@tkeron/html-parser 0.1.7 → 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 (89) hide show
  1. package/README.md +1 -7
  2. package/bun.lock +5 -0
  3. package/index.ts +4 -0
  4. package/package.json +7 -1
  5. package/src/css-selector.ts +1 -1
  6. package/src/dom-simulator.ts +38 -16
  7. package/src/encoding.ts +39 -0
  8. package/src/index.ts +9 -0
  9. package/src/parser.ts +478 -144
  10. package/src/serializer.ts +450 -0
  11. package/src/tokenizer.ts +59 -43
  12. package/tests/advanced.test.ts +119 -106
  13. package/tests/custom-elements.test.ts +172 -162
  14. package/tests/dom-extended.test.ts +12 -12
  15. package/tests/dom-manipulation.test.ts +9 -10
  16. package/tests/dom.test.ts +32 -27
  17. package/tests/helpers/tokenizer-adapter.test.ts +70 -0
  18. package/tests/helpers/tokenizer-adapter.ts +65 -0
  19. package/tests/helpers/tree-adapter.test.ts +39 -0
  20. package/tests/helpers/tree-adapter.ts +43 -0
  21. package/tests/html5lib-data/tokenizer/namedEntities.test +42422 -0
  22. package/tests/html5lib-data/tokenizer/pendingSpecChanges.test +9 -0
  23. package/tests/html5lib-data/tree-construction/adoption01.dat +354 -0
  24. package/tests/html5lib-data/tree-construction/adoption02.dat +39 -0
  25. package/tests/html5lib-data/tree-construction/domjs-unsafe.dat +0 -0
  26. package/tests/html5lib-data/tree-construction/entities02.dat +309 -0
  27. package/tests/html5lib-data/tree-construction/html5test-com.dat +301 -0
  28. package/tests/html5lib-data/tree-construction/math.dat +104 -0
  29. package/tests/html5lib-data/tree-construction/namespace-sensitivity.dat +22 -0
  30. package/tests/html5lib-data/tree-construction/noscript01.dat +237 -0
  31. package/tests/html5lib-data/tree-construction/ruby.dat +302 -0
  32. package/tests/html5lib-data/tree-construction/scriptdata01.dat +372 -0
  33. package/tests/html5lib-data/tree-construction/svg.dat +104 -0
  34. package/tests/html5lib-data/tree-construction/template.dat +1673 -0
  35. package/tests/html5lib-data/tree-construction/tests10.dat +853 -0
  36. package/tests/html5lib-data/tree-construction/tests11.dat +523 -0
  37. package/tests/html5lib-data/tree-construction/tests20.dat +842 -0
  38. package/tests/html5lib-data/tree-construction/tests21.dat +306 -0
  39. package/tests/html5lib-data/tree-construction/tests23.dat +168 -0
  40. package/tests/html5lib-data/tree-construction/tests24.dat +79 -0
  41. package/tests/html5lib-data/tree-construction/tests5.dat +210 -0
  42. package/tests/html5lib-data/tree-construction/tests6.dat +663 -0
  43. package/tests/html5lib-data/tree-construction/tests_innerHTML_1.dat +844 -0
  44. package/tests/parser.test.ts +172 -193
  45. package/tests/serializer-core.test.ts +16 -0
  46. package/tests/serializer-data/core.test +125 -0
  47. package/tests/serializer-data/injectmeta.test +66 -0
  48. package/tests/serializer-data/optionaltags.test +965 -0
  49. package/tests/serializer-data/options.test +60 -0
  50. package/tests/serializer-data/whitespace.test +51 -0
  51. package/tests/serializer-injectmeta.test.ts +16 -0
  52. package/tests/serializer-optionaltags.test.ts +16 -0
  53. package/tests/serializer-options.test.ts +16 -0
  54. package/tests/serializer-whitespace.test.ts +16 -0
  55. package/tests/tokenizer-namedEntities.test.ts +20 -0
  56. package/tests/tokenizer-pendingSpecChanges.test.ts +20 -0
  57. package/tests/tokenizer.test.ts +3 -6
  58. package/tests/tree-construction-adoption01.test.ts +37 -0
  59. package/tests/tree-construction-adoption02.test.ts +34 -0
  60. package/tests/tree-construction-domjs-unsafe.test.ts +24 -0
  61. package/tests/tree-construction-entities02.test.ts +33 -0
  62. package/tests/tree-construction-html5test-com.test.ts +24 -0
  63. package/tests/tree-construction-math.test.ts +18 -0
  64. package/tests/tree-construction-namespace-sensitivity.test.ts +18 -0
  65. package/tests/tree-construction-noscript01.test.ts +18 -0
  66. package/tests/tree-construction-ruby.test.ts +21 -0
  67. package/tests/tree-construction-scriptdata01.test.ts +21 -0
  68. package/tests/tree-construction-svg.test.ts +21 -0
  69. package/tests/tree-construction-template.test.ts +21 -0
  70. package/tests/tree-construction-tests10.test.ts +21 -0
  71. package/tests/tree-construction-tests11.test.ts +21 -0
  72. package/tests/tree-construction-tests20.test.ts +18 -0
  73. package/tests/tree-construction-tests21.test.ts +18 -0
  74. package/tests/tree-construction-tests23.test.ts +18 -0
  75. package/tests/tree-construction-tests24.test.ts +18 -0
  76. package/tests/tree-construction-tests5.test.ts +21 -0
  77. package/tests/tree-construction-tests6.test.ts +21 -0
  78. package/tests/tree-construction-tests_innerHTML_1.test.ts +21 -0
  79. package/tests/official/README.md +0 -87
  80. package/tests/official/acid/acid-tests.test.ts +0 -309
  81. package/tests/official/final-output/final-output.test.ts +0 -361
  82. package/tests/official/html5lib/tokenizer-utils.ts +0 -192
  83. package/tests/official/html5lib/tokenizer.test.ts +0 -171
  84. package/tests/official/html5lib/tree-construction-utils.ts +0 -194
  85. package/tests/official/html5lib/tree-construction.test.ts +0 -250
  86. package/tests/official/validator/validator-tests.test.ts +0 -237
  87. package/tests/official/validator-nu/validator-nu.test.ts +0 -335
  88. package/tests/official/whatwg/whatwg-tests.test.ts +0 -205
  89. package/tests/official/wpt/wpt-tests.test.ts +0 -409
