vendor/assets/javascripts/codemirror/modes/xml.js in codemirror-rails-0.2.3 vs vendor/assets/javascripts/codemirror/modes/xml.js in codemirror-rails-0.3.0
- old
+ new
@@ -130,11 +130,10 @@
if (type == "openTag") {curState.tagName = tagName; return cont(attributes, endtag(curState.startOfLine));}
else if (type == "closeTag") {
var err = false;
if (curState.context) {
err = curState.context.tagName != tagName;
- popContext();
} else {
err = true;
}
if (err) setStyle = "error";
return cont(endclosetag(err));
@@ -156,12 +155,13 @@
};
}
function endclosetag(err) {
return function(type) {
if (err) setStyle = "error";
- if (type == "endTag") return cont();
- return pass();
+ if (type == "endTag") { popContext(); return cont(); }
+ setStyle = "error";
+ return cont(arguments.callee);
}
}
function attributes(type) {
if (type == "word") {setStyle = "attribute"; return cont(attributes);}
@@ -214,10 +214,10 @@
if (context) return context.indent + indentUnit;
else return 0;
},
compareStates: function(a, b) {
- if (a.indented != b.indented || a.tagName != b.tagName) return false;
+ if (a.indented != b.indented) return false;
for (var ca = a.context, cb = b.context; ; ca = ca.prev, cb = cb.prev) {
if (!ca || !cb) return ca == cb;
if (ca.tagName != cb.tagName) return false;
}
},