MCPcopy Create free account
hub / github.com/ronreiter/interactive-tutorials / element

Function element

static/js/codemirror/mode/xml/xml.js:191–211  ·  view source on GitHub ↗
(type)

Source from the content-addressed store, hash-verified

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

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