Skip to content

Commit aaee111

Browse files
committed
Apply patch from <select> parser PR
html5lib/html5lib-tests#178
1 parent 7be47cf commit aaee111

File tree

12 files changed

+293
-128
lines changed

12 files changed

+293
-128
lines changed

tests/phpunit/data/html5lib-tests/tree-construction/menuitem-element.dat

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,14 @@
161161
#data
162162
<!DOCTYPE html><select><menuitem></select>
163163
#errors
164-
33: Stray start tag menuitem.
164+
1:34: ERROR: End tag 'select' isn't allowed here. Currently open tags: html, body, select, menuitem.
165165
#document
166166
| <!DOCTYPE html>
167167
| <html>
168168
| <head>
169169
| <body>
170170
| <select>
171+
| <menuitem>
171172

172173
#data
173174
<!DOCTYPE html><option><menuitem>

tests/phpunit/data/html5lib-tests/tree-construction/tables01.dat

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,11 @@
100100
#data
101101
<table><select><option>3</select></table>
102102
#errors
103-
(1,7): expected-doctype-but-got-start-tag
104-
(1,15): unexpected-start-tag-implies-table-voodoo
103+
1:1: ERROR: Expected a doctype token
104+
1:8: ERROR: Start tag 'select' isn't allowed here. Currently open tags: html, body, table.
105+
1:16: ERROR: Start tag 'option' isn't allowed here. Currently open tags: html, body, table, select.
106+
1:24: ERROR: Character tokens aren't legal here
107+
1:25: ERROR: End tag 'select' isn't allowed here. Currently open tags: html, body, table, select, option.
105108
#document
106109
| <html>
107110
| <head>
@@ -114,12 +117,11 @@
114117
#data
115118
<table><select><table></table></select></table>
116119
#errors
117-
(1,7): expected-doctype-but-got-start-tag
118-
(1,15): unexpected-start-tag-implies-table-voodoo
119-
(1,22): unexpected-table-element-start-tag-in-select-in-table
120-
(1,22): unexpected-start-tag-implies-end-tag
121-
(1,39): unexpected-end-tag
122-
(1,47): unexpected-end-tag
120+
1:1: ERROR: Expected a doctype token
121+
1:8: ERROR: Start tag 'select' isn't allowed here. Currently open tags: html, body, table.
122+
1:16: ERROR: Start tag 'table' isn't allowed here. Currently open tags: html, body, table, select.
123+
1:31: ERROR: End tag 'select' isn't allowed here. Currently open tags: html, body.
124+
1:40: ERROR: End tag 'table' isn't allowed here. Currently open tags: html, body.
123125
#document
124126
| <html>
125127
| <head>
@@ -131,9 +133,8 @@
131133
#data
132134
<table><select></table>
133135
#errors
134-
(1,7): expected-doctype-but-got-start-tag
135-
(1,15): unexpected-start-tag-implies-table-voodoo
136-
(1,23): unexpected-table-element-end-tag-in-select-in-table
136+
1:1: ERROR: Expected a doctype token
137+
1:8: ERROR: Start tag 'select' isn't allowed here. Currently open tags: html, body, table.
137138
#document
138139
| <html>
139140
| <head>
@@ -144,9 +145,10 @@
144145
#data
145146
<table><select><option>A<tr><td>B</td></tr></table>
146147
#errors
147-
(1,7): expected-doctype-but-got-start-tag
148-
(1,15): unexpected-start-tag-implies-table-voodoo
149-
(1,28): unexpected-table-element-start-tag-in-select-in-table
148+
1:1: ERROR: Expected a doctype token
149+
1:8: ERROR: Start tag 'select' isn't allowed here. Currently open tags: html, body, table.
150+
1:16: ERROR: Start tag 'option' isn't allowed here. Currently open tags: html, body, table, select.
151+
1:24: ERROR: Character tokens aren't legal here
150152
#document
151153
| <html>
152154
| <head>
@@ -292,7 +294,6 @@
292294
1:13: 'svg' tag isn't allowed here. Currently open tags: html, body, div, table.
293295
1:33: 'select' tag isn't allowed here. Currently open tags: html, body, div, table, svg, foreignobject.
294296
1:41: 'table' tag isn't allowed here. Currently open tags: html, body, div, table, svg, foreignobject, select.
295-
1:41: 'table' tag isn't allowed here. Currently open tags: html, body, div, table, svg, foreignobject.
296297
1:48: 's' tag isn't allowed here. Currently open tags: html, body, div, table.
297298
1:51: Premature end of file. Currently open tags: html, body, div, table, s.
298299
#document

