1 |
wakaba |
1.1 |
{"tests": [ |
2 |
|
|
|
3 |
|
|
{"description":"< in attribute name", |
4 |
|
|
"input":"<z/0 <", |
5 |
|
|
"output":["ParseError", "ParseError", ["StartTag", "z", {"0": "", "<": ""}]]}, |
6 |
|
|
|
7 |
|
|
{"description":"< in attribute value", |
8 |
|
|
"input":"<z x=<", |
9 |
|
|
"output":["ParseError", ["StartTag", "z", {"x": "<"}]]}, |
10 |
|
|
|
11 |
wakaba |
1.3 |
{"description":"= in unquoted attribute value", |
12 |
|
|
"input":"<z z=z=z>", |
13 |
|
|
"output":["ParseError", ["StartTag", "z", {"z": "z=z"}]]}, |
14 |
|
|
|
15 |
|
|
{"description":"= attribute", |
16 |
|
|
"input":"<z =>", |
17 |
|
|
"output":["ParseError", ["StartTag", "z", {"=": ""}]]}, |
18 |
|
|
|
19 |
|
|
{"description":"== attribute", |
20 |
|
|
"input":"<z ==>", |
21 |
|
|
"output":["ParseError", ["StartTag", "z", {"=": ""}]]}, |
22 |
|
|
|
23 |
|
|
{"description":"=== attribute", |
24 |
|
|
"input":"<z ===>", |
25 |
|
|
"output":["ParseError", "ParseError", ["StartTag", "z", {"=": "="}]]}, |
26 |
|
|
|
27 |
|
|
{"description":"==== attribute", |
28 |
|
|
"input":"<z ====>", |
29 |
|
|
"output":["ParseError", "ParseError", "ParseError", ["StartTag", "z", {"=": "=="}]]}, |
30 |
|
|
|
31 |
|
|
{"description":"Allowed \" after ampersand in attribute value", |
32 |
|
|
"input":"<z z=\"&\">", |
33 |
|
|
"output":[["StartTag", "z", {"z": "&"}]]}, |
34 |
|
|
|
35 |
|
|
{"description":"Non-allowed ' after ampersand in attribute value", |
36 |
|
|
"input":"<z z=\"&'\">", |
37 |
|
|
"output":["ParseError", ["StartTag", "z", {"z": "&'"}]]}, |
38 |
|
|
|
39 |
|
|
{"description":"Allowed ' after ampersand in attribute value", |
40 |
|
|
"input":"<z z='&'>", |
41 |
|
|
"output":[["StartTag", "z", {"z": "&"}]]}, |
42 |
|
|
|
43 |
|
|
{"description":"Non-allowed \" after ampersand in attribute value", |
44 |
|
|
"input":"<z z='&\"'>", |
45 |
|
|
"output":["ParseError", ["StartTag", "z", {"z": "&\""}]]}, |
46 |
|
|
|
47 |
|
|
{"description":"Attribute name starting with \"", |
48 |
|
|
"input":"<foo \"='bar'>", |
49 |
|
|
"output":["ParseError", ["StartTag", "foo", {"\"": "bar"}]]}, |
50 |
|
|
|
51 |
|
|
{"description":"Attribute name starting with '", |
52 |
|
|
"input":"<foo '='bar'>", |
53 |
|
|
"output":["ParseError", ["StartTag", "foo", {"'": "bar"}]]}, |
54 |
|
|
|
55 |
|
|
{"description":"Attribute name containing \"", |
56 |
|
|
"input":"<foo a\"b='bar'>", |
57 |
|
|
"output":["ParseError", ["StartTag", "foo", {"a\"b": "bar"}]]}, |
58 |
|
|
|
59 |
|
|
{"description":"Attribute name containing '", |
60 |
|
|
"input":"<foo a'b='bar'>", |
61 |
|
|
"output":["ParseError", ["StartTag", "foo", {"a'b": "bar"}]]}, |
62 |
|
|
|
63 |
|
|
{"description":"Unquoted attribute value containing '", |
64 |
|
|
"input":"<foo a=b'c>", |
65 |
|
|
"output":["ParseError", ["StartTag", "foo", {"a": "b'c"}]]}, |
66 |
|
|
|
67 |
|
|
{"description":"Unquoted attribute value containing \"", |
68 |
|
|
"input":"<foo a=b\"c>", |
69 |
|
|
"output":["ParseError", ["StartTag", "foo", {"a": "b\"c"}]]}, |
70 |
|
|
|
71 |
|
|
{"description":"Double-quoted attribute value not followed by whitespace", |
72 |
|
|
"input":"<foo a=\"b\"c>", |
73 |
|
|
"output":["ParseError", ["StartTag", "foo", {"a": "b", "c": ""}]]}, |
74 |
|
|
|
75 |
|
|
{"description":"Single-quoted attribute value not followed by whitespace", |
76 |
|
|
"input":"<foo a='b'c>", |
77 |
|
|
"output":["ParseError", ["StartTag", "foo", {"a": "b", "c": ""}]]}, |
78 |
|
|
|
79 |
|
|
{"description":"Quoted attribute followed by permitted /", |
80 |
|
|
"input":"<br a='b'/>", |
81 |
wakaba |
1.5 |
"output":[["StartTag","br",{"a":"b"},true]]}, |
82 |
wakaba |
1.3 |
|
83 |
|
|
{"description":"Quoted attribute followed by non-permitted /", |
84 |
|
|
"input":"<bar a='b'/>", |
85 |
wakaba |
1.5 |
"output":[["StartTag","bar",{"a":"b"},true]]}, |
86 |
wakaba |
1.3 |
|
87 |
wakaba |
1.1 |
{"description":"CR EOF after doctype name", |
88 |
|
|
"input":"<!doctype html \r", |
89 |
|
|
"output":["ParseError", ["DOCTYPE", "html", null, null, false]]}, |
90 |
|
|
|
91 |
|
|
{"description":"CR EOF in tag name", |
92 |
|
|
"input":"<z\r", |
93 |
|
|
"output":["ParseError", ["StartTag", "z", {}]]}, |
94 |
|
|
|
95 |
|
|
{"description":"Zero hex numeric entity", |
96 |
|
|
"input":"�", |
97 |
|
|
"output":["ParseError", "ParseError", ["Character", "\uFFFD"]]}, |
98 |
|
|
|
99 |
|
|
{"description":"Zero decimal numeric entity", |
100 |
|
|
"input":"�", |
101 |
|
|
"output":["ParseError", "ParseError", ["Character", "\uFFFD"]]}, |
102 |
|
|
|
103 |
|
|
{"description":"Zero-prefixed hex numeric entity", |
104 |
|
|
"input":"A", |
105 |
|
|
"output":[["Character", "A"]]}, |
106 |
|
|
|
107 |
|
|
{"description":"Zero-prefixed decimal numeric entity", |
108 |
|
|
"input":"A", |
109 |
|
|
"output":[["Character", "A"]]}, |
110 |
|
|
|
111 |
|
|
{"description":"Empty hex numeric entities", |
112 |
|
|
"input":"&#x &#X ", |
113 |
|
|
"output":["ParseError", ["Character", "&#x "], "ParseError", ["Character", "&#X "]]}, |
114 |
|
|
|
115 |
|
|
{"description":"Empty decimal numeric entities", |
116 |
|
|
"input":"&# &#; ", |
117 |
|
|
"output":["ParseError", ["Character", "&# "], "ParseError", ["Character", "&#; "]]}, |
118 |
|
|
|
119 |
|
|
{"description":"Non-BMP numeric entity", |
120 |
|
|
"input":"𐀀", |
121 |
|
|
"output":[["Character", "\uD800\uDC00"]]}, |
122 |
|
|
|
123 |
|
|
{"description":"Maximum non-BMP numeric entity", |
124 |
|
|
"input":"", |
125 |
|
|
"output":[["Character", "\uDBFF\uDFFF"]]}, |
126 |
|
|
|
127 |
|
|
{"description":"Above maximum numeric entity", |
128 |
|
|
"input":"�", |
129 |
|
|
"output":["ParseError", ["Character", "\uFFFD"]]}, |
130 |
|
|
|
131 |
|
|
{"description":"32-bit hex numeric entity", |
132 |
|
|
"input":"�", |
133 |
|
|
"output":["ParseError", ["Character", "\uFFFD"]]}, |
134 |
|
|
|
135 |
|
|
{"description":"33-bit hex numeric entity", |
136 |
|
|
"input":"�", |
137 |
|
|
"output":["ParseError", ["Character", "\uFFFD"]]}, |
138 |
|
|
|
139 |
|
|
{"description":"33-bit decimal numeric entity", |
140 |
|
|
"input":"�", |
141 |
|
|
"output":["ParseError", ["Character", "\uFFFD"]]}, |
142 |
|
|
|
143 |
|
|
{"description":"65-bit hex numeric entity", |
144 |
|
|
"input":"�", |
145 |
|
|
"output":["ParseError", ["Character", "\uFFFD"]]}, |
146 |
|
|
|
147 |
|
|
{"description":"65-bit decimal numeric entity", |
148 |
|
|
"input":"�", |
149 |
|
|
"output":["ParseError", ["Character", "\uFFFD"]]}, |
150 |
|
|
|
151 |
|
|
{"description":"Surrogate code point edge cases", |
152 |
|
|
"input":"퟿����", |
153 |
|
|
"output":[["Character", "\uD7FF"], "ParseError", ["Character", "\uFFFD"], "ParseError", ["Character", "\uFFFD"], "ParseError", ["Character", "\uFFFD"], "ParseError", ["Character", "\uFFFD\uE000"]]}, |
154 |
|
|
|
155 |
|
|
{"description":"Uppercase start tag name", |
156 |
|
|
"input":"<X>", |
157 |
|
|
"output":[["StartTag", "x", {}]]}, |
158 |
|
|
|
159 |
|
|
{"description":"Uppercase end tag name", |
160 |
|
|
"input":"</X>", |
161 |
|
|
"output":[["EndTag", "x"]]}, |
162 |
|
|
|
163 |
|
|
{"description":"Uppercase attribute name", |
164 |
|
|
"input":"<x X>", |
165 |
|
|
"output":[["StartTag", "x", { "x":"" }]]}, |
166 |
|
|
|
167 |
|
|
{"description":"Tag/attribute name case edge values", |
168 |
|
|
"input":"<x@AZ[`az{ @AZ[`az{>", |
169 |
|
|
"output":[["StartTag", "x@az[`az{", { "@az[`az{":"" }]]}, |
170 |
|
|
|
171 |
|
|
{"description":"Duplicate different-case attributes", |
172 |
|
|
"input":"<x x=1 x=2 X=3>", |
173 |
|
|
"output":["ParseError", "ParseError", ["StartTag", "x", { "x":"1" }]]}, |
174 |
|
|
|
175 |
|
|
{"description":"Uppercase close tag attributes", |
176 |
|
|
"input":"</x X>", |
177 |
|
|
"output":["ParseError", ["EndTag", "x"]]}, |
178 |
|
|
|
179 |
|
|
{"description":"Duplicate close tag attributes", |
180 |
|
|
"input":"</x x x>", |
181 |
|
|
"output":["ParseError", "ParseError", ["EndTag", "x"]]}, |
182 |
|
|
|
183 |
|
|
{"description":"Permitted slash", |
184 |
|
|
"input":"<br/>", |
185 |
wakaba |
1.5 |
"output":[["StartTag","br",{},true]]}, |
186 |
wakaba |
1.1 |
|
187 |
|
|
{"description":"Non-permitted slash", |
188 |
|
|
"input":"<xr/>", |
189 |
wakaba |
1.5 |
"output":[["StartTag","xr",{},true]]}, |
190 |
wakaba |
1.1 |
|
191 |
|
|
{"description":"Permitted slash but in close tag", |
192 |
|
|
"input":"</br/>", |
193 |
|
|
"output":["ParseError", ["EndTag", "br"]]}, |
194 |
|
|
|
195 |
|
|
{"description":"Doctype public case-sensitivity (1)", |
196 |
|
|
"input":"<!DoCtYpE HtMl PuBlIc \"AbC\" \"XyZ\">", |
197 |
|
|
"output":[["DOCTYPE", "HtMl", "AbC", "XyZ", true]]}, |
198 |
|
|
|
199 |
|
|
{"description":"Doctype public case-sensitivity (2)", |
200 |
|
|
"input":"<!dOcTyPe hTmL pUbLiC \"aBc\" \"xYz\">", |
201 |
|
|
"output":[["DOCTYPE", "hTmL", "aBc", "xYz", true]]}, |
202 |
|
|
|
203 |
|
|
{"description":"Doctype system case-sensitivity (1)", |
204 |
|
|
"input":"<!DoCtYpE HtMl SyStEm \"XyZ\">", |
205 |
|
|
"output":[["DOCTYPE", "HtMl", null, "XyZ", true]]}, |
206 |
|
|
|
207 |
|
|
{"description":"Doctype system case-sensitivity (2)", |
208 |
|
|
"input":"<!dOcTyPe hTmL sYsTeM \"xYz\">", |
209 |
|
|
"output":[["DOCTYPE", "hTmL", null, "xYz", true]]}, |
210 |
|
|
|
211 |
|
|
{"description":"U+0000 in lookahead region after non-matching character", |
212 |
|
|
"input":"<!doc>\u0000", |
213 |
|
|
"output":["ParseError", ["Comment", "doc"], "ParseError", ["Character", "\uFFFD"]], |
214 |
|
|
"ignoreErrorOrder":true}, |
215 |
|
|
|
216 |
|
|
{"description":"U+0000 in lookahead region", |
217 |
|
|
"input":"<!doc\u0000", |
218 |
|
|
"output":["ParseError", "ParseError", ["Comment", "doc\uFFFD"]], |
219 |
|
|
"ignoreErrorOrder":true}, |
220 |
|
|
|
221 |
wakaba |
1.4 |
{"description":"U+0080 in lookahead region", |
222 |
|
|
"input":"<!doc\u0080", |
223 |
|
|
"output":["ParseError", "ParseError", ["Comment", "doc\u0080"]], |
224 |
|
|
"ignoreErrorOrder":true}, |
225 |
|
|
|
226 |
|
|
{"description":"U+FDD1 in lookahead region", |
227 |
|
|
"input":"<!doc\uFDD1", |
228 |
|
|
"output":["ParseError", "ParseError", ["Comment", "doc\uFDD1"]], |
229 |
|
|
"ignoreErrorOrder":true}, |
230 |
|
|
|
231 |
|
|
{"description":"U+1FFFF in lookahead region", |
232 |
|
|
"input":"<!doc\uD83F\uDFFF", |
233 |
|
|
"output":["ParseError", "ParseError", ["Comment", "doc\uD83F\uDFFF"]], |
234 |
|
|
"ignoreErrorOrder":true}, |
235 |
|
|
|
236 |
wakaba |
1.1 |
{"description":"CR followed by U+0000", |
237 |
|
|
"input":"\r\u0000", |
238 |
|
|
"output":["ParseError", ["Character", "\n\uFFFD"]], |
239 |
|
|
"ignoreErrorOrder":true}, |
240 |
|
|
|
241 |
|
|
{"description":"CR followed by non-LF", |
242 |
|
|
"input":"\r?", |
243 |
|
|
"output":[["Character", "\n?"]]}, |
244 |
|
|
|
245 |
|
|
{"description":"CR at EOF", |
246 |
|
|
"input":"\r", |
247 |
|
|
"output":[["Character", "\n"]]}, |
248 |
|
|
|
249 |
|
|
{"description":"LF at EOF", |
250 |
|
|
"input":"\n", |
251 |
|
|
"output":[["Character", "\n"]]}, |
252 |
|
|
|
253 |
|
|
{"description":"CR LF", |
254 |
|
|
"input":"\r\n", |
255 |
|
|
"output":[["Character", "\n"]]}, |
256 |
|
|
|
257 |
|
|
{"description":"CR CR", |
258 |
|
|
"input":"\r\r", |
259 |
|
|
"output":[["Character", "\n\n"]]}, |
260 |
|
|
|
261 |
|
|
{"description":"LF LF", |
262 |
|
|
"input":"\n\n", |
263 |
|
|
"output":[["Character", "\n\n"]]}, |
264 |
|
|
|
265 |
|
|
{"description":"LF CR", |
266 |
|
|
"input":"\n\r", |
267 |
wakaba |
1.2 |
"output":[["Character", "\n\n"]]}, |
268 |
|
|
|
269 |
|
|
{"description":"text CR CR CR text", |
270 |
|
|
"input":"text\r\r\rtext", |
271 |
|
|
"output":[["Character", "text\n\n\ntext"]]}, |
272 |
|
|
|
273 |
|
|
{"description":"Doctype publik", |
274 |
|
|
"input":"<!DOCTYPE html PUBLIK \"AbC\" \"XyZ\">", |
275 |
|
|
"output":["ParseError", ["DOCTYPE", "html", null, null, false]]}, |
276 |
|
|
|
277 |
|
|
{"description":"Doctype publi", |
278 |
|
|
"input":"<!DOCTYPE html PUBLI", |
279 |
|
|
"output":["ParseError", "ParseError", ["DOCTYPE", "html", null, null, false]]}, |
280 |
|
|
|
281 |
|
|
{"description":"Doctype sistem", |
282 |
|
|
"input":"<!DOCTYPE html SISTEM \"AbC\">", |
283 |
|
|
"output":["ParseError", ["DOCTYPE", "html", null, null, false]]}, |
284 |
|
|
|
285 |
|
|
{"description":"Doctype sys", |
286 |
|
|
"input":"<!DOCTYPE html SYS", |
287 |
|
|
"output":["ParseError", "ParseError", ["DOCTYPE", "html", null, null, false]]} |
288 |
wakaba |
1.1 |
|
289 |
|
|
]} |