Backout rev 58f91861b1f1. Accidental changes included.
authorHenri Sivonen <hsivonen@iki.fi>
Thu, 13 Aug 2009 10:48:13 +0300
changeset 31419 63fbf79e947461937a9c87a0969ac60687fe1ea7
parent 31418 58f91861b1f15eda8ebc700f38dda791ea1741aa
child 31420 a7511af18bcea2eaebe6867bbfe8475f885ada73
child 31421 908834ee9c289a1a2f8151b0132598310bc5b6ce
push id1
push usersledru@mozilla.com
push dateThu, 04 Dec 2014 17:57:20 +0000
milestone1.9.2a2pre
Backout rev 58f91861b1f1. Accidental changes included.
parser/html/nsHtml5TreeOperation.cpp
parser/htmlparser/tests/mochitest/Makefile.in
parser/htmlparser/tests/mochitest/html5lib_tree_dat1.txt
parser/htmlparser/tests/mochitest/html5lib_tree_dat2.txt
parser/htmlparser/tests/mochitest/html5lib_tree_dat3.txt
parser/htmlparser/tests/mochitest/parser_datreader.js
parser/htmlparser/tests/mochitest/parser_web_testrunner.js
parser/htmlparser/tests/mochitest/regressions.txt
parser/htmlparser/tests/mochitest/test_html5_tree_construction.html
--- a/parser/html/nsHtml5TreeOperation.cpp
+++ b/parser/html/nsHtml5TreeOperation.cpp
@@ -34,24 +34,19 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsHtml5TreeOperation.h"
-#include "nsContentUtils.h"
 #include "nsNodeUtils.h"
 #include "nsAttrName.h"
 #include "nsHtml5TreeBuilder.h"
-#include "nsIDOMMutationEvent.h"
-#include "mozAutoDocUpdate.h"
-#include "nsBindingManager.h"
-#include "nsXBLBinding.h"
 
 nsHtml5TreeOperation::nsHtml5TreeOperation()
  : mOpCode(eTreeOpAppend)
 {
   MOZ_COUNT_CTOR(nsHtml5TreeOperation);
 }
 
 nsHtml5TreeOperation::~nsHtml5TreeOperation()
@@ -117,58 +112,26 @@ nsHtml5TreeOperation::Perform(nsHtml5Tre
       PRUint32 childCount = doc->GetChildCount();
       rv = doc->AppendChildTo(mNode, PR_FALSE);
       NS_ENSURE_SUCCESS(rv, rv);
       nsNodeUtils::ContentInserted(doc, mNode, childCount);
       return rv;
     }
     case eTreeOpAddAttributes: {
       // mNode holds the new attributes and mParent is the target
-      nsIDocument* document = mParent->GetCurrentDoc();
-      
       PRUint32 len = mNode->GetAttrCount();
       for (PRUint32 i = 0; i < len; ++i) {
         const nsAttrName* attrName = mNode->GetAttrNameAt(i);
         nsIAtom* localName = attrName->LocalName();
         PRInt32 nsuri = attrName->NamespaceID();
         if (!mParent->HasAttr(nsuri, localName)) {
           nsAutoString value;
           mNode->GetAttr(nsuri, localName, value);
-          
-          // the manual notification code is based on nsGenericElement
-          
-          PRUint32 stateMask = PRUint32(mParent->IntrinsicState());
-          nsNodeUtils::AttributeWillChange(mParent, 
-                                           nsuri,
-                                           localName,
-                                           static_cast<PRUint8>(nsIDOMMutationEvent::ADDITION));
-          
-          mParent->SetAttr(nsuri, localName, attrName->GetPrefix(), value, PR_FALSE);
-          
-          if (document || mParent->HasFlag(NODE_FORCE_XBL_BINDINGS)) {
-            nsIDocument* ownerDoc = mParent->GetOwnerDoc();
-            if (ownerDoc) {
-              nsRefPtr<nsXBLBinding> binding =
-                ownerDoc->BindingManager()->GetBinding(mParent);
-              if (binding) {
-                binding->AttributeChanged(localName, nsuri, PR_FALSE, PR_FALSE);
-              }
-            }
-          }
-          
-          stateMask = stateMask ^ PRUint32(mParent->IntrinsicState());
-          if (stateMask && document) {
-            MOZ_AUTO_DOC_UPDATE(document, UPDATE_CONTENT_STATE, PR_TRUE);
-            document->ContentStatesChanged(mParent, nsnull, stateMask);
-          }
-          nsNodeUtils::AttributeChanged(mParent, 
-                                        nsuri, 
-                                        localName, 
-                                        static_cast<PRUint8>(nsIDOMMutationEvent::ADDITION),
-                                        stateMask);
+          mParent->SetAttr(nsuri, localName, attrName->GetPrefix(), value, PR_TRUE);
+          // XXX should not fire mutation event here
         }
       }
       return rv;
     }
     case eTreeOpDoneAddingChildren: {
       mNode->DoneAddingChildren(PR_FALSE);
       return rv;
     }
--- a/parser/htmlparser/tests/mochitest/Makefile.in
+++ b/parser/htmlparser/tests/mochitest/Makefile.in
@@ -41,49 +41,21 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = parser/htmlparser/tests/mochitest
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _TEST_FILES =	parser_datreader.js \
 		parser_web_testrunner.js \
-		tokenizer_file_server.sjs \
-		html5lib_tokenizer_entities.test \
-		html5lib_tokenizer_numeric_entities.test \
-		html5lib_tokenizer_unicode_chars.test \
-		html5lib_tokenizer_test1.test \
-		html5lib_tokenizer_test2.test \
-		html5lib_tokenizer_test3.test \
-		html5lib_tokenizer_test4.test \
-		html5lib_tokenizer_test5.test \
 		html5lib_tree_dat1.txt \
 		html5lib_tree_dat2.txt \
 		html5lib_tree_dat3.txt \
-		html5lib_tree_dat5.txt \
-		html5lib_tree_dat6.txt \
-		html5lib_tree_dat7.txt \
-		html5lib_tree_dat8.txt \
-		html5lib_tree_dat9.txt \
-		html5lib_tree_dat10.txt \
-		html5lib_tree_dat11.txt \
-		html5lib_tree_dat12.txt \
-		html5lib_tree_dat14.txt \
 		html5_tree_construction_exceptions.js \
-		nu.validator.htmlparser.HtmlParser.nocache.js \
-		test_html5_tokenizer_entities.html \
-		test_html5_tokenizer_numeric_entities.html \
-		test_html5_tokenizer_test1.html \
-		test_html5_tokenizer_test2.html \
-		test_html5_tokenizer_test3.html \
-		test_html5_tokenizer_test4.html \
-		test_html5_tokenizer_test5.html \
-		test_html5_tokenizer_unicode_chars.html \
 		test_html5_tree_construction.html \
-		test_html5_tree_construction_js_compare.html \
 		test_bug174351.html \
 	 	test_bug339350.xhtml \
 		test_bug358797.html \
 		test_bug396568.html \
 		test_bug418464.html \
 		test_bug460437.xhtml \
 		test_bug502091.html \
 		bug_502091_iframe.html \
--- a/parser/htmlparser/tests/mochitest/html5lib_tree_dat1.txt
+++ b/parser/htmlparser/tests/mochitest/html5lib_tree_dat1.txt
@@ -1,377 +1,367 @@
 #data
 Test
 #errors
-Line: 1 Col: 4 Unexpected non-space characters. Expected DOCTYPE.
+5: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 |     "Test"
 
 #data
 <p>One<p>Two
 #errors
-Line: 1 Col: 3 Unexpected start tag (p). Expected DOCTYPE.
+3: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 |     <p>
 |       "One"
 |     <p>
 |       "Two"
 
 #data
 Line1<br>Line2<br>Line3<br>Line4
 #errors
-Line: 1 Col: 5 Unexpected non-space characters. Expected DOCTYPE.
+7: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 |     "Line1"
 |     <br>
 |     "Line2"
 |     <br>
 |     "Line3"
 |     <br>
 |     "Line4"
 
 #data
 <html>
 #errors
-Line: 1 Col: 6 Unexpected start tag (html). Expected DOCTYPE.
+6: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 
 #data
 <head>
 #errors
-Line: 1 Col: 6 Unexpected start tag (head). Expected DOCTYPE.
+6: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 
 #data
 <body>
 #errors
-Line: 1 Col: 6 Unexpected start tag (body). Expected DOCTYPE.
+6: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 
 #data
 <html><head>
 #errors
-Line: 1 Col: 6 Unexpected start tag (html). Expected DOCTYPE.
+6: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 
 #data
 <html><head></head>
 #errors
-Line: 1 Col: 6 Unexpected start tag (html). Expected DOCTYPE.
+6: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 
 #data
 <html><head></head><body>
 #errors
-Line: 1 Col: 6 Unexpected start tag (html). Expected DOCTYPE.
+6: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 
 #data
 <html><head></head><body></body>
 #errors
-Line: 1 Col: 6 Unexpected start tag (html). Expected DOCTYPE.
+6: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 
 #data
 <html><head><body></body></html>
 #errors
-Line: 1 Col: 6 Unexpected start tag (html). Expected DOCTYPE.
+6: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 
 #data
 <html><head></body></html>
 #errors
-Line: 1 Col: 6 Unexpected start tag (html). Expected DOCTYPE.
-Line: 1 Col: 19 Unexpected end tag (body).
-Line: 1 Col: 26 Unexpected end tag (html).
+6: missing document type declaration
+19: unexpected body element end tag in head
 #document
 | <html>
 |   <head>
 |   <body>
 
 #data
 <html><head><body></html>
 #errors
-Line: 1 Col: 6 Unexpected start tag (html). Expected DOCTYPE.
+6: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 
 #data
 <html><body></html>
 #errors
-Line: 1 Col: 6 Unexpected start tag (html). Expected DOCTYPE.
+6: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 
 #data
 <body></html>
 #errors
-Line: 1 Col: 6 Unexpected start tag (body). Expected DOCTYPE.
+6: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 
 #data
 <head></html>
 #errors
-Line: 1 Col: 6 Unexpected start tag (head). Expected DOCTYPE.
-Line: 1 Col: 13 Unexpected end tag (html). Ignored.
+6: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 
 #data
 </head>
 #errors
-Line: 1 Col: 7 Unexpected end tag (head). Expected DOCTYPE.
+7: missing document type declaration
+7: unexpected head element end tag
 #document
 | <html>
 |   <head>
 |   <body>
 
 #data
 </body>
 #errors
-Line: 1 Col: 7 Unexpected end tag (body). Expected DOCTYPE.
-Line: 1 Col: 7 Unexpected end tag (body) after the (implied) root element.
+7: missing document type declaration
+7: unexpected body element end tag
 #document
 | <html>
 |   <head>
 |   <body>
 
 #data
 </html>
 #errors
-Line: 1 Col: 7 Unexpected end tag (html). Expected DOCTYPE.
-Line: 1 Col: 7 Unexpected end tag (html) after the (implied) root element.
+7: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 
 #data
 <b><table><td><i></table>
 #errors
-Line: 1 Col: 3 Unexpected start tag (b). Expected DOCTYPE.
-Line: 1 Col: 14 Unexpected table cell start tag (td) in the table body phase.
-Line: 1 Col: 25 Got table cell end tag (td) while required end tags are missing.
-Line: 1 Col: 25 Expected closing tag. Unexpected end of file.
+3: missing document type declaration
+14: required tr element start tag implied by unexpected td element start tag
+25: unexpected td element end tag implied other end tags
+26: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <b>
 |       <table>
 |         <tbody>
 |           <tr>
 |             <td>
 |               <i>
 
 #data
 <b><table><td></b><i></table>X
 #errors
-Line: 1 Col: 3 Unexpected start tag (b). Expected DOCTYPE.
-Line: 1 Col: 14 Unexpected table cell start tag (td) in the table body phase.
-Line: 1 Col: 18 End tag (b) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 29 Got table cell end tag (td) while required end tags are missing.
-Line: 1 Col: 30 Expected closing tag. Unexpected end of file.
+3: missing document type declaration
+14: required tr element start tag implied by unexpected td element start tag
+18: mismatched b element end tag (no matching start tag)
+29: unexpected td element end tag implied other end tags
+31: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <b>
 |       <table>
 |         <tbody>
 |           <tr>
 |             <td>
 |               <i>
 |       "X"
 
 #data
 <h1>Hello<h2>World
 #errors
-4: Start tag seen without seeing a doctype first. Expected “<!DOCTYPE html>”.
-13: Heading cannot be a child of another heading.
-18: End of file seen and there were open elements.
+4: missing document type declaration
+13: h2 element start tag implying h1 element end tag
+19: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <h1>
 |       "Hello"
 |     <h2>
 |       "World"
 
 #data
 <a><p>X<a>Y</a>Z</p></a>
 #errors
-Line: 1 Col: 3 Unexpected start tag (a). Expected DOCTYPE.
-Line: 1 Col: 10 Unexpected start tag (a) implies end tag (a).
-Line: 1 Col: 10 End tag (a) violates step 1, paragraph 3 of the adoption agency algorithm.
-Line: 1 Col: 24 End tag (a) violates step 1, paragraph 1 of the adoption agency algorithm.
+3: missing document type declaration
+10: a element start tag implying a element end tag
+10: mismatched a element end tag (misnested tags)
+24: mismatched a element end tag (no matching start tag)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <a>
 |     <p>
 |       <a>
 |         "X"
 |       <a>
 |         "Y"
 |       "Z"
 
 #data
 <b><button></b></button></b>
 #errors
-Line: 1 Col: 3 Unexpected start tag (b). Expected DOCTYPE.
-Line: 1 Col: 15 End tag (b) violates step 1, paragraph 1 of the adoption agency algorithm.
+3: missing document type declaration
+15: mismatched b element end tag (no matching start tag)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <b>
 |       <button>
 
 #data
 <p><b><div><marquee></p></b></div>X
 #errors
-Line: 1 Col: 3 Unexpected start tag (p). Expected DOCTYPE.
-Line: 1 Col: 11 Unexpected end tag (p). Ignored.
-Line: 1 Col: 24 Unexpected end tag (p). Ignored.
-Line: 1 Col: 28 End tag (b) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 34 End tag (div) seen too early. Expected other end tag.
-Line: 1 Col: 35 Expected closing tag. Unexpected end of file.
+3: missing document type declaration
+11: mismatched p element end tag
+24: mismatched p element end tag
+28: mismatched b element end tag (no matching start tag)
+34: mismatched div element end tag
+36: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <p>
 |       <b>
 |     <div>
 |       <b>
 |         <marquee>
-|           <p>
 |           "X"
 
 #data
 <script><div></script></div><title><p></title><p><p>
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 28 Unexpected end tag (div). Ignored.
+8: missing document type declaration
+28: unexpected div element end tag in head
 #document
 | <html>
 |   <head>
 |     <script>
 |       "<div>"
 |     <title>
 |       "<p>"
 |   <body>
 |     <p>
 |     <p>
 
 #data
 <!--><div>--<!-->
 #errors
-Line: 1 Col: 5 Incorrect comment.
-Line: 1 Col: 10 Unexpected start tag (div). Expected DOCTYPE.
-Line: 1 Col: 17 Incorrect comment.
-Line: 1 Col: 17 Expected closing tag. Unexpected end of file.
+13: unexpected character after two '-' characters while parsing comment
+18: missing document type declaration
 #document
-| <!--  -->
+| <!-- ><div>--<! -->
 | <html>
 |   <head>
 |   <body>
-|     <div>
-|       "--"
-|       <!--  -->
 
 #data
 <p><hr></p>
 #errors
-Line: 1 Col: 3 Unexpected start tag (p). Expected DOCTYPE.
-Line: 1 Col: 11 Unexpected end tag (p). Ignored.
+3: missing document type declaration
+11: mismatched p element end tag
 #document
 | <html>
 |   <head>
 |   <body>
 |     <p>
 |     <hr>
-|     <p>
 
 #data
 <select><b><option><select><option></b></select>X
 #errors
-Line: 1 Col: 8 Unexpected start tag (select). Expected DOCTYPE.
-Line: 1 Col: 11 Unexpected start tag token (b) in the select phase. Ignored.
-Line: 1 Col: 27 Unexpected select start tag in the select phase treated as select end tag.
-Line: 1 Col: 39 End tag (b) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 48 Unexpected end tag (select). Ignored.
-Line: 1 Col: 49 Expected closing tag. Unexpected end of file.
+8: missing document type declaration
+11: unexpected node in select element context
+27: select element start tag used as end tag
+35: unexpected option element start tag in body
+39: mismatched b element end tag (no matching start tag)
+48: mismatched special end tag select
 #document
 | <html>
 |   <head>
 |   <body>
 |     <select>
 |       <option>
-|     <option>
-|       "X"
+|     "X"
 
 #data
 <a><table><td><a><table></table><a></tr><a></table><b>X</b>C<a>Y
 #errors
-Line: 1 Col: 3 Unexpected start tag (a). Expected DOCTYPE.
-Line: 1 Col: 14 Unexpected table cell start tag (td) in the table body phase.
-Line: 1 Col: 35 Unexpected start tag (a) implies end tag (a).
-Line: 1 Col: 40 Got table cell end tag (td) while required end tags are missing.
-Line: 1 Col: 43 Unexpected start tag (a) in table context caused voodoo mode.
-Line: 1 Col: 43 Unexpected start tag (a) implies end tag (a).
-Line: 1 Col: 43 End tag (a) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 51 Unexpected implied end tag (a) in the table phase.
-Line: 1 Col: 63 Unexpected start tag (a) implies end tag (a).
-Line: 1 Col: 64 Expected closing tag. Unexpected end of file.
+3: missing document type declaration
+14: required tr element start tag implied by unexpected td element start tag
+35: a element start tag implying a element end tag
+40: unexpected td element end tag implied other end tags
+43: unexpected node in table context
+43: a element start tag implying a element end tag
+43: unexpected node in table context
+43: mismatched a element end tag (misnested tags across <table> tag)
+63: a element start tag implying a element end tag
+65: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <a>
 |       <a>
 |       <table>
 |         <tbody>
