Skip to content

Commit e1f5573

Browse files
committed
Merge pull request #43 from html5lib/script-on-script-off
update tests to support new #script-on #script-off format; r=gsnedders+Ms2ger
2 parents b93f570 + 093674a commit e1f5573

File tree

4 files changed

+127
-2
lines changed

4 files changed

+127
-2
lines changed

tree-construction/README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,22 @@ final newline (on the last line) removed.
2121
Then there must be a line that says "\#errors". It must be followed by
2222
one line per parse error that a conformant checker would return. It
2323
doesn't matter what those lines are, although they can't be
24-
"\#document-fragment", "\#document", or empty, the only thing that
25-
matters is that there be the right number of parse errors.
24+
"\#document-fragment", "\#document", "\#script-off", "\#script-on", or
25+
empty, the only thing that matters is that there be the right number
26+
of parse errors.
2627

2728
Then there \*may\* be a line that says "\#document-fragment", which must
2829
be followed by a newline (LF), followed by a string of characters that
2930
indicates the context element, followed by a newline (LF). If this line
3031
is present the "\#data" must be parsed using the HTML fragment parsing
3132
algorithm with the context element as context.
3233

34+
Then there \*may\* be a line that says "\#script-off" or
35+
"\#script-in". If a line that says "\#script-off" is present, the
36+
parser must set the scripting flag to disabled. If a line that says
37+
"\#script-on" is present, it must set it to enabled. Otherwise, the
38+
test should be run in both modes.
39+
3340
Then there must be a line that says "\#document", which must be followed
3441
by a dump of the tree of the parsed DOM. Each node must be represented
3542
by a single line. Each line must start with "| ", followed by two spaces
@@ -53,6 +60,8 @@ per parent node that the node has before the root document node.
5360
space, then the data and then "`>`". (The HTML parser cannot emit
5461
processing instructions, but scripts can, and the WebVTT to DOM
5562
rules can emit them.)
63+
- Template contents are represented by the string "content" with the
64+
children below it.
5665

5766
The *tag name string* is the local name prefixed by a namespace
5867
designator. For the HTML namespace, the namespace designator is the

tree-construction/tests16.dat

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,7 @@
10291029
<!doctype html><noscript><!--<noscript></noscript>--></noscript>
10301030
#errors
10311031
(1,64): unexpected-end-tag
1032+
#script-on
10321033
#document
10331034
| <!DOCTYPE html>
10341035
| <html>
@@ -1038,9 +1039,22 @@
10381039
| <body>
10391040
| "-->"
10401041

1042+
#data
1043+
<!doctype html><noscript><!--<noscript></noscript>--></noscript>
1044+
#errors
1045+
#script-off
1046+
#document
1047+
| <!DOCTYPE html>
1048+
| <html>
1049+
| <head>
1050+
| <noscript>
1051+
| <!-- <noscript></noscript> -->
1052+
| <body>
1053+
10411054
#data
10421055
<!doctype html><noscript><!--</noscript>X<noscript>--></noscript>
10431056
#errors
1057+
#script-on
10441058
#document
10451059
| <!DOCTYPE html>
10461060
| <html>
@@ -1052,9 +1066,22 @@
10521066
| <noscript>
10531067
| "-->"
10541068

1069+
#data
1070+
<!doctype html><noscript><!--</noscript>X<noscript>--></noscript>
1071+
#errors
1072+
#script-off
1073+
#document
1074+
| <!DOCTYPE html>
1075+
| <html>
1076+
| <head>
1077+
| <noscript>
1078+
| <!-- </noscript>X<noscript> -->
1079+
| <body>
1080+
10551081
#data
10561082
<!doctype html><noscript><iframe></noscript>X
10571083
#errors
1084+
#script-on
10581085
#document
10591086
| <!DOCTYPE html>
10601087
| <html>
@@ -1064,6 +1091,21 @@
10641091
| <body>
10651092
| "X"
10661093

