1 |
wakaba |
1.1 |
{"tests": [ |
2 |
|
|
|
3 |
wakaba |
1.2 |
{"description":"DOCTYPE without name", |
4 |
wakaba |
1.1 |
"input":"<!DOCTYPE>", |
5 |
wakaba |
1.2 |
"output":["ParseError", "ParseError", ["DOCTYPE", "", null, null, false]]}, |
6 |
wakaba |
1.1 |
|
7 |
wakaba |
1.2 |
{"description":"DOCTYPE without space before name", |
8 |
wakaba |
1.1 |
"input":"<!DOCTYPEhtml>", |
9 |
wakaba |
1.2 |
"output":["ParseError", ["DOCTYPE", "html", null, null, true]]}, |
10 |
wakaba |
1.1 |
|
11 |
wakaba |
1.2 |
{"description":"Incorrect DOCTYPE without a space before name", |
12 |
wakaba |
1.1 |
"input":"<!DOCTYPEfoo>", |
13 |
wakaba |
1.2 |
"output":["ParseError", ["DOCTYPE", "foo", null, null, true]]}, |
14 |
wakaba |
1.1 |
|
15 |
wakaba |
1.2 |
{"description":"DOCTYPE with publicId", |
16 |
wakaba |
1.1 |
"input":"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML Transitional 4.01//EN\">", |
17 |
wakaba |
1.2 |
"output":[["DOCTYPE", "html", "-//W3C//DTD HTML Transitional 4.01//EN", null, true]]}, |
18 |
|
|
|
19 |
|
|
{"description":"DOCTYPE with EOF after PUBLIC", |
20 |
|
|
"input":"<!DOCTYPE html PUBLIC", |
21 |
|
|
"output":["ParseError", ["DOCTYPE", "html", null, null, false]]}, |
22 |
|
|
|
23 |
|
|
{"description":"DOCTYPE with EOF after PUBLIC '", |
24 |
|
|
"input":"<!DOCTYPE html PUBLIC '", |
25 |
|
|
"output":["ParseError", ["DOCTYPE", "html", "", null, false]]}, |
26 |
|
|
|
27 |
|
|
{"description":"DOCTYPE with EOF after PUBLIC 'x", |
28 |
|
|
"input":"<!DOCTYPE html PUBLIC 'x", |
29 |
|
|
"output":["ParseError", ["DOCTYPE", "html", "x", null, false]]}, |
30 |
|
|
|
31 |
|
|
{"description":"DOCTYPE with systemId", |
32 |
|
|
"input":"<!DOCTYPE html SYSTEM \"-//W3C//DTD HTML Transitional 4.01//EN\">", |
33 |
|
|
"output":[["DOCTYPE", "html", null, "-//W3C//DTD HTML Transitional 4.01//EN", true]]}, |
34 |
|
|
|
35 |
|
|
{"description":"DOCTYPE with publicId and systemId", |
36 |
|
|
"input":"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML Transitional 4.01//EN\" \"-//W3C//DTD HTML Transitional 4.01//EN\">", |
37 |
|
|
"output":[["DOCTYPE", "html", "-//W3C//DTD HTML Transitional 4.01//EN", "-//W3C//DTD HTML Transitional 4.01//EN", true]]}, |
38 |
wakaba |
1.1 |
|
39 |
wakaba |
1.6 |
{"description":"DOCTYPE with > in double-quoted publicId", |
40 |
|
|
"input":"<!DOCTYPE html PUBLIC \">x", |
41 |
|
|
"output":["ParseError", ["DOCTYPE", "html", "", null, false], ["Character", "x"]]}, |
42 |
|
|
|
43 |
|
|
{"description":"DOCTYPE with > in single-quoted publicId", |
44 |
|
|
"input":"<!DOCTYPE html PUBLIC '>x", |
45 |
|
|
"output":["ParseError", ["DOCTYPE", "html", "", null, false], ["Character", "x"]]}, |
46 |
|
|
|
47 |
|
|
{"description":"DOCTYPE with > in double-quoted systemId", |
48 |
|
|
"input":"<!DOCTYPE html PUBLIC \"foo\" \">x", |
49 |
|
|
"output":["ParseError", ["DOCTYPE", "html", "foo", "", false], ["Character", "x"]]}, |
50 |
|
|
|
51 |
|
|
{"description":"DOCTYPE with > in single-quoted systemId", |
52 |
|
|
"input":"<!DOCTYPE html PUBLIC 'foo' '>x", |
53 |
|
|
"output":["ParseError", ["DOCTYPE", "html", "foo", "", false], ["Character", "x"]]}, |
54 |
|
|
|
55 |
wakaba |
1.1 |
{"description":"Incomplete doctype", |
56 |
|
|
"input":"<!DOCTYPE html ", |
57 |
wakaba |
1.2 |
"output":["ParseError", ["DOCTYPE", "html", null, null, false]]}, |
58 |
wakaba |
1.1 |
|
59 |
|
|
{"description":"Numeric entity representing the NUL character", |
60 |
|
|
"input":"�", |
61 |
wakaba |
1.3 |
"output":["ParseError", ["Character", "\uFFFD"]]}, |
62 |
wakaba |
1.1 |
|
63 |
|
|
{"description":"Hexadecimal entity representing the NUL character", |
64 |
|
|
"input":"�", |
65 |
wakaba |
1.3 |
"output":["ParseError", ["Character", "\uFFFD"]]}, |
66 |
wakaba |
1.1 |
|
67 |
|
|
{"description":"Numeric entity representing a codepoint after 1114111 (U+10FFFF)", |
68 |
|
|
"input":"�", |
69 |
wakaba |
1.3 |
"output":["ParseError", ["Character", "\uFFFD"]]}, |
70 |
wakaba |
1.1 |
|
71 |
|
|
{"description":"Hexadecimal entity representing a codepoint after 1114111 (U+10FFFF)", |
72 |
|
|
"input":"�", |
73 |
wakaba |
1.3 |
"output":["ParseError", ["Character", "\uFFFD"]]}, |
74 |
|
|
|
75 |
|
|
{"description":"Hexadecimal entity pair representing a surrogate pair", |
76 |
|
|
"input":"��", |
77 |
|
|
"output":["ParseError", ["Character", "\uFFFD"], "ParseError", ["Character", "\uFFFD"]]}, |
78 |
wakaba |
1.1 |
|
79 |
|
|
{"description":"Hexadecimal entity with mixed uppercase and lowercase", |
80 |
|
|
"input":"ꯍ", |
81 |
|
|
"output":[["Character", "\uABCD"]]}, |
82 |
|
|
|
83 |
|
|
{"description":"Entity without a name", |
84 |
|
|
"input":"&;", |
85 |
|
|
"output":["ParseError", ["Character", "&;"]]}, |
86 |
|
|
|
87 |
|
|
{"description":"Unescaped ampersand in attribute value", |
88 |
|
|
"input":"<h a='&'>", |
89 |
|
|
"output":["ParseError", ["StartTag", "h", { "a":"&" }]]}, |
90 |
|
|
|
91 |
|
|
{"description":"StartTag containing <", |
92 |
|
|
"input":"<a<b>", |
93 |
wakaba |
1.2 |
"output":[["StartTag", "a<b", { }]]}, |
94 |
wakaba |
1.1 |
|
95 |
|
|
{"description":"Non-void element containing trailing /", |
96 |
|
|
"input":"<h/>", |
97 |
|
|
"output":["ParseError", ["StartTag", "h", { }]]}, |
98 |
|
|
|
99 |
|
|
{"description":"Void element with permitted slash", |
100 |
|
|
"input":"<br/>", |
101 |
|
|
"output":[["StartTag", "br", { }]]}, |
102 |
|
|
|
103 |
|
|
{"description":"StartTag containing /", |
104 |
|
|
"input":"<h/a='b'>", |
105 |
|
|
"output":["ParseError", ["StartTag", "h", { "a":"b" }]]}, |
106 |
|
|
|
107 |
|
|
{"description":"Double-quoted attribute value", |
108 |
|
|
"input":"<h a=\"b\">", |
109 |
|
|
"output":[["StartTag", "h", { "a":"b" }]]}, |
110 |
|
|
|
111 |
|
|
{"description":"Unescaped </", |
112 |
|
|
"input":"</", |
113 |
|
|
"output":["ParseError", ["Character", "</"]]}, |
114 |
|
|
|
115 |
|
|
{"description":"Illegal end tag name", |
116 |
|
|
"input":"</1>", |
117 |
|
|
"output":["ParseError", ["Comment", "1"]]}, |
118 |
|
|
|
119 |
|
|
{"description":"Simili processing instruction", |
120 |
|
|
"input":"<?namespace>", |
121 |
|
|
"output":["ParseError", ["Comment", "?namespace"]]}, |
122 |
|
|
|
123 |
|
|
{"description":"A bogus comment stops at >, even if preceeded by two dashes", |
124 |
|
|
"input":"<?foo-->", |
125 |
|
|
"output":["ParseError", ["Comment", "?foo--"]]}, |
126 |
|
|
|
127 |
|
|
{"description":"Unescaped <", |
128 |
|
|
"input":"foo < bar", |
129 |
|
|
"output":[["Character", "foo "], "ParseError", ["Character", "< bar"]]}, |
130 |
|
|
|
131 |
|
|
{"description":"Null Byte Replacement", |
132 |
|
|
"input":"\u0000", |
133 |
wakaba |
1.4 |
"output":["ParseError", ["Character", "\ufffd"]]}, |
134 |
|
|
|
135 |
|
|
{"description":"Comment with dash", |
136 |
|
|
"input":"<!---x", |
137 |
wakaba |
1.5 |
"output":["ParseError", ["Comment", "-x"]]}, |
138 |
|
|
|
139 |
|
|
{"description":"Entity + newline", |
140 |
|
|
"input":"\nx\n>\n", |
141 |
|
|
"output":[["Character","\nx\n>\n"]]} |
142 |
wakaba |
1.1 |
|
143 |
|
|
]} |
144 |
|
|
|
145 |
|
|
|