@@ -385,20 +375,20 @@ Line: 1 Col: 64 Expected closing tag. Un
 |         "X"
 |       "C"
 |     <a>
 |       "Y"
 
 #data
 <a X>0<b>1<a Y>2
 #errors
-Line: 1 Col: 5 Unexpected start tag (a). Expected DOCTYPE.
-Line: 1 Col: 15 Unexpected start tag (a) implies end tag (a).
-Line: 1 Col: 15 End tag (a) violates step 1, paragraph 3 of the adoption agency algorithm.
-Line: 1 Col: 16 Expected closing tag. Unexpected end of file.
+5: missing document type declaration
+15: a element start tag implying a element end tag
+15: mismatched a element end tag (misnested tags)
+17: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <a>
 |       x=""
 |       "0"
 |       <b>
@@ -406,24 +396,25 @@ Line: 1 Col: 16 Expected closing tag. Un
 |     <b>
 |       <a>
 |         y=""
 |         "2"
 
 #data
 <!-----><font><div>hello<table>excite!<b>me!<th><i>please!</tr><!--X-->
 #errors
-Line: 1 Col: 7 Unexpected '-' after '--' found in comment.
-Line: 1 Col: 14 Unexpected start tag (font). Expected DOCTYPE.
-Line: 1 Col: 38 Unexpected non-space characters in table context caused voodoo mode.
-Line: 1 Col: 41 Unexpected start tag (b) in table context caused voodoo mode.
-Line: 1 Col: 48 Unexpected implied end tag (b) in the table phase.
-Line: 1 Col: 48 Unexpected table cell start tag (th) in the table body phase.
-Line: 1 Col: 63 Got table cell end tag (th) while required end tags are missing.
-Line: 1 Col: 71 Unexpected end of file. Expected table content.
+7: unexpected '-' character after two '-' characters while parsing comment
+14: missing document type declaration
+40: unexpected node in table context
+41: unexpected node in table context
+46: unexpected node in table context
+48: required tr element start tag implied by unexpected th element start tag
+63: unexpected th element end tag implied other end tags
+72: unexpected end of file implied table element end tag
+72: mismatched body element end tag (premature end of file?)
 #document
 | <!-- - -->
 | <html>
 |   <head>
 |   <body>
 |     <font>
 |       <div>
 |         "helloexcite!"
@@ -433,552 +424,548 @@ Line: 1 Col: 71 Unexpected end of file. 
 |           <tbody>
 |             <tr>
 |               <th>
 |                 <i>
 |                   "please!"
 |             <!-- X -->
 
 #data
-<!DOCTYPE html><li>hello<li>world<ul>how<li>do</ul>you</body><!--do-->
+<!DOCTYPE HTML><li>hello<li>world<ul>how<li>do</ul>you</body><!--do-->
 #errors
-Line: 1 Col: 61 Unexpected end tag (li). Missing end tag (body).
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <li>
 |       "hello"
 |     <li>
 |       "world"
 |       <ul>
 |         "how"
 |         <li>
 |           "do"
 |       "you"
 |   <!-- do -->
 
 #data
-<!DOCTYPE html>A<option>B<optgroup>C<select>D</option>E
+<!DOCTYPE HTML>A<option>B<optgroup>C<select>D</option>E
 #errors
-Line: 1 Col: 54 Unexpected end tag (option) in the select phase. Ignored.
-Line: 1 Col: 55 Expected closing tag. Unexpected end of file.
+24: unexpected option element start tag in body
+35: unexpected optgroup element start tag in body
+54: unexpected option element end tag
+56: required select element end tag implied by unexpected end of file
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
-|     "A"
-|     <option>
-|       "B"
-|     <optgroup>
-|       "C"
-|       <select>
-|         "DE"
+|     "ABC"
+|     <select>
+|       "DE"
 
 #data
 <
 #errors
-Line: 1 Col: 1 Expected tag name. Got something else instead
-Line: 1 Col: 1 Unexpected non-space characters. Expected DOCTYPE.
+2: unescaped '<' character
+2: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 |     "<"
 
 #data
 <#
 #errors
-Line: 1 Col: 1 Expected tag name. Got something else instead
-Line: 1 Col: 1 Unexpected non-space characters. Expected DOCTYPE.
+2: unescaped '<' character
+3: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 |     "<#"
 
 #data
 </
 #errors
-Line: 1 Col: 2 Expected closing tag. Unexpected end of file.
-Line: 1 Col: 2 Unexpected non-space characters. Expected DOCTYPE.
+3: unescaped '<' character followed by '/' at EOF
+3: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 |     "</"
 
 #data
 </#
 #errors
-Line: 1 Col: 2 Expected closing tag. Unexpected character '#' found.
-Line: 1 Col: 3 Unexpected End of file. Expected DOCTYPE.
+3: unescaped '<' character followed by '/'
+4: missing document type declaration
 #document
 | <!-- # -->
 | <html>
 |   <head>
 |   <body>
 
 #data
 <?
 #errors
