Bug 886390 part 3 - Import html5lib tests for fragment parsing with a foreign context node. r=jgraham.

This commit is contained in:
Henri Sivonen 2014-10-27 11:48:11 +02:00
Родитель c4548f78b5
Коммит 1cbb9537c5
5 изменённых файлов: 583 добавлений и 7 удалений

Просмотреть файл

@ -21,14 +21,27 @@ 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.
indicates the context element, followed by a newline (LF). If the string
of characters starts with "svg ", the context element is in the SVG
namespace and the substring after "svg " is the local name. If the
string of characters starts with "math ", the context element is in the
MathML namespace and the substring after "math " is the local name.
Otherwise, the context element is in the HTML namespace and the string
is the local name. 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
@ -53,6 +66,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

Просмотреть файл

@ -0,0 +1,550 @@
#data
<nobr>X
#errors
6: HTML start tag “nobr” in a foreign namespace context.
7: End of file seen and there were open elements.
6: Unclosed element “nobr”.
#document-fragment
svg path
#document
| <svg nobr>
| "X"
#data
<font color></font>X
#errors
12: HTML start tag “font” in a foreign namespace context.
#document-fragment
svg path
#document
| <svg font>
| color=""
| "X"
#data
<font></font>X
#errors
#document-fragment
svg path
#document
| <svg font>
| "X"
#data
<g></path>X
#errors
10: End tag “path” did not match the name of the current open element (“g”).
11: End of file seen and there were open elements.
3: Unclosed element “g”.
#document-fragment
svg path
#document
| <svg g>
| "X"
#data
</path>X
#errors
5: Stray end tag “path”.
#document-fragment
svg path
#document
| "X"
#data
</foreignObject>X
#errors
5: Stray end tag “foreignobject”.
#document-fragment
svg foreignObject
#document
| "X"
#data
</desc>X
#errors
5: Stray end tag “desc”.
#document-fragment
svg desc
#document
| "X"
#data
</title>X
#errors
5: Stray end tag “title”.
#document-fragment
svg title
#document
| "X"
#data
</svg>X
#errors
5: Stray end tag “svg”.
#document-fragment
svg svg
#document
| "X"
#data
</mfenced>X
#errors
5: Stray end tag “mfenced”.
#document-fragment
math mfenced
#document
| "X"
#data
</malignmark>X
#errors
5: Stray end tag “malignmark”.
#document-fragment
math malignmark
#document
| "X"
#data
</math>X
#errors
5: Stray end tag “math”.
#document-fragment
math math
#document
| "X"
#data
</annotation-xml>X
#errors
5: Stray end tag “annotation-xml”.
#document-fragment
math annotation-xml
#document
| "X"
#data
</mtext>X
#errors
5: Stray end tag “mtext”.
#document-fragment
math mtext
#document
| "X"
#data
</mi>X
#errors
5: Stray end tag “mi”.
#document-fragment
math mi
#document
| "X"
#data
</mo>X
#errors
5: Stray end tag “mo”.
#document-fragment
math mo
#document
| "X"
#data
</mn>X
#errors
5: Stray end tag “mn”.
#document-fragment
math mn
#document
| "X"
#data
</ms>X
#errors
5: Stray end tag “ms”.
#document-fragment
math ms
#document
| "X"
#data
<b></b><mglyph/><i></i><malignmark/><u></u><ms/>X
#errors
51: Self-closing syntax (“/>”) used on a non-void HTML element. Ignoring the slash and treating as a start tag.
52: End of file seen and there were open elements.
51: Unclosed element “ms”.
#document-fragment
math ms
#document
| <b>
| <math mglyph>
| <i>
| <math malignmark>
| <u>
| <ms>
| "X"
#data
<malignmark></malignmark>
#errors
#document-fragment
math ms
#document
| <math malignmark>
#data
<div></div>
#errors
#document-fragment
math ms
#document
| <div>
#data
<figure></figure>
#errors
#document-fragment
math ms
#document
| <figure>
#data
<b></b><mglyph/><i></i><malignmark/><u></u><mn/>X
#errors
51: Self-closing syntax (“/>”) used on a non-void HTML element. Ignoring the slash and treating as a start tag.
52: End of file seen and there were open elements.
51: Unclosed element “mn”.
#document-fragment
math mn
#document
| <b>
| <math mglyph>
| <i>
| <math malignmark>
| <u>
| <mn>
| "X"
#data
<malignmark></malignmark>
#errors
#document-fragment
math mn
#document
| <math malignmark>
#data
<div></div>
#errors
#document-fragment
math mn
#document
| <div>
#data
<figure></figure>
#errors
#document-fragment
math mn
#document
| <figure>
#data
<b></b><mglyph/><i></i><malignmark/><u></u><mo/>X
#errors
51: Self-closing syntax (“/>”) used on a non-void HTML element. Ignoring the slash and treating as a start tag.
52: End of file seen and there were open elements.
51: Unclosed element “mo”.
#document-fragment
math mo
#document
| <b>
| <math mglyph>
| <i>
| <math malignmark>
| <u>
| <mo>
| "X"
#data
<malignmark></malignmark>
#errors
#document-fragment
math mo
#document
| <math malignmark>
#data
<div></div>
#errors
#document-fragment
math mo
#document
| <div>
#data
<figure></figure>
#errors
#document-fragment
math mo
#document
| <figure>
#data
<b></b><mglyph/><i></i><malignmark/><u></u><mi/>X
#errors
51: Self-closing syntax (“/>”) used on a non-void HTML element. Ignoring the slash and treating as a start tag.
52: End of file seen and there were open elements.
51: Unclosed element “mi”.
#document-fragment
math mi
#document
| <b>
| <math mglyph>
| <i>
| <math malignmark>
| <u>
| <mi>
| "X"
#data
<malignmark></malignmark>
#errors
#document-fragment
math mi
#document
| <math malignmark>
#data
<div></div>
#errors
#document-fragment
math mi
#document
| <div>
#data
<figure></figure>
#errors
#document-fragment
math mi
#document
| <figure>
#data
<b></b><mglyph/><i></i><malignmark/><u></u><mtext/>X
#errors
51: Self-closing syntax (“/>”) used on a non-void HTML element. Ignoring the slash and treating as a start tag.
52: End of file seen and there were open elements.
51: Unclosed element “mtext”.
#document-fragment
math mtext
#document
| <b>
| <math mglyph>
| <i>
| <math malignmark>
| <u>
| <mtext>
| "X"
#data
<malignmark></malignmark>
#errors
#document-fragment
math mtext
#document
| <math malignmark>
#data
<div></div>
#errors
#document-fragment
math mtext
#document
| <div>
#data
<figure></figure>
#errors
#document-fragment
math mtext
#document
| <figure>
#data
<div></div>
#errors
5: HTML start tag “div” in a foreign namespace context.
#document-fragment
math annotation-xml
#document
| <math div>
#data
<figure></figure>
#errors
#document-fragment
math annotation-xml
#document
| <math figure>
#data
<div></div>
#errors
5: HTML start tag “div” in a foreign namespace context.
#document-fragment
math math
#document
| <math div>
#data
<figure></figure>
#errors
#document-fragment
math math
#document
| <math figure>
#data
<div></div>
#errors
#document-fragment
svg foreignObject
#document
| <div>
#data
<figure></figure>
#errors
#document-fragment
svg foreignObject
#document
| <figure>
#data
<div></div>
#errors
#document-fragment
svg title
#document
| <div>
#data
<figure></figure>
#errors
#document-fragment
svg title
#document
| <figure>
#data
<figure></figure>
#errors
#document-fragment
svg desc
#document
| <figure>
#data
<div><h1>X</h1></div>
#errors
5: HTML start tag “div” in a foreign namespace context.
9: HTML start tag “h1” in a foreign namespace context.
#document-fragment
svg svg
#document
| <svg div>
| <svg h1>
| "X"
#data
<div></div>
#errors
5: HTML start tag “div” in a foreign namespace context.
#document-fragment
svg svg
#document
| <svg div>
#data
<div></div>
#errors
#document-fragment
svg desc
#document
| <div>
#data
<figure></figure>
#errors
#document-fragment
svg desc
#document
| <figure>
#data
<plaintext><foo>
#errors
16: End of file seen and there were open elements.
11: Unclosed element “plaintext”.
#document-fragment
svg desc
#document
| <plaintext>
| "<foo>"
#data
<frameset>X
#errors
6: Stray start tag “frameset”.
#document-fragment
svg desc
#document
| "X"
#data
<head>X
#errors
6: Stray start tag “head”.
#document-fragment
svg desc
#document
| "X"
#data
<body>X
#errors
6: Stray start tag “body”.
#document-fragment
svg desc
#document
| "X"
#data
<html>X
#errors
6: Stray start tag “html”.
#document-fragment
svg desc
#document
| "X"
#data
<html class="foo">X
#errors
6: Stray start tag “html”.
#document-fragment
svg desc
#document
| "X"
#data
<body class="foo">X
#errors
6: Stray start tag “body”.
#document-fragment
svg desc
#document
| "X"

