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,308 +0,0 @@
1
- #data
2
- FOO<script>'Hello'</script>BAR
3
- #errors
4
- #document
5
- | <html>
6
- | <head>
7
- | <body>
8
- | "FOO"
9
- | <script>
10
- | "'Hello'"
11
- | "BAR"
12
-
13
- #data
14
- FOO<script></script>BAR
15
- #errors
16
- #document
17
- | <html>
18
- | <head>
19
- | <body>
20
- | "FOO"
21
- | <script>
22
- | "BAR"
23
-
24
- #data
25
- FOO<script></script >BAR
26
- #errors
27
- #document
28
- | <html>
29
- | <head>
30
- | <body>
31
- | "FOO"
32
- | <script>
33
- | "BAR"
34
-
35
- #data
36
- FOO<script></script/>BAR
37
- #errors
38
- #document
39
- | <html>
40
- | <head>
41
- | <body>
42
- | "FOO"
43
- | <script>
44
- | "BAR"
45
-
46
- #data
47
- FOO<script></script/ >BAR
48
- #errors
49
- #document
50
- | <html>
51
- | <head>
52
- | <body>
53
- | "FOO"
54
- | <script>
55
- | "BAR"
56
-
57
- #data
58
- FOO<script type="text/plain"></scriptx>BAR
59
- #errors
60
- #document
61
- | <html>
62
- | <head>
63
- | <body>
64
- | "FOO"
65
- | <script>
66
- | type="text/plain"
67
- | "</scriptx>BAR"
68
-
69
- #data
70
- FOO<script></script foo=">" dd>BAR
71
- #errors
72
- #document
73
- | <html>
74
- | <head>
75
- | <body>
76
- | "FOO"
77
- | <script>
78
- | "BAR"
79
-
80
- #data
81
- FOO<script>'<'</script>BAR
82
- #errors
83
- #document
84
- | <html>
85
- | <head>
86
- | <body>
87
- | "FOO"
88
- | <script>
89
- | "'<'"
90
- | "BAR"
91
-
92
- #data
93
- FOO<script>'<!'</script>BAR
94
- #errors
95
- #document
96
- | <html>
97
- | <head>
98
- | <body>
99
- | "FOO"
100
- | <script>
101
- | "'<!'"
102
- | "BAR"
103
-
104
- #data
105
- FOO<script>'<!-'</script>BAR
106
- #errors
107
- #document
108
- | <html>
109
- | <head>
110
- | <body>
111
- | "FOO"
112
- | <script>
113
- | "'<!-'"
114
- | "BAR"
115
-
116
- #data
117
- FOO<script>'<!--'</script>BAR
118
- #errors
119
- #document
120
- | <html>
121
- | <head>
122
- | <body>
123
- | "FOO"
124
- | <script>
125
- | "'<!--'"
126
- | "BAR"
127
-
128
- #data
129
- FOO<script>'<!---'</script>BAR
130
- #errors
131
- #document
132
- | <html>
133
- | <head>
134
- | <body>
135
- | "FOO"
136
- | <script>
137
- | "'<!---'"
138
- | "BAR"
139
-
140
- #data
141
- FOO<script>'<!-->'</script>BAR
142
- #errors
143
- #document
144
- | <html>
145
- | <head>
146
- | <body>
147
- | "FOO"
148
- | <script>
149
- | "'<!-->'"
150
- | "BAR"
151
-
152
- #data
153
- FOO<script>'<!-->'</script>BAR
154
- #errors
155
- #document
156
- | <html>
157
- | <head>
158
- | <body>
159
- | "FOO"
160
- | <script>
161
- | "'<!-->'"
162
- | "BAR"
163
-
164
- #data
165
- FOO<script>'<!-- potato'</script>BAR
166
- #errors
167
- #document
168
- | <html>
169
- | <head>
170
- | <body>
171
- | "FOO"
172
- | <script>
173
- | "'<!-- potato'"
174
- | "BAR"
175
-
176
- #data
177
- FOO<script>'<!-- <sCrIpt'</script>BAR
178
- #errors
179
- #document
180
- | <html>
181
- | <head>
182
- | <body>
183
- | "FOO"
184
- | <script>
185
- | "'<!-- <sCrIpt'"
186
- | "BAR"
187
-
188
- #data
189
- FOO<script type="text/plain">'<!-- <sCrIpt>'</script>BAR
190
- #errors
191
- #document
192
- | <html>
193
- | <head>
194
- | <body>
195
- | "FOO"
196
- | <script>
197
- | type="text/plain"
198
- | "'<!-- <sCrIpt>'</script>BAR"
199
-
200
- #data
201
- FOO<script type="text/plain">'<!-- <sCrIpt> -'</script>BAR
202
- #errors
203
- #document
204
- | <html>
205
- | <head>
206
- | <body>
207
- | "FOO"
208
- | <script>
209
- | type="text/plain"
210
- | "'<!-- <sCrIpt> -'</script>BAR"
211
-
212
- #data
213
- FOO<script type="text/plain">'<!-- <sCrIpt> --'</script>BAR
214
- #errors
215
- #document
216
- | <html>
217
- | <head>
218
- | <body>
219
- | "FOO"
220
- | <script>
221
- | type="text/plain"
222
- | "'<!-- <sCrIpt> --'</script>BAR"
223
-
224
- #data
225
- FOO<script>'<!-- <sCrIpt> -->'</script>BAR
226
- #errors
227
- #document
228
- | <html>
229
- | <head>
230
- | <body>
231
- | "FOO"
232
- | <script>
233
- | "'<!-- <sCrIpt> -->'"
234
- | "BAR"
235
-
236
- #data
237
- FOO<script type="text/plain">'<!-- <sCrIpt> --!>'</script>BAR
238
- #errors
239
- #document
240
- | <html>
241
- | <head>
242
- | <body>
243
- | "FOO"
244
- | <script>
245
- | type="text/plain"
246
- | "'<!-- <sCrIpt> --!>'</script>BAR"
247
-
248
- #data
249
- FOO<script type="text/plain">'<!-- <sCrIpt> -- >'</script>BAR
250
- #errors
251
- #document
252
- | <html>
253
- | <head>
254
- | <body>
255
- | "FOO"
256
- | <script>
257
- | type="text/plain"
258
- | "'<!-- <sCrIpt> -- >'</script>BAR"
259
-
260
- #data
261
- FOO<script type="text/plain">'<!-- <sCrIpt '</script>BAR
262
- #errors
263
- #document
264
- | <html>
265
- | <head>
266
- | <body>
267
- | "FOO"
268
- | <script>
269
- | type="text/plain"
270
- | "'<!-- <sCrIpt '</script>BAR"
271
-
272
- #data
273
- FOO<script type="text/plain">'<!-- <sCrIpt/'</script>BAR
274
- #errors
275
- #document
276
- | <html>
277
- | <head>
278
- | <body>
279
- | "FOO"
280
- | <script>
281
- | type="text/plain"
282
- | "'<!-- <sCrIpt/'</script>BAR"
283
-
284
- #data
285
- FOO<script type="text/plain">'<!-- <sCrIpt\'</script>BAR
286
- #errors
287
- #document
288
- | <html>
289
- | <head>
290
- | <body>
291
- | "FOO"
292
- | <script>
293
- | type="text/plain"
294
- | "'<!-- <sCrIpt\'"
295
- | "BAR"
296
-
297
- #data
298
- FOO<script type="text/plain">'<!-- <sCrIpt/'</script>BAR</script>QUX
299
- #errors
300
- #document
301
- | <html>
302
- | <head>
303
- | <body>
304
- | "FOO"
305
- | <script>
306
- | type="text/plain"
307
- | "'<!-- <sCrIpt/'</script>BAR"
308
- | "QUX"
@@ -1,212 +0,0 @@
1
- #data
2
- <table><th>
3
- #errors
4
- #document
5
- | <html>
6
- | <head>
7
- | <body>
8
- | <table>
9
- | <tbody>
10
- | <tr>
11
- | <th>
12
-
13
- #data
14
- <table><td>
15
- #errors
16
- #document
17
- | <html>
18
- | <head>
19
- | <body>
20
- | <table>
21
- | <tbody>
22
- | <tr>
23
- | <td>
24
-
25
- #data
26
- <table><col foo='bar'>
27
- #errors
28
- #document
29
- | <html>
30
- | <head>
31
- | <body>
32
- | <table>
33
- | <colgroup>
34
- | <col>
35
- | foo="bar"
36
-
37
- #data
38
- <table><colgroup></html>foo
39
- #errors
40
- #document
41
- | <html>
42
- | <head>
43
- | <body>
44
- | "foo"
45
- | <table>
46
- | <colgroup>
47
-
48
- #data
49
- <table></table><p>foo
50
- #errors
51
- #document
52
- | <html>
53
- | <head>
54
- | <body>
55
- | <table>
56
- | <p>
57
- | "foo"
58
-
59
- #data
60
- <table></body></caption></col></colgroup></html></tbody></td></tfoot></th></thead></tr><td>
61
- #errors
62
- #document
63
- | <html>
64
- | <head>
65
- | <body>
66
- | <table>
67
- | <tbody>
68
- | <tr>
69
- | <td>
70
-
71
- #data
72
- <table><select><option>3</select></table>
73
- #errors
74
- #document
75
- | <html>
76
- | <head>
77
- | <body>
78
- | <select>
79
- | <option>
80
- | "3"
81
- | <table>
82
-
83
- #data
84
- <table><select><table></table></select></table>
85
- #errors
86
- #document
87
- | <html>
88
- | <head>
89
- | <body>
90
- | <select>
91
- | <table>
92
- | <table>
93
-
94
- #data
95
- <table><select></table>
96
- #errors
97
- #document
98
- | <html>
99
- | <head>
100
- | <body>
101
- | <select>
102
- | <table>
103
-
104
- #data
105
- <table><select><option>A<tr><td>B</td></tr></table>
106
- #errors
107
- #document
108
- | <html>
109
- | <head>
110
- | <body>
111
- | <select>
112
- | <option>
113
- | "A"
114
- | <table>
115
- | <tbody>
116
- | <tr>
117
- | <td>
118
- | "B"
119
-
120
- #data
121
- <table><td></body></caption></col></colgroup></html>foo
122
- #errors
123
- #document
124
- | <html>
125
- | <head>
126
- | <body>
127
- | <table>
128
- | <tbody>
129
- | <tr>
130
- | <td>
131
- | "foo"
132
-
133
- #data
134
- <table><td>A</table>B
135
- #errors
136
- #document
137
- | <html>
138
- | <head>
139
- | <body>
140
- | <table>
141
- | <tbody>
142
- | <tr>
143
- | <td>
144
- | "A"
145
- | "B"
146
-
147
- #data
148
- <table><tr><caption>
149
- #errors
150
- #document
151
- | <html>
152
- | <head>
153
- | <body>
154
- | <table>
155
- | <tbody>
156
- | <tr>
157
- | <caption>
158
-
159
- #data
160
- <table><tr></body></caption></col></colgroup></html></td></th><td>foo
161
- #errors
162
- #document
163
- | <html>
164
- | <head>
165
- | <body>
166
- | <table>
167
- | <tbody>
168
- | <tr>
169
- | <td>
170
- | "foo"
171
-
172
- #data
173
- <table><td><tr>
174
- #errors
175
- #document
176
- | <html>
177
- | <head>
178
- | <body>
179
- | <table>
180
- | <tbody>
181
- | <tr>
182
- | <td>
183
- | <tr>
184
-
185
- #data
186
- <table><td><button><td>
187
- #errors
188
- #document
189
- | <html>
190
- | <head>
191
- | <body>
192
- | <table>
193
- | <tbody>
194
- | <tr>
195
- | <td>
196
- | <button>
197
- | <td>
198
-
199
- #data
200
- <table><tr><td><svg><desc><td>
201
- #errors
202
- #document
203
- | <html>
204
- | <head>
205
- | <body>
206
- | <table>
207
- | <tbody>
208
- | <tr>
209
- | <td>
210
- | <svg svg>
211
- | <svg desc>
212
- | <td>