-Line: 1 Col: 1 Expected tag name. Got '?' instead. (HTML doesn't support processing instructions.)
-Line: 1 Col: 2 Unexpected End of file. Expected DOCTYPE.
+2: PIs are not supported in HTML5
+3: missing document type declaration
 #document
 | <!-- ? -->
 | <html>
 |   <head>
 |   <body>
 
 #data
 <?#
 #errors
-Line: 1 Col: 1 Expected tag name. Got '?' instead. (HTML doesn't support processing instructions.)
-Line: 1 Col: 3 Unexpected End of file. Expected DOCTYPE.
+2: PIs are not supported in HTML5
+4: missing document type declaration
 #document
 | <!-- ?# -->
 | <html>
 |   <head>
 |   <body>
 
 #data
 <!
 #errors
-Line: 1 Col: 2 Expected '--' or 'DOCTYPE'. Not found.
-Line: 1 Col: 2 Unexpected End of file. Expected DOCTYPE.
+3: markup declarations are not supported in HTML5
+3: missing document type declaration
 #document
 | <!--  -->
 | <html>
 |   <head>
 |   <body>
 
 #data
 <!#
 #errors
-Line: 1 Col: 3 Expected '--' or 'DOCTYPE'. Not found.
-Line: 1 Col: 3 Unexpected End of file. Expected DOCTYPE.
+3: markup declarations are not supported in HTML5
+4: missing document type declaration
 #document
 | <!-- # -->
 | <html>
 |   <head>
 |   <body>
 
 #data
 <?COMMENT?>
 #errors
-Line: 1 Col: 1 Expected tag name. Got '?' instead. (HTML doesn't support processing instructions.)
-Line: 1 Col: 11 Unexpected End of file. Expected DOCTYPE.
+2: PIs are not supported in HTML5
+12: missing document type declaration
 #document
 | <!-- ?COMMENT? -->
 | <html>
 |   <head>
 |   <body>
 
 #data
 <!COMMENT>
 #errors
-Line: 1 Col: 2 Expected '--' or 'DOCTYPE'. Not found.
-Line: 1 Col: 10 Unexpected End of file. Expected DOCTYPE.
+3: markup declarations are not supported in HTML5
+11: missing document type declaration
 #document
 | <!-- COMMENT -->
 | <html>
 |   <head>
 |   <body>
 
 #data
 </ COMMENT >
 #errors
-Line: 1 Col: 2 Expected closing tag. Unexpected character ' ' found.
-Line: 1 Col: 12 Unexpected End of file. Expected DOCTYPE.
+3: unescaped '<' character followed by '/'
+13: missing document type declaration
 #document
 | <!--  COMMENT  -->
 | <html>
 |   <head>
 |   <body>
 
 #data
 <?COM--MENT?>
 #errors
-Line: 1 Col: 1 Expected tag name. Got '?' instead. (HTML doesn't support processing instructions.)
-Line: 1 Col: 13 Unexpected End of file. Expected DOCTYPE.
+2: PIs are not supported in HTML5
+14: missing document type declaration
 #document
 | <!-- ?COM--MENT? -->
 | <html>
 |   <head>
 |   <body>
 
 #data
 <!COM--MENT>
 #errors
-Line: 1 Col: 2 Expected '--' or 'DOCTYPE'. Not found.
-Line: 1 Col: 12 Unexpected End of file. Expected DOCTYPE.
+3: markup declarations are not supported in HTML5
+13: missing document type declaration
 #document
 | <!-- COM--MENT -->
 | <html>
 |   <head>
 |   <body>
 
 #data
 </ COM--MENT >
 #errors
-Line: 1 Col: 2 Expected closing tag. Unexpected character ' ' found.
-Line: 1 Col: 14 Unexpected End of file. Expected DOCTYPE.
+3: unescaped '<' character followed by '/'
+15: missing document type declaration
 #document
 | <!--  COM--MENT  -->
 | <html>
 |   <head>
 |   <body>
 
 #data
-<!DOCTYPE html><style> EOF
+<!DOCTYPE HTML><style> EOF
 #errors
-Line: 1 Col: 26 Unexpected end of file. Expected end tag (style).
+27: unexpected end of file while parsing CDATA section for element style
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |     <style>
 |       " EOF"
 |   <body>
 
 #data
-<!DOCTYPE html><script> <!-- </script> --> </script> EOF
+<!DOCTYPE HTML><script> <!-- </script> --> </script> EOF
 #errors
+52: unexpected script element end tag
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |     <script>
-|       " <!-- </script> --> "
+|       " <!-- "
 |     " "
 |   <body>
-|     "EOF"
+|     "-->  EOF"
 
 #data
 <b><p></b>TEST
 #errors
-Line: 1 Col: 3 Unexpected start tag (b). Expected DOCTYPE.
-Line: 1 Col: 10 End tag (b) violates step 1, paragraph 3 of the adoption agency algorithm.
+3: missing document type declaration
+10: mismatched b element end tag (misnested tags)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <b>
 |     <p>
 |       <b>
 |       "TEST"
 
 #data
 <p id=a><b><p id=b></b>TEST
 #errors
-Line: 1 Col: 8 Unexpected start tag (p). Expected DOCTYPE.
-Line: 1 Col: 19 Unexpected end tag (p). Ignored.
-Line: 1 Col: 23 End tag (b) violates step 1, paragraph 2 of the adoption agency algorithm.
+8: missing document type declaration
+19: mismatched p element end tag
+23: mismatched b element end tag (out-of-order end tags)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <p>
 |       id="a"
 |       <b>
 |     <p>
 |       id="b"
 |       "TEST"
 
 #data
 <b id=a><p><b id=b></p></b>TEST
 #errors
-Line: 1 Col: 8 Unexpected start tag (b). Expected DOCTYPE.
-Line: 1 Col: 23 Unexpected end tag (p). Ignored.
-Line: 1 Col: 27 End tag (b) violates step 1, paragraph 2 of the adoption agency algorithm.
-Line: 1 Col: 31 Expected closing tag. Unexpected end of file.
+8: missing document type declaration
+23: mismatched p element end tag
+27: mismatched b element end tag (out-of-order end tags)
+32: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <b>
 |       id="a"
 |       <p>
 |         <b>
 |           id="b"
 |       "TEST"
 
 #data
-<!DOCTYPE html><title>U-test</title><body><div><p>Test<u></p></div></body>
+<!DOCTYPE HTML><title>U-test</title><body><div><p>Test<u></p></div></body>
 #errors
-Line: 1 Col: 61 Unexpected end tag (p). Ignored.
+61: mismatched p element end tag
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |     <title>
 |       "U-test"
 |   <body>
 |     <div>
 |       <p>
 |         "Test"
 |         <u>
 
 #data
-<!DOCTYPE html><font><table></font></table></font>
+<!DOCTYPE HTML><font><table></font></table></font>
 #errors
-Line: 1 Col: 35 Unexpected end tag (font) in table context caused voodoo mode.
-Line: 1 Col: 35 End tag (font) violates step 1, paragraph 1 of the adoption agency algorithm.
+35: unexpected node in table context
+35: mismatched font element end tag (misnested tags across <table> tag)
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <font>
 |       <table>
 
 #data
 <font><p>hello<b>cruel</font>world
 #errors
-Line: 1 Col: 6 Unexpected start tag (font). Expected DOCTYPE.
-Line: 1 Col: 29 End tag (font) violates step 1, paragraph 3 of the adoption agency algorithm.
-Line: 1 Col: 29 End tag (font) violates step 1, paragraph 3 of the adoption agency algorithm.
-Line: 1 Col: 34 Expected closing tag. Unexpected end of file.
+6: missing document type declaration
+29: mismatched font element end tag (misnested tags)
+35: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <font>
 |     <p>
 |       <font>
 |         "hello"
 |         <b>
 |           "cruel"
 |       <b>
 |         "world"
 
 #data
 <b>Test</i>Test
 #errors
-Line: 1 Col: 3 Unexpected start tag (b). Expected DOCTYPE.
-Line: 1 Col: 11 End tag (i) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 15 Expected closing tag. Unexpected end of file.
+3: missing document type declaration
+11: mismatched i element end tag (no matching start tag)
+16: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <b>
 |       "TestTest"
 
 #data
 <b>A<cite>B<div>C
 #errors
-Line: 1 Col: 3 Unexpected start tag (b). Expected DOCTYPE.
-Line: 1 Col: 17 Expected closing tag. Unexpected end of file.
+3: missing document type declaration
+18: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <b>
 |       "A"
 |       <cite>
 |         "B"
 |         <div>
 |           "C"
 
 #data
 <b>A<cite>B<div>C</cite>D
 #errors
-Line: 1 Col: 3 Unexpected start tag (b). Expected DOCTYPE.
-Line: 1 Col: 24 Unexpected end tag (cite). Ignored.
-Line: 1 Col: 25 Expected closing tag. Unexpected end of file.
+3: missing document type declaration
+24: unexpected cite element end tag
+26: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <b>
 |       "A"
 |       <cite>
 |         "B"
 |         <div>
 |           "CD"
 
 #data
 <b>A<cite>B<div>C</b>D
 #errors
-Line: 1 Col: 3 Unexpected start tag (b). Expected DOCTYPE.
-Line: 1 Col: 21 End tag (b) violates step 1, paragraph 3 of the adoption agency algorithm.
-Line: 1 Col: 22 Expected closing tag. Unexpected end of file.
+3: missing document type declaration
+21: mismatched b element end tag (misnested tags)
+23: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <b>
 |       "A"
 |       <cite>
 |         "B"
 |     <div>
 |       <b>
 |         "C"
 |       "D"
 
 #data
 <cite><b><cite><i><cite><i><cite><i><div>X</b>TEST
 #errors
-Line: 1 Col: 6 Unexpected start tag (cite). Expected DOCTYPE.
-Line: 1 Col: 46 End tag (b) violates step 1, paragraph 3 of the adoption agency algorithm.
-Line: 1 Col: 50 Expected closing tag. Unexpected end of file.
+6: missing document type declaration
+46: mismatched b element end tag (misnested tags)
+51: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <cite>
 |       <b>
 |         <cite>
 |           <i>
 |             <cite>
 |               <i>
 |                 <cite>
-|                   <i>
 |       <i>
 |         <i>
 |           <i>
 |             <div>
 |               <b>
 |                 "X"
 |               "TEST"
 
 #data
 
 #errors
-Line: 1 Col: 0 Unexpected End of file. Expected DOCTYPE.
+1: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 
 #data
 <DIV>
 #errors
-Line: 1 Col: 5 Unexpected start tag (div). Expected DOCTYPE.
-Line: 1 Col: 5 Expected closing tag. Unexpected end of file.
+5: missing document type declaration
+6: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <div>
 
 #data
 <DIV> abc
 #errors
-Line: 1 Col: 5 Unexpected start tag (div). Expected DOCTYPE.
-Line: 1 Col: 9 Expected closing tag. Unexpected end of file.
+5: missing document type declaration
+10: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <div>
 |       " abc"
 
 #data
 <DIV> abc <B>
 #errors
-Line: 1 Col: 5 Unexpected start tag (div). Expected DOCTYPE.
-Line: 1 Col: 13 Expected closing tag. Unexpected end of file.
+5: missing document type declaration
+14: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <div>
 |       " abc "
 |       <b>
 
 #data
 <DIV> abc <B> def
 #errors
-Line: 1 Col: 5 Unexpected start tag (div). Expected DOCTYPE.
-Line: 1 Col: 17 Expected closing tag. Unexpected end of file.
+5: missing document type declaration
+18: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <div>
 |       " abc "
 |       <b>
 |         " def"
 
 #data
 <DIV> abc <B> def <I>
 #errors
-Line: 1 Col: 5 Unexpected start tag (div). Expected DOCTYPE.
-Line: 1 Col: 21 Expected closing tag. Unexpected end of file.
+5: missing document type declaration
+22: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <div>
 |       " abc "
 |       <b>
 |         " def "
 |         <i>
 
 #data
 <DIV> abc <B> def <I> ghi
 #errors
-Line: 1 Col: 5 Unexpected start tag (div). Expected DOCTYPE.
-Line: 1 Col: 25 Expected closing tag. Unexpected end of file.
+5: missing document type declaration
+26: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <div>
 |       " abc "
 |       <b>
 |         " def "
 |         <i>
 |           " ghi"
 
 #data
 <DIV> abc <B> def <I> ghi <P>
 #errors
-Line: 1 Col: 5 Unexpected start tag (div). Expected DOCTYPE.
-Line: 1 Col: 29 Expected closing tag. Unexpected end of file.
+5: missing document type declaration
+30: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <div>
 |       " abc "
 |       <b>
 |         " def "
 |         <i>
 |           " ghi "
 |           <p>
 
 #data
 <DIV> abc <B> def <I> ghi <P> jkl
 #errors
-Line: 1 Col: 5 Unexpected start tag (div). Expected DOCTYPE.
-Line: 1 Col: 33 Expected closing tag. Unexpected end of file.
+5: missing document type declaration
+34: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <div>
 |       " abc "
 |       <b>
 |         " def "
 |         <i>
 |           " ghi "
 |           <p>
 |             " jkl"
 
 #data
 <DIV> abc <B> def <I> ghi <P> jkl </B>
 #errors
-Line: 1 Col: 5 Unexpected start tag (div). Expected DOCTYPE.
-Line: 1 Col: 38 End tag (b) violates step 1, paragraph 3 of the adoption agency algorithm.
-Line: 1 Col: 38 Expected closing tag. Unexpected end of file.
+5: missing document type declaration
+38: mismatched b element end tag (misnested tags)
+39: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <div>
 |       " abc "
 |       <b>
 |         " def "
@@ -987,19 +974,19 @@ Line: 1 Col: 38 Expected closing tag. Un
 |       <i>
 |         <p>
 |           <b>
 |             " jkl "
 
 #data
 <DIV> abc <B> def <I> ghi <P> jkl </B> mno
 #errors
-Line: 1 Col: 5 Unexpected start tag (div). Expected DOCTYPE.
-Line: 1 Col: 38 End tag (b) violates step 1, paragraph 3 of the adoption agency algorithm.
-Line: 1 Col: 42 Expected closing tag. Unexpected end of file.
+5: missing document type declaration
+38: mismatched b element end tag (misnested tags)
+43: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <div>
 |       " abc "
 |       <b>
 |         " def "
@@ -1009,20 +996,20 @@ Line: 1 Col: 42 Expected closing tag. Un
 |         <p>
 |           <b>
 |             " jkl "
 |           " mno"
 
 #data
 <DIV> abc <B> def <I> ghi <P> jkl </B> mno </I>
 #errors
-Line: 1 Col: 5 Unexpected start tag (div). Expected DOCTYPE.
-Line: 1 Col: 38 End tag (b) violates step 1, paragraph 3 of the adoption agency algorithm.
-Line: 1 Col: 47 End tag (i) violates step 1, paragraph 3 of the adoption agency algorithm.
-Line: 1 Col: 47 Expected closing tag. Unexpected end of file.
+5: missing document type declaration
+38: mismatched b element end tag (misnested tags)
+47: mismatched i element end tag (misnested tags)
+48: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <div>
 |       " abc "
 |       <b>
 |         " def "
@@ -1033,20 +1020,20 @@ Line: 1 Col: 47 Expected closing tag. Un
 |         <i>
 |           <b>
 |             " jkl "
 |           " mno "
 
 #data
 <DIV> abc <B> def <I> ghi <P> jkl </B> mno </I> pqr
 #errors
-Line: 1 Col: 5 Unexpected start tag (div). Expected DOCTYPE.
-Line: 1 Col: 38 End tag (b) violates step 1, paragraph 3 of the adoption agency algorithm.
-Line: 1 Col: 47 End tag (i) violates step 1, paragraph 3 of the adoption agency algorithm.
-Line: 1 Col: 51 Expected closing tag. Unexpected end of file.
+5: missing document type declaration
+38: mismatched b element end tag (misnested tags)
+47: mismatched i element end tag (misnested tags)
+52: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <div>
 |       " abc "
 |       <b>
 |         " def "
@@ -1058,20 +1045,20 @@ Line: 1 Col: 51 Expected closing tag. Un
 |           <b>
 |             " jkl "
 |           " mno "
 |         " pqr"
 
 #data
 <DIV> abc <B> def <I> ghi <P> jkl </B> mno </I> pqr </P>
 #errors
-Line: 1 Col: 5 Unexpected start tag (div). Expected DOCTYPE.
-Line: 1 Col: 38 End tag (b) violates step 1, paragraph 3 of the adoption agency algorithm.
-Line: 1 Col: 47 End tag (i) violates step 1, paragraph 3 of the adoption agency algorithm.
-Line: 1 Col: 56 Expected closing tag. Unexpected end of file.
+5: missing document type declaration
+38: mismatched b element end tag (misnested tags)
+47: mismatched i element end tag (misnested tags)
+57: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <div>
 |       " abc "
 |       <b>
 |         " def "
@@ -1083,20 +1070,20 @@ Line: 1 Col: 56 Expected closing tag. Un
 |           <b>
 |             " jkl "
 |           " mno "
 |         " pqr "
 
 #data
 <DIV> abc <B> def <I> ghi <P> jkl </B> mno </I> pqr </P> stu
 #errors
-Line: 1 Col: 5 Unexpected start tag (div). Expected DOCTYPE.
-Line: 1 Col: 38 End tag (b) violates step 1, paragraph 3 of the adoption agency algorithm.
-Line: 1 Col: 47 End tag (i) violates step 1, paragraph 3 of the adoption agency algorithm.
-Line: 1 Col: 60 Expected closing tag. Unexpected end of file.
+5: missing document type declaration
+38: mismatched b element end tag (misnested tags)
+47: mismatched i element end tag (misnested tags)
+61: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <div>
 |       " abc "
 |       <b>
 |         " def "
@@ -1109,36 +1096,36 @@ Line: 1 Col: 60 Expected closing tag. Un
 |             " jkl "
 |           " mno "
 |         " pqr "
 |       " stu"
 
 #data
 <test attribute---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
 #errors
-Line: 1 Col: 1040 Unexpected start tag (test). Expected DOCTYPE.
-Line: 1 Col: 1040 Expected closing tag. Unexpected end of file.
+1040: missing document type declaration
+1041: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <test>
 |       attribute----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------=""
 
 #data
 <a href="blah">aba<table><a href="foo">br<tr><td></td></tr>x</table>aoe
 #errors
-Line: 1 Col: 15 Unexpected start tag (a). Expected DOCTYPE.
-Line: 1 Col: 39 Unexpected start tag (a) in table context caused voodoo mode.
-Line: 1 Col: 39 Unexpected start tag (a) implies end tag (a).
-Line: 1 Col: 39 End tag (a) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 45 Unexpected implied end tag (a) in the table phase.
-Line: 1 Col: 68 Unexpected implied end tag (a) in the table phase.
-Line: 1 Col: 71 Expected closing tag. Unexpected end of file.
-
+15: missing document type declaration
+39: unexpected node in table context
+39: a element start tag implying a element end tag
+39: unexpected node in table context
+39: mismatched a element end tag (misnested tags across <table> tag)
+43: unexpected node in table context
+63: unexpected node in table context
+72: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <a>
 |       href="blah"
 |       "aba"
 |       <a>
@@ -1153,20 +1140,20 @@ Line: 1 Col: 71 Expected closing tag. Un
 |             <td>
 |     <a>
 |       href="foo"
 |       "aoe"
 
 #data
 <a href="blah">aba<table><tr><td><a href="foo">br</td></tr>x</table>aoe
 #errors
-Line: 1 Col: 15 Unexpected start tag (a). Expected DOCTYPE.
-Line: 1 Col: 54 Got table cell end tag (td) while required end tags are missing.
-Line: 1 Col: 60 Unexpected non-space characters in table context caused voodoo mode.
-Line: 1 Col: 71 Expected closing tag. Unexpected end of file.
+15: missing document type declaration
+54: unexpected td element end tag implied other end tags
+63: unexpected node in table context
+72: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <a>
 |       href="blah"
 |       "abax"
 |       <table>
@@ -1176,22 +1163,22 @@ Line: 1 Col: 71 Expected closing tag. Un
 |               <a>
 |                 href="foo"
 |                 "br"
 |       "aoe"
 
 #data
 <table><a href="blah">aba<tr><td><a href="foo">br</td></tr>x</table>aoe
 #errors
-Line: 1 Col: 7 Unexpected start tag (table). Expected DOCTYPE.
-Line: 1 Col: 22 Unexpected start tag (a) in table context caused voodoo mode.
-Line: 1 Col: 29 Unexpected implied end tag (a) in the table phase.
-Line: 1 Col: 54 Got table cell end tag (td) while required end tags are missing.
-Line: 1 Col: 68 Unexpected implied end tag (a) in the table phase.
-Line: 1 Col: 71 Expected closing tag. Unexpected end of file.
+7: missing document type declaration
+22: unexpected node in table context
+27: unexpected node in table context
+54: unexpected td element end tag implied other end tags
+63: unexpected node in table context
+72: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <a>
 |       href="blah"
 |       "aba"
 |     <a>
@@ -1206,19 +1193,19 @@ Line: 1 Col: 71 Expected closing tag. Un
 |               "br"
 |     <a>
 |       href="blah"
 |       "aoe"
 
 #data
 <a href=a>aa<marquee>aa<a href=b>bb</marquee>aa
 #errors
-Line: 1 Col: 10 Unexpected start tag (a). Expected DOCTYPE.
-Line: 1 Col: 45 End tag (marquee) seen too early. Expected other end tag.
-Line: 1 Col: 47 Expected closing tag. Unexpected end of file.
+10: missing document type declaration
+45: mismatched marquee element end tag
+48: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <a>
 |       href="a"
 |       "aa"
 |       <marquee>
@@ -1226,74 +1213,75 @@ Line: 1 Col: 47 Expected closing tag. Un
 |         <a>
 |           href="b"
 |           "bb"
 |       "aa"
 
 #data
 <wbr><strike><code></strike><code><strike></code>
 #errors
-Line: 1 Col: 5 Unexpected start tag (wbr). Expected DOCTYPE.
-Line: 1 Col: 28 End tag (strike) violates step 1, paragraph 3 of the adoption agency algorithm.
-Line: 1 Col: 49 Unexpected end tag (code). Ignored.
+5: missing document type declaration
+28: mismatched strike element end tag (misnested tags)
+49: mismatched code element end tag
 #document
 | <html>
 |   <head>
 |   <body>
 |     <wbr>
 |     <strike>
 |       <code>
 |     <code>
-|       <code>
-|         <strike>
+|       <strike>
 
 #data
 <title><meta></title><link><title><meta></title>
 #errors
-Line: 1 Col: 7 Unexpected start tag (title). Expected DOCTYPE.
+7: missing document type declaration
 #document
 | <html>
 |   <head>
 |     <title>
 |       "<meta>"
 |     <link>
 |     <title>
 |       "<meta>"
 |   <body>
 
 #data
 <style><!--</style><meta><script>--><link></script>
 #errors
-Line: 1 Col: 7 Unexpected start tag (style). Expected DOCTYPE.
-Line: 1 Col: 51 Unexpected end of file. Expected end tag (style).
+7: missing document type declaration
 #document
 | <html>
 |   <head>
 |     <style>
-|       "<!--</style><meta><script>--><link></script>"
+|       "<!--"
+|     <meta>
+|     <script>
+|       "--><link>"
 |   <body>
 
 #data
 <head><meta></head><link>
 #errors
-Line: 1 Col: 6 Unexpected start tag (head). Expected DOCTYPE.
-Line: 1 Col: 25 Unexpected start tag (link) that can be in head. Moved.
+6: missing document type declaration
+25: unexpected link element start tag
 #document
 | <html>
 |   <head>
 |     <meta>
 |     <link>
 |   <body>
 
 #data
 <table><tr><tr><td><td><span><th><span>X</table>
 #errors
-Line: 1 Col: 7 Unexpected start tag (table). Expected DOCTYPE.
-Line: 1 Col: 33 Got table cell end tag (td) while required end tags are missing.
-Line: 1 Col: 48 Got table cell end tag (th) while required end tags are missing.
+7: missing document type declaration
+33: unexpected td element end tag implied other end tags
+48: unexpected th element end tag implied other end tags
 #document
 | <html>
 |   <head>
 |   <body>
 |     <table>
 |       <tbody>
 |         <tr>
 |         <tr>
@@ -1302,270 +1290,273 @@ Line: 1 Col: 48 Got table cell end tag (
 |             <span>
 |           <th>
 |             <span>
 |               "X"
 
 #data
 <body><body><base><link><meta><title><p></title><body><p></body>
 #errors
-Line: 1 Col: 6 Unexpected start tag (body). Expected DOCTYPE.
-Line: 1 Col: 12 Unexpected start tag (body).
-Line: 1 Col: 54 Unexpected start tag (body).
-Line: 1 Col: 64 Unexpected end tag (p). Missing end tag (body).
+6: missing document type declaration
+12: unexpected body element start tag
+18: base element start tag out of place
+24: link element start tag out of place
+30: meta element start tag out of place
+37: title element start tag out of place
+54: unexpected body element start tag
 #document
 | <html>
 |   <head>
-|   <body>
 |     <base>
 |     <link>
 |     <meta>
 |     <title>
 |       "<p>"
+|   <body>
 |     <p>
 
 #data
 <textarea><p></textarea>
 #errors
-Line: 1 Col: 10 Unexpected start tag (textarea). Expected DOCTYPE.
+10: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 |     <textarea>
 |       "<p>"
 
 #data
 <p><image></p>
 #errors
-Line: 1 Col: 3 Unexpected start tag (p). Expected DOCTYPE.
-Line: 1 Col: 10 Unexpected start tag (image). Treated as img.
+3: missing document type declaration
+10: 'image' is not a valid element name, it should be 'img'
 #document
 | <html>
 |   <head>
 |   <body>
 |     <p>
 |       <img>
 
 #data
 <a><table><a></table><p><a><div><a>
 #errors
-Line: 1 Col: 3 Unexpected start tag (a). Expected DOCTYPE.
-Line: 1 Col: 13 Unexpected start tag (a) in table context caused voodoo mode.
-Line: 1 Col: 13 Unexpected start tag (a) implies end tag (a).
-Line: 1 Col: 13 End tag (a) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 21 Unexpected end tag (table). Expected end tag (a).
-Line: 1 Col: 27 Unexpected start tag (a) implies end tag (a).
-Line: 1 Col: 27 End tag (a) violates step 1, paragraph 2 of the adoption agency algorithm.
-Line: 1 Col: 32 Unexpected end tag (p). Ignored.
-Line: 1 Col: 35 Unexpected start tag (a) implies end tag (a).
-Line: 1 Col: 35 End tag (a) violates step 1, paragraph 2 of the adoption agency algorithm.
-Line: 1 Col: 35 Expected closing tag. Unexpected end of file.
+3: missing document type declaration
+13: unexpected node in table context
+13: a element start tag implying a element end tag
+13: unexpected node in table context
+13: mismatched a element end tag (misnested tags across <table> tag)
+21: mismatched table element end tag
+27: a element start tag implying a element end tag
+27: mismatched a element end tag (out-of-order end tags)
+32: mismatched p element end tag
+35: a element start tag implying a element end tag
+35: mismatched a element end tag (out-of-order end tags)
+36: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <a>
 |       <a>
 |       <table>
 |     <p>
 |       <a>
 |     <div>
 |       <a>
 
 #data
 <head></p><meta><p>
 #errors
-Line: 1 Col: 6 Unexpected start tag (head). Expected DOCTYPE.
-Line: 1 Col: 10 Unexpected end tag (p). Ignored.
+6: missing document type declaration
+10: unexpected p element end tag in head
 #document
 | <html>
 |   <head>
 |     <meta>
 |   <body>
 |     <p>
 
 #data
 <head></html><meta><p>
 #errors
-Line: 1 Col: 6 Unexpected start tag (head). Expected DOCTYPE.
-Line: 1 Col: 19 Unexpected start tag (meta).
+6: missing document type declaration
+19: unexpected node at end of document
+19: unexpected node after body element end tag
+19: meta element start tag out of place
 #document
 | <html>
 |   <head>
+|     <meta>
 |   <body>
-|     <meta>
 |     <p>
 
 #data
 <b><table><td><i></table>
 #errors
-Line: 1 Col: 3 Unexpected start tag (b). Expected DOCTYPE.
-Line: 1 Col: 14 Unexpected table cell start tag (td) in the table body phase.
-Line: 1 Col: 25 Got table cell end tag (td) while required end tags are missing.
-Line: 1 Col: 25 Expected closing tag. Unexpected end of file.
+3: missing document type declaration
+14: required tr element start tag implied by unexpected td element start tag
+25: unexpected td element end tag implied other end tags
+26: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <b>
 |       <table>
 |         <tbody>
 |           <tr>
 |             <td>
 |               <i>
 
 #data
 <b><table><td></b><i></table>
 #errors
-Line: 1 Col: 3 Unexpected start tag (b). Expected DOCTYPE.
-Line: 1 Col: 14 Unexpected table cell start tag (td) in the table body phase.
-Line: 1 Col: 18 End tag (b) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 29 Got table cell end tag (td) while required end tags are missing.
-Line: 1 Col: 29 Expected closing tag. Unexpected end of file.
+3: missing document type declaration
+14: required tr element start tag implied by unexpected td element start tag
+18: mismatched b element end tag (no matching start tag)
+29: unexpected td element end tag implied other end tags
+30: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <b>
 |       <table>
 |         <tbody>
 |           <tr>
 |             <td>
 |               <i>
 
 #data
 <h1><h2>
 #errors
-4: Start tag seen without seeing a doctype first. Expected “<!DOCTYPE html>”.
-8: Heading cannot be a child of another heading.
-8: End of file seen and there were open elements.
+4: missing document type declaration
+8: h2 element start tag implying h1 element end tag
+9: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <h1>
 |     <h2>
 
 #data
 <a><p><a></a></p></a>
 #errors
-Line: 1 Col: 3 Unexpected start tag (a). Expected DOCTYPE.
-Line: 1 Col: 9 Unexpected start tag (a) implies end tag (a).
-Line: 1 Col: 9 End tag (a) violates step 1, paragraph 3 of the adoption agency algorithm.
-Line: 1 Col: 21 End tag (a) violates step 1, paragraph 1 of the adoption agency algorithm.
+3: missing document type declaration
+9: a element start tag implying a element end tag
+9: mismatched a element end tag (misnested tags)
+21: mismatched a element end tag (no matching start tag)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <a>
 |     <p>
 |       <a>
 |       <a>
 
 #data
 <b><button></b></button></b>
 #errors
-Line: 1 Col: 3 Unexpected start tag (b). Expected DOCTYPE.
-Line: 1 Col: 15 End tag (b) violates step 1, paragraph 1 of the adoption agency algorithm.
+3: missing document type declaration
+15: mismatched b element end tag (no matching start tag)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <b>
 |       <button>
 
 #data
 <p><b><div><marquee></p></b></div>
 #errors
-Line: 1 Col: 3 Unexpected start tag (p). Expected DOCTYPE.
-Line: 1 Col: 11 Unexpected end tag (p). Ignored.
-Line: 1 Col: 24 Unexpected end tag (p). Ignored.
-Line: 1 Col: 28 End tag (b) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 34 End tag (div) seen too early. Expected other end tag.
-Line: 1 Col: 34 Expected closing tag. Unexpected end of file.
+3: missing document type declaration
+11: mismatched p element end tag
+24: mismatched p element end tag
+28: mismatched b element end tag (no matching start tag)
+34: mismatched div element end tag
+35: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <p>
 |       <b>
 |     <div>
 |       <b>
 |         <marquee>
-|           <p>
 
 #data
 <script></script></div><title></title><p><p>
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 23 Unexpected end tag (div). Ignored.
+8: missing document type declaration
+23: unexpected div element end tag in head
 #document
 | <html>
 |   <head>
 |     <script>
 |     <title>
 |   <body>
 |     <p>
 |     <p>
 
 #data
 <p><hr></p>
 #errors
-Line: 1 Col: 3 Unexpected start tag (p). Expected DOCTYPE.
-Line: 1 Col: 11 Unexpected end tag (p). Ignored.
+3: missing document type declaration
+11: mismatched p element end tag
 #document
 | <html>
 |   <head>
 |   <body>
 |     <p>
 |     <hr>
-|     <p>
 
 #data
 <select><b><option><select><option></b></select>
 #errors
-Line: 1 Col: 8 Unexpected start tag (select). Expected DOCTYPE.
-Line: 1 Col: 11 Unexpected start tag token (b) in the select phase. Ignored.
-Line: 1 Col: 27 Unexpected select start tag in the select phase treated as select end tag.
-Line: 1 Col: 39 End tag (b) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 48 Unexpected end tag (select). Ignored.
-Line: 1 Col: 48 Expected closing tag. Unexpected end of file.
+8: missing document type declaration
+11: unexpected node in select element context
+27: select element start tag used as end tag
+35: unexpected option element start tag in body
+39: mismatched b element end tag (no matching start tag)
+48: mismatched special end tag select
 #document
 | <html>
 |   <head>
 |   <body>
 |     <select>
 |       <option>
-|     <option>
 
 #data
 <html><head><title></title><body></body></html>
 #errors
-Line: 1 Col: 6 Unexpected start tag (html). Expected DOCTYPE.
+6: missing document type declaration
 #document
 | <html>
 |   <head>
 |     <title>
 |   <body>
 
 #data
 <a><table><td><a><table></table><a></tr><a></table><a>
 #errors
-Line: 1 Col: 3 Unexpected start tag (a). Expected DOCTYPE.
-Line: 1 Col: 14 Unexpected table cell start tag (td) in the table body phase.
-Line: 1 Col: 35 Unexpected start tag (a) implies end tag (a).
-Line: 1 Col: 40 Got table cell end tag (td) while required end tags are missing.
-Line: 1 Col: 43 Unexpected start tag (a) in table context caused voodoo mode.
-Line: 1 Col: 43 Unexpected start tag (a) implies end tag (a).
-Line: 1 Col: 43 End tag (a) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 51 Unexpected implied end tag (a) in the table phase.
-Line: 1 Col: 54 Unexpected start tag (a) implies end tag (a).
-Line: 1 Col: 54 End tag (a) violates step 1, paragraph 2 of the adoption agency algorithm.
-Line: 1 Col: 54 Expected closing tag. Unexpected end of file.
+3: missing document type declaration
+14: required tr element start tag implied by unexpected td element start tag
+35: a element start tag implying a element end tag
+40: unexpected td element end tag implied other end tags
+43: unexpected node in table context
+43: a element start tag implying a element end tag
+43: unexpected node in table context
+43: mismatched a element end tag (misnested tags across <table> tag)
+54: a element start tag implying a element end tag
+54: mismatched a element end tag (out-of-order end tags)
+55: mismatched body element end tag (premature end of file?)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <a>
 |       <a>
 |       <table>
 |         <tbody>
@@ -1574,20 +1565,18 @@ Line: 1 Col: 54 Expected closing tag. Un
 |               <a>
 |                 <table>
 |               <a>
 |     <a>
 
 #data
 <ul><li></li><div><li></div><li><li><div><li><address><li><b><em></b><li></ul>
 #errors
-Line: 1 Col: 4 Unexpected start tag (ul). Expected DOCTYPE.
-Line: 1 Col: 45 Missing end tag (div, li).
-Line: 1 Col: 58 Missing end tag (address, li).
-Line: 1 Col: 69 End tag (b) violates step 1, paragraph 3 of the adoption agency algorithm.
+4: missing document type declaration
+69: mismatched b element end tag (misnested tags)
 #document
 | <html>
 |   <head>
 |   <body>
 |     <ul>
 |       <li>
 |       <div>
 |         <li>
@@ -1599,50 +1588,71 @@ Line: 1 Col: 69 End tag (b) violates ste
 |       <li>
 |         <b>
 |           <em>
 |       <li>
 
 #data
 <frameset><frame><frameset><frame></frameset><noframes></noframes></frameset>
 #errors
-Line: 1 Col: 10 Unexpected start tag (frameset). Expected DOCTYPE.
+10: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <frameset>
 |     <frame>
 |     <frameset>
 |       <frame>
 |     <noframes>
 
 #data
+<body><frame></frame></frame><frameset><frame><frameset><frame></frameset><noframes></frameset><noframes>
+#errors
+6: missing document type declaration
+13: unexpected frame element start tag in body
+21: unexpected frame element end tag
+29: unexpected frame element end tag
+39: unexpected frameset element start tag in body
+46: unexpected frame element start tag in body
+56: unexpected frameset element start tag in body
+63: unexpected frame element start tag in body
+74: unexpected frameset element end tag
+87: unescaped '</' in CDATA or RCDATA block
+106: unexpected end of file while parsing CDATA section for element noframes
+#document
+| <html>
+|   <head>
+|   <body>
+|     <noframes>
+|       "</frameset><noframes>"
+
+#data
 <h1><table><td><h3></table><h3></h1>
 #errors
-4: Start tag seen without seeing a doctype first. Expected “<!DOCTYPE html>”.
-15: “td” start tag in table body.
-27: Unclosed elements.
-31: Heading cannot be a child of another heading.
-36: End tag “h1” seen but there were unclosed elements.
+4: missing document type declaration
+15: required tr element start tag implied by unexpected td element start tag
+27: unexpected td element end tag implied other end tags
+31: h3 element start tag implying h1 element end tag
+36: mismatched h1 element end tag
 #document
 | <html>
 |   <head>
 |   <body>
 |     <h1>
 |       <table>
 |         <tbody>
 |           <tr>
 |             <td>
 |               <h3>
 |     <h3>
 
 #data
 <table><colgroup><col><colgroup><col><col><col><colgroup><col><col><thead><tr><td></table>
 #errors
-Line: 1 Col: 7 Unexpected start tag (table). Expected DOCTYPE.
+7: missing document type declaration
 #document
 | <html>
 |   <head>
 |   <body>
 |     <table>
 |       <colgroup>
 |         <col>
 |       <colgroup>
@@ -1654,19 +1664,19 @@ Line: 1 Col: 7 Unexpected start tag (tab
 |         <col>
 |       <thead>
 |         <tr>
 |           <td>
 
 #data
 <table><col><tbody><col><tr><col><td><col></table><col>
 #errors
-Line: 1 Col: 7 Unexpected start tag (table). Expected DOCTYPE.
-Line: 1 Col: 37 Unexpected table cell start tag (td) in the table body phase.
-Line: 1 Col: 55 Unexpected start tag col. Ignored.
+7: missing document type declaration
+37: required tr element start tag implied by unexpected td element start tag
+55: unexpected col element start tag in body
 #document
 | <html>
 |   <head>
 |   <body>
 |     <table>
 |       <colgroup>
 |         <col>
 |       <tbody>
@@ -1680,19 +1690,19 @@ Line: 1 Col: 55 Unexpected start tag col
 |         <tr>
 |           <td>
 |       <colgroup>
 |         <col>
 
 #data
 <table><colgroup><tbody><colgroup><tr><colgroup><td><colgroup></table><colgroup>
 #errors
-Line: 1 Col: 7 Unexpected start tag (table). Expected DOCTYPE.
-Line: 1 Col: 52 Unexpected table cell start tag (td) in the table body phase.
-Line: 1 Col: 80 Unexpected start tag colgroup. Ignored.
+7: missing document type declaration
+52: required tr element start tag implied by unexpected td element start tag
+80: unexpected colgroup element start tag in body
 #document
 | <html>
 |   <head>
 |   <body>
 |     <table>
 |       <colgroup>
 |       <tbody>
 |       <colgroup>
@@ -1702,231 +1712,218 @@ Line: 1 Col: 80 Unexpected start tag col
 |       <tbody>
 |         <tr>
 |           <td>
 |       <colgroup>
 
 #data
 </strong></b></em></i></u></strike></s></blink></tt></pre></big></small></font></select></h1></h2></h3></h4></h5></h6></body></br></a></img></title></span></style></script></table></th></td></tr></frame></area></link></param></hr></input></col></base></meta></basefont></bgsound></embed></spacer></p></dd></dt></caption></colgroup></tbody></tfoot></thead></address></blockquote></center></dir></div></dl></fieldset></listing></menu></ol></ul></li></nobr></wbr></form></button></marquee></object></html></frameset></head></iframe></image></isindex></noembed></noframes></noscript></optgroup></option></plaintext></textarea>
 #errors
-Line: 1 Col: 9 Unexpected end tag (strong). Expected DOCTYPE.
-Line: 1 Col: 9 Unexpected end tag (strong) after the (implied) root element.
-Line: 1 Col: 13 Unexpected end tag (b) after the (implied) root element.
-Line: 1 Col: 18 Unexpected end tag (em) after the (implied) root element.
-Line: 1 Col: 22 Unexpected end tag (i) after the (implied) root element.
-Line: 1 Col: 26 Unexpected end tag (u) after the (implied) root element.
-Line: 1 Col: 35 Unexpected end tag (strike) after the (implied) root element.
-Line: 1 Col: 39 Unexpected end tag (s) after the (implied) root element.
-Line: 1 Col: 47 Unexpected end tag (blink) after the (implied) root element.
-Line: 1 Col: 52 Unexpected end tag (tt) after the (implied) root element.
-Line: 1 Col: 58 Unexpected end tag (pre) after the (implied) root element.
-Line: 1 Col: 64 Unexpected end tag (big) after the (implied) root element.
-Line: 1 Col: 72 Unexpected end tag (small) after the (implied) root element.
-Line: 1 Col: 79 Unexpected end tag (font) after the (implied) root element.
-Line: 1 Col: 88 Unexpected end tag (select) after the (implied) root element.
-Line: 1 Col: 93 Unexpected end tag (h1) after the (implied) root element.
-Line: 1 Col: 98 Unexpected end tag (h2) after the (implied) root element.
-Line: 1 Col: 103 Unexpected end tag (h3) after the (implied) root element.
-Line: 1 Col: 108 Unexpected end tag (h4) after the (implied) root element.
-Line: 1 Col: 113 Unexpected end tag (h5) after the (implied) root element.
-Line: 1 Col: 118 Unexpected end tag (h6) after the (implied) root element.
-Line: 1 Col: 125 Unexpected end tag (body) after the (implied) root element.
-Line: 1 Col: 130 Unexpected end tag (br). Treated as br element.
-Line: 1 Col: 134 End tag (a) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 140 This element (img) has no end tag.
-Line: 1 Col: 148 Unexpected end tag (title). Ignored.
-Line: 1 Col: 155 Unexpected end tag (span). Ignored.
-Line: 1 Col: 163 Unexpected end tag (style). Ignored.
-Line: 1 Col: 172 Unexpected end tag (script). Ignored.
-Line: 1 Col: 180 Unexpected end tag (table). Ignored.
-Line: 1 Col: 185 Unexpected end tag (th). Ignored.
-Line: 1 Col: 190 Unexpected end tag (td). Ignored.
-Line: 1 Col: 195 Unexpected end tag (tr). Ignored.
-Line: 1 Col: 203 This element (frame) has no end tag.
-Line: 1 Col: 210 This element (area) has no end tag.
-Line: 1 Col: 217 Unexpected end tag (link). Ignored.
-Line: 1 Col: 225 This element (param) has no end tag.
-Line: 1 Col: 230 This element (hr) has no end tag.
-Line: 1 Col: 238 This element (input) has no end tag.
-Line: 1 Col: 244 Unexpected end tag (col). Ignored.
-Line: 1 Col: 251 Unexpected end tag (base). Ignored.
-Line: 1 Col: 258 Unexpected end tag (meta). Ignored.
-Line: 1 Col: 269 This element (basefont) has no end tag.
-Line: 1 Col: 279 This element (bgsound) has no end tag.
-Line: 1 Col: 287 This element (embed) has no end tag.
-Line: 1 Col: 296 This element (spacer) has no end tag.
-Line: 1 Col: 300 Unexpected end tag (p). Ignored.
-Line: 1 Col: 305 End tag (dd) seen too early. Expected other end tag.
-Line: 1 Col: 310 End tag (dt) seen too early. Expected other end tag.
-Line: 1 Col: 320 Unexpected end tag (caption). Ignored.
-Line: 1 Col: 331 Unexpected end tag (colgroup). Ignored.
-Line: 1 Col: 339 Unexpected end tag (tbody). Ignored.
-Line: 1 Col: 347 Unexpected end tag (tfoot). Ignored.
-Line: 1 Col: 355 Unexpected end tag (thead). Ignored.
-Line: 1 Col: 365 End tag (address) seen too early. Expected other end tag.
-Line: 1 Col: 378 End tag (blockquote) seen too early. Expected other end tag.
-Line: 1 Col: 387 End tag (center) seen too early. Expected other end tag.
-Line: 1 Col: 393 Unexpected end tag (dir). Ignored.
-Line: 1 Col: 399 End tag (div) seen too early. Expected other end tag.
-Line: 1 Col: 404 End tag (dl) seen too early. Expected other end tag.
-Line: 1 Col: 415 End tag (fieldset) seen too early. Expected other end tag.
-Line: 1 Col: 425 End tag (listing) seen too early. Expected other end tag.
-Line: 1 Col: 432 End tag (menu) seen too early. Expected other end tag.
-Line: 1 Col: 437 End tag (ol) seen too early. Expected other end tag.
-Line: 1 Col: 442 End tag (ul) seen too early. Expected other end tag.
-Line: 1 Col: 447 End tag (li) seen too early. Expected other end tag.
-Line: 1 Col: 454 End tag (nobr) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 460 This element (wbr) has no end tag.
-Line: 1 Col: 476 End tag (button) seen too early. Expected other end tag.
-Line: 1 Col: 486 End tag (marquee) seen too early. Expected other end tag.
-Line: 1 Col: 495 End tag (object) seen too early. Expected other end tag.
-Line: 1 Col: 513 Unexpected end tag (html). Ignored.
-Line: 1 Col: 513 Unexpected end tag (frameset). Ignored.
-Line: 1 Col: 520 Unexpected end tag (head). Ignored.
-Line: 1 Col: 529 Unexpected end tag (iframe). Ignored.
-Line: 1 Col: 537 This element (image) has no end tag.
-Line: 1 Col: 547 This element (isindex) has no end tag.
-Line: 1 Col: 557 Unexpected end tag (noembed). Ignored.
-Line: 1 Col: 568 Unexpected end tag (noframes). Ignored.
-Line: 1 Col: 579 Unexpected end tag (noscript). Ignored.
-Line: 1 Col: 590 Unexpected end tag (optgroup). Ignored.
-Line: 1 Col: 599 Unexpected end tag (option). Ignored.
-Line: 1 Col: 611 Unexpected end tag (plaintext). Ignored.
-Line: 1 Col: 622 Unexpected end tag (textarea). Ignored.
+9: missing document type declaration
+9: unexpected strong element end tag
+13: unexpected b element end tag
+18: unexpected em element end tag
+22: unexpected i element end tag
+26: unexpected u element end tag
+35: unexpected strike element end tag
+39: unexpected s element end tag
+47: unexpected blink element end tag
+52: unexpected tt element end tag
+58: unexpected pre element end tag
+64: unexpected big element end tag
+72: unexpected small element end tag
+79: unexpected font element end tag
+88: unexpected select element end tag
+93: unexpected h1 element end tag
+98: unexpected h2 element end tag
+103: unexpected h3 element end tag
+108: unexpected h4 element end tag
+113: unexpected h5 element end tag
+118: unexpected h6 element end tag
+125: unexpected body element end tag
+130: unexpected br element end tag
+134: unexpected a element end tag
+140: unexpected img element end tag
+148: unexpected title element end tag
+155: unexpected span element end tag
+163: unexpected style element end tag
+172: unexpected script element end tag
+180: unexpected table element end tag
+185: unexpected th element end tag
+190: unexpected td element end tag
+195: unexpected tr element end tag
+203: unexpected frame element end tag
+210: unexpected area element end tag
+217: unexpected link element end tag
+225: unexpected param element end tag
+230: unexpected hr element end tag
+238: unexpected input element end tag
+244: unexpected col element end tag
+251: unexpected base element end tag
+258: unexpected meta element end tag
+269: unexpected basefont element end tag
+279: unexpected bgsound element end tag
+287: unexpected embed element end tag
+296: unexpected spacer element end tag
+300: unexpected p element end tag
+305: unexpected dd element end tag
+310: unexpected dt element end tag
+320: unexpected caption element end tag
+331: unexpected colgroup element end tag
+339: unexpected tbody element end tag
+347: unexpected tfoot element end tag
+355: unexpected thead element end tag
+365: unexpected address element end tag
+378: unexpected blockquote element end tag
+387: unexpected center element end tag
+393: unexpected dir element end tag
+399: unexpected div element end tag
+404: unexpected dl element end tag
+415: unexpected fieldset element end tag
+425: unexpected listing element end tag
+432: unexpected menu element end tag
+437: unexpected ol element end tag
+442: unexpected ul element end tag
+447: unexpected li element end tag
+454: unexpected nobr element end tag
+460: unexpected wbr element end tag
+467: unexpected form element end tag
+476: unexpected button element end tag
+486: unexpected marquee element end tag
+495: unexpected object element end tag
+513: unexpected node at end of document
+513: unexpected node after body element end tag
+513: unexpected frameset element end tag
+520: unexpected head element end tag
+529: mismatched special end tag iframe
+537: unexpected image end tag (that element has no end tag, ever)
+547: unexpected isindex end tag (that element has no end tag, ever)
+557: mismatched special end tag noembed
+568: mismatched special end tag noframes
+579: mismatched special end tag noscript
+590: unexpected optgroup element end tag
+599: unexpected option element end tag
+611: unexpected plaintext element end tag
+622: mismatched special end tag textarea
 #document
 | <html>
 |   <head>
 |   <body>
-|     <br>
-|     <p>
 
 #data
 <table><tr></strong></b></em></i></u></strike></s></blink></tt></pre></big></small></font></select></h1></h2></h3></h4></h5></h6></body></br></a></img></title></span></style></script></table></th></td></tr></frame></area></link></param></hr></input></col></base></meta></basefont></bgsound></embed></spacer></p></dd></dt></caption></colgroup></tbody></tfoot></thead></address></blockquote></center></dir></div></dl></fieldset></listing></menu></ol></ul></li></nobr></wbr></form></button></marquee></object></html></frameset></head></iframe></image></isindex></noembed></noframes></noscript></optgroup></option></plaintext></textarea>
 #errors
-Line: 1 Col: 7 Unexpected start tag (table). Expected DOCTYPE.
-Line: 1 Col: 20 Unexpected end tag (strong) in table context caused voodoo mode.
-Line: 1 Col: 20 End tag (strong) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 24 Unexpected end tag (b) in table context caused voodoo mode.
-Line: 1 Col: 24 End tag (b) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 29 Unexpected end tag (em) in table context caused voodoo mode.
-Line: 1 Col: 29 End tag (em) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 33 Unexpected end tag (i) in table context caused voodoo mode.
-Line: 1 Col: 33 End tag (i) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 37 Unexpected end tag (u) in table context caused voodoo mode.
-Line: 1 Col: 37 End tag (u) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 46 Unexpected end tag (strike) in table context caused voodoo mode.
-Line: 1 Col: 46 End tag (strike) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 50 Unexpected end tag (s) in table context caused voodoo mode.
-Line: 1 Col: 50 End tag (s) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 58 Unexpected end tag (blink) in table context caused voodoo mode.
-Line: 1 Col: 58 Unexpected end tag (blink). Ignored.
-Line: 1 Col: 63 Unexpected end tag (tt) in table context caused voodoo mode.
-Line: 1 Col: 63 End tag (tt) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 69 Unexpected end tag (pre) in table context caused voodoo mode.
-Line: 1 Col: 69 End tag (pre) seen too early. Expected other end tag.
-Line: 1 Col: 75 Unexpected end tag (big) in table context caused voodoo mode.
-Line: 1 Col: 75 End tag (big) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 83 Unexpected end tag (small) in table context caused voodoo mode.
-Line: 1 Col: 83 End tag (small) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 90 Unexpected end tag (font) in table context caused voodoo mode.
-Line: 1 Col: 90 End tag (font) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 99 Unexpected end tag (select) in table context caused voodoo mode.
-Line: 1 Col: 99 Unexpected end tag (select). Ignored.
-Line: 1 Col: 104 Unexpected end tag (h1) in table context caused voodoo mode.
-Line: 1 Col: 104 End tag (h1) seen too early. Expected other end tag.
-Line: 1 Col: 109 Unexpected end tag (h2) in table context caused voodoo mode.
-Line: 1 Col: 109 End tag (h2) seen too early. Expected other end tag.
-Line: 1 Col: 114 Unexpected end tag (h3) in table context caused voodoo mode.
-Line: 1 Col: 114 End tag (h3) seen too early. Expected other end tag.
-Line: 1 Col: 119 Unexpected end tag (h4) in table context caused voodoo mode.
-Line: 1 Col: 119 End tag (h4) seen too early. Expected other end tag.
-Line: 1 Col: 124 Unexpected end tag (h5) in table context caused voodoo mode.
-Line: 1 Col: 124 End tag (h5) seen too early. Expected other end tag.
-Line: 1 Col: 129 Unexpected end tag (h6) in table context caused voodoo mode.
-Line: 1 Col: 129 End tag (h6) seen too early. Expected other end tag.
-Line: 1 Col: 136 Unexpected end tag (body) in the table row phase. Ignored.
-Line: 1 Col: 141 Unexpected end tag (br) in table context caused voodoo mode.
-Line: 1 Col: 141 Unexpected end tag (br). Treated as br element.
-Line: 1 Col: 145 Unexpected end tag (a) in table context caused voodoo mode.
-Line: 1 Col: 145 End tag (a) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 151 Unexpected end tag (img) in table context caused voodoo mode.
-Line: 1 Col: 151 This element (img) has no end tag.
-Line: 1 Col: 159 Unexpected end tag (title) in table context caused voodoo mode.
-Line: 1 Col: 159 Unexpected end tag (title). Ignored.
-Line: 1 Col: 166 Unexpected end tag (span) in table context caused voodoo mode.
-Line: 1 Col: 166 Unexpected end tag (span). Ignored.
-Line: 1 Col: 174 Unexpected end tag (style) in table context caused voodoo mode.
-Line: 1 Col: 174 Unexpected end tag (style). Ignored.
-Line: 1 Col: 183 Unexpected end tag (script) in table context caused voodoo mode.
-Line: 1 Col: 183 Unexpected end tag (script). Ignored.
-Line: 1 Col: 196 Unexpected end tag (th). Ignored.
-Line: 1 Col: 201 Unexpected end tag (td). Ignored.
-Line: 1 Col: 206 Unexpected end tag (tr). Ignored.
-Line: 1 Col: 214 This element (frame) has no end tag.
-Line: 1 Col: 221 This element (area) has no end tag.
-Line: 1 Col: 228 Unexpected end tag (link). Ignored.
-Line: 1 Col: 236 This element (param) has no end tag.
-Line: 1 Col: 241 This element (hr) has no end tag.
-Line: 1 Col: 249 This element (input) has no end tag.
-Line: 1 Col: 255 Unexpected end tag (col). Ignored.
-Line: 1 Col: 262 Unexpected end tag (base). Ignored.
-Line: 1 Col: 269 Unexpected end tag (meta). Ignored.
-Line: 1 Col: 280 This element (basefont) has no end tag.
-Line: 1 Col: 290 This element (bgsound) has no end tag.
-Line: 1 Col: 298 This element (embed) has no end tag.
-Line: 1 Col: 307 This element (spacer) has no end tag.
-Line: 1 Col: 311 Unexpected end tag (p). Ignored.
-Line: 1 Col: 316 End tag (dd) seen too early. Expected other end tag.
-Line: 1 Col: 321 End tag (dt) seen too early. Expected other end tag.
-Line: 1 Col: 331 Unexpected end tag (caption). Ignored.
-Line: 1 Col: 342 Unexpected end tag (colgroup). Ignored.
-Line: 1 Col: 350 Unexpected end tag (tbody). Ignored.
-Line: 1 Col: 358 Unexpected end tag (tfoot). Ignored.
-Line: 1 Col: 366 Unexpected end tag (thead). Ignored.
-Line: 1 Col: 376 End tag (address) seen too early. Expected other end tag.
-Line: 1 Col: 389 End tag (blockquote) seen too early. Expected other end tag.
-Line: 1 Col: 398 End tag (center) seen too early. Expected other end tag.
-Line: 1 Col: 404 Unexpected end tag (dir). Ignored.
-Line: 1 Col: 410 End tag (div) seen too early. Expected other end tag.
-Line: 1 Col: 415 End tag (dl) seen too early. Expected other end tag.
-Line: 1 Col: 426 End tag (fieldset) seen too early. Expected other end tag.
-Line: 1 Col: 436 End tag (listing) seen too early. Expected other end tag.
-Line: 1 Col: 443 End tag (menu) seen too early. Expected other end tag.
-Line: 1 Col: 448 End tag (ol) seen too early. Expected other end tag.
-Line: 1 Col: 453 End tag (ul) seen too early. Expected other end tag.
-Line: 1 Col: 458 End tag (li) seen too early. Expected other end tag.
-Line: 1 Col: 465 End tag (nobr) violates step 1, paragraph 1 of the adoption agency algorithm.
-Line: 1 Col: 471 This element (wbr) has no end tag.
-Line: 1 Col: 487 End tag (button) seen too early. Expected other end tag.
-Line: 1 Col: 497 End tag (marquee) seen too early. Expected other end tag.
-Line: 1 Col: 506 End tag (object) seen too early. Expected other end tag.
-Line: 1 Col: 524 Unexpected end tag (html). Ignored.
-Line: 1 Col: 524 Unexpected end tag (frameset). Ignored.
-Line: 1 Col: 531 Unexpected end tag (head). Ignored.
-Line: 1 Col: 540 Unexpected end tag (iframe). Ignored.
-Line: 1 Col: 548 This element (image) has no end tag.
-Line: 1 Col: 558 This element (isindex) has no end tag.
-Line: 1 Col: 568 Unexpected end tag (noembed). Ignored.
-Line: 1 Col: 579 Unexpected end tag (noframes). Ignored.
-Line: 1 Col: 590 Unexpected end tag (noscript). Ignored.
-Line: 1 Col: 601 Unexpected end tag (optgroup). Ignored.
-Line: 1 Col: 610 Unexpected end tag (option). Ignored.
-Line: 1 Col: 622 Unexpected end tag (plaintext). Ignored.
-Line: 1 Col: 633 Unexpected end tag (textarea). Ignored.
+7: missing document type declaration
+20: unexpected node in table context
+20: mismatched strong element end tag (no matching start tag)
+24: unexpected node in table context
+24: mismatched b element end tag (no matching start tag)
+29: unexpected node in table context
+29: mismatched em element end tag (no matching start tag)
+33: unexpected node in table context
+33: mismatched i element end tag (no matching start tag)
+37: unexpected node in table context
+37: mismatched u element end tag (no matching start tag)
+46: unexpected node in table context
+46: mismatched strike element end tag (no matching start tag)
+50: unexpected node in table context
+50: mismatched s element end tag (no matching start tag)
+58: unexpected node in table context
+58: unexpected blink element end tag
+63: unexpected node in table context
+63: mismatched tt element end tag (no matching start tag)
+69: unexpected node in table context
+69: mismatched pre element end tag
+75: unexpected node in table context
+75: mismatched big element end tag (no matching start tag)
+83: unexpected node in table context
+83: mismatched small element end tag (no matching start tag)
+90: unexpected node in table context
+90: mismatched font element end tag (no matching start tag)
+99: unexpected node in table context
+99: mismatched special end tag select
+104: unexpected node in table context
+104: mismatched h1 element end tag
+109: unexpected node in table context
+109: mismatched h2 element end tag
+114: unexpected node in table context
+114: mismatched h3 element end tag
+119: unexpected node in table context
+119: mismatched h4 element end tag
+124: unexpected node in table context
+124: mismatched h5 element end tag
+129: unexpected node in table context
+129: mismatched h6 element end tag
+136: unexpected body element end tag
+141: unexpected node in table context
+141: unexpected br end tag (that element has no end tag, ever)
+145: unexpected node in table context
+145: mismatched a element end tag (no matching start tag)
+151: unexpected node in table context
+151: unexpected img end tag (that element has no end tag, ever)
+159: unexpected node in table context
+159: unexpected title element end tag
+166: unexpected node in table context
+166: unexpected span element end tag
+174: unexpected node in table context
+174: unexpected style element end tag
+183: unexpected node in table context
+183: unexpected script element end tag
+196: unexpected th element end tag
+201: unexpected td element end tag
+206: unexpected tr element end tag
+214: unexpected frame element end tag
+221: unexpected area end tag (that element has no end tag, ever)
+228: unexpected link element end tag
+236: unexpected param end tag (that element has no end tag, ever)
+241: unexpected hr end tag (that element has no end tag, ever)
+249: unexpected input end tag (that element has no end tag, ever)
+255: unexpected col element end tag
+262: unexpected base element end tag
+269: unexpected meta element end tag
+280: unexpected basefont end tag (that element has no end tag, ever)
+290: unexpected bgsound end tag (that element has no end tag, ever)
+298: unexpected embed end tag (that element has no end tag, ever)
+307: unexpected spacer end tag (that element has no end tag, ever)
+311: mismatched p element end tag
+316: mismatched dd element end tag
+321: mismatched dt element end tag
+331: unexpected caption element end tag
+342: unexpected colgroup element end tag
+350: unexpected tbody element end tag
+358: unexpected tfoot element end tag
+366: unexpected thead element end tag
+376: mismatched address element end tag
+389: mismatched blockquote element end tag
+398: mismatched center element end tag
+404: mismatched dir element end tag
+410: mismatched div element end tag
+415: mismatched dl element end tag
+426: mismatched fieldset element end tag
+436: mismatched listing element end tag
+443: mismatched menu element end tag
+448: mismatched ol element end tag
+453: mismatched ul element end tag
+458: mismatched li element end tag
+465: mismatched nobr element end tag (no matching start tag)
+471: unexpected wbr end tag (that element has no end tag, ever)
+478: mismatched form element end tag
+524: unexpected node at end of document
+524: unexpected node after body element end tag
+524: unexpected frameset element end tag
+531: unexpected head element end tag
+540: mismatched special end tag iframe
+548: unexpected image end tag (that element has no end tag, ever)
+558: unexpected isindex end tag (that element has no end tag, ever)
+568: mismatched special end tag noembed
+579: mismatched special end tag noframes
+590: mismatched special end tag noscript
+601: unexpected optgroup element end tag
+610: unexpected option element end tag
+622: unexpected plaintext element end tag
+633: mismatched special end tag textarea
 #document
 | <html>
 |   <head>
 |   <body>
-|     <br>
 |     <table>
 |       <tbody>
 |         <tr>
-|     <p>
-
-#data
-<frameset>
-#errors
-Line: 1 Col: 10 Unexpected start tag (frameset). Expected DOCTYPE.
-Line: 1 Col: 10 Expected closing tag. Unexpected end of file.
-#document
-| <html>
-|   <head>
-|   <frameset>
--- a/parser/htmlparser/tests/mochitest/html5lib_tree_dat2.txt
+++ b/parser/htmlparser/tests/mochitest/html5lib_tree_dat2.txt
@@ -1,738 +1,768 @@
 #data
-<!DOCTYPE html>Test
+<!doctype html>Test
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     "Test"
 
 #data
 <textarea>test</div>test
 #errors
-Line: 1 Col: 10 Unexpected start tag (textarea). Expected DOCTYPE.
-Line: 1 Col: 24 Expected closing tag. Unexpected end of file.
+10: missing document type declaration.
+17: unescaped '</' in CDATA or RCDATA block.
+25: unexpected end of file while parsing CDATA section for element textarea.
 #document
 | <html>
 |   <head>
 |   <body>
 |     <textarea>
 |       "test</div>test"
 
 #data
 <table><td>
 #errors
-Line: 1 Col: 7 Unexpected start tag (table). Expected DOCTYPE.
-Line: 1 Col: 11 Unexpected table cell start tag (td) in the table body phase.
-Line: 1 Col: 11 Expected closing tag. Unexpected end of file.
+7: missing document type declaration.
+11: required tr element start tag implied by unexpected td element start tag.
+12: unexpected end of file implied table element end tag.
 #document
 | <html>
 |   <head>
 |   <body>
 |     <table>
 |       <tbody>
 |         <tr>
 |           <td>
 
 #data
 <table><td>test</tbody></table>
 #errors
-Line: 1 Col: 7 Unexpected start tag (table). Expected DOCTYPE.
-Line: 1 Col: 11 Unexpected table cell start tag (td) in the table body phase.
+missing document type declarattion
+Unexpected and of file
 #document
 | <html>
 |   <head>
 |   <body>
 |     <table>
 |       <tbody>
 |         <tr>
 |           <td>
 |             "test"
 
 #data
 <frame>test
 #errors
-Line: 1 Col: 7 Unexpected start tag (frame). Expected DOCTYPE.
-Line: 1 Col: 7 Unexpected start tag frame. Ignored.
+missing document type declaration
+frame element can't occur here
 #document
 | <html>
 |   <head>
 |   <body>
 |     "test"
 
 #data
-<!DOCTYPE html><frameset>test
+<!doctype html><frameset>test
 #errors
-Line: 1 Col: 29 Unepxected characters in the frameset phase. Characters ignored.
-Line: 1 Col: 29 Expected closing tag. Unexpected end of file.
+frameset can't contain text
+Unexpected end of file
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <frameset>
 
 #data
-<!DOCTYPE html><frameset><!DOCTYPE html>
+<!doctype html><frameset><!doctype html>
 #errors
-Line: 1 Col: 40 Unexpected DOCTYPE. Ignored.
-Line: 1 Col: 40 Expected closing tag. Unexpected end of file.
+document type declaration can only occur at the start of a document
+Expected end tag </frameset>
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <frameset>
 
 #data
-<!DOCTYPE html><font><p><b>test</font>
+<!doctype html><font><p><b>test</font>
 #errors
-Line: 1 Col: 38 End tag (font) violates step 1, paragraph 3 of the adoption agency algorithm.
-Line: 1 Col: 38 End tag (font) violates step 1, paragraph 3 of the adoption agency algorithm.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <font>
 |     <p>
 |       <font>
 |         <b>
 |           "test"
 
 #data
-<!DOCTYPE html><dt><div><dd>
+<!DOCTYPE htmL><dt><div><dd>
 #errors
-Line: 1 Col: 28 Missing end tag (div, dt).
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <dt>
 |       <div>
 |     <dd>
 
 #data
 <script></x
 #errors
-Line: 1 Col: 8 Unexpected start tag (script). Expected DOCTYPE.
-Line: 1 Col: 11 Unexpected end of file. Expected end tag (script).
+no document type
+</ in script
+Unexpected end of file. Expected </script> end tag.
 #document
 | <html>
 |   <head>
 |     <script>
 |       "</x"
 |   <body>
 
 #data
 <table><plaintext><td>
 #errors
-Line: 1 Col: 7 Unexpected start tag (table). Expected DOCTYPE.
-Line: 1 Col: 18 Unexpected start tag (plaintext) in table context caused voodoo mode.
-Line: 1 Col: 22 Unexpected end of file. Expected table content.
+no document type
+<plaintext> directly inside table
+Characters inside table.
+Unexpected end of file.
 #document
 | <html>
 |   <head>
 |   <body>
 |     <plaintext>
 |       "<td>"
 |     <table>
 
 #data
 <plaintext></plaintext>
 #errors
-Line: 1 Col: 11 Unexpected start tag (plaintext). Expected DOCTYPE.
-Line: 1 Col: 23 Expected closing tag. Unexpected end of file.
+No DOCTYPE seen.
+Unexpected end of file.
 #document
 | <html>
 |   <head>
 |   <body>
 |     <plaintext>
 |       "</plaintext>"
 
 #data
-<!DOCTYPE html><table><tr>TEST
+<!doctype html><table><tr>TEST
 #errors
-Line: 1 Col: 30 Unexpected non-space characters in table context caused voodoo mode.
-Line: 1 Col: 30 Unexpected end of file. Expected table content.
+TEST can't occur in <tr>
+Unexpected end of file.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     "TEST"
 |     <table>
 |       <tbody>
 |         <tr>
 
 #data
-<!DOCTYPE html><body t1=1><body t2=2><body t3=3 t4=4>
+<!doctype html><body t1=1><body t2=2><body t3=3 t4=4>
 #errors
-Line: 1 Col: 37 Unexpected start tag (body).
-Line: 1 Col: 53 Unexpected start tag (body).
+Unexpected start tag "body"
+Unexpected start tag "body"
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
-|     t1="1"
+|     t4="4"
 |     t2="2"
 |     t3="3"
-|     t4="4"
+|     t1="1"
 
 #data
 </b test
 #errors
-Line: 1 Col: 8 Unexpected end of file in attribute name.
-Line: 1 Col: 8 End tag contains unexpected attributes.
-Line: 1 Col: 8 Unexpected end tag (b). Expected DOCTYPE.
-Line: 1 Col: 8 Unexpected end tag (b) after the (implied) root element.
+Unexpected EOF in attribute
+Unexpected attribute in end tag.
+No doctype.
+Unexpected end tag.
 #document
 | <html>
 |   <head>
 |   <body>
 
 #data
-<!DOCTYPE html></b test<b &=&amp>X
+<!doctype HtML></b test<b &=&amp>X
 #errors
-Line: 1 Col: 32 Named entity didn't end with ';'.
-Line: 1 Col: 33 End tag contains unexpected attributes.
-Line: 1 Col: 33 Unexpected end tag (b) after the (implied) root element.
+Unexpected < in attribute
+End tag contains attributes.
+Unexpected end tag.
+Named entity didn't end with ;
+Unexpected EOF. Missing closing tag.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
-|     "X"
+|     <b>
+|       &="&"
+|       "X"
 
 #data
 <!doctypehtml><scrIPt type=text/x-foobar;baz>X</SCRipt
 #errors
-Line: 1 Col: 9 No space after literal string 'DOCTYPE'.
-Line: 1 Col: 54 Unexpected end of file in the tag name.
+No space after literal DOCTYPE.
+Unexpected EOF in (end) tag name
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |     <script>
 |       type="text/x-foobar;baz"
 |       "X"
 |   <body>
 
 #data
 &
 #errors
-Line: 1 Col: 1 Unexpected non-space characters. Expected DOCTYPE.
+No doctype.
+Unfinished entity.
 #document
 | <html>
 |   <head>
 |   <body>
 |     "&"
 
 #data
 &#
 #errors
-Line: 1 Col: 1 Numeric entity expected. Got end of file instead.
-Line: 1 Col: 1 Unexpected non-space characters. Expected DOCTYPE.
+No doctype.
+Unfinished numeric entity.
 #document
 | <html>
 |   <head>
 |   <body>
 |     "&#"
 
 #data
 &#X
 #errors
-Line: 1 Col: 3 Numeric entity expected but none found.
-Line: 1 Col: 3 Unexpected non-space characters. Expected DOCTYPE.
+No doctype.
+Unfinished hexadecimal entity.
 #document
 | <html>
 |   <head>
 |   <body>
 |     "&#X"
 
 #data
 &#x
 #errors
-Line: 1 Col: 3 Numeric entity expected but none found.
-Line: 1 Col: 3 Unexpected non-space characters. Expected DOCTYPE.
+No doctype.
+Unfinished hexadecimal entity.
 #document
 | <html>
 |   <head>
 |   <body>
 |     "&#x"
 
 #data
 &#45
 #errors
-Line: 1 Col: 4 Numeric entity didn't end with ';'.
-Line: 1 Col: 4 Unexpected non-space characters. Expected DOCTYPE.
+No doctype.
+Numeric entity didn't end with ;
 #document
 | <html>
 |   <head>
 |   <body>
 |     "-"
 
 #data
 &x-test
 #errors
-Line: 1 Col: 1 Named entity expected. Got none.
-Line: 1 Col: 1 Unexpected non-space characters. Expected DOCTYPE.
+No doctype.
+Unfinished named entity.
 #document
 | <html>
 |   <head>
 |   <body>
 |     "&x-test"
 
 #data
 <!doctypehtml><p><li>
 #errors
-Line: 1 Col: 9 No space after literal string 'DOCTYPE'.
+No space after literal DOCTYPE.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <p>
 |     <li>
 
 #data
 <!doctypehtml><p><dt>
 #errors
-Line: 1 Col: 9 No space after literal string 'DOCTYPE'.
+No space after literal DOCTYPE.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <p>
 |     <dt>
 
 #data
 <!doctypehtml><p><dd>
 #errors
-Line: 1 Col: 9 No space after literal string 'DOCTYPE'.
+No space after literal DOCTYPE.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <p>
 |     <dd>
 
 #data
 <!doctypehtml><p><form>
 #errors
-Line: 1 Col: 9 No space after literal string 'DOCTYPE'.
-Line: 1 Col: 23 Expected closing tag. Unexpected end of file.
+No space after literal DOCTYPE.
+Unexpected EOF.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <p>
 |     <form>
 
 #data
-<!DOCTYPE html><p></P>X
+<!doctype html><p><b><i><u></p> <p>X
+#errors
+Unexpected end tag </p>.
+Unexpected end EOF. Missing closing tags.
+#document
+| <!DOCTYPE HTML>
+| <html>
+|   <head>
+|   <body>
+|     <p>
+|       <b>
+|         <i>
+|           <u>
+|     " "
+|     <p>
+|       <b>
+|         <i>
+|           <u>
+|             "X"
+
+#data
+<!doctype html><p></P>X
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <p>
 |     "X"
 
 #data
 &AMP
 #errors
-Line: 1 Col: 4 Named entity didn't end with ';'.
-Line: 1 Col: 4 Unexpected non-space characters. Expected DOCTYPE.
+No doctype.
+No closing ; for the entity.
 #document
 | <html>
 |   <head>
 |   <body>
 |     "&"
 
 #data
 &AMp;
 #errors
-Line: 1 Col: 1 Named entity expected. Got none.
-Line: 1 Col: 1 Unexpected non-space characters. Expected DOCTYPE.
+No doctype.
+Invalid entity.
 #document
 | <html>
 |   <head>
 |   <body>
 |     "&AMp;"
 
 #data
-<!DOCTYPE html><html><head></head><body><thisISasillyTESTelementNameToMakeSureCrazyTagNamesArePARSEDcorrectLY>
+<!doctype html><html><head></head><body><thisISasillyTESTelementNameToMakeSureCrazyTagNamesArePARSEDcorrectLY>
 #errors
-Line: 1 Col: 110 Expected closing tag. Unexpected end of file.
+Unexpected end of file.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <thisisasillytestelementnametomakesurecrazytagnamesareparsedcorrectly>
 
 #data
-<!DOCTYPE html>X</body>X
+<!doctype html>X</body>X
 #errors
-Line: 1 Col: 24 Unexpected non-space characters in the after body phase.
+Unexpected non-space characters in the after body phase.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     "XX"
 
 #data
-<!DOCTYPE html><!-- X
+<!doctype html><!-- X
 #errors
-Line: 1 Col: 21 Unexpected end of file in comment.
+Unexpected end of file in comment.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <!--  X -->
 | <html>
 |   <head>
 |   <body>
 
 #data
-<!DOCTYPE html><table><caption>test TEST</caption><td>test
+<!doctype html><table><caption>test TEST</caption><td>test
 #errors
-Line: 1 Col: 54 Unexpected table cell start tag (td) in the table body phase.
-Line: 1 Col: 58 Expected closing tag. Unexpected end of file.
+Unexpected <td> in table body phase.
+Unexpected end of file.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <table>
 |       <caption>
 |         "test TEST"
 |       <tbody>
 |         <tr>
 |           <td>
 |             "test"
 
 #data
-<!DOCTYPE html><select><option><optgroup>
+<!doctype html><select><option><optgroup>
 #errors
-Line: 1 Col: 41 Expected closing tag. Unexpected end of file.
+Unexpected end of file. Missing closing tags.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <select>
 |       <option>
 |       <optgroup>
 
 #data
-<!DOCTYPE html><select><optgroup><option></optgroup><option><select><option>
+<!doctype html><select><optgroup><option></optgroup><option><select><option>
 #errors
-Line: 1 Col: 68 Unexpected select start tag in the select phase treated as select end tag.
-Line: 1 Col: 76 Expected closing tag. Unexpected end of file.
+Unexpected start tag <select> in <select>.
+Unexpected start tag <option>.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <select>
 |       <optgroup>
 |         <option>
 |       <option>
-|     <option>
 
 #data
-<!DOCTYPE html><select><optgroup><option><optgroup>
+<!doctype html><select><optgroup><option><optgroup>
 #errors
-Line: 1 Col: 51 Expected closing tag. Unexpected end of file.
+Unexpected end of file. Missing closing tags.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <select>
 |       <optgroup>
 |         <option>
 |       <optgroup>
 
 #data
-<!DOCTYPE html><font><input><input></font>
+<!doctype html><font><input><input></font>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <font>
 |       <input>
 |       <input>
 
 #data
-<!DOCTYPE html><!-- XXX - XXX -->
+<!DoctypE html><!-- XXX - XXX -->
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <!--  XXX - XXX  -->
 | <html>
 |   <head>
 |   <body>
 
 #data
-<!DOCTYPE html><!-- XXX - XXX
+<!DoctypE html><!-- XXX - XXX
 #errors
-Line: 1 Col: 29 Unexpected end of file in comment (-)
+Unexpected EOF in comment.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <!--  XXX - XXX -->
 | <html>
 |   <head>
 |   <body>
 
 #data
-<!DOCTYPE html><!-- XXX - XXX - XXX -->
+<!DoctypE html><!-- XXX - XXX - XXX -->
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <!--  XXX - XXX - XXX  -->
 | <html>
 |   <head>
 |   <body>
 
 #data
 <isindex test=x name=x>
 #errors
-Line: 1 Col: 23 Unexpected start tag (isindex). Expected DOCTYPE.
-Line: 1 Col: 23 Unexpected start tag isindex. Don't use it!
+No doctype
+<isindex> is not ok!
 #document
 | <html>
 |   <head>
 |   <body>
 |     <form>
 |       <hr>
-|       <label>
-|         "This is a searchable index. Insert your search keywords here: "
-|         <input>
-|           name="isindex"
-|           test="x"
+|       <p>
+|         <label>
+|           "This is a searchable index. Insert your search keywords here:"
+|           <input>
+|             test="x"
+|             name="isindex"
 |       <hr>
 
 #data
 test
 test
 #errors
-Line: 2 Col: 4 Unexpected non-space characters. Expected DOCTYPE.
+No doctype
 #document
 | <html>
 |   <head>
 |   <body>
 |     "test
 test"
 
 #data
-<!DOCTYPE html><body><title>test</body></title>
+<p><b><i><u></p>
+<p>X
 #errors
+No doctype
+Unexpected end tag p.
+Unexpected EOF.
 #document
-| <!DOCTYPE html>
 | <html>
 |   <head>
 |   <body>
-|     <title>
-|       "test</body>"
+|     <p>
+|       <b>
+|         <i>
+|           <u>
+|     "
+"
+|     <p>
+|       <b>
+|         <i>
+|           <u>
+|             "X"
 
 #data
-<!DOCTYPE html><body><title>X</title><meta name=z><link rel=foo><style>
+<!doctype html><body><title>test</body></title>
+#errors
+Unexpected start tag that belongs in the head.
+Expected closing tag after </.
+#document
+| <!DOCTYPE HTML>
+| <html>
+|   <head>
+|     <title>
+|       "test</body>"
+|   <body>
+
+#data
+<!doctype html><body><title>X</title><meta name=z><link rel=foo><style>
 x { content:"</style" } </style>
 #errors
+Unexpected start tag that belongs in head.
+Unexpected start tag that belongs in head.
+Unexpected start tag that belongs in head.
+Expected closing tag after </.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
-|   <body>
 |     <title>
 |       "X"
 |     <meta>
 |       name="z"
 |     <link>
 |       rel="foo"
+|   <body>
 |     <style>
 |       "
 x { content:"</style" } "
 
 #data
-<!DOCTYPE html><select><optgroup></optgroup></select>
+<!doctype html><select><optgroup></optgroup></select>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <select>
 |       <optgroup>
 
 #data
  
  
 #errors
-Line: 2 Col: 1 Unexpected End of file. Expected DOCTYPE.
+No doctype.
 #document
+| " 
+ "
 | <html>
 |   <head>
 |   <body>
 
 #data
-<!DOCTYPE html>  <html>
+<!doctype html>  <html>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
+| "  "
 | <html>
 |   <head>
 |   <body>
 
 #data
-<!DOCTYPE html><script>
+<!doctype html><script>
 </script>  <title>x</title>  </head>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |     <script>
 |       "
 "
 |     "  "
 |     <title>
 |       "x"
 |     "  "
 |   <body>
 
 #data
-<!DOCTYPE html><html><body><html id=x>
+<!doctype html><html><body><html id=x>
 #errors
-Line: 1 Col: 38 html needs to be the first start tag.
+duplicate html start tag
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   id="x"
 |   <head>
 |   <body>
 
 #data
-<!DOCTYPE html>X</body><html id="x">
+<!doctype html>X</body><html id="x">
 #errors
-Line: 1 Col: 36 Unexpected start tag token (html) in the after body phase.
-Line: 1 Col: 36 html needs to be the first start tag.
+Unexpected html start tag in the after body phase.
+html needs to be the first start tag.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   id="x"
 |   <head>
 |   <body>
 |     "X"
 
 #data
-<!DOCTYPE html><head><html id=x>
+<!doctype html><head><html id=x>
 #errors
-Line: 1 Col: 32 html needs to be the first start tag.
+html start tag too late
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   id="x"
 |   <head>
 |   <body>
 
 #data
-<!DOCTYPE html>X</html>X
+<!doctype html>X</html>X
 #errors
-Line: 1 Col: 24 Unexpected non-space characters in the after body phase.
+Unexpected non-space characters. Expected end of file.
+Unexpected non-space characters in after body phase. Expected end of file.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     "XX"
 
 #data
-<!DOCTYPE html>X</html> 
+<!doctype html>X</html> 
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     "X "
 
 #data
-<!DOCTYPE html>X</html><p>X
+<!doctype html>X</html><p>X
 #errors
-Line: 1 Col: 26 Unexpected start tag (p).
+Unexpected start tag <p> in trailing end phase.
+Unexpected start tag <p> in after body phase.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     "X"
 |     <p>
 |       "X"
 
 #data
-<!DOCTYPE html>X<p/x/y/z>
+<!doctype html>X<p/x/y/z>
 #errors
-Line: 1 Col: 19 Expected a > after the /.
-Line: 1 Col: 21 Solidus (/) incorrectly placed in tag.
-Line: 1 Col: 23 Solidus (/) incorrectly placed in tag.
+Solidus (/) incorrectly placed.
+Solidus (/) incorrectly placed.
+Solidus (/) incorrectly placed.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     "X"
 |     <p>
+|       y=""
 |       x=""
-|       y=""
 |       z=""
 
 #data
-<!DOCTYPE html><!--x--
+<!doctype html><!--x--
 #errors
-Line: 1 Col: 22 Unexpected end of file in comment (--).
+Unexpected end of file in comment.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <!-- x -->
 | <html>
 |   <head>
 |   <body>
-
-#data
-<!DOCTYPE html><table><tr><td></p></table>
-#errors
-Line: 1 Col: 34 Unexpected end tag (p). Ignored.
-#document
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     <table>
-|       <tbody>
-|         <tr>
-|           <td>
-|             <p>
-
-#data
-<!DOCTYPE <!DOCTYPE HTML>><!--<!--x-->-->
-#errors
-Line: 1 Col: 20 Expected space or '>'. Got ''
-Line: 1 Col: 25 Erroneous DOCTYPE.
-Line: 1 Col: 35 Unexpected character in comment found.
-#document
-| <!DOCTYPE <!doctype>
-| <html>
-|   <head>
-|   <body>
-|     ">"
-|     <!-- <!--x -->
-|     "-->"
--- a/parser/htmlparser/tests/mochitest/html5lib_tree_dat3.txt
+++ b/parser/htmlparser/tests/mochitest/html5lib_tree_dat3.txt
@@ -1,293 +1,132 @@
 #data
 <head></head><style></style>
 #errors
-Line: 1 Col: 6 Unexpected start tag (head). Expected DOCTYPE.
-Line: 1 Col: 20 Unexpected start tag (style) that can be in head. Moved.
+No DOCTYPE
+<style> in after-head mode
 #document
 | <html>
 |   <head>
 |     <style>
 |   <body>
 
 #data
 <head></head><script></script>
 #errors
-Line: 1 Col: 6 Unexpected start tag (head). Expected DOCTYPE.
-Line: 1 Col: 21 Unexpected start tag (script) that can be in head. Moved.
+No DOCTYPE
+<script> in after-head mode
 #document
 | <html>
 |   <head>
 |     <script>
 |   <body>
 
 #data
 <head></head><!-- --><style></style><!-- --><script></script>
 #errors
-Line: 1 Col: 6 Unexpected start tag (head). Expected DOCTYPE.
-Line: 1 Col: 28 Unexpected start tag (style) that can be in head. Moved.
+No DOCTYPE
+<style> in after-head mode
 #document
 | <html>
 |   <head>
 |     <style>
 |     <script>
 |   <!--   -->
 |   <!--   -->
 |   <body>
 
 #data
 <head></head><!-- -->x<style></style><!-- --><script></script>
 #errors
-Line: 1 Col: 6 Unexpected start tag (head). Expected DOCTYPE.
+No DOCTYPE
 #document
 | <html>
 |   <head>
 |   <!--   -->
 |   <body>
 |     "x"
 |     <style>
 |     <!--   -->
 |     <script>
 
 #data
 <!DOCTYPE html><html><head></head><body><pre>
 </pre></body></html>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <pre>
 
 #data
 <!DOCTYPE html><html><head></head><body><pre>
-foo2</pre></body></html>
+
+foo</pre></body></html>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <pre>
-|       "foo2"
+|       "foo"
+
 
 #data
 <!DOCTYPE html><html><head></head><body><pre>
 
-foo3</pre></body></html>
+foo
+</pre></body></html>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <pre>
-|       "
-foo3"
-
-#data
-<!DOCTYPE html><html><head></head><body><pre>
-foo4
-</pre></body></html>
-#errors
-#document
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     <pre>
-|       "foo4
+|       "foo
 "
 
 #data
 <!DOCTYPE html><html><head></head><body><pre>x</pre><span>
 </span></body></html>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <pre>
 |       "x"
 |     <span>
 |       "
 "
 
 #data
 <!DOCTYPE html><html><head></head><body><pre>x
 y</pre></body></html>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <pre>
 |       "x
 y"
 
 #data
 <!DOCTYPE html><html><head></head><body><pre>x<div>
 y</pre></body></html>
 #errors
-Line: 2 Col: 7 End tag (pre) seen too early. Expected other end tag.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <pre>
 |       "x"
 |       <div>
 |         "
-y"
-
-#data
-<!DOCTYPE html><HTML><META><HEAD></HEAD></HTML>
-#errors
-Line: 1 Col: 33 Unexpected start tag head in existing head. Ignored.
-#document
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|     <meta>
-|   <body>
-
-#data
-<!DOCTYPE html><HTML><HEAD><head></HEAD></HTML>
-#errors
-Line: 1 Col: 33 Unexpected start tag head in existing head. Ignored.
-#document
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-
-#data
-<textarea>foo<span>bar</span><i>baz
-#errors
-Line: 1 Col: 10 Unexpected start tag (textarea). Expected DOCTYPE.
-Line: 1 Col: 35 Expected closing tag. Unexpected end of file.
-#document
-| <html>
-|   <head>
-|   <body>
-|     <textarea>
-|       "foo<span>bar</span><i>baz"
-
-#data
-<title>foo<span>bar</em><i>baz
-#errors
-Line: 1 Col: 7 Unexpected start tag (title). Expected DOCTYPE.
-Line: 1 Col: 30 Unexpected end of file. Expected end tag (title).
-#document
-| <html>
-|   <head>
-|     <title>
-|       "foo<span>bar</em><i>baz"
-|   <body>
-
-#data
-<!DOCTYPE html><textarea>
-</textarea>
-#errors
-#document
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     <textarea>
-
-#data
-<!DOCTYPE html><textarea>
-foo</textarea>
-#errors
-#document
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     <textarea>
-|       "foo"
-
-#data
-<!DOCTYPE html><textarea>
-
-foo</textarea>
-#errors
-#document
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     <textarea>
-|       "
-foo"
-
-#data
-<!DOCTYPE html><html><head></head><body><ul><li><div><p><li></ul></body></html>
-#errors
-Line: 1 Col: 60 Missing end tag (div, li).
-#document
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     <ul>
-|       <li>
-|         <div>
-|           <p>
-|       <li>
-
-#data
-<!doctype html><nobr><nobr><nobr>
-#errors
-Line: 1 Col: 27 Unexpected start tag (nobr) implies end tag (nobr).
-Line: 1 Col: 33 Unexpected start tag (nobr) implies end tag (nobr).
-Line: 1 Col: 33 Expected closing tag. Unexpected end of file.
-#document
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     <nobr>
-|     <nobr>
-|     <nobr>
-
-#data
-<!doctype html><nobr><nobr></nobr><nobr>
-#errors
-Line: 1 Col: 27 Unexpected start tag (nobr) implies end tag (nobr).
-Line: 1 Col: 40 Expected closing tag. Unexpected end of file.
-#document
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     <nobr>
-|     <nobr>
-|     <nobr>
-
-#data
-<!doctype html><html><body><p><table></table></body></html>
-#errors
-Not known
-#document
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     <p>
-|     <table>
-
-#data
-<p><table></table>
-#errors
-Not known
-#document
-| <html>
-|   <head>
-|   <body>
-|     <p>
-|       <table>
+| y"
--- a/parser/htmlparser/tests/mochitest/parser_datreader.js
+++ b/parser/htmlparser/tests/mochitest/parser_datreader.js
@@ -53,197 +53,50 @@ function log(entry) {
 function startsWith(s, s2) {
   return s.indexOf(s2)==0;
 }
 
 function trimString(s) {
   return(s.replace(/^\s+/,'').replace(/\s+$/,''));
 }
 
-function getLastLine(str) {
-  var str_array = str.split("\n");
-  let last_line = str_array[str_array.length - 1];
-  return last_line;
-}
-
-/**
- * Produces a string containing the expected output of a
- * JSON-formatted test, by running the "output" object
- * of the test through a serializer.
- *
- * @param buf string buffer containing the serialized output
- * @param obj the object to serialize
- * @param indent the current line indent
- */
-var gDumpMode;
-function dumpTree(buf, obj, indent) {
-  var buffer = buf;
-  if (typeof(obj) == "object" && (obj instanceof Array)) {
-    for each (var item in obj) {
-      [buffer, indent] = dumpTree(buffer, item, indent);
-    }
-    gDumpMode = -1;
-  }
-  else {
-    // Node.* constants are used here for convenience.
-    switch(obj) {
-      case "ParseError":
-        // no-op
-        break;
-      case "Character":
-        gDumpMode = Node.TEXT_NODE;
-        break;
-      case "StartTag":
-        gDumpMode = Node.ELEMENT_NODE;
-        break;
-      case "EndTag":
-        indent = indent.substring(2);
-        break;
-      case "Comment":
-        gDumpMode = Node.COMMENT_NODE;
-        break;
-      case "DOCTYPE":
-        gDumpMode = Node.DOCUMENT_TYPE_NODE;
-        break;
-      default:
-        switch(gDumpMode) {
-          case Node.DOCUMENT_TYPE_NODE:
-            buffer += "<!DOCTYPE " + obj + ">\n<html>\n  <head>\n  <body>";
-            indent += "    "
-            gDumpMode = -1;
-            break;
-          case Node.COMMENT_NODE:
-            if (buffer.length > 1) {
-              buffer += "\n";
-            }
-            buffer += indent + "<!-- " + obj + " -->";
-            gDumpMode = -1;
-            break;
-          case Node.ATTRIBUTE_NODE:
-            is(typeof(obj), "object", "obj not an object!");
-            indent += "  ";
-            for (var key in obj) {
-              buffer += "\n" + indent + key + "=\"" + obj[key] + "\"";
-            }
-            gDumpMode = -1;
-            break;
-          case Node.TEXT_NODE:
-            if (buffer.indexOf("<head>") == -1) {
-              buffer += "\n<html>\n  <head>\n  <body>";
-              indent += "    ";
-            }
-            // If this text is being appended to some earlier
-            // text, concatenate the two by chopping off the
-            // trailing quote before adding new string.
-            let last_line = trimString(getLastLine(buffer));
-            if (last_line[0] == "\"" && 
-              last_line[last_line.length - 1] == "\"") {
-              buffer = buffer.substring(0, buffer.length - 1);    
-            }
-            else {
-              buffer += "\n" + indent + "\"";  
-            }
-            buffer += obj + "\"";
-            break;
-          case Node.ELEMENT_NODE:
-            buffer += "\n" + indent + "<" + obj + ">";
-            gDumpMode = Node.ATTRIBUTE_NODE;
-            break;
-          default:
-            // no-op
-            break;
-        }
-        break;
-    }
-  }
-  return [buffer, indent];
-}
-
-/**
- * Parses an individual testcase in decoded JSON form, 
- * as for tokenizer tests.
- *
- * @param An object containing a single testcase
- */
-function parseJsonTestcase(testcase) {
-  gDumpMode = -1;
-  // If the test begins with something that looks like the
-  // beginning of a doctype, then don't add a standard doctype,
-  // otherwise do.
-  if (testcase["input"].toLowerCase().indexOf("<!doc") == 0) {
-    var test_output = dumpTree(
-      "", 
-      testcase["output"],
-      "");
-  } else {
-    var test_output = dumpTree(
-      "<!DOCTYPE html>\n<html>\n  <head>\n  <body>", 
-      testcase["output"],
-      "    ");
-  }
-  // Add html, head and body elements now if they
-  // haven't been added already.
-  if (test_output[0].indexOf("<head>") == -1) {
-    test_output[0] += "\n<html>\n  <head>\n  <body>";
-  }
-  return [testcase["input"], test_output[0], "",
-    testcase["description"],
-    JSON.stringify(testcase["output"])];
-}
-
 /**
  * Parses an individual testcase into an array containing the input
  * string, a string representing the expected tree (DOM), and a list
  * of error messages.
  *
  * @param A string containing a single testcase
  */
 function parseTestcase(testcase) {
-  var documentFragmentTest = false;
   var lines = testcase.split("\n");
   if (lines[0] != "#data") {
     log(lines);
     throw "Unknown test format."
   }
   var input = [];
   var output = [];
   var errors = [];
-  var description = undefined;
-  var expectedTokenizerOutput = undefined;
   var currentList = input;
   for each (var line in lines) {
-    // allow blank lines in input
-    if ((line || currentList == input) && !(startsWith(line, "#errors") ||
+    if (line && !(startsWith(line, "#error") ||
 		  startsWith(line, "#document") ||
-		  startsWith(line, "#description") ||
-		  startsWith(line, "#expected") || 
 		  startsWith(line, "#data"))) {
       if (currentList == output && startsWith(line, "|")) {
       	currentList.push(line.substring(2));
       } else {
 	      currentList.push(line);
       }
     } else if (line == "#errors") {
       currentList = errors;
     } else if (line == "#document") {
       currentList = output;
-    } else if (line == "#document-fragment") {
-      documentFragmentTest = true;
     }
   }  
-  
-  // For #document-fragment tests, erase the output, so that the 
-  // test is skipped in makeTestChecker()...there is no good way
-  // to run fragment tests without direct access to the parser.
-  if (documentFragmentTest) {
-    output = [];
-  }
   //logger.log(input.length, output.length, errors.length);
-  return [input.join("\n"), output.join("\n"), errors, description,
-    expectedTokenizerOutput];
+  return [input.join("\n"), output.join("\n"), errors];
 }
 
 /**
  * Sometimes the test output will depend on attribute order.
  * This function fixes up that output to match, if possible.
  *
  * @param output The string generated from walking the DOM
  * @param expected The expected output from the test case
@@ -309,39 +162,28 @@ function attName(line) {
 
 function isAttributeLine(line) {
   var str = trimString(line);
   return (!startsWith(str, "<") && !startsWith(str, "\"") &&
           (str.indexOf("=\"") > 0));
 }
 
 /**
- * A generator function that accepts a list of tests. Each list
+ * A generator function that accepts a list of strings. Each list
  * member corresponds to the contents of a ".dat" file from the
- * html5lib test suite, or an array of decoded JSON tests,
- * in the case of tokenizer "*.test" tests.
+ * html5lib test suite.
  *
  * @param The list of strings
  */
 function test_parser(testlist) {
-  var index = 1;
-  if (gTokenizerMode) {
-    for each (var test in testlist) {
-      var tmpArray = [index];
-      yield tmpArray.concat(parseJsonTestcase(test));
-      index++;
-    }
-  }
-  else {
-    for each (var testgroup in testlist) {
-      var tests = testgroup.split("#data\n");
-      tests = ["#data\n" + test for each(test in tests) if (test)];
-      for each (var test in tests) {
-        yield parseTestcase(test);
-      }
+  for each (var testgroup in testlist) {
+    var tests = testgroup.split("#data\n");
+    tests = ["#data\n" + test for each(test in tests) if (test)];
+    for each (var test in tests) {
+      yield parseTestcase(test);
     }
   }
 }
 
 /**
  * Transforms a DOM document to a string matching the format in 
  * the test cases.
  *
@@ -350,70 +192,38 @@ function test_parser(testlist) {
 function docToTestOutput(doc) {
   var walker = doc.createTreeWalker(doc, NodeFilter.SHOW_ALL, null, true);
   return addLevels(walker, "", "").slice(0,-1); // remove the last newline
 }
 
 function addLevels(walker, buf, indent) {
   if(walker.firstChild()) {
     do {
+      buf += indent;
       switch (walker.currentNode.nodeType) {
         case Node.ELEMENT_NODE:
-          buf += indent + "<";
-          // Prefix MathML element names with "math " to match
-          // the format of the expected output.
-          if (walker.currentNode.namespaceURI.toLowerCase().
-          indexOf("math") != -1) {
-            buf += "math " + walker.currentNode.tagName.toLowerCase() + ">\n";
-          }
-          else if (walker.currentNode.namespaceURI.toLowerCase().
-          indexOf("svg") != -1) {
-            buf += "svg " + walker.currentNode.tagName + ">\n";
-          }
-          else {
-            buf += walker.currentNode.tagName.toLowerCase() + ">\n";
-          }
+          buf += "<" + walker.currentNode.tagName.toLowerCase() + ">";
           if (walker.currentNode.hasAttributes()) {
             var attrs = walker.currentNode.attributes;
             for (var i=0; i < attrs.length; ++i) {
-              // Ignore the -moz-math-font-style attr, which
-              // Firefox automatically adds to every math element.
-              var attrname = attrs[i].name;
-              if (attrname != "-moz-math-font-style") {
-                buf += indent + "  " + attrname + 
-                       "=\"" + attrs[i].value +"\"\n";
-              }
+              buf += "\n" + indent + "  " + attrs[i].name + 
+                     "=\"" + attrs[i].value +"\"";
             }
           }
           break;
         case Node.DOCUMENT_TYPE_NODE:
-          if (!gJSCompatibilityMode) {
-            buf += indent + "<!DOCTYPE " + walker.currentNode.name + ">\n";
-          }
+          buf += "<!DOCTYPE " + walker.currentNode.name + ">";
           break;
         case Node.COMMENT_NODE:
-          if (!gJSCompatibilityMode) {
-            buf += indent + "<!-- " + walker.currentNode.nodeValue + " -->\n";
-          }
+          buf += "<!-- " + walker.currentNode.nodeValue + " -->";
           break;
         case Node.TEXT_NODE:
-          // If this text is being appended to some earlier
-          // text at the same indent level, concatenate the two by
-          // removing the trailing quote before adding new string.
-          let last_line = getLastLine(
-            buf.substring(0, buf.length - 1));
-          if (last_line[indent.length] == "\"" && 
-            last_line[last_line.length - 1] == "\"") {
-            buf = buf.substring(0, buf.length - 2);    
-          }
-          else {
-            buf += indent + "\"";
-          }
-          buf += walker.currentNode.nodeValue + "\"\n";
+          buf += "\"" + walker.currentNode.nodeValue + "\"";
           break;
       }
+      buf += "\n";
       buf = addLevels(walker, buf, indent + "  ");
     } while(walker.nextSibling());
     walker.parentNode();
   }
   return buf;
 }
 
--- a/parser/htmlparser/tests/mochitest/parser_web_testrunner.js
+++ b/parser/htmlparser/tests/mochitest/parser_web_testrunner.js
@@ -43,136 +43,68 @@
  * and it will load each of those dat files into an array, then run
  * the test parser on each and run the tests by assigning the input
  * data to an iframe's url.
  *
  * Your test document should have an element with id "display" and
  * an iframe with id "testframe".
  */
 
-function writeErrorSummary(input, expected, got, isTodo, description,
-  expectedTokenizerOutput) {
+function writeErrorSummary(input, expected, got, isTodo) {
   if (!isTodo) {
     appendChildNodes($("display"), H2("Unexpected Failure:"));
   }
   appendChildNodes(
     $("display"), BR(),
-    SPAN("Matched: "), "" + (expected == got)
-  );
-  if (typeof(description) != "undefined") {
-    appendChildNodes(
-      $("display"), P("Description: " + description)
-    );
-  }
-  appendChildNodes(
-    $("display"), 
-    PRE("Input: " + input)
-  );
-  if (typeof(expectedTokenizerOutput) != "undefined") {
-    appendChildNodes(
-      $("display"), P("Expected raw tokenizer output: " +
-        expectedTokenizerOutput)
-    );
-  }
-  let expectedTitle = "Expected:";
-  let outputTitle = "Output:";
-  if (gJSCompatibilityMode) {
-    outputTitle = "Gecko parser output:";
-    expectedTitle = "JavaScript parser output:";
-  }
-  appendChildNodes(
-    $("display"),
-    PRE(expectedTitle + "\n|" + expected +"|", "\n-\n",
-        outputTitle + "\n|" + got + "|\n\n"),
+    SPAN("Matched: "), "" + (expected == got),
+    P("Input: " + input),
+    PRE("Expected:\n|" + expected +"|", "\n-\n",
+        "Output:\n|" + got + "|\n\n"),
     HR()
   );
 }
 
-function checkTests(input, expected, errors, description, 
-  expectedTokenizerOutput, testDocument) {
-  // For fragment tests, the expected output will be empty, so skip
-  // the test.
-  if (expected.length > 1) {    
-    var domAsString = docToTestOutput(testDocument);
-    // It's possible we need to reorder attributes to get these to match
-    if (expected == domAsString) {
-      is(domAsString, expected, "HTML5 expected success. " + new Date());
-    } else {
-      var reorderedDOM = reorderToMatchExpected(domAsString, expected);
-      if (!gJSCompatibilityMode && html5Exceptions[input]) {
-        todo(reorderedDOM == expected, "HTML5 expected failure. " + new Date());
-        writeErrorSummary(input, expected, reorderedDOM, true, description,
-          expectedTokenizerOutput);
-      } else {
-        if (reorderedDOM != expected) {
-          is(reorderedDOM, expected, "HTML5 unexpected failure. " + input + " " + new Date());
-          writeErrorSummary(input, expected, reorderedDOM, false,
-            description, expectedTokenizerOutput);
-        } else {
-          is(reorderedDOM, expected, "HTML5 expected success. " + new Date());
-        }
-      }
-    }
-  }    
-}
-
 /**
  * Control will bounce back and forth between nextTest() and the
  * event handler returned by makeTestChecker() until the 'testcases'
  * iterator is spent.
  */
-function makeTestChecker(input, expected, errors, description, 
-  expectedTokenizerOutput) {
+function makeTestChecker(input, expected, errors) {
   return function (e) {
-    if (!gJSCompatibilityMode) {
-      checkTests(input, expected, errors, description, 
-        expectedTokenizerOutput, e.target.contentDocument);
-      nextTest(e.target);
+    var domAsString = docToTestOutput(e.target.contentDocument);
+    // It's possible we need to reorder attributes to get these to match
+    if (expected == domAsString) {
+      is(domAsString, expected, "HTML5 expected success. " + new Date());
+    } else {
+      var reorderedDOM = reorderToMatchExpected(domAsString, expected);
+      if (html5Exceptions[input]) {
+        todo(reorderedDOM == expected, "HTML5 expected failure. " + new Date());
+        writeErrorSummary(input, expected, reorderedDOM, true);
+      } else {
+        if (reorderedDOM != expected) {
+          is(reorderedDOM, expected, "HTML5 unexpected failure. " + input + " " + new Date());
+          writeErrorSummary(input, expected, reorderedDOM, false);
+        } else {
+          is(reorderedDOM, expected, "HTML5 expected success. " + new Date());
+        }
+      }
     }
-    else {
-      window.parseHtmlDocument(input, $("jsframe").contentDocument,
-        function() {
-          expected = docToTestOutput($("jsframe").contentDocument);
-          checkTests(input, expected, errors, description, 
-            expectedTokenizerOutput, e.target.contentDocument);
-          nextTest(e.target);        
-        }, null);      
-    }
-  }
+    nextTest(e.target);
+  } 
 }
 
 var testcases;
 function nextTest(testframe) {
   var test = 0;
   try {
-    if (gTokenizerMode) {
-      // For tokenizer tests, testcases.next() return an extra paramter,
-      // the index of the test.  The dataURL points to a server-side js
-      // that returns the test data.
-      var [index, input, output, errors, description, expectedTokenizerOutput]
-        = testcases.next();
-      dataURL = "tokenizer_file_server.sjs?" + index + 
-        "&" + gTokenizerTestFile;
-    } else {
-      var [input, output, errors, description, expectedTokenizerOutput] = 
-        testcases.next();
-      dataURL = "data:text/html;base64," + btoa(input);
-    }
-    testframe.onload = makeTestChecker(input, output, errors, description,
-      expectedTokenizerOutput);
+    var [input, output, errors] = testcases.next();
+    dataURL = "data:text/html;base64," + btoa(input);
+    testframe.onload = makeTestChecker(input, output, errors);
     testframe.src = dataURL;
   } catch (err if err instanceof StopIteration) {
-    // restore the original value of html5.enable if it was changed earlier
-    if (typeof(gOriginalHtml5Pref) == "boolean") {
-      netscape.security.PrivilegeManager
-                  .enablePrivilege("UniversalXPConnect");
-      var prefs = Components.classes["@mozilla.org/preferences-service;1"]
-                  .getService(Components.interfaces.nsIPrefBranch);
-      prefs.setBoolPref("html5.enable", gOriginalHtml5Pref);
-    }
     SimpleTest.finish();
   }
 }
 
 var framesLoaded = [];
 function frameLoaded(e) {
   framesLoaded.push(e.target);
   if (framesLoaded.length == parserDatFiles.length) {
@@ -184,41 +116,19 @@ function frameLoaded(e) {
     //SimpleTest.finish();
   }
 }
 
 /**
  * Create an iframe for each dat file
  */
 function makeIFrames() {
-  // Set JavaScript compatibility mode if the function 
-  // window.parseHtmlDocument exists.
-  gJSCompatibilityMode = typeof(window.parseHtmlDocument) != "undefined";
-
-  if (gTokenizerMode) {
-    // For tokenizer tests, no additional frames need to be created.
-    appendChildNodes($("display"), BR(), "Results: ", HR());
-    testcases = test_parser(tokenizerTests["tests"]);    
-    nextTest($("testframe"));
+  for each (var filename in parserDatFiles) {
+    var datFrame = document.createElement("iframe");
+    datFrame.onload = frameLoaded;
+    datFrame.src = filename;
+    $("display").appendChild(datFrame);
   }
-  else {
-    for each (var filename in parserDatFiles) {
-      var datFrame = document.createElement("iframe");
-      datFrame.onload = frameLoaded;
-      datFrame.src = filename;
-      $("display").appendChild(datFrame);
-    }
-    appendChildNodes($("display"), BR(), "Results: ", HR());
-  }
+  appendChildNodes($("display"), BR(), "Results: ", HR());
 }
 
-// If gTokenizerMode is undefined, set it to false: this
-// isn't a tokenizer test.
-if (typeof(gTokenizerMode) == "undefined") {
-  gTokenizerMode = false;
-}
-
-// Global variable indicating whether or not the tests should
-// be run in JavaScript compatibility mode.
-var gJSCompatibilityMode;
-
 addLoadEvent(makeIFrames);
 SimpleTest.waitForExplicitFinish();
--- a/parser/htmlparser/tests/mochitest/regressions.txt
+++ b/parser/htmlparser/tests/mochitest/regressions.txt
@@ -1,34 +1,34 @@
 #data
 <!DOCTYPE html><html><head><noscript></noscript><style></style></head><frameset></frameset>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |     <noscript>
 |     <style>
 |   <frameset>
 
 #data
 <!DOCTYPE html><html><head><link><body></body></html>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |     <link>
 |   <body>
 
 #data
 <!DOCTYPE html><html><link><body>#</body></html>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |     <link>
 |   <body>
 |     "#"
 
 #data
 <body><body><base><link><meta><title><p></title><body><p>#</body>
@@ -56,17 +56,17 @@ 54: unexpected body element start tag
 <!doctype html><body><title>X</title><meta name=y><link rel=foo><style>
 x { content:"</style" } </style>
 #errors
 Unexpected start tag that belongs in head.
 Unexpected start tag that belongs in head.
 Unexpected start tag that belongs in head.
 Expected closing tag after </.
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |     <title>
 |       "X"
 |     <meta>
 |       name="y"
 |   <body>
 |     <link>
@@ -74,112 +74,112 @@ Expected closing tag after </.
 |     <style>
 |       "
 x { content:"</style" } "
 
 #data
 <!DOCTYPE html><body><table><tr><td></td><input><td></td></tr></table></body>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <input>
 |     <table>
 |       <tbody>
 |         <tr>
 |           <td>
 |           <td>
 
 #data
 <!DOCTYPE html><body><table><tr><td></td><input type="hidden"><td></td></tr></table></body>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <table>
 |       <tbody>
 |         <tr>
 |           <td>
 |           <input>
 |             type="hidden"
 |           <td>
 
 #data
 <!DOCTYPE html><body><table><tr><td></td><input tYPe="	hiDDen	"><td></td></tr></table></body>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <table>
 |       <tbody>
 |         <tr>
 |           <td>
 |           <input>
 |             type="hiDDen"
 |           <td>
 
 #data
 <!DOCTYPE html><body><table><tr><td></td><input tYPe="  hiDDen  "><td></td></tr></table></body>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <input>
 |       type="  hiDDen  "
 |     <table>
 |       <tbody>
 |         <tr>
 |           <td>
 |           <td>
 
 #data
 <!DOCTYPE html><body><table><tr><td></td><input type="text" type="hidden"><td></td></tr></table></body>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <input>
 |       type="text"
 |     <table>
 |       <tbody>
 |         <tr>
 |           <td>
 |           <td>
 
 #data
 <!DOCTYPE html><body><table><tr><td></td><input type="hidden" type="text"><td></td></tr></table></body>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <table>
 |       <tbody>
 |         <tr>
 |           <td>
 |           <input>
 |             type="hidden"
 |           <td>
 
 #data
 <!DOCTYPE html><body><table><tr><td></td><input id="one"><input type="hidden"><input id="two"><td></td></tr></table></body>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <input>
 |       id="one"
 |     <input>
 |       id="two"
 |     <table>
@@ -189,17 +189,17 @@ x { content:"</style" } "
 |           <input>
 |             type="hidden"
 |           <td>
 
 #data
 <!DOCTYPE html><body><table><tr><td></td><input id="one" type="hidden"><input id="two"><input id="three" type="hidden"><td></td></tr></table></body>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <input>
 |       id="two"
 |     <table>
 |       <tbody>
 |         <tr>
@@ -211,217 +211,216 @@ x { content:"</style" } "
 |             type="hidden"
 |             id="three"
 |           <td>
 
 #data
 <!DOCTYPE html><body><table><input><tr><td></td><td></td></tr></table></body>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <input>
 |     <table>
 |       <tbody>
 |         <tr>
 |           <td>
 |           <td>
 
 #data
 <!DOCTYPE html><body><table><input type="hidden"><tr><td></td><td></td></tr></table></body>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <table>
 |       <input>
 |         type="hidden"
 |       <tbody>
 |         <tr>
 |           <td>
 |           <td>
 
 #data
 <!DOCTYPE html><body><table><tbody><input><tr><td></td><td></td></tr></tbody></table></body>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <input>
 |     <table>
 |       <tbody>
 |         <tr>
 |           <td>
 |           <td>
 
 #data
 <!DOCTYPE html><body><table><tbody><input type="hidden"><tr><td></td><td></td></tr></tbody></table></body>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <table>
 |       <tbody>
 |         <input>
 |           type="hidden"
 |         <tr>
 |           <td>
 |           <td>
 
 #data
 <!DOCTYPE html><body><table><thead><input><tr><td></td><td></td></tr></thead></table></body>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <input>
 |     <table>
 |       <thead>
 |         <tr>
 |           <td>
 |           <td>
 
 #data
 <!DOCTYPE html><body><table><thead><input type="hidden"><tr><td></td><td></td></tr></thead></table></body>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <table>
 |       <thead>
 |         <input>
 |           type="hidden"
 |         <tr>
 |           <td>
 |           <td>
 
 #data
 <!DOCTYPE html><body><table><tfoot><input><tr><td></td><td></td></tr></tfoot></table></body>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <input>
 |     <table>
 |       <tfoot>
 |         <tr>
 |           <td>
 |           <td>
 
 #data
 <!DOCTYPE html><body><table><tfoot><input type="hidden"><tr><td></td><td></td></tr></tfoot></table></body>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <table>
 |       <tfoot>
 |         <input>
 |           type="hidden"
 |         <tr>
 |           <td>
 |           <td>
 
 #data
 <!DOCTYPE html><html><head></head><form><input></form><frameset rows="*"><frame></frameset></html>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <frameset>
 |     rows="*"
 |     <frame>
 
 #data
 <!DOCTYPE html><html><head></head><form><input type="text"></form><frameset rows="*"><frame></frameset></html>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <form>
 |       <input>
 |         type="text"
 
 #data
 <!DOCTYPE html><html><head></head><form><input type="hidden"></form><frameset rows="*"><frame></frameset></html>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <frameset>
 |     rows="*"
 |     <frame>
 
 #data
 <!DOCTYPE html><html><head></head><form><input tYpE="	HIdDen	"></form><frameset rows="*"><frame></frameset></html>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <frameset>
 |     rows="*"
 |     <frame>
 
 #data
 <!DOCTYPE html><html><body><table><link><tr><td>Hi!</td></tr></table></html>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <table>
 |       <link>
 |       <tbody>
 |         <tr>
 |           <td>
 |             "Hi!"
 
 #data
 <!DOCTYPE html><html><body><table><style>td { color: green }</style><tr><td>Hi!</tr></td></table>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <table>
 |       <style>
 |         "td { color: green }"
 |       <tbody>
 |         <tr>
 |           <td>
 |             "Hi!"
-
 #data
 <!DOCTYPE html><html><head></head><form><input type=" hidden"></form><frameset rows="*"><frame></frameset></html>
 #errors
 #document
-| <!DOCTYPE html>
+| <!DOCTYPE HTML>
 | <html>
 |   <head>
 |   <body>
 |     <form>
 |       <input>
 |         type=" hidden"
 
 #data
--- a/parser/htmlparser/tests/mochitest/test_html5_tree_construction.html
+++ b/parser/htmlparser/tests/mochitest/test_html5_tree_construction.html
@@ -10,38 +10,20 @@ https://bugzilla.mozilla.org/show_bug.cg
 	  src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" 
         href="/tests/SimpleTest/test.css" /> 
   <script type="application/javascript;version=1.7"
           src="parser_datreader.js"></script>
   <script type="application/javascript"
           src="html5_tree_construction_exceptions.js"></script>
   <script class="testbody" type="application/javascript;version=1.7">
-   var parserDatFiles = ["html5lib_tree_dat1.txt",
+   var parserDatFiles = ["html5lib_tree_dat1.txt", 
                          "html5lib_tree_dat2.txt",
                          "html5lib_tree_dat3.txt",
-                         "html5lib_tree_dat5.txt",
-                         "html5lib_tree_dat6.txt",
-                         "html5lib_tree_dat7.txt",
-                         "html5lib_tree_dat8.txt",
-                         "html5lib_tree_dat9.txt",
-                         "html5lib_tree_dat10.txt",
-                         "html5lib_tree_dat11.txt",
-                         "html5lib_tree_dat12.txt",
-                         "html5lib_tree_dat14.txt",
-                         "regressions.txt"
-                         ];
-                  
-   netscape.security.PrivilegeManager.
-            enablePrivilege("UniversalXPConnect");
-   var prefs = Components.classes["@mozilla.org/preferences-service;1"]
-            .getService(Components.interfaces.nsIPrefBranch);
-   var gOriginalHtml5Pref = prefs.getBoolPref("html5.enable");
-   prefs.setBoolPref("html5.enable", true);
-
+                         "regressions.txt"];
   </script>
   <script type="application/javascript;version=1.7"
           src="parser_web_testrunner.js"></script>
 </head>
 <body>
 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=366936"
    target="_blank">Mozilla Bug 366936</a>
 <div id="content">