Fix for '</' constructs.

Fixes #12.
This commit is contained in:
Ingvar Stepanyan 2015-01-11 23:36:41 +02:00
parent f188613e09
commit eb37a57fb0
3 changed files with 44 additions and 2 deletions

View File

@ -789,7 +789,7 @@
size = input.charCodeAt(tokPos + 2) === 61 ? 3 : 2;
return finishOp(_relational, size);
}
if (next === 47) {
if (code === 60 && next === 47) {
// '</', beginning of JSX closing element
size = 2;
return finishOp(_ltSlash, size);

View File

@ -2,7 +2,7 @@
"name": "acorn-jsx",
"description": "Alternative React JSX parser",
"main": "acorn.js",
"version": "0.9.1-7",
"version": "0.9.1-8",
"maintainers": [
{
"name": "Marijn Haverbeke",

View File

@ -3400,6 +3400,48 @@ var fbTestFixture = {
}
}]
}
},
'<div>/text</div>': {
type: "ExpressionStatement",
start: 0,
end: 16,
expression: {
type: "XJSElement",
start: 0,
end: 16,
openingElement: {
type: "XJSOpeningElement",
start: 0,
end: 5,
attributes: [],
name: {
type: "XJSIdentifier",
start: 1,
end: 4,
name: "div"
},
selfClosing: false
},
closingElement: {
type: "XJSClosingElement",
start: 10,
end: 16,
name: {
type: "XJSIdentifier",
start: 12,
end: 15,
name: "div"
}
},
children: [{
type: "Literal",
start: 5,
end: 10,
value: "/text",
raw: "/text"
}]
}
}
}
};