summaryrefslogtreecommitdiff
path: root/tests/html5lib-tests/tokenizer/test4.test
blob: 8963c7471184e53446afaa31e9cc7a74624a3812 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
{"tests": [

{"description":"< in attribute name",
"input":"<z/0  <>",
"output":[["StartTag", "z", {"0": "", "<": ""}]],
"errors":[
    { "code": "unexpected-solidus-in-tag", "line": 1, "col": 4 },
    { "code": "unexpected-character-in-attribute-name", "line": 1, "col": 7 }
]},

{"description":"< in unquoted attribute value",
"input":"<z x=<>",
"output":[["StartTag", "z", {"x": "<"}]],
"errors":[
    { "code": "unexpected-character-in-unquoted-attribute-value", "line": 1, "col": 6 }
]},

{"description":"= in unquoted attribute value",
"input":"<z z=z=z>",
"output":[["StartTag", "z", {"z": "z=z"}]],
"errors":[
    { "code": "unexpected-character-in-unquoted-attribute-value", "line": 1, "col": 7 }
]},

{"description":"= attribute",
"input":"<z =>",
"output":[["StartTag", "z", {"=": ""}]],
"errors":[
    { "code": "unexpected-equals-sign-before-attribute-name", "line": 1, "col": 4 }
]},

{"description":"== attribute",
"input":"<z ==>",
"output":[["StartTag", "z", {"=": ""}]],
"errors":[
    { "code": "unexpected-equals-sign-before-attribute-name", "line": 1, "col": 4 },
    { "code": "missing-attribute-value", "line": 1, "col": 6 }
]},

{"description":"=== attribute",
"input":"<z ===>",
"output":[["StartTag", "z", {"=": "="}]],
"errors":[
    { "code": "unexpected-equals-sign-before-attribute-name", "line": 1, "col": 4 },
    { "code": "unexpected-character-in-unquoted-attribute-value", "line": 1, "col": 6 }
]},

{"description":"==== attribute",
"input":"<z ====>",
"output":[["StartTag", "z", {"=": "=="}]],
"errors":[
    { "code": "unexpected-equals-sign-before-attribute-name", "line": 1, "col": 4 },
    { "code": "unexpected-character-in-unquoted-attribute-value", "line": 1, "col": 6 },
    { "code": "unexpected-character-in-unquoted-attribute-value", "line": 1, "col": 7 }
]},

{"description":"\" after ampersand in double-quoted attribute value",
"input":"<z z=\"&\">",
"output":[["StartTag", "z", {"z": "&"}]]},

{"description":"' after ampersand in double-quoted attribute value",
"input":"<z z=\"&'\">",
"output":[["StartTag", "z", {"z": "&'"}]]},

{"description":"' after ampersand in single-quoted attribute value",
"input":"<z z='&'>",
"output":[["StartTag", "z", {"z": "&"}]]},

{"description":"\" after ampersand in single-quoted attribute value",
"input":"<z z='&\"'>",
"output":[["StartTag", "z", {"z": "&\""}]]},

{"description":"Text after bogus character reference",
"input":"<z z='&xlink_xmlns;'>bar<z>",
"output":[["StartTag","z",{"z":"&xlink_xmlns;"}],["Character","bar"],["StartTag","z",{}]]},

{"description":"Text after hex character reference",
"input":"<z z='&#x0020; foo'>bar<z>",
"output":[["StartTag","z",{"z":"  foo"}],["Character","bar"],["StartTag","z",{}]]},

{"description":"Attribute name starting with \"",
"input":"<foo \"='bar'>",
"output":[["StartTag", "foo", {"\"": "bar"}]],
"errors":[
    { "code": "unexpected-character-in-attribute-name", "line": 1, "col": 6 }
]},

{"description":"Attribute name starting with '",
"input":"<foo '='bar'>",
"output":[["StartTag", "foo", {"'": "bar"}]],
"errors":[
    { "code": "unexpected-character-in-attribute-name", "line": 1, "col": 6 }
]},

{"description":"Attribute name containing \"",
"input":"<foo a\"b='bar'>",
"output":[["StartTag", "foo", {"a\"b": "bar"}]],
"errors":[
    { "code": "unexpected-character-in-attribute-name", "line": 1, "col": 7 }
]},

{"description":"Attribute name containing '",
"input":"<foo a'b='bar'>",
"output":[["StartTag", "foo", {"a'b": "bar"}]],
"errors":[
    { "code": "unexpected-character-in-attribute-name", "line": 1, "col": 7 }
]},

{"description":"Unquoted attribute value containing '",
"input":"<foo a=b'c>",
"output":[["StartTag", "foo", {"a": "b'c"}]],
"errors":[
    { "code": "unexpected-character-in-unquoted-attribute-value", "line": 1, "col": 9 }
]},


{"description":"Unquoted attribute value containing \"",
"input":"<foo a=b\"c>",
"output":[["StartTag", "foo", {"a": "b\"c"}]],
"errors":[
    { "code": "unexpected-character-in-unquoted-attribute-value", "line": 1, "col": 9 }
]},

{"description":"Double-quoted attribute value not followed by whitespace",
"input":"<foo a=\"b\"c>",
"output":[["StartTag", "foo", {"a": "b", "c": ""}]],
"errors":[
    { "code": "missing-whitespace-between-attributes", "line": 1, "col": 11 }
]},

{"description":"Single-quoted attribute value not followed by whitespace",
"input":"<foo a='b'c>",
"output":[["StartTag", "foo", {"a": "b", "c": ""}]],
"errors":[
    { "code": "missing-whitespace-between-attributes", "line": 1, "col": 11 }
]},

{"description":"Quoted attribute followed by permitted /",
"input":"<br a='b'/>",
"output":[["StartTag","br",{"a":"b"},true]]},

{"description":"Quoted attribute followed by non-permitted /",
"input":"<bar a='b'/>",
"output":[["StartTag","bar",{"a":"b"},true]]},

{"description":"CR EOF after doctype name",
"input":"<!doctype html \r",
"output":[["DOCTYPE", "html", null, null, false]],
"errors":[
    { "code": "eof-in-doctype", "line": 2, "col": 1 }
]},

{"description":"CR EOF in tag name",
"input":"<z\r",
"output":[],
"errors":[
    { "code": "eof-in-tag", "line": 2, "col": 1 }
]},

{"description":"Slash EOF in tag name",
"input":"<z/",
"output":[],
"errors":[
    { "code": "eof-in-tag", "line": 1, "col": 4 }
]},

{"description":"Zero hex numeric entity",
"input":"&#x0",
"output":[["Character", "\uFFFD"]],
"errors":[
    { "code": "missing-semicolon-after-character-reference", "line": 1, "col": 5 },
    { "code": "null-character-reference", "line": 1, "col": 5 }
]},

{"description":"Zero decimal numeric entity",
"input":"&#0",
"output":[["Character", "\uFFFD"]],
"errors":[
    { "code": "missing-semicolon-after-character-reference", "line": 1, "col": 4 },
    { "code": "null-character-reference", "line": 1, "col": 4 }
]},

{"description":"Zero-prefixed hex numeric entity",
"input":"&#x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041;",
"output":[["Character", "A"]]},

{"description":"Zero-prefixed decimal numeric entity",
"input":"&#000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000065;",
"output":[["Character", "A"]]},

{"description":"Empty hex numeric entities",
"input":"&#x &#X ",
"output":[["Character", "&#x &#X "]],
"errors":[
    { "code": "absence-of-digits-in-numeric-character-reference", "line": 1, "col": 4 },
    { "code": "absence-of-digits-in-numeric-character-reference", "line": 1, "col": 8 }
]},

{"description":"Invalid digit in hex numeric entity",
"input":"&#xZ",
"output":[["Character", "&#xZ"]],
"errors":[
    { "code": "absence-of-digits-in-numeric-character-reference", "line": 1, "col": 4 }
]},

{"description":"Empty decimal numeric entities",
"input":"&# &#; ",
"output":[["Character", "&# &#; "]],
"errors":[
    { "code": "absence-of-digits-in-numeric-character-reference", "line": 1, "col": 3 },
    { "code": "absence-of-digits-in-numeric-character-reference", "line": 1, "col": 6 }
]},

{"description":"Invalid digit in decimal numeric entity",
"input":"&#A",
"output":[["Character", "&#A"]],
"errors":[
    { "code": "absence-of-digits-in-numeric-character-reference", "line": 1, "col": 3 }
]},

{"description":"Non-BMP numeric entity",
"input":"&#x10000;",
"output":[["Character", "\uD800\uDC00"]]},

{"description":"Maximum non-BMP numeric entity",
"input":"&#X10FFFF;",
"output":[["Character", "\uDBFF\uDFFF"]],
"errors":[
    { "code": "noncharacter-character-reference", "line": 1, "col": 11 }
]},


{"description":"Above maximum numeric entity",
"input":"&#x110000;",
"output":[["Character", "\uFFFD"]],
"errors":[
    { "code": "character-reference-outside-unicode-range", "line": 1, "col": 11 }
]},

{"description":"32-bit hex numeric entity",
"input":"&#x80000041;",
"output":[["Character", "\uFFFD"]],
"errors":[
    { "code": "character-reference-outside-unicode-range", "line": 1, "col": 13 }
]},

{"description":"33-bit hex numeric entity",
"input":"&#x100000041;",
"output":[["Character", "\uFFFD"]],
"errors":[
    { "code": "character-reference-outside-unicode-range", "line": 1, "col": 14 }
]},

{"description":"33-bit decimal numeric entity",
"input":"&#4294967361;",
"output":[["Character", "\uFFFD"]],
"errors":[
    { "code": "character-reference-outside-unicode-range", "line": 1, "col": 14 }
]},

{"description":"65-bit hex numeric entity",
"input":"&#x10000000000000041;",
"output":[["Character", "\uFFFD"]],
"errors":[
    { "code": "character-reference-outside-unicode-range", "line": 1, "col": 22 }
]},

{"description":"65-bit decimal numeric entity",
"input":"&#18446744073709551681;",
"output":[["Character", "\uFFFD"]],
"errors":[
    { "code": "character-reference-outside-unicode-range", "line": 1, "col": 24 }
]},

{"description":"Surrogate code point edge cases",
"input":"&#xD7FF;&#xD800;&#xD801;&#xDFFE;&#xDFFF;&#xE000;",
"output":[["Character", "\uD7FF\uFFFD\uFFFD\uFFFD\uFFFD\uE000"]],
"errors":[
    { "code": "surrogate-character-reference", "line": 1, "col": 17 },
    { "code": "surrogate-character-reference", "line": 1, "col": 25 },
    { "code": "surrogate-character-reference", "line": 1, "col": 33 },
    { "code": "surrogate-character-reference", "line": 1, "col": 41 }
]},

{"description":"Uppercase start tag name",
"input":"<X>",
"output":[["StartTag", "x", {}]]},

{"description":"Uppercase end tag name",
"input":"</X>",
"output":[["EndTag", "x"]]},

{"description":"Uppercase attribute name",
"input":"<x X>",
"output":[["StartTag", "x", { "x":"" }]]},

{"description":"Tag/attribute name case edge values",
"input":"<x@AZ[`az{ @AZ[`az{>",
"output":[["StartTag", "x@az[`az{", { "@az[`az{":"" }]]},

{"description":"Duplicate different-case attributes",
"input":"<x x=1 x=2 X=3>",
"output":[["StartTag", "x", { "x":"1" }]],
"errors":[
    { "code": "duplicate-attribute", "line": 1, "col": 9 },
    { "code": "duplicate-attribute", "line": 1, "col": 13 }
]},

{"description":"Uppercase close tag attributes",
"input":"</x X>",
"output":[["EndTag", "x"]],
"errors":[
    { "code": "end-tag-with-attributes", "line": 1, "col": 6 }
]},

{"description":"Duplicate close tag attributes",
"input":"</x x x>",
"output":[["EndTag", "x"]],
"errors":[
    { "code": "duplicate-attribute", "line": 1, "col": 8 },
    { "code": "end-tag-with-attributes", "line": 1, "col": 8 }
]},

{"description":"Permitted slash",
"input":"<br/>",
"output":[["StartTag","br",{},true]]},

{"description":"Non-permitted slash",
"input":"<xr/>",
"output":[["StartTag","xr",{},true]]},

{"description":"Permitted slash but in close tag",
"input":"</br/>",
"output":[["EndTag", "br"]],
"errors":[
    { "code": "end-tag-with-trailing-solidus", "line": 1, "col": 6 }
]},

{"description":"Doctype public case-sensitivity (1)",
"input":"<!DoCtYpE HtMl PuBlIc \"AbC\" \"XyZ\">",
"output":[["DOCTYPE", "html", "AbC", "XyZ", true]]},

{"description":"Doctype public case-sensitivity (2)",
"input":"<!dOcTyPe hTmL pUbLiC \"aBc\" \"xYz\">",
"output":[["DOCTYPE", "html", "aBc", "xYz", true]]},

{"description":"Doctype system case-sensitivity (1)",
"input":"<!DoCtYpE HtMl SyStEm \"XyZ\">",
"output":[["DOCTYPE", "html", null, "XyZ", true]]},

{"description":"Doctype system case-sensitivity (2)",
"input":"<!dOcTyPe hTmL sYsTeM \"xYz\">",
"output":[["DOCTYPE", "html", null, "xYz", true]]},

{"description":"U+0000 in lookahead region after non-matching character",
"input":"<!doc>\u0000",
"output":[["Comment", "doc"], ["Character", "\u0000"]],
"errors":[
    { "code": "incorrectly-opened-comment", "line": 1, "col": 3 },
    { "code": "unexpected-null-character", "line": 1, "col": 7 }
]},

{"description":"U+0000 in lookahead region",
"input":"<!doc\u0000",
"output":[["Comment", "doc\uFFFD"]],
"errors":[
    { "code": "incorrectly-opened-comment", "line": 1, "col": 3 },
    { "code": "unexpected-null-character", "line": 1, "col": 6 }
]},

{"description":"U+0080 in lookahead region",
"input":"<!doc\u0080",
"output":[["Comment", "doc\u0080"]],
"errors":[
    { "code": "incorrectly-opened-comment", "line": 1, "col": 3 },
    { "code": "control-character-in-input-stream", "line": 1, "col": 6 }
]},

{"description":"U+FDD1 in lookahead region",
"input":"<!doc\uFDD1",
"output":[["Comment", "doc\uFDD1"]],
"errors":[
    { "code": "incorrectly-opened-comment", "line": 1, "col": 3 },
    { "code": "noncharacter-in-input-stream", "line": 1, "col": 6 }
]},

{"description":"U+1FFFF in lookahead region",
"input":"<!doc\uD83F\uDFFF",
"output":[["Comment", "doc\uD83F\uDFFF"]],
"errors":[
    { "code": "incorrectly-opened-comment", "line": 1, "col": 3 },
    { "code": "noncharacter-in-input-stream", "line": 1, "col": 6 }
]},

{"description":"CR followed by non-LF",
"input":"\r?",
"output":[["Character", "\n?"]]},

{"description":"CR at EOF",
"input":"\r",
"output":[["Character", "\n"]]},

{"description":"LF at EOF",
"input":"\n",
"output":[["Character", "\n"]]},

{"description":"CR LF",
"input":"\r\n",
"output":[["Character", "\n"]]},

{"description":"CR CR",
"input":"\r\r",
"output":[["Character", "\n\n"]]},

{"description":"LF LF",
"input":"\n\n",
"output":[["Character", "\n\n"]]},

{"description":"LF CR",
"input":"\n\r",
"output":[["Character", "\n\n"]]},

{"description":"text CR CR CR text",
"input":"text\r\r\rtext",
"output":[["Character", "text\n\n\ntext"]]},

{"description":"Doctype publik",
"input":"<!DOCTYPE html PUBLIK \"AbC\" \"XyZ\">",
"output":[["DOCTYPE", "html", null, null, false]],
"errors":[
    { "code": "invalid-character-sequence-after-doctype-name", "line": 1, "col": 16 }
]},

{"description":"Doctype publi",
"input":"<!DOCTYPE html PUBLI",
"output":[["DOCTYPE", "html", null, null, false]],
"errors":[
    { "code": "invalid-character-sequence-after-doctype-name", "line": 1, "col": 16 }
]},

{"description":"Doctype sistem",
"input":"<!DOCTYPE html SISTEM \"AbC\">",
"output":[["DOCTYPE", "html", null, null, false]],
"errors":[
    { "code": "invalid-character-sequence-after-doctype-name", "line": 1, "col": 16 }
]},

{"description":"Doctype sys",
"input":"<!DOCTYPE html SYS",
"output":[["DOCTYPE", "html", null, null, false]],
"errors":[
    { "code": "invalid-character-sequence-after-doctype-name", "line": 1, "col": 16 }
]},

{"description":"Doctype html x>text",
"input":"<!DOCTYPE html x>text",
"output":[["DOCTYPE", "html", null, null, false], ["Character", "text"]],
"errors":[
    { "code": "invalid-character-sequence-after-doctype-name", "line": 1, "col": 16 }
]},

{"description":"Grave accent in unquoted attribute",
"input":"<a a=aa`>",
"output":[["StartTag", "a", {"a":"aa`"}]],
"errors":[
    { "code": "unexpected-character-in-unquoted-attribute-value", "line": 1, "col": 8 }
]},

{"description":"EOF in tag name state ",
"input":"<a",
"output":[],
"errors": [
    { "code": "eof-in-tag", "line": 1, "col": 3 }
]},

{"description":"EOF in before attribute name state",
"input":"<a ",
"output":[],
"errors":[
    { "code": "eof-in-tag", "line": 1, "col": 4 }
]},

{"description":"EOF in attribute name state",
"input":"<a a",
"output":[],
"errors":[
    { "code": "eof-in-tag", "line": 1, "col": 5 }
]},

{"description":"EOF in after attribute name state",
"input":"<a a ",
"output":[],
"errors":[
    { "code": "eof-in-tag", "line": 1, "col": 6 }
]},

{"description":"EOF in before attribute value state",
"input":"<a a =",
"output":[],
"errors":[
    { "code": "eof-in-tag", "line": 1, "col": 7 }
]},

{"description":"EOF in attribute value (double quoted) state",
"input":"<a a =\"a",
"output":[],
"errors":[
    { "code": "eof-in-tag", "line": 1, "col": 9 }
]},

{"description":"EOF in attribute value (single quoted) state",
"input":"<a a ='a",
"output":[],
"errors":[
    { "code": "eof-in-tag", "line": 1, "col": 9 }
]},

{"description":"EOF in attribute value (unquoted) state",
"input":"<a a =a",
"output":[],
"errors":[
    { "code": "eof-in-tag", "line": 1, "col": 8 }
]},

{"description":"EOF in after attribute value state",
"input":"<a a ='a'",
"output":[],
"errors":[
    { "code": "eof-in-tag", "line": 1, "col": 10 }
]}

]}