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,261 +0,0 @@
|
|
|
1
|
-
#data
|
|
2
|
-
<b><p>Bold </b> Not bold</p>
|
|
3
|
-
Also not bold.
|
|
4
|
-
#errors
|
|
5
|
-
#document
|
|
6
|
-
| <html>
|
|
7
|
-
| <head>
|
|
8
|
-
| <body>
|
|
9
|
-
| <b>
|
|
10
|
-
| <p>
|
|
11
|
-
| <b>
|
|
12
|
-
| "Bold "
|
|
13
|
-
| " Not bold"
|
|
14
|
-
| "
|
|
15
|
-
Also not bold."
|
|
16
|
-
|
|
17
|
-
#data
|
|
18
|
-
<html>
|
|
19
|
-
<font color=red><i>Italic and Red<p>Italic and Red </font> Just italic.</p> Italic only.</i> Plain
|
|
20
|
-
<p>I should not be red. <font color=red>Red. <i>Italic and red.</p>
|
|
21
|
-
<p>Italic and red. </i> Red.</font> I should not be red.</p>
|
|
22
|
-
<b>Bold <i>Bold and italic</b> Only Italic </i> Plain
|
|
23
|
-
#errors
|
|
24
|
-
#document
|
|
25
|
-
| <html>
|
|
26
|
-
| <head>
|
|
27
|
-
| <body>
|
|
28
|
-
| <font>
|
|
29
|
-
| color="red"
|
|
30
|
-
| <i>
|
|
31
|
-
| "Italic and Red"
|
|
32
|
-
| <i>
|
|
33
|
-
| <p>
|
|
34
|
-
| <font>
|
|
35
|
-
| color="red"
|
|
36
|
-
| "Italic and Red "
|
|
37
|
-
| " Just italic."
|
|
38
|
-
| " Italic only."
|
|
39
|
-
| " Plain
|
|
40
|
-
"
|
|
41
|
-
| <p>
|
|
42
|
-
| "I should not be red. "
|
|
43
|
-
| <font>
|
|
44
|
-
| color="red"
|
|
45
|
-
| "Red. "
|
|
46
|
-
| <i>
|
|
47
|
-
| "Italic and red."
|
|
48
|
-
| <font>
|
|
49
|
-
| color="red"
|
|
50
|
-
| <i>
|
|
51
|
-
| "
|
|
52
|
-
"
|
|
53
|
-
| <p>
|
|
54
|
-
| <font>
|
|
55
|
-
| color="red"
|
|
56
|
-
| <i>
|
|
57
|
-
| "Italic and red. "
|
|
58
|
-
| " Red."
|
|
59
|
-
| " I should not be red."
|
|
60
|
-
| "
|
|
61
|
-
"
|
|
62
|
-
| <b>
|
|
63
|
-
| "Bold "
|
|
64
|
-
| <i>
|
|
65
|
-
| "Bold and italic"
|
|
66
|
-
| <i>
|
|
67
|
-
| " Only Italic "
|
|
68
|
-
| " Plain"
|
|
69
|
-
|
|
70
|
-
#data
|
|
71
|
-
<html><body>
|
|
72
|
-
<p><font size="7">First paragraph.</p>
|
|
73
|
-
<p>Second paragraph.</p></font>
|
|
74
|
-
<b><p><i>Bold and Italic</b> Italic</p>
|
|
75
|
-
#errors
|
|
76
|
-
#document
|
|
77
|
-
| <html>
|
|
78
|
-
| <head>
|
|
79
|
-
| <body>
|
|
80
|
-
| "
|
|
81
|
-
"
|
|
82
|
-
| <p>
|
|
83
|
-
| <font>
|
|
84
|
-
| size="7"
|
|
85
|
-
| "First paragraph."
|
|
86
|
-
| <font>
|
|
87
|
-
| size="7"
|
|
88
|
-
| "
|
|
89
|
-
"
|
|
90
|
-
| <p>
|
|
91
|
-
| "Second paragraph."
|
|
92
|
-
| "
|
|
93
|
-
"
|
|
94
|
-
| <b>
|
|
95
|
-
| <p>
|
|
96
|
-
| <b>
|
|
97
|
-
| <i>
|
|
98
|
-
| "Bold and Italic"
|
|
99
|
-
| <i>
|
|
100
|
-
| " Italic"
|
|
101
|
-
|
|
102
|
-
#data
|
|
103
|
-
<html>
|
|
104
|
-
<dl>
|
|
105
|
-
<dt><b>Boo
|
|
106
|
-
<dd>Goo?
|
|
107
|
-
</dl>
|
|
108
|
-
</html>
|
|
109
|
-
#errors
|
|
110
|
-
#document
|
|
111
|
-
| <html>
|
|
112
|
-
| <head>
|
|
113
|
-
| <body>
|
|
114
|
-
| <dl>
|
|
115
|
-
| "
|
|
116
|
-
"
|
|
117
|
-
| <dt>
|
|
118
|
-
| <b>
|
|
119
|
-
| "Boo
|
|
120
|
-
"
|
|
121
|
-
| <dd>
|
|
122
|
-
| <b>
|
|
123
|
-
| "Goo?
|
|
124
|
-
"
|
|
125
|
-
| <b>
|
|
126
|
-
| "
|
|
127
|
-
"
|
|
128
|
-
|
|
129
|
-
#data
|
|
130
|
-
<html><body>
|
|
131
|
-
<label><a><div>Hello<div>World</div></a></label>
|
|
132
|
-
</body></html>
|
|
133
|
-
#errors
|
|
134
|
-
#document
|
|
135
|
-
| <html>
|
|
136
|
-
| <head>
|
|
137
|
-
| <body>
|
|
138
|
-
| "
|
|
139
|
-
"
|
|
140
|
-
| <label>
|
|
141
|
-
| <a>
|
|
142
|
-
| <div>
|
|
143
|
-
| <a>
|
|
144
|
-
| "Hello"
|
|
145
|
-
| <div>
|
|
146
|
-
| "World"
|
|
147
|
-
| "
|
|
148
|
-
"
|
|
149
|
-
|
|
150
|
-
#data
|
|
151
|
-
<table><center> <font>a</center> <img> <tr><td> </td> </tr> </table>
|
|
152
|
-
#errors
|
|
153
|
-
#document
|
|
154
|
-
| <html>
|
|
155
|
-
| <head>
|
|
156
|
-
| <body>
|
|
157
|
-
| <center>
|
|
158
|
-
| " "
|
|
159
|
-
| <font>
|
|
160
|
-
| "a"
|
|
161
|
-
| <font>
|
|
162
|
-
| <img>
|
|
163
|
-
| " "
|
|
164
|
-
| <table>
|
|
165
|
-
| " "
|
|
166
|
-
| <tbody>
|
|
167
|
-
| <tr>
|
|
168
|
-
| <td>
|
|
169
|
-
| " "
|
|
170
|
-
| " "
|
|
171
|
-
| " "
|
|
172
|
-
|
|
173
|
-
#data
|
|
174
|
-
<table><tr><p><a><p>You should see this text.
|
|
175
|
-
#errors
|
|
176
|
-
#document
|
|
177
|
-
| <html>
|
|
178
|
-
| <head>
|
|
179
|
-
| <body>
|
|
180
|
-
| <p>
|
|
181
|
-
| <a>
|
|
182
|
-
| <p>
|
|
183
|
-
| <a>
|
|
184
|
-
| "You should see this text."
|
|
185
|
-
| <table>
|
|
186
|
-
| <tbody>
|
|
187
|
-
| <tr>
|
|
188
|
-
|
|
189
|
-
#data
|
|
190
|
-
<TABLE>
|
|
191
|
-
<TR>
|
|
192
|
-
<CENTER><CENTER><TD></TD></TR><TR>
|
|
193
|
-
<FONT>
|
|
194
|
-
<TABLE><tr></tr></TABLE>
|
|
195
|
-
</P>
|
|
196
|
-
<a></font><font></a>
|
|
197
|
-
This page contains an insanely badly-nested tag sequence.
|
|
198
|
-
#errors
|
|
199
|
-
#document
|
|
200
|
-
| <html>
|
|
201
|
-
| <head>
|
|
202
|
-
| <body>
|
|
203
|
-
| <center>
|
|
204
|
-
| <center>
|
|
205
|
-
| <font>
|
|
206
|
-
| "
|
|
207
|
-
"
|
|
208
|
-
| <table>
|
|
209
|
-
| "
|
|
210
|
-
"
|
|
211
|
-
| <tbody>
|
|
212
|
-
| <tr>
|
|
213
|
-
| "
|
|
214
|
-
"
|
|
215
|
-
| <td>
|
|
216
|
-
| <tr>
|
|
217
|
-
| "
|
|
218
|
-
"
|
|
219
|
-
| <table>
|
|
220
|
-
| <tbody>
|
|
221
|
-
| <tr>
|
|
222
|
-
| <font>
|
|
223
|
-
| "
|
|
224
|
-
"
|
|
225
|
-
| <p>
|
|
226
|
-
| "
|
|
227
|
-
"
|
|
228
|
-
| <a>
|
|
229
|
-
| <a>
|
|
230
|
-
| <font>
|
|
231
|
-
| <font>
|
|
232
|
-
| "
|
|
233
|
-
This page contains an insanely badly-nested tag sequence."
|
|
234
|
-
|
|
235
|
-
#data
|
|
236
|
-
<html>
|
|
237
|
-
<body>
|
|
238
|
-
<b><nobr><div>This text is in a div inside a nobr</nobr>More text that should not be in the nobr, i.e., the
|
|
239
|
-
nobr should have closed the div inside it implicitly. </b><pre>A pre tag outside everything else.</pre>
|
|
240
|
-
</body>
|
|
241
|
-
</html>
|
|
242
|
-
#errors
|
|
243
|
-
#document
|
|
244
|
-
| <html>
|
|
245
|
-
| <head>
|
|
246
|
-
| <body>
|
|
247
|
-
| "
|
|
248
|
-
"
|
|
249
|
-
| <b>
|
|
250
|
-
| <nobr>
|
|
251
|
-
| <div>
|
|
252
|
-
| <b>
|
|
253
|
-
| <nobr>
|
|
254
|
-
| "This text is in a div inside a nobr"
|
|
255
|
-
| "More text that should not be in the nobr, i.e., the
|
|
256
|
-
nobr should have closed the div inside it implicitly. "
|
|
257
|
-
| <pre>
|
|
258
|
-
| "A pre tag outside everything else."
|
|
259
|
-
| "
|
|
260
|
-
|
|
261
|
-
"
|