Просмотреть файл

@ -50,6 +50,7 @@ support-files =
html5lib_tree_construction/domjs-unsafe.dat
html5lib_tree_construction/entities01.dat
html5lib_tree_construction/entities02.dat
html5lib_tree_construction/foreign-fragment.dat
html5lib_tree_construction/html5test-com.dat
html5lib_tree_construction/inbody01.dat
html5lib_tree_construction/isindex.dat

Просмотреть файл

@ -76,8 +76,17 @@ function makeFragmentTestChecker(input,
fragment,
testframe) {
return function () {
var context = document.createElementNS("http://www.w3.org/1999/xhtml",
fragment);
var context;
if (fragment.startsWith("svg ")) {
context = document.createElementNS("http://www.w3.org/2000/svg",
fragment.substring(4));
} else if (fragment.startsWith("math ")) {
context = document.createElementNS("http://www.w3.org/1998/Math/MathML",
fragment.substring(5));
} else {
context = document.createElementNS("http://www.w3.org/1999/xhtml",
fragment);
}
context.innerHTML = input;
var domAsString = fragmentToTestOutput(context);
is(domAsString, expected, "HTML5 expected success. " + new Date());

Просмотреть файл

@ -39,6 +39,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=366936
"webkit01.dat",
"webkit02.dat",
"main-element.dat",
"foreign-fragment.dat",
"ruby.dat"];
</script>
<script type="application/javascript;version=1.7"