MCPcopy Create free account
hub / github.com/nwutils/nw-sample-apps / element

Function element

mini-code-edit/cm/mode/xml/xml.js:190–210  ·  view source on GitHub ↗
(type)

Source from the content-addressed store, hash-verified

188 }
189
190 function element(type) {
191 if (type == "openTag") {
192 curState.tagName = tagName;
193 return cont(attributes, endtag(curState.startOfLine));
194 } else if (type == "closeTag") {
195 var err = false;
196 if (curState.context) {
197 if (curState.context.tagName != tagName) {
198 if (Kludges.implicitlyClosed.hasOwnProperty(curState.context.tagName.toLowerCase())) {
199 popContext();
200 }
201 err = !curState.context || curState.context.tagName != tagName;
202 }
203 } else {
204 err = true;
205 }
206 if (err) setStyle = "error";
207 return cont(endclosetag(err));
208 }
209 return cont();
210 }
211 function endtag(startOfLine) {
212 return function(type) {
213 if (type == "selfcloseTag" ||

Callers

nothing calls this directly

Calls 4

endtagFunction · 0.85
endclosetagFunction · 0.85
contFunction · 0.70
popContextFunction · 0.70

Tested by

no test coverage detected