Skip to content

Commit

Permalink
Merge pull request #43 from html5lib/script-on-script-off
Browse files Browse the repository at this point in the history
update tests to support new #script-on #script-off format; r=gsnedders+Ms2ger
  • Loading branch information
Ms2ger committed Aug 14, 2014
2 parents b93f570 + 093674a commit e1f5573
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tree-construction/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,22 @@ final newline (on the last line) removed.
Then there must be a line that says "\#errors". It must be followed by
one line per parse error that a conformant checker would return. It
doesn't matter what those lines are, although they can't be
"\#document-fragment", "\#document", or empty, the only thing that
matters is that there be the right number of parse errors.
"\#document-fragment", "\#document", "\#script-off", "\#script-on", or
empty, the only thing that matters is that there be the right number
of parse errors.

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

Then there \*may\* be a line that says "\#script-off" or
"\#script-in". If a line that says "\#script-off" is present, the
parser must set the scripting flag to disabled. If a line that says
"\#script-on" is present, it must set it to enabled. Otherwise, the
test should be run in both modes.

Then there must be a line that says "\#document", which must be followed
by a dump of the tree of the parsed DOM. Each node must be represented
by a single line. Each line must start with "| ", followed by two spaces
Expand All @@ -53,6 +60,8 @@ per parent node that the node has before the root document node.
space, then the data and then "`>`". (The HTML parser cannot emit
processing instructions, but scripts can, and the WebVTT to DOM
rules can emit them.)
- Template contents are represented by the string "content" with the
children below it.

The *tag name string* is the local name prefixed by a namespace
designator. For the HTML namespace, the namespace designator is the
Expand Down
85 changes: 85 additions & 0 deletions tree-construction/tests16.dat
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,7 @@
<!doctype html><noscript><!--<noscript></noscript>--></noscript>
#errors
(1,64): unexpected-end-tag
#script-on
#document
| <!DOCTYPE html>
| <html>
Expand All @@ -1038,9 +1039,22 @@
| <body>
| "-->"

#data
<!doctype html><noscript><!--<noscript></noscript>--></noscript>
#errors
#script-off
#document
| <!DOCTYPE html>
| <html>
| <head>
| <noscript>
| <!-- <noscript></noscript> -->
| <body>

#data
<!doctype html><noscript><!--</noscript>X<noscript>--></noscript>
#errors
#script-on
#document
| <!DOCTYPE html>
| <html>
Expand All @@ -1052,9 +1066,22 @@
| <noscript>
| "-->"

#data
<!doctype html><noscript><!--</noscript>X<noscript>--></noscript>
#errors
#script-off
#document
| <!DOCTYPE html>
| <html>
| <head>
| <noscript>
| <!-- </noscript>X<noscript> -->
| <body>

#data
<!doctype html><noscript><iframe></noscript>X
#errors
#script-on
#document
| <!DOCTYPE html>
| <html>
Expand All @@ -1064,6 +1091,21 @@
| <body>
| "X"

#data
<!doctype html><noscript><iframe></noscript>X
#errors
* (1,34) unexpected token in head noscript
* (1,46) unexpected EOF
#script-off
#document
| <!DOCTYPE html>
| <html>
| <head>
| <noscript>
| <body>
| <iframe>
| "</noscript>X"

#data
<!doctype html><noframes><!--<noframes></noframes>--></noframes>
#errors
Expand Down Expand Up @@ -2190,6 +2232,7 @@
#errors
(1,10): expected-doctype-but-got-start-tag
(1,49): unexpected-end-tag
#script-on
#document
| <html>
| <head>
Expand All @@ -2198,10 +2241,23 @@
| <body>
| "-->"

#data
<noscript><!--<noscript></noscript>--></noscript>
#errors
* (1,11) missing DOCTYPE
#script-off
#document
| <html>
| <head>
| <noscript>
| <!-- <noscript></noscript> -->
| <body>

#data
<noscript><!--</noscript>X<noscript>--></noscript>
#errors
(1,10): expected-doctype-but-got-start-tag
#script-on
#document
| <html>
| <head>
Expand All @@ -2212,10 +2268,24 @@
| <noscript>
| "-->"


#data
<noscript><!--</noscript>X<noscript>--></noscript>
#errors
(1,10): expected-doctype-but-got-start-tag
#script-off
#document
| <html>
| <head>
| <noscript>
| <!-- </noscript>X<noscript> -->
| <body>

#data
<noscript><iframe></noscript>X
#errors
(1,10): expected-doctype-but-got-start-tag
#script-on
#document
| <html>
| <head>
Expand All @@ -2224,6 +2294,21 @@
| <body>
| "X"

#data
<noscript><iframe></noscript>X
#errors
* (1,11) missing DOCTYPE
* (1,19) unexpected token in head noscript
* (1,31) unexpected EOF
#script-off
#document
| <html>
| <head>
| <noscript>
| <body>
| <iframe>
| "</noscript>X"

#data
<noframes><!--<noframes></noframes>--></noframes>
#errors
Expand Down
13 changes: 13 additions & 0 deletions tree-construction/tests5.dat
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,23 @@
#errors
(1,10): expected-doctype-but-got-start-tag
(1,39): unexpected-end-tag
#script-on
#document
| <html>
| <head>
| <noscript>
| "<!--"
| <body>
| "-->"

#data
<noscript><!--</noscript>--></noscript>
#errors
(1,10): expected-doctype-but-got-start-tag
#script-off
#document
| <html>
| <head>
| <noscript>
| <!-- </noscript> -->
| <body>
18 changes: 18 additions & 0 deletions tree-construction/webkit02.dat
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<p id="status"><noscript><strong>A</strong></noscript><span>B</span></p>
#errors
(1,15): expected-doctype-but-got-start-tag
#script-on
#document
| <html>
| <head>
Expand All @@ -25,6 +26,23 @@
| <span>
| "B"

#data
<p id="status"><noscript><strong>A</strong></noscript><span>B</span></p>
#errors
(1,15): expected-doctype-but-got-start-tag
#script-off
#document
| <html>
| <head>
| <body>
| <p>
| id="status"
| <noscript>
| <strong>
| "A"
| <span>
| "B"

#data
<div><sarcasm><div></div></sarcasm></div>
#errors
Expand Down

0 comments on commit e1f5573

Please sign in to comment.