@@ -0,0 +1,210 @@
1
+ #data
2
+ <style> <!-- </style>x
3
+ #errors
4
+ (1,7): expected-doctype-but-got-start-tag
5
+ #document
6
+ | <html>
7
+ | <head>
8
+ | <style>
9
+ | " <!-- "
10
+ | <body>
11
+ | "x"
12
+
13
+ #data
14
+ <style> <!-- </style> --> </style>x
15
+ #errors
16
+ (1,7): expected-doctype-but-got-start-tag
17
+ (1,34): unexpected-end-tag
18
+ #document
19
+ | <html>
20
+ | <head>
21
+ | <style>
22
+ | " <!-- "
23
+ | " "
24
+ | <body>
25
+ | "--> x"
26
+
27
+ #data
28
+ <style> <!--> </style>x
29
+ #errors
30
+ (1,7): expected-doctype-but-got-start-tag
31
+ #document
32
+ | <html>
33
+ | <head>
34
+ | <style>
35
+ | " <!--> "
36
+ | <body>
37
+ | "x"
38
+
39
+ #data
40
+ <style> <!---> </style>x
41
+ #errors
42
+ (1,7): expected-doctype-but-got-start-tag
43
+ #document
44
+ | <html>
45
+ | <head>
46
+ | <style>
47
+ | " <!---> "
48
+ | <body>
49
+ | "x"
50
+
51
+ #data
52
+ <iframe> <!---> </iframe>x
53
+ #errors
54
+ (1,8): expected-doctype-but-got-start-tag
55
+ #document
56
+ | <html>
57
+ | <head>
58
+ | <body>
59
+ | <iframe>
60
+ | " <!---> "
61
+ | "x"
62
+
63
+ #data
64
+ <iframe> <!--- </iframe>->x</iframe> --> </iframe>x
65
+ #errors
66
+ (1,8): expected-doctype-but-got-start-tag
67
+ (1,36): unexpected-end-tag
68
+ (1,50): unexpected-end-tag
69
+ #document
70
+ | <html>
71
+ | <head>
72
+ | <body>
73
+ | <iframe>
74
+ | " <!--- "
75
+ | "->x --> x"
76
+
77
+ #data
78
+ <script> <!-- </script> --> </script>x
79
+ #errors
80
+ (1,8): expected-doctype-but-got-start-tag
81
+ (1,37): unexpected-end-tag
82
+ #document
83
+ | <html>
84
+ | <head>
85
+ | <script>
86
+ | " <!-- "
87
+ | " "
88
+ | <body>
89
+ | "--> x"
90
+
91
+ #data
92
+ <title> <!-- </title> --> </title>x
93
+ #errors
94
+ (1,7): expected-doctype-but-got-start-tag
95
+ (1,34): unexpected-end-tag
96
+ #document
97
+ | <html>
98
+ | <head>
99
+ | <title>
100
+ | " <!-- "
101
+ | " "
102
+ | <body>
103
+ | "--> x"
104
+
105
+ #data
106
+ <textarea> <!--- </textarea>->x</textarea> --> </textarea>x
107
+ #errors
108
+ (1,10): expected-doctype-but-got-start-tag
109
+ (1,42): unexpected-end-tag
110
+ (1,58): unexpected-end-tag
111
+ #document
112
+ | <html>
113
+ | <head>
114
+ | <body>
115
+ | <textarea>
116
+ | " <!--- "
117
+ | "->x --> x"
118
+
119
+ #data
120
+ <style> <!</-- </style>x
121
+ #errors
122
+ (1,7): expected-doctype-but-got-start-tag
123
+ #document
124
+ | <html>
125
+ | <head>
126
+ | <style>
127
+ | " <!</-- "
128
+ | <body>
129
+ | "x"
130
+
131
+ #data
132
+ <p><xmp></xmp>
133
+ #errors
134
+ (1,3): expected-doctype-but-got-start-tag
135
+ #document
136
+ | <html>
137
+ | <head>
138
+ | <body>
139
+ | <p>
140
+ | <xmp>
141
+
142
+ #data
143
+ <xmp> <!-- > --> </xmp>
144
+ #errors
145
+ (1,5): expected-doctype-but-got-start-tag
146
+ #document
147
+ | <html>
148
+ | <head>
149
+ | <body>
150
+ | <xmp>
151
+ | " <!-- > --> "
152
+
153
+ #data
154
+ <title>&amp;</title>
155
+ #errors
156
+ (1,7): expected-doctype-but-got-start-tag
157
+ #document
158
+ | <html>
159
+ | <head>
160
+ | <title>
161
+ | "&"
162
+ | <body>
163
+
164
+ #data
165
+ <title><!--&amp;--></title>
166
+ #errors
167
+ (1,7): expected-doctype-but-got-start-tag
168
+ #document
169
+ | <html>
170
+ | <head>
171
+ | <title>
172
+ | "<!--&-->"
173
+ | <body>
174
+
175
+ #data
176
+ <title><!--</title>
177
+ #errors
178
+ (1,7): expected-doctype-but-got-start-tag
179
+ #document
180
+ | <html>
181
+ | <head>
182
+ | <title>
183
+ | "<!--"
184
+ | <body>
185
+
186
+ #data
187
+ <noscript><!--</noscript>--></noscript>
188
+ #errors
189
+ (1,10): expected-doctype-but-got-start-tag
190
+ (1,39): unexpected-end-tag
191
+ #script-on
192
+ #document
193
+ | <html>
194
+ | <head>
195
+ | <noscript>
196
+ | "<!--"
197
+ | <body>
198
+ | "-->"
199
+
200
+ #data
201
+ <noscript><!--</noscript>--></noscript>
202
+ #errors
203
+ (1,10): expected-doctype-but-got-start-tag
204
+ #script-off
205
+ #document
206
+ | <html>
207
+ | <head>
208
+ | <noscript>
209
+ | <!-- </noscript> -->
210
+ | <body>