tests/phpunit/data/html5lib-tests/tree-construction/tests1.dat

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -355,19 +355,20 @@ Line1<br>Line2<br>Line3<br>Line4
355355
#data
356356
<select><b><option><select><option></b></select>X
357357
#errors
358-
(1,8): expected-doctype-but-got-start-tag
359-
(1,11): unexpected-start-tag-in-select
360-
(1,27): unexpected-select-in-select
361-
(1,39): unexpected-end-tag
362-
(1,48): unexpected-end-tag
358+
1:1: ERROR: Expected a doctype token
359+
1:20: ERROR: Start tag 'select' isn't allowed here. Currently open tags: html, body, select, b, option.
360+
1:36: ERROR: End tag 'b' isn't allowed here. Currently open tags: html, body, b, select, option.
361+
1:50: ERROR: Premature end of file. Currently open tags: html, body, b.
363362
#document
364363
| <html>
365364
| <head>
366365
| <body>
367366
| <select>
367+
| <b>
368+
| <option>
369+
| <b>
368370
| <option>
369-
| <option>
370-
| "X"
371+
| "X"
371372

372373
#data
373374
<a><table><td><a><table></table><a></tr><a></table><b>X</b>C<a>Y
@@ -1532,18 +1533,19 @@ Line1<br>Line2<br>Line3<br>Line4
15321533
#data
15331534
<select><b><option><select><option></b></select>
15341535
#errors
1535-
(1,8): expected-doctype-but-got-start-tag
1536-
(1,11): unexpected-start-tag-in-select
1537-
(1,27): unexpected-select-in-select
1538-
(1,39): unexpected-end-tag
1539-
(1,48): unexpected-end-tag
1536+
1:1: ERROR: Expected a doctype token
1537+
1:20: ERROR: Start tag 'select' isn't allowed here. Currently open tags: html, body, select, b, option.
1538+
1:36: ERROR: End tag 'b' isn't allowed here. Currently open tags: html, body, b, select, option.
1539+
1:49: ERROR: Premature end of file. Currently open tags: html, body, b.
15401540
#document
15411541
| <html>
15421542
| <head>
15431543
| <body>
15441544
| <select>
1545+
| <b>
1546+
| <option>
1547+
| <b>
15451548
| <option>
1546-
| <option>
15471549

15481550
#data
15491551
<html><head><title></title><body></body></html>

tests/phpunit/data/html5lib-tests/tree-construction/tests10.dat

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,25 @@
3535
#data
3636
<!DOCTYPE html><body><select><svg></svg></select>
3737
#errors
38-
(1,34) unexpected-start-tag-in-select
39-
(1,40) unexpected-end-tag-in-select
4038
#document
4139
| <!DOCTYPE html>
4240
| <html>
4341
| <head>
4442
| <body>
4543
| <select>
44+
| <svg svg>
4645

4746
#data
4847
<!DOCTYPE html><body><select><option><svg></svg></option></select>
4948
#errors
50-
(1,42) unexpected-start-tag-in-select
51-
(1,48) unexpected-end-tag-in-select
5249
#document
5350
| <!DOCTYPE html>
5451
| <html>
5552
| <head>
5653
| <body>
5754
| <select>
5855
| <option>
56+
| <svg svg>
5957

6058
#data
6159
<!DOCTYPE html><body><table><svg></svg></table>
@@ -261,13 +259,8 @@
261259
#data
262260
<!DOCTYPE html><body><table><tr><td><select><svg><g>foo</g><g>bar</g><p>baz</table><p>quux
263261
#errors
264-
(1,49) unexpected-start-tag-in-select
265-
(1,52) unexpected-start-tag-in-select
266-
(1,59) unexpected-end-tag-in-select
267-
(1,62) unexpected-start-tag-in-select
268-
(1,69) unexpected-end-tag-in-select
269-
(1,72) unexpected-start-tag-in-select
270-
(1,83) unexpected-table-element-end-tag-in-select-in-table
262+
1:70: ERROR: Start tag 'p' isn't allowed here. Currently open tags: html, body, table, tbody, tr, td, select, svg.
263+
1:76: ERROR: End tag 'table' isn't allowed here. Currently open tags: html, body, table, tbody, tr, td, select.
271264
#document
272265
| <!DOCTYPE html>
273266
| <html>
@@ -278,28 +271,39 @@
278271
| <tr>
279272
| <td>
280273
| <select>
281-
| "foobarbaz"
274+
| <svg svg>
275+
| <svg g>
276+
| "foo"
277+
| <svg g>
278+
| "bar"
279+
| <p>
280+
| "baz"
282281
| <p>
283282
| "quux"
284283

