Fixed in-tag spaces in hacky way (to be refactored).

Conflicts:
	acorn.js
This commit is contained in:
Ingvar Stepanyan 2014-07-10 22:45:47 +03:00
parent 292942c1d8
commit 7560ba4c94

View File

@ -544,7 +544,9 @@
tokEnd = tokPos; tokEnd = tokPos;
if (options.locations) tokEndLoc = new Position; if (options.locations) tokEndLoc = new Position;
tokType = type; tokType = type;
if (shouldSkipSpace !== false) skipSpace(); if (shouldSkipSpace !== false && !(inXJSTag && val === '>')) {
skipSpace();
}
tokVal = val; tokVal = val;
tokRegexpAllowed = type.beforeExpr; tokRegexpAllowed = type.beforeExpr;
if (options.onToken) { if (options.onToken) {
@ -3056,6 +3058,7 @@
expectChar('<'); expectChar('<');
expect(_slash); expect(_slash);
node.name = parseXJSElementName(); node.name = parseXJSElementName();
skipSpace();
// Because advance() (called by lex() called by expect()) expects there // Because advance() (called by lex() called by expect()) expects there
// to be a valid token after >, it needs to know whether to look for a // to be a valid token after >, it needs to know whether to look for a
// standard JS token or an XJS text node // standard JS token or an XJS text node
@ -3082,16 +3085,18 @@
attributes.push(parseXJSAttribute()); attributes.push(parseXJSAttribute());
} }
inXJSTag = origInXJSTag; inXJSTag = false;
if (eat(_slash)) { if (eat(_slash)) {
inXJSTag = origInXJSTag;
inXJSChild = origInXJSChild; inXJSChild = origInXJSChild;
node.selfClosing = true; node.selfClosing = true;
expectChar('>');
} else { } else {
inXJSChild = true; inXJSChild = true;
node.selfClosing = false; node.selfClosing = false;
expectChar('>');
} }
expectChar('>');
return finishNode(node, "XJSOpeningElement"); return finishNode(node, "XJSOpeningElement");
} }
@ -3103,8 +3108,8 @@
var openingElement = parseXJSOpeningElement(); var openingElement = parseXJSOpeningElement();
if (!openingElement.selfClosing) { if (!openingElement.selfClosing) {
inXJSChild = true;
while (tokType !== _eof && !(tokVal === '<' && nextChar() === '/')) { while (tokType !== _eof && !(tokVal === '<' && nextChar() === '/')) {
inXJSChild = true;
children.push(parseXJSChild()); children.push(parseXJSChild());
} }
inXJSChild = origInXJSChild; inXJSChild = origInXJSChild;