diff --git a/packages/compiler-core/__tests__/__snapshots__/parse.spec.ts.snap b/packages/compiler-core/__tests__/__snapshots__/parse.spec.ts.snap new file mode 100644 index 00000000..ce41e304 --- /dev/null +++ b/packages/compiler-core/__tests__/__snapshots__/parse.spec.ts.snap @@ -0,0 +1,7392 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`parser/parse invalid html 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [ + Object { + "children": Array [], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + "offset": 13, + }, + "source": " +", + "start": Object { + "column": 1, + "line": 2, + "offset": 6, + }, + }, + "ns": 0, + "props": Array [], + "tag": "span", + "tagType": 0, + "type": 2, + }, + ], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + "offset": 19, + }, + "source": "
+ +
", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "ns": 0, + "props": Array [], + "tag": "div", + "tagType": 0, + "type": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + "offset": 27, + }, + "source": "
+ +
+
", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": 6, +} +`; + +exports[`parser/parse onError option ABRUPT_CLOSING_OF_EMPTY_COMMENT 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [ + Object { + "content": "", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + "offset": 15, + }, + "source": "", + "start": Object { + "column": 11, + "line": 1, + "offset": 10, + }, + }, + "type": 1, + }, + ], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + "offset": 26, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "ns": 0, + "props": Array [], + "tag": "template", + "tagType": 3, + "type": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + "offset": 26, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": 6, +} +`; + +exports[`parser/parse onError option ABRUPT_CLOSING_OF_EMPTY_COMMENT 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [ + Object { + "content": "", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + "offset": 16, + }, + "source": "", + "start": Object { + "column": 11, + "line": 1, + "offset": 10, + }, + }, + "type": 1, + }, + ], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + "offset": 27, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "ns": 0, + "props": Array [], + "tag": "template", + "tagType": 3, + "type": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + "offset": 27, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": 6, +} +`; + +exports[`parser/parse onError option ABRUPT_CLOSING_OF_EMPTY_COMMENT 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [ + Object { + "content": "", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + "offset": 17, + }, + "source": "", + "start": Object { + "column": 11, + "line": 1, + "offset": 10, + }, + }, + "type": 1, + }, + ], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + "offset": 28, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "ns": 0, + "props": Array [], + "tag": "template", + "tagType": 3, + "type": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + "offset": 28, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": 6, +} +`; + +exports[`parser/parse onError option ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + "offset": 34, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "ns": 0, + "props": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + "offset": 22, + }, + "source": "attr=\\"c\\"", + "start": Object { + "column": 11, + "line": 1, + "offset": 10, + }, + }, + "name": "attr", + "type": 3, + "value": Object { + "content": "c", + "isEmpty": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + "offset": 22, + }, + "source": "\\"c\\"", + "start": Object { + "column": 16, + "line": 1, + "offset": 15, + }, + }, + "type": 0, + }, + }, + ], + "tag": "template", + "tagType": 3, + "type": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + "offset": 34, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": 6, +} +`; + +exports[`parser/parse onError option ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + "offset": 33, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "ns": 0, + "props": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + "offset": 21, + }, + "source": "attr=\\"&#a;\\"", + "start": Object { + "column": 11, + "line": 1, + "offset": 10, + }, + }, + "name": "attr", + "type": 3, + "value": Object { + "content": "&#a;", + "isEmpty": false, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + "offset": 21, + }, + "source": "\\"&#a;\\"", + "start": Object { + "column": 16, + "line": 1, + "offset": 15, + }, + }, + "type": 0, + }, + }, + ], + "tag": "template", + "tagType": 3, + "type": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + "offset": 33, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": 6, +} +`; + +exports[`parser/parse onError option ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + "offset": 35, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "ns": 0, + "props": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + "offset": 23, + }, + "source": "attr=\\"ÿ\\"", + "start": Object { + "column": 11, + "line": 1, + "offset": 10, + }, + }, + "name": "attr", + "type": 3, + "value": Object { + "content": "ÿ", + "isEmpty": false, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + "offset": 23, + }, + "source": "\\"ÿ\\"", + "start": Object { + "column": 16, + "line": 1, + "offset": 15, + }, + }, + "type": 0, + }, + }, + ], + "tag": "template", + "tagType": 3, + "type": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + "offset": 35, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": 6, +} +`; + +exports[`parser/parse onError option ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + "offset": 34, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "ns": 0, + "props": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + "offset": 22, + }, + "source": "attr=\\"&#xg;\\"", + "start": Object { + "column": 11, + "line": 1, + "offset": 10, + }, + }, + "name": "attr", + "type": 3, + "value": Object { + "content": "&#xg;", + "isEmpty": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + "offset": 22, + }, + "source": "\\"&#xg;\\"", + "start": Object { + "column": 16, + "line": 1, + "offset": 15, + }, + }, + "type": 0, + }, + }, + ], + "tag": "template", + "tagType": 3, + "type": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + "offset": 34, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": 6, +} +`; + +exports[`parser/parse onError option ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [ + Object { + "content": "c", + "isEmpty": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + "offset": 15, + }, + "source": "c", + "start": Object { + "column": 11, + "line": 1, + "offset": 10, + }, + }, + "type": 0, + }, + ], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + "offset": 26, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "ns": 0, + "props": Array [], + "tag": "template", + "tagType": 3, + "type": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + "offset": 26, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": 6, +} +`; + +exports[`parser/parse onError option ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [ + Object { + "content": "&#a;", + "isEmpty": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + "offset": 14, + }, + "source": "&#a;", + "start": Object { + "column": 11, + "line": 1, + "offset": 10, + }, + }, + "type": 0, + }, + ], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + "offset": 25, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "ns": 0, + "props": Array [], + "tag": "template", + "tagType": 3, + "type": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + "offset": 25, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": 6, +} +`; + +exports[`parser/parse onError option ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [ + Object { + "content": "ÿ", + "isEmpty": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + "offset": 16, + }, + "source": "ÿ", + "start": Object { + "column": 11, + "line": 1, + "offset": 10, + }, + }, + "type": 0, + }, + ], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + "offset": 27, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "ns": 0, + "props": Array [], + "tag": "template", + "tagType": 3, + "type": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + "offset": 27, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": 6, +} +`; + +exports[`parser/parse onError option ABSENCE_OF_DIGITS_IN_NUMERIC_CHARACTER_REFERENCE 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [ + Object { + "content": "&#xg;", + "isEmpty": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + "offset": 15, + }, + "source": "&#xg;", + "start": Object { + "column": 11, + "line": 1, + "offset": 10, + }, + }, + "type": 0, + }, + ], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + "offset": 26, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "ns": 0, + "props": Array [], + "tag": "template", + "tagType": 3, + "type": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + "offset": 26, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": 6, +} +`; + +exports[`parser/parse onError option CDATA_IN_HTML_CONTENT 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [ + Object { + "content": "[CDATA[cdata]]", + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + "offset": 27, + }, + "source": "", + "start": Object { + "column": 11, + "line": 1, + "offset": 10, + }, + }, + "type": 1, + }, + ], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + "offset": 38, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "ns": 0, + "props": Array [], + "tag": "template", + "tagType": 3, + "type": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + "offset": 38, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": 6, +} +`; + +exports[`parser/parse onError option CDATA_IN_HTML_CONTENT 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [ + Object { + "children": Array [ + Object { + "content": "cdata", + "isEmpty": false, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + "offset": 29, + }, + "source": "cdata", + "start": Object { + "column": 25, + "line": 1, + "offset": 24, + }, + }, + "type": 0, + }, + ], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + "offset": 38, + }, + "source": "cdata", + "start": Object { + "column": 11, + "line": 1, + "offset": 10, + }, + }, + "ns": 1, + "props": Array [], + "tag": "svg", + "tagType": 0, + "type": 2, + }, + ], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + "offset": 49, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "ns": 0, + "props": Array [], + "tag": "template", + "tagType": 3, + "type": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + "offset": 49, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": 6, +} +`; + +exports[`parser/parse onError option CHARACTER_REFERENCE_OUTSIDE_UNICODE_RANGE 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [ + Object { + "content": "�", + "isEmpty": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + "offset": 20, + }, + "source": "�", + "start": Object { + "column": 11, + "line": 1, + "offset": 10, + }, + }, + "type": 0, + }, + ], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + "offset": 31, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "ns": 0, + "props": Array [], + "tag": "template", + "tagType": 3, + "type": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + "offset": 31, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": 6, +} +`; + +exports[`parser/parse onError option CONTROL_CHARACTER_REFERENCE 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [ + Object { + "content": "", + "isEmpty": false, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + "offset": 17, + }, + "source": "", + "start": Object { + "column": 11, + "line": 1, + "offset": 10, + }, + }, + "type": 0, + }, + ], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + "offset": 28, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "ns": 0, + "props": Array [], + "tag": "template", + "tagType": 3, + "type": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + "offset": 28, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": 6, +} +`; + +exports[`parser/parse onError option CONTROL_CHARACTER_REFERENCE 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [ + Object { + "content": "", + "isEmpty": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + "offset": 16, + }, + "source": "", + "start": Object { + "column": 11, + "line": 1, + "offset": 10, + }, + }, + "type": 0, + }, + ], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + "offset": 27, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "ns": 0, + "props": Array [], + "tag": "template", + "tagType": 3, + "type": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + "offset": 27, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": 6, +} +`; + +exports[`parser/parse onError option DUPLICATE_ATTRIBUTE 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [ + Object { + "children": Array [], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + "offset": 33, + }, + "source": "
", + "start": Object { + "column": 11, + "line": 1, + "offset": 10, + }, + }, + "ns": 0, + "props": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + "offset": 20, + }, + "source": "id=\\"\\"", + "start": Object { + "column": 16, + "line": 1, + "offset": 15, + }, + }, + "name": "id", + "type": 3, + "value": Object { + "content": "", + "isEmpty": true, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + "offset": 20, + }, + "source": "\\"\\"", + "start": Object { + "column": 19, + "line": 1, + "offset": 18, + }, + }, + "type": 0, + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + "offset": 26, + }, + "source": "id=\\"\\"", + "start": Object { + "column": 22, + "line": 1, + "offset": 21, + }, + }, + "name": "id", + "type": 3, + "value": Object { + "content": "", + "isEmpty": true, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + "offset": 26, + }, + "source": "\\"\\"", + "start": Object { + "column": 25, + "line": 1, + "offset": 24, + }, + }, + "type": 0, + }, + }, + ], + "tag": "div", + "tagType": 0, + "type": 2, + }, + ], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + "offset": 44, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "ns": 0, + "props": Array [], + "tag": "template", + "tagType": 3, + "type": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + "offset": 44, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": 6, +} +`; + +exports[`parser/parse onError option END_TAG_WITH_ATTRIBUTES 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [ + Object { + "children": Array [], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + "offset": 27, + }, + "source": "
", + "start": Object { + "column": 11, + "line": 1, + "offset": 10, + }, + }, + "ns": 0, + "props": Array [], + "tag": "div", + "tagType": 0, + "type": 2, + }, + ], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + "offset": 38, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "ns": 0, + "props": Array [], + "tag": "template", + "tagType": 3, + "type": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + "offset": 38, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": 6, +} +`; + +exports[`parser/parse onError option END_TAG_WITH_TRAILING_SOLIDUS 1`] = ` +Object { + "children": Array [ + Object { + "children": Array [ + Object { + "children": Array [], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + "offset": 22, + }, + "source": "
", + "start": Object { + "column": 11, + "line": 1, + "offset": 10, + }, + }, + "ns": 0, + "props": Array [], + "tag": "div", + "tagType": 0, + "type": 2, + }, + ], + "isSelfClosing": false, + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + "offset": 33, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "ns": 0, + "props": Array [], + "tag": "template", + "tagType": 3, + "type": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + "offset": 33, + }, + "source": "", + "start": Object { + "column": 1, + "line": 1, + "offset": 0, + }, + }, + "type": 6, +} +`; + +exports[`parser/parse onError option EOF_BEFORE_TAG_NAME