285284
#data
286285
<!DOCTYPE html><body><table><select><svg><g>foo</g><g>bar</g><p>baz</table><p>quux
287286
#errors
288-
(1,36) unexpected-start-tag-implies-table-voodoo
289-
(1,41) unexpected-start-tag-in-select
290-
(1,44) unexpected-start-tag-in-select
291-
(1,51) unexpected-end-tag-in-select
292-
(1,54) unexpected-start-tag-in-select
293-
(1,61) unexpected-end-tag-in-select
294-
(1,64) unexpected-start-tag-in-select
295-
(1,75) unexpected-table-element-end-tag-in-select-in-table
287+
1:29: ERROR: Start tag 'select' isn't allowed here. Currently open tags: html, body, table.
288+
1:37: ERROR: Start tag 'svg' isn't allowed here. Currently open tags: html, body, table, select.
289+
1:62: ERROR: Start tag 'p' isn't allowed here. Currently open tags: html, body, table, select, svg.
290+
1:62: ERROR: Start tag 'p' isn't allowed here. Currently open tags: html, body, table, select.
291+
1:65: ERROR: Character tokens aren't legal here
292+
1:66: ERROR: Character tokens aren't legal here
293+
1:67: ERROR: Character tokens aren't legal here
296294
#document
297295
| <!DOCTYPE html>
298296
| <html>
299297
| <head>
300298
| <body>
301299
| <select>
302-
| "foobarbaz"
300+
| <svg svg>
301+
| <svg g>
302+
| "foo"
303+
| <svg g>
304+
| "bar"
305+
| <p>
306+
| "baz"
303307
| <table>
304308
| <p>
305309
| "quux"

tests/phpunit/data/html5lib-tests/tree-construction/tests17.dat

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#data
22
<!doctype html><table><tbody><select><tr>
33
#errors
4-
(1,37): unexpected-start-tag-implies-table-voodoo
5-
(1,41): unexpected-table-element-start-tag-in-select-in-table
6-
(1,41): eof-in-table
4+
(1,30): unexpected-start-tag
5+
(1,42): premature-eof
76
#document
87
| <!DOCTYPE html>
98
| <html>
@@ -17,9 +16,8 @@
1716
#data
1817
<!doctype html><table><tr><select><td>
1918
#errors
20-
(1,34): unexpected-start-tag-implies-table-voodoo
21-
(1,38): unexpected-table-element-start-tag-in-select-in-table
22-
(1,38): expected-closing-tag-but-got-eof
19+
(1,27): unexpected-start-tag
20+
(1,39): premature-eof
2321
#document
2422
| <!DOCTYPE html>
2523
| <html>

tests/phpunit/data/html5lib-tests/tree-construction/tests18.dat

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -227,34 +227,42 @@
227227
#data
228228
<!doctype html><select><plaintext></plaintext>X
229229
#errors
230-
34: Stray start tag “plaintext”.
231-
46: Stray end tag “plaintext”.
232-
47: End of file seen and there were open elements.
230+
1:48: ERROR: Premature end of file. Currently open tags: html, body, select, plaintext.
233231
#document
234232
| <!DOCTYPE html>
235233
| <html>
236234
| <head>
237235
| <body>
238236
| <select>
239-
| "X"
237+
| <plaintext>
238+
| "</plaintext>X"
240239

