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,370 +0,0 @@
1
- #data
2
- <!DOCTYPE html>Hello
3
- #errors
4
- #document
5
- | <!DOCTYPE html>
6
- | <html>
7
- | <head>
8
- | <body>
9
- | "Hello"
10
-
11
- #data
12
- <!dOctYpE HtMl>Hello
13
- #errors
14
- #document
15
- | <!DOCTYPE html>
16
- | <html>
17
- | <head>
18
- | <body>
19
- | "Hello"
20
-
21
- #data
22
- <!DOCTYPEhtml>Hello
23
- #errors
24
- #document
25
- | <!DOCTYPE html>
26
- | <html>
27
- | <head>
28
- | <body>
29
- | "Hello"
30
-
31
- #data
32
- <!DOCTYPE>Hello
33
- #errors
34
- #document
35
- | <!DOCTYPE >
36
- | <html>
37
- | <head>
38
- | <body>
39
- | "Hello"
40
-
41
- #data
42
- <!DOCTYPE >Hello
43
- #errors
44
- #document
45
- | <!DOCTYPE >
46
- | <html>
47
- | <head>
48
- | <body>
49
- | "Hello"
50
-
51
- #data
52
- <!DOCTYPE potato>Hello
53
- #errors
54
- #document
55
- | <!DOCTYPE potato>
56
- | <html>
57
- | <head>
58
- | <body>
59
- | "Hello"
60
-
61
- #data
62
- <!DOCTYPE potato >Hello
63
- #errors
64
- #document
65
- | <!DOCTYPE potato>
66
- | <html>
67
- | <head>
68
- | <body>
69
- | "Hello"
70
-
71
- #data
72
- <!DOCTYPE potato taco>Hello
73
- #errors
74
- #document
75
- | <!DOCTYPE potato>
76
- | <html>
77
- | <head>
78
- | <body>
79
- | "Hello"
80
-
81
- #data
82
- <!DOCTYPE potato taco "ddd>Hello
83
- #errors
84
- #document
85
- | <!DOCTYPE potato>
86
- | <html>
87
- | <head>
88
- | <body>
89
- | "Hello"
90
-
91
- #data
92
- <!DOCTYPE potato sYstEM>Hello
93
- #errors
94
- #document
95
- | <!DOCTYPE potato>
96
- | <html>
97
- | <head>
98
- | <body>
99
- | "Hello"
100
-
101
- #data
102
- <!DOCTYPE potato sYstEM >Hello
103
- #errors
104
- #document
105
- | <!DOCTYPE potato>
106
- | <html>
107
- | <head>
108
- | <body>
109
- | "Hello"
110
-
111
- #data
112
- <!DOCTYPE potato sYstEM ggg>Hello
113
- #errors
114
- #document
115
- | <!DOCTYPE potato>
116
- | <html>
117
- | <head>
118
- | <body>
119
- | "Hello"
120
-
121
- #data
122
- <!DOCTYPE potato SYSTEM taco >Hello
123
- #errors
124
- #document
125
- | <!DOCTYPE potato>
126
- | <html>
127
- | <head>
128
- | <body>
129
- | "Hello"
130
-
131
- #data
132
- <!DOCTYPE potato SYSTEM 'taco"'>Hello
133
- #errors
134
- #document
135
- | <!DOCTYPE potato "" "taco"">
136
- | <html>
137
- | <head>
138
- | <body>
139
- | "Hello"
140
-
141
- #data
142
- <!DOCTYPE potato SYSTEM "taco">Hello
143
- #errors
144
- #document
145
- | <!DOCTYPE potato "" "taco">
146
- | <html>
147
- | <head>
148
- | <body>
149
- | "Hello"
150
-
151
- #data
152
- <!DOCTYPE potato SYSTEM "tai'co">Hello
153
- #errors
154
- #document
155
- | <!DOCTYPE potato "" "tai'co">
156
- | <html>
157
- | <head>
158
- | <body>
159
- | "Hello"
160
-
161
- #data
162
- <!DOCTYPE potato SYSTEMtaco "ddd">Hello
163
- #errors
164
- #document
165
- | <!DOCTYPE potato>
166
- | <html>
167
- | <head>
168
- | <body>
169
- | "Hello"
170
-
171
- #data
172
- <!DOCTYPE potato grass SYSTEM taco>Hello
173
- #errors
174
- #document
175
- | <!DOCTYPE potato>
176
- | <html>
177
- | <head>
178
- | <body>
179
- | "Hello"
180
-
181
- #data
182
- <!DOCTYPE potato pUbLIc>Hello
183
- #errors
184
- #document
185
- | <!DOCTYPE potato>
186
- | <html>
187
- | <head>
188
- | <body>
189
- | "Hello"
190
-
191
- #data
192
- <!DOCTYPE potato pUbLIc >Hello
193
- #errors
194
- #document
195
- | <!DOCTYPE potato>
196
- | <html>
197
- | <head>
198
- | <body>
199
- | "Hello"
200
-
201
- #data
202
- <!DOCTYPE potato pUbLIcgoof>Hello
203
- #errors
204
- #document
205
- | <!DOCTYPE potato>
206
- | <html>
207
- | <head>
208
- | <body>
209
- | "Hello"
210
-
211
- #data
212
- <!DOCTYPE potato PUBLIC goof>Hello
213
- #errors
214
- #document
215
- | <!DOCTYPE potato>
216
- | <html>
217
- | <head>
218
- | <body>
219
- | "Hello"
220
-
221
- #data
222
- <!DOCTYPE potato PUBLIC "go'of">Hello
223
- #errors
224
- #document
225
- | <!DOCTYPE potato "go'of" "">
226
- | <html>
227
- | <head>
228
- | <body>
229
- | "Hello"
230
-
231
- #data
232
- <!DOCTYPE potato PUBLIC 'go'of'>Hello
233
- #errors
234
- #document
235
- | <!DOCTYPE potato "go" "">
236
- | <html>
237
- | <head>
238
- | <body>
239
- | "Hello"
240
-
241
- #data
242
- <!DOCTYPE potato PUBLIC 'go:hh of' >Hello
243
- #errors
244
- #document
245
- | <!DOCTYPE potato "go:hh of" "">
246
- | <html>
247
- | <head>
248
- | <body>
249
- | "Hello"
250
-
251
- #data
252
- <!DOCTYPE potato PUBLIC "W3C-//dfdf" SYSTEM ggg>Hello
253
- #errors
254
- #document
255
- | <!DOCTYPE potato "W3C-//dfdf" "">
256
- | <html>
257
- | <head>
258
- | <body>
259
- | "Hello"
260
-
261
- #data
262
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
263
- "http://www.w3.org/TR/html4/strict.dtd">Hello
264
- #errors
265
- #document
266
- | <!DOCTYPE html "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
267
- | <html>
268
- | <head>
269
- | <body>
270
- | "Hello"
271
-
272
- #data
273
- <!DOCTYPE ...>Hello
274
- #errors
275
- #document
276
- | <!DOCTYPE ...>
277
- | <html>
278
- | <head>
279
- | <body>
280
- | "Hello"
281
-
282
- #data
283
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
284
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
285
- #errors
286
- #document
287
- | <!DOCTYPE html "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
288
- | <html>
289
- | <head>
290
- | <body>
291
-
292
- #data
293
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
294
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
295
- #errors
296
- #document
297
- | <!DOCTYPE html "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
298
- | <html>
299
- | <head>
300
- | <body>
301
-
302
- #data
303
- <!DOCTYPE root-element [SYSTEM OR PUBLIC FPI] "uri" [
304
- <!-- internal declarations -->
305
- ]>
306
- #errors
307
- #document
308
- | <!DOCTYPE root-element>
309
- | <html>
310
- | <head>
311
- | <body>
312
- | "]>"
313
-
314
- #data
315
- <!DOCTYPE html PUBLIC
316
- "-//WAPFORUM//DTD XHTML Mobile 1.0//EN"
317
- "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
318
- #errors
319
- #document
320
- | <!DOCTYPE html "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
321
- | <html>
322
- | <head>
323
- | <body>
324
-
325
- #data
326
- <!DOCTYPE HTML SYSTEM "http://www.w3.org/DTD/HTML4-strict.dtd"><body><b>Mine!</b></body>
327
- #errors
328
- #document
329
- | <!DOCTYPE html "" "http://www.w3.org/DTD/HTML4-strict.dtd">
330
- | <html>
331
- | <head>
332
- | <body>
333
- | <b>
334
- | "Mine!"
335
-
336
- #data
337
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
338
- #errors
339
- #document
340
- | <!DOCTYPE html "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
341
- | <html>
342
- | <head>
343
- | <body>
344
-
345
- #data
346
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"'http://www.w3.org/TR/html4/strict.dtd'>
347
- #errors
348
- #document
349
- | <!DOCTYPE html "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
350
- | <html>
351
- | <head>
352
- | <body>
353
-
354
- #data
355
- <!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.01//EN"'http://www.w3.org/TR/html4/strict.dtd'>
356
- #errors
357
- #document
358
- | <!DOCTYPE html "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
359
- | <html>
360
- | <head>
361
- | <body>
362
-
363
- #data
364
- <!DOCTYPE HTML PUBLIC'-//W3C//DTD HTML 4.01//EN''http://www.w3.org/TR/html4/strict.dtd'>
365
- #errors
366
- #document
367
- | <!DOCTYPE html "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
368
- | <html>
369
- | <head>
370
- | <body>