parse5 0.6.1 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/.npmignore +3 -1
  2. package/LICENSE +1 -1
  3. package/README.md +166 -77
  4. package/index.js +7 -0
  5. package/lib/{html.js → const/html.js} +0 -0
  6. package/lib/{unicode.js → const/unicode.js} +0 -0
  7. package/lib/{named_entity_trie.js → tokenization_stage/named_entity_trie.js} +1 -1
  8. package/lib/tokenization_stage/parser_simulator.js +2 -0
  9. package/lib/{preprocessor.js → tokenization_stage/preprocessor.js} +5 -5
  10. package/lib/{tokenizer.js → tokenization_stage/tokenizer.js} +37 -37
  11. package/lib/{default_tree_adapter.js → tree_adapters/default.js} +47 -0
  12. package/lib/tree_adapters/htmlparser2.js +267 -0
  13. package/lib/{formatting_element_list.js → tree_construction_stage/formatting_element_list.js} +1 -1
  14. package/lib/{open_element_stack.js → tree_construction_stage/open_element_stack.js} +2 -2
  15. package/lib/{parser.js → tree_construction_stage/parser.js} +8 -8
  16. package/lib/tree_construction_stage/tree_serializer.js +165 -0
  17. package/package.json +33 -26
  18. package/test/data/tokenizer/contentModelFlags.test +0 -75
  19. package/test/data/tokenizer/domjs.test +0 -90
  20. package/test/data/tokenizer/entities.test +0 -283
  21. package/test/data/tokenizer/escapeFlag.test +0 -33
  22. package/test/data/tokenizer/namedEntities.test +0 -44189
  23. package/test/data/tokenizer/numericEntities.test +0 -1313
  24. package/test/data/tokenizer/pendingSpecChanges.test +0 -7
  25. package/test/data/tokenizer/test1.test +0 -196
  26. package/test/data/tokenizer/test2.test +0 -179
  27. package/test/data/tokenizer/test3.test +0 -6047
  28. package/test/data/tokenizer/test4.test +0 -344
  29. package/test/data/tokenizer/unicodeChars.test +0 -1295
  30. package/test/data/tokenizer/unicodeCharsProblematic.test +0 -27
  31. package/test/data/tree-construction/adoption01.dat +0 -275
  32. package/test/data/tree-construction/adoption02.dat +0 -31
  33. package/test/data/tree-construction/comments01.dat +0 -146
  34. package/test/data/tree-construction/doctype01.dat +0 -370
  35. package/test/data/tree-construction/domjs-unsafe.dat +0 -0
  36. package/test/data/tree-construction/entities01.dat +0 -603
  37. package/test/data/tree-construction/entities02.dat +0 -249
  38. package/test/data/tree-construction/html5test-com.dat +0 -246
  39. package/test/data/tree-construction/inbody01.dat +0 -43
  40. package/test/data/tree-construction/isindex.dat +0 -40
  41. package/test/data/tree-construction/main-element.dat +0 -29
  42. package/test/data/tree-construction/pending-spec-changes-plain-text-unsafe.dat +0 -0
  43. package/test/data/tree-construction/pending-spec-changes.dat +0 -52
  44. package/test/data/tree-construction/plain-text-unsafe.dat +0 -0
  45. package/test/data/tree-construction/scriptdata01.dat +0 -308
  46. package/test/data/tree-construction/tables01.dat +0 -212
  47. package/test/data/tree-construction/tests1.dat +0 -1952
  48. package/test/data/tree-construction/tests10.dat +0 -799
  49. package/test/data/tree-construction/tests11.dat +0 -482
  50. package/test/data/tree-construction/tests12.dat +0 -62
  51. package/test/data/tree-construction/tests14.dat +0 -74
  52. package/test/data/tree-construction/tests15.dat +0 -208
  53. package/test/data/tree-construction/tests16.dat +0 -2299
  54. package/test/data/tree-construction/tests17.dat +0 -153
  55. package/test/data/tree-construction/tests18.dat +0 -269
  56. package/test/data/tree-construction/tests19.dat +0 -1249
  57. package/test/data/tree-construction/tests2.dat +0 -763
  58. package/test/data/tree-construction/tests20.dat +0 -455
  59. package/test/data/tree-construction/tests21.dat +0 -257
  60. package/test/data/tree-construction/tests22.dat +0 -157
  61. package/test/data/tree-construction/tests23.dat +0 -155
  62. package/test/data/tree-construction/tests24.dat +0 -79
  63. package/test/data/tree-construction/tests25.dat +0 -219
  64. package/test/data/tree-construction/tests26.dat +0 -313
  65. package/test/data/tree-construction/tests3.dat +0 -305
  66. package/test/data/tree-construction/tests4.dat +0 -59
  67. package/test/data/tree-construction/tests5.dat +0 -191
  68. package/test/data/tree-construction/tests6.dat +0 -663
  69. package/test/data/tree-construction/tests7.dat +0 -390
  70. package/test/data/tree-construction/tests8.dat +0 -148
  71. package/test/data/tree-construction/tests9.dat +0 -457
  72. package/test/data/tree-construction/tests_innerHTML_1.dat +0 -741
  73. package/test/data/tree-construction/tricky01.dat +0 -261
  74. package/test/data/tree-construction/webkit01.dat +0 -594
  75. package/test/data/tree-construction/webkit02.dat +0 -94
  76. package/test/fixtures/formatting_element_list_test.js +0 -267
  77. package/test/fixtures/open_element_stack_test.js +0 -495
  78. package/test/fixtures/parser_test.js +0 -160
  79. package/test/fixtures/tokenizer_test.js +0 -178
  80. package/test/run_tests.js +0 -10