241240
#data
242241
<!doctype html><table><select><plaintext>a<caption>b
243242
#errors
244-
30: Start tag “select” seen in “table”.
245-
41: Stray start tag “plaintext”.
246-
51: “caption” start tag with “select” open.
247-
52: End of file seen and there were open elements.
243+
1:23: ERROR: Start tag 'select' isn't allowed here. Currently open tags: html, body, table.
244+
1:31: ERROR: Start tag 'plaintext' isn't allowed here. Currently open tags: html, body, table, select.
245+
1:42: ERROR: Character tokens aren't legal here
246+
1:43: ERROR: Character tokens aren't legal here
247+
1:44: ERROR: Character tokens aren't legal here
248+
1:45: ERROR: Character tokens aren't legal here
249+
1:46: ERROR: Character tokens aren't legal here
250+
1:47: ERROR: Character tokens aren't legal here
251+
1:48: ERROR: Character tokens aren't legal here
252+
1:49: ERROR: Character tokens aren't legal here
253+
1:50: ERROR: Character tokens aren't legal here
254+
1:51: ERROR: Character tokens aren't legal here
255+
1:52: ERROR: Character tokens aren't legal here
256+
1:53: ERROR: Premature end of file. Currently open tags: html, body, table, select, plaintext.
248257
#document
249258
| <!DOCTYPE html>
250259
| <html>
251260
| <head>
252261
| <body>
253262
| <select>
254-
| "a"
263+
| <plaintext>
264+
| "a<caption>b"
255265
| <table>
256-
| <caption>
257-
| "b"
258266

259267
#data
260268
<!doctype html><template><plaintext>a</template>b
@@ -446,8 +454,11 @@
446454
#data
447455
<!doctype html><table><select><script></style></script>abc
448456
#errors
449-
(1,30): unexpected-start-tag-implies-table-voodoo
450-
(1,58): eof-in-select
457+
1:23: ERROR: Start tag 'select' isn't allowed here. Currently open tags: html, body, table.
458+
1:56: ERROR: Character tokens aren't legal here
459+
1:57: ERROR: Character tokens aren't legal here
460+
1:58: ERROR: Character tokens aren't legal here
461+
1:59: ERROR: Premature end of file. Currently open tags: html, body, table, select.
451462
#document
452463
| <!DOCTYPE html>
453464
| <html>
@@ -462,8 +473,11 @@
462473
#data
463474
<!doctype html><table><tr><select><script></style></script>abc
464475
#errors
465-
(1,34): unexpected-start-tag-implies-table-voodoo
466-
(1,62): eof-in-select
476+
1:27: ERROR: Start tag 'select' isn't allowed here. Currently open tags: html, body, table, tbody, tr.
477+
1:60: ERROR: Character tokens aren't legal here
478+
1:61: ERROR: Character tokens aren't legal here
479+
1:62: ERROR: Character tokens aren't legal here
480+
1:63: ERROR: Premature end of file. Currently open tags: html, body, table, tbody, tr, select.
467481
#document
468482
| <!DOCTYPE html>
469483
| <html>

tests/phpunit/data/html5lib-tests/tree-construction/tests2.dat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@
500500
#data
501501
<!DOCTYPE html><select><optgroup><option></optgroup><option><select><option>
502502
#errors
503-
(1,68): unexpected-select-in-select
503+
1:61: ERROR: Start tag 'select' isn't allowed here. Currently open tags: html, body, select, option.
504504
#document
505505
| <!DOCTYPE html>
506506
| <html>

tests/phpunit/data/html5lib-tests/tree-construction/tests7.dat

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,20 +200,20 @@ X</listing>
200200
#data
201201
<!doctype html><select><input>X
202202
#errors
203-
(1,30): unexpected-input-in-select
203+
1:32: ERROR: Premature end of file. Currently open tags: html, body, select.
204204
#document
205205
| <!DOCTYPE html>
206206
| <html>
207207
| <head>
208208
| <body>
209209
| <select>
210-
| <input>
211-
| "X"
210+
| <input>
211+
| "X"
212212

213213
#data
214214
<!doctype html><select><select>X
215215
#errors
216-
(1,31): unexpected-select-in-select
216+
1:24: ERROR: Start tag 'select' isn't allowed here. Currently open tags: html, body, select.
217217
#document
218218
| <!DOCTYPE html>
219219
| <html>
@@ -443,11 +443,11 @@ A<table><tr> B</tr> </em>C</table>
443443
#data
444444
<select><keygen>
445445
#errors
446-
(1,8): expected-doctype-but-got-start-tag
447-
(1,16): unexpected-input-in-select
446+
1:1: ERROR: Expected a doctype token
447+
1:17: ERROR: Premature end of file. Currently open tags: html, body, select.
448448
#document
449449
| <html>
450450
| <head>
451451
| <body>
452452
| <select>
453-
| <keygen>
453+
| <keygen>

0 commit comments

Comments
 (0)