Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "",
"offset": 10,
},
},
- "type": 1,
+ "type": 3,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "",
"offset": 10,
},
},
- "type": 1,
+ "type": 3,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "",
"offset": 10,
},
},
- "type": 1,
+ "type": 3,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 35,
- "line": 1,
- "offset": 34,
- },
- "source": "<template attr=\\"c\\"></template>",
- "start": Object {
- "column": 1,
- "line": 1,
- "offset": 0,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "attr",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "c",
"isEmpty": false,
"offset": 15,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 35,
+ "line": 1,
+ "offset": 34,
+ },
+ "source": "<template attr=\\"c\\"></template>",
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ "offset": 0,
+ },
+ },
+ "ns": 0,
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 34,
- "line": 1,
- "offset": 33,
- },
- "source": "<template attr=\\"&#a;\\"></template>",
- "start": Object {
- "column": 1,
- "line": 1,
- "offset": 0,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "attr",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "&#a;",
"isEmpty": false,
"offset": 15,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 34,
+ "line": 1,
+ "offset": 33,
+ },
+ "source": "<template attr=\\"&#a;\\"></template>",
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ "offset": 0,
+ },
+ },
+ "ns": 0,
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 36,
- "line": 1,
- "offset": 35,
- },
- "source": "<template attr=\\"ÿ\\"></template>",
- "start": Object {
- "column": 1,
- "line": 1,
- "offset": 0,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "attr",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "ΓΏ",
"isEmpty": false,
"offset": 15,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 36,
+ "line": 1,
+ "offset": 35,
+ },
+ "source": "<template attr=\\"ÿ\\"></template>",
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ "offset": 0,
+ },
+ },
+ "ns": 0,
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 35,
- "line": 1,
- "offset": 34,
- },
- "source": "<template attr=\\"&#xg;\\"></template>",
- "start": Object {
- "column": 1,
- "line": 1,
- "offset": 0,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "attr",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "&#xg;",
"isEmpty": false,
"offset": 15,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 35,
+ "line": 1,
+ "offset": 34,
+ },
+ "source": "<template attr=\\"&#xg;\\"></template>",
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ "offset": 0,
+ },
+ },
+ "ns": 0,
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "c",
"offset": 10,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "&#a;",
"offset": 10,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "ΓΏ",
"offset": 10,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "&#xg;",
"offset": 10,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "[CDATA[cdata]]",
"offset": 10,
},
},
- "type": 1,
+ "type": 3,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "cdata",
"offset": 24,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 1,
- "props": Array [],
"tag": "svg",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "οΏ½",
"offset": 10,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "\ 3",
"offset": 10,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "\7f",
"offset": 10,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 34,
- "line": 1,
- "offset": 33,
- },
- "source": "<div id=\\"\\" id=\\"\\"></div>",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "id",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "",
"isEmpty": true,
"offset": 18,
},
},
- "type": 0,
+ "type": 2,
},
},
Object {
},
},
"name": "id",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "",
"isEmpty": true,
"offset": 24,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 34,
+ "line": 1,
+ "offset": 33,
+ },
+ "source": "<div id=\\"\\" id=\\"\\"></div>",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "<",
"offset": 10,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "</",
"offset": 10,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 1,
- "props": Array [],
"tag": "svg",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "cdata",
"offset": 24,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 1,
- "props": Array [],
"tag": "svg",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "",
"offset": 10,
},
},
- "type": 1,
+ "type": 3,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "-",
"offset": 10,
},
},
- "type": 1,
+ "type": 3,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "",
"offset": 10,
},
},
- "type": 1,
+ "type": 3,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "comment",
"offset": 10,
},
},
- "type": 1,
+ "type": 3,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "abc",
"offset": 10,
},
},
- "type": 1,
+ "type": 3,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "<!--console.log('hello')",
"offset": 8,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "script",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "console.log('hello')",
"offset": 8,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "script",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 1,
- "offset": 18,
- },
- "source": "<div id ",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "id",
- "type": 3,
+ "type": 5,
"value": undefined,
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 1,
+ "offset": 18,
+ },
+ "source": "<div id ",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 20,
- "line": 1,
- "offset": 19,
- },
- "source": "<div id =",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "id",
- "type": 3,
+ "type": 5,
"value": undefined,
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 20,
+ "line": 1,
+ "offset": 19,
+ },
+ "source": "<div id =",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 18,
- "line": 1,
- "offset": 17,
- },
- "source": "<div id",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "id",
- "type": 3,
+ "type": 5,
"value": undefined,
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 18,
+ "line": 1,
+ "offset": 17,
+ },
+ "source": "<div id",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 1,
- "offset": 22,
- },
- "source": "<div id=\\"abc",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "id",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "abc",
"isEmpty": false,
"offset": 18,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 1,
+ "offset": 22,
+ },
+ "source": "<div id=\\"abc",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 1,
- "offset": 23,
- },
- "source": "<div id=\\"abc\\"",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "id",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "abc",
"isEmpty": false,
"offset": 18,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 1,
+ "offset": 23,
+ },
+ "source": "<div id=\\"abc\\"",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 1,
- "offset": 24,
- },
- "source": "<div id=\\"abc\\"/",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "id",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "abc",
"isEmpty": false,
"offset": 18,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ "offset": 24,
+ },
+ "source": "<div id=\\"abc\\"/",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 23,
- "line": 1,
- "offset": 22,
- },
- "source": "<div id='abc",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "id",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "abc",
"isEmpty": false,
"offset": 18,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 23,
+ "line": 1,
+ "offset": 22,
+ },
+ "source": "<div id='abc",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 1,
- "offset": 23,
- },
- "source": "<div id='abc'",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "id",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "abc",
"isEmpty": false,
"offset": 18,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 1,
+ "offset": 23,
+ },
+ "source": "<div id='abc'",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 25,
- "line": 1,
- "offset": 24,
- },
- "source": "<div id='abc'/",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "id",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "abc",
"isEmpty": false,
"offset": 18,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 25,
+ "line": 1,
+ "offset": 24,
+ },
+ "source": "<div id='abc'/",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 1,
- "offset": 23,
- },
- "source": "<div id=abc /",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "id",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "abc",
"isEmpty": false,
"offset": 18,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 1,
+ "offset": 23,
+ },
+ "source": "<div id=abc /",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 22,
- "line": 1,
- "offset": 21,
- },
- "source": "<div id=abc",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "id",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "abc",
"isEmpty": false,
"offset": 18,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 22,
+ "line": 1,
+ "offset": 21,
+ },
+ "source": "<div id=abc",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "comment",
"offset": 10,
},
},
- "type": 1,
+ "type": 3,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
"offset": 0,
},
},
- "type": 1,
+ "type": 3,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "",
"offset": 10,
},
},
- "type": 1,
+ "type": 3,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "-",
"offset": 10,
},
},
- "type": 1,
+ "type": 3,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "ELEMENT br EMPTY",
"offset": 10,
},
},
- "type": 1,
+ "type": 3,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "οΏ½",
"offset": 10,
},
},
- "type": 1,
+ "type": 3,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "<οΏ½>",
"offset": 10,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "a < b",
"type": 4,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "a < b",
"offset": 10,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "a ",
"offset": 10,
},
},
- "type": 0,
+ "type": 2,
},
Object {
"content": " b</template",
"offset": 12,
},
},
- "type": 1,
+ "type": 3,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 28,
- "line": 1,
- "offset": 27,
- },
- "source": "<div id= /></div>",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "id",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "/",
"isEmpty": false,
"offset": 19,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 28,
+ "line": 1,
+ "offset": 27,
+ },
+ "source": "<div id= /></div>",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 27,
- "line": 1,
- "offset": 26,
- },
- "source": "<div id= ></div>",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "id",
- "type": 3,
+ "type": 5,
"value": undefined,
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 27,
+ "line": 1,
+ "offset": 26,
+ },
+ "source": "<div id= ></div>",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 26,
- "line": 1,
- "offset": 25,
- },
- "source": "<div id=></div>",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "id",
- "type": 3,
+ "type": 5,
"value": undefined,
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 1,
+ "offset": 25,
+ },
+ "source": "<div id=></div>",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "(",
"offset": 10,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "@",
"offset": 10,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "&",
"offset": 10,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 19,
- "line": 2,
- "offset": 43,
- },
- "source": "<div id=\\"foo\\"
-class=\\"bar\\"></div>",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "id",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "foo",
"isEmpty": false,
"offset": 18,
},
},
- "type": 0,
+ "type": 2,
},
},
Object {
},
},
"name": "class",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "bar",
"isEmpty": false,
"offset": 31,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 19,
+ "line": 2,
+ "offset": 43,
+ },
+ "source": "<div id=\\"foo\\"
+class=\\"bar\\"></div>",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 42,
- "line": 1,
- "offset": 41,
- },
- "source": "<div id=\\"foo\\"class=\\"bar\\"></div>",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "id",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "foo",
"isEmpty": false,
"offset": 18,
},
},
- "type": 0,
+ "type": 2,
},
},
Object {
},
},
"name": "class",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "bar",
"isEmpty": false,
"offset": 29,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 42,
+ "line": 1,
+ "offset": 41,
+ },
+ "source": "<div id=\\"foo\\"class=\\"bar\\"></div>",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "a<!--",
"offset": 10,
},
},
- "type": 1,
+ "type": 3,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "a<!",
"offset": 10,
},
},
- "type": 1,
+ "type": 3,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "a<!--b<!--c",
"offset": 10,
},
},
- "type": 1,
+ "type": 3,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "a<!--b",
"offset": 10,
},
},
- "type": 1,
+ "type": 3,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "πΏΏ",
"offset": 10,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "οΏΎ",
"offset": 10,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "οΏ½",
"offset": 10,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "οΏ½",
"offset": 10,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 30,
- "line": 1,
- "offset": 29,
- },
- "source": "<div a\\"bc=''></div>",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "a\\"bc",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "",
"isEmpty": true,
"offset": 20,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 1,
+ "offset": 29,
+ },
+ "source": "<div a\\"bc=''></div>",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 30,
- "line": 1,
- "offset": 29,
- },
- "source": "<div a'bc=''></div>",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "a'bc",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "",
"isEmpty": true,
"offset": 20,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 1,
+ "offset": 29,
+ },
+ "source": "<div a'bc=''></div>",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 30,
- "line": 1,
- "offset": 29,
- },
- "source": "<div a<bc=''></div>",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "a<bc",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "",
"isEmpty": true,
"offset": 20,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 30,
+ "line": 1,
+ "offset": 29,
+ },
+ "source": "<div a<bc=''></div>",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 31,
- "line": 1,
- "offset": 30,
- },
- "source": "<div foo=bar\\"></div>",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "foo",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "bar\\"",
"isEmpty": false,
"offset": 19,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 1,
+ "offset": 30,
+ },
+ "source": "<div foo=bar\\"></div>",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 31,
- "line": 1,
- "offset": 30,
- },
- "source": "<div foo=bar'></div>",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "foo",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "bar'",
"isEmpty": false,
"offset": 19,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 1,
+ "offset": 30,
+ },
+ "source": "<div foo=bar'></div>",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 34,
- "line": 1,
- "offset": 33,
- },
- "source": "<div foo=bar<div></div>",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "foo",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "bar<div",
"isEmpty": false,
"offset": 19,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 34,
+ "line": 1,
+ "offset": 33,
+ },
+ "source": "<div foo=bar<div></div>",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 34,
- "line": 1,
- "offset": 33,
- },
- "source": "<div foo=bar=baz></div>",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "foo",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "bar=baz",
"isEmpty": false,
"offset": 19,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 34,
+ "line": 1,
+ "offset": 33,
+ },
+ "source": "<div foo=bar=baz></div>",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 31,
- "line": 1,
- "offset": 30,
- },
- "source": "<div foo=bar\`></div>",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "foo",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "bar\`",
"isEmpty": false,
"offset": 19,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 1,
+ "offset": 30,
+ },
+ "source": "<div foo=bar\`></div>",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 24,
- "line": 1,
- "offset": 23,
- },
- "source": "<div =></div>",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "=",
- "type": 3,
+ "type": 5,
"value": undefined,
},
- ],
+ ],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 24,
+ "line": 1,
+ "offset": 23,
+ },
+ "source": "<div =></div>",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 31,
- "line": 1,
- "offset": 30,
- },
- "source": "<div =foo=bar></div>",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "=foo",
- "type": 3,
+ "type": 5,
"value": Object {
"content": "bar",
"isEmpty": false,
"offset": 20,
},
},
- "type": 0,
+ "type": 2,
},
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 31,
+ "line": 1,
+ "offset": 30,
+ },
+ "source": "<div =foo=bar></div>",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "?xml?",
"offset": 10,
},
},
- "type": 1,
+ "type": 3,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
- "children": Array [],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 26,
- "line": 1,
- "offset": 25,
- },
- "source": "<div a/b></div>",
- "start": Object {
- "column": 11,
- "line": 1,
- "offset": 10,
- },
- },
- "ns": 0,
- "props": Array [
+ "attrs": Array [
Object {
"loc": Object {
"end": Object {
},
},
"name": "a",
- "type": 3,
+ "type": 5,
"value": undefined,
},
Object {
},
},
"name": "b",
- "type": 3,
+ "type": 5,
"value": undefined,
},
],
+ "children": Array [],
+ "directives": Array [],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 26,
+ "line": 1,
+ "offset": 25,
+ },
+ "source": "<div a/b></div>",
+ "start": Object {
+ "column": 11,
+ "line": 1,
+ "offset": 10,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "&unknown;",
"offset": 10,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "</div>",
"offset": 14,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 1,
- "props": Array [],
"tag": "svg",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "</div>",
"offset": 5,
},
},
- "type": 1,
+ "type": 3,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 1,
- "props": Array [],
"tag": "svg",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "'</div>'",
"type": 4,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
"content": "</div>",
"offset": 10,
},
},
- "type": 0,
+ "type": 2,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "textarea",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "template",
"tagType": 3,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
"offset": 0,
},
},
- "type": 0,
+ "type": 2,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
"offset": 0,
},
},
- "type": 0,
+ "type": 2,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "span",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
+ "directives": Array [],
"isSelfClosing": false,
"loc": Object {
"end": Object {
},
},
"ns": 0,
- "props": Array [],
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [],
- "isSelfClosing": true,
- "loc": Object {
- "end": Object {
- "column": 37,
- "line": 1,
- "offset": 36,
- },
- "source": "<div :class=\\"{ some: condition }\\" />",
- "start": Object {
- "column": 1,
- "line": 1,
- "offset": 0,
- },
- },
- "ns": 0,
- "props": Array [
+ "directives": Array [
Object {
"arg": Object {
"content": "class",
},
"modifiers": Array [],
"name": "bind",
- "type": 5,
+ "type": 6,
},
],
- "tag": "div",
- "tagType": 0,
- "type": 2,
- },
- Object {
- "children": Array [],
"isSelfClosing": true,
"loc": Object {
"end": Object {
"column": 37,
- "line": 2,
- "offset": 73,
+ "line": 1,
+ "offset": 36,
},
- "source": "<p v-bind:style=\\"{ color: 'red' }\\"/>",
+ "source": "<div :class=\\"{ some: condition }\\" />",
"start": Object {
"column": 1,
- "line": 2,
- "offset": 37,
+ "line": 1,
+ "offset": 0,
},
},
"ns": 0,
- "props": Array [
+ "tag": "div",
+ "tagType": 0,
+ "type": 1,
+ },
+ Object {
+ "attrs": Array [],
+ "children": Array [],
+ "directives": Array [
Object {
"arg": Object {
"content": "style",
},
"modifiers": Array [],
"name": "bind",
- "type": 5,
+ "type": 6,
},
],
+ "isSelfClosing": true,
+ "loc": Object {
+ "end": Object {
+ "column": 37,
+ "line": 2,
+ "offset": 73,
+ },
+ "source": "<p v-bind:style=\\"{ color: 'red' }\\"/>",
+ "start": Object {
+ "column": 1,
+ "line": 2,
+ "offset": 37,
+ },
+ },
+ "ns": 0,
"tag": "p",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
Object {
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [
Object {
+ "attrs": Array [],
"children": Array [],
- "isSelfClosing": true,
- "loc": Object {
- "end": Object {
- "column": 38,
- "line": 2,
- "offset": 73,
- },
- "source": "<p v-bind:style=\\"{ color: 'red' }\\"/>",
- "start": Object {
- "column": 2,
- "line": 2,
- "offset": 37,
- },
- },
- "ns": 0,
- "props": Array [
+ "directives": Array [
Object {
"arg": Object {
"content": "style",
},
"modifiers": Array [],
"name": "bind",
- "type": 5,
+ "type": 6,
},
],
+ "isSelfClosing": true,
+ "loc": Object {
+ "end": Object {
+ "column": 38,
+ "line": 2,
+ "offset": 73,
+ },
+ "source": "<p v-bind:style=\\"{ color: 'red' }\\"/>",
+ "start": Object {
+ "column": 2,
+ "line": 2,
+ "offset": 37,
+ },
+ },
+ "ns": 0,
"tag": "p",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
Object {
"content": " a comment with <html> inside it ",
"offset": 76,
},
},
- "type": 1,
+ "type": 3,
},
],
- "isSelfClosing": false,
- "loc": Object {
- "end": Object {
- "column": 7,
- "line": 4,
- "offset": 123,
- },
- "source": "<div :class=\\"{ some: condition }\\">
- <p v-bind:style=\\"{ color: 'red' }\\"/>
- <!-- a comment with <html> inside it -->
-</div>",
- "start": Object {
- "column": 1,
- "line": 1,
- "offset": 0,
- },
- },
- "ns": 0,
- "props": Array [
+ "directives": Array [
Object {
"arg": Object {
"content": "class",
},
"modifiers": Array [],
"name": "bind",
- "type": 5,
+ "type": 6,
},
],
+ "isSelfClosing": false,
+ "loc": Object {
+ "end": Object {
+ "column": 7,
+ "line": 4,
+ "offset": 123,
+ },
+ "source": "<div :class=\\"{ some: condition }\\">
+ <p v-bind:style=\\"{ color: 'red' }\\"/>
+ <!-- a comment with <html> inside it -->
+</div>",
+ "start": Object {
+ "column": 1,
+ "line": 1,
+ "offset": 0,
+ },
+ },
+ "ns": 0,
"tag": "div",
"tagType": 0,
- "type": 2,
+ "type": 1,
},
],
"loc": Object {
"offset": 0,
},
},
- "type": 6,
+ "type": 0,
}
`;
-import { parse, ParserOptions, TextModes } from '../src/parser'
-import { ParserErrorTypes } from '../src/errorTypes'
+import { parse, ParserOptions, TextModes } from '../src/parse'
+import { ErrorCodes } from '../src/errors'
import {
CommentNode,
- DirectiveNode,
ElementNode,
ElementTypes,
ExpressionNode,
test('lonly "<" don\'t separate nodes', () => {
const ast = parse('a < b', {
- onError: errorCode => {
- if (
- errorCode !== ParserErrorTypes.INVALID_FIRST_CHARACTER_OF_TAG_NAME
- ) {
- throw new Error(`${errorCode}`)
+ onError: err => {
+ if (err.code !== ErrorCodes.INVALID_FIRST_CHARACTER_OF_TAG_NAME) {
+ throw err
}
}
})
test('lonly "{{" don\'t separate nodes', () => {
const ast = parse('a {{ b', {
- onError: errorCode => {
- if (errorCode !== ParserErrorTypes.X_MISSING_INTERPOLATION_END) {
- throw new Error(`${errorCode}`)
+ onError: error => {
+ if (error.code !== ErrorCodes.X_MISSING_INTERPOLATION_END) {
+ throw error
}
}
})
source: '&ersand;'
}
})
- expect(spy.mock.calls).toEqual([
+ expect(spy.mock.calls).toMatchObject([
[
- ParserErrorTypes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE,
- { offset: 4, line: 1, column: 5 }
+ {
+ code: ErrorCodes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE,
+ loc: { offset: 4, line: 1, column: 5 }
+ }
]
])
})
}
)
const element = ast.children[0] as ElementNode
- const text1 = (element.props[0] as AttributeNode).value
- const text2 = (element.props[1] as AttributeNode).value
- const text3 = (element.props[2] as AttributeNode).value
+ const text1 = (element.attrs[0] as AttributeNode).value
+ const text2 = (element.attrs[1] as AttributeNode).value
+ const text3 = (element.attrs[2] as AttributeNode).value
expect(text1).toStrictEqual({
type: NodeTypes.TEXT,
source: '"&!"'
}
})
- expect(spy.mock.calls).toEqual([
+ expect(spy.mock.calls).toMatchObject([
[
- ParserErrorTypes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE,
- { offset: 45, line: 1, column: 46 }
+ {
+ code: ErrorCodes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE,
+ loc: { offset: 45, line: 1, column: 46 }
+ }
]
])
})
source: '†'
}
})
- expect(spy.mock.calls).toEqual([
+ expect(spy.mock.calls).toMatchObject([
[
- ParserErrorTypes.CONTROL_CHARACTER_REFERENCE,
- { offset: 0, line: 1, column: 1 }
+ {
+ code: ErrorCodes.CONTROL_CHARACTER_REFERENCE,
+ loc: { offset: 0, line: 1, column: 1 }
+ }
]
])
})
ns: Namespaces.HTML,
tag: 'div',
tagType: ElementTypes.ELEMENT,
- props: [],
+ attrs: [],
+ directives: [],
isSelfClosing: false,
children: [
{
ns: Namespaces.HTML,
tag: 'div',
tagType: ElementTypes.ELEMENT,
- props: [],
+ attrs: [],
+ directives: [],
isSelfClosing: false,
children: [],
loc: {
ns: Namespaces.HTML,
tag: 'div',
tagType: ElementTypes.ELEMENT,
- props: [],
+ attrs: [],
+ directives: [],
isSelfClosing: true,
children: [],
loc: {
ns: Namespaces.HTML,
tag: 'img',
tagType: ElementTypes.ELEMENT,
- props: [],
+ attrs: [],
+ directives: [],
isSelfClosing: false,
children: [],
loc: {
ns: Namespaces.HTML,
tag: 'div',
tagType: ElementTypes.ELEMENT,
- props: [
+ attrs: [
{
type: NodeTypes.ATTRIBUTE,
name: 'id',
}
}
],
+ directives: [],
isSelfClosing: false,
children: [],
loc: {
ns: Namespaces.HTML,
tag: 'div',
tagType: ElementTypes.ELEMENT,
- props: [
+ attrs: [
{
type: NodeTypes.ATTRIBUTE,
name: 'id',
}
}
],
+ directives: [],
isSelfClosing: false,
children: [],
loc: {
ns: Namespaces.HTML,
tag: 'div',
tagType: ElementTypes.ELEMENT,
- props: [
+ attrs: [
{
type: NodeTypes.ATTRIBUTE,
name: 'id',
}
}
],
+ directives: [],
isSelfClosing: false,
children: [],
loc: {
ns: Namespaces.HTML,
tag: 'div',
tagType: ElementTypes.ELEMENT,
- props: [
+ attrs: [
{
type: NodeTypes.ATTRIBUTE,
name: 'id',
}
}
],
+ directives: [],
isSelfClosing: false,
children: [],
loc: {
ns: Namespaces.HTML,
tag: 'div',
tagType: ElementTypes.ELEMENT,
- props: [
+ attrs: [
{
type: NodeTypes.ATTRIBUTE,
name: 'id',
}
}
],
+ directives: [],
isSelfClosing: false,
children: [],
loc: {
ns: Namespaces.HTML,
tag: 'div',
tagType: ElementTypes.ELEMENT,
- props: [
+ attrs: [
{
type: NodeTypes.ATTRIBUTE,
name: 'id',
}
}
],
+ directives: [],
isSelfClosing: false,
children: [],
loc: {
ns: Namespaces.HTML,
tag: 'div',
tagType: ElementTypes.ELEMENT,
- props: [
+ attrs: [
{
type: NodeTypes.ATTRIBUTE,
name: 'id',
}
}
],
+ directives: [],
isSelfClosing: false,
children: [],
loc: {
test('directive with no value', () => {
const ast = parse('<div v-if/>')
- const directive = (ast.children[0] as ElementNode)
- .props[0] as DirectiveNode
+ const directive = (ast.children[0] as ElementNode).directives[0]
expect(directive).toStrictEqual({
type: NodeTypes.DIRECTIVE,
test('directive with value', () => {
const ast = parse('<div v-if="a"/>')
- const directive = (ast.children[0] as ElementNode)
- .props[0] as DirectiveNode
+ const directive = (ast.children[0] as ElementNode).directives[0]
expect(directive).toStrictEqual({
type: NodeTypes.DIRECTIVE,
test('directive with argument', () => {
const ast = parse('<div v-on:click/>')
- const directive = (ast.children[0] as ElementNode)
- .props[0] as DirectiveNode
+ const directive = (ast.children[0] as ElementNode).directives[0]
expect(directive).toStrictEqual({
type: NodeTypes.DIRECTIVE,
test('directive with a modifier', () => {
const ast = parse('<div v-on.enter/>')
- const directive = (ast.children[0] as ElementNode)
- .props[0] as DirectiveNode
+ const directive = (ast.children[0] as ElementNode).directives[0]
expect(directive).toStrictEqual({
type: NodeTypes.DIRECTIVE,
test('directive with two modifiers', () => {
const ast = parse('<div v-on.enter.exact/>')
- const directive = (ast.children[0] as ElementNode)
- .props[0] as DirectiveNode
+ const directive = (ast.children[0] as ElementNode).directives[0]
expect(directive).toStrictEqual({
type: NodeTypes.DIRECTIVE,
test('directive with argument and modifiers', () => {
const ast = parse('<div v-on:click.enter.exact/>')
- const directive = (ast.children[0] as ElementNode)
- .props[0] as DirectiveNode
+ const directive = (ast.children[0] as ElementNode).directives[0]
expect(directive).toStrictEqual({
type: NodeTypes.DIRECTIVE,
test('v-bind shorthand', () => {
const ast = parse('<div :a=b />')
- const directive = (ast.children[0] as ElementNode)
- .props[0] as DirectiveNode
+ const directive = (ast.children[0] as ElementNode).directives[0]
expect(directive).toStrictEqual({
type: NodeTypes.DIRECTIVE,
test('v-bind shorthand with modifier', () => {
const ast = parse('<div :a.sync=b />')
- const directive = (ast.children[0] as ElementNode)
- .props[0] as DirectiveNode
+ const directive = (ast.children[0] as ElementNode).directives[0]
expect(directive).toStrictEqual({
type: NodeTypes.DIRECTIVE,
test('v-on shorthand', () => {
const ast = parse('<div @a=b />')
- const directive = (ast.children[0] as ElementNode)
- .props[0] as DirectiveNode
+ const directive = (ast.children[0] as ElementNode).directives[0]
expect(directive).toStrictEqual({
type: NodeTypes.DIRECTIVE,
test('v-on shorthand with modifier', () => {
const ast = parse('<div @a.enter=b />')
- const directive = (ast.children[0] as ElementNode)
- .props[0] as DirectiveNode
+ const directive = (ast.children[0] as ElementNode).directives[0]
expect(directive).toStrictEqual({
type: NodeTypes.DIRECTIVE,
onError: spy
})
- expect(spy).toBeCalledWith(ParserErrorTypes.X_MISSING_END_TAG, {
- offset: 13,
- line: 3,
- column: 1
- })
- expect(spy).toBeCalledWith(ParserErrorTypes.X_INVALID_END_TAG, {
- offset: 20,
- line: 4,
- column: 1
- })
+ expect(spy.mock.calls).toMatchObject([
+ [
+ {
+ code: ErrorCodes.X_MISSING_END_TAG,
+ loc: {
+ offset: 13,
+ line: 3,
+ column: 1
+ }
+ }
+ ],
+ [
+ {
+ code: ErrorCodes.X_INVALID_END_TAG,
+ loc: {
+ offset: 20,
+ line: 4,
+ column: 1
+ }
+ }
+ ]
+ ])
+
expect(ast).toMatchSnapshot()
})
const patterns: {
[key: string]: Array<{
code: string
- errors: Array<{ type: ParserErrorTypes; loc: Position }>
+ errors: Array<{ type: ErrorCodes; loc: Position }>
options?: Partial<ParserOptions>
}>
} = {
code: '<template><!--></template>',
errors: [
{
- type: ParserErrorTypes.ABRUPT_CLOSING_OF_EMPTY_COMMENT,
+ type: ErrorCodes.ABRUPT_CLOSING_OF_EMPTY_COMMENT,
loc: { offset: 10, line: 1, column: 11 }
}
]
code: '<template><!---></template>',
errors: [
{
- type: ParserErrorTypes.ABRUPT_CLOSING_OF_EMPTY_COMMENT,
+ type: ErrorCodes.ABRUPT_CLOSING_OF_EMPTY_COMMENT,
loc: { offset: 10, line: 1, column: 11 }
}
]
code: '<template>&#a;</template>',
errors: [
{
- type:
- ParserErrorTypes.ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE,
+ type: ErrorCodes.ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE,
loc: { offset: 10, line: 1, column: 11 }
}
]
code: '<template>&#xg;</template>',
errors: [
{
- type:
- ParserErrorTypes.ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE,
+ type: ErrorCodes.ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE,
loc: { offset: 10, line: 1, column: 11 }
}
]
code: '<template attr="&#a;"></template>',
errors: [
{
- type:
- ParserErrorTypes.ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE,
+ type: ErrorCodes.ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE,
loc: { offset: 16, line: 1, column: 17 }
}
]
code: '<template attr="&#xg;"></template>',
errors: [
{
- type:
- ParserErrorTypes.ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE,
+ type: ErrorCodes.ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE,
loc: { offset: 16, line: 1, column: 17 }
}
]
code: '<template><![CDATA[cdata]]></template>',
errors: [
{
- type: ParserErrorTypes.CDATA_IN_HTML_CONTENT,
+ type: ErrorCodes.CDATA_IN_HTML_CONTENT,
loc: { offset: 10, line: 1, column: 11 }
}
]
code: '<template>�</template>',
errors: [
{
- type: ParserErrorTypes.CHARACTER_REFERENCE_OUTSIDE_UNICODE_RANGE,
+ type: ErrorCodes.CHARACTER_REFERENCE_OUTSIDE_UNICODE_RANGE,
loc: { offset: 10, line: 1, column: 11 }
}
]
code: '<template></template>',
errors: [
{
- type: ParserErrorTypes.CONTROL_CHARACTER_REFERENCE,
+ type: ErrorCodes.CONTROL_CHARACTER_REFERENCE,
loc: { offset: 10, line: 1, column: 11 }
}
]
code: '<template></template>',
errors: [
{
- type: ParserErrorTypes.CONTROL_CHARACTER_REFERENCE,
+ type: ErrorCodes.CONTROL_CHARACTER_REFERENCE,
loc: { offset: 10, line: 1, column: 11 }
}
]
code: '<template><div id="" id=""></div></template>',
errors: [
{
- type: ParserErrorTypes.DUPLICATE_ATTRIBUTE,
+ type: ErrorCodes.DUPLICATE_ATTRIBUTE,
loc: { offset: 21, line: 1, column: 22 }
}
]
code: '<template><div></div id=""></template>',
errors: [
{
- type: ParserErrorTypes.END_TAG_WITH_ATTRIBUTES,
+ type: ErrorCodes.END_TAG_WITH_ATTRIBUTES,
loc: { offset: 21, line: 1, column: 22 }
}
]
code: '<template><div></div/></template>',
errors: [
{
- type: ParserErrorTypes.END_TAG_WITH_TRAILING_SOLIDUS,
+ type: ErrorCodes.END_TAG_WITH_TRAILING_SOLIDUS,
loc: { offset: 20, line: 1, column: 21 }
}
]
code: '<template><',
errors: [
{
- type: ParserErrorTypes.EOF_BEFORE_TAG_NAME,
+ type: ErrorCodes.EOF_BEFORE_TAG_NAME,
loc: { offset: 11, line: 1, column: 12 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 11, line: 1, column: 12 }
}
]
code: '<template></',
errors: [
{
- type: ParserErrorTypes.EOF_BEFORE_TAG_NAME,
+ type: ErrorCodes.EOF_BEFORE_TAG_NAME,
loc: { offset: 12, line: 1, column: 13 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 12, line: 1, column: 13 }
}
]
code: '<template><svg><![CDATA[cdata',
errors: [
{
- type: ParserErrorTypes.EOF_IN_CDATA,
+ type: ErrorCodes.EOF_IN_CDATA,
loc: { offset: 29, line: 1, column: 30 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 29, line: 1, column: 30 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 29, line: 1, column: 30 }
}
]
code: '<template><svg><![CDATA[',
errors: [
{
- type: ParserErrorTypes.EOF_IN_CDATA,
+ type: ErrorCodes.EOF_IN_CDATA,
loc: { offset: 24, line: 1, column: 25 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 24, line: 1, column: 25 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 24, line: 1, column: 25 }
}
]
code: '<template><!--comment',
errors: [
{
- type: ParserErrorTypes.EOF_IN_COMMENT,
+ type: ErrorCodes.EOF_IN_COMMENT,
loc: { offset: 21, line: 1, column: 22 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 21, line: 1, column: 22 }
}
]
code: '<template><!--',
errors: [
{
- type: ParserErrorTypes.EOF_IN_COMMENT,
+ type: ErrorCodes.EOF_IN_COMMENT,
loc: { offset: 14, line: 1, column: 15 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 14, line: 1, column: 15 }
}
]
code: '<template><!',
errors: [
{
- type: ParserErrorTypes.INCORRECTLY_OPENED_COMMENT,
+ type: ErrorCodes.INCORRECTLY_OPENED_COMMENT,
loc: { offset: 10, line: 1, column: 11 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 12, line: 1, column: 13 }
}
]
code: '<template><!-',
errors: [
{
- type: ParserErrorTypes.INCORRECTLY_OPENED_COMMENT,
+ type: ErrorCodes.INCORRECTLY_OPENED_COMMENT,
loc: { offset: 10, line: 1, column: 11 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 13, line: 1, column: 14 }
}
]
code: '<template><!abc',
errors: [
{
- type: ParserErrorTypes.INCORRECTLY_OPENED_COMMENT,
+ type: ErrorCodes.INCORRECTLY_OPENED_COMMENT,
loc: { offset: 10, line: 1, column: 11 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 15, line: 1, column: 16 }
}
]
code: "<script><!--console.log('hello')",
errors: [
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 32, line: 1, column: 33 }
},
{
- type: ParserErrorTypes.EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT,
+ type: ErrorCodes.EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT,
loc: { offset: 32, line: 1, column: 33 }
}
]
code: "<script>console.log('hello')",
errors: [
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 28, line: 1, column: 29 }
}
]
code: '<template><div',
errors: [
{
- type: ParserErrorTypes.EOF_IN_TAG,
+ type: ErrorCodes.EOF_IN_TAG,
loc: { offset: 14, line: 1, column: 15 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 14, line: 1, column: 15 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 14, line: 1, column: 15 }
}
]
code: '<template><div ',
errors: [
{
- type: ParserErrorTypes.EOF_IN_TAG,
+ type: ErrorCodes.EOF_IN_TAG,
loc: { offset: 15, line: 1, column: 16 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 15, line: 1, column: 16 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 15, line: 1, column: 16 }
}
]
code: '<template><div id',
errors: [
{
- type: ParserErrorTypes.EOF_IN_TAG,
+ type: ErrorCodes.EOF_IN_TAG,
loc: { offset: 17, line: 1, column: 18 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 17, line: 1, column: 18 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 17, line: 1, column: 18 }
}
]
code: '<template><div id ',
errors: [
{
- type: ParserErrorTypes.EOF_IN_TAG,
+ type: ErrorCodes.EOF_IN_TAG,
loc: { offset: 18, line: 1, column: 19 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 18, line: 1, column: 19 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 18, line: 1, column: 19 }
}
]
code: '<template><div id =',
errors: [
{
- type: ParserErrorTypes.MISSING_ATTRIBUTE_VALUE,
+ type: ErrorCodes.MISSING_ATTRIBUTE_VALUE,
loc: { offset: 19, line: 1, column: 20 }
},
{
- type: ParserErrorTypes.EOF_IN_TAG,
+ type: ErrorCodes.EOF_IN_TAG,
loc: { offset: 19, line: 1, column: 20 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 19, line: 1, column: 20 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 19, line: 1, column: 20 }
}
]
code: "<template><div id='abc",
errors: [
{
- type: ParserErrorTypes.EOF_IN_TAG,
+ type: ErrorCodes.EOF_IN_TAG,
loc: { offset: 22, line: 1, column: 23 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 22, line: 1, column: 23 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 22, line: 1, column: 23 }
}
]
code: '<template><div id="abc',
errors: [
{
- type: ParserErrorTypes.EOF_IN_TAG,
+ type: ErrorCodes.EOF_IN_TAG,
loc: { offset: 22, line: 1, column: 23 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 22, line: 1, column: 23 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 22, line: 1, column: 23 }
}
]
code: "<template><div id='abc'",
errors: [
{
- type: ParserErrorTypes.EOF_IN_TAG,
+ type: ErrorCodes.EOF_IN_TAG,
loc: { offset: 23, line: 1, column: 24 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 23, line: 1, column: 24 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 23, line: 1, column: 24 }
}
]
code: '<template><div id="abc"',
errors: [
{
- type: ParserErrorTypes.EOF_IN_TAG,
+ type: ErrorCodes.EOF_IN_TAG,
loc: { offset: 23, line: 1, column: 24 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 23, line: 1, column: 24 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 23, line: 1, column: 24 }
}
]
code: '<template><div id=abc',
errors: [
{
- type: ParserErrorTypes.EOF_IN_TAG,
+ type: ErrorCodes.EOF_IN_TAG,
loc: { offset: 21, line: 1, column: 22 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 21, line: 1, column: 22 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 21, line: 1, column: 22 }
}
]
code: "<template><div id='abc'/",
errors: [
{
- type: ParserErrorTypes.UNEXPECTED_SOLIDUS_IN_TAG,
+ type: ErrorCodes.UNEXPECTED_SOLIDUS_IN_TAG,
loc: { offset: 23, line: 1, column: 24 }
},
{
- type: ParserErrorTypes.EOF_IN_TAG,
+ type: ErrorCodes.EOF_IN_TAG,
loc: { offset: 24, line: 1, column: 25 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 24, line: 1, column: 25 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 24, line: 1, column: 25 }
}
]
code: '<template><div id="abc"/',
errors: [
{
- type: ParserErrorTypes.UNEXPECTED_SOLIDUS_IN_TAG,
+ type: ErrorCodes.UNEXPECTED_SOLIDUS_IN_TAG,
loc: { offset: 23, line: 1, column: 24 }
},
{
- type: ParserErrorTypes.EOF_IN_TAG,
+ type: ErrorCodes.EOF_IN_TAG,
loc: { offset: 24, line: 1, column: 25 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 24, line: 1, column: 25 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 24, line: 1, column: 25 }
}
]
code: '<template><div id=abc /',
errors: [
{
- type: ParserErrorTypes.UNEXPECTED_SOLIDUS_IN_TAG,
+ type: ErrorCodes.UNEXPECTED_SOLIDUS_IN_TAG,
loc: { offset: 22, line: 1, column: 23 }
},
{
- type: ParserErrorTypes.EOF_IN_TAG,
+ type: ErrorCodes.EOF_IN_TAG,
loc: { offset: 23, line: 1, column: 24 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 23, line: 1, column: 24 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 23, line: 1, column: 24 }
}
]
code: '<template><!--comment--!></template>',
errors: [
{
- type: ParserErrorTypes.INCORRECTLY_CLOSED_COMMENT,
+ type: ErrorCodes.INCORRECTLY_CLOSED_COMMENT,
loc: { offset: 10, line: 1, column: 11 }
}
]
code: '<template><!></template>',
errors: [
{
- type: ParserErrorTypes.INCORRECTLY_OPENED_COMMENT,
+ type: ErrorCodes.INCORRECTLY_OPENED_COMMENT,
loc: { offset: 10, line: 1, column: 11 }
}
]
code: '<template><!-></template>',
errors: [
{
- type: ParserErrorTypes.INCORRECTLY_OPENED_COMMENT,
+ type: ErrorCodes.INCORRECTLY_OPENED_COMMENT,
loc: { offset: 10, line: 1, column: 11 }
}
]
code: '<template><!ELEMENT br EMPTY></template>',
errors: [
{
- type: ParserErrorTypes.INCORRECTLY_OPENED_COMMENT,
+ type: ErrorCodes.INCORRECTLY_OPENED_COMMENT,
loc: { offset: 10, line: 1, column: 11 }
}
]
code: '<template>a < b</template>',
errors: [
{
- type: ParserErrorTypes.INVALID_FIRST_CHARACTER_OF_TAG_NAME,
+ type: ErrorCodes.INVALID_FIRST_CHARACTER_OF_TAG_NAME,
loc: { offset: 13, line: 1, column: 14 }
}
]
code: '<template><οΏ½></template>',
errors: [
{
- type: ParserErrorTypes.INVALID_FIRST_CHARACTER_OF_TAG_NAME,
+ type: ErrorCodes.INVALID_FIRST_CHARACTER_OF_TAG_NAME,
loc: { offset: 11, line: 1, column: 12 }
}
]
code: '<template>a </ b</template>',
errors: [
{
- type: ParserErrorTypes.INVALID_FIRST_CHARACTER_OF_TAG_NAME,
+ type: ErrorCodes.INVALID_FIRST_CHARACTER_OF_TAG_NAME,
loc: { offset: 14, line: 1, column: 15 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 27, line: 1, column: 28 }
}
]
code: '<template></οΏ½></template>',
errors: [
{
- type: ParserErrorTypes.INVALID_FIRST_CHARACTER_OF_TAG_NAME,
+ type: ErrorCodes.INVALID_FIRST_CHARACTER_OF_TAG_NAME,
loc: { offset: 12, line: 1, column: 13 }
}
]
code: '<template><div id=></div></template>',
errors: [
{
- type: ParserErrorTypes.MISSING_ATTRIBUTE_VALUE,
+ type: ErrorCodes.MISSING_ATTRIBUTE_VALUE,
loc: { offset: 18, line: 1, column: 19 }
}
]
code: '<template><div id= ></div></template>',
errors: [
{
- type: ParserErrorTypes.MISSING_ATTRIBUTE_VALUE,
+ type: ErrorCodes.MISSING_ATTRIBUTE_VALUE,
loc: { offset: 19, line: 1, column: 20 }
}
]
code: '<template></></template>',
errors: [
{
- type: ParserErrorTypes.MISSING_END_TAG_NAME,
+ type: ErrorCodes.MISSING_END_TAG_NAME,
loc: { offset: 12, line: 1, column: 13 }
}
]
options: { namedCharacterReferences: { amp: '&' } },
errors: [
{
- type:
- ParserErrorTypes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE,
+ type: ErrorCodes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE,
loc: { offset: 14, line: 1, column: 15 }
}
]
code: '<template>(</template>',
errors: [
{
- type:
- ParserErrorTypes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE,
+ type: ErrorCodes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE,
loc: { offset: 14, line: 1, column: 15 }
}
]
code: '<template>@</template>',
errors: [
{
- type:
- ParserErrorTypes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE,
+ type: ErrorCodes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE,
loc: { offset: 15, line: 1, column: 16 }
}
]
code: '<template><div id="foo"class="bar"></div></template>',
errors: [
{
- type: ParserErrorTypes.MISSING_WHITESPACE_BETWEEN_ATTRIBUTES,
+ type: ErrorCodes.MISSING_WHITESPACE_BETWEEN_ATTRIBUTES,
loc: { offset: 23, line: 1, column: 24 }
}
]
code: '<template><!--a<!--b--></template>',
errors: [
{
- type: ParserErrorTypes.NESTED_COMMENT,
+ type: ErrorCodes.NESTED_COMMENT,
loc: { offset: 15, line: 1, column: 16 }
}
]
code: '<template><!--a<!--b<!--c--></template>',
errors: [
{
- type: ParserErrorTypes.NESTED_COMMENT,
+ type: ErrorCodes.NESTED_COMMENT,
loc: { offset: 15, line: 1, column: 16 }
},
{
- type: ParserErrorTypes.NESTED_COMMENT,
+ type: ErrorCodes.NESTED_COMMENT,
loc: { offset: 20, line: 1, column: 21 }
}
]
code: '<template><!--a<!--',
errors: [
{
- type: ParserErrorTypes.EOF_IN_COMMENT,
+ type: ErrorCodes.EOF_IN_COMMENT,
loc: { offset: 19, line: 1, column: 20 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 19, line: 1, column: 20 }
}
]
code: '<template></template>',
errors: [
{
- type: ParserErrorTypes.NONCHARACTER_CHARACTER_REFERENCE,
+ type: ErrorCodes.NONCHARACTER_CHARACTER_REFERENCE,
loc: { offset: 10, line: 1, column: 11 }
}
]
code: '<template></template>',
errors: [
{
- type: ParserErrorTypes.NONCHARACTER_CHARACTER_REFERENCE,
+ type: ErrorCodes.NONCHARACTER_CHARACTER_REFERENCE,
loc: { offset: 10, line: 1, column: 11 }
}
]
code: '<template>�</template>',
errors: [
{
- type: ParserErrorTypes.NULL_CHARACTER_REFERENCE,
+ type: ErrorCodes.NULL_CHARACTER_REFERENCE,
loc: { offset: 10, line: 1, column: 11 }
}
]
code: '<template>�</template>',
errors: [
{
- type: ParserErrorTypes.SURROGATE_CHARACTER_REFERENCE,
+ type: ErrorCodes.SURROGATE_CHARACTER_REFERENCE,
loc: { offset: 10, line: 1, column: 11 }
}
]
code: "<template><div a\"bc=''></div></template>",
errors: [
{
- type: ParserErrorTypes.UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME,
+ type: ErrorCodes.UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME,
loc: { offset: 16, line: 1, column: 17 }
}
]
code: "<template><div a'bc=''></div></template>",
errors: [
{
- type: ParserErrorTypes.UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME,
+ type: ErrorCodes.UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME,
loc: { offset: 16, line: 1, column: 17 }
}
]
code: "<template><div a<bc=''></div></template>",
errors: [
{
- type: ParserErrorTypes.UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME,
+ type: ErrorCodes.UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME,
loc: { offset: 16, line: 1, column: 17 }
}
]
code: '<template><div foo=bar"></div></template>',
errors: [
{
- type:
- ParserErrorTypes.UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE,
+ type: ErrorCodes.UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE,
loc: { offset: 22, line: 1, column: 23 }
}
]
code: "<template><div foo=bar'></div></template>",
errors: [
{
- type:
- ParserErrorTypes.UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE,
+ type: ErrorCodes.UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE,
loc: { offset: 22, line: 1, column: 23 }
}
]
code: '<template><div foo=bar<div></div></template>',
errors: [
{
- type:
- ParserErrorTypes.UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE,
+ type: ErrorCodes.UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE,
loc: { offset: 22, line: 1, column: 23 }
}
]
code: '<template><div foo=bar=baz></div></template>',
errors: [
{
- type:
- ParserErrorTypes.UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE,
+ type: ErrorCodes.UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE,
loc: { offset: 22, line: 1, column: 23 }
}
]
code: '<template><div foo=bar`></div></template>',
errors: [
{
- type:
- ParserErrorTypes.UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE,
+ type: ErrorCodes.UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE,
loc: { offset: 22, line: 1, column: 23 }
}
]
code: '<template><div =foo=bar></div></template>',
errors: [
{
- type:
- ParserErrorTypes.UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME,
+ type: ErrorCodes.UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME,
loc: { offset: 15, line: 1, column: 16 }
}
]
code: '<template><div =></div></template>',
errors: [
{
- type:
- ParserErrorTypes.UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME,
+ type: ErrorCodes.UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME,
loc: { offset: 15, line: 1, column: 16 }
}
]
code: '<template><?xml?></template>',
errors: [
{
- type:
- ParserErrorTypes.UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME,
+ type: ErrorCodes.UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME,
loc: { offset: 11, line: 1, column: 12 }
}
]
code: '<template><div a/b></div></template>',
errors: [
{
- type: ParserErrorTypes.UNEXPECTED_SOLIDUS_IN_TAG,
+ type: ErrorCodes.UNEXPECTED_SOLIDUS_IN_TAG,
loc: { offset: 16, line: 1, column: 17 }
}
]
code: '<template>&unknown;</template>',
errors: [
{
- type: ParserErrorTypes.UNKNOWN_NAMED_CHARACTER_REFERENCE,
+ type: ErrorCodes.UNKNOWN_NAMED_CHARACTER_REFERENCE,
loc: { offset: 10, line: 1, column: 11 }
}
]
code: '<template></div></template>',
errors: [
{
- type: ParserErrorTypes.X_INVALID_END_TAG,
+ type: ErrorCodes.X_INVALID_END_TAG,
loc: { offset: 10, line: 1, column: 11 }
}
]
code: '<template></div></div></template>',
errors: [
{
- type: ParserErrorTypes.X_INVALID_END_TAG,
+ type: ErrorCodes.X_INVALID_END_TAG,
loc: { offset: 10, line: 1, column: 11 }
},
{
- type: ParserErrorTypes.X_INVALID_END_TAG,
+ type: ErrorCodes.X_INVALID_END_TAG,
loc: { offset: 16, line: 1, column: 17 }
}
]
code: '<template><div></template>',
errors: [
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 15, line: 1, column: 16 }
}
]
code: '<template><div>',
errors: [
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 15, line: 1, column: 16 }
},
{
- type: ParserErrorTypes.X_MISSING_END_TAG,
+ type: ErrorCodes.X_MISSING_END_TAG,
loc: { offset: 15, line: 1, column: 16 }
}
]
code: '{{ foo',
errors: [
{
- type: ParserErrorTypes.X_MISSING_INTERPOLATION_END,
+ type: ErrorCodes.X_MISSING_INTERPOLATION_END,
loc: { offset: 0, line: 1, column: 1 }
}
]
code: '{{',
errors: [
{
- type: ParserErrorTypes.X_MISSING_INTERPOLATION_END,
+ type: ErrorCodes.X_MISSING_INTERPOLATION_END,
loc: { offset: 0, line: 1, column: 1 }
}
]
onError: spy
})
- expect(spy.mock.calls).toEqual(
- errors.map(({ type, loc }) => [type, loc])
- )
+ expect(
+ spy.mock.calls.map(([err]) => ({
+ type: err.code,
+ loc: err.loc
+ }))
+ ).toMatchObject(errors)
expect(ast).toMatchSnapshot()
}
)
}
export const enum NodeTypes {
+ ROOT,
+ ELEMENT,
TEXT,
COMMENT,
- ELEMENT,
- ATTRIBUTE,
EXPRESSION,
+ ATTRIBUTE,
DIRECTIVE,
- ROOT
+ IF,
+ IF_BRANCH,
+ FOR
}
export const enum ElementTypes {
ELEMENT,
COMPONENT,
- SLOT, // slot
- TEMPLATE // template, component
+ SLOT,
+ TEMPLATE
}
export interface Node {
loc: SourceLocation
}
+export type ParentNode = RootNode | ElementNode | IfBranchNode | ForNode
+export type ChildNode =
+ | ElementNode
+ | ExpressionNode
+ | TextNode
+ | CommentNode
+ | IfNode
+ | ForNode
+
export interface RootNode extends Node {
type: NodeTypes.ROOT
- children: Array<ElementNode | ExpressionNode | TextNode | CommentNode>
+ children: ChildNode[]
}
export interface ElementNode extends Node {
tag: string
tagType: ElementTypes
isSelfClosing: boolean
- props: Array<AttributeNode | DirectiveNode>
- children: Array<ElementNode | ExpressionNode | TextNode | CommentNode>
+ attrs: AttributeNode[]
+ directives: DirectiveNode[]
+ children: ChildNode[]
}
export interface TextNode extends Node {
isStatic: boolean
}
+export interface IfNode extends Node {
+ type: NodeTypes.IF
+ branches: IfBranchNode[]
+}
+
+export interface IfBranchNode extends Node {
+ type: NodeTypes.IF_BRANCH
+ condition: ExpressionNode | undefined // else
+ children: ChildNode[]
+}
+
+export interface ForNode extends Node {
+ type: NodeTypes.FOR
+ source: ExpressionNode
+ valueAlias: ExpressionNode
+ keyAlias: ExpressionNode
+ objectIndexAlias: ExpressionNode
+ children: ChildNode[]
+}
+
export interface Position {
- offset: number // from start of file
+ offset: number // from start of file (in SFCs)
line: number
column: number
}
-// TODO
+import { createDirectiveTransform } from '../transform'
+import {
+ NodeTypes,
+ ElementTypes,
+ ElementNode,
+ DirectiveNode,
+ IfBranchNode
+} from '../ast'
+import { createCompilerError, ErrorCodes } from '../errors'
+
+export const transformIf = createDirectiveTransform(
+ /^(if|else|else-if)$/,
+ (node, dir, context) => {
+ if (dir.name === 'if') {
+ context.replaceNode({
+ type: NodeTypes.IF,
+ loc: node.loc,
+ branches: [createIfBranch(node, dir)]
+ })
+ } else {
+ // locate the adjacent v-if
+ const siblings = context.parent.children
+ let i = context.childIndex
+ while (i--) {
+ const sibling = siblings[i]
+ if (sibling.type === NodeTypes.COMMENT) {
+ continue
+ }
+ if (sibling.type === NodeTypes.IF) {
+ // move the node to the if node's branches
+ context.removeNode()
+ sibling.branches.push(createIfBranch(node, dir))
+ } else {
+ context.onError(
+ createCompilerError(
+ dir.name === 'else'
+ ? ErrorCodes.X_ELSE_NO_ADJACENT_IF
+ : ErrorCodes.X_ELSE_IF_NO_ADJACENT_IF,
+ node.loc.start
+ )
+ )
+ }
+ break
+ }
+ }
+ }
+)
+
+function createIfBranch(node: ElementNode, dir: DirectiveNode): IfBranchNode {
+ return {
+ type: NodeTypes.IF_BRANCH,
+ loc: node.loc,
+ condition: dir.name === 'else' ? undefined : dir.exp,
+ children: node.tagType === ElementTypes.TEMPLATE ? node.children : [node]
+ }
+}
+++ /dev/null
-export const enum ParserErrorTypes {
- ABRUPT_CLOSING_OF_EMPTY_COMMENT,
- ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE,
- CDATA_IN_HTML_CONTENT,
- CHARACTER_REFERENCE_OUTSIDE_UNICODE_RANGE,
- CONTROL_CHARACTER_REFERENCE,
- DUPLICATE_ATTRIBUTE,
- END_TAG_WITH_ATTRIBUTES,
- END_TAG_WITH_TRAILING_SOLIDUS,
- EOF_BEFORE_TAG_NAME,
- EOF_IN_CDATA,
- EOF_IN_COMMENT,
- EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT,
- EOF_IN_TAG,
- INCORRECTLY_CLOSED_COMMENT,
- INCORRECTLY_OPENED_COMMENT,
- INVALID_FIRST_CHARACTER_OF_TAG_NAME,
- MISSING_ATTRIBUTE_VALUE,
- MISSING_END_TAG_NAME,
- MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE,
- MISSING_WHITESPACE_BETWEEN_ATTRIBUTES,
- NESTED_COMMENT,
- NONCHARACTER_CHARACTER_REFERENCE,
- NULL_CHARACTER_REFERENCE,
- SURROGATE_CHARACTER_REFERENCE,
- UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME,
- UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE,
- UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME,
- UNEXPECTED_NULL_CHARACTER,
- UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME,
- UNEXPECTED_SOLIDUS_IN_TAG,
- UNKNOWN_NAMED_CHARACTER_REFERENCE,
- X_INVALID_END_TAG,
- X_MISSING_END_TAG,
- X_MISSING_INTERPOLATION_END,
- X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END
-}
-
-export const errorMessages: { [code: number]: string } = {
- [ParserErrorTypes.ABRUPT_CLOSING_OF_EMPTY_COMMENT]: 'Illegal comment.',
- [ParserErrorTypes.ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE]:
- 'Illegal numeric character reference: invalid character.',
- [ParserErrorTypes.CDATA_IN_HTML_CONTENT]:
- 'CDATA section is allowed only in XML context.',
- [ParserErrorTypes.CHARACTER_REFERENCE_OUTSIDE_UNICODE_RANGE]:
- 'Illegal numeric character reference: too big.',
- [ParserErrorTypes.CONTROL_CHARACTER_REFERENCE]:
- 'Illegal numeric character reference: control character.',
- [ParserErrorTypes.DUPLICATE_ATTRIBUTE]: 'Duplicate attribute.',
- [ParserErrorTypes.END_TAG_WITH_ATTRIBUTES]: 'End tag cannot have attributes.',
- [ParserErrorTypes.END_TAG_WITH_TRAILING_SOLIDUS]: "Illegal '/' in tags.",
- [ParserErrorTypes.EOF_BEFORE_TAG_NAME]: 'Unexpected EOF in tag.',
- [ParserErrorTypes.EOF_IN_CDATA]: 'Unexpected EOF in CDATA section.',
- [ParserErrorTypes.EOF_IN_COMMENT]: 'Unexpected EOF in comment.',
- [ParserErrorTypes.EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT]:
- 'Unexpected EOF in script.',
- [ParserErrorTypes.EOF_IN_TAG]: 'Unexpected EOF in tag.',
- [ParserErrorTypes.INCORRECTLY_CLOSED_COMMENT]: 'Incorrectly closed comment.',
- [ParserErrorTypes.INCORRECTLY_OPENED_COMMENT]: 'Incorrectly opened comment.',
- [ParserErrorTypes.INVALID_FIRST_CHARACTER_OF_TAG_NAME]:
- "Illegal tag name. Use '<' to print '<'.",
- [ParserErrorTypes.MISSING_ATTRIBUTE_VALUE]: 'Attribute value was expected.',
- [ParserErrorTypes.MISSING_END_TAG_NAME]: 'End tag name was expected.',
- [ParserErrorTypes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE]:
- 'Semicolon was expected.',
- [ParserErrorTypes.MISSING_WHITESPACE_BETWEEN_ATTRIBUTES]:
- 'Whitespace was expected.',
- [ParserErrorTypes.NESTED_COMMENT]: "Unexpected '<!--' in comment.",
- [ParserErrorTypes.NONCHARACTER_CHARACTER_REFERENCE]:
- 'Illegal numeric character reference: non character.',
- [ParserErrorTypes.NULL_CHARACTER_REFERENCE]:
- 'Illegal numeric character reference: null character.',
- [ParserErrorTypes.SURROGATE_CHARACTER_REFERENCE]:
- 'Illegal numeric character reference: non-pair surrogate.',
- [ParserErrorTypes.UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME]:
- 'Attribute name cannot contain U+0022 ("), U+0027 (\'), and U+003C (<).',
- [ParserErrorTypes.UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE]:
- 'Unquoted attribute value cannot contain U+0022 ("), U+0027 (\'), U+003C (<), U+003D (=), and U+0060 (`).',
- [ParserErrorTypes.UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME]:
- "Attribute name cannot start with '='.",
- [ParserErrorTypes.UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME]:
- "'<?' is allowed only in XML context.",
- [ParserErrorTypes.UNEXPECTED_SOLIDUS_IN_TAG]: "Illegal '/' in tags.",
- [ParserErrorTypes.UNKNOWN_NAMED_CHARACTER_REFERENCE]: 'Unknown entity name.',
- [ParserErrorTypes.X_INVALID_END_TAG]: 'Invalid end tag.',
- [ParserErrorTypes.X_MISSING_END_TAG]: 'End tag was not found.',
- [ParserErrorTypes.X_MISSING_INTERPOLATION_END]:
- 'Interpolation end sign was not found.'
-}
--- /dev/null
+import { Position } from './ast'
+
+export interface CompilerError extends SyntaxError {
+ code: ErrorCodes
+ loc: Position
+}
+
+export function createCompilerError(
+ code: ErrorCodes,
+ loc: Position
+): CompilerError {
+ const error = new SyntaxError(
+ `${__DEV__ || !__BROWSER__ ? errorMessages[code] : code} (${loc.line}:${
+ loc.column
+ })`
+ ) as CompilerError
+ error.code = code
+ error.loc = loc
+ return error
+}
+
+export const enum ErrorCodes {
+ // parse errors
+ ABRUPT_CLOSING_OF_EMPTY_COMMENT,
+ ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE,
+ CDATA_IN_HTML_CONTENT,
+ CHARACTER_REFERENCE_OUTSIDE_UNICODE_RANGE,
+ CONTROL_CHARACTER_REFERENCE,
+ DUPLICATE_ATTRIBUTE,
+ END_TAG_WITH_ATTRIBUTES,
+ END_TAG_WITH_TRAILING_SOLIDUS,
+ EOF_BEFORE_TAG_NAME,
+ EOF_IN_CDATA,
+ EOF_IN_COMMENT,
+ EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT,
+ EOF_IN_TAG,
+ INCORRECTLY_CLOSED_COMMENT,
+ INCORRECTLY_OPENED_COMMENT,
+ INVALID_FIRST_CHARACTER_OF_TAG_NAME,
+ MISSING_ATTRIBUTE_VALUE,
+ MISSING_END_TAG_NAME,
+ MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE,
+ MISSING_WHITESPACE_BETWEEN_ATTRIBUTES,
+ NESTED_COMMENT,
+ NONCHARACTER_CHARACTER_REFERENCE,
+ NULL_CHARACTER_REFERENCE,
+ SURROGATE_CHARACTER_REFERENCE,
+ UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME,
+ UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE,
+ UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME,
+ UNEXPECTED_NULL_CHARACTER,
+ UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME,
+ UNEXPECTED_SOLIDUS_IN_TAG,
+ UNKNOWN_NAMED_CHARACTER_REFERENCE,
+ X_INVALID_END_TAG,
+ X_MISSING_END_TAG,
+ X_MISSING_INTERPOLATION_END,
+ X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END,
+
+ // transform errors
+ X_ELSE_IF_NO_ADJACENT_IF,
+ X_ELSE_NO_ADJACENT_IF
+}
+
+export const errorMessages: { [code: number]: string } = {
+ // parse errors
+ [ErrorCodes.ABRUPT_CLOSING_OF_EMPTY_COMMENT]: 'Illegal comment.',
+ [ErrorCodes.ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE]:
+ 'Illegal numeric character reference: invalid character.',
+ [ErrorCodes.CDATA_IN_HTML_CONTENT]:
+ 'CDATA section is allowed only in XML context.',
+ [ErrorCodes.CHARACTER_REFERENCE_OUTSIDE_UNICODE_RANGE]:
+ 'Illegal numeric character reference: too big.',
+ [ErrorCodes.CONTROL_CHARACTER_REFERENCE]:
+ 'Illegal numeric character reference: control character.',
+ [ErrorCodes.DUPLICATE_ATTRIBUTE]: 'Duplicate attribute.',
+ [ErrorCodes.END_TAG_WITH_ATTRIBUTES]: 'End tag cannot have attributes.',
+ [ErrorCodes.END_TAG_WITH_TRAILING_SOLIDUS]: "Illegal '/' in tags.",
+ [ErrorCodes.EOF_BEFORE_TAG_NAME]: 'Unexpected EOF in tag.',
+ [ErrorCodes.EOF_IN_CDATA]: 'Unexpected EOF in CDATA section.',
+ [ErrorCodes.EOF_IN_COMMENT]: 'Unexpected EOF in comment.',
+ [ErrorCodes.EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT]:
+ 'Unexpected EOF in script.',
+ [ErrorCodes.EOF_IN_TAG]: 'Unexpected EOF in tag.',
+ [ErrorCodes.INCORRECTLY_CLOSED_COMMENT]: 'Incorrectly closed comment.',
+ [ErrorCodes.INCORRECTLY_OPENED_COMMENT]: 'Incorrectly opened comment.',
+ [ErrorCodes.INVALID_FIRST_CHARACTER_OF_TAG_NAME]:
+ "Illegal tag name. Use '<' to print '<'.",
+ [ErrorCodes.MISSING_ATTRIBUTE_VALUE]: 'Attribute value was expected.',
+ [ErrorCodes.MISSING_END_TAG_NAME]: 'End tag name was expected.',
+ [ErrorCodes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE]:
+ 'Semicolon was expected.',
+ [ErrorCodes.MISSING_WHITESPACE_BETWEEN_ATTRIBUTES]:
+ 'Whitespace was expected.',
+ [ErrorCodes.NESTED_COMMENT]: "Unexpected '<!--' in comment.",
+ [ErrorCodes.NONCHARACTER_CHARACTER_REFERENCE]:
+ 'Illegal numeric character reference: non character.',
+ [ErrorCodes.NULL_CHARACTER_REFERENCE]:
+ 'Illegal numeric character reference: null character.',
+ [ErrorCodes.SURROGATE_CHARACTER_REFERENCE]:
+ 'Illegal numeric character reference: non-pair surrogate.',
+ [ErrorCodes.UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME]:
+ 'Attribute name cannot contain U+0022 ("), U+0027 (\'), and U+003C (<).',
+ [ErrorCodes.UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE]:
+ 'Unquoted attribute value cannot contain U+0022 ("), U+0027 (\'), U+003C (<), U+003D (=), and U+0060 (`).',
+ [ErrorCodes.UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME]:
+ "Attribute name cannot start with '='.",
+ [ErrorCodes.UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME]:
+ "'<?' is allowed only in XML context.",
+ [ErrorCodes.UNEXPECTED_SOLIDUS_IN_TAG]: "Illegal '/' in tags.",
+ [ErrorCodes.UNKNOWN_NAMED_CHARACTER_REFERENCE]: 'Unknown entity name.',
+ [ErrorCodes.X_INVALID_END_TAG]: 'Invalid end tag.',
+ [ErrorCodes.X_MISSING_END_TAG]: 'End tag was not found.',
+ [ErrorCodes.X_MISSING_INTERPOLATION_END]:
+ 'Interpolation end sign was not found.',
+
+ // transform errors
+ [ErrorCodes.X_ELSE_IF_NO_ADJACENT_IF]: `v-else-if has no adjacent v-if`,
+ [ErrorCodes.X_ELSE_NO_ADJACENT_IF]: `v-else has no adjacent v-if`
+}
-export { parse, ParserOptions, TextModes } from './parser'
-export { ParserErrorTypes } from './errorTypes'
+export { parse, ParserOptions, TextModes } from './parse'
+export { transform, Transform, TransformContext } from './transform'
+export { ErrorCodes } from './errors'
export * from './ast'
+
+export { transformIf } from './directives/vIf'
-import { ParserErrorTypes, errorMessages } from './errorTypes'
+import { ErrorCodes, CompilerError, createCompilerError } from './errors'
import {
Namespace,
Namespaces,
Position,
RootNode,
SourceLocation,
- TextNode
+ TextNode,
+ ChildNode
} from './ast'
export interface ParserOptions {
// The full set is https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references
namedCharacterReferences?: { [name: string]: string | undefined }
- onError?: (type: ParserErrorTypes, loc: Position) => void
+ onError?: (error: CompilerError) => void
}
export const defaultParserOptions: Required<ParserOptions> = {
'apos;': "'",
'quot;': '"'
},
- onError(code: ParserErrorTypes, loc: Position): void {
- const error: any = new SyntaxError(
- `${__DEV__ || !__BROWSER__ ? errorMessages[code] : code} (${loc.line}:${
- loc.column
- })`
- )
- error.code = code
- error.loc = loc
+ onError(error: CompilerError): void {
throw error
}
}
context: ParserContext,
mode: TextModes,
ancestors: ElementNode[]
-): RootNode['children'] {
+): ChildNode[] {
const parent = last(ancestors)
const ns = parent ? parent.ns : Namespaces.HTML
- const nodes: RootNode['children'] = []
+ const nodes: ChildNode[] = []
while (!isEnd(context, mode, ancestors)) {
__DEV__ && assert(context.source.length > 0)
} else if (mode === TextModes.DATA && s[0] === '<') {
// https://html.spec.whatwg.org/multipage/parsing.html#tag-open-state
if (s.length === 1) {
- emitError(context, ParserErrorTypes.EOF_BEFORE_TAG_NAME, 1)
+ emitError(context, ErrorCodes.EOF_BEFORE_TAG_NAME, 1)
} else if (s[1] === '!') {
// https://html.spec.whatwg.org/multipage/parsing.html#markup-declaration-open-state
if (startsWith(s, '<!--')) {
if (ns !== Namespaces.HTML) {
node = parseCDATA(context, ancestors)
} else {
- emitError(context, ParserErrorTypes.CDATA_IN_HTML_CONTENT)
+ emitError(context, ErrorCodes.CDATA_IN_HTML_CONTENT)
node = parseBogusComment(context)
}
} else {
- emitError(context, ParserErrorTypes.INCORRECTLY_OPENED_COMMENT)
+ emitError(context, ErrorCodes.INCORRECTLY_OPENED_COMMENT)
node = parseBogusComment(context)
}
} else if (s[1] === '/') {
// https://html.spec.whatwg.org/multipage/parsing.html#end-tag-open-state
if (s.length === 2) {
- emitError(context, ParserErrorTypes.EOF_BEFORE_TAG_NAME, 2)
+ emitError(context, ErrorCodes.EOF_BEFORE_TAG_NAME, 2)
} else if (s[2] === '>') {
- emitError(context, ParserErrorTypes.MISSING_END_TAG_NAME, 2)
+ emitError(context, ErrorCodes.MISSING_END_TAG_NAME, 2)
advanceBy(context, 3)
continue
} else if (/[a-z]/i.test(s[2])) {
- emitError(context, ParserErrorTypes.X_INVALID_END_TAG)
+ emitError(context, ErrorCodes.X_INVALID_END_TAG)
parseTag(context, TagType.End, parent)
continue
} else {
- emitError(
- context,
- ParserErrorTypes.INVALID_FIRST_CHARACTER_OF_TAG_NAME,
- 2
- )
+ emitError(context, ErrorCodes.INVALID_FIRST_CHARACTER_OF_TAG_NAME, 2)
node = parseBogusComment(context)
}
} else if (/[a-z]/i.test(s[1])) {
} else if (s[1] === '?') {
emitError(
context,
- ParserErrorTypes.UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME,
+ ErrorCodes.UNEXPECTED_QUESTION_MARK_INSTEAD_OF_TAG_NAME,
1
)
node = parseBogusComment(context)
} else {
- emitError(
- context,
- ParserErrorTypes.INVALID_FIRST_CHARACTER_OF_TAG_NAME,
- 1
- )
+ emitError(context, ErrorCodes.INVALID_FIRST_CHARACTER_OF_TAG_NAME, 1)
}
}
if (!node) {
}
if (Array.isArray(node)) {
- node.forEach(pushNode.bind(null, context, nodes))
+ for (let i = 0; i < node.length; i++) {
+ pushNode(context, nodes, node[i])
+ }
} else {
pushNode(context, nodes, node)
}
function pushNode(
context: ParserContext,
- nodes: RootNode['children'],
- node: RootNode['children'][0]
+ nodes: ChildNode[],
+ node: ChildNode
): void {
if (context.ignoreSpaces && node.type === NodeTypes.TEXT && node.isEmpty) {
return
function parseCDATA(
context: ParserContext,
ancestors: ElementNode[]
-): RootNode['children'] {
+): ChildNode[] {
__DEV__ &&
assert(last(ancestors) == null || last(ancestors)!.ns !== Namespaces.HTML)
__DEV__ && assert(startsWith(context.source, '<![CDATA['))
advanceBy(context, 9)
const nodes = parseChildren(context, TextModes.CDATA, ancestors)
if (context.source.length === 0) {
- emitError(context, ParserErrorTypes.EOF_IN_CDATA)
+ emitError(context, ErrorCodes.EOF_IN_CDATA)
} else {
__DEV__ && assert(startsWith(context.source, ']]>'))
advanceBy(context, 3)
if (!match) {
content = context.source.slice(4)
advanceBy(context, context.source.length)
- emitError(context, ParserErrorTypes.EOF_IN_COMMENT)
+ emitError(context, ErrorCodes.EOF_IN_COMMENT)
} else {
if (match.index <= 3) {
- emitError(context, ParserErrorTypes.ABRUPT_CLOSING_OF_EMPTY_COMMENT)
+ emitError(context, ErrorCodes.ABRUPT_CLOSING_OF_EMPTY_COMMENT)
}
if (match[1]) {
- emitError(context, ParserErrorTypes.INCORRECTLY_CLOSED_COMMENT)
+ emitError(context, ErrorCodes.INCORRECTLY_CLOSED_COMMENT)
}
content = context.source.slice(4, match.index)
while ((nestedIndex = s.indexOf('<!--', prevIndex)) !== -1) {
advanceBy(context, nestedIndex - prevIndex + 1)
if (nestedIndex + 4 < s.length) {
- emitError(context, ParserErrorTypes.NESTED_COMMENT)
+ emitError(context, ErrorCodes.NESTED_COMMENT)
}
prevIndex = nestedIndex + 1
}
if (startsWithEndTagOpen(context.source, element.tag)) {
parseTag(context, TagType.End, parent)
} else {
- emitError(context, ParserErrorTypes.X_MISSING_END_TAG)
+ emitError(context, ErrorCodes.X_MISSING_END_TAG)
if (context.source.length === 0 && element.tag.toLowerCase() === 'script') {
const first = children[0]
if (first && startsWith(first.loc.source, '<!--')) {
- emitError(
- context,
- ParserErrorTypes.EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT
- )
+ emitError(context, ErrorCodes.EOF_IN_SCRIPT_HTML_COMMENT_LIKE_TEXT)
}
}
}
const start = getCursor(context)
const match = /^<\/?([a-z][^\t\r\n\f />]*)/i.exec(context.source)!
const tag = match[1]
- const props = []
+ const attrs = []
+ const directives = []
const ns = context.getNamespace(tag, parent)
advanceBy(context, match[0].length)
!startsWith(context.source, '/>')
) {
if (startsWith(context.source, '/')) {
- emitError(context, ParserErrorTypes.UNEXPECTED_SOLIDUS_IN_TAG)
+ emitError(context, ErrorCodes.UNEXPECTED_SOLIDUS_IN_TAG)
advanceBy(context, 1)
advanceSpaces(context)
continue
}
if (type === TagType.End) {
- emitError(context, ParserErrorTypes.END_TAG_WITH_ATTRIBUTES)
+ emitError(context, ErrorCodes.END_TAG_WITH_ATTRIBUTES)
}
const attr = parseAttribute(context, attributeNames)
if (type === TagType.Start) {
- props.push(attr)
+ if (attr.type === NodeTypes.DIRECTIVE) {
+ directives.push(attr)
+ } else {
+ attrs.push(attr)
+ }
}
if (/^[^\t\r\n\f />]/.test(context.source)) {
- emitError(context, ParserErrorTypes.MISSING_WHITESPACE_BETWEEN_ATTRIBUTES)
+ emitError(context, ErrorCodes.MISSING_WHITESPACE_BETWEEN_ATTRIBUTES)
}
advanceSpaces(context)
}
// Tag close.
let isSelfClosing = false
if (context.source.length === 0) {
- emitError(context, ParserErrorTypes.EOF_IN_TAG)
+ emitError(context, ErrorCodes.EOF_IN_TAG)
} else {
isSelfClosing = startsWith(context.source, '/>')
if (type === TagType.End && isSelfClosing) {
- emitError(context, ParserErrorTypes.END_TAG_WITH_TRAILING_SOLIDUS)
+ emitError(context, ErrorCodes.END_TAG_WITH_TRAILING_SOLIDUS)
}
advanceBy(context, isSelfClosing ? 2 : 1)
}
ns,
tag,
tagType,
- props,
+ attrs,
+ directives,
isSelfClosing,
children: [],
loc: getSelection(context, start)
const name = match[0]
if (nameSet.has(name)) {
- emitError(context, ParserErrorTypes.DUPLICATE_ATTRIBUTE)
+ emitError(context, ErrorCodes.DUPLICATE_ATTRIBUTE)
}
nameSet.add(name)
if (name[0] === '=') {
- emitError(
- context,
- ParserErrorTypes.UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME
- )
+ emitError(context, ErrorCodes.UNEXPECTED_EQUALS_SIGN_BEFORE_ATTRIBUTE_NAME)
}
{
const pattern = /["'<]/g
while ((m = pattern.exec(name)) !== null) {
emitError(
context,
- ParserErrorTypes.UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME,
+ ErrorCodes.UNEXPECTED_CHARACTER_IN_ATTRIBUTE_NAME,
m.index
)
}
advanceSpaces(context)
value = parseAttributeValue(context)
if (!value) {
- emitError(context, ParserErrorTypes.MISSING_ATTRIBUTE_VALUE)
+ emitError(context, ErrorCodes.MISSING_ATTRIBUTE_VALUE)
}
}
const loc = getSelection(context, start)
if (!content.endsWith(']')) {
emitError(
context,
- ParserErrorTypes.X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END
+ ErrorCodes.X_MISSING_DYNAMIC_DIRECTIVE_ARGUMENT_END
)
}
while ((m = unexpectedChars.exec(match[0])) !== null) {
emitError(
context,
- ParserErrorTypes.UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE,
+ ErrorCodes.UNEXPECTED_CHARACTER_IN_UNQUOTED_ATTRIBUTE_VALUE,
m.index
)
}
const closeIndex = context.source.indexOf(close, open.length)
if (closeIndex === -1) {
- emitError(context, ParserErrorTypes.X_MISSING_INTERPOLATION_END)
+ emitError(context, ErrorCodes.X_MISSING_INTERPOLATION_END)
return undefined
}
if (!semi) {
emitError(
context,
- ParserErrorTypes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE
+ ErrorCodes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE
)
}
}
} else {
- emitError(context, ParserErrorTypes.UNKNOWN_NAMED_CHARACTER_REFERENCE)
+ emitError(context, ErrorCodes.UNKNOWN_NAMED_CHARACTER_REFERENCE)
text += '&'
text += name
advanceBy(context, 1 + name.length)
text += head[0]
emitError(
context,
- ParserErrorTypes.ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE
+ ErrorCodes.ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE
)
advanceBy(context, head[0].length)
} else {
// https://html.spec.whatwg.org/multipage/parsing.html#numeric-character-reference-end-state
let cp = Number.parseInt(body[1], hex ? 16 : 10)
if (cp === 0) {
- emitError(context, ParserErrorTypes.NULL_CHARACTER_REFERENCE)
+ emitError(context, ErrorCodes.NULL_CHARACTER_REFERENCE)
cp = 0xfffd
} else if (cp > 0x10ffff) {
emitError(
context,
- ParserErrorTypes.CHARACTER_REFERENCE_OUTSIDE_UNICODE_RANGE
+ ErrorCodes.CHARACTER_REFERENCE_OUTSIDE_UNICODE_RANGE
)
cp = 0xfffd
} else if (cp >= 0xd800 && cp <= 0xdfff) {
- emitError(context, ParserErrorTypes.SURROGATE_CHARACTER_REFERENCE)
+ emitError(context, ErrorCodes.SURROGATE_CHARACTER_REFERENCE)
cp = 0xfffd
} else if ((cp >= 0xfdd0 && cp <= 0xfdef) || (cp & 0xfffe) === 0xfffe) {
- emitError(context, ParserErrorTypes.NONCHARACTER_CHARACTER_REFERENCE)
+ emitError(context, ErrorCodes.NONCHARACTER_CHARACTER_REFERENCE)
} else if (
(cp >= 0x01 && cp <= 0x08) ||
cp === 0x0b ||
(cp >= 0x0d && cp <= 0x1f) ||
(cp >= 0x7f && cp <= 0x9f)
) {
- emitError(context, ParserErrorTypes.CONTROL_CHARACTER_REFERENCE)
+ emitError(context, ErrorCodes.CONTROL_CHARACTER_REFERENCE)
cp = CCR_REPLACEMENTS[cp] || cp
}
text += String.fromCodePoint(cp)
if (!body![0].endsWith(';')) {
emitError(
context,
- ParserErrorTypes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE
+ ErrorCodes.MISSING_SEMICOLON_AFTER_CHARACTER_REFERENCE
)
}
}
function emitError(
context: ParserContext,
- type: ParserErrorTypes,
+ code: ErrorCodes,
offset?: number
): void {
const loc = getCursor(context)
loc.offset += offset
loc.column += offset
}
- context.onError(type, loc)
+ context.onError(createCompilerError(code, loc))
}
function isEnd(
-// TODO
+import {
+ RootNode,
+ NodeTypes,
+ ParentNode,
+ ChildNode,
+ ElementNode,
+ DirectiveNode
+} from './ast'
+import { isString } from '@vue/shared'
+import { CompilerError } from './errors'
+
+export type Transform = (node: ChildNode, context: TransformContext) => void
+
+export type DirectiveTransform = (
+ node: ElementNode,
+ dir: DirectiveNode,
+ context: TransformContext
+) => false | void
+
+export interface TransformOptions {
+ transforms: Transform[]
+ onError?: (error: CompilerError) => void
+}
+
+export interface TransformContext extends Required<TransformOptions> {
+ parent: ParentNode
+ ancestors: ParentNode[]
+ childIndex: number
+ replaceNode(node: ChildNode): void
+ removeNode(): void
+ nodeRemoved: boolean
+}
+
+export function transform(root: RootNode, options: TransformOptions) {
+ const context = createTransformContext(root, options)
+ traverseChildren(root, context, context.ancestors)
+}
+
+function createTransformContext(
+ root: RootNode,
+ options: TransformOptions
+): TransformContext {
+ const context: TransformContext = {
+ onError(error: CompilerError) {
+ throw error
+ },
+ ...options,
+ parent: root,
+ ancestors: [root],
+ childIndex: 0,
+ replaceNode(node) {
+ context.parent.children[context.childIndex] = node
+ },
+ removeNode() {
+ context.parent.children.splice(context.childIndex, 1)
+ context.nodeRemoved = true
+ },
+ nodeRemoved: false
+ }
+ return context
+}
+
+function traverseChildren(
+ parent: ParentNode,
+ context: TransformContext,
+ ancestors: ParentNode[]
+) {
+ ancestors = ancestors.concat(parent)
+ for (let i = 0; i < parent.children.length; i++) {
+ context.parent = parent
+ context.ancestors = ancestors
+ context.childIndex = i
+ traverseNode(parent.children[i], context, ancestors)
+ if (context.nodeRemoved) {
+ i--
+ }
+ }
+}
+
+function traverseNode(
+ node: ChildNode,
+ context: TransformContext,
+ ancestors: ParentNode[]
+) {
+ // apply transform plugins
+ const transforms = context.transforms
+ for (let i = 0; i < transforms.length; i++) {
+ const transform = transforms[i]
+ context.nodeRemoved = false
+ transform(node, context)
+ if (context.nodeRemoved) {
+ return
+ } else {
+ // node may have been replaced
+ node = context.parent.children[context.childIndex]
+ }
+ }
+
+ // further traverse downwards
+ switch (node.type) {
+ case NodeTypes.IF:
+ for (let i = 0; i < node.branches.length; i++) {
+ traverseChildren(node.branches[i], context, ancestors)
+ }
+ break
+ case NodeTypes.FOR:
+ case NodeTypes.ELEMENT:
+ traverseChildren(node, context, ancestors)
+ break
+ }
+}
+
+const identity = <T>(_: T): T => _
+
+export function createDirectiveTransform(
+ name: string | RegExp,
+ fn: DirectiveTransform
+): Transform {
+ const matches = isString(name)
+ ? (n: string) => n === name
+ : (n: string) => name.test(n)
+
+ return (node, context) => {
+ if (node.type === NodeTypes.ELEMENT) {
+ const dirs = node.directives
+ let didRemove = false
+ for (let i = 0; i < dirs.length; i++) {
+ if (matches(dirs[i].name)) {
+ const res = fn(node, dirs[i], context)
+ // Directives are removed after transformation by default. A transform
+ // returning false means the directive should not be removed.
+ if (res !== false) {
+ ;(dirs as any)[i] = undefined
+ didRemove = true
+ }
+ }
+ }
+ if (didRemove) {
+ node.directives = dirs.filter(identity)
+ }
+ }
+ }
+}
NodeTypes,
ElementNode,
TextNode,
- ParserErrorTypes,
+ ErrorCodes,
ExpressionNode,
ElementTypes
} from '@vue/compiler-core'
ns: DOMNamespaces.HTML,
tag: 'img',
tagType: ElementTypes.ELEMENT,
- props: [],
+ attrs: [],
+ directives: [],
isSelfClosing: false,
children: [],
loc: {
'<textarea>hello</textarea</textarea0></texTArea a="<>">',
{
...parserOptions,
- onError: type => {
- if (type !== ParserErrorTypes.END_TAG_WITH_ATTRIBUTES) {
- throw new Error(String(type))
+ onError: err => {
+ if (err.code !== ErrorCodes.END_TAG_WITH_ATTRIBUTES) {
+ throw err
}
}
}
import {
- NodeTypes,
TextModes,
ParserOptions,
ElementNode,
return DOMNamespaces.SVG
}
if (
- parent.props.some(
+ parent.attrs.some(
a =>
- a.type === NodeTypes.ATTRIBUTE &&
a.name === 'encoding' &&
a.value != null &&
(a.value.content === 'text/html' ||