gecko/parser/htmlparser/tests/mochitest/html5lib_tree_construction
2014-01-31 15:03:24 -08:00
..
scripted Bug 939271 - Part h: move mochitests to manifests in parser/htmlparser; r=hsivonen 2013-11-28 15:03:18 +01:00
adoption01.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
adoption02.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
comments01.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
doctype01.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
domjs-unsafe.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
entities01.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
entities02.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
html5lib_license.txt
html5lib_upstream.txt
html5test-com.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
inbody01.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
isindex.dat Bug 946585 - Change how the form element pointer affects parsing template elements. r=hsivonen 2014-01-31 15:03:24 -08:00
main-element.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
pending-spec-changes-plain-text-unsafe.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
pending-spec-changes.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
plain-text-unsafe.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
README.md Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
scriptdata01.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tables01.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
template.dat Bug 946585 - Change how the form element pointer affects parsing template elements. r=hsivonen 2014-01-31 15:03:24 -08:00
tests1.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tests2.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tests3.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tests4.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tests5.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tests6.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tests7.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tests8.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tests9.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tests10.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tests11.dat
tests12.dat
tests14.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tests15.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tests16.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tests17.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tests18.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tests19.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tests20.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tests21.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tests22.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tests23.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tests24.dat
tests25.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
tests26.dat Bug 822776 - Update "after after frameset" insertion mode. r=hsivonen 2013-11-13 14:57:07 -08:00
tests_innerHTML_1.dat Bug 797009 - Remove bad assertion in HTML parser. r=hsivonen 2013-11-13 15:53:12 -08:00
tricky01.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
webkit01.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00
webkit02.dat Bug 936994 - Update html5lib-tests to latest version as of Oct 8, 2013. r=hsivonen 2013-11-10 22:02:21 -08:00

Tree Construction Tests

Each file containing tree construction tests consists of any number of tests separated by two newlines (LF) and a single newline before the end of the file. For instance:

[TEST]LF
LF
[TEST]LF
LF
[TEST]LF

Where [TEST] is the following format:

Each test must begin with a string "#data" followed by a newline (LF). All subsequent lines until a line that says "#errors" are the test data and must be passed to the system being tested unchanged, except with the 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.

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 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 per parent node that the node has before the root document node.

  • Element nodes must be represented by a "<" then the tag name string ">", and all the attributes must be given, sorted lexicographically by UTF-16 code unit according to their attribute name string, on subsequent lines, as if they were children of the element node.
  • Attribute nodes must have the attribute name string, then an "=" sign, then the attribute value in double quotes (").
  • Text nodes must be the string, in double quotes. Newlines aren't escaped.
  • Comments must be "<" then "!-- " then the data then " -->".
  • DOCTYPEs must be "<!DOCTYPE " then the name then if either of the system id or public id is non-empty a space, public id in double-quotes, another space an the system id in double-quotes, and then in any case ">".
  • Processing instructions must be "<?", then the target, then a 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.)

The tag name string is the local name prefixed by a namespace designator. For the HTML namespace, the namespace designator is the empty string, i.e. there's no prefix. For the SVG namespace, the namespace designator is "svg ". For the MathML namespace, the namespace designator is "math ".

The attribute name string is the local name prefixed by a namespace designator. For no namespace, the namespace designator is the empty string, i.e. there's no prefix. For the XLink namespace, the namespace designator is "xlink ". For the XML namespace, the namespace designator is "xml ". For the XMLNS namespace, the namespace designator is "xmlns ". Note the difference between "xlink:href" which is an attribute in no namespace with the local name "xlink:href" and "xlink href" which is an attribute in the xlink namespace with the local name "href".

If there is also a "#document-fragment" the bit following "#document" must be a representation of the HTML fragment serialization for the context element given by "#document-fragment".

For example:

#data
<p>One<p>Two
#errors
3: Missing document type declaration
#document
| <html>
|   <head>
|   <body>
|     <p>
|       "One"
|     <p>
|       "Two"