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.
- package/.npmignore +3 -1
- package/LICENSE +1 -1
- package/README.md +166 -77
- package/index.js +7 -0
- package/lib/{html.js → const/html.js} +0 -0
- package/lib/{unicode.js → const/unicode.js} +0 -0
- package/lib/{named_entity_trie.js → tokenization_stage/named_entity_trie.js} +1 -1
- package/lib/tokenization_stage/parser_simulator.js +2 -0
- package/lib/{preprocessor.js → tokenization_stage/preprocessor.js} +5 -5
- package/lib/{tokenizer.js → tokenization_stage/tokenizer.js} +37 -37
- package/lib/{default_tree_adapter.js → tree_adapters/default.js} +47 -0
- package/lib/tree_adapters/htmlparser2.js +267 -0
- package/lib/{formatting_element_list.js → tree_construction_stage/formatting_element_list.js} +1 -1
- package/lib/{open_element_stack.js → tree_construction_stage/open_element_stack.js} +2 -2
- package/lib/{parser.js → tree_construction_stage/parser.js} +8 -8
- package/lib/tree_construction_stage/tree_serializer.js +165 -0
- package/package.json +33 -26
- package/test/data/tokenizer/contentModelFlags.test +0 -75
- package/test/data/tokenizer/domjs.test +0 -90
- package/test/data/tokenizer/entities.test +0 -283
- package/test/data/tokenizer/escapeFlag.test +0 -33
- package/test/data/tokenizer/namedEntities.test +0 -44189
- package/test/data/tokenizer/numericEntities.test +0 -1313
- package/test/data/tokenizer/pendingSpecChanges.test +0 -7
- package/test/data/tokenizer/test1.test +0 -196
- package/test/data/tokenizer/test2.test +0 -179
- package/test/data/tokenizer/test3.test +0 -6047
- package/test/data/tokenizer/test4.test +0 -344
- package/test/data/tokenizer/unicodeChars.test +0 -1295
- package/test/data/tokenizer/unicodeCharsProblematic.test +0 -27
- package/test/data/tree-construction/adoption01.dat +0 -275
- package/test/data/tree-construction/adoption02.dat +0 -31
- package/test/data/tree-construction/comments01.dat +0 -146
- package/test/data/tree-construction/doctype01.dat +0 -370
- package/test/data/tree-construction/domjs-unsafe.dat +0 -0
- package/test/data/tree-construction/entities01.dat +0 -603
- package/test/data/tree-construction/entities02.dat +0 -249
- package/test/data/tree-construction/html5test-com.dat +0 -246
- package/test/data/tree-construction/inbody01.dat +0 -43
- package/test/data/tree-construction/isindex.dat +0 -40
- package/test/data/tree-construction/main-element.dat +0 -29
- package/test/data/tree-construction/pending-spec-changes-plain-text-unsafe.dat +0 -0
- package/test/data/tree-construction/pending-spec-changes.dat +0 -52
- package/test/data/tree-construction/plain-text-unsafe.dat +0 -0
- package/test/data/tree-construction/scriptdata01.dat +0 -308
- package/test/data/tree-construction/tables01.dat +0 -212
- package/test/data/tree-construction/tests1.dat +0 -1952
- package/test/data/tree-construction/tests10.dat +0 -799
- package/test/data/tree-construction/tests11.dat +0 -482
- package/test/data/tree-construction/tests12.dat +0 -62
- package/test/data/tree-construction/tests14.dat +0 -74
- package/test/data/tree-construction/tests15.dat +0 -208
- package/test/data/tree-construction/tests16.dat +0 -2299
- package/test/data/tree-construction/tests17.dat +0 -153
- package/test/data/tree-construction/tests18.dat +0 -269
- package/test/data/tree-construction/tests19.dat +0 -1249
- package/test/data/tree-construction/tests2.dat +0 -763
- package/test/data/tree-construction/tests20.dat +0 -455
- package/test/data/tree-construction/tests21.dat +0 -257
- package/test/data/tree-construction/tests22.dat +0 -157
- package/test/data/tree-construction/tests23.dat +0 -155
- package/test/data/tree-construction/tests24.dat +0 -79
- package/test/data/tree-construction/tests25.dat +0 -219
- package/test/data/tree-construction/tests26.dat +0 -313
- package/test/data/tree-construction/tests3.dat +0 -305
- package/test/data/tree-construction/tests4.dat +0 -59
- package/test/data/tree-construction/tests5.dat +0 -191
- package/test/data/tree-construction/tests6.dat +0 -663
- package/test/data/tree-construction/tests7.dat +0 -390
- package/test/data/tree-construction/tests8.dat +0 -148
- package/test/data/tree-construction/tests9.dat +0 -457
- package/test/data/tree-construction/tests_innerHTML_1.dat +0 -741
- package/test/data/tree-construction/tricky01.dat +0 -261
- package/test/data/tree-construction/webkit01.dat +0 -594
- package/test/data/tree-construction/webkit02.dat +0 -94
- package/test/fixtures/formatting_element_list_test.js +0 -267
- package/test/fixtures/open_element_stack_test.js +0 -495
- package/test/fixtures/parser_test.js +0 -160
- package/test/fixtures/tokenizer_test.js +0 -178
- package/test/run_tests.js +0 -10
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
{"tests" : [
|
|
2
|
-
{"description": "Invalid Unicode character U+DFFF",
|
|
3
|
-
"doubleEscaped":true,
|
|
4
|
-
"input": "\\uDFFF",
|
|
5
|
-
"output":["ParseError", ["Character", "\\uFFFD"]]},
|
|
6
|
-
|
|
7
|
-
{"description": "Invalid Unicode character U+D800",
|
|
8
|
-
"doubleEscaped":true,
|
|
9
|
-
"input": "\\uD800",
|
|
10
|
-
"output":["ParseError", ["Character", "\\uFFFD"]]},
|
|
11
|
-
|
|
12
|
-
{"description": "Invalid Unicode character U+DFFF with valid preceding character",
|
|
13
|
-
"doubleEscaped":true,
|
|
14
|
-
"input": "a\\uDFFF",
|
|
15
|
-
"output":[["Character", "a"], "ParseError", ["Character", "\\uFFFD"]]},
|
|
16
|
-
|
|
17
|
-
{"description": "Invalid Unicode character U+D800 with valid following character",
|
|
18
|
-
"doubleEscaped":true,
|
|
19
|
-
"input": "\\uD800a",
|
|
20
|
-
"output":["ParseError", ["Character", "\\uFFFDa"]]},
|
|
21
|
-
|
|
22
|
-
{"description":"CR followed by U+0000",
|
|
23
|
-
"input":"\r\u0000",
|
|
24
|
-
"output":[["Character", "\n"], "ParseError", ["Character", "\u0000"]],
|
|
25
|
-
"ignoreErrorOrder":true}
|
|
26
|
-
]
|
|
27
|
-
}
|
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
#data
|
|
2
|
-
<a><p></a></p>
|
|
3
|
-
#errors
|
|
4
|
-
#document
|
|
5
|
-
| <html>
|
|
6
|
-
| <head>
|
|
7
|
-
| <body>
|
|
8
|
-
| <a>
|
|
9
|
-
| <p>
|
|
10
|
-
| <a>
|
|
11
|
-
|
|
12
|
-
#data
|
|
13
|
-
<a>1<p>2</a>3</p>
|
|
14
|
-
#errors
|
|
15
|
-
#document
|
|
16
|
-
| <html>
|
|
17
|
-
| <head>
|
|
18
|
-
| <body>
|
|
19
|
-
| <a>
|
|
20
|
-
| "1"
|
|
21
|
-
| <p>
|
|
22
|
-
| <a>
|
|
23
|
-
| "2"
|
|
24
|
-
| "3"
|
|
25
|
-
|
|
26
|
-
#data
|
|
27
|
-
<a>1<button>2</a>3</button>
|
|
28
|
-
#errors
|
|
29
|
-
#document
|
|
30
|
-
| <html>
|
|
31
|
-
| <head>
|
|
32
|
-
| <body>
|
|
33
|
-
| <a>
|
|
34
|
-
| "1"
|
|
35
|
-
| <button>
|
|
36
|
-
| <a>
|
|
37
|
-
| "2"
|
|
38
|
-
| "3"
|
|
39
|
-
|
|
40
|
-
#data
|
|
41
|
-
<a>1<b>2</a>3</b>
|
|
42
|
-
#errors
|
|
43
|
-
#document
|
|
44
|
-
| <html>
|
|
45
|
-
| <head>
|
|
46
|
-
| <body>
|
|
47
|
-
| <a>
|
|
48
|
-
| "1"
|
|
49
|
-
| <b>
|
|
50
|
-
| "2"
|
|
51
|
-
| <b>
|
|
52
|
-
| "3"
|
|
53
|
-
|
|
54
|
-
#data
|
|
55
|
-
<a>1<div>2<div>3</a>4</div>5</div>
|
|
56
|
-
#errors
|
|
57
|
-
#document
|
|
58
|
-
| <html>
|
|
59
|
-
| <head>
|
|
60
|
-
| <body>
|
|
61
|
-
| <a>
|
|
62
|
-
| "1"
|
|
63
|
-
| <div>
|
|
64
|
-
| <a>
|
|
65
|
-
| "2"
|
|
66
|
-
| <div>
|
|
67
|
-
| <a>
|
|
68
|
-
| "3"
|
|
69
|
-
| "4"
|
|
70
|
-
| "5"
|
|
71
|
-
|
|
72
|
-
#data
|
|
73
|
-
<table><a>1<p>2</a>3</p>
|
|
74
|
-
#errors
|
|
75
|
-
#document
|
|
76
|
-
| <html>
|
|
77
|
-
| <head>
|
|
78
|
-
| <body>
|
|
79
|
-
| <a>
|
|
80
|
-
| "1"
|
|
81
|
-
| <p>
|
|
82
|
-
| <a>
|
|
83
|
-
| "2"
|
|
84
|
-
| "3"
|
|
85
|
-
| <table>
|
|
86
|
-
|
|
87
|
-
#data
|
|
88
|
-
<b><b><a><p></a>
|
|
89
|
-
#errors
|
|
90
|
-
#document
|
|
91
|
-
| <html>
|
|
92
|
-
| <head>
|
|
93
|
-
| <body>
|
|
94
|
-
| <b>
|
|
95
|
-
| <b>
|
|
96
|
-
| <a>
|
|
97
|
-
| <p>
|
|
98
|
-
| <a>
|
|
99
|
-
|
|
100
|
-
#data
|
|
101
|
-
<b><a><b><p></a>
|
|
102
|
-
#errors
|
|
103
|
-
#document
|
|
104
|
-
| <html>
|
|
105
|
-
| <head>
|
|
106
|
-
| <body>
|
|
107
|
-
| <b>
|
|
108
|
-
| <a>
|
|
109
|
-
| <b>
|
|
110
|
-
| <b>
|
|
111
|
-
| <p>
|
|
112
|
-
| <a>
|
|
113
|
-
|
|
114
|
-
#data
|
|
115
|
-
<a><b><b><p></a>
|
|
116
|
-
#errors
|
|
117
|
-
#document
|
|
118
|
-
| <html>
|
|
119
|
-
| <head>
|
|
120
|
-
| <body>
|
|
121
|
-
| <a>
|
|
122
|
-
| <b>
|
|
123
|
-
| <b>
|
|
124
|
-
| <b>
|
|
125
|
-
| <b>
|
|
126
|
-
| <p>
|
|
127
|
-
| <a>
|
|
128
|
-
|
|
129
|
-
#data
|
|
130
|
-
<p>1<s id="A">2<b id="B">3</p>4</s>5</b>
|
|
131
|
-
#errors
|
|
132
|
-
#document
|
|
133
|
-
| <html>
|
|
134
|
-
| <head>
|
|
135
|
-
| <body>
|
|
136
|
-
| <p>
|
|
137
|
-
| "1"
|
|
138
|
-
| <s>
|
|
139
|
-
| id="A"
|
|
140
|
-
| "2"
|
|
141
|
-
| <b>
|
|
142
|
-
| id="B"
|
|
143
|
-
| "3"
|
|
144
|
-
| <s>
|
|
145
|
-
| id="A"
|
|
146
|
-
| <b>
|
|
147
|
-
| id="B"
|
|
148
|
-
| "4"
|
|
149
|
-
| <b>
|
|
150
|
-
| id="B"
|
|
151
|
-
| "5"
|
|
152
|
-
|
|
153
|
-
#data
|
|
154
|
-
<table><a>1<td>2</td>3</table>
|
|
155
|
-
#errors
|
|
156
|
-
#document
|
|
157
|
-
| <html>
|
|
158
|
-
| <head>
|
|
159
|
-
| <body>
|
|
160
|
-
| <a>
|
|
161
|
-
| "1"
|
|
162
|
-
| <a>
|
|
163
|
-
| "3"
|
|
164
|
-
| <table>
|
|
165
|
-
| <tbody>
|
|
166
|
-
| <tr>
|
|
167
|
-
| <td>
|
|
168
|
-
| "2"
|
|
169
|
-
|
|
170
|
-
#data
|
|
171
|
-
<table>A<td>B</td>C</table>
|
|
172
|
-
#errors
|
|
173
|
-
#document
|
|
174
|
-
| <html>
|
|
175
|
-
| <head>
|
|
176
|
-
| <body>
|
|
177
|
-
| "AC"
|
|
178
|
-
| <table>
|
|
179
|
-
| <tbody>
|
|
180
|
-
| <tr>
|
|
181
|
-
| <td>
|
|
182
|
-
| "B"
|
|
183
|
-
|
|
184
|
-
#data
|
|
185
|
-
<a><svg><tr><input></a>
|
|
186
|
-
#errors
|
|
187
|
-
#document
|
|
188
|
-
| <html>
|
|
189
|
-
| <head>
|
|
190
|
-
| <body>
|
|
191
|
-
| <a>
|
|
192
|
-
| <svg svg>
|
|
193
|
-
| <svg tr>
|
|
194
|
-
| <svg input>
|
|
195
|
-
|
|
196
|
-
#data
|
|
197
|
-
<div><a><b><div><div><div><div><div><div><div><div><div><div></a>
|
|
198
|
-
#errors
|
|
199
|
-
#document
|
|
200
|
-
| <html>
|
|
201
|
-
| <head>
|
|
202
|
-
| <body>
|
|
203
|
-
| <div>
|
|
204
|
-
| <a>
|
|
205
|
-
| <b>
|
|
206
|
-
| <b>
|
|
207
|
-
| <div>
|
|
208
|
-
| <a>
|
|
209
|
-
| <div>
|
|
210
|
-
| <a>
|
|
211
|
-
| <div>
|
|
212
|
-
| <a>
|
|
213
|
-
| <div>
|
|
214
|
-
| <a>
|
|
215
|
-
| <div>
|
|
216
|
-
| <a>
|
|
217
|
-
| <div>
|
|
218
|
-
| <a>
|
|
219
|
-
| <div>
|
|
220
|
-
| <a>
|
|
221
|
-
| <div>
|
|
222
|
-
| <a>
|
|
223
|
-
| <div>
|
|
224
|
-
| <div>
|
|
225
|
-
|
|
226
|
-
#data
|
|
227
|
-
<div><a><b><u><i><code><div></a>
|
|
228
|
-
#errors
|
|
229
|
-
#document
|
|
230
|
-
| <html>
|
|
231
|
-
| <head>
|
|
232
|
-
| <body>
|
|
233
|
-
| <div>
|
|
234
|
-
| <a>
|
|
235
|
-
| <b>
|
|
236
|
-
| <u>
|
|
237
|
-
| <i>
|
|
238
|
-
| <code>
|
|
239
|
-
| <u>
|
|
240
|
-
| <i>
|
|
241
|
-
| <code>
|
|
242
|
-
| <div>
|
|
243
|
-
| <a>
|
|
244
|
-
|
|
245
|
-
#data
|
|
246
|
-
<b><b><b><b>x</b></b></b></b>y
|
|
247
|
-
#errors
|
|
248
|
-
#document
|
|
249
|
-
| <html>
|
|
250
|
-
| <head>
|
|
251
|
-
| <body>
|
|
252
|
-
| <b>
|
|
253
|
-
| <b>
|
|
254
|
-
| <b>
|
|
255
|
-
| <b>
|
|
256
|
-
| "x"
|
|
257
|
-
| "y"
|
|
258
|
-
|
|
259
|
-
#data
|
|
260
|
-
<p><b><b><b><b><p>x
|
|
261
|
-
#errors
|
|
262
|
-
#document
|
|
263
|
-
| <html>
|
|
264
|
-
| <head>
|
|
265
|
-
| <body>
|
|
266
|
-
| <p>
|
|
267
|
-
| <b>
|
|
268
|
-
| <b>
|
|
269
|
-
| <b>
|
|
270
|
-
| <b>
|
|
271
|
-
| <p>
|
|
272
|
-
| <b>
|
|
273
|
-
| <b>
|
|
274
|
-
| <b>
|
|
275
|
-
| "x"
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
#data
|
|
2
|
-
<b>1<i>2<p>3</b>4
|
|
3
|
-
#errors
|
|
4
|
-
#document
|
|
5
|
-
| <html>
|
|
6
|
-
| <head>
|
|
7
|
-
| <body>
|
|
8
|
-
| <b>
|
|
9
|
-
| "1"
|
|
10
|
-
| <i>
|
|
11
|
-
| "2"
|
|
12
|
-
| <i>
|
|
13
|
-
| <p>
|
|
14
|
-
| <b>
|
|
15
|
-
| "3"
|
|
16
|
-
| "4"
|
|
17
|
-
|
|
18
|
-
#data
|
|
19
|
-
<a><div><style></style><address><a>
|
|
20
|
-
#errors
|
|
21
|
-
#document
|
|
22
|
-
| <html>
|
|
23
|
-
| <head>
|
|
24
|
-
| <body>
|
|
25
|
-
| <a>
|
|
26
|
-
| <div>
|
|
27
|
-
| <a>
|
|
28
|
-
| <style>
|
|
29
|
-
| <address>
|
|
30
|
-
| <a>
|
|
31
|
-
| <a>
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
#data
|
|
2
|
-
FOO<!-- BAR -->BAZ
|
|
3
|
-
#errors
|
|
4
|
-
#document
|
|
5
|
-
| <html>
|
|
6
|
-
| <head>
|
|
7
|
-
| <body>
|
|
8
|
-
| "FOO"
|
|
9
|
-
| <!-- BAR -->
|
|
10
|
-
| "BAZ"
|
|
11
|
-
|
|
12
|
-
#data
|
|
13
|
-
FOO<!-- BAR --!>BAZ
|
|
14
|
-
#errors
|
|
15
|
-
#document
|
|
16
|
-
| <html>
|
|
17
|
-
| <head>
|
|
18
|
-
| <body>
|
|
19
|
-
| "FOO"
|
|
20
|
-
| <!-- BAR -->
|
|
21
|
-
| "BAZ"
|
|
22
|
-
|
|
23
|
-
#data
|
|
24
|
-
FOO<!-- BAR -- >BAZ
|
|
25
|
-
#errors
|
|
26
|
-
#document
|
|
27
|
-
| <html>
|
|
28
|
-
| <head>
|
|
29
|
-
| <body>
|
|
30
|
-
| "FOO"
|
|
31
|
-
| <!-- BAR -- >BAZ -->
|
|
32
|
-
|
|
33
|
-
#data
|
|
34
|
-
FOO<!-- BAR -- <QUX> -- MUX -->BAZ
|
|
35
|
-
#errors
|
|
36
|
-
#document
|
|
37
|
-
| <html>
|
|
38
|
-
| <head>
|
|
39
|
-
| <body>
|
|
40
|
-
| "FOO"
|
|
41
|
-
| <!-- BAR -- <QUX> -- MUX -->
|
|
42
|
-
| "BAZ"
|
|
43
|
-
|
|
44
|
-
#data
|
|
45
|
-
FOO<!-- BAR -- <QUX> -- MUX --!>BAZ
|
|
46
|
-
#errors
|
|
47
|
-
#document
|
|
48
|
-
| <html>
|
|
49
|
-
| <head>
|
|
50
|
-
| <body>
|
|
51
|
-
| "FOO"
|
|
52
|
-
| <!-- BAR -- <QUX> -- MUX -->
|
|
53
|
-
| "BAZ"
|
|
54
|
-
|
|
55
|
-
#data
|
|
56
|
-
FOO<!-- BAR -- <QUX> -- MUX -- >BAZ
|
|
57
|
-
#errors
|
|
58
|
-
#document
|
|
59
|
-
| <html>
|
|
60
|
-
| <head>
|
|
61
|
-
| <body>
|
|
62
|
-
| "FOO"
|
|
63
|
-
| <!-- BAR -- <QUX> -- MUX -- >BAZ -->
|
|
64
|
-
|
|
65
|
-
#data
|
|
66
|
-
FOO<!---->BAZ
|
|
67
|
-
#errors
|
|
68
|
-
#document
|
|
69
|
-
| <html>
|
|
70
|
-
| <head>
|
|
71
|
-
| <body>
|
|
72
|
-
| "FOO"
|
|
73
|
-
| <!-- -->
|
|
74
|
-
| "BAZ"
|
|
75
|
-
|
|
76
|
-
#data
|
|
77
|
-
FOO<!--->BAZ
|
|
78
|
-
#errors
|
|
79
|
-
#document
|
|
80
|
-
| <html>
|
|
81
|
-
| <head>
|
|
82
|
-
| <body>
|
|
83
|
-
| "FOO"
|
|
84
|
-
| <!-- -->
|
|
85
|
-
| "BAZ"
|
|
86
|
-
|
|
87
|
-
#data
|
|
88
|
-
FOO<!-->BAZ
|
|
89
|
-
#errors
|
|
90
|
-
#document
|
|
91
|
-
| <html>
|
|
92
|
-
| <head>
|
|
93
|
-
| <body>
|
|
94
|
-
| "FOO"
|
|
95
|
-
| <!-- -->
|
|
96
|
-
| "BAZ"
|
|
97
|
-
|
|
98
|
-
#data
|
|
99
|
-
<?xml version="1.0">Hi
|
|
100
|
-
#errors
|
|
101
|
-
#document
|
|
102
|
-
| <!-- ?xml version="1.0" -->
|
|
103
|
-
| <html>
|
|
104
|
-
| <head>
|
|
105
|
-
| <body>
|
|
106
|
-
| "Hi"
|
|
107
|
-
|
|
108
|
-
#data
|
|
109
|
-
<?xml version="1.0">
|
|
110
|
-
#errors
|
|
111
|
-
#document
|
|
112
|
-
| <!-- ?xml version="1.0" -->
|
|
113
|
-
| <html>
|
|
114
|
-
| <head>
|
|
115
|
-
| <body>
|
|
116
|
-
|
|
117
|
-
#data
|
|
118
|
-
<?xml version
|
|
119
|
-
#errors
|
|
120
|
-
#document
|
|
121
|
-
| <!-- ?xml version -->
|
|
122
|
-
| <html>
|
|
123
|
-
| <head>
|
|
124
|
-
| <body>
|
|
125
|
-
|
|
126
|
-
#data
|
|
127
|
-
FOO<!----->BAZ
|
|
128
|
-
#errors
|
|
129
|
-
#document
|
|
130
|
-
| <html>
|
|
131
|
-
| <head>
|
|
132
|
-
| <body>
|
|
133
|
-
| "FOO"
|
|
134
|
-
| <!-- - -->
|
|
135
|
-
| "BAZ"
|
|
136
|
-
|
|
137
|
-
#data
|
|
138
|
-
<html><!-- comment --><title>Comment before head</title>
|
|
139
|
-
#errors
|
|
140
|
-
#document
|
|
141
|
-
| <html>
|
|
142
|
-
| <!-- comment -->
|
|
143
|
-
| <head>
|
|
144
|
-
| <title>
|
|
145
|
-
| "Comment before head"
|
|
146
|
-
| <body>
|