html5 0.1.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. data/History.txt +9 -2
  2. data/Manifest.txt +61 -2
  3. data/README +41 -5
  4. data/Rakefile.rb +22 -6
  5. data/{parse.rb → bin/html5} +11 -11
  6. data/lib/core_ext/string.rb +17 -0
  7. data/lib/html5/constants.rb +228 -0
  8. data/lib/html5/filters/iso639codes.rb +752 -0
  9. data/lib/html5/filters/rfc2046.rb +30 -0
  10. data/lib/html5/filters/rfc3987.rb +89 -0
  11. data/lib/html5/filters/validator.rb +830 -0
  12. data/lib/html5/html5parser.rb +25 -25
  13. data/lib/html5/html5parser/after_body_phase.rb +3 -3
  14. data/lib/html5/html5parser/after_frameset_phase.rb +3 -4
  15. data/lib/html5/html5parser/after_head_phase.rb +6 -6
  16. data/lib/html5/html5parser/before_head_phase.rb +1 -1
  17. data/lib/html5/html5parser/in_body_phase.rb +54 -48
  18. data/lib/html5/html5parser/in_caption_phase.rb +7 -6
  19. data/lib/html5/html5parser/in_cell_phase.rb +3 -3
  20. data/lib/html5/html5parser/in_column_group_phase.rb +1 -1
  21. data/lib/html5/html5parser/in_frameset_phase.rb +5 -5
  22. data/lib/html5/html5parser/in_head_phase.rb +10 -10
  23. data/lib/html5/html5parser/in_row_phase.rb +4 -2
  24. data/lib/html5/html5parser/in_select_phase.rb +7 -6
  25. data/lib/html5/html5parser/in_table_body_phase.rb +8 -5
  26. data/lib/html5/html5parser/in_table_phase.rb +12 -7
  27. data/lib/html5/html5parser/initial_phase.rb +5 -6
  28. data/lib/html5/html5parser/phase.rb +5 -9
  29. data/lib/html5/html5parser/root_element_phase.rb +1 -2
  30. data/lib/html5/html5parser/trailing_end_phase.rb +3 -3
  31. data/lib/html5/inputstream.rb +25 -31
  32. data/lib/html5/liberalxmlparser.rb +2 -2
  33. data/lib/html5/sanitizer.rb +6 -6
  34. data/lib/html5/serializer/htmlserializer.rb +2 -3
  35. data/lib/html5/sniffer.rb +45 -0
  36. data/lib/html5/tokenizer.rb +57 -59
  37. data/lib/html5/treebuilders/rexml.rb +7 -6
  38. data/lib/html5/treebuilders/simpletree.rb +1 -1
  39. data/lib/html5/treewalkers/base.rb +8 -0
  40. data/lib/html5/version.rb +3 -0
  41. data/testdata/encoding/chardet/test_big5.txt +51 -0
  42. data/testdata/encoding/test-yahoo-jp.dat +10 -0
  43. data/testdata/encoding/tests1.dat +394 -0
  44. data/testdata/encoding/tests2.dat +81 -0
  45. data/testdata/sanitizer/tests1.dat +416 -0
  46. data/testdata/serializer/core.test +104 -0
  47. data/testdata/serializer/injectmeta.test +65 -0
  48. data/testdata/serializer/optionaltags.test +900 -0
  49. data/testdata/serializer/options.test +60 -0
  50. data/testdata/serializer/whitespace.test +51 -0
  51. data/testdata/sites/google-results.htm +1 -0
  52. data/testdata/sites/python-ref-import.htm +1 -0
  53. data/testdata/sites/web-apps-old.htm +1 -0
  54. data/testdata/sites/web-apps.htm +34275 -0
  55. data/testdata/sniffer/htmlOrFeed.json +43 -0
  56. data/testdata/tokenizer/contentModelFlags.test +48 -0
  57. data/testdata/tokenizer/entities.test +2339 -0
  58. data/testdata/tokenizer/escapeFlag.test +21 -0
  59. data/testdata/tokenizer/test1.test +172 -0
  60. data/testdata/tokenizer/test2.test +129 -0
  61. data/testdata/tokenizer/test3.test +367 -0
  62. data/testdata/tokenizer/test4.test +198 -0
  63. data/testdata/tree-construction/tests1.dat +1950 -0
  64. data/testdata/tree-construction/tests2.dat +773 -0
  65. data/testdata/tree-construction/tests3.dat +270 -0
  66. data/testdata/tree-construction/tests4.dat +60 -0
  67. data/testdata/tree-construction/tests5.dat +175 -0
  68. data/testdata/tree-construction/tests6.dat +196 -0
  69. data/testdata/validator/attributes.test +1035 -0
  70. data/testdata/validator/base-href-attribute.test +787 -0
  71. data/testdata/validator/base-target-attribute.test +35 -0
  72. data/testdata/validator/blockquote-cite-attribute.test +7 -0
  73. data/testdata/validator/classattribute.test +152 -0
  74. data/testdata/validator/contenteditableattribute.test +59 -0
  75. data/testdata/validator/contextmenuattribute.test +115 -0
  76. data/testdata/validator/dirattribute.test +59 -0
  77. data/testdata/validator/draggableattribute.test +63 -0
  78. data/testdata/validator/html-xmlns-attribute.test +23 -0
  79. data/testdata/validator/idattribute.test +115 -0
  80. data/testdata/validator/inputattributes.test +2795 -0
  81. data/testdata/validator/irrelevantattribute.test +63 -0
  82. data/testdata/validator/langattribute.test +5579 -0
  83. data/testdata/validator/li-value-attribute.test +7 -0
  84. data/testdata/validator/link-href-attribute.test +7 -0
  85. data/testdata/validator/link-hreflang-attribute.test +7 -0
  86. data/testdata/validator/link-rel-attribute.test +271 -0
  87. data/testdata/validator/ol-start-attribute.test +7 -0
  88. data/testdata/validator/starttags.test +375 -0
  89. data/testdata/validator/style-scoped-attribute.test +7 -0
  90. data/testdata/validator/tabindexattribute.test +79 -0
  91. data/tests/preamble.rb +7 -17
  92. data/tests/test_encoding.rb +1 -1
  93. data/tests/test_lxp.rb +16 -0
  94. data/tests/test_parser.rb +2 -2
  95. data/tests/test_sniffer.rb +27 -0
  96. data/tests/test_treewalkers.rb +41 -22
  97. data/tests/test_validator.rb +31 -0
  98. metadata +65 -6