@@ -1,455 +0,0 @@
1
- #data
2
- <!doctype html><p><button><button>
3
- #errors
4
- #document
5
- | <!DOCTYPE html>
6
- | <html>
7
- | <head>
8
- | <body>
9
- | <p>
10
- | <button>
11
- | <button>
12
-
13
- #data
14
- <!doctype html><p><button><address>
15
- #errors
16
- #document
17
- | <!DOCTYPE html>
18
- | <html>
19
- | <head>
20
- | <body>
21
- | <p>
22
- | <button>
23
- | <address>
24
-
25
- #data
26
- <!doctype html><p><button><blockquote>
27
- #errors
28
- #document
29
- | <!DOCTYPE html>
30
- | <html>
31
- | <head>
32
- | <body>
33
- | <p>
34
- | <button>
35
- | <blockquote>
36
-
37
- #data
38
- <!doctype html><p><button><menu>
39
- #errors
40
- #document
41
- | <!DOCTYPE html>
42
- | <html>
43
- | <head>
44
- | <body>
45
- | <p>
46
- | <button>
47
- | <menu>
48
-
49
- #data
50
- <!doctype html><p><button><p>
51
- #errors
52
- #document
53
- | <!DOCTYPE html>
54
- | <html>
55
- | <head>
56
- | <body>
57
- | <p>
58
- | <button>
59
- | <p>
60
-
61
- #data
62
- <!doctype html><p><button><ul>
63
- #errors
64
- #document
65
- | <!DOCTYPE html>
66
- | <html>
67
- | <head>
68
- | <body>
69
- | <p>
70
- | <button>
71
- | <ul>
72
-
73
- #data
74
- <!doctype html><p><button><h1>
75
- #errors
76
- #document
77
- | <!DOCTYPE html>
78
- | <html>
79
- | <head>
80
- | <body>
81
- | <p>
82
- | <button>
83
- | <h1>
84
-
85
- #data
86
- <!doctype html><p><button><h6>
87
- #errors
88
- #document
89
- | <!DOCTYPE html>
90
- | <html>
91
- | <head>
92
- | <body>
93
- | <p>
94
- | <button>
95
- | <h6>
96
-
97
- #data
98
- <!doctype html><p><button><listing>
99
- #errors
100
- #document
101
- | <!DOCTYPE html>
102
- | <html>
103
- | <head>
104
- | <body>
105
- | <p>
106
- | <button>
107
- | <listing>
108
-
109
- #data
110
- <!doctype html><p><button><pre>
111
- #errors
112
- #document
113
- | <!DOCTYPE html>
114
- | <html>
115
- | <head>
116
- | <body>
117
- | <p>
118
- | <button>
119
- | <pre>
120
-
121
- #data
122
- <!doctype html><p><button><form>
123
- #errors
124
- #document
125
- | <!DOCTYPE html>
126
- | <html>
127
- | <head>
128
- | <body>
129
- | <p>
130
- | <button>
131
- | <form>
132
-
133
- #data
134
- <!doctype html><p><button><li>
135
- #errors
136
- #document
137
- | <!DOCTYPE html>
138
- | <html>
139
- | <head>
140
- | <body>
141
- | <p>
142
- | <button>
143
- | <li>
144
-
145
- #data
146
- <!doctype html><p><button><dd>
147
- #errors
148
- #document
149
- | <!DOCTYPE html>
150
- | <html>
151
- | <head>
152
- | <body>
153
- | <p>
154
- | <button>
155
- | <dd>
156
-
157
- #data
158
- <!doctype html><p><button><dt>
159
- #errors
160
- #document
161
- | <!DOCTYPE html>
162
- | <html>
163
- | <head>
164
- | <body>
165
- | <p>
166
- | <button>
167
- | <dt>
168
-
169
- #data
170
- <!doctype html><p><button><plaintext>
171
- #errors
172
- #document
173
- | <!DOCTYPE html>
174
- | <html>
175
- | <head>
176
- | <body>
177
- | <p>
178
- | <button>
179
- | <plaintext>
180
-
181
- #data
182
- <!doctype html><p><button><table>
183
- #errors
184
- #document
185
- | <!DOCTYPE html>
186
- | <html>
187
- | <head>
188
- | <body>
189
- | <p>
190
- | <button>
191
- | <table>
192
-
193
- #data
194
- <!doctype html><p><button><hr>
195
- #errors
196
- #document
197
- | <!DOCTYPE html>
198
- | <html>
199
- | <head>
200
- | <body>
201
- | <p>
202
- | <button>
203
- | <hr>
204
-
205
- #data
206
- <!doctype html><p><button><xmp>
207
- #errors
208
- #document
209
- | <!DOCTYPE html>
210
- | <html>
211
- | <head>
212
- | <body>
213
- | <p>
214
- | <button>
215
- | <xmp>
216
-
217
- #data
218
- <!doctype html><p><button></p>
219
- #errors
220
- #document
221
- | <!DOCTYPE html>
222
- | <html>
223
- | <head>
224
- | <body>
225
- | <p>
226
- | <button>
227
- | <p>
228
-
229
- #data
230
- <!doctype html><address><button></address>a
231
- #errors
232
- #document
233
- | <!DOCTYPE html>
234
- | <html>
235
- | <head>
236
- | <body>
237
- | <address>
238
- | <button>
239
- | "a"
240
-
241
- #data
242
- <!doctype html><address><button></address>a
243
- #errors
244
- #document
245
- | <!DOCTYPE html>
246
- | <html>
247
- | <head>
248
- | <body>
249
- | <address>
250
- | <button>
251
- | "a"
252
-
253
- #data
254
- <p><table></p>
255
- #errors
256
- #document
257
- | <html>
258
- | <head>
259
- | <body>
260
- | <p>
261
- | <p>
262
- | <table>
263
-
264
- #data
265
- <!doctype html><svg>
266
- #errors
267
- #document
268
- | <!DOCTYPE html>
269
- | <html>
270
- | <head>
271
- | <body>
272
- | <svg svg>
273
-
274
- #data
275
- <!doctype html><p><figcaption>
276
- #errors
277
- #document
278
- | <!DOCTYPE html>
279
- | <html>
280
- | <head>
281
- | <body>
282
- | <p>
283
- | <figcaption>
284
-
285
- #data
286
- <!doctype html><p><summary>
287
- #errors
288
- #document
289
- | <!DOCTYPE html>
290
- | <html>
291
- | <head>
292
- | <body>
293
- | <p>
294
- | <summary>
295
-
296
- #data
297
- <!doctype html><form><table><form>
298
- #errors
299
- #document
300
- | <!DOCTYPE html>
301
- | <html>
302
- | <head>
303
- | <body>
304
- | <form>
305
- | <table>
306
-
307
- #data
308
- <!doctype html><table><form><form>
309
- #errors
310
- #document
311
- | <!DOCTYPE html>
312
- | <html>
313
- | <head>
314
- | <body>
315
- | <table>
316
- | <form>
317
-
318
- #data
319
- <!doctype html><table><form></table><form>
320
- #errors
321
- #document
322
- | <!DOCTYPE html>
323
- | <html>
324
- | <head>
325
- | <body>
326
- | <table>
327
- | <form>
328
-
329
- #data
330
- <!doctype html><svg><foreignObject><p>
331
- #errors
332
- #document
333
- | <!DOCTYPE html>
334
- | <html>
335
- | <head>
336
- | <body>
337
- | <svg svg>
338
- | <svg foreignObject>
339
- | <p>
340
-
341
- #data
342
- <!doctype html><svg><title>abc
343
- #errors
344
- #document
345
- | <!DOCTYPE html>
346
- | <html>
347
- | <head>
348
- | <body>
349
- | <svg svg>
350
- | <svg title>
351
- | "abc"
352
-
353
- #data
354
- <option><span><option>
355
- #errors
356
- #document
357
- | <html>
358
- | <head>
359
- | <body>
360
- | <option>
361
- | <span>
362
- | <option>
363
-
364
- #data
365
- <option><option>
366
- #errors
367
- #document
368
- | <html>
369
- | <head>
370
- | <body>
371
- | <option>
372
- | <option>
373
-
374
- #data
375
- <math><annotation-xml><div>
376
- #errors
377
- #document
378
- | <html>
379
- | <head>
380
- | <body>
381
- | <math math>
382
- | <math annotation-xml>
383
- | <div>
384
-
385
- #data
386
- <math><annotation-xml encoding="application/svg+xml"><div>
387
- #errors
388
- #document
389
- | <html>
390
- | <head>
391
- | <body>
392
- | <math math>
393
- | <math annotation-xml>
394
- | encoding="application/svg+xml"
395
- | <div>
396
-
397
- #data
398
- <math><annotation-xml encoding="application/xhtml+xml"><div>
399
- #errors
400
- #document
401
- | <html>
402
- | <head>
403
- | <body>
404
- | <math math>
405
- | <math annotation-xml>
406
- | encoding="application/xhtml+xml"
407
- | <div>
408
-
409
- #data
410
- <math><annotation-xml encoding="aPPlication/xhtmL+xMl"><div>
411
- #errors
412
- #document
413
- | <html>
414
- | <head>
415
- | <body>
416
- | <math math>
417
- | <math annotation-xml>
418
- | encoding="aPPlication/xhtmL+xMl"
419
- | <div>
420
-
421
- #data
422
- <math><annotation-xml encoding="text/html"><div>
423
- #errors
424
- #document
425
- | <html>
426
- | <head>
427
- | <body>
428
- | <math math>
429
- | <math annotation-xml>
430
- | encoding="text/html"
431
- | <div>
432
-
433
- #data
434
- <math><annotation-xml encoding="Text/htmL"><div>
435
- #errors
436
- #document
437
- | <html>
438
- | <head>
439
- | <body>
440
- | <math math>
441
- | <math annotation-xml>
442
- | encoding="Text/htmL"
443
- | <div>
444
-
445
- #data
446
- <math><annotation-xml encoding=" text/html "><div>
447
- #errors
448
- #document
449
- | <html>
450
- | <head>
451
- | <body>
452
- | <math math>
453
- | <math annotation-xml>
454
- | encoding=" text/html "
455
- | <div>
@@ -1,257 +0,0 @@
1
- #data
2
- <svg><![CDATA[foo]]>
3
- #errors
4
- #document
5
- | <html>
6
- | <head>
7
- | <body>
8
- | <svg svg>
9
- | "foo"
10
-
11
- #data
12
- <math><![CDATA[foo]]>
13
- #errors
14
- #document
15
- | <html>
16
- | <head>
17
- | <body>
18
- | <math math>
19
- | "foo"
20
-
21
- #data
22
- <div><![CDATA[foo]]>
23
- #errors
24
- #document
25
- | <html>
26
- | <head>
27
- | <body>
28
- | <div>
29
- | <!-- [CDATA[foo]] -->
30
-
31
- #data
32
- <svg><![CDATA[foo
33
- #errors
34
- #document
35
- | <html>
36
- | <head>
37
- | <body>
38
- | <svg svg>
39
- | "foo"
40
-
41
- #data
42
- <svg><![CDATA[foo
43
- #errors
44
- #document
45
- | <html>
46
- | <head>
47
- | <body>
48
- | <svg svg>
49
- | "foo"
50
-
51
- #data
52
- <svg><![CDATA[
53
- #errors
54
- #document
55
- | <html>
56
- | <head>
57
- | <body>
58
- | <svg svg>
59
-
60
- #data
61
- <svg><![CDATA[]]>
62
- #errors
63
- #document
64
- | <html>
65
- | <head>
66
- | <body>
67
- | <svg svg>
68
-
69
- #data
70
- <svg><![CDATA[]] >]]>
71
- #errors
72
- #document
73
- | <html>
74
- | <head>
75
- | <body>
76
- | <svg svg>
77
- | "]] >"
78
-
79
- #data
80
- <svg><![CDATA[]] >]]>
81
- #errors
82
- #document
83
- | <html>
84
- | <head>
85
- | <body>
86
- | <svg svg>
87
- | "]] >"
88
-
89
- #data
90
- <svg><![CDATA[]]
91
- #errors
92
- #document
93
- | <html>
94
- | <head>
95
- | <body>
96
- | <svg svg>
97
- | "]]"
98
-
99
- #data
100
- <svg><![CDATA[]
101
- #errors
102
- #document
103
- | <html>
104
- | <head>
105
- | <body>
106
- | <svg svg>
107
- | "]"
108
-
109
- #data
110
- <svg><![CDATA[]>a
111
- #errors
112
- #document
113
- | <html>
114
- | <head>
115
- | <body>
116
- | <svg svg>
117
- | "]>a"
118
-
119
- #data
120
- <!DOCTYPE html><svg><![CDATA[foo]]]>
121
- #errors
122
- 36: End of file in a foreign namespace context.
123
- #document
124
- | <!DOCTYPE html>
125
- | <html>
126
- | <head>
127
- | <body>
128
- | <svg svg>
129
- | "foo]"
130
-
131
- #data
132
- <!DOCTYPE html><svg><![CDATA[foo]]]]>
133
- #errors
134
- 36: End of file in a foreign namespace context.
135
- #document
136
- | <!DOCTYPE html>
137
- | <html>
138
- | <head>
139
- | <body>
140
- | <svg svg>
141
- | "foo]]"
142
-
143
- #data
144
- <!DOCTYPE html><svg><![CDATA[foo]]]]]>
145
- #errors
146
- 36: End of file in a foreign namespace context.
147
- #document
148
- | <!DOCTYPE html>
149
- | <html>
150
- | <head>
151
- | <body>
152
- | <svg svg>
153
- | "foo]]]"
154
-
155
- #data
156
- <svg><foreignObject><div><![CDATA[foo]]>
157
- #errors
158
- #document
159
- | <html>
160
- | <head>
161
- | <body>
162
- | <svg svg>
163
- | <svg foreignObject>
164
- | <div>
165
- | <!-- [CDATA[foo]] -->
166
-
167
- #data
168
- <svg><![CDATA[<svg>]]>
169
- #errors
170
- #document
171
- | <html>
172
- | <head>
173
- | <body>
174
- | <svg svg>
175
- | "<svg>"
176
-
177
- #data
178
- <svg><![CDATA[</svg>a]]>
179
- #errors
180
- #document
181
- | <html>
182
- | <head>
183
- | <body>
184
- | <svg svg>
185
- | "</svg>a"
186
-
187
- #data
188
- <svg><![CDATA[<svg>a
189
- #errors
190
- #document
191
- | <html>
192
- | <head>
193
- | <body>
194
- | <svg svg>
195
- | "<svg>a"
196
-
197
- #data
198
- <svg><![CDATA[</svg>a
199
- #errors
200
- #document
201
- | <html>
202
- | <head>
203
- | <body>
204
- | <svg svg>
205
- | "</svg>a"
206
-
207
- #data
208
- <svg><![CDATA[<svg>]]><path>
209
- #errors
210
- #document
211
- | <html>
212
- | <head>
213
- | <body>
214
- | <svg svg>
215
- | "<svg>"
216
- | <svg path>
217
-
218
- #data
219
- <svg><![CDATA[<svg>]]></path>
220
- #errors
221
- #document
222
- | <html>
223
- | <head>
224
- | <body>
225
- | <svg svg>
226
- | "<svg>"
227
-
228
- #data
229
- <svg><![CDATA[<svg>]]><!--path-->
230
- #errors
231
- #document
232
- | <html>
233
- | <head>
234
- | <body>
235
- | <svg svg>
236
- | "<svg>"
237
- | <!-- path -->
238
-
239
- #data
240
- <svg><![CDATA[<svg>]]>path
241
- #errors
242
- #document
243
- | <html>
244
- | <head>
245
- | <body>
246
- | <svg svg>
247
- | "<svg>path"
248
-
249
- #data
250
- <svg><![CDATA[<!--svg-->]]>
251
- #errors
252
- #document
253
- | <html>
254
- | <head>
255
- | <body>
256
- | <svg svg>
257
- | "<!--svg-->"