1094+
#data
1095+
<!doctype html><noscript><iframe></noscript>X
1096+
#errors
1097+
* (1,34) unexpected token in head noscript
1098+
* (1,46) unexpected EOF
1099+
#script-off
1100+
#document
1101+
| <!DOCTYPE html>
1102+
| <html>
1103+
| <head>
1104+
| <noscript>
1105+
| <body>
1106+
| <iframe>
1107+
| "</noscript>X"
1108+
10671109
#data
10681110
<!doctype html><noframes><!--<noframes></noframes>--></noframes>
10691111
#errors
@@ -2190,6 +2232,7 @@
21902232
#errors
21912233
(1,10): expected-doctype-but-got-start-tag
21922234
(1,49): unexpected-end-tag
2235+
#script-on
21932236
#document
21942237
| <html>
21952238
| <head>
@@ -2198,10 +2241,23 @@
21982241
| <body>
21992242
| "-->"
22002243

2244+
#data
2245+
<noscript><!--<noscript></noscript>--></noscript>
2246+
#errors
2247+
* (1,11) missing DOCTYPE
2248+
#script-off
2249+
#document
2250+
| <html>
2251+
| <head>
2252+
| <noscript>
2253+
| <!-- <noscript></noscript> -->
2254+
| <body>
2255+
22012256
#data
22022257
<noscript><!--</noscript>X<noscript>--></noscript>
22032258
#errors
22042259
(1,10): expected-doctype-but-got-start-tag
2260+
#script-on
22052261
#document
22062262
| <html>
22072263
| <head>
@@ -2212,10 +2268,24 @@
22122268
| <noscript>
22132269
| "-->"
22142270

2271+
2272+
#data
2273+
<noscript><!--</noscript>X<noscript>--></noscript>
2274+
#errors
2275+
(1,10): expected-doctype-but-got-start-tag
2276+
#script-off
2277+
#document
2278+
| <html>
2279+
| <head>
2280+
| <noscript>
2281+
| <!-- </noscript>X<noscript> -->
2282+
| <body>
2283+
22152284
#data
22162285
<noscript><iframe></noscript>X
22172286
#errors
22182287
(1,10): expected-doctype-but-got-start-tag
2288+
#script-on
22192289
#document
22202290
| <html>
22212291
| <head>
@@ -2224,6 +2294,21 @@
22242294
| <body>
22252295
| "X"
22262296

2297+
#data
2298+
<noscript><iframe></noscript>X
2299+
#errors
2300+
* (1,11) missing DOCTYPE
2301+
* (1,19) unexpected token in head noscript
2302+
* (1,31) unexpected EOF
2303+
#script-off
2304+
#document
2305+
| <html>
2306+
| <head>
2307+
| <noscript>
2308+
| <body>
2309+
| <iframe>
2310+
| "</noscript>X"
2311+
22272312
#data
22282313
<noframes><!--<noframes></noframes>--></noframes>
22292314
#errors

tree-construction/tests5.dat

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,23 @@
188188
#errors
189189
(1,10): expected-doctype-but-got-start-tag
190190
(1,39): unexpected-end-tag
191+
#script-on
191192
#document
192193
| <html>
193194
| <head>
194195
| <noscript>
195196
| "<!--"
196197
| <body>
197198
| "-->"
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>

tree-construction/webkit02.dat

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<p id="status"><noscript><strong>A</strong></noscript><span>B</span></p>
1515
#errors
1616
(1,15): expected-doctype-but-got-start-tag
17+
#script-on
1718
#document
1819
| <html>
1920
| <head>
@@ -25,6 +26,23 @@
2526
| <span>
2627
| "B"
2728

29+
#data
30+
<p id="status"><noscript><strong>A</strong></noscript><span>B</span></p>
31+
#errors
32+
(1,15): expected-doctype-but-got-start-tag
33+
#script-off
34+
#document
35+
| <html>
36+
| <head>
37+
| <body>
38+
| <p>
39+
| id="status"
40+
| <noscript>
41+
| <strong>
42+
| "A"
43+
| <span>
44+
| "B"
45+
2846
#data
2947
<div><sarcasm><div></div></sarcasm></div>
3048
#errors

0 commit comments

Comments
 (0)