@@ -0,0 +1,104 @@
1
+ {"tests": [
2
+
3
+ {"description": "proper attribute value escaping",
4
+ "input": [["StartTag", "span", {"title": "test \"with\" ""}]],
5
+ "expected": ["<span title='test \"with\" &amp;quot;'>"]
6
+ },
7
+
8
+ {"description": "proper attribute value non-quoting",
9
+ "input": [["StartTag", "span", {"title": "foo"}]],
10
+ "expected": ["<span title=foo>"],
11
+ "xhtml": ["<span title=\"foo\">"]
12
+ },
13
+
14
+ {"description": "proper attribute value quoting (with >)",
15
+ "input": [["StartTag", "span", {"title": "foo>bar"}]],
16
+ "expected": ["<span title=\"foo>bar\">"]
17
+ },
18
+
19
+ {"description": "proper attribute value quoting (with <)",
20
+ "input": [["StartTag", "span", {"title": "foo<bar"}]],
21
+ "expected": ["<span title=\"foo<bar\">"],
22
+ "xhtml": ["<span title=\"foo&lt;bar\">"]
23
+ },
24
+
25
+ {"description": "proper attribute value quoting (with \")",
26
+ "input": [["StartTag", "span", {"title": "foo\"bar"}]],
27
+ "expected": ["<span title='foo\"bar'>"]
28
+ },
29
+
30
+ {"description": "proper attribute value quoting (with ')",
31
+ "input": [["StartTag", "span", {"title": "foo'bar"}]],
32
+ "expected": ["<span title=\"foo'bar\">"]
33
+ },
34
+
35
+ {"description": "proper attribute value quoting (with both \" and ')",
36
+ "input": [["StartTag", "span", {"title": "foo'bar\"baz"}]],
37
+ "expected": ["<span title=\"foo'bar&quot;baz\">"]
38
+ },
39
+
40
+ {"description": "proper attribute value quoting (with space)",
41
+ "input": [["StartTag", "span", {"title": "foo bar"}]],
42
+ "expected": ["<span title=\"foo bar\">"]
43
+ },
44
+
45
+ {"description": "proper attribute value quoting (with tab)",
46
+ "input": [["StartTag", "span", {"title": "foo\tbar"}]],
47
+ "expected": ["<span title=\"foo\tbar\">"]
48
+ },
49
+
50
+ {"description": "proper attribute value quoting (with LF)",
51
+ "input": [["StartTag", "span", {"title": "foo\nbar"}]],
52
+ "expected": ["<span title=\"foo\nbar\">"]
53
+ },
54
+
55
+ {"description": "proper attribute value quoting (with CR)",
56
+ "input": [["StartTag", "span", {"title": "foo\rbar"}]],
57
+ "expected": ["<span title=\"foo\rbar\">"]
58
+ },
59
+
60
+ {"description": "proper attribute value quoting (with linetab)",
61
+ "input": [["StartTag", "span", {"title": "foo\u000Bbar"}]],
62
+ "expected": ["<span title=\"foo\u000Bbar\">"]
63
+ },
64
+
65
+ {"description": "proper attribute value quoting (with form feed)",
66
+ "input": [["StartTag", "span", {"title": "foo\u000Cbar"}]],
67
+ "expected": ["<span title=\"foo\u000Cbar\">"]
68
+ },
69
+
70
+ {"description": "void element (as EmptyTag token)",
71
+ "input": [["EmptyTag", "img", {}]],
72
+ "expected": ["<img>"],
73
+ "xhtml": ["<img />"]
74
+ },
75
+
76
+ {"description": "void element (as StartTag token)",
77
+ "input": [["StartTag", "img", {}]],
78
+ "expected": ["<img>"],
79
+ "xhtml": ["<img />"]
80
+ },
81
+
82
+ {"description": "doctype in error",
83
+ "input": [["Doctype", "foo"]],
84
+ "expected": ["<!DOCTYPE foo>"]
85
+ },
86
+
87
+ {"description": "character data",
88
+ "options": {"encoding":"utf-8"},
89
+ "input": [["Characters", "a<b>c&d"]],
90
+ "expected": ["a&lt;b&gt;c&amp;d"]
91
+ },
92
+
93
+ {"description": "rcdata",
94
+ "input": [["StartTag", "script", {}], ["Characters", "a<b>c&d"]],
95
+ "expected": ["<script>a<b>c&d"],
96
+ "xhtml": ["<script>a&lt;b&gt;c&amp;d"]
97
+ },
98
+
99
+ {"description": "doctype",
100
+ "input": [["Doctype", "HTML"]],
101
+ "expected": ["<!DOCTYPE HTML>"]
102
+ }
103
+
104
+ ]}
@@ -0,0 +1,65 @@
1
+ {"tests": [
2
+
3
+ {"description": "no encoding",
4
+ "options": {"inject_meta_charset": true},
5
+ "input": [["EmptyTag", "head", {}]],
6
+ "expected": ["<head>"]
7
+ },
8
+
9
+ {"description": "empytag head",
10
+ "options": {"inject_meta_charset": true, "encoding":"utf-8"},
11
+ "input": [["EmptyTag", "head", {}]],
12
+ "expected": ["<head><meta charset=utf-8>"],
13
+ "xhtml": ["<head><meta charset=\"utf-8\" /></head>"]
14
+ },
15
+
16
+ {"description": "head w/title",
17
+ "options": {"inject_meta_charset": true, "encoding":"utf-8"},
18
+ "input": [["StartTag", "head", {}], ["StartTag","title",{}], ["Characters", "foo"],["EndTag", "title"], ["EndTag", "head"]],
19
+ "expected": ["<head><meta charset=utf-8><title>foo</title>"],
20
+ "xhtml": ["<head><meta charset=\"utf-8\" /><title>foo</title></head>"]
21
+ },
22
+
23
+ {"description": "head w/meta-charset",
24
+ "options": {"inject_meta_charset": true, "encoding":"utf-8"},
25
+ "input": [["StartTag", "head", {}], ["EmptyTag","meta",{"charset":"ascii"}], ["EndTag", "head"]],
26
+ "expected": ["<head><meta charset=utf-8>"],
27
+ "xhtml": ["<head><meta charset=\"utf-8\" /></head>"]
28
+ },
29
+
30
+ {"description": "head w/ two meta-charset",
31
+ "options": {"inject_meta_charset": true, "encoding":"utf-8"},
32
+ "input": [["StartTag", "head", {}], ["EmptyTag","meta",{"charset":"ascii"}], ["EmptyTag","meta",{"charset":"ascii"}], ["EndTag", "head"]],
33
+ "expected": ["<head><meta charset=utf-8><meta charset=utf-8>", "<head><meta charset=utf-8><meta charset=ascii>"],
34
+ "xhtml": ["<head><meta charset=\"utf-8\" /><meta charset=\"utf-8\" /></head>", "<head><meta charset=\"utf-8\" /><meta charset=\"ascii\" /></head>"]
35
+ },
36
+
37
+ {"description": "head w/robots",
38
+ "options": {"inject_meta_charset": true, "encoding":"utf-8"},
39
+ "input": [["StartTag", "head", {}], ["EmptyTag","meta",{"name":"robots","content":"noindex"}], ["EndTag", "head"]],
40
+ "expected": ["<head><meta charset=utf-8><meta content=noindex name=robots>"],
41
+ "xhtml": ["<head><meta charset=\"utf-8\" /><meta content=\"noindex\" name=\"robots\" /></head>"]
42
+ },
43
+
44
+ {"description": "head w/robots & charset",
45
+ "options": {"inject_meta_charset": true, "encoding":"utf-8"},
46
+ "input": [["StartTag", "head", {}], ["EmptyTag","meta",{"name":"robots","content":"noindex"}], ["EmptyTag","meta",{"charset":"ascii"}], ["EndTag", "head"]],
47
+ "expected": ["<head><meta content=noindex name=robots><meta charset=utf-8>"],
48
+ "xhtml": ["<head><meta content=\"noindex\" name=\"robots\" /><meta charset=\"utf-8\" /></head>"]
49
+ },
50
+
51
+ {"description": "head w/ charset in http-equiv content-type",
52
+ "options": {"inject_meta_charset": true, "encoding":"utf-8"},
53
+ "input": [["StartTag", "head", {}], ["EmptyTag","meta",{"http-equiv":"content-type", "content":"text/html; charset=ascii"}], ["EndTag", "head"]],
54
+ "expected": ["<head><meta content=\"text/html; charset=utf-8\" http-equiv=content-type>"],
55
+ "xhtml": ["<head><meta content=\"text/html; charset=utf-8\" http-equiv=\"content-type\" /></head>"]
56
+ },
57
+
58
+ {"description": "head w/robots & charset in http-equiv content-type",
59
+ "options": {"inject_meta_charset": true, "encoding":"utf-8"},
60
+ "input": [["StartTag", "head", {}], ["EmptyTag","meta",{"name":"robots","content":"noindex"}], ["EmptyTag","meta",{"http-equiv":"content-type", "content":"text/html; charset=ascii"}], ["EndTag", "head"]],
61
+ "expected": ["<head><meta content=noindex name=robots><meta content=\"text/html; charset=utf-8\" http-equiv=content-type>"],
62
+ "xhtml": ["<head><meta content=\"noindex\" name=\"robots\" /><meta content=\"text/html; charset=utf-8\" http-equiv=\"content-type\" /></head>"]
63
+ }
64
+
65
+ ]}
@@ -0,0 +1,900 @@
1
+ {"tests": [
2
+
3
+ {"description": "html start-tag followed by text, with attributes",
4
+ "input": [["StartTag", "html", {"lang": "en"}], ["Characters", "foo"]],
5
+ "expected": ["<html lang=en>foo"]
6
+ },
7
+
8
+
9
+
10
+ {"description": "html start-tag followed by comment",
11
+ "input": [["StartTag", "html", {}], ["Comment", "foo"]],
12
+ "expected": ["<html><!--foo-->"]
13
+ },
14
+
15
+ {"description": "html start-tag followed by space character",
16
+ "input": [["StartTag", "html", {}], ["Characters", " foo"]],
17
+ "expected": ["<html> foo"]
18
+ },
19
+
20
+ {"description": "html start-tag followed by text",
21
+ "input": [["StartTag", "html", {}], ["Characters", "foo"]],
22
+ "expected": ["foo"]
23
+ },
24
+
25
+ {"description": "html start-tag followed by start-tag",
26
+ "input": [["StartTag", "html", {}], ["StartTag", "foo", {}]],
27
+ "expected": ["<foo>"]
28
+ },
29
+
30
+ {"description": "html start-tag followed by end-tag",
31
+ "input": [["StartTag", "html", {}], ["EndTag", "foo", {}]],
32
+ "expected": ["</foo>"]
33
+ },
34
+
35
+ {"description": "html start-tag at EOF (shouldn't ever happen?!)",
36
+ "input": [["StartTag", "html", {}]],
37
+ "expected": [""]
38
+ },
39
+
40
+
41
+
42
+ {"description": "html end-tag followed by comment",
43
+ "input": [["EndTag", "html"], ["Comment", "foo"]],
44
+ "expected": ["</html><!--foo-->"]
45
+ },
46
+
47
+ {"description": "html end-tag followed by space character",
48
+ "input": [["EndTag", "html"], ["Characters", " foo"]],
49
+ "expected": ["</html> foo"]
50
+ },
51
+
52
+ {"description": "html end-tag followed by text",
53
+ "input": [["EndTag", "html"], ["Characters", "foo"]],
54
+ "expected": ["foo"]
55
+ },
56
+
57
+ {"description": "html end-tag followed by start-tag",
58
+ "input": [["EndTag", "html"], ["StartTag", "foo", {}]],
59
+ "expected": ["<foo>"]
60
+ },
61
+
62
+ {"description": "html end-tag followed by end-tag",
63
+ "input": [["EndTag", "html"], ["EndTag", "foo", {}]],
64
+ "expected": ["</foo>"]
65
+ },
66
+
67
+ {"description": "html end-tag at EOF",
68
+ "input": [["EndTag", "html"]],
69
+ "expected": [""]
70
+ },
71
+
72
+
73
+
74
+
75
+ {"description": "head start-tag followed by comment",
76
+ "input": [["StartTag", "head", {}], ["Comment", "foo"]],
77
+ "expected": ["<head><!--foo-->"]
78
+ },
79
+
80
+ {"description": "head start-tag followed by space character",
81
+ "input": [["StartTag", "head", {}], ["Characters", " foo"]],
82
+ "expected": ["<head> foo"]
83
+ },
84
+
85
+ {"description": "head start-tag followed by text",
86
+ "input": [["StartTag", "head", {}], ["Characters", "foo"]],
87
+ "expected": ["<head>foo"]
88
+ },
89
+
90
+ {"description": "head start-tag followed by start-tag",
91
+ "input": [["StartTag", "head", {}], ["StartTag", "foo", {}]],
92
+ "expected": ["<foo>"]
93
+ },
94
+
95
+ {"description": "head start-tag followed by end-tag",
96
+ "input": [["StartTag", "head", {}], ["EndTag", "foo", {}]],
97
+ "expected": ["<head></foo>"]
98
+ },
99
+
100
+ {"description": "head start-tag at EOF (shouldn't ever happen?!)",
101
+ "input": [["StartTag", "head", {}]],
102
+ "expected": ["<head>"]
103
+ },
104
+
105
+
106
+
107
+ {"description": "head end-tag followed by comment",
108
+ "input": [["EndTag", "head"], ["Comment", "foo"]],
109
+ "expected": ["</head><!--foo-->"]
110
+ },
111
+
112
+ {"description": "head end-tag followed by space character",
113
+ "input": [["EndTag", "head"], ["Characters", " foo"]],
114
+ "expected": ["</head> foo"]
115
+ },
116
+
117
+ {"description": "head end-tag followed by text",
118
+ "input": [["EndTag", "head"], ["Characters", "foo"]],
119
+ "expected": ["foo"]
120
+ },
121
+
122
+ {"description": "head end-tag followed by start-tag",
123
+ "input": [["EndTag", "head"], ["StartTag", "foo", {}]],
124
+ "expected": ["<foo>"]
125
+ },
126
+
127
+ {"description": "head end-tag followed by end-tag",
128
+ "input": [["EndTag", "head"], ["EndTag", "foo", {}]],
129
+ "expected": ["</foo>"]
130
+ },
131
+
132
+ {"description": "head end-tag at EOF",
133
+ "input": [["EndTag", "head"]],
134
+ "expected": [""]
135
+ },
136
+
137
+
138
+
139
+
140
+ {"description": "body start-tag followed by comment",
141
+ "input": [["StartTag", "body", {}], ["Comment", "foo"]],
142
+ "expected": ["<body><!--foo-->"]
143
+ },
144
+
145
+ {"description": "body start-tag followed by space character",
146
+ "input": [["StartTag", "body", {}], ["Characters", " foo"]],
147
+ "expected": ["<body> foo"]
148
+ },
149
+
150
+ {"description": "body start-tag followed by text",
151
+ "input": [["StartTag", "body", {}], ["Characters", "foo"]],
152
+ "expected": ["foo"]
153
+ },
154
+
155
+ {"description": "body start-tag followed by start-tag",
156
+ "input": [["StartTag", "body", {}], ["StartTag", "foo", {}]],
157
+ "expected": ["<foo>"]
158
+ },
159
+
160
+ {"description": "body start-tag followed by end-tag",
161
+ "input": [["StartTag", "body", {}], ["EndTag", "foo", {}]],
162
+ "expected": ["</foo>"]
163
+ },
164
+
165
+ {"description": "body start-tag at EOF (shouldn't ever happen?!)",
166
+ "input": [["StartTag", "body", {}]],
167
+ "expected": [""]
168
+ },
169
+
170
+
171
+
172
+ {"description": "body end-tag followed by comment",
173
+ "input": [["EndTag", "body"], ["Comment", "foo"]],
174
+ "expected": ["</body><!--foo-->"]
175
+ },
176
+
177
+ {"description": "body end-tag followed by space character",
178
+ "input": [["EndTag", "body"], ["Characters", " foo"]],
179
+ "expected": ["</body> foo"]
180
+ },
181
+
182
+ {"description": "body end-tag followed by text",
183
+ "input": [["EndTag", "body"], ["Characters", "foo"]],
184
+ "expected": ["foo"]
185
+ },
186
+
187
+ {"description": "body end-tag followed by start-tag",
188
+ "input": [["EndTag", "body"], ["StartTag", "foo", {}]],
189
+ "expected": ["<foo>"]
190
+ },
191
+
192
+ {"description": "body end-tag followed by end-tag",
193
+ "input": [["EndTag", "body"], ["EndTag", "foo", {}]],
194
+ "expected": ["</foo>"]
195
+ },
196
+
197
+ {"description": "body end-tag at EOF",
198
+ "input": [["EndTag", "body"]],
199
+ "expected": [""]
200
+ },
201
+
202
+
203
+
204
+
205
+ {"description": "li end-tag followed by comment",
206
+ "input": [["EndTag", "li"], ["Comment", "foo"]],
207
+ "expected": ["</li><!--foo-->"]
208
+ },
209
+
210
+ {"description": "li end-tag followed by space character",
211
+ "input": [["EndTag", "li"], ["Characters", " foo"]],
212
+ "expected": ["</li> foo"]
213
+ },
214
+
215
+ {"description": "li end-tag followed by text",
216
+ "input": [["EndTag", "li"], ["Characters", "foo"]],
217
+ "expected": ["</li>foo"]
218
+ },
219
+
220
+ {"description": "li end-tag followed by start-tag",
221
+ "input": [["EndTag", "li"], ["StartTag", "foo", {}]],
222
+ "expected": ["</li><foo>"]
223
+ },
224
+
225
+ {"description": "li end-tag followed by li start-tag",
226
+ "input": [["EndTag", "li"], ["StartTag", "li", {}]],
227
+ "expected": ["<li>"]
228
+ },
229
+
230
+ {"description": "li end-tag followed by end-tag",
231
+ "input": [["EndTag", "li"], ["EndTag", "foo", {}]],
232
+ "expected": ["</foo>"]
233
+ },
234
+
235
+ {"description": "li end-tag at EOF",
236
+ "input": [["EndTag", "li"]],
237
+ "expected": [""]
238
+ },
239
+
240
+
241
+
242
+
243
+ {"description": "dt end-tag followed by comment",
244
+ "input": [["EndTag", "dt"], ["Comment", "foo"]],
245
+ "expected": ["</dt><!--foo-->"]
246
+ },
247
+
248
+ {"description": "dt end-tag followed by space character",
249
+ "input": [["EndTag", "dt"], ["Characters", " foo"]],
250
+ "expected": ["</dt> foo"]
251
+ },
252
+
253
+ {"description": "dt end-tag followed by text",
254
+ "input": [["EndTag", "dt"], ["Characters", "foo"]],
255
+ "expected": ["</dt>foo"]
256
+ },
257
+
258
+ {"description": "dt end-tag followed by start-tag",
259
+ "input": [["EndTag", "dt"], ["StartTag", "foo", {}]],
260
+ "expected": ["</dt><foo>"]
261
+ },
262
+
263
+ {"description": "dt end-tag followed by dt start-tag",
264
+ "input": [["EndTag", "dt"], ["StartTag", "dt", {}]],
265
+ "expected": ["<dt>"]
266
+ },
267
+
268
+ {"description": "dt end-tag followed by dd start-tag",
269
+ "input": [["EndTag", "dt"], ["StartTag", "dd", {}]],
270
+ "expected": ["<dd>"]
271
+ },
272
+
273
+ {"description": "dt end-tag followed by end-tag",
274
+ "input": [["EndTag", "dt"], ["EndTag", "foo", {}]],
275
+ "expected": ["</dt></foo>"]
276
+ },
277
+
278
+ {"description": "dt end-tag at EOF",
279
+ "input": [["EndTag", "dt"]],
280
+ "expected": ["</dt>"]
281
+ },
282
+
283
+
284
+
285
+
286
+ {"description": "dd end-tag followed by comment",
287
+ "input": [["EndTag", "dd"], ["Comment", "foo"]],
288
+ "expected": ["</dd><!--foo-->"]
289
+ },
290
+
291
+ {"description": "dd end-tag followed by space character",
292
+ "input": [["EndTag", "dd"], ["Characters", " foo"]],
293
+ "expected": ["</dd> foo"]
294
+ },
295
+
296
+ {"description": "dd end-tag followed by text",
297
+ "input": [["EndTag", "dd"], ["Characters", "foo"]],
298
+ "expected": ["</dd>foo"]
299
+ },
300
+
301
+ {"description": "dd end-tag followed by start-tag",
302
+ "input": [["EndTag", "dd"], ["StartTag", "foo", {}]],
303
+ "expected": ["</dd><foo>"]
304
+ },
305
+
306
+ {"description": "dd end-tag followed by dd start-tag",
307
+ "input": [["EndTag", "dd"], ["StartTag", "dd", {}]],
308
+ "expected": ["<dd>"]
309
+ },
310
+
311
+ {"description": "dd end-tag followed by dt start-tag",
312
+ "input": [["EndTag", "dd"], ["StartTag", "dt", {}]],
313
+ "expected": ["<dt>"]
314
+ },
315
+
316
+ {"description": "dd end-tag followed by end-tag",
317
+ "input": [["EndTag", "dd"], ["EndTag", "foo", {}]],
318
+ "expected": ["</foo>"]
319
+ },
320
+
321
+ {"description": "dd end-tag at EOF",
322
+ "input": [["EndTag", "dd"]],
323
+ "expected": [""]
324
+ },
325
+
326
+
327
+
328
+
329
+ {"description": "p end-tag followed by comment",
330
+ "input": [["EndTag", "p"], ["Comment", "foo"]],
331
+ "expected": ["</p><!--foo-->"]
332
+ },
333
+
334
+ {"description": "p end-tag followed by space character",
335
+ "input": [["EndTag", "p"], ["Characters", " foo"]],
336
+ "expected": ["</p> foo"]
337
+ },
338
+
339
+ {"description": "p end-tag followed by text",
340
+ "input": [["EndTag", "p"], ["Characters", "foo"]],
341
+ "expected": ["</p>foo"]
342
+ },
343
+
344
+ {"description": "p end-tag followed by start-tag",
345
+ "input": [["EndTag", "p"], ["StartTag", "foo", {}]],
346
+ "expected": ["</p><foo>"]
347
+ },
348
+
349
+ {"description": "p end-tag followed by address start-tag",
350
+ "input": [["EndTag", "p"], ["StartTag", "address", {}]],
351
+ "expected": ["<address>"]
352
+ },
353
+
354
+ {"description": "p end-tag followed by blockquote start-tag",
355
+ "input": [["EndTag", "p"], ["StartTag", "blockquote", {}]],
356
+ "expected": ["<blockquote>"]
357
+ },
358
+
359
+ {"description": "p end-tag followed by dl start-tag",
360
+ "input": [["EndTag", "p"], ["StartTag", "dl", {}]],
361
+ "expected": ["<dl>"]
362
+ },
363
+
364
+ {"description": "p end-tag followed by fieldset start-tag",
365
+ "input": [["EndTag", "p"], ["StartTag", "fieldset", {}]],
366
+ "expected": ["<fieldset>"]
367
+ },
368
+
369
+ {"description": "p end-tag followed by form start-tag",
370
+ "input": [["EndTag", "p"], ["StartTag", "form", {}]],
371
+ "expected": ["<form>"]
372
+ },
373
+
374
+ {"description": "p end-tag followed by h1 start-tag",
375
+ "input": [["EndTag", "p"], ["StartTag", "h1", {}]],
376
+ "expected": ["<h1>"]
377
+ },
378
+
379
+ {"description": "p end-tag followed by h2 start-tag",
380
+ "input": [["EndTag", "p"], ["StartTag", "h2", {}]],
381
+ "expected": ["<h2>"]
382
+ },
383
+
384
+ {"description": "p end-tag followed by h3 start-tag",
385
+ "input": [["EndTag", "p"], ["StartTag", "h3", {}]],
386
+ "expected": ["<h3>"]
387
+ },
388
+
389
+ {"description": "p end-tag followed by h4 start-tag",
390
+ "input": [["EndTag", "p"], ["StartTag", "h4", {}]],
391
+ "expected": ["<h4>"]
392
+ },
393
+
394
+ {"description": "p end-tag followed by h5 start-tag",
395
+ "input": [["EndTag", "p"], ["StartTag", "h5", {}]],
396
+ "expected": ["<h5>"]
397
+ },
398
+
399
+ {"description": "p end-tag followed by h6 start-tag",
400
+ "input": [["EndTag", "p"], ["StartTag", "h6", {}]],
401
+ "expected": ["<h6>"]
402
+ },
403
+
404
+ {"description": "p end-tag followed by hr start-tag",
405
+ "input": [["EndTag", "p"], ["StartTag", "hr", {}]],
406
+ "expected": ["<hr>"]
407
+ },
408
+
409
+ {"description": "p end-tag followed by menu start-tag",
410
+ "input": [["EndTag", "p"], ["StartTag", "menu", {}]],
411
+ "expected": ["<menu>"]
412
+ },
413
+
414
+ {"description": "p end-tag followed by ol start-tag",
415
+ "input": [["EndTag", "p"], ["StartTag", "ol", {}]],
416
+ "expected": ["<ol>"]
417
+ },
418
+
419
+ {"description": "p end-tag followed by p start-tag",
420
+ "input": [["EndTag", "p"], ["StartTag", "p", {}]],
421
+ "expected": ["<p>"]
422
+ },
423
+
424
+ {"description": "p end-tag followed by pre start-tag",
425
+ "input": [["EndTag", "p"], ["StartTag", "pre", {}]],
426
+ "expected": ["<pre>"]
427
+ },
428
+
429
+ {"description": "p end-tag followed by table start-tag",
430
+ "input": [["EndTag", "p"], ["StartTag", "table", {}]],
431
+ "expected": ["<table>"]
432
+ },
433
+
434
+ {"description": "p end-tag followed by ul start-tag",
435
+ "input": [["EndTag", "p"], ["StartTag", "ul", {}]],
436
+ "expected": ["<ul>"]
437
+ },
438
+
439
+ {"description": "p end-tag followed by end-tag",
440
+ "input": [["EndTag", "p"], ["EndTag", "foo", {}]],
441
+ "expected": ["</foo>"]
442
+ },
443
+
444
+ {"description": "p end-tag at EOF",
445
+ "input": [["EndTag", "p"]],
446
+ "expected": [""]
447
+ },
448
+
449
+
450
+
451
+
452
+ {"description": "optgroup end-tag followed by comment",
453
+ "input": [["EndTag", "optgroup"], ["Comment", "foo"]],
454
+ "expected": ["</optgroup><!--foo-->"]
455
+ },
456
+
457
+ {"description": "optgroup end-tag followed by space character",
458
+ "input": [["EndTag", "optgroup"], ["Characters", " foo"]],
459
+ "expected": ["</optgroup> foo"]
460
+ },
461
+
462
+ {"description": "optgroup end-tag followed by text",
463
+ "input": [["EndTag", "optgroup"], ["Characters", "foo"]],
464
+ "expected": ["</optgroup>foo"]
465
+ },
466
+
467
+ {"description": "optgroup end-tag followed by start-tag",
468
+ "input": [["EndTag", "optgroup"], ["StartTag", "foo", {}]],
469
+ "expected": ["</optgroup><foo>"]
470
+ },
471
+
472
+ {"description": "optgroup end-tag followed by optgroup start-tag",
473
+ "input": [["EndTag", "optgroup"], ["StartTag", "optgroup", {}]],
474
+ "expected": ["<optgroup>"]
475
+ },
476
+
477
+ {"description": "optgroup end-tag followed by end-tag",
478
+ "input": [["EndTag", "optgroup"], ["EndTag", "foo", {}]],
479
+ "expected": ["</foo>"]
480
+ },
481
+
482
+ {"description": "optgroup end-tag at EOF",
483
+ "input": [["EndTag", "optgroup"]],
484
+ "expected": [""]
485
+ },
486
+
487
+
488
+
489
+
490
+ {"description": "option end-tag followed by comment",
491
+ "input": [["EndTag", "option"], ["Comment", "foo"]],
492
+ "expected": ["</option><!--foo-->"]
493
+ },
494
+
495
+ {"description": "option end-tag followed by space character",
496
+ "input": [["EndTag", "option"], ["Characters", " foo"]],
497
+ "expected": ["</option> foo"]
498
+ },
499
+
500
+ {"description": "option end-tag followed by text",
501
+ "input": [["EndTag", "option"], ["Characters", "foo"]],
502
+ "expected": ["</option>foo"]
503
+ },
504
+
505
+ {"description": "option end-tag followed by start-tag",
506
+ "input": [["EndTag", "option"], ["StartTag", "foo", {}]],
507
+ "expected": ["</option><foo>"]
508
+ },
509
+
510
+ {"description": "option end-tag followed by option start-tag",
511
+ "input": [["EndTag", "option"], ["StartTag", "option", {}]],
512
+ "expected": ["<option>"]
513
+ },
514
+
515
+ {"description": "option end-tag followed by end-tag",
516
+ "input": [["EndTag", "option"], ["EndTag", "foo", {}]],
517
+ "expected": ["</foo>"]
518
+ },
519
+
520
+ {"description": "option end-tag at EOF",
521
+ "input": [["EndTag", "option"]],
522
+ "expected": [""]
523
+ },
524
+
525
+
526
+
527
+
528
+ {"description": "colgroup start-tag followed by comment",
529
+ "input": [["StartTag", "colgroup", {}], ["Comment", "foo"]],
530
+ "expected": ["<colgroup><!--foo-->"]
531
+ },
532
+
533
+ {"description": "colgroup start-tag followed by space character",
534
+ "input": [["StartTag", "colgroup", {}], ["Characters", " foo"]],
535
+ "expected": ["<colgroup> foo"]
536
+ },
537
+
538
+ {"description": "colgroup start-tag followed by text",
539
+ "input": [["StartTag", "colgroup", {}], ["Characters", "foo"]],
540
+ "expected": ["<colgroup>foo"]
541
+ },
542
+
543
+ {"description": "colgroup start-tag followed by start-tag",
544
+ "input": [["StartTag", "colgroup", {}], ["StartTag", "foo", {}]],
545
+ "expected": ["<colgroup><foo>"]
546
+ },
547
+
548
+ {"description": "first colgroup in a table with a col child",
549
+ "input": [["StartTag", "table", {}], ["StartTag", "colgroup", {}], ["StartTag", "col", {}]],
550
+ "expected": ["<table><col>"]
551
+ },
552
+
553
+ {"description": "colgroup with a col child, following another colgroup",
554
+ "input": [["EndTag", "colgroup", {}], ["StartTag", "colgroup", {}], ["StartTag", "col", {}]],
555
+ "expected": ["</colgroup><col>", "<colgroup><col>"]
556
+ },
557
+
558
+ {"description": "colgroup start-tag followed by end-tag",
559
+ "input": [["StartTag", "colgroup", {}], ["EndTag", "foo", {}]],
560
+ "expected": ["<colgroup></foo>"]
561
+ },
562
+
563
+ {"description": "colgroup start-tag at EOF",
564
+ "input": [["StartTag", "colgroup", {}]],
565
+ "expected": ["<colgroup>"]
566
+ },
567
+
568
+
569
+
570
+ {"description": "colgroup end-tag followed by comment",
571
+ "input": [["EndTag", "colgroup"], ["Comment", "foo"]],
572
+ "expected": ["</colgroup><!--foo-->"]
573
+ },
574
+
575
+ {"description": "colgroup end-tag followed by space character",
576
+ "input": [["EndTag", "colgroup"], ["Characters", " foo"]],
577
+ "expected": ["</colgroup> foo"]
578
+ },
579
+
580
+ {"description": "colgroup end-tag followed by text",
581
+ "input": [["EndTag", "colgroup"], ["Characters", "foo"]],
582
+ "expected": ["foo"]
583
+ },
584
+
585
+ {"description": "colgroup end-tag followed by start-tag",
586
+ "input": [["EndTag", "colgroup"], ["StartTag", "foo", {}]],
587
+ "expected": ["<foo>"]
588
+ },
589
+
590
+ {"description": "colgroup end-tag followed by end-tag",
591
+ "input": [["EndTag", "colgroup"], ["EndTag", "foo", {}]],
592
+ "expected": ["</foo>"]
593
+ },
594
+
595
+ {"description": "colgroup end-tag at EOF",
596
+ "input": [["EndTag", "colgroup"]],
597
+ "expected": [""]
598
+ },
599
+
600
+
601
+
602
+
603
+ {"description": "thead end-tag followed by comment",
604
+ "input": [["EndTag", "thead"], ["Comment", "foo"]],
605
+ "expected": ["</thead><!--foo-->"]
606
+ },
607
+
608
+ {"description": "thead end-tag followed by space character",
609
+ "input": [["EndTag", "thead"], ["Characters", " foo"]],
610
+ "expected": ["</thead> foo"]
611
+ },
612
+
613
+ {"description": "thead end-tag followed by text",
614
+ "input": [["EndTag", "thead"], ["Characters", "foo"]],
615
+ "expected": ["</thead>foo"]
616
+ },
617
+
618
+ {"description": "thead end-tag followed by start-tag",
619
+ "input": [["EndTag", "thead"], ["StartTag", "foo", {}]],
620
+ "expected": ["</thead><foo>"]
621
+ },
622
+
623
+ {"description": "thead end-tag followed by tbody start-tag",
624
+ "input": [["EndTag", "thead"], ["StartTag", "tbody", {}]],
625
+ "expected": ["<tbody>"]
626
+ },
627
+
628
+ {"description": "thead end-tag followed by tfoot start-tag",
629
+ "input": [["EndTag", "thead"], ["StartTag", "tfoot", {}]],
630
+ "expected": ["<tfoot>"]
631
+ },
632
+
633
+ {"description": "thead end-tag followed by end-tag",
634
+ "input": [["EndTag", "thead"], ["EndTag", "foo", {}]],
635
+ "expected": ["</thead></foo>"]
636
+ },
637
+
638
+ {"description": "thead end-tag at EOF",
639
+ "input": [["EndTag", "thead"]],
640
+ "expected": ["</thead>"]
641
+ },
642
+
643
+
644
+
645
+
646
+ {"description": "tbody start-tag followed by comment",
647
+ "input": [["StartTag", "tbody", {}], ["Comment", "foo"]],
648
+ "expected": ["<tbody><!--foo-->"]
649
+ },
650
+
651
+ {"description": "tbody start-tag followed by space character",
652
+ "input": [["StartTag", "tbody", {}], ["Characters", " foo"]],
653
+ "expected": ["<tbody> foo"]
654
+ },
655
+
656
+ {"description": "tbody start-tag followed by text",
657
+ "input": [["StartTag", "tbody", {}], ["Characters", "foo"]],
658
+ "expected": ["<tbody>foo"]
659
+ },
660
+
661
+ {"description": "tbody start-tag followed by start-tag",
662
+ "input": [["StartTag", "tbody", {}], ["StartTag", "foo", {}]],
663
+ "expected": ["<tbody><foo>"]
664
+ },
665
+
666
+ {"description": "first tbody in a table with a tr child",
667
+ "input": [["StartTag", "table", {}], ["StartTag", "tbody", {}], ["StartTag", "tr", {}]],
668
+ "expected": ["<table><tr>"]
669
+ },
670
+
671
+ {"description": "tbody with a tr child, following another tbody",
672
+ "input": [["EndTag", "tbody", {}], ["StartTag", "tbody", {}], ["StartTag", "tr", {}]],
673
+ "expected": ["<tbody><tr>", "</tbody><tr>"]
674
+ },
675
+
676
+ {"description": "tbody with a tr child, following a thead",
677
+ "input": [["EndTag", "thead", {}], ["StartTag", "tbody", {}], ["StartTag", "tr", {}]],
678
+ "expected": ["<tbody><tr>", "</thead><tr>"]
679
+ },
680
+
681
+ {"description": "tbody with a tr child, following a tfoot",
682
+ "input": [["EndTag", "tfoot", {}], ["StartTag", "tbody", {}], ["StartTag", "tr", {}]],
683
+ "expected": ["<tbody><tr>", "</tfoot><tr>"]
684
+ },
685
+
686
+ {"description": "tbody start-tag followed by end-tag",
687
+ "input": [["StartTag", "tbody", {}], ["EndTag", "foo", {}]],
688
+ "expected": ["<tbody></foo>"]
689
+ },
690
+
691
+ {"description": "tbody start-tag at EOF",
692
+ "input": [["StartTag", "tbody", {}]],
693
+ "expected": ["<tbody>"]
694
+ },
695
+
696
+
697
+
698
+ {"description": "tbody end-tag followed by comment",
699
+ "input": [["EndTag", "tbody"], ["Comment", "foo"]],
700
+ "expected": ["</tbody><!--foo-->"]
701
+ },
702
+
703
+ {"description": "tbody end-tag followed by space character",
704
+ "input": [["EndTag", "tbody"], ["Characters", " foo"]],
705
+ "expected": ["</tbody> foo"]
706
+ },
707
+
708
+ {"description": "tbody end-tag followed by text",
709
+ "input": [["EndTag", "tbody"], ["Characters", "foo"]],
710
+ "expected": ["</tbody>foo"]
711
+ },
712
+
713
+ {"description": "tbody end-tag followed by start-tag",
714
+ "input": [["EndTag", "tbody"], ["StartTag", "foo", {}]],
715
+ "expected": ["</tbody><foo>"]
716
+ },
717
+
718
+ {"description": "tbody end-tag followed by tbody start-tag",
719
+ "input": [["EndTag", "tbody"], ["StartTag", "tbody", {}]],
720
+ "expected": ["<tbody>", "</tbody>"]
721
+ },
722
+
723
+ {"description": "tbody end-tag followed by tfoot start-tag",
724
+ "input": [["EndTag", "tbody"], ["StartTag", "tfoot", {}]],
725
+ "expected": ["<tfoot>"]
726
+ },
727
+
728
+ {"description": "tbody end-tag followed by end-tag",
729
+ "input": [["EndTag", "tbody"], ["EndTag", "foo", {}]],
730
+ "expected": ["</foo>"]
731
+ },
732
+
733
+ {"description": "tbody end-tag at EOF",
734
+ "input": [["EndTag", "tbody"]],
735
+ "expected": [""]
736
+ },
737
+
738
+
739
+
740
+
741
+ {"description": "tfoot end-tag followed by comment",
742
+ "input": [["EndTag", "tfoot"], ["Comment", "foo"]],
743
+ "expected": ["</tfoot><!--foo-->"]
744
+ },
745
+
746
+ {"description": "tfoot end-tag followed by space character",
747
+ "input": [["EndTag", "tfoot"], ["Characters", " foo"]],
748
+ "expected": ["</tfoot> foo"]
749
+ },
750
+
751
+ {"description": "tfoot end-tag followed by text",
752
+ "input": [["EndTag", "tfoot"], ["Characters", "foo"]],
753
+ "expected": ["</tfoot>foo"]
754
+ },
755
+
756
+ {"description": "tfoot end-tag followed by start-tag",
757
+ "input": [["EndTag", "tfoot"], ["StartTag", "foo", {}]],
758
+ "expected": ["</tfoot><foo>"]
759
+ },
760
+
761
+ {"description": "tfoot end-tag followed by tbody start-tag",
762
+ "input": [["EndTag", "tfoot"], ["StartTag", "tbody", {}]],
763
+ "expected": ["<tbody>", "</tfoot>"]
764
+ },
765
+
766
+ {"description": "tfoot end-tag followed by end-tag",
767
+ "input": [["EndTag", "tfoot"], ["EndTag", "foo", {}]],
768
+ "expected": ["</foo>"]
769
+ },
770
+
771
+ {"description": "tfoot end-tag at EOF",
772
+ "input": [["EndTag", "tfoot"]],
773
+ "expected": [""]
774
+ },
775
+
776
+
777
+
778
+
779
+ {"description": "tr end-tag followed by comment",
780
+ "input": [["EndTag", "tr"], ["Comment", "foo"]],
781
+ "expected": ["</tr><!--foo-->"]
782
+ },
783
+
784
+ {"description": "tr end-tag followed by space character",
785
+ "input": [["EndTag", "tr"], ["Characters", " foo"]],
786
+ "expected": ["</tr> foo"]
787
+ },
788
+
789
+ {"description": "tr end-tag followed by text",
790
+ "input": [["EndTag", "tr"], ["Characters", "foo"]],
791
+ "expected": ["</tr>foo"]
792
+ },
793
+
794
+ {"description": "tr end-tag followed by start-tag",
795
+ "input": [["EndTag", "tr"], ["StartTag", "foo", {}]],
796
+ "expected": ["</tr><foo>"]
797
+ },
798
+
799
+ {"description": "tr end-tag followed by tr start-tag",
800
+ "input": [["EndTag", "tr"], ["StartTag", "tr", {}]],
801
+ "expected": ["<tr>", "</tr>"]
802
+ },
803
+
804
+ {"description": "tr end-tag followed by end-tag",
805
+ "input": [["EndTag", "tr"], ["EndTag", "foo", {}]],
806
+ "expected": ["</foo>"]
807
+ },
808
+
809
+ {"description": "tr end-tag at EOF",
810
+ "input": [["EndTag", "tr"]],
811
+ "expected": [""]
812
+ },
813
+
814
+
815
+
816
+
817
+ {"description": "td end-tag followed by comment",
818
+ "input": [["EndTag", "td"], ["Comment", "foo"]],
819
+ "expected": ["</td><!--foo-->"]
820
+ },
821
+
822
+ {"description": "td end-tag followed by space character",
823
+ "input": [["EndTag", "td"], ["Characters", " foo"]],
824
+ "expected": ["</td> foo"]
825
+ },
826
+
827
+ {"description": "td end-tag followed by text",
828
+ "input": [["EndTag", "td"], ["Characters", "foo"]],
829
+ "expected": ["</td>foo"]
830
+ },
831
+
832
+ {"description": "td end-tag followed by start-tag",
833
+ "input": [["EndTag", "td"], ["StartTag", "foo", {}]],
834
+ "expected": ["</td><foo>"]
835
+ },
836
+
837
+ {"description": "td end-tag followed by td start-tag",
838
+ "input": [["EndTag", "td"], ["StartTag", "td", {}]],
839
+ "expected": ["<td>", "</td>"]
840
+ },
841
+
842
+ {"description": "td end-tag followed by th start-tag",
843
+ "input": [["EndTag", "td"], ["StartTag", "th", {}]],
844
+ "expected": ["<th>", "</td>"]
845
+ },
846
+
847
+ {"description": "td end-tag followed by end-tag",
848
+ "input": [["EndTag", "td"], ["EndTag", "foo", {}]],
849
+ "expected": ["</foo>"]
850
+ },
851
+
852
+ {"description": "td end-tag at EOF",
853
+ "input": [["EndTag", "td"]],
854
+ "expected": [""]
855
+ },
856
+
857
+
858
+
859
+
860
+ {"description": "th end-tag followed by comment",
861
+ "input": [["EndTag", "th"], ["Comment", "foo"]],
862
+ "expected": ["</th><!--foo-->"]
863
+ },
864
+
865
+ {"description": "th end-tag followed by space character",
866
+ "input": [["EndTag", "th"], ["Characters", " foo"]],
867
+ "expected": ["</th> foo"]
868
+ },
869
+
870
+ {"description": "th end-tag followed by text",
871
+ "input": [["EndTag", "th"], ["Characters", "foo"]],
872
+ "expected": ["</th>foo"]
873
+ },
874
+
875
+ {"description": "th end-tag followed by start-tag",
876
+ "input": [["EndTag", "th"], ["StartTag", "foo", {}]],
877
+ "expected": ["</th><foo>"]
878
+ },
879
+
880
+ {"description": "th end-tag followed by th start-tag",
881
+ "input": [["EndTag", "th"], ["StartTag", "th", {}]],
882
+ "expected": ["<th>", "</th>"]
883
+ },
884
+
885
+ {"description": "th end-tag followed by td start-tag",
886
+ "input": [["EndTag", "th"], ["StartTag", "td", {}]],
887
+ "expected": ["<td>", "</th>"]
888
+ },
889
+
890
+ {"description": "th end-tag followed by end-tag",
891
+ "input": [["EndTag", "th"], ["EndTag", "foo", {}]],
892
+ "expected": ["</foo>"]
893
+ },
894
+
895
+ {"description": "th end-tag at EOF",
896
+ "input": [["EndTag", "th"]],
897
+ "expected": [""]
898
+ }
899
+
900
+ ]}