JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
cleanup file/function names
authorJason Woofenden <jason@jasonwoof.com>
Fri, 22 Jan 2016 01:09:28 +0000 (20:09 -0500)
committerJason Woofenden <jason@jasonwoof.com>
Fri, 22 Jan 2016 01:09:28 +0000 (20:09 -0500)
14 files changed:
.gitignore
COPYING.txt
Makefile
README.md
editor.coffee [new file with mode: 0644]
editor_tests_coffee.html [new file with mode: 0644]
html5-named-entities.coffee [deleted file]
parse-html.coffee [deleted file]
parser.coffee [new file with mode: 0644]
parser_no_browser_helper.coffee [new file with mode: 0644]
parser_tests.coffee [new file with mode: 0644]
parser_tests.html
parser_tests_coffee.html
test.coffee [deleted file]

index cccce55..de3b8f4 100644 (file)
@@ -1,3 +1,3 @@
-/html5-named-entities.js
-/parse-html.js
-/test.js
+/parser.js
+/parser_no_browser_helper.js
+/parser_tests.js
index 38e2973..4cd8ad4 100644 (file)
@@ -1,7 +1,7 @@
 A couple files have their own licensing terms, see the top of these files for
 details:
 
-       test.coffee
+       parser_tests.coffee
        coffee-script.js
 
 Unless otherwise noted at the top of the file, all other files in this project
index 5ae1b2b..f2fef49 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
-OBJECTS= parse-html.js test.js html5-named-entities.js
+OBJECTS= parser.js parser_tests.js parser_no_browser_helper.js
 all: $(OBJECTS)
 
 %.js: %.coffee
-       coffee -c $< && sed -i -e 's/\(parse-html\|html5-named-entities\)[.]coffee/\1.js/g' $@
+       coffee -c $< && sed -i -e 's/\(parser\|parser_no_browser_helper\)[.]coffee/\1.js/g' $@
 
 clean:
        rm -f $(OBJECTS)
index 02020d6..af50f19 100644 (file)
--- a/README.md
+++ b/README.md
@@ -28,7 +28,7 @@ Quick Start Guide
 
 4.     Try running the parser in the console, example:
 
-               window.wheic.parse_html("<p>foo</p>", {fragment: "body"})
+               window.wheic_parser.parse("<p>foo</p>", {fragment: "body"})
 
 For further reading, see "Running Under node.js" below.
 
@@ -55,25 +55,25 @@ Now you can do any of these things in any order:
 
 *      Run the tests directly from CoffeeScript:
 
-               coffee test.coffee
+               coffee parser_tests.coffee
 
 *      Test the compiled (javascript) parser in your favorite browser by opening
        up ``parser_tests.html`` and looking at the console.
 
 *      Run tests via compiled code:
 
-               nodejs test.js
+               nodejs parser_tests.js
 
 *      Try using the parser in your own javascript node.js project:
 
-               var wheic = require('./parse-html.js');
-               var dom = wheic.parse_html("<p>hi</p>", {fragment: 'body'});
+               var html5 = require('./parser.js');
+               var dom = html5.parse("<p>hi</p>", {fragment: 'body'});
                ...
 
 *      Try using the parser in your own CoffeeScript node.js project:
 
-               wheic = require './parse-html.js'
-               dom = wheic.parse_html "<p>hi</p>", fragment: 'body'
+               html5 = require './parser.js'
+               dom = html5.parse "<p>hi</p>", fragment: 'body'
                ...
 
        Note: the CoffeeScript compile time is significant, so you'll want to use
diff --git a/editor.coffee b/editor.coffee
new file mode 100644 (file)
index 0000000..4de3b81
--- /dev/null
@@ -0,0 +1,16 @@
+# Copyright 2015 Jason Woofenden
+# This file implements an WYSIWYG editor in the browser (no contenteditable)
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
diff --git a/editor_tests_coffee.html b/editor_tests_coffee.html
new file mode 100644 (file)
index 0000000..3e0a005
--- /dev/null
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+       <meta charset="UTF-8">
+       <link rel="icon" href="data:;base64,iVBORw0KGgo=">
+       <title>html parser tester</title>
+</head>
+<body>
+       <h1>WHEIC editor test page (CoffeeScript version)</h1>
+       <p>This version of the test page compiles the CoffeeScript files in the browser. This is slower to load, but saves you having to rebuild as you work (or even install CoffeeScript).</p>
+       <form action="#" method="get">
+       <p><textarea rows="9" cols="22" name="test_wysiwyg">&lt;p&gt;Normal &lt;strong&gt;Bold &lt;em&gt; Italic+Bold&lt;/strong&gt; Italic&lt;/em&gt; Normal&lt;/p&gt;</textarea></p>
+               
+       </form>
+       <script src="parser.coffee" type="text/coffeescript"></script>
+       <script src="editor.coffee" type="text/coffeescript"></script>
+       <script src="coffee-script.js"></script>
+</body>
+</html>
diff --git a/html5-named-entities.coffee b/html5-named-entities.coffee
deleted file mode 100644 (file)
index afec2f7..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-# This module exports a single function which will decode any of the character
-# references that have a terminating semicolon from the html5 spec at
-# https://www.w3.org/TR/html5/entities.json
-# Do not include the "&" or ";" in your argument, eg pass "alpha"
-module.exports = (txt) ->
-       return named_entities_with_terminators[txt] ? null
-named_entities_with_terminators = {"Aacute":"Á","aacute":"á","Abreve":"Ă","abreve":"ă","ac":"∾","acd":"∿","acE":"∾̳","Acirc":"Â","acirc":"â","acute":"´","Acy":"А","acy":"а","AElig":"Æ","aelig":"æ","af":"⁡","Afr":"𝔄","afr":"𝔞","Agrave":"À","agrave":"à","alefsym":"ℵ","aleph":"ℵ","Alpha":"Α","alpha":"α","Amacr":"Ā","amacr":"ā","amalg":"⨿","AMP":"&","amp":"&","And":"⩓","and":"∧","andand":"⩕","andd":"⩜","andslope":"⩘","andv":"⩚","ang":"∠","ange":"⦤","angle":"∠","angmsd":"∡","angmsdaa":"⦨","angmsdab":"⦩","angmsdac":"⦪","angmsdad":"⦫","angmsdae":"⦬","angmsdaf":"⦭","angmsdag":"⦮","angmsdah":"⦯","angrt":"∟","angrtvb":"⊾","angrtvbd":"⦝","angsph":"∢","angst":"Å","angzarr":"⍼","Aogon":"Ą","aogon":"ą","Aopf":"𝔸","aopf":"𝕒","ap":"≈","apacir":"⩯","apE":"⩰","ape":"≊","apid":"≋","apos":"'","ApplyFunction":"⁡","approx":"≈","approxeq":"≊","Aring":"Å","aring":"å","Ascr":"𝒜","ascr":"𝒶","Assign":"≔","ast":"*","asymp":"≈","asympeq":"≍","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","awconint":"∳","awint":"⨑","backcong":"≌","backepsilon":"϶","backprime":"‵","backsim":"∽","backsimeq":"⋍","Backslash":"∖","Barv":"⫧","barvee":"⊽","Barwed":"⌆","barwed":"⌅","barwedge":"⌅","bbrk":"⎵","bbrktbrk":"⎶","bcong":"≌","Bcy":"Б","bcy":"б","bdquo":"„","becaus":"∵","Because":"∵","because":"∵","bemptyv":"⦰","bepsi":"϶","bernou":"ℬ","Bernoullis":"ℬ","Beta":"Β","beta":"β","beth":"ℶ","between":"≬","Bfr":"𝔅","bfr":"𝔟","bigcap":"⋂","bigcirc":"◯","bigcup":"⋃","bigodot":"⨀","bigoplus":"⨁","bigotimes":"⨂","bigsqcup":"⨆","bigstar":"★","bigtriangledown":"▽","bigtriangleup":"△","biguplus":"⨄","bigvee":"⋁","bigwedge":"⋀","bkarow":"⤍","blacklozenge":"⧫","blacksquare":"▪","blacktriangle":"▴","blacktriangledown":"▾","blacktriangleleft":"◂","blacktriangleright":"▸","blank":"␣","blk12":"▒","blk14":"░","blk34":"▓","block":"█","bne":"=⃥","bnequiv":"≡⃥","bNot":"⫭","bnot":"⌐","Bopf":"𝔹","bopf":"𝕓","bot":"⊥","bottom":"⊥","bowtie":"⋈","boxbox":"⧉","boxDL":"╗","boxDl":"╖","boxdL":"╕","boxdl":"┐","boxDR":"╔","boxDr":"╓","boxdR":"╒","boxdr":"┌","boxH":"═","boxh":"─","boxHD":"╦","boxHd":"╤","boxhD":"╥","boxhd":"┬","boxHU":"╩","boxHu":"╧","boxhU":"╨","boxhu":"┴","boxminus":"⊟","boxplus":"⊞","boxtimes":"⊠","boxUL":"╝","boxUl":"╜","boxuL":"╛","boxul":"┘","boxUR":"╚","boxUr":"╙","boxuR":"╘","boxur":"└","boxV":"║","boxv":"│","boxVH":"╬","boxVh":"╫","boxvH":"╪","boxvh":"┼","boxVL":"╣","boxVl":"╢","boxvL":"╡","boxvl":"┤","boxVR":"╠","boxVr":"╟","boxvR":"╞","boxvr":"├","bprime":"‵","Breve":"˘","breve":"˘","brvbar":"¦","Bscr":"ℬ","bscr":"𝒷","bsemi":"⁏","bsim":"∽","bsime":"⋍","bsol":"\\","bsolb":"⧅","bsolhsub":"⟈","bull":"•","bullet":"•","bump":"≎","bumpE":"⪮","bumpe":"≏","Bumpeq":"≎","bumpeq":"≏","Cacute":"Ć","cacute":"ć","Cap":"⋒","cap":"∩","capand":"⩄","capbrcup":"⩉","capcap":"⩋","capcup":"⩇","capdot":"⩀","CapitalDifferentialD":"ⅅ","caps":"∩︀","caret":"⁁","caron":"ˇ","Cayleys":"ℭ","ccaps":"⩍","Ccaron":"Č","ccaron":"č","Ccedil":"Ç","ccedil":"ç","Ccirc":"Ĉ","ccirc":"ĉ","Cconint":"∰","ccups":"⩌","ccupssm":"⩐","Cdot":"Ċ","cdot":"ċ","cedil":"¸","Cedilla":"¸","cemptyv":"⦲","cent":"¢","CenterDot":"·","centerdot":"·","Cfr":"ℭ","cfr":"𝔠","CHcy":"Ч","chcy":"ч","check":"✓","checkmark":"✓","Chi":"Χ","chi":"χ","cir":"○","circ":"ˆ","circeq":"≗","circlearrowleft":"↺","circlearrowright":"↻","circledast":"⊛","circledcirc":"⊚","circleddash":"⊝","CircleDot":"⊙","circledR":"®","circledS":"Ⓢ","CircleMinus":"⊖","CirclePlus":"⊕","CircleTimes":"⊗","cirE":"⧃","cire":"≗","cirfnint":"⨐","cirmid":"⫯","cirscir":"⧂","ClockwiseContourIntegral":"∲","CloseCurlyDoubleQuote":"”","CloseCurlyQuote":"’","clubs":"♣","clubsuit":"♣","Colon":"∷","colon":":","Colone":"⩴","colone":"≔","coloneq":"≔","comma":",","commat":"@","comp":"∁","compfn":"∘","complement":"∁","complexes":"ℂ","cong":"≅","congdot":"⩭","Congruent":"≡","Conint":"∯","conint":"∮","ContourIntegral":"∮","Copf":"ℂ","copf":"𝕔","coprod":"∐","Coproduct":"∐","COPY":"©","copy":"©","copysr":"℗","CounterClockwiseContourIntegral":"∳","crarr":"↵","Cross":"⨯","cross":"✗","Cscr":"𝒞","cscr":"𝒸","csub":"⫏","csube":"⫑","csup":"⫐","csupe":"⫒","ctdot":"⋯","cudarrl":"⤸","cudarrr":"⤵","cuepr":"⋞","cuesc":"⋟","cularr":"↶","cularrp":"⤽","Cup":"⋓","cup":"∪","cupbrcap":"⩈","CupCap":"≍","cupcap":"⩆","cupcup":"⩊","cupdot":"⊍","cupor":"⩅","cups":"∪︀","curarr":"↷","curarrm":"⤼","curlyeqprec":"⋞","curlyeqsucc":"⋟","curlyvee":"⋎","curlywedge":"⋏","curren":"¤","curvearrowleft":"↶","curvearrowright":"↷","cuvee":"⋎","cuwed":"⋏","cwconint":"∲","cwint":"∱","cylcty":"⌭","Dagger":"‡","dagger":"†","daleth":"ℸ","Darr":"↡","dArr":"⇓","darr":"↓","dash":"‐","Dashv":"⫤","dashv":"⊣","dbkarow":"⤏","dblac":"˝","Dcaron":"Ď","dcaron":"ď","Dcy":"Д","dcy":"д","DD":"ⅅ","dd":"ⅆ","ddagger":"‡","ddarr":"⇊","DDotrahd":"⤑","ddotseq":"⩷","deg":"°","Del":"∇","Delta":"Δ","delta":"δ","demptyv":"⦱","dfisht":"⥿","Dfr":"𝔇","dfr":"𝔡","dHar":"⥥","dharl":"⇃","dharr":"⇂","DiacriticalAcute":"´","DiacriticalDot":"˙","DiacriticalDoubleAcute":"˝","DiacriticalGrave":"`","DiacriticalTilde":"˜","diam":"⋄","Diamond":"⋄","diamond":"⋄","diamondsuit":"♦","diams":"♦","die":"¨","DifferentialD":"ⅆ","digamma":"ϝ","disin":"⋲","div":"÷","divide":"÷","divideontimes":"⋇","divonx":"⋇","DJcy":"Ђ","djcy":"ђ","dlcorn":"⌞","dlcrop":"⌍","dollar":"$","Dopf":"𝔻","dopf":"𝕕","Dot":"¨","dot":"˙","DotDot":"⃜","doteq":"≐","doteqdot":"≑","DotEqual":"≐","dotminus":"∸","dotplus":"∔","dotsquare":"⊡","doublebarwedge":"⌆","DoubleContourIntegral":"∯","DoubleDot":"¨","DoubleDownArrow":"⇓","DoubleLeftArrow":"⇐","DoubleLeftRightArrow":"⇔","DoubleLeftTee":"⫤","DoubleLongLeftArrow":"⟸","DoubleLongLeftRightArrow":"⟺","DoubleLongRightArrow":"⟹","DoubleRightArrow":"⇒","DoubleRightTee":"⊨","DoubleUpArrow":"⇑","DoubleUpDownArrow":"⇕","DoubleVerticalBar":"∥","DownArrow":"↓","Downarrow":"⇓","downarrow":"↓","DownArrowBar":"⤓","DownArrowUpArrow":"⇵","DownBreve":"̑","downdownarrows":"⇊","downharpoonleft":"⇃","downharpoonright":"⇂","DownLeftRightVector":"⥐","DownLeftTeeVector":"⥞","DownLeftVector":"↽","DownLeftVectorBar":"⥖","DownRightTeeVector":"⥟","DownRightVector":"⇁","DownRightVectorBar":"⥗","DownTee":"⊤","DownTeeArrow":"↧","drbkarow":"⤐","drcorn":"⌟","drcrop":"⌌","Dscr":"𝒟","dscr":"𝒹","DScy":"Ѕ","dscy":"ѕ","dsol":"⧶","Dstrok":"Đ","dstrok":"đ","dtdot":"⋱","dtri":"▿","dtrif":"▾","duarr":"⇵","duhar":"⥯","dwangle":"⦦","DZcy":"Џ","dzcy":"џ","dzigrarr":"⟿","Eacute":"É","eacute":"é","easter":"⩮","Ecaron":"Ě","ecaron":"ě","ecir":"≖","Ecirc":"Ê","ecirc":"ê","ecolon":"≕","Ecy":"Э","ecy":"э","eDDot":"⩷","Edot":"Ė","eDot":"≑","edot":"ė","ee":"ⅇ","efDot":"≒","Efr":"𝔈","efr":"𝔢","eg":"⪚","Egrave":"È","egrave":"è","egs":"⪖","egsdot":"⪘","el":"⪙","Element":"∈","elinters":"⏧","ell":"ℓ","els":"⪕","elsdot":"⪗","Emacr":"Ē","emacr":"ē","empty":"∅","emptyset":"∅","EmptySmallSquare":"◻","emptyv":"∅","EmptyVerySmallSquare":"▫","emsp":" ","emsp13":" ","emsp14":" ","ENG":"Ŋ","eng":"ŋ","ensp":" ","Eogon":"Ę","eogon":"ę","Eopf":"𝔼","eopf":"𝕖","epar":"⋕","eparsl":"⧣","eplus":"⩱","epsi":"ε","Epsilon":"Ε","epsilon":"ε","epsiv":"ϵ","eqcirc":"≖","eqcolon":"≕","eqsim":"≂","eqslantgtr":"⪖","eqslantless":"⪕","Equal":"⩵","equals":"=","EqualTilde":"≂","equest":"≟","Equilibrium":"⇌","equiv":"≡","equivDD":"⩸","eqvparsl":"⧥","erarr":"⥱","erDot":"≓","Escr":"ℰ","escr":"ℯ","esdot":"≐","Esim":"⩳","esim":"≂","Eta":"Η","eta":"η","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","euro":"€","excl":"!","exist":"∃","Exists":"∃","expectation":"ℰ","ExponentialE":"ⅇ","exponentiale":"ⅇ","fallingdotseq":"≒","Fcy":"Ф","fcy":"ф","female":"♀","ffilig":"ffi","fflig":"ff","ffllig":"ffl","Ffr":"𝔉","ffr":"𝔣","filig":"fi","FilledSmallSquare":"◼","FilledVerySmallSquare":"▪","fjlig":"fj","flat":"♭","fllig":"fl","fltns":"▱","fnof":"ƒ","Fopf":"𝔽","fopf":"𝕗","ForAll":"∀","forall":"∀","fork":"⋔","forkv":"⫙","Fouriertrf":"ℱ","fpartint":"⨍","frac12":"½","frac13":"⅓","frac14":"¼","frac15":"⅕","frac16":"⅙","frac18":"⅛","frac23":"⅔","frac25":"⅖","frac34":"¾","frac35":"⅗","frac38":"⅜","frac45":"⅘","frac56":"⅚","frac58":"⅝","frac78":"⅞","frasl":"⁄","frown":"⌢","Fscr":"ℱ","fscr":"𝒻","gacute":"ǵ","Gamma":"Γ","gamma":"γ","Gammad":"Ϝ","gammad":"ϝ","gap":"⪆","Gbreve":"Ğ","gbreve":"ğ","Gcedil":"Ģ","Gcirc":"Ĝ","gcirc":"ĝ","Gcy":"Г","gcy":"г","Gdot":"Ġ","gdot":"ġ","gE":"≧","ge":"≥","gEl":"⪌","gel":"⋛","geq":"≥","geqq":"≧","geqslant":"⩾","ges":"⩾","gescc":"⪩","gesdot":"⪀","gesdoto":"⪂","gesdotol":"⪄","gesl":"⋛︀","gesles":"⪔","Gfr":"𝔊","gfr":"𝔤","Gg":"⋙","gg":"≫","ggg":"⋙","gimel":"ℷ","GJcy":"Ѓ","gjcy":"ѓ","gl":"≷","gla":"⪥","glE":"⪒","glj":"⪤","gnap":"⪊","gnapprox":"⪊","gnE":"≩","gne":"⪈","gneq":"⪈","gneqq":"≩","gnsim":"⋧","Gopf":"𝔾","gopf":"𝕘","grave":"`","GreaterEqual":"≥","GreaterEqualLess":"⋛","GreaterFullEqual":"≧","GreaterGreater":"⪢","GreaterLess":"≷","GreaterSlantEqual":"⩾","GreaterTilde":"≳","Gscr":"𝒢","gscr":"ℊ","gsim":"≳","gsime":"⪎","gsiml":"⪐","GT":">","Gt":"≫","gt":">","gtcc":"⪧","gtcir":"⩺","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","Hacek":"ˇ","hairsp":" ","half":"½","hamilt":"ℋ","HARDcy":"Ъ","hardcy":"ъ","hArr":"⇔","harr":"↔","harrcir":"⥈","harrw":"↭","Hat":"^","hbar":"ℏ","Hcirc":"Ĥ","hcirc":"ĥ","hearts":"♥","heartsuit":"♥","hellip":"…","hercon":"⊹","Hfr":"ℌ","hfr":"𝔥","HilbertSpace":"ℋ","hksearow":"⤥","hkswarow":"⤦","hoarr":"⇿","homtht":"∻","hookleftarrow":"↩","hookrightarrow":"↪","Hopf":"ℍ","hopf":"𝕙","horbar":"―","HorizontalLine":"─","Hscr":"ℋ","hscr":"𝒽","hslash":"ℏ","Hstrok":"Ħ","hstrok":"ħ","HumpDownHump":"≎","HumpEqual":"≏","hybull":"⁃","hyphen":"‐","Iacute":"Í","iacute":"í","ic":"⁣","Icirc":"Î","icirc":"î","Icy":"И","icy":"и","Idot":"İ","IEcy":"Е","iecy":"е","iexcl":"¡","iff":"⇔","Ifr":"ℑ","ifr":"𝔦","Igrave":"Ì","igrave":"ì","ii":"ⅈ","iiiint":"⨌","iiint":"∭","iinfin":"⧜","iiota":"℩","IJlig":"IJ","ijlig":"ij","Im":"ℑ","Imacr":"Ī","imacr":"ī","image":"ℑ","ImaginaryI":"ⅈ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","imof":"⊷","imped":"Ƶ","Implies":"⇒","in":"∈","incare":"℅","infin":"∞","infintie":"⧝","inodot":"ı","Int":"∬","int":"∫","intcal":"⊺","integers":"ℤ","Integral":"∫","intercal":"⊺","Intersection":"⋂","intlarhk":"⨗","intprod":"⨼","InvisibleComma":"⁣","InvisibleTimes":"⁢","IOcy":"Ё","iocy":"ё","Iogon":"Į","iogon":"į","Iopf":"𝕀","iopf":"𝕚","Iota":"Ι","iota":"ι","iprod":"⨼","iquest":"¿","Iscr":"ℐ","iscr":"𝒾","isin":"∈","isindot":"⋵","isinE":"⋹","isins":"⋴","isinsv":"⋳","isinv":"∈","it":"⁢","Itilde":"Ĩ","itilde":"ĩ","Iukcy":"І","iukcy":"і","Iuml":"Ï","iuml":"ï","Jcirc":"Ĵ","jcirc":"ĵ","Jcy":"Й","jcy":"й","Jfr":"𝔍","jfr":"𝔧","jmath":"ȷ","Jopf":"𝕁","jopf":"𝕛","Jscr":"𝒥","jscr":"𝒿","Jsercy":"Ј","jsercy":"ј","Jukcy":"Є","jukcy":"є","Kappa":"Κ","kappa":"κ","kappav":"ϰ","Kcedil":"Ķ","kcedil":"ķ","Kcy":"К","kcy":"к","Kfr":"𝔎","kfr":"𝔨","kgreen":"ĸ","KHcy":"Х","khcy":"х","KJcy":"Ќ","kjcy":"ќ","Kopf":"𝕂","kopf":"𝕜","Kscr":"𝒦","kscr":"𝓀","lAarr":"⇚","Lacute":"Ĺ","lacute":"ĺ","laemptyv":"⦴","lagran":"ℒ","Lambda":"Λ","lambda":"λ","Lang":"⟪","lang":"⟨","langd":"⦑","langle":"⟨","lap":"⪅","Laplacetrf":"ℒ","laquo":"«","Larr":"↞","lArr":"⇐","larr":"←","larrb":"⇤","larrbfs":"⤟","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","lat":"⪫","lAtail":"⤛","latail":"⤙","late":"⪭","lates":"⪭︀","lBarr":"⤎","lbarr":"⤌","lbbrk":"❲","lbrace":"{","lbrack":"[","lbrke":"⦋","lbrksld":"⦏","lbrkslu":"⦍","Lcaron":"Ľ","lcaron":"ľ","Lcedil":"Ļ","lcedil":"ļ","lceil":"⌈","lcub":"{","Lcy":"Л","lcy":"л","ldca":"⤶","ldquo":"“","ldquor":"„","ldrdhar":"⥧","ldrushar":"⥋","ldsh":"↲","lE":"≦","le":"≤","LeftAngleBracket":"⟨","LeftArrow":"←","Leftarrow":"⇐","leftarrow":"←","LeftArrowBar":"⇤","LeftArrowRightArrow":"⇆","leftarrowtail":"↢","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVector":"⇃","LeftDownVectorBar":"⥙","LeftFloor":"⌊","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","LeftRightArrow":"↔","Leftrightarrow":"⇔","leftrightarrow":"↔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","LeftRightVector":"⥎","LeftTee":"⊣","LeftTeeArrow":"↤","LeftTeeVector":"⥚","leftthreetimes":"⋋","LeftTriangle":"⊲","LeftTriangleBar":"⧏","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVector":"↿","LeftUpVectorBar":"⥘","LeftVector":"↼","LeftVectorBar":"⥒","lEg":"⪋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","les":"⩽","lescc":"⪨","lesdot":"⩿","lesdoto":"⪁","lesdotor":"⪃","lesg":"⋚︀","lesges":"⪓","lessapprox":"⪅","lessdot":"⋖","lesseqgtr":"⋚","lesseqqgtr":"⪋","LessEqualGreater":"⋚","LessFullEqual":"≦","LessGreater":"≶","lessgtr":"≶","LessLess":"⪡","lesssim":"≲","LessSlantEqual":"⩽","LessTilde":"≲","lfisht":"⥼","lfloor":"⌊","Lfr":"𝔏","lfr":"𝔩","lg":"≶","lgE":"⪑","lHar":"⥢","lhard":"↽","lharu":"↼","lharul":"⥪","lhblk":"▄","LJcy":"Љ","ljcy":"љ","Ll":"⋘","ll":"≪","llarr":"⇇","llcorner":"⌞","Lleftarrow":"⇚","llhard":"⥫","lltri":"◺","Lmidot":"Ŀ","lmidot":"ŀ","lmoust":"⎰","lmoustache":"⎰","lnap":"⪉","lnapprox":"⪉","lnE":"≨","lne":"⪇","lneq":"⪇","lneqq":"≨","lnsim":"⋦","loang":"⟬","loarr":"⇽","lobrk":"⟦","LongLeftArrow":"⟵","Longleftarrow":"⟸","longleftarrow":"⟵","LongLeftRightArrow":"⟷","Longleftrightarrow":"⟺","longleftrightarrow":"⟷","longmapsto":"⟼","LongRightArrow":"⟶","Longrightarrow":"⟹","longrightarrow":"⟶","looparrowleft":"↫","looparrowright":"↬","lopar":"⦅","Lopf":"𝕃","lopf":"𝕝","loplus":"⨭","lotimes":"⨴","lowast":"∗","lowbar":"_","LowerLeftArrow":"↙","LowerRightArrow":"↘","loz":"◊","lozenge":"◊","lozf":"⧫","lpar":"(","lparlt":"⦓","lrarr":"⇆","lrcorner":"⌟","lrhar":"⇋","lrhard":"⥭","lrm":"‎","lrtri":"⊿","lsaquo":"‹","Lscr":"ℒ","lscr":"𝓁","Lsh":"↰","lsh":"↰","lsim":"≲","lsime":"⪍","lsimg":"⪏","lsqb":"[","lsquo":"‘","lsquor":"‚","Lstrok":"Ł","lstrok":"ł","LT":"<","Lt":"≪","lt":"<","ltcc":"⪦","ltcir":"⩹","ltdot":"⋖","lthree":"⋋","ltimes":"⋉","ltlarr":"⥶","ltquest":"⩻","ltri":"◃","ltrie":"⊴","ltrif":"◂","ltrPar":"⦖","lurdshar":"⥊","luruhar":"⥦","lvertneqq":"≨︀","lvnE":"≨︀","macr":"¯","male":"♂","malt":"✠","maltese":"✠","Map":"⤅","map":"↦","mapsto":"↦","mapstodown":"↧","mapstoleft":"↤","mapstoup":"↥","marker":"▮","mcomma":"⨩","Mcy":"М","mcy":"м","mdash":"—","mDDot":"∺","measuredangle":"∡","MediumSpace":" ","Mellintrf":"ℳ","Mfr":"𝔐","mfr":"𝔪","mho":"℧","micro":"µ","mid":"∣","midast":"*","midcir":"⫰","middot":"·","minus":"−","minusb":"⊟","minusd":"∸","minusdu":"⨪","MinusPlus":"∓","mlcp":"⫛","mldr":"…","mnplus":"∓","models":"⊧","Mopf":"𝕄","mopf":"𝕞","mp":"∓","Mscr":"ℳ","mscr":"𝓂","mstpos":"∾","Mu":"Μ","mu":"μ","multimap":"⊸","mumap":"⊸","nabla":"∇","Nacute":"Ń","nacute":"ń","nang":"∠⃒","nap":"≉","napE":"⩰̸","napid":"≋̸","napos":"ʼn","napprox":"≉","natur":"♮","natural":"♮","naturals":"ℕ","nbsp":" ","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","Ncaron":"Ň","ncaron":"ň","Ncedil":"Ņ","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","Ncy":"Н","ncy":"н","ndash":"–","ne":"≠","nearhk":"⤤","neArr":"⇗","nearr":"↗","nearrow":"↗","nedot":"≐̸","NegativeMediumSpace":"​","NegativeThickSpace":"​","NegativeThinSpace":"​","NegativeVeryThinSpace":"​","nequiv":"≢","nesear":"⤨","nesim":"≂̸","NestedGreaterGreater":"≫","NestedLessLess":"≪","NewLine":"\n","nexist":"∄","nexists":"∄","Nfr":"𝔑","nfr":"𝔫","ngE":"≧̸","nge":"≱","ngeq":"≱","ngeqq":"≧̸","ngeqslant":"⩾̸","nges":"⩾̸","nGg":"⋙̸","ngsim":"≵","nGt":"≫⃒","ngt":"≯","ngtr":"≯","nGtv":"≫̸","nhArr":"⇎","nharr":"↮","nhpar":"⫲","ni":"∋","nis":"⋼","nisd":"⋺","niv":"∋","NJcy":"Њ","njcy":"њ","nlArr":"⇍","nlarr":"↚","nldr":"‥","nlE":"≦̸","nle":"≰","nLeftarrow":"⇍","nleftarrow":"↚","nLeftrightarrow":"⇎","nleftrightarrow":"↮","nleq":"≰","nleqq":"≦̸","nleqslant":"⩽̸","nles":"⩽̸","nless":"≮","nLl":"⋘̸","nlsim":"≴","nLt":"≪⃒","nlt":"≮","nltri":"⋪","nltrie":"⋬","nLtv":"≪̸","nmid":"∤","NoBreak":"⁠","NonBreakingSpace":" ","Nopf":"ℕ","nopf":"𝕟","Not":"⫬","not":"¬","NotCongruent":"≢","NotCupCap":"≭","NotDoubleVerticalBar":"∦","NotElement":"∉","NotEqual":"≠","NotEqualTilde":"≂̸","NotExists":"∄","NotGreater":"≯","NotGreaterEqual":"≱","NotGreaterFullEqual":"≧̸","NotGreaterGreater":"≫̸","NotGreaterLess":"≹","NotGreaterSlantEqual":"⩾̸","NotGreaterTilde":"≵","NotHumpDownHump":"≎̸","NotHumpEqual":"≏̸","notin":"∉","notindot":"⋵̸","notinE":"⋹̸","notinva":"∉","notinvb":"⋷","notinvc":"⋶","NotLeftTriangle":"⋪","NotLeftTriangleBar":"⧏̸","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangle":"⋫","NotRightTriangleBar":"⧐̸","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","npar":"∦","nparallel":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","npre":"⪯̸","nprec":"⊀","npreceq":"⪯̸","nrArr":"⇏","nrarr":"↛","nrarrc":"⤳̸","nrarrw":"↝̸","nRightarrow":"⇏","nrightarrow":"↛","nrtri":"⋫","nrtrie":"⋭","nsc":"⊁","nsccue":"⋡","nsce":"⪰̸","Nscr":"𝒩","nscr":"𝓃","nshortmid":"∤","nshortparallel":"∦","nsim":"≁","nsime":"≄","nsimeq":"≄","nsmid":"∤","nspar":"∦","nsqsube":"⋢","nsqsupe":"⋣","nsub":"⊄","nsubE":"⫅̸","nsube":"⊈","nsubset":"⊂⃒","nsubseteq":"⊈","nsubseteqq":"⫅̸","nsucc":"⊁","nsucceq":"⪰̸","nsup":"⊅","nsupE":"⫆̸","nsupe":"⊉","nsupset":"⊃⃒","nsupseteq":"⊉","nsupseteqq":"⫆̸","ntgl":"≹","Ntilde":"Ñ","ntilde":"ñ","ntlg":"≸","ntriangleleft":"⋪","ntrianglelefteq":"⋬","ntriangleright":"⋫","ntrianglerighteq":"⋭","Nu":"Ν","nu":"ν","num":"#","numero":"№","numsp":" ","nvap":"≍⃒","nVDash":"⊯","nVdash":"⊮","nvDash":"⊭","nvdash":"⊬","nvge":"≥⃒","nvgt":">⃒","nvHarr":"⤄","nvinfin":"⧞","nvlArr":"⤂","nvle":"≤⃒","nvlt":"<⃒","nvltrie":"⊴⃒","nvrArr":"⤃","nvrtrie":"⊵⃒","nvsim":"∼⃒","nwarhk":"⤣","nwArr":"⇖","nwarr":"↖","nwarrow":"↖","nwnear":"⤧","Oacute":"Ó","oacute":"ó","oast":"⊛","ocir":"⊚","Ocirc":"Ô","ocirc":"ô","Ocy":"О","ocy":"о","odash":"⊝","Odblac":"Ő","odblac":"ő","odiv":"⨸","odot":"⊙","odsold":"⦼","OElig":"Œ","oelig":"œ","ofcir":"⦿","Ofr":"𝔒","ofr":"𝔬","ogon":"˛","Ograve":"Ò","ograve":"ò","ogt":"⧁","ohbar":"⦵","ohm":"Ω","oint":"∮","olarr":"↺","olcir":"⦾","olcross":"⦻","oline":"‾","olt":"⧀","Omacr":"Ō","omacr":"ō","Omega":"Ω","omega":"ω","Omicron":"Ο","omicron":"ο","omid":"⦶","ominus":"⊖","Oopf":"𝕆","oopf":"𝕠","opar":"⦷","OpenCurlyDoubleQuote":"“","OpenCurlyQuote":"‘","operp":"⦹","oplus":"⊕","Or":"⩔","or":"∨","orarr":"↻","ord":"⩝","order":"ℴ","orderof":"ℴ","ordf":"ª","ordm":"º","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oS":"Ⓢ","Oscr":"𝒪","oscr":"ℴ","Oslash":"Ø","oslash":"ø","osol":"⊘","Otilde":"Õ","otilde":"õ","Otimes":"⨷","otimes":"⊗","otimesas":"⨶","Ouml":"Ö","ouml":"ö","ovbar":"⌽","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","par":"∥","para":"¶","parallel":"∥","parsim":"⫳","parsl":"⫽","part":"∂","PartialD":"∂","Pcy":"П","pcy":"п","percnt":"%","period":".","permil":"‰","perp":"⊥","pertenk":"‱","Pfr":"𝔓","pfr":"𝔭","Phi":"Φ","phi":"φ","phiv":"ϕ","phmmat":"ℳ","phone":"☎","Pi":"Π","pi":"π","pitchfork":"⋔","piv":"ϖ","planck":"ℏ","planckh":"ℎ","plankv":"ℏ","plus":"+","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plusdo":"∔","plusdu":"⨥","pluse":"⩲","PlusMinus":"±","plusmn":"±","plussim":"⨦","plustwo":"⨧","pm":"±","Poincareplane":"ℌ","pointint":"⨕","Popf":"ℙ","popf":"𝕡","pound":"£","Pr":"⪻","pr":"≺","prap":"⪷","prcue":"≼","prE":"⪳","pre":"⪯","prec":"≺","precapprox":"⪷","preccurlyeq":"≼","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","precsim":"≾","Prime":"″","prime":"′","primes":"ℙ","prnap":"⪹","prnE":"⪵","prnsim":"⋨","prod":"∏","Product":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","Proportion":"∷","Proportional":"∝","propto":"∝","prsim":"≾","prurel":"⊰","Pscr":"𝒫","pscr":"𝓅","Psi":"Ψ","psi":"ψ","puncsp":" ","Qfr":"𝔔","qfr":"𝔮","qint":"⨌","Qopf":"ℚ","qopf":"𝕢","qprime":"⁗","Qscr":"𝒬","qscr":"𝓆","quaternions":"ℍ","quatint":"⨖","quest":"?","questeq":"≟","QUOT":"\"","quot":"\"","rAarr":"⇛","race":"∽̱","Racute":"Ŕ","racute":"ŕ","radic":"√","raemptyv":"⦳","Rang":"⟫","rang":"⟩","rangd":"⦒","range":"⦥","rangle":"⟩","raquo":"»","Rarr":"↠","rArr":"⇒","rarr":"→","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarrfs":"⤞","rarrhk":"↪","rarrlp":"↬","rarrpl":"⥅","rarrsim":"⥴","Rarrtl":"⤖","rarrtl":"↣","rarrw":"↝","rAtail":"⤜","ratail":"⤚","ratio":"∶","rationals":"ℚ","RBarr":"⤐","rBarr":"⤏","rbarr":"⤍","rbbrk":"❳","rbrace":"}","rbrack":"]","rbrke":"⦌","rbrksld":"⦎","rbrkslu":"⦐","Rcaron":"Ř","rcaron":"ř","Rcedil":"Ŗ","rcedil":"ŗ","rceil":"⌉","rcub":"}","Rcy":"Р","rcy":"р","rdca":"⤷","rdldhar":"⥩","rdquo":"”","rdquor":"”","rdsh":"↳","Re":"ℜ","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","rect":"▭","REG":"®","reg":"®","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","rfisht":"⥽","rfloor":"⌋","Rfr":"ℜ","rfr":"𝔯","rHar":"⥤","rhard":"⇁","rharu":"⇀","rharul":"⥬","Rho":"Ρ","rho":"ρ","rhov":"ϱ","RightAngleBracket":"⟩","RightArrow":"→","Rightarrow":"⇒","rightarrow":"→","RightArrowBar":"⇥","RightArrowLeftArrow":"⇄","rightarrowtail":"↣","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVector":"⇂","RightDownVectorBar":"⥕","RightFloor":"⌋","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","RightTee":"⊢","RightTeeArrow":"↦","RightTeeVector":"⥛","rightthreetimes":"⋌","RightTriangle":"⊳","RightTriangleBar":"⧐","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVector":"↾","RightUpVectorBar":"⥔","RightVector":"⇀","RightVectorBar":"⥓","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"‏","rmoust":"⎱","rmoustache":"⎱","rnmid":"⫮","roang":"⟭","roarr":"⇾","robrk":"⟧","ropar":"⦆","Ropf":"ℝ","ropf":"𝕣","roplus":"⨮","rotimes":"⨵","RoundImplies":"⥰","rpar":")","rpargt":"⦔","rppolint":"⨒","rrarr":"⇉","Rrightarrow":"⇛","rsaquo":"›","Rscr":"ℛ","rscr":"𝓇","Rsh":"↱","rsh":"↱","rsqb":"]","rsquo":"’","rsquor":"’","rthree":"⋌","rtimes":"⋊","rtri":"▹","rtrie":"⊵","rtrif":"▸","rtriltri":"⧎","RuleDelayed":"⧴","ruluhar":"⥨","rx":"℞","Sacute":"Ś","sacute":"ś","sbquo":"‚","Sc":"⪼","sc":"≻","scap":"⪸","Scaron":"Š","scaron":"š","sccue":"≽","scE":"⪴","sce":"⪰","Scedil":"Ş","scedil":"ş","Scirc":"Ŝ","scirc":"ŝ","scnap":"⪺","scnE":"⪶","scnsim":"⋩","scpolint":"⨓","scsim":"≿","Scy":"С","scy":"с","sdot":"⋅","sdotb":"⊡","sdote":"⩦","searhk":"⤥","seArr":"⇘","searr":"↘","searrow":"↘","sect":"§","semi":";","seswar":"⤩","setminus":"∖","setmn":"∖","sext":"✶","Sfr":"𝔖","sfr":"𝔰","sfrown":"⌢","sharp":"♯","SHCHcy":"Щ","shchcy":"щ","SHcy":"Ш","shcy":"ш","ShortDownArrow":"↓","ShortLeftArrow":"←","shortmid":"∣","shortparallel":"∥","ShortRightArrow":"→","ShortUpArrow":"↑","shy":"­","Sigma":"Σ","sigma":"σ","sigmaf":"ς","sigmav":"ς","sim":"∼","simdot":"⩪","sime":"≃","simeq":"≃","simg":"⪞","simgE":"⪠","siml":"⪝","simlE":"⪟","simne":"≆","simplus":"⨤","simrarr":"⥲","slarr":"←","SmallCircle":"∘","smallsetminus":"∖","smashp":"⨳","smeparsl":"⧤","smid":"∣","smile":"⌣","smt":"⪪","smte":"⪬","smtes":"⪬︀","SOFTcy":"Ь","softcy":"ь","sol":"/","solb":"⧄","solbar":"⌿","Sopf":"𝕊","sopf":"𝕤","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","Sqrt":"√","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","squ":"□","Square":"□","square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","squarf":"▪","squf":"▪","srarr":"→","Sscr":"𝒮","sscr":"𝓈","ssetmn":"∖","ssmile":"⌣","sstarf":"⋆","Star":"⋆","star":"☆","starf":"★","straightepsilon":"ϵ","straightphi":"ϕ","strns":"¯","Sub":"⋐","sub":"⊂","subdot":"⪽","subE":"⫅","sube":"⊆","subedot":"⫃","submult":"⫁","subnE":"⫋","subne":"⊊","subplus":"⪿","subrarr":"⥹","Subset":"⋐","subset":"⊂","subseteq":"⊆","subseteqq":"⫅","SubsetEqual":"⊆","subsetneq":"⊊","subsetneqq":"⫋","subsim":"⫇","subsub":"⫕","subsup":"⫓","succ":"≻","succapprox":"⪸","succcurlyeq":"≽","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","SuchThat":"∋","Sum":"∑","sum":"∑","sung":"♪","Sup":"⋑","sup":"⊃","sup1":"¹","sup2":"²","sup3":"³","supdot":"⪾","supdsub":"⫘","supE":"⫆","supe":"⊇","supedot":"⫄","Superset":"⊃","SupersetEqual":"⊇","suphsol":"⟉","suphsub":"⫗","suplarr":"⥻","supmult":"⫂","supnE":"⫌","supne":"⊋","supplus":"⫀","Supset":"⋑","supset":"⊃","supseteq":"⊇","supseteqq":"⫆","supsetneq":"⊋","supsetneqq":"⫌","supsim":"⫈","supsub":"⫔","supsup":"⫖","swarhk":"⤦","swArr":"⇙","swarr":"↙","swarrow":"↙","swnwar":"⤪","szlig":"ß","Tab":"\t","target":"⌖","Tau":"Τ","tau":"τ","tbrk":"⎴","Tcaron":"Ť","tcaron":"ť","Tcedil":"Ţ","tcedil":"ţ","Tcy":"Т","tcy":"т","tdot":"⃛","telrec":"⌕","Tfr":"𝔗","tfr":"𝔱","there4":"∴","Therefore":"∴","therefore":"∴","Theta":"Θ","theta":"θ","thetasym":"ϑ","thetav":"ϑ","thickapprox":"≈","thicksim":"∼","ThickSpace":"  ","thinsp":" ","ThinSpace":" ","thkap":"≈","thksim":"∼","THORN":"Þ","thorn":"þ","Tilde":"∼","tilde":"˜","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","times":"×","timesb":"⊠","timesbar":"⨱","timesd":"⨰","tint":"∭","toea":"⤨","top":"⊤","topbot":"⌶","topcir":"⫱","Topf":"𝕋","topf":"𝕥","topfork":"⫚","tosa":"⤩","tprime":"‴","TRADE":"™","trade":"™","triangle":"▵","triangledown":"▿","triangleleft":"◃","trianglelefteq":"⊴","triangleq":"≜","triangleright":"▹","trianglerighteq":"⊵","tridot":"◬","trie":"≜","triminus":"⨺","TripleDot":"⃛","triplus":"⨹","trisb":"⧍","tritime":"⨻","trpezium":"⏢","Tscr":"𝒯","tscr":"𝓉","TScy":"Ц","tscy":"ц","TSHcy":"Ћ","tshcy":"ћ","Tstrok":"Ŧ","tstrok":"ŧ","twixt":"≬","twoheadleftarrow":"↞","twoheadrightarrow":"↠","Uacute":"Ú","uacute":"ú","Uarr":"↟","uArr":"⇑","uarr":"↑","Uarrocir":"⥉","Ubrcy":"Ў","ubrcy":"ў","Ubreve":"Ŭ","ubreve":"ŭ","Ucirc":"Û","ucirc":"û","Ucy":"У","ucy":"у","udarr":"⇅","Udblac":"Ű","udblac":"ű","udhar":"⥮","ufisht":"⥾","Ufr":"𝔘","ufr":"𝔲","Ugrave":"Ù","ugrave":"ù","uHar":"⥣","uharl":"↿","uharr":"↾","uhblk":"▀","ulcorn":"⌜","ulcorner":"⌜","ulcrop":"⌏","ultri":"◸","Umacr":"Ū","umacr":"ū","uml":"¨","UnderBar":"_","UnderBrace":"⏟","UnderBracket":"⎵","UnderParenthesis":"⏝","Union":"⋃","UnionPlus":"⊎","Uogon":"Ų","uogon":"ų","Uopf":"𝕌","uopf":"𝕦","UpArrow":"↑","Uparrow":"⇑","uparrow":"↑","UpArrowBar":"⤒","UpArrowDownArrow":"⇅","UpDownArrow":"↕","Updownarrow":"⇕","updownarrow":"↕","UpEquilibrium":"⥮","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","UpperLeftArrow":"↖","UpperRightArrow":"↗","Upsi":"ϒ","upsi":"υ","upsih":"ϒ","Upsilon":"Υ","upsilon":"υ","UpTee":"⊥","UpTeeArrow":"↥","upuparrows":"⇈","urcorn":"⌝","urcorner":"⌝","urcrop":"⌎","Uring":"Ů","uring":"ů","urtri":"◹","Uscr":"𝒰","uscr":"𝓊","utdot":"⋰","Utilde":"Ũ","utilde":"ũ","utri":"▵","utrif":"▴","uuarr":"⇈","Uuml":"Ü","uuml":"ü","uwangle":"⦧","vangrt":"⦜","varepsilon":"ϵ","varkappa":"ϰ","varnothing":"∅","varphi":"ϕ","varpi":"ϖ","varpropto":"∝","vArr":"⇕","varr":"↕","varrho":"ϱ","varsigma":"ς","varsubsetneq":"⊊︀","varsubsetneqq":"⫋︀","varsupsetneq":"⊋︀","varsupsetneqq":"⫌︀","vartheta":"ϑ","vartriangleleft":"⊲","vartriangleright":"⊳","Vbar":"⫫","vBar":"⫨","vBarv":"⫩","Vcy":"В","vcy":"в","VDash":"⊫","Vdash":"⊩","vDash":"⊨","vdash":"⊢","Vdashl":"⫦","Vee":"⋁","vee":"∨","veebar":"⊻","veeeq":"≚","vellip":"⋮","Verbar":"‖","verbar":"|","Vert":"‖","vert":"|","VerticalBar":"∣","VerticalLine":"|","VerticalSeparator":"❘","VerticalTilde":"≀","VeryThinSpace":" ","Vfr":"𝔙","vfr":"𝔳","vltri":"⊲","vnsub":"⊂⃒","vnsup":"⊃⃒","Vopf":"𝕍","vopf":"𝕧","vprop":"∝","vrtri":"⊳","Vscr":"𝒱","vscr":"𝓋","vsubnE":"⫋︀","vsubne":"⊊︀","vsupnE":"⫌︀","vsupne":"⊋︀","Vvdash":"⊪","vzigzag":"⦚","Wcirc":"Ŵ","wcirc":"ŵ","wedbar":"⩟","Wedge":"⋀","wedge":"∧","wedgeq":"≙","weierp":"℘","Wfr":"𝔚","wfr":"𝔴","Wopf":"𝕎","wopf":"𝕨","wp":"℘","wr":"≀","wreath":"≀","Wscr":"𝒲","wscr":"𝓌","xcap":"⋂","xcirc":"◯","xcup":"⋃","xdtri":"▽","Xfr":"𝔛","xfr":"𝔵","xhArr":"⟺","xharr":"⟷","Xi":"Ξ","xi":"ξ","xlArr":"⟸","xlarr":"⟵","xmap":"⟼","xnis":"⋻","xodot":"⨀","Xopf":"𝕏","xopf":"𝕩","xoplus":"⨁","xotime":"⨂","xrArr":"⟹","xrarr":"⟶","Xscr":"𝒳","xscr":"𝓍","xsqcup":"⨆","xuplus":"⨄","xutri":"△","xvee":"⋁","xwedge":"⋀","Yacute":"Ý","yacute":"ý","YAcy":"Я","yacy":"я","Ycirc":"Ŷ","ycirc":"ŷ","Ycy":"Ы","ycy":"ы","yen":"¥","Yfr":"𝔜","yfr":"𝔶","YIcy":"Ї","yicy":"ї","Yopf":"𝕐","yopf":"𝕪","Yscr":"𝒴","yscr":"𝓎","YUcy":"Ю","yucy":"ю","Yuml":"Ÿ","yuml":"ÿ","Zacute":"Ź","zacute":"ź","Zcaron":"Ž","zcaron":"ž","Zcy":"З","zcy":"з","Zdot":"Ż","zdot":"ż","zeetrf":"ℨ","ZeroWidthSpace":"​","Zeta":"Ζ","zeta":"ζ","Zfr":"ℨ","zfr":"𝔷","ZHcy":"Ж","zhcy":"ж","zigrarr":"⇝","Zopf":"ℤ","zopf":"𝕫","Zscr":"𝒵","zscr":"𝓏","zwj":"‍","zwnj":"‌"}
diff --git a/parse-html.coffee b/parse-html.coffee
deleted file mode 100644 (file)
index 362240f..0000000
+++ /dev/null
@@ -1,4746 +0,0 @@
-# HTML parser meant to run in a browser, in support of WYSIWYG editor
-# Copyright 2015 Jason Woofenden
-#
-# This program is free software: you can redistribute it and/or modify it under
-# the terms of the GNU Affero General Public License as published by the Free
-# Software Foundation, either version 3 of the License, or (at your option) any
-# later version.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-
-# This file implements a thorough parser for html5, meant to be used by a
-# WYSIWYG editor.
-
-# The implementation is a pretty direct implementation of the parsing algorithm
-# described here:
-#
-#     http://www.w3.org/TR/html5/syntax.html
-#
-# except for some places marked "WHATWG" that are implemented as described here:
-#
-#     https://html.spec.whatwg.org/multipage/syntax.html
-#
-# This code passes all of the tests in the .dat files at:
-#
-#     https://github.com/JasonWoof/html5lib-tests/tree/patch-1/tree-construction
-
-
-##################################
-## how to use this code
-##################################
-#
-# See README.md for how to run this file in the browser or in node.js.
-#
-# This file exports a single useful function: parse_tml, and some constants
-# (see the bottom of this file for those.)
-#
-# Call it like this:
-#
-#     wheic.parse_html("<p><b>hi</p>")
-#
-# Or, if you don't want <html><head><body>/etc, do this:
-#
-#     wheic.parse_html("<p><b>hi</p>", {fragment: "body"})
-#
-# return value is an array of Nodes, see "class Node" below.
-
-# This code is a work in progress, eg try search this file for "fixfull",
-# "TODO" and "FIXME"
-
-
-# Notes:  stacks/lists
-#
-# Jason was frequently confused by the terminology used to refer to different
-# parts of the stacks and lists in the spec, so he made this chart to help keep
-# his head straight:
-#
-# stacks grow downward (current element is index=0)
-#
-# example: open_els = [a, b, c, d, e, f, g]
-#
-# "grows downwards" means it's visualized like this: (index: el "names")
-#
-#   6: g "start of the list", "topmost", "first"
-#   5: f
-#   4: e "previous" (to d), "above", "before"
-#   3: d   (previous/next are relative to this element)
-#   2: c "next", "after", "lower", "below"
-#   1: b
-#   0: a "end of the list", "current node", "bottommost", "last"
-
-if (typeof module) isnt 'undefined' and module.exports?
-       context = 'module'
-       exports = module.exports
-else
-       context = 'browser'
-       window.wheic = {}
-       exports = window.wheic
-
-from_code_point = (x) ->
-       if String.fromCodePoint?
-               return String.fromCodePoint x
-       else
-               if x <= 0xffff
-                       return String.fromCharCode x
-               x -= 0x10000
-               return String.fromCharCode((x >> 10) + 0xd800, (x % 0x400) + 0xdc00)
-
-# Each node is an obect of the Node class. Here are the Node types:
-TYPE_TAG = 0 # name, {attributes}, [children]
-TYPE_TEXT = 1 # "text"
-TYPE_COMMENT = 2
-TYPE_DOCTYPE = 3
-# the following types are emited by the tokenizer, but shouldn't end up in the tree:
-TYPE_START_TAG = 4 # name, [attributes ([key,value]...) in reverse order], [children]
-TYPE_END_TAG = 5 # name
-TYPE_EOF = 6
-TYPE_AFE_MARKER = 7 # http://www.w3.org/TR/html5/syntax.html#reconstruct-the-active-formatting-elements
-TYPE_AAA_BOOKMARK = 8 # http://www.w3.org/TR/html5/syntax.html#adoption-agency-algorithm
-
-# namespace constants
-NS_HTML = 1
-NS_MATHML = 2
-NS_SVG = 3
-
-# quirks mode constants
-QUIRKS_NO = 1
-QUIRKS_LIMITED = 2
-QUIRKS_YES = 3
-
-# queue up debug logs, so eg they can be shown only for tests that fail
-g_debug_log = []
-debug_log_reset = ->
-       g_debug_log = []
-       return
-debug_log = (str) ->
-       g_debug_log.push str
-       return
-debug_log_each = (cb) ->
-       for str in g_debug_log
-               cb str
-       return
-
-prev_node_id = 0
-class Node
-       constructor: (type, args = {}) ->
-               @type = type # one of the TYPE_* constants above
-               @name = args.name ? '' # tag name
-               @text = args.text ? '' # contents for text/comment nodes
-               @attrs = args.attrs ? {}
-               @attrs_a = args.attr_k ? [] # attrs in progress, TYPE_START_TAG only
-               @children = args.children ? []
-               @namespace = args.namespace ? NS_HTML
-               @parent = args.parent ? null
-               @token = args.token ? null
-               @flags = args.flags ? {}
-               if args.id?
-                       @id = "#{args.id}+"
-               else
-                       @id = "#{++prev_node_id}"
-       acknowledge_self_closing: ->
-               if @token?
-                       @token.flag 'did_self_close', true
-               else
-                       @flag 'did_self_close', true
-               return
-       flag: (key, value = null) ->
-               if value?
-                       @flags[key] = value
-               else
-                       return @flags[key]
-               return
-
-# helpers: (only take args that are normally known when parser creates nodes)
-new_open_tag = (name) ->
-       return new Node TYPE_START_TAG, name: name
-new_end_tag = (name) ->
-       return new Node TYPE_END_TAG, name: name
-new_element = (name) ->
-       return new Node TYPE_TAG, name: name
-new_text_node = (txt) ->
-       return new Node TYPE_TEXT, text: txt
-new_character_token = new_text_node
-new_comment_token = (txt) ->
-       return new Node TYPE_COMMENT, text: txt
-new_doctype_token = (name) ->
-       return new Node TYPE_DOCTYPE, name: name
-new_eof_token = ->
-       return new Node TYPE_EOF
-new_afe_marker = ->
-       return new Node TYPE_AFE_MARKER
-new_aaa_bookmark = ->
-       return new Node TYPE_AAA_BOOKMARK
-
-lc_alpha = "abcdefghijklmnopqrstuvwxyz"
-uc_alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-digits = "0123456789"
-alnum = lc_alpha + uc_alpha + digits
-hex_chars = digits + "abcdefABCDEF"
-
-is_uc_alpha = (str) ->
-       return str.length is 1 and uc_alpha.indexOf(str) > -1
-is_lc_alpha = (str) ->
-       return str.length is 1 and lc_alpha.indexOf(str) > -1
-
-# some SVG elements have dashes in them
-tag_name_chars = alnum + "-"
-
-# http://www.w3.org/TR/html5/infrastructure.html#space-character
-space_chars = "\u0009\u000a\u000c\u000d\u0020"
-is_space = (txt) ->
-       return txt.length is 1 and space_chars.indexOf(txt) > -1
-is_space_tok = (t) ->
-       return t.type is TYPE_TEXT && t.text.length is 1 and space_chars.indexOf(t.text) > -1
-
-is_input_hidden_tok = (t) ->
-       return false unless t.type is TYPE_START_TAG
-       for a in t.attrs_a
-               if a[0] is 'type'
-                       if a[1].toLowerCase() is 'hidden'
-                               return true
-                       return false
-       return false
-
-# https://en.wikipedia.org/wiki/Whitespace_character#Unicode
-whitespace_chars = "\u0009\u000a\u000b\u000c\u000d\u0020\u0085\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000"
-
-unicode_fixes = {}
-unicode_fixes[0x00] = "\uFFFD"
-unicode_fixes[0x80] = "\u20AC"
-unicode_fixes[0x82] = "\u201A"
-unicode_fixes[0x83] = "\u0192"
-unicode_fixes[0x84] = "\u201E"
-unicode_fixes[0x85] = "\u2026"
-unicode_fixes[0x86] = "\u2020"
-unicode_fixes[0x87] = "\u2021"
-unicode_fixes[0x88] = "\u02C6"
-unicode_fixes[0x89] = "\u2030"
-unicode_fixes[0x8A] = "\u0160"
-unicode_fixes[0x8B] = "\u2039"
-unicode_fixes[0x8C] = "\u0152"
-unicode_fixes[0x8E] = "\u017D"
-unicode_fixes[0x91] = "\u2018"
-unicode_fixes[0x92] = "\u2019"
-unicode_fixes[0x93] = "\u201C"
-unicode_fixes[0x94] = "\u201D"
-unicode_fixes[0x95] = "\u2022"
-unicode_fixes[0x96] = "\u2013"
-unicode_fixes[0x97] = "\u2014"
-unicode_fixes[0x98] = "\u02DC"
-unicode_fixes[0x99] = "\u2122"
-unicode_fixes[0x9A] = "\u0161"
-unicode_fixes[0x9B] = "\u203A"
-unicode_fixes[0x9C] = "\u0153"
-unicode_fixes[0x9E] = "\u017E"
-unicode_fixes[0x9F] = "\u0178"
-
-quirks_yes_pi_prefixes = [
-       "+//silmaril//dtd html pro v0r11 19970101//"
-       "-//as//dtd html 3.0 aswedit + extensions//"
-       "-//advasoft ltd//dtd html 3.0 aswedit + extensions//"
-       "-//ietf//dtd html 2.0 level 1//"
-       "-//ietf//dtd html 2.0 level 2//"
-       "-//ietf//dtd html 2.0 strict level 1//"
-       "-//ietf//dtd html 2.0 strict level 2//"
-       "-//ietf//dtd html 2.0 strict//"
-       "-//ietf//dtd html 2.0//"
-       "-//ietf//dtd html 2.1e//"
-       "-//ietf//dtd html 3.0//"
-       "-//ietf//dtd html 3.2 final//"
-       "-//ietf//dtd html 3.2//"
-       "-//ietf//dtd html 3//"
-       "-//ietf//dtd html level 0//"
-       "-//ietf//dtd html level 1//"
-       "-//ietf//dtd html level 2//"
-       "-//ietf//dtd html level 3//"
-       "-//ietf//dtd html strict level 0//"
-       "-//ietf//dtd html strict level 1//"
-       "-//ietf//dtd html strict level 2//"
-       "-//ietf//dtd html strict level 3//"
-       "-//ietf//dtd html strict//"
-       "-//ietf//dtd html//"
-       "-//metrius//dtd metrius presentational//"
-       "-//microsoft//dtd internet explorer 2.0 html strict//"
-       "-//microsoft//dtd internet explorer 2.0 html//"
-       "-//microsoft//dtd internet explorer 2.0 tables//"
-       "-//microsoft//dtd internet explorer 3.0 html strict//"
-       "-//microsoft//dtd internet explorer 3.0 html//"
-       "-//microsoft//dtd internet explorer 3.0 tables//"
-       "-//netscape comm. corp.//dtd html//"
-       "-//netscape comm. corp.//dtd strict html//"
-       "-//o'reilly and associates//dtd html 2.0//"
-       "-//o'reilly and associates//dtd html extended 1.0//"
-       "-//o'reilly and associates//dtd html extended relaxed 1.0//"
-       "-//sq//dtd html 2.0 hotmetal + extensions//"
-       "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//"
-       "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//"
-       "-//spyglass//dtd html 2.0 extended//"
-       "-//sun microsystems corp.//dtd hotjava html//"
-       "-//sun microsystems corp.//dtd hotjava strict html//"
-       "-//w3c//dtd html 3 1995-03-24//"
-       "-//w3c//dtd html 3.2 draft//"
-       "-//w3c//dtd html 3.2 final//"
-       "-//w3c//dtd html 3.2//"
-       "-//w3c//dtd html 3.2s draft//"
-       "-//w3c//dtd html 4.0 frameset//"
-       "-//w3c//dtd html 4.0 transitional//"
-       "-//w3c//dtd html experimental 19960712//"
-       "-//w3c//dtd html experimental 970421//"
-       "-//w3c//dtd w3 html//"
-       "-//w3o//dtd w3 html 3.0//"
-       "-//webtechs//dtd mozilla html 2.0//"
-       "-//webtechs//dtd mozilla html//"
-]
-
-# These are the character references that don't need a terminating semicolon
-# min length: 2, max: 6, none are a prefix of any other.
-legacy_char_refs = {
-       Aacute: 'Á', aacute: 'á', Acirc: 'Â', acirc: 'â', acute: '´', AElig: 'Æ',
-       aelig: 'æ', Agrave: 'À', agrave: 'à', AMP: '&', amp: '&', Aring: 'Å',
-       aring: 'å', Atilde: 'Ã', atilde: 'ã', Auml: 'Ä', auml: 'ä', brvbar: '¦',
-       Ccedil: 'Ç', ccedil: 'ç', cedil: '¸', cent: '¢', COPY: '©', copy: '©',
-       curren: '¤', deg: '°', divide: '÷', Eacute: 'É', eacute: 'é', Ecirc: 'Ê',
-       ecirc: 'ê', Egrave: 'È', egrave: 'è', ETH: 'Ð', eth: 'ð', Euml: 'Ë',
-       euml: 'ë', frac12: '½', frac14: '¼', frac34: '¾', GT: '>', gt: '>',
-       Iacute: 'Í', iacute: 'í', Icirc: 'Î', icirc: 'î', iexcl: '¡', Igrave: 'Ì',
-       igrave: 'ì', iquest: '¿', Iuml: 'Ï', iuml: 'ï', laquo: '«', LT: '<',
-       lt: '<', macr: '¯', micro: 'µ', middot: '·', nbsp: "\u00a0", not: '¬',
-       Ntilde: 'Ñ', ntilde: 'ñ', Oacute: 'Ó', oacute: 'ó', Ocirc: 'Ô', ocirc: 'ô',
-       Ograve: 'Ò', ograve: 'ò', ordf: 'ª', ordm: 'º', Oslash: 'Ø', oslash: 'ø',
-       Otilde: 'Õ', otilde: 'õ', Ouml: 'Ö', ouml: 'ö', para: '¶', plusmn: '±',
-       pound: '£', QUOT: '"', quot: '"', raquo: '»', REG: '®', reg: '®', sect: '§',
-       shy: '­', sup1: '¹', sup2: '²', sup3: '³', szlig: 'ß', THORN: 'Þ', thorn: 'þ',
-       times: '×', Uacute: 'Ú', uacute: 'ú', Ucirc: 'Û', ucirc: 'û', Ugrave: 'Ù',
-       ugrave: 'ù', uml: '¨', Uuml: 'Ü', uuml: 'ü', Yacute: 'Ý', yacute: 'ý',
-       yen: '¥', yuml: 'ÿ'
-}
-
-void_elements = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']
-raw_text_elements = ['script', 'style']
-escapable_raw_text_elements = ['textarea', 'title']
-# http://www.w3.org/TR/SVG/ 1.1 (Second Edition)
-svg_elements = [
-       'a', 'altGlyph', 'altGlyphDef', 'altGlyphItem', 'animate', 'animateColor',
-       'animateMotion', 'animateTransform', 'circle', 'clipPath', 'color-profile',
-       'cursor', 'defs', 'desc', 'ellipse', 'feBlend', 'feColorMatrix',
-       'feComponentTransfer', 'feComposite', 'feConvolveMatrix',
-       'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood',
-       'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage',
-       'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight',
-       'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence', 'filter',
-       'font', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src',
-       'font-face-uri', 'foreignObject', 'g', 'glyph', 'glyphRef', 'hkern',
-       'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata',
-       'missing-glyph', 'mpath', 'path', 'pattern', 'polygon', 'polyline',
-       'radialGradient', 'rect', 'script', 'set', 'stop', 'style', 'svg',
-       'switch', 'symbol', 'text', 'textPath', 'title', 'tref', 'tspan', 'use',
-       'view', 'vkern'
-]
-
-# http://www.w3.org/TR/MathML/ Version 3.0 2nd Edition
-mathml_elements = [
-       'abs', 'and', 'annotation', 'annotation-xml', 'apply', 'approx', 'arccos',
-       'arccosh', 'arccot', 'arccoth', 'arccsc', 'arccsch', 'arcsec', 'arcsech',
-       'arcsin', 'arcsinh', 'arctan', 'arctanh', 'arg', 'bind', 'bvar', 'card',
-       'cartesianproduct', 'cbytes', 'ceiling', 'cerror', 'ci', 'cn', 'codomain',
-       'complexes', 'compose', 'condition', 'conjugate', 'cos', 'cosh', 'cot',
-       'coth', 'cs', 'csc', 'csch', 'csymbol', 'curl', 'declare', 'degree',
-       'determinant', 'diff', 'divergence', 'divide', 'domain',
-       'domainofapplication', 'emptyset', 'eq', 'equivalent', 'eulergamma',
-       'exists', 'exp', 'exponentiale', 'factorial', 'factorof', 'false', 'floor',
-       'fn', 'forall', 'gcd', 'geq', 'grad', 'gt', 'ident', 'image', 'imaginary',
-       'imaginaryi', 'implies', 'in', 'infinity', 'int', 'integers', 'intersect',
-       'interval', 'inverse', 'lambda', 'laplacian', 'lcm', 'leq', 'limit',
-       'list', 'ln', 'log', 'logbase', 'lowlimit', 'lt', 'maction', 'maligngroup',
-       'malignmark', 'math', 'matrix', 'matrixrow', 'max', 'mean', 'median',
-       'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mi', 'min',
-       'minus', 'mlabeledtr', 'mlongdiv', 'mmultiscripts', 'mn', 'mo', 'mode',
-       'moment', 'momentabout', 'mover', 'mpadded', 'mphantom', 'mprescripts',
-       'mroot', 'mrow', 'ms', 'mscarries', 'mscarry', 'msgroup', 'msline',
-       'mspace', 'msqrt', 'msrow', 'mstack', 'mstyle', 'msub', 'msubsup', 'msup',
-       'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'naturalnumbers',
-       'neq', 'none', 'not', 'notanumber', 'notin', 'notprsubset', 'notsubset',
-       'or', 'otherwise', 'outerproduct', 'partialdiff', 'pi', 'piece',
-       'piecewise', 'plus', 'power', 'primes', 'product', 'prsubset', 'quotient',
-       'rationals', 'real', 'reals', 'reln', 'rem', 'root', 'scalarproduct',
-       'sdev', 'sec', 'sech', 'selector', 'semantics', 'sep', 'set', 'setdiff',
-       'share', 'sin', 'sinh', 'span', 'subset', 'sum', 'tan', 'tanh', 'tendsto',
-       'times', 'transpose', 'true', 'union', 'uplimit', 'variance', 'vector',
-       'vectorproduct', 'xor'
-]
-# foreign_elements = [svg_elements..., mathml_elements...]
-#normal_elements = All other allowed HTML elements are normal elements.
-
-special_elements = {
-       # HTML:
-       address:NS_HTML, applet:NS_HTML, area:NS_HTML, article:NS_HTML,
-       aside:NS_HTML, base:NS_HTML, basefont:NS_HTML, bgsound:NS_HTML,
-       blockquote:NS_HTML, body:NS_HTML, br:NS_HTML, button:NS_HTML,
-       caption:NS_HTML, center:NS_HTML, col:NS_HTML, colgroup:NS_HTML, dd:NS_HTML,
-       details:NS_HTML, dir:NS_HTML, div:NS_HTML, dl:NS_HTML, dt:NS_HTML,
-       embed:NS_HTML, fieldset:NS_HTML, figcaption:NS_HTML, figure:NS_HTML,
-       footer:NS_HTML, form:NS_HTML, frame:NS_HTML, frameset:NS_HTML, h1:NS_HTML,
-       h2:NS_HTML, h3:NS_HTML, h4:NS_HTML, h5:NS_HTML, h6:NS_HTML, head:NS_HTML,
-       header:NS_HTML, hgroup:NS_HTML, hr:NS_HTML, html:NS_HTML, iframe:NS_HTML,
-       img:NS_HTML, input:NS_HTML, isindex:NS_HTML, li:NS_HTML, link:NS_HTML,
-       listing:NS_HTML, main:NS_HTML, marquee:NS_HTML,
-
-       menu:NS_HTML,menuitem:NS_HTML, # WHATWG adds these
-
-       meta:NS_HTML, nav:NS_HTML, noembed:NS_HTML, noframes:NS_HTML,
-       noscript:NS_HTML, object:NS_HTML, ol:NS_HTML, p:NS_HTML, param:NS_HTML,
-       plaintext:NS_HTML, pre:NS_HTML, script:NS_HTML, section:NS_HTML,
-       select:NS_HTML, source:NS_HTML, style:NS_HTML, summary:NS_HTML,
-       table:NS_HTML, tbody:NS_HTML, td:NS_HTML, template:NS_HTML,
-       textarea:NS_HTML, tfoot:NS_HTML, th:NS_HTML, thead:NS_HTML, title:NS_HTML,
-       tr:NS_HTML, track:NS_HTML, ul:NS_HTML, wbr:NS_HTML, xmp:NS_HTML,
-
-       # MathML:
-       mi:NS_MATHML, mo:NS_MATHML, mn:NS_MATHML, ms:NS_MATHML, mtext:NS_MATHML,
-       'annotation-xml':NS_MATHML,
-
-       # SVG:
-       foreignObject:NS_SVG, desc:NS_SVG, title:NS_SVG
-}
-
-formatting_elements = {
-        a: true, b: true, big: true, code: true, em: true, font: true, i: true,
-        nobr: true, s: true, small: true, strike: true, strong: true, tt: true,
-        u: true
-}
-
-mathml_text_integration = {
-       mi: NS_MATHML, mo: NS_MATHML, mn: NS_MATHML, ms: NS_MATHML, mtext: NS_MATHML
-}
-is_mathml_text_integration_point = (el) ->
-       return mathml_text_integration[el.name] is el.namespace
-is_html_integration = (el) -> # DON'T PASS A TOKEN
-       if el.namespace is NS_MATHML
-               if el.name is 'annotation-xml'
-                       if el.attrs.encoding?
-                               if el.attrs.encoding.toLowerCase() is 'text/html'
-                                       return true
-                               if el.attrs.encoding.toLowerCase() is 'application/xhtml+xml'
-                                       return true
-               return false
-       if el.namespace is NS_SVG
-               if el.name is 'foreignObject' or el.name is 'desc' or el.name is 'title'
-                       return true
-       return false
-
-h_tags = {
-       h1:NS_HTML, h2:NS_HTML, h3:NS_HTML, h4:NS_HTML, h5:NS_HTML, h6:NS_HTML
-}
-
-foster_parenting_targets = {
-       table: NS_HTML
-       tbody: NS_HTML
-       tfoot: NS_HTML
-       thead: NS_HTML
-       tr: NS_HTML
-}
-
-end_tag_implied = {
-       dd: NS_HTML
-       dt: NS_HTML
-       li: NS_HTML
-       option: NS_HTML
-       optgroup: NS_HTML
-       p: NS_HTML
-       rb: NS_HTML
-       rp: NS_HTML
-       rt: NS_HTML
-       rtc: NS_HTML
-}
-
-el_is_special = (e) ->
-       return special_elements[e.name] is e.namespace
-
-adp_els = { address: NS_HTML, div: NS_HTML, p: NS_HTML }
-el_is_special_not_adp = (el) ->
-       return special_elements[el.name] is el.namespace and adp_els[el.name] isnt el.namespace
-
-svg_name_fixes = {
-       altglyph: 'altGlyph'
-       altglyphdef: 'altGlyphDef'
-       altglyphitem: 'altGlyphItem'
-       animatecolor: 'animateColor'
-       animatemotion: 'animateMotion'
-       animatetransform: 'animateTransform'
-       clippath: 'clipPath'
-       feblend: 'feBlend'
-       fecolormatrix: 'feColorMatrix'
-       fecomponenttransfer: 'feComponentTransfer'
-       fecomposite: 'feComposite'
-       feconvolvematrix: 'feConvolveMatrix'
-       fediffuselighting: 'feDiffuseLighting'
-       fedisplacementmap: 'feDisplacementMap'
-       fedistantlight: 'feDistantLight'
-       fedropshadow: 'feDropShadow'
-       feflood: 'feFlood'
-       fefunca: 'feFuncA'
-       fefuncb: 'feFuncB'
-       fefuncg: 'feFuncG'
-       fefuncr: 'feFuncR'
-       fegaussianblur: 'feGaussianBlur'
-       feimage: 'feImage'
-       femerge: 'feMerge'
-       femergenode: 'feMergeNode'
-       femorphology: 'feMorphology'
-       feoffset: 'feOffset'
-       fepointlight: 'fePointLight'
-       fespecularlighting: 'feSpecularLighting'
-       fespotlight: 'feSpotLight'
-       fetile: 'feTile'
-       feturbulence: 'feTurbulence'
-       foreignobject: 'foreignObject'
-       glyphref: 'glyphRef'
-       lineargradient: 'linearGradient'
-       radialgradient: 'radialGradient'
-       textpath: 'textPath'
-}
-svg_attribute_fixes = {
-       attributename: 'attributeName'
-       attributetype: 'attributeType'
-       basefrequency: 'baseFrequency'
-       baseprofile: 'baseProfile'
-       calcmode: 'calcMode'
-       clippathunits: 'clipPathUnits'
-       contentscripttype: 'contentScriptType'
-       contentstyletype: 'contentStyleType'
-       diffuseconstant: 'diffuseConstant'
-       edgemode: 'edgeMode'
-       externalresourcesrequired: 'externalResourcesRequired'
-       # WHATWG removes this: filterres: 'filterRes'
-       filterunits: 'filterUnits'
-       glyphref: 'glyphRef'
-       gradienttransform: 'gradientTransform'
-       gradientunits: 'gradientUnits'
-       kernelmatrix: 'kernelMatrix'
-       kernelunitlength: 'kernelUnitLength'
-       keypoints: 'keyPoints'
-       keysplines: 'keySplines'
-       keytimes: 'keyTimes'
-       lengthadjust: 'lengthAdjust'
-       limitingconeangle: 'limitingConeAngle'
-       markerheight: 'markerHeight'
-       markerunits: 'markerUnits'
-       markerwidth: 'markerWidth'
-       maskcontentunits: 'maskContentUnits'
-       maskunits: 'maskUnits'
-       numoctaves: 'numOctaves'
-       pathlength: 'pathLength'
-       patterncontentunits: 'patternContentUnits'
-       patterntransform: 'patternTransform'
-       patternunits: 'patternUnits'
-       pointsatx: 'pointsAtX'
-       pointsaty: 'pointsAtY'
-       pointsatz: 'pointsAtZ'
-       preservealpha: 'preserveAlpha'
-       preserveaspectratio: 'preserveAspectRatio'
-       primitiveunits: 'primitiveUnits'
-       refx: 'refX'
-       refy: 'refY'
-       repeatcount: 'repeatCount'
-       repeatdur: 'repeatDur'
-       requiredextensions: 'requiredExtensions'
-       requiredfeatures: 'requiredFeatures'
-       specularconstant: 'specularConstant'
-       specularexponent: 'specularExponent'
-       spreadmethod: 'spreadMethod'
-       startoffset: 'startOffset'
-       stddeviation: 'stdDeviation'
-       stitchtiles: 'stitchTiles'
-       surfacescale: 'surfaceScale'
-       systemlanguage: 'systemLanguage'
-       tablevalues: 'tableValues'
-       targetx: 'targetX'
-       targety: 'targetY'
-       textlength: 'textLength'
-       viewbox: 'viewBox'
-       viewtarget: 'viewTarget'
-       xchannelselector: 'xChannelSelector'
-       ychannelselector: 'yChannelSelector'
-       zoomandpan: 'zoomAndPan'
-}
-foreign_attr_fixes = {
-       'xlink:actuate': 'xlink actuate'
-       'xlink:arcrole': 'xlink arcrole'
-       'xlink:href': 'xlink href'
-       'xlink:role': 'xlink role'
-       'xlink:show': 'xlink show'
-       'xlink:title': 'xlink title'
-       'xlink:type': 'xlink type'
-       'xml:base': 'xml base'
-       'xml:lang': 'xml lang'
-       'xml:space': 'xml space'
-       'xmlns': 'xmlns'
-       'xmlns:xlink': 'xmlns xlink'
-}
-adjust_mathml_attributes = (t) ->
-       for a in t.attrs_a
-               if a[0] is 'definitionurl'
-                       a[0] = 'definitionURL'
-       return
-adjust_svg_attributes = (t) ->
-       for a in t.attrs_a
-               if svg_attribute_fixes[a[0]]?
-                       a[0] = svg_attribute_fixes[a[0]]
-       return
-adjust_foreign_attributes = (t) ->
-       # fixfull
-       for a in t.attrs_a
-               if foreign_attr_fixes[a[0]]?
-                       a[0] = foreign_attr_fixes[a[0]]
-       return
-
-# decode_named_char_ref()
-#
-# The list of named character references is _huge_ so if we're running in a
-# browser, we get the browser to decode them, rather than increasing the code
-# size to include the table.
-if context is 'module'
-       _decode_named_char_ref = require './html5-named-entities.coffee'
-else
-       # TODO test this in IE8
-       decode_named_char_ref_el = document.createElement('textarea')
-       _decode_named_char_ref = (txt) ->
-               txt = "&#{txt};"
-               decode_named_char_ref_el.innerHTML = txt
-               decoded = decode_named_char_ref_el.value
-               return null if decoded is txt
-               return decoded
-# Pass the name of a named entity _that has a terminating semicolon_
-# Entities without terminating semicolons should use legacy_char_refs[]
-# Do not include the "&" or ";" in your argument, eg pass "alpha"
-decode_named_char_ref_cache = {}
-decode_named_char_ref = (txt) ->
-       decoded = decode_named_char_ref_cache[txt]
-       return decoded if decoded?
-       decoded = _decode_named_char_ref txt
-       return decode_named_char_ref_cache[txt] = decoded
-
-parse_html = (args_html, args = {}) ->
-       txt = null
-       cur = null # index of next char in txt to be parsed
-       # declare doc and tokenizer variables so they're in scope below
-       doc = null
-       open_els = null # stack of open elements
-       afe = null # active formatting elements
-       template_ins_modes = null
-       ins_mode = null
-       original_ins_mode = null
-       tok_state = null
-       tok_cur_tag = null # partially parsed tag
-       flag_scripting = null
-       flag_frameset_ok = null
-       flag_parsing = null
-       flag_foster_parenting = null
-       form_element_pointer = null
-       temporary_buffer = null
-       pending_table_character_tokens = null
-       head_element_pointer = null
-       flag_fragment_parsing = null
-       context_element = null
-
-       stop_parsing = ->
-               flag_parsing = false
-               return
-
-       parse_error = ->
-               if args.error_cb?
-                       args.error_cb cur
-               return
-
-       # http://www.w3.org/TR/html5/syntax.html#push-onto-the-list-of-active-formatting-elements
-       # "Noah's Ark clause" but with three
-       afe_push = (new_el) ->
-               matches = 0
-               for el, i in afe
-                       if el.type is TYPE_AFE_MARKER
-                               break
-                       if el.name is new_el.name and el.namespace is new_el.namespace
-                               attrs_match = true
-                               for k, v of el.attrs
-                                       unless new_el.attrs[k] is v
-                                               attrs_match = false
-                                               break
-                               if attrs_match
-                                       for k, v of new_el.attrs
-                                               unless el.attrs[k] is v
-                                                       attrs_match = false
-                                                       break
-                               if attrs_match
-                                       matches += 1
-                                       if matches is 3
-                                               afe.splice i, 1
-                                               break
-               afe.unshift new_el
-               return
-
-       afe_push_marker = ->
-               afe.unshift new_afe_marker()
-               return
-
-       # the functions below impliment the Tree Contstruction algorithm
-       # http://www.w3.org/TR/html5/syntax.html#tree-construction
-
-       # But first... the helpers
-       template_tag_is_open = ->
-               for el in open_els
-                       if el.name is 'template' and el.namespace is NS_HTML
-                               return true
-               return false
-       is_in_scope_x = (tag_name, scope, namespace) ->
-               for el in open_els
-                       if el.name is tag_name and (namespace is null or namespace is el.namespace)
-                               return true
-                       if scope[el.name] is el.namespace
-                               return false
-               return false
-       is_in_scope_x_y = (tag_name, scope, scope2, namespace) ->
-               for el in open_els
-                       if el.name is tag_name and (namespace is null or namespace is el.namespace)
-                               return true
-                       if scope[el.name] is el.namespace
-                               return false
-                       if scope2[el.name] is el.namespace
-                               return false
-               return false
-       standard_scopers = {
-               applet: NS_HTML, caption: NS_HTML, html: NS_HTML, table: NS_HTML,
-               td: NS_HTML, th: NS_HTML, marquee: NS_HTML, object: NS_HTML,
-               template: NS_HTML,
-
-               mi: NS_MATHML, mo: NS_MATHML, mn: NS_MATHML, ms: NS_MATHML,
-               mtext: NS_MATHML, 'annotation-xml': NS_MATHML,
-
-               foreignObject: NS_SVG, desc: NS_SVG, title: NS_SVG
-       }
-       button_scopers = button: NS_HTML
-       li_scopers = ol: NS_HTML, ul: NS_HTML
-       table_scopers = html: NS_HTML, table: NS_HTML, template: NS_HTML
-       is_in_scope = (tag_name, namespace = null) ->
-               return is_in_scope_x tag_name, standard_scopers, namespace
-       is_in_button_scope = (tag_name, namespace = null) ->
-               return is_in_scope_x_y tag_name, standard_scopers, button_scopers, namespace
-       is_in_table_scope = (tag_name, namespace = null) ->
-               return is_in_scope_x tag_name, table_scopers, namespace
-       # aka is_in_list_item_scope
-       is_in_li_scope = (tag_name, namespace = null) ->
-               return is_in_scope_x_y tag_name, standard_scopers, li_scopers, namespace
-       is_in_select_scope = (tag_name, namespace = null) ->
-               for t in open_els
-                       if t.name is tag_name and (namespace is null or namespace is t.namespace)
-                               return true
-                       if t.namespace isnt NS_HTML and t.name isnt 'optgroup' and t.name isnt 'option'
-                               return false
-               return false
-       # this checks for a particular element, not by name
-       # this requires a namespace match
-       el_is_in_scope = (needle) ->
-               for el in open_els
-                       if el is needle
-                               return true
-                       if standard_scopers[el.name] is el.namespace
-                               return false
-               return false
-
-       clear_to_table_stopers = {
-               'table': true
-               'template': true
-               'html': true
-       }
-       clear_stack_to_table_context = ->
-               loop
-                       if clear_to_table_stopers[open_els[0].name]?
-                               break
-                       open_els.shift()
-               return
-       clear_to_table_body_stopers = {
-               tbody: NS_HTML
-               tfoot: NS_HTML
-               thead: NS_HTML
-               template: NS_HTML
-               html: NS_HTML
-       }
-       clear_stack_to_table_body_context = ->
-               loop
-                       if clear_to_table_body_stopers[open_els[0].name] is open_els[0].namespace
-                               break
-                       open_els.shift()
-               return
-       clear_to_table_row_stopers = {
-               'tr': true
-               'template': true
-               'html': true
-       }
-       clear_stack_to_table_row_context = ->
-               loop
-                       if clear_to_table_row_stopers[open_els[0].name]?
-                               break
-                       open_els.shift()
-               return
-       clear_afe_to_marker = ->
-               loop
-                       return unless afe.length > 0 # this happens in fragment case, ?spec error
-                       el = afe.shift()
-                       if el.type is TYPE_AFE_MARKER
-                               return
-               return
-
-       # 8.2.3.1 ...
-       # http://www.w3.org/TR/html5/syntax.html#reset-the-insertion-mode-appropriately
-       reset_ins_mode = ->
-               # 1. Let last be false.
-               last = false
-               # 2. Let node be the last node in the stack of open elements.
-               node_i = 0
-               node = open_els[node_i]
-               # 3. Loop: If node is the first node in the stack of open elements,
-               # then set last to true, and, if the parser was originally created as
-               # part of the HTML fragment parsing algorithm (fragment case) set node
-               # to the context element.
-               loop
-                       if node_i is open_els.length - 1
-                               last = true
-                               if flag_fragment_parsing
-                                       node = context_element
-                       # 4. If node is a select element, run these substeps:
-                       if node.name is 'select' and node.namespace is NS_HTML
-                               # 1. If last is true, jump to the step below labeled done.
-                               unless last
-                                       # 2. Let ancestor be node.
-                                       ancestor_i = node_i
-                                       ancestor = node
-                                       # 3. Loop: If ancestor is the first node in the stack of
-                                       # open elements, jump to the step below labeled done.
-                                       loop
-                                               if ancestor_i is open_els.length - 1
-                                                       break
-                                               # 4. Let ancestor be the node before ancestor in the stack
-                                               # of open elements.
-                                               ancestor_i += 1
-                                               ancestor = open_els[ancestor_i]
-                                               # 5. If ancestor is a template node, jump to the step below
-                                               # labeled done.
-                                               if ancestor.name is 'template' and ancestor.namespace is NS_HTML
-                                                       break
-                                               # 6. If ancestor is a table node, switch the insertion mode
-                                               # to "in select in table" and abort these steps.
-                                               if ancestor.name is 'table' and ancestor.namespace is NS_HTML
-                                                       ins_mode = ins_mode_in_select_in_table
-                                                       return
-                                               # 7. Jump back to the step labeled loop.
-                               # 8. Done: Switch the insertion mode to "in select" and abort
-                               # these steps.
-                               ins_mode = ins_mode_in_select
-                               return
-                       # 5. If node is a td or th element and last is false, then switch
-                       # the insertion mode to "in cell" and abort these steps.
-                       if (node.name is 'td' or node.name is 'th') and node.namespace is NS_HTML and last is false
-                               ins_mode = ins_mode_in_cell
-                               return
-                       # 6. If node is a tr element, then switch the insertion mode to "in
-                       # row" and abort these steps.
-                       if node.name is 'tr' and node.namespace is NS_HTML
-                               ins_mode = ins_mode_in_row
-                               return
-                       # 7. If node is a tbody, thead, or tfoot element, then switch the
-                       # insertion mode to "in table body" and abort these steps.
-                       if (node.name is 'tbody' or node.name is 'thead' or node.name is 'tfoot') and node.namespace is NS_HTML
-                               ins_mode = ins_mode_in_table_body
-                               return
-                       # 8. If node is a caption element, then switch the insertion mode
-                       # to "in caption" and abort these steps.
-                       if node.name is 'caption' and node.namespace is NS_HTML
-                               ins_mode = ins_mode_in_caption
-                               return
-                       # 9. If node is a colgroup element, then switch the insertion mode
-                       # to "in column group" and abort these steps.
-                       if node.name is 'colgroup' and node.namespace is NS_HTML
-                               ins_mode = ins_mode_in_column_group
-                               return
-                       # 10. If node is a table element, then switch the insertion mode to
-                       # "in table" and abort these steps.
-                       if node.name is 'table' and node.namespace is NS_HTML
-                               ins_mode = ins_mode_in_table
-                               return
-                       # 11. If node is a template element, then switch the insertion mode
-                       # to the current template insertion mode and abort these steps.
-                       if node.name is 'template' and node.namespace is NS_HTML
-                               ins_mode = template_ins_modes[0]
-                               return
-                       # 12. If node is a head element and last is true, then switch the
-                       # insertion mode to "in body" ("in body"! not "in head"!) and abort
-                       # these steps. (fragment case)
-                       if node.name is 'head' and node.namespace is NS_HTML and last
-                               ins_mode = ins_mode_in_body
-                               return
-                       # 13. If node is a head element and last is false, then switch the
-                       # insertion mode to "in head" and abort these steps.
-                       if node.name is 'head' and node.namespace is NS_HTML and last is false
-                               ins_mode = ins_mode_in_head
-                               return
-                       # 14. If node is a body element, then switch the insertion mode to
-                       # "in body" and abort these steps.
-                       if node.name is 'body' and node.namespace is NS_HTML
-                               ins_mode = ins_mode_in_body
-                               return
-                       # 15. If node is a frameset element, then switch the insertion mode
-                       # to "in frameset" and abort these steps. (fragment case)
-                       if node.name is 'frameset' and node.namespace is NS_HTML
-                               ins_mode = ins_mode_in_frameset
-                               return
-                       # 16. If node is an html element, run these substeps:
-                       if node.name is 'html' and node.namespace is NS_HTML
-                               # 1. If the head element pointer is null, switch the insertion
-                               # mode to "before head" and abort these steps. (fragment case)
-                               if head_element_pointer is null
-                                       ins_mode = ins_mode_before_head
-                               else
-                                       # 2. Otherwise, the head element pointer is not null,
-                                       # switch the insertion mode to "after head" and abort these
-                                       # steps.
-                                       ins_mode = ins_mode_after_head
-                               return
-                       # 17. If last is true, then switch the insertion mode to "in body"
-                       # and abort these steps. (fragment case)
-                       if last
-                               ins_mode = ins_mode_in_body
-                               return
-                       # 18. Let node now be the node before node in the stack of open
-                       # elements.
-                       node_i += 1
-                       node = open_els[node_i]
-                       # 19. Return to the step labeled loop.
-               return
-
-       # 8.2.3.2
-
-       # http://www.w3.org/TR/html5/syntax.html#adjusted-current-node
-       adjusted_current_node = ->
-               if open_els.length is 1 and flag_fragment_parsing
-                       return context_element
-               return open_els[0]
-
-       # http://www.w3.org/TR/html5/syntax.html#reconstruct-the-active-formatting-elements
-       # this implementation is structured (mostly) as described at the link above.
-       # capitalized comments are the "labels" described at the link above.
-       reconstruct_afe = ->
-               return if afe.length is 0
-               if afe[0].type is TYPE_AFE_MARKER or afe[0] in open_els
-                       return
-               # Rewind
-               i = 0
-               loop
-                       if i is afe.length - 1
-                               break
-                       i += 1
-                       if afe[i].type is TYPE_AFE_MARKER or afe[i] in open_els
-                               i -= 1 # Advance
-                               break
-               # Create
-               loop
-                       el = insert_html_element afe[i].token
-                       afe[i] = el
-                       break if i is 0
-                       i -= 1 # Advance
-               return
-
-       # http://www.w3.org/TR/html5/syntax.html#adoption-agency-algorithm
-       # adoption agency algorithm
-       # overview here:
-       #   http://www.w3.org/TR/html5/syntax.html#misnested-tags:-b-i-/b-/i
-       #   http://www.w3.org/TR/html5/syntax.html#misnested-tags:-b-p-/b-/p
-       #   http://www.w3.org/TR/html5/syntax.html#unclosed-formatting-elements
-       adoption_agency = (subject) ->
-# this block implements tha W3C spec
-#              # 1. If the current node is an HTML element whose tag name is subject,
-#              # then run these substeps:
-#              #
-#              # 1. Let element be the current node.
-#              #
-#              # 2. Pop element off the stack of open elements.
-#              #
-#              # 3. If element is also in the list of active formatting elements,
-#              # remove the element from the list.
-#              #
-#              # 4. Abort the adoption agency algorithm.
-#              if open_els[0].name is subject and open_els[0].namespace is NS_HTML
-#                      el = open_els.shift()
-#                      # remove it from the list of active formatting elements (if found)
-#                      for t, i in afe
-#                              if t is el
-#                                      afe.splice i, 1
-#                                      break
-#                      return
-# WHATWG: https://html.spec.whatwg.org/multipage/syntax.html#adoption-agency-algorithm
-               # If the current node is an HTML element whose tag name is subject, and
-               # the current node is not in the list of active formatting elements,
-               # then pop the current node off the stack of open elements, and abort
-               # these steps.
-               if open_els[0].name is subject and open_els[0].namespace is NS_HTML
-                       # remove it from the list of active formatting elements (if found)
-                       in_afe = false
-                       for el, i in afe
-                               if el is open_els[0]
-                                       in_afe = true
-                                       break
-                       unless in_afe
-                               open_els.shift()
-                               return
-                       # fall through
-# END WHATWG
-               outer = 0
-               loop
-                       if outer >= 8
-                               return
-                       outer += 1
-                       # 5. Let formatting element be the last element in the list of
-                       # active formatting elements that: is between the end of the list
-                       # and the last scope marker in the list, if any, or the start of
-                       # the list otherwise, and  has the tag name subject.
-                       fe = null
-                       for t, fe_of_afe in afe
-                               if t.type is TYPE_AFE_MARKER
-                                       break
-                               if t.name is subject
-                                       fe = t
-                                       break
-                       # If there is no such element, then abort these steps and instead
-                       # act as described in the "any other end tag" entry above.
-                       if fe is null
-                               in_body_any_other_end_tag subject
-                               return
-                       # 6. If formatting element is not in the stack of open elements,
-                       # then this is a parse error; remove the element from the list, and
-                       # abort these steps.
-                       in_open_els = false
-                       for t, fe_of_open_els in open_els
-                               if t is fe
-                                       in_open_els = true
-                                       break
-                       unless in_open_els
-                               parse_error()
-                               # "remove it from the list" must mean afe, since it's not in open_els
-                               afe.splice fe_of_afe, 1
-                               return
-                       # 7. If formatting element is in the stack of open elements, but
-                       # the element is not in scope, then this is a parse error; abort
-                       # these steps.
-                       unless el_is_in_scope fe
-                               parse_error()
-                               return
-                       # 8. If formatting element is not the current node, this is a parse
-                       # error. (But do not abort these steps.)
-                       unless open_els[0] is fe
-                               parse_error()
-                               # continue
-                       # 9. Let furthest block be the topmost node in the stack of open
-                       # elements that is lower in the stack than formatting element, and
-                       # is an element in the special category. There might not be one.
-                       fb = null
-                       fb_of_open_els = null
-                       for t, i in open_els
-                               if t is fe
-                                       break
-                               if el_is_special t
-                                       fb = t
-                                       fb_of_open_els = i
-                                       # and continue, to see if there's one that's more "topmost"
-                       # 10. If there is no furthest block, then the UA must first pop all
-                       # the nodes from the bottom of the stack of open elements, from the
-                       # current node up to and including formatting element, then remove
-                       # formatting element from the list of active formatting elements,
-                       # and finally abort these steps.
-                       if fb is null
-                               loop
-                                       t = open_els.shift()
-                                       if t is fe
-                                               afe.splice fe_of_afe, 1
-                                               return
-                       # 11. Let common ancestor be the element immediately above
-                       # formatting element in the stack of open elements.
-                       ca = open_els[fe_of_open_els + 1] # common ancestor
-
-                       node_above = open_els[fb_of_open_els + 1] # next node if node isn't in open_els anymore
-                       # 12. Let a bookmark note the position of formatting element in the list of active formatting elements relative to the elements on either side of it in the list.
-                       bookmark = new_aaa_bookmark()
-                       for t, i in afe
-                               if t is fe
-                                       afe.splice i, 0, bookmark
-                                       break
-                       node = last_node = fb
-                       inner = 0
-                       loop
-                               inner += 1
-                               # 3. Let node be the element immediately above node in the
-                               # stack of open elements, or if node is no longer in the stack
-                               # of open elements (e.g. because it got removed by this
-                               # algorithm), the element that was immediately above node in
-                               # the stack of open elements before node was removed.
-                               node_next = null
-                               for t, i in open_els
-                                       if t is node
-                                               node_next = open_els[i + 1]
-                                               break
-                               node = node_next ? node_above
-                               # TODO make sure node_above gets re-set if/when node is removed from open_els
-
-                               # 4. If node is formatting element, then go to the next step in
-                               # the overall algorithm.
-                               if node is fe
-                                       break
-                               # 5. If inner loop counter is greater than three and node is in
-                               # the list of active formatting elements, then remove node from
-                               # the list of active formatting elements.
-                               node_in_afe = false
-                               for t, i in afe
-                                       if t is node
-                                               if inner > 3
-                                                       afe.splice i, 1
-                                               else
-                                                       node_in_afe = true
-                                               break
-                               # 6. If node is not in the list of active formatting elements,
-                               # then remove node from the stack of open elements and then go
-                               # back to the step labeled inner loop.
-                               unless node_in_afe
-                                       for t, i in open_els
-                                               if t is node
-                                                       node_above = open_els[i + 1]
-                                                       open_els.splice i, 1
-                                                       break
-                                       continue
-                               # 7. create an element for the token for which the element node
-                               # was created, in the HTML namespace, with common ancestor as
-                               # the intended parent; replace the entry for node in the list
-                               # of active formatting elements with an entry for the new
-                               # element, replace the entry for node in the stack of open
-                               # elements with an entry for the new element, and let node be
-                               # the new element.
-                               new_node = token_to_element node.token, NS_HTML, ca
-                               for t, i in afe
-                                       if t is node
-                                               afe[i] = new_node
-                                               break
-                               for t, i in open_els
-                                       if t is node
-                                               node_above = open_els[i + 1]
-                                               open_els[i] = new_node
-                                               break
-                               node = new_node
-                               # 8. If last node is furthest block, then move the
-                               # aforementioned bookmark to be immediately after the new node
-                               # in the list of active formatting elements.
-                               if last_node is fb
-                                       for t, i in afe
-                                               if t is bookmark
-                                                       afe.splice i, 1
-                                                       break
-                                       for t, i in afe
-                                               if t is node
-                                                       # "after" means lower
-                                                       afe.splice i, 0, bookmark # "after as <-
-                                                       break
-                               # 9. Insert last node into node, first removing it from its
-                               # previous parent node if any.
-                               if last_node.parent?
-                                       for c, i in last_node.parent.children
-                                               if c is last_node
-                                                       last_node.parent.children.splice i, 1
-                                                       break
-                               node.children.push last_node
-                               last_node.parent = node
-                               # 10. Let last node be node.
-                               last_node = node
-                               # 11. Return to the step labeled inner loop.
-                       # 14. Insert whatever last node ended up being in the previous step
-                       # at the appropriate place for inserting a node, but using common
-                       # ancestor as the override target.
-
-                       # In the case where fe is immediately followed by fb:
-                       #   * inner loop exits out early (node==fe)
-                       #   * last_node is fb
-                       #   * last_node is still in the tree (not a duplicate)
-                       if last_node.parent?
-                               for c, i in last_node.parent.children
-                                       if c is last_node
-                                               last_node.parent.children.splice i, 1
-                                               break
-                       # can't use standard insert token thing, because it's already in
-                       # open_els and must stay at it's current position in open_els
-                       dest = adjusted_insertion_location ca
-                       dest[0].children.splice dest[1], 0, last_node
-                       last_node.parent = dest[0]
-                       # 15. Create an element for the token for which formatting element
-                       # was created, in the HTML namespace, with furthest block as the
-                       # intended parent.
-                       new_element = token_to_element fe.token, NS_HTML, fb
-                       # 16. Take all of the child nodes of furthest block and append them
-                       # to the element created in the last step.
-                       while fb.children.length
-                               t = fb.children.shift()
-                               t.parent = new_element
-                               new_element.children.push t
-                       # 17. Append that new element to furthest block.
-                       new_element.parent = fb
-                       fb.children.push new_element
-                       # 18. Remove formatting element from the list of active formatting
-                       # elements, and insert the new element into the list of active
-                       # formatting elements at the position of the aforementioned
-                       # bookmark.
-                       for t, i in afe
-                               if t is fe
-                                       afe.splice i, 1
-                                       break
-                       for t, i in afe
-                               if t is bookmark
-                                       afe[i] = new_element
-                                       break
-                       # 19. Remove formatting element from the stack of open elements,
-                       # and insert the new element into the stack of open elements
-                       # immediately below the position of furthest block in that stack.
-                       for t, i in open_els
-                               if t is fe
-                                       open_els.splice i, 1
-                                       break
-                       for t, i in open_els
-                               if t is fb
-                                       open_els.splice i, 0, new_element
-                                       break
-                       # 20. Jump back to the step labeled outer loop.
-               return
-
-       # http://www.w3.org/TR/html5/syntax.html#close-a-p-element
-       close_p_element = ->
-               generate_implied_end_tags 'p' # arg is exception
-               unless open_els[0].name is 'p' and open_els[0].namespace is NS_HTML
-                       parse_error()
-               while open_els.length > 1 # just in case
-                       el = open_els.shift()
-                       if el.name is 'p' and el.namespace is NS_HTML
-                               return
-               return
-       close_p_if_in_button_scope = ->
-               if is_in_button_scope 'p', NS_HTML
-                       close_p_element()
-               return
-
-       # http://www.w3.org/TR/html5/syntax.html#insert-a-character
-       # aka insert_a_character = (t) ->
-       insert_character = (t) ->
-               dest = adjusted_insertion_location()
-               # fixfull check for Document node
-               if dest[1] > 0
-                       prev = dest[0].children[dest[1] - 1]
-                       if prev.type is TYPE_TEXT
-                               prev.text += t.text
-                               return
-               dest[0].children.splice dest[1], 0, t
-               return
-
-       # 8.2.5 http://www.w3.org/TR/html5/syntax.html#tree-construction
-       process_token = (t) ->
-               acn = adjusted_current_node()
-               unless acn?
-                       ins_mode t
-                       return
-               if acn.namespace is NS_HTML
-                       ins_mode t
-                       return
-               if is_mathml_text_integration_point(acn)
-                       if t.type is TYPE_START_TAG and not (t.name is 'mglyph' or t.name is 'malignmark')
-                               ins_mode t
-                               return
-                       if t.type is TYPE_TEXT
-                               ins_mode t
-                               return
-               if acn.namespace is NS_MATHML and acn.name is 'annotation-xml' and t.type is TYPE_START_TAG and t.name is 'svg'
-                       ins_mode t
-                       return
-               if is_html_integration acn
-                       if t.type is TYPE_START_TAG or t.type is TYPE_TEXT
-                               ins_mode t
-                               return
-               if t.type is TYPE_EOF
-                       ins_mode t
-                       return
-               in_foreign_content t
-               return
-
-       # 8.2.5.1
-       # http://www.w3.org/TR/html5/syntax.html#creating-and-inserting-nodes
-       # http://www.w3.org/TR/html5/syntax.html#appropriate-place-for-inserting-a-node
-       adjusted_insertion_location = (override_target = null) ->
-               # 1. If there was an override target specified, then let target be the
-               # override target.
-               if override_target?
-                       target = override_target
-               else # Otherwise, let target be the current node.
-                       target = open_els[0]
-               # 2. Determine the adjusted insertion location using the first matching
-               # steps from the following list:
-               #
-               # If foster parenting is enabled and target is a table, tbody, tfoot,
-               # thead, or tr element Foster parenting happens when content is
-               # misnested in tables.
-               if flag_foster_parenting and foster_parenting_targets[target.name] is target.namespace
-                       loop # once. this is here so we can ``break`` to "abort these substeps"
-                               # 1. Let last template be the last template element in the
-                               # stack of open elements, if any.
-                               last_template = null
-                               last_template_i = null
-                               for el, i in open_els
-                                       if el.name is 'template' and el.namespace is NS_HTML
-                                               last_template = el
-                                               last_template_i = i
-                                               break
-                               # 2. Let last table be the last table element in the stack of
-                               # open elements, if any.
-                               last_table = null
-                               last_table_i
-                               for el, i in open_els
-                                       if el.name is 'table' and el.namespace is NS_HTML
-                                               last_table = el
-                                               last_table_i = i
-                                               break
-                               # 3. If there is a last template and either there is no last
-                               # table, or there is one, but last template is lower (more
-                               # recently added) than last table in the stack of open
-                               # elements, then: let adjusted insertion location be inside
-                               # last template's template contents, after its last child (if
-                               # any), and abort these substeps.
-                               if last_template and (last_table is null or last_template_i < last_table_i)
-                                       target = last_template # fixfull should be it's contents
-                                       target_i = target.children.length
-                                       break
-                               # 4. If there is no last table, then let adjusted insertion
-                               # location be inside the first element in the stack of open
-                               # elements (the html element), after its last child (if any),
-                               # and abort these substeps. (fragment case)
-                               if last_table is null
-                                       # this is odd
-                                       target = open_els[open_els.length - 1]
-                                       target_i = target.children.length
-                                       break
-                               # 5. If last table has a parent element, then let adjusted
-                               # insertion location be inside last table's parent element,
-                               # immediately before last table, and abort these substeps.
-                               if last_table.parent?
-                                       for c, i in last_table.parent.children
-                                               if c is last_table
-                                                       target = last_table.parent
-                                                       target_i = i
-                                                       break
-                                       break
-                               # 6. Let previous element be the element immediately above last
-                               # table in the stack of open elements.
-                               #
-                               # huh? how could it not have a parent?
-                               previous_element = open_els[last_table_i + 1]
-                               # 7. Let adjusted insertion location be inside previous
-                               # element, after its last child (if any).
-                               target = previous_element
-                               target_i = target.children.length
-                               # Note: These steps are involved in part because it's possible
-                               # for elements, the table element in this case in particular,
-                               # to have been moved by a script around in the DOM, or indeed
-                               # removed from the DOM entirely, after the element was inserted
-                               # by the parser.
-                               break # don't really loop
-               else
-                       # Otherwise Let adjusted insertion location be inside target, after
-                       # its last child (if any).
-                       target_i = target.children.length
-
-               # 3. If the adjusted insertion location is inside a template element,
-               # let it instead be inside the template element's template contents,
-               # after its last child (if any).
-               # fixfull (template)
-
-               # 4. Return the adjusted insertion location.
-               return [target, target_i]
-
-       # http://www.w3.org/TR/html5/syntax.html#create-an-element-for-the-token
-       # aka create_an_element_for_token
-       token_to_element = (t, namespace, intended_parent) ->
-               # convert attributes into a hash
-               attrs = {}
-               for a in t.attrs_a
-                       attrs[a[0]] = a[1] # TODO check what to do with dupilcate attrs
-               el = new Node TYPE_TAG, name: t.name, namespace: namespace, attrs: attrs, token: t
-
-               # TODO 2. If the newly created element has an xmlns attribute in the
-               # XMLNS namespace whose value is not exactly the same as the element's
-               # namespace, that is a parse error. Similarly, if the newly created
-               # element has an xmlns:xlink attribute in the XMLNS namespace whose
-               # value is not the XLink Namespace, that is a parse error.
-
-               # fixfull: the spec says stuff about form pointers and ownerDocument
-
-               return el
-
-       # http://www.w3.org/TR/html5/syntax.html#insert-a-foreign-element
-       insert_foreign_element = (token, namespace) ->
-               ail = adjusted_insertion_location()
-               ail_el = ail[0]
-               ail_i = ail[1]
-               el = token_to_element token, namespace, ail_el
-               # TODO skip this next step if it's broken (eg ail_el is document with child already)
-               el.parent = ail_el
-               ail_el.children.splice ail_i, 0, el
-               open_els.unshift el
-               return el
-       # http://www.w3.org/TR/html5/syntax.html#insert-an-html-element
-       insert_html_element = (token) ->
-               return insert_foreign_element token, NS_HTML
-
-       # http://www.w3.org/TR/html5/syntax.html#insert-a-comment
-       # position should be [node, index_within_children]
-       insert_comment = (t, position = null) ->
-               position ?= adjusted_insertion_location()
-               position[0].children.splice position[1], 0, t
-               return
-
-       # 8.2.5.2
-       # http://www.w3.org/TR/html5/syntax.html#generic-raw-text-element-parsing-algorithm
-       parse_generic_raw_text = (t) ->
-               insert_html_element t
-               tok_state = tok_state_rawtext
-               original_ins_mode = ins_mode
-               ins_mode = ins_mode_text
-               return
-       parse_generic_rcdata_text = (t) ->
-               insert_html_element t
-               tok_state = tok_state_rcdata
-               original_ins_mode = ins_mode
-               ins_mode = ins_mode_text
-               return
-
-       # 8.2.5.3 http://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags
-       # http://www.w3.org/TR/html5/syntax.html#generate-implied-end-tags
-       generate_implied_end_tags = (except = null) ->
-               while end_tag_implied[open_els[0].name] is open_els[0].namespace and open_els[0].name isnt except
-                       open_els.shift()
-               return
-
-       # 8.2.5.4 The rules for parsing tokens in HTML content
-       # http://www.w3.org/TR/html5/syntax.html#parsing-main-inhtml
-
-       # 8.2.5.4.1 The "initial" insertion mode
-       # http://www.w3.org/TR/html5/syntax.html#the-initial-insertion-mode
-       is_quirks_yes_doctype = (t) ->
-               if t.flag 'force-quirks'
-                       return true
-               if t.name isnt 'html'
-                       return true
-               if t.public_identifier?
-                       pi = t.public_identifier.toLowerCase()
-                       for p in quirks_yes_pi_prefixes
-                               if pi.substr(0, p.length) is p
-                                       return true
-                       if pi is '-//w3o//dtd w3 html strict 3.0//en//' or pi is '-/w3c/dtd html 4.0 transitional/en' or pi is 'html'
-                               return true
-               if t.system_identifier?
-                       if t.system_identifier.toLowerCase() is 'http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd'
-                               return true
-               else if t.public_identifier?
-                       # already did this: pi = t.public_identifier.toLowerCase()
-                       if pi.substr(0, 32) is '-//w3c//dtd html 4.01 frameset//' or pi.substr(0, 36) is '-//w3c//dtd html 4.01 transitional//'
-                               return true
-               return false
-       is_quirks_limited_doctype = (t) ->
-               if t.public_identifier?
-                       pi = t.public_identifier.toLowerCase()
-                       if pi.substr(0, 32) is '-//w3c//dtd xhtml 1.0 frameset//' or pi.substr(0, 36) is '-//w3c//dtd xhtml 1.0 transitional//'
-                               return true
-                       if t.system_identifier?
-                               if pi.substr(0, 32) is '-//w3c//dtd html 4.01 frameset//' or pi.substr(0, 36) is '-//w3c//dtd html 4.01 transitional//'
-                                       return true
-               return false
-       ins_mode_initial = (t) ->
-               if is_space_tok t
-                       return
-               if t.type is TYPE_COMMENT
-                       # ?fixfull
-                       doc.children.push t
-                       return
-               if t.type is TYPE_DOCTYPE
-                       # fixfull syntax error from first paragraph and following bullets
-                       # fixfull set doc.doctype
-                       # fixfull is the "not an iframe srcdoc" thing relevant?
-                       if is_quirks_yes_doctype t
-                               doc.flag 'quirks mode', QUIRKS_YES
-                       else if is_quirks_limited_doctype t
-                               doc.flag 'quirks mode', QUIRKS_LIMITED
-                       doc.children.push t
-                       ins_mode = ins_mode_before_html
-                       return
-               # Anything else
-               # fixfull not iframe srcdoc?
-               parse_error()
-               doc.flag 'quirks mode', QUIRKS_YES
-               ins_mode = ins_mode_before_html
-               process_token t
-               return
-
-       # 8.2.5.4.2 http://www.w3.org/TR/html5/syntax.html#the-before-html-insertion-mode
-       ins_mode_before_html = (t) ->
-               if t.type is TYPE_DOCTYPE
-                       parse_error()
-                       return
-               if t.type is TYPE_COMMENT
-                       doc.children.push t
-                       return
-               if is_space_tok t
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'html'
-                       el = token_to_element t, NS_HTML, doc
-                       doc.children.push el
-                       el.document = doc
-                       open_els.unshift(el)
-                       # fixfull (big paragraph in spec about manifest, fragment, urls, etc)
-                       ins_mode = ins_mode_before_head
-                       return
-               if t.type is TYPE_END_TAG
-                       if t.name is 'head' or t.name is 'body' or t.name is 'html' or t.name is 'br'
-                               # fall through to "anything else"
-                       else
-                               parse_error()
-                               return
-               # Anything else
-               el = token_to_element new_open_tag('html'), NS_HTML, doc
-               doc.children.push el
-               el.document = doc
-               open_els.unshift el
-               # ?fixfull browsing context
-               ins_mode = ins_mode_before_head
-               process_token t
-               return
-
-       # 8.2.5.4.3 http://www.w3.org/TR/html5/syntax.html#the-before-head-insertion-mode
-       ins_mode_before_head = (t) ->
-               if is_space_tok t
-                       return
-               if t.type is TYPE_COMMENT
-                       insert_comment t
-                       return
-               if t.type is TYPE_DOCTYPE
-                       parse_error()
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'html'
-                       ins_mode_in_body t
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'head'
-                       el = insert_html_element t
-                       head_element_pointer = el
-                       ins_mode = ins_mode_in_head
-                       return
-               if t.type is TYPE_END_TAG
-                       if t.name is 'head' or t.name is 'body' or t.name is 'html' or t.name is 'br'
-                               # fall through to Anything else below
-                       else
-                               parse_error()
-                               return
-               # Anything else
-               el = insert_html_element new_open_tag 'head'
-               head_element_pointer = el
-               ins_mode = ins_mode_in_head
-               process_token t
-               return
-
-       # 8.2.5.4.4 http://www.w3.org/TR/html5/syntax.html#parsing-main-inhead
-       ins_mode_in_head_else = (t) -> # factored out for same-as-spec flow control
-               open_els.shift() # spec says this will be a 'head' node
-               ins_mode = ins_mode_after_head
-               process_token t
-               return
-       ins_mode_in_head = (t) ->
-               if t.type is TYPE_TEXT and (t.text is "\t" or t.text is "\n" or t.text is "\u000c" or t.text is ' ')
-                       insert_character t
-                       return
-               if t.type is TYPE_COMMENT
-                       insert_comment t
-                       return
-               if t.type is TYPE_DOCTYPE
-                       parse_error()
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'html'
-                       ins_mode_in_body t
-                       return
-               if t.type is TYPE_START_TAG and (t.name is 'base' or t.name is 'basefont' or t.name is 'bgsound' or t.name is 'link')
-                       el = insert_html_element t
-                       open_els.shift()
-                       t.acknowledge_self_closing()
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'meta'
-                       el = insert_html_element t
-                       open_els.shift()
-                       t.acknowledge_self_closing()
-                       # fixfull encoding stuff
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'title'
-                       parse_generic_rcdata_text t
-                       return
-               if t.type is TYPE_START_TAG and ((t.name is 'noscript' and flag_scripting) or t.name is 'noframes' or t.name is 'style')
-                       parse_generic_raw_text t
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'noscript' and flag_scripting is false
-                       insert_html_element t
-                       ins_mode = ins_mode_in_head_noscript
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'script'
-                       ail = adjusted_insertion_location()
-                       el = token_to_element t, NS_HTML, ail
-                       el.flag 'parser-inserted', true
-                       # fixfull frament case
-                       ail[0].children.splice ail[1], 0, el
-                       open_els.unshift el
-                       tok_state = tok_state_script_data
-                       original_ins_mode = ins_mode # make sure orig... is defined
-                       ins_mode = ins_mode_text
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'head'
-                       open_els.shift() # will be a head element... spec says so
-                       ins_mode = ins_mode_after_head
-                       return
-               if t.type is TYPE_END_TAG and (t.name is 'body' or t.name is 'html' or t.name is 'br')
-                       ins_mode_in_head_else t
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'template'
-                       insert_html_element t
-                       afe_push_marker()
-                       flag_frameset_ok = false
-                       ins_mode = ins_mode_in_template
-                       template_ins_modes.unshift ins_mode_in_template
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'template'
-                       if template_tag_is_open()
-                               generate_implied_end_tags
-                               if open_els[0].name isnt 'template'
-                                       parse_error()
-                               loop
-                                       el = open_els.shift()
-                                       if el.name is 'template' and el.namespace is NS_HTML
-                                               break
-                               clear_afe_to_marker()
-                               template_ins_modes.shift()
-                               reset_ins_mode()
-                       else
-                               parse_error()
-                       return
-               if (t.type is TYPE_START_TAG and t.name is 'head') or t.type is TYPE_END_TAG
-                       parse_error()
-                       return
-               ins_mode_in_head_else t
-               return
-
-       # 8.2.5.4.5 http://www.w3.org/TR/html5/syntax.html#parsing-main-inheadnoscript
-       ins_mode_in_head_noscript_else = (t) ->
-               parse_error()
-               open_els.shift()
-               ins_mode = ins_mode_in_head
-               process_token t
-               return
-       ins_mode_in_head_noscript = (t) ->
-               if t.type is TYPE_DOCTYPE
-                       parse_error()
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'html'
-                       ins_mode_in_body t
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'noscript'
-                       open_els.shift()
-                       ins_mode = ins_mode_in_head
-                       return
-               if is_space_tok(t) or t.type is TYPE_COMMENT or (t.type is TYPE_START_TAG and (t.name is 'basefont' or t.name is 'bgsound' or t.name is 'link' or t.name is 'meta' or t.name is 'noframes' or t.name is 'style'))
-                       ins_mode_in_head t
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'br'
-                       ins_mode_in_head_noscript_else t
-                       return
-               if (t.type is TYPE_START_TAG and (t.name is 'head' or t.name is 'noscript')) or t.type is TYPE_END_TAG
-                       parse_error()
-                       return
-               # Anything else
-               ins_mode_in_head_noscript_else t
-               return
-
-       # 8.2.5.4.6 http://www.w3.org/TR/html5/syntax.html#the-after-head-insertion-mode
-       ins_mode_after_head_else = (t) ->
-               body_tok = new_open_tag 'body'
-               insert_html_element body_tok
-               ins_mode = ins_mode_in_body
-               process_token t
-               return
-       ins_mode_after_head = (t) ->
-               if is_space_tok t
-                       insert_character t
-                       return
-               if t.type is TYPE_COMMENT
-                       insert_comment t
-                       return
-               if t.type is TYPE_DOCTYPE
-                       parse_error()
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'html'
-                       ins_mode_in_body t
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'body'
-                       insert_html_element t
-                       flag_frameset_ok = false
-                       ins_mode = ins_mode_in_body
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'frameset'
-                       insert_html_element t
-                       ins_mode = ins_mode_in_frameset
-                       return
-               if t.type is TYPE_START_TAG and (t.name is 'base' or t.name is 'basefont' or t.name is 'bgsound' or t.name is 'link' or t.name is 'meta' or t.name is 'noframes' or t.name is 'script' or t.name is 'style' or t.name is 'template' or t.name is 'title')
-                       parse_error()
-                       open_els.unshift head_element_pointer
-                       ins_mode_in_head t
-                       for el, i in open_els
-                               if el is head_element_pointer
-                                       open_els.splice i, 1
-                                       return
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'template'
-                       ins_mode_in_head t
-                       return
-               if t.type is TYPE_END_TAG and (t.name is 'body' or t.name is 'html' or t.name is 'br')
-                       ins_mode_after_head_else t
-                       return
-               if (t.type is TYPE_START_TAG and t.name is 'head') or t.type is TYPE_END_TAG
-                       parse_error()
-                       return
-               # Anything else
-               ins_mode_after_head_else t
-               return
-
-       # 8.2.5.4.7 http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody
-       in_body_any_other_end_tag = (name) -> # factored out because adoption agency calls it
-               node = open_els[0]
-               loop
-                       if node.name is name and node.namespace is NS_HTML
-                               generate_implied_end_tags name # arg is exception
-                               unless node is open_els[0]
-                                       parse_error()
-                               loop
-                                       el = open_els.shift()
-                                       if el is node
-                                               return
-                       if special_elements[node.name] is node.namespace
-                               parse_error()
-                               return
-                       for el, i in open_els
-                               if node is el
-                                       node = open_els[i + 1]
-                                       break
-               return
-       ins_mode_in_body = (t) ->
-               if t.type is TYPE_TEXT and t.text is "\u0000"
-                       parse_error()
-                       return
-               if is_space_tok t
-                       reconstruct_afe()
-                       insert_character t
-                       return
-               if t.type is TYPE_TEXT
-                       reconstruct_afe()
-                       insert_character t
-                       flag_frameset_ok = false
-                       return
-               if t.type is TYPE_COMMENT
-                       insert_comment t
-                       return
-               if t.type is TYPE_DOCTYPE
-                       parse_error()
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'html'
-                       parse_error()
-                       return if template_tag_is_open()
-                       root_attrs = open_els[open_els.length - 1].attrs
-                       for a in t.attrs_a
-                               root_attrs[a[0]] = a[1] unless root_attrs[a[0]]?
-                       return
-
-               if (t.type is TYPE_START_TAG and (t.name is 'base' or t.name is 'basefont' or t.name is 'bgsound' or t.name is 'link' or t.name is 'meta' or t.name is 'noframes' or t.name is 'script' or t.name is 'style' or t.name is 'template' or t.name is 'title')) or (t.type is TYPE_END_TAG and t.name is 'template')
-                       ins_mode_in_head t
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'body'
-                       parse_error()
-                       return if open_els.length < 2
-                       second = open_els[open_els.length - 2]
-                       return unless second.namespace is NS_HTML
-                       return unless second.name is 'body'
-                       return if template_tag_is_open()
-                       flag_frameset_ok = false
-                       for a in t.attrs_a
-                               second.attrs[a[0]] = a[1] unless second.attrs[a[0]]?
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'frameset'
-                       parse_error()
-                       return if open_els.length < 2
-                       second_i = open_els.length - 2
-                       second = open_els[second_i]
-                       return unless second.namespace is NS_HTML
-                       return unless second.name is 'body'
-                       if flag_frameset_ok is false
-                               return
-                       if second.parent?
-                               for el, i in second.parent.children
-                                       if el is second
-                                               second.parent.children.splice i, 1
-                                               break
-                       open_els.splice second_i, 1
-                       # pop everything except the "root html element"
-                       while open_els.length > 1
-                               open_els.shift()
-                       insert_html_element t
-                       ins_mode = ins_mode_in_frameset
-                       return
-               if t.type is TYPE_EOF
-                       ok_tags = {
-                               dd:NS_HTML, dt:NS_HTML, li:NS_HTML, p:NS_HTML, tbody:NS_HTML,
-                               td:NS_HTML, tfoot:NS_HTML, th:NS_HTML, thead:NS_HTML,
-                               tr:NS_HTML, body:NS_HTML, html:NS_HTML,
-                       }
-                       for el in open_els
-                               unless ok_tags[t.name] is el.namespace
-                                       parse_error()
-                                       break
-                       if template_ins_modes.length > 0
-                               ins_mode_in_template t
-                       else
-                               stop_parsing()
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'body'
-                       unless is_in_scope 'body', NS_HTML
-                               parse_error()
-                               return
-                       ok_tags = {
-                               dd:NS_HTML, dt:NS_HTML, li:NS_HTML, optgroup:NS_HTML,
-                               option:NS_HTML, p:NS_HTML, rb:NS_HTML, rp:NS_HTML, rt:NS_HTML,
-                               rtc:NS_HTML, tbody:NS_HTML, td:NS_HTML, tfoot:NS_HTML,
-                               th:NS_HTML, thead:NS_HTML, tr:NS_HTML, body:NS_HTML,
-                               html:NS_HTML
-                       }
-                       for el in open_els
-                               unless ok_tags[t.name] is el.namespace
-                                       parse_error()
-                                       break
-                       ins_mode = ins_mode_after_body
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'html'
-                       unless is_in_scope 'body', NS_HTML
-                               parse_error()
-                               return
-                       ok_tags = {
-                               dd:NS_HTML, dt:NS_HTML, li:NS_HTML, optgroup:NS_HTML,
-                               option:NS_HTML, p:NS_HTML, rb:NS_HTML, rp:NS_HTML, rt:NS_HTML,
-                               rtc:NS_HTML, tbody:NS_HTML, td:NS_HTML, tfoot:NS_HTML,
-                               th:NS_HTML, thead:NS_HTML, tr:NS_HTML, body:NS_HTML,
-                               html:NS_HTML
-                       }
-                       for el in open_els
-                               unless ok_tags[t.name] is el.namespace
-                                       parse_error()
-                                       break
-                       ins_mode = ins_mode_after_body
-                       process_token t
-                       return
-               if t.type is TYPE_START_TAG and (t.name is 'address' or t.name is 'article' or t.name is 'aside' or t.name is 'blockquote' or t.name is 'center' or t.name is 'details' or t.name is 'dialog' or t.name is 'dir' or t.name is 'div' or t.name is 'dl' or t.name is 'fieldset' or t.name is 'figcaption' or t.name is 'figure' or t.name is 'footer' or t.name is 'header' or t.name is 'hgroup' or t.name is 'main' or t.name is 'nav' or t.name is 'ol' or t.name is 'p' or t.name is 'section' or t.name is 'summary' or t.name is 'ul')
-                       close_p_if_in_button_scope()
-                       insert_html_element t
-                       return
-               if t.type is TYPE_START_TAG and h_tags[t.name]?
-                       close_p_if_in_button_scope()
-                       if h_tags[open_els[0].name] is open_els[0].namespace
-                               parse_error()
-                               open_els.shift()
-                       insert_html_element t
-                       return
-               if t.type is TYPE_START_TAG and (t.name is 'pre' or t.name is 'listing')
-                       close_p_if_in_button_scope()
-                       insert_html_element t
-                       eat_next_token_if_newline()
-                       flag_frameset_ok = false
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'form'
-                       unless form_element_pointer is null or template_tag_is_open()
-                               parse_error()
-                               return
-                       close_p_if_in_button_scope()
-                       el = insert_html_element t
-                       unless template_tag_is_open()
-                               form_element_pointer = el
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'li'
-                       flag_frameset_ok = false
-                       for node in open_els
-                               if node.name is 'li' and node.namespace is NS_HTML
-                                       generate_implied_end_tags 'li' # arg is exception
-                                       if open_els[0].name isnt 'li' or open_els[0].namespace isnt NS_HTML
-                                               parse_error()
-                                       loop
-                                               el = open_els.shift()
-                                               if el.name is 'li' and el.namespace is NS_HTML
-                                                       break
-                                       break
-                               if el_is_special_not_adp node
-                                               break
-                       close_p_if_in_button_scope()
-                       insert_html_element t
-                       return
-               if t.type is TYPE_START_TAG and (t.name is 'dd' or t.name is 'dt')
-                       flag_frameset_ok = false
-                       for node in open_els
-                               if node.name is 'dd' and node.namespace is NS_HTML
-                                       generate_implied_end_tags 'dd' # arg is exception
-                                       if open_els[0].name isnt 'dd' or open_els[0].namespace isnt NS_HTML
-                                               parse_error()
-                                       loop
-                                               el = open_els.shift()
-                                               if el.name is 'dd' and el.namespace is NS_HTML
-                                                       break
-                                       break
-                               if node.name is 'dt' and node.namespace is NS_HTML
-                                       generate_implied_end_tags 'dt' # arg is exception
-                                       if open_els[0].name isnt 'dt' or open_els[0].namespace isnt NS_HTML
-                                               parse_error()
-                                       loop
-                                               el = open_els.shift()
-                                               if el.name is 'dt' and el.namespace is NS_HTML
-                                                       break
-                                       break
-                               if el_is_special_not_adp node
-                                       break
-                       close_p_if_in_button_scope()
-                       insert_html_element t
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'plaintext'
-                       close_p_if_in_button_scope()
-                       insert_html_element t
-                       tok_state = tok_state_plaintext
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'button'
-                       if is_in_scope 'button', NS_HTML
-                               parse_error()
-                               generate_implied_end_tags()
-                               loop
-                                       el = open_els.shift()
-                                       if el.name is 'button' and el.namespace is NS_HTML
-                                               break
-                       reconstruct_afe()
-                       insert_html_element t
-                       flag_frameset_ok = false
-                       return
-               if t.type is TYPE_END_TAG and (t.name is 'address' or t.name is 'article' or t.name is 'aside' or t.name is 'blockquote' or t.name is 'button' or t.name is 'center' or t.name is 'details' or t.name is 'dialog' or t.name is 'dir' or t.name is 'div' or t.name is 'dl' or t.name is 'fieldset' or t.name is 'figcaption' or t.name is 'figure' or t.name is 'footer' or t.name is 'header' or t.name is 'hgroup' or t.name is 'listing' or t.name is 'main' or t.name is 'nav' or t.name is 'ol' or t.name is 'pre' or t.name is 'section' or t.name is 'summary' or t.name is 'ul')
-                       unless is_in_scope t.name, NS_HTML
-                               parse_error()
-                               return
-                       generate_implied_end_tags()
-                       unless open_els[0].name is t.name and open_els[0].namespace is NS_HTML
-                               parse_error()
-                       loop
-                               el = open_els.shift()
-                               if el.name is t.name and el.namespace is NS_HTML
-                                       return
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'form'
-                       unless template_tag_is_open()
-                               node = form_element_pointer
-                               form_element_pointer = null
-                               if node is null or not el_is_in_scope node
-                                       parse_error()
-                                       return
-                               generate_implied_end_tags()
-                               if open_els[0] isnt node
-                                       parse_error()
-                               for el, i in open_els
-                                       if el is node
-                                               open_els.splice i, 1
-                                               break
-                       else
-                               unless is_in_scope 'form', NS_HTML
-                                       parse_error()
-                                       return
-                               generate_implied_end_tags()
-                               if open_els[0].name isnt 'form' or open_els[0].namespace isnt NS_HTML
-                                       parse_error()
-                               loop
-                                       el = open_els.shift()
-                                       if el.name is 'form' and el.namespace is NS_HTML
-                                               break
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'p'
-                       unless is_in_button_scope 'p', NS_HTML
-                               parse_error()
-                               insert_html_element new_open_tag 'p'
-                       close_p_element()
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'li'
-                       unless is_in_li_scope 'li', NS_HTML
-                               parse_error()
-                               return
-                       generate_implied_end_tags 'li' # arg is exception
-                       if open_els[0].name isnt 'li' or open_els[0].namespace isnt NS_HTML
-                               parse_error()
-                       loop
-                               el = open_els.shift()
-                               if el.name is 'li' and el.namespace is NS_HTML
-                                       break
-                       return
-               if t.type is TYPE_END_TAG and (t.name is 'dd' or t.name is 'dt')
-                       unless is_in_scope t.name, NS_HTML
-                               parse_error()
-                               return
-                       generate_implied_end_tags t.name # arg is exception
-                       if open_els[0].name isnt t.name or open_els[0].namespace isnt NS_HTML
-                               parse_error()
-                       loop
-                               el = open_els.shift()
-                               if el.name is t.name and el.namespace is NS_HTML
-                                       break
-                       return
-               if t.type is TYPE_END_TAG and h_tags[t.name]?
-                       h_in_scope = false
-                       for el in open_els
-                               if h_tags[el.name] is el.namespace
-                                       h_in_scope = true
-                                       break
-                               if standard_scopers[el.name] is el.namespace
-                                       break
-                       unless h_in_scope
-                               parse_error()
-                               return
-                       generate_implied_end_tags()
-                       if open_els[0].name isnt t.name or open_els[0].namespace isnt NS_HTML
-                               parse_error()
-                       loop
-                               el = open_els.shift()
-                               if h_tags[el.name] is el.namespace
-                                       break
-                       return
-               # deep breath!
-               if t.type is TYPE_START_TAG and t.name is 'a'
-                       # If the list of active formatting elements contains an a element
-                       # between the end of the list and the last marker on the list (or
-                       # the start of the list if there is no marker on the list), then
-                       # this is a parse error; run the adoption agency algorithm for the
-                       # tag name "a", then remove that element from the list of active
-                       # formatting elements and the stack of open elements if the
-                       # adoption agency algorithm didn't already remove it (it might not
-                       # have if the element is not in table scope).
-                       found = false
-                       for el in afe
-                               if el.type is TYPE_AFE_MARKER
-                                       break
-                               if el.name is 'a' and el.namespace is NS_HTML
-                                       found = el
-                       if found?
-                               parse_error()
-                               adoption_agency 'a'
-                               for el, i in afe
-                                       if el is found
-                                               afe.splice i, 1
-                               for el, i in open_els
-                                       if el is found
-                                               open_els.splice i, 1
-                       reconstruct_afe()
-                       el = insert_html_element t
-                       afe_push el
-                       return
-               if t.type is TYPE_START_TAG and (t.name is 'b' or t.name is 'big' or t.name is 'code' or t.name is 'em' or t.name is 'font' or t.name is 'i' or t.name is 's' or t.name is 'small' or t.name is 'strike' or t.name is 'strong' or t.name is 'tt' or t.name is 'u')
-                       reconstruct_afe()
-                       el = insert_html_element t
-                       afe_push el
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'nobr'
-                       reconstruct_afe()
-                       if is_in_scope 'nobr', NS_HTML
-                               parse_error()
-                               adoption_agency 'nobr'
-                               reconstruct_afe()
-                       el = insert_html_element t
-                       afe_push el
-                       return
-               if t.type is TYPE_END_TAG and (t.name is 'a' or t.name is 'b' or t.name is 'big' or t.name is 'code' or t.name is 'em' or t.name is 'font' or t.name is 'i' or t.name is 'nobr' or t.name is 's' or t.name is 'small' or t.name is 'strike' or t.name is 'strong' or t.name is 'tt' or t.name is 'u')
-                       adoption_agency t.name
-                       return
-               if t.type is TYPE_START_TAG and (t.name is 'applet' or t.name is 'marquee' or t.name is 'object')
-                       reconstruct_afe()
-                       insert_html_element t
-                       afe_push_marker()
-                       flag_frameset_ok = false
-                       return
-               if t.type is TYPE_END_TAG and (t.name is 'applet' or t.name is 'marquee' or t.name is 'object')
-                       unless is_in_scope t.name, NS_HTML
-                               parse_error()
-                               return
-                       generate_implied_end_tags()
-                       if open_els[0].name isnt t.name or open_els[0].namespace isnt NS_HTML
-                               parse_error()
-                       loop
-                               el = open_els.shift()
-                               if el.name is t.name and el.namespace is NS_HTML
-                                       break
-                       clear_afe_to_marker()
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'table'
-                       unless doc.flag('quirks mode') is QUIRKS_YES
-                               close_p_if_in_button_scope() # test
-                       insert_html_element t
-                       flag_frameset_ok = false
-                       ins_mode = ins_mode_in_table
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'br'
-                       parse_error()
-                       # W3C: t.type = TYPE_START_TAG
-                       t = new_open_tag 'br' # WHATWG
-                       # fall through
-               if t.type is TYPE_START_TAG and (t.name is 'area' or t.name is 'br' or t.name is 'embed' or t.name is 'img' or t.name is 'keygen' or t.name is 'wbr')
-                       reconstruct_afe()
-                       insert_html_element t
-                       open_els.shift()
-                       t.acknowledge_self_closing()
-                       flag_frameset_ok = false
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'input'
-                       reconstruct_afe()
-                       insert_html_element t
-                       open_els.shift()
-                       t.acknowledge_self_closing()
-                       unless is_input_hidden_tok t
-                               flag_frameset_ok = false
-                       return
-               if t.type is TYPE_START_TAG and (t.name is 'menuitem' or t.name is 'param' or t.name is 'source' or t.name is 'track')
-                       # WHATWG adds 'menuitem' for this block
-                       insert_html_element t
-                       open_els.shift()
-                       t.acknowledge_self_closing()
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'hr'
-                       close_p_if_in_button_scope()
-                       insert_html_element t
-                       open_els.shift()
-                       t.acknowledge_self_closing()
-                       flag_frameset_ok = false
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'image'
-                       parse_error()
-                       t.name = 'img'
-                       process_token t
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'isindex'
-                       parse_error()
-                       if template_tag_is_open() is false and form_element_pointer isnt null
-                               return
-                       t.acknowledge_self_closing()
-                       flag_frameset_ok = false
-                       close_p_if_in_button_scope()
-                       el = insert_html_element new_open_tag 'form'
-                       unless template_tag_is_open()
-                               form_element_pointer = el
-                       for a in t.attrs_a
-                               if a[0] is 'action'
-                                       el.attrs['action'] = a[1]
-                                       break
-                       insert_html_element new_open_tag 'hr'
-                       open_els.shift()
-                       reconstruct_afe()
-                       insert_html_element new_open_tag 'label'
-                       # note: this is a little out-of-spec-order so we only have to scan t.attrs_a once
-                       input_el = new_open_tag 'input'
-                       prompt = null
-                       for a in t.attrs_a
-                               if a[0] is 'prompt'
-                                       prompt = a[1]
-                               if a[0] isnt 'name' and a[0] isnt 'action' and a[0] isnt 'prompt'
-                                       input_el.attrs_a.push [a[0], a[1]]
-                       input_el.attrs_a.push ['name', 'isindex']
-                       # fixfull this next bit is in english... internationalize?
-                       prompt ?= "This is a searchable index. Enter search keywords: "
-                       insert_character new_character_token prompt # fixfull split
-                       # TODO submit typo "balue" in spec
-                       insert_html_element input_el
-                       open_els.shift()
-                       # insert_character '' # you can put chars here if promt attr missing
-                       open_els.shift()
-                       insert_html_element new_open_tag 'hr'
-                       open_els.shift()
-                       open_els.shift()
-                       unless template_tag_is_open()
-                               form_element_pointer = null
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'textarea'
-                       insert_html_element t
-                       eat_next_token_if_newline()
-                       tok_state = tok_state_rcdata
-                       original_ins_mode = ins_mode
-                       flag_frameset_ok = false
-                       ins_mode = ins_mode_text
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'xmp'
-                       close_p_if_in_button_scope()
-                       reconstruct_afe()
-                       flag_frameset_ok = false
-                       parse_generic_raw_text t
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'iframe'
-                       flag_frameset_ok = false
-                       parse_generic_raw_text t
-                       return
-               if t.type is TYPE_START_TAG and (t.name is 'noembed' or (t.name is 'noscript' and flag_scripting))
-                       parse_generic_raw_text t
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'select'
-                       reconstruct_afe()
-                       insert_html_element t
-                       flag_frameset_ok = false
-                       if ins_mode is ins_mode_in_table or ins_mode is ins_mode_in_caption or ins_mode is ins_mode_in_table_body or ins_mode is ins_mode_in_row or ins_mode is ins_mode_in_cell
-                               ins_mode = ins_mode_in_select_in_table
-                       else
-                               ins_mode = ins_mode_in_select
-                       return
-               if t.type is TYPE_START_TAG and (t.name is 'optgroup' or t.name is 'option')
-                       if open_els[0].name is 'option' and open_els[0].namespace is NS_HTML
-                               open_els.shift()
-                       reconstruct_afe()
-                       insert_html_element t
-                       return
-# this comment block implements the W3C spec
-#              if t.type is TYPE_START_TAG and (t.name is 'rb' or t.name is 'rp' or t.name is 'rtc')
-#                      if is_in_scope 'ruby', NS_HTML
-#                              generate_implied_end_tags()
-#                              unless open_els[0].name is 'ruby' and open_els[0].namespace is NS_HTML
-#                                      parse_error()
-#                      insert_html_element t
-#                      return
-#              if t.type is TYPE_START_TAG and t.name is 'rt'
-#                      if is_in_scope 'ruby', NS_HTML
-#                              generate_implied_end_tags 'rtc' # arg is exception
-#                              unless (open_els[0].name is 'ruby' or open_els[0].name is 'rtc') and open_els[0].namespace is NS_HTML
-#                                      parse_error()
-#                      insert_html_element t
-#                      return
-# below implements the WHATWG spec https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
-               if t.type is TYPE_START_TAG and (t.name is 'rb' or t.name is 'rtc')
-                       if is_in_scope 'ruby', NS_HTML
-                               generate_implied_end_tags()
-                               unless open_els[0].name is 'ruby' and open_els[0].namespace is NS_HTML
-                                       parse_error()
-                       insert_html_element t
-                       return
-               if t.type is TYPE_START_TAG and (t.name is 'rp' or t.name is 'rt')
-                       if is_in_scope 'ruby', NS_HTML
-                               generate_implied_end_tags 'rtc'
-                               unless (open_els[0].name is 'ruby' or open_els[0].name is 'rtc') and open_els[0].namespace is NS_HTML
-                                       parse_error()
-                       insert_html_element t
-                       return
-# end WHATWG chunk
-               if t.type is TYPE_START_TAG and t.name is 'math'
-                       reconstruct_afe()
-                       adjust_mathml_attributes t
-                       adjust_foreign_attributes t
-                       insert_foreign_element t, NS_MATHML
-                       if t.flag 'self-closing'
-                               open_els.shift()
-                               t.acknowledge_self_closing()
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'svg'
-                       reconstruct_afe()
-                       adjust_svg_attributes t
-                       adjust_foreign_attributes t
-                       insert_foreign_element t, NS_SVG
-                       if t.flag 'self-closing'
-                               open_els.shift()
-                               t.acknowledge_self_closing()
-                       return
-               if t.type is TYPE_START_TAG and (t.name is 'caption' or t.name is 'col' or t.name is 'colgroup' or t.name is 'frame' or t.name is 'head' or t.name is 'tbody' or t.name is 'td' or t.name is 'tfoot' or t.name is 'th' or t.name is 'thead' or t.name is 'tr')
-                       parse_error()
-                       return
-               if t.type is TYPE_START_TAG # any other start tag
-                       reconstruct_afe()
-                       insert_html_element t
-                       return
-               if t.type is TYPE_END_TAG # any other end tag
-                       in_body_any_other_end_tag t.name
-                       return
-               return
-
-       # 8.2.5.4.8 http://www.w3.org/TR/html5/syntax.html#parsing-main-incdata
-       ins_mode_text = (t) ->
-               if t.type is TYPE_TEXT
-                       insert_character t
-                       return
-               if t.type is TYPE_EOF
-                       parse_error()
-                       if open_els[0].name is 'script' and open_els[0].namespace is NS_HTML
-                               open_els[0].flag 'already started', true
-                       open_els.shift()
-                       ins_mode = original_ins_mode
-                       process_token t
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'script'
-                       open_els.shift()
-                       ins_mode = original_ins_mode
-                       # fixfull the spec seems to assume that I'm going to run the script
-                       # http://www.w3.org/TR/html5/syntax.html#scriptEndTag
-                       return
-               if t.type is TYPE_END_TAG
-                       open_els.shift()
-                       ins_mode = original_ins_mode
-                       return
-               return
-
-       # the functions below implement the tokenizer stats described here:
-       # http://www.w3.org/TR/html5/syntax.html#tokenization
-
-       # 8.2.5.4.9 http://www.w3.org/TR/html5/syntax.html#parsing-main-intable
-       ins_mode_in_table_else = (t) ->
-               parse_error()
-               flag_foster_parenting = true
-               ins_mode_in_body t
-               flag_foster_parenting = false
-               return
-       ins_mode_in_table = (t) ->
-               switch t.type
-                       when TYPE_TEXT
-                               if (open_els[0].name is 'table' or open_els[0].name is 'tbody' or open_els[0].name is 'tfoot' or open_els[0].name is 'thead' or open_els[0].name is 'tr') and open_els[0].namespace is NS_HTML
-                                       pending_table_character_tokens = []
-                                       original_ins_mode = ins_mode
-                                       ins_mode = ins_mode_in_table_text
-                                       process_token t
-                               else
-                                       ins_mode_in_table_else t
-                       when TYPE_COMMENT
-                               insert_comment t
-                       when TYPE_DOCTYPE
-                               parse_error()
-                       when TYPE_START_TAG
-                               switch t.name
-                                       when 'caption'
-                                               clear_stack_to_table_context()
-                                               afe_push_marker()
-                                               insert_html_element t
-                                               ins_mode = ins_mode_in_caption
-                                       when 'colgroup'
-                                               clear_stack_to_table_context()
-                                               insert_html_element t
-                                               ins_mode = ins_mode_in_column_group
-                                       when 'col'
-                                               clear_stack_to_table_context()
-                                               insert_html_element new_open_tag 'colgroup'
-                                               ins_mode = ins_mode_in_column_group
-                                               process_token t
-                                       when 'tbody', 'tfoot', 'thead'
-                                               clear_stack_to_table_context()
-                                               insert_html_element t
-                                               ins_mode = ins_mode_in_table_body
-                                       when 'td', 'th', 'tr'
-                                               clear_stack_to_table_context()
-                                               insert_html_element new_open_tag 'tbody'
-                                               ins_mode = ins_mode_in_table_body
-                                               process_token t
-                                       when 'table'
-                                               parse_error()
-                                               if is_in_table_scope 'table', NS_HTML
-                                                       loop
-                                                               el = open_els.shift()
-                                                               if el.name is 'table' and el.namespace is NS_HTML
-                                                                       break
-                                                       reset_ins_mode()
-                                                       process_token t
-                                       when 'style', 'script', 'template'
-                                               ins_mode_in_head t
-                                       when 'input'
-                                               unless is_input_hidden_tok t
-                                                       ins_mode_in_table_else t
-                                               else
-                                                       parse_error()
-                                                       el = insert_html_element t
-                                                       open_els.shift()
-                                                       t.acknowledge_self_closing()
-                                       when 'form'
-                                               parse_error()
-                                               if form_element_pointer?
-                                                       return
-                                               if template_tag_is_open()
-                                                       return
-                                               form_element_pointer = insert_html_element t
-                                               open_els.shift()
-                                       else
-                                               ins_mode_in_table_else t
-                       when TYPE_END_TAG
-                               switch t.name
-                                       when 'table'
-                                               if is_in_table_scope 'table', NS_HTML
-                                                       loop
-                                                               el = open_els.shift()
-                                                               if el.name is 'table' and el.namespace is NS_HTML
-                                                                       break
-                                                       reset_ins_mode()
-                                               else
-                                                       parse_error()
-                                       when 'body', 'caption', 'col', 'colgroup', 'html', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr'
-                                               parse_error()
-                                       when 'template'
-                                               ins_mode_in_head t
-                                       else
-                                               ins_mode_in_table_else t
-                       when TYPE_EOF
-                               ins_mode_in_body t
-                       else
-                               ins_mode_in_table_else t
-               return
-
-
-       # 8.2.5.4.10 http://www.w3.org/TR/html5/syntax.html#parsing-main-intabletext
-       ins_mode_in_table_text = (t) ->
-               if t.type is TYPE_TEXT and t.text is "\u0000"
-                       # from javascript?
-                       parse_error()
-                       return
-               if t.type is TYPE_TEXT
-                       pending_table_character_tokens.push t
-                       return
-               # Anything else
-               all_space = true
-               for old in pending_table_character_tokens
-                       unless is_space_tok old
-                               all_space = false
-                               break
-               if all_space
-                       for old in pending_table_character_tokens
-                               insert_character old
-               else
-                       for old in pending_table_character_tokens
-                               ins_mode_in_table_else old
-               pending_table_character_tokens = []
-               ins_mode = original_ins_mode
-               process_token t
-               return
-
-       # 8.2.5.4.11 http://www.w3.org/TR/html5/syntax.html#parsing-main-incaption
-       ins_mode_in_caption = (t) ->
-               if t.type is TYPE_END_TAG and t.name is 'caption'
-                       if is_in_table_scope 'caption', NS_HTML
-                               generate_implied_end_tags()
-                               if open_els[0].name isnt 'caption'
-                                       parse_error()
-                               loop
-                                       el = open_els.shift()
-                                       if el.name is 'caption' and el.namespace is NS_HTML
-                                               break
-                               clear_afe_to_marker()
-                               ins_mode = ins_mode_in_table
-                       else
-                               parse_error()
-                               # fragment case
-                       return
-               if (t.type is TYPE_START_TAG and (t.name is 'caption' or t.name is 'col' or t.name is 'colgroup' or t.name is 'tbody' or t.name is 'td' or t.name is 'tfoot' or t.name is 'th' or t.name is 'thead' or t.name is 'tr')) or t.type is TYPE_END_TAG and t.name is 'table'
-                       parse_error()
-                       if is_in_table_scope 'caption', NS_HTML
-                               loop
-                                       el = open_els.shift()
-                                       if el.name is 'caption' and el.namespace is NS_HTML
-                                               break
-                               clear_afe_to_marker()
-                               ins_mode = ins_mode_in_table
-                               process_token t
-                       # else fragment case
-                       return
-               if t.type is TYPE_END_TAG and (t.name is 'body' or t.name is 'col' or t.name is 'colgroup' or t.name is 'html' or t.name is 'tbody' or t.name is 'td' or t.name is 'tfoot' or t.name is 'th' or t.name is 'thead' or t.name is 'tr')
-                       parse_error()
-                       return
-               # Anything else
-               ins_mode_in_body t
-               return
-
-       # 8.2.5.4.12 http://www.w3.org/TR/html5/syntax.html#parsing-main-incolgroup
-       ins_mode_in_column_group = (t) ->
-               if is_space_tok t
-                       insert_character t
-                       return
-               if t.type is TYPE_COMMENT
-                       insert_comment t
-                       return
-               if t.type is TYPE_DOCTYPE
-                       parse_error()
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'html'
-                       ins_mode_in_body t
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'col'
-                       el = insert_html_element t
-                       open_els.shift()
-                       t.acknowledge_self_closing()
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'colgroup'
-                       if open_els[0].name is 'colgroup' and open_els.namespace is NS_HTML
-                               open_els.shift()
-                               ins_mode = ins_mode_in_table
-                       else
-                               parse_error()
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'col'
-                       parse_error()
-                       return
-               if (t.type is TYPE_START_TAG or t.type is TYPE_END_TAG) and t.name is 'template'
-                       ins_mode_in_head t
-                       return
-               if t.type is TYPE_EOF
-                       ins_mode_in_body t
-                       return
-               # Anything else
-               if open_els[0].name isnt 'colgroup'
-                       parse_error()
-                       return
-               open_els.shift()
-               ins_mode = ins_mode_in_table
-               process_token t
-               return
-
-       # 8.2.5.4.13 http://www.w3.org/TR/html5/syntax.html#parsing-main-intbody
-       ins_mode_in_table_body = (t) ->
-               if t.type is TYPE_START_TAG and t.name is 'tr'
-                       clear_stack_to_table_body_context()
-                       insert_html_element t
-                       ins_mode = ins_mode_in_row
-                       return
-               if t.type is TYPE_START_TAG and (t.name is 'th' or t.name is 'td')
-                       parse_error()
-                       clear_stack_to_table_body_context()
-                       insert_html_element new_open_tag 'tr'
-                       ins_mode = ins_mode_in_row
-                       process_token t
-                       return
-               if t.type is TYPE_END_TAG and (t.name is 'tbody' or t.name is 'tfoot' or t.name is 'thead')
-                       unless is_in_table_scope t.name, NS_HTML
-                               parse_error()
-                               return
-                       clear_stack_to_table_body_context()
-                       open_els.shift()
-                       ins_mode = ins_mode_in_table
-                       return
-               if (t.type is TYPE_START_TAG and (t.name is 'caption' or t.name is 'col' or t.name is 'colgroup' or t.name is 'tbody' or t.name is 'tfoot' or t.name is 'thead')) or (t.type is TYPE_END_TAG and t.name is 'table')
-                       has = false
-                       for el in open_els
-                               if el.namespace is NS_HTML and (el.name is 'tbody' or el.name is 'tfoot' or el.name is 'thead')
-                                       has = true
-                                       break
-                               if table_scopers[el.name] is el.namespace
-                                       break
-                       if !has
-                               parse_error()
-                               return
-                       clear_stack_to_table_body_context()
-                       open_els.shift()
-                       ins_mode = ins_mode_in_table
-                       process_token t
-                       return
-               if t.type is TYPE_END_TAG and (t.name is 'body' or t.name is 'caption' or t.name is 'col' or t.name is 'colgroup' or t.name is 'html' or t.name is 'td' or t.name is 'th' or t.name is 'tr')
-                       parse_error()
-                       return
-               # Anything else
-               ins_mode_in_table t
-               return
-
-       # 8.2.5.4.14 http://www.w3.org/TR/html5/syntax.html#parsing-main-intr
-       ins_mode_in_row = (t) ->
-               if t.type is TYPE_START_TAG and (t.name is 'th' or t.name is 'td')
-                       clear_stack_to_table_row_context()
-                       insert_html_element t
-                       ins_mode = ins_mode_in_cell
-                       afe_push_marker()
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'tr'
-                       if is_in_table_scope 'tr', NS_HTML
-                               clear_stack_to_table_row_context()
-                               open_els.shift()
-                               ins_mode = ins_mode_in_table_body
-                       else
-                               parse_error()
-                       return
-               if (t.type is TYPE_START_TAG and (t.name is 'caption' or t.name is 'col' or t.name is 'colgroup' or t.name is 'tbody' or t.name is 'tfoot' or t.name is 'thead' or t.name is 'tr')) or t.type is TYPE_END_TAG and t.name is 'table'
-                       if is_in_table_scope 'tr', NS_HTML
-                               clear_stack_to_table_row_context()
-                               open_els.shift()
-                               ins_mode = ins_mode_in_table_body
-                               process_token t
-                       else
-                               parse_error()
-                       return
-               if t.type is TYPE_END_TAG and (t.name is 'tbody' or t.name is 'tfoot' or t.name is 'thead')
-                       if is_in_table_scope t.name, NS_HTML
-                               if is_in_table_scope 'tr', NS_HTML
-                                       clear_stack_to_table_row_context()
-                                       open_els.shift()
-                                       ins_mode = ins_mode_in_table_body
-                                       process_token t
-                       else
-                               parse_error()
-                       return
-               if t.type is TYPE_END_TAG and (t.name is 'body' or t.name is 'caption' or t.name is 'col' or t.name is 'colgroup' or t.name is 'html' or t.name is 'td' or t.name is 'th')
-                       parse_error()
-                       return
-               # Anything else
-               ins_mode_in_table t
-               return
-
-       # http://www.w3.org/TR/html5/syntax.html#close-the-cell
-       close_the_cell = ->
-               generate_implied_end_tags()
-               unless (open_els[0].name is 'td' or open_els[0] is 'th') and open_els[0].namespace is NS_HTML
-                       parse_error()
-               loop
-                       el = open_els.shift()
-                       if el.namespace is NS_HTML and (el.name is 'td' or el.name is 'th')
-                               break
-               clear_afe_to_marker()
-               ins_mode = ins_mode_in_row
-               return
-
-       # 8.2.5.4.15 http://www.w3.org/TR/html5/syntax.html#parsing-main-intd
-       ins_mode_in_cell = (t) ->
-               if t.type is TYPE_END_TAG and (t.name is 'td' or t.name is 'th')
-                       if is_in_table_scope t.name, NS_HTML
-                               generate_implied_end_tags()
-                               unless (open_els[0].name is t.name) and open_els[0].namespace is NS_HTML
-                                       parse_error()
-                               loop
-                                       el = open_els.shift()
-                                       if el.name is t.name and el.namespace is NS_HTML
-                                               break
-                               clear_afe_to_marker()
-                               ins_mode = ins_mode_in_row
-                       else
-                               parse_error()
-                       return
-               if t.type is TYPE_START_TAG and (t.name is 'caption' or t.name is 'col' or t.name is 'colgroup' or t.name is 'tbody' or t.name is 'td' or t.name is 'tfoot' or t.name is 'th' or t.name is 'thead' or t.name is 'tr')
-                       has = false
-                       for el in open_els
-                               if el.namespace is NS_HTML and (el.name is 'td' or el.name is 'th')
-                                       has = true
-                                       break
-                               if table_scopers[el.name] is el.namespace
-                                       break
-                       if !has
-                               parse_error()
-                               return
-                       close_the_cell()
-                       process_token t
-                       return
-               if t.type is TYPE_END_TAG and (t.name is 'body' or t.name is 'caption' or t.name is 'col' or t.name is 'colgroup' or t.name is 'html')
-                       parse_error()
-                       return
-               if t.type is TYPE_END_TAG and (t.name is 'table' or t.name is 'tbody' or t.name is 'tfoot' or t.name is 'thead' or t.name is 'tr')
-                       if is_in_table_scope t.name, NS_HTML
-                               close_the_cell()
-                               process_token t
-                       else
-                               parse_error()
-                       return
-               # Anything Else
-               ins_mode_in_body t
-               return
-
-       # 8.2.5.4.16 http://www.w3.org/TR/html5/syntax.html#parsing-main-inselect
-       ins_mode_in_select = (t) ->
-               if t.type is TYPE_TEXT and t.text is "\u0000"
-                       parse_error()
-                       return
-               if t.type is TYPE_TEXT
-                       insert_character t
-                       return
-               if t.type is TYPE_COMMENT
-                       insert_comment t
-                       return
-               if t.type is TYPE_DOCTYPE
-                       parse_error()
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'html'
-                       ins_mode_in_body t
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'option'
-                       if open_els[0].name is 'option' and open_els[0].namespace is NS_HTML
-                               open_els.shift()
-                       insert_html_element t
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'optgroup'
-                       if open_els[0].name is 'option' and open_els[0].namespace is NS_HTML
-                               open_els.shift()
-                       if open_els[0].name is 'optgroup' and open_els[0].namespace is NS_HTML
-                               open_els.shift()
-                       insert_html_element t
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'optgroup'
-                       if open_els[0].name is 'option' and open_els[0].namespace is NS_HTML
-                               if open_els[1].name is 'optgroup' and open_els[0].namespace is NS_HTML
-                                       open_els.shift()
-                       if open_els[0].name is 'optgroup' and open_els[0].namespace is NS_HTML
-                               open_els.shift()
-                       else
-                               parse_error()
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'option'
-                       if open_els[0].name is 'option' and open_els[0].namespace is NS_HTML
-                               open_els.shift()
-                       else
-                               parse_error()
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'select'
-                       if is_in_select_scope 'select', NS_HTML
-                               loop
-                                       el = open_els.shift()
-                                       if el.name is 'select' and el.namespace is NS_HTML
-                                               break
-                               reset_ins_mode()
-                       else
-                               parse_error()
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'select'
-                       parse_error()
-                       loop
-                               el = open_els.shift()
-                               if el.name is 'select' and el.namespace is NS_HTML
-                                       break
-                       reset_ins_mode()
-                       # spec says that this is the same as </select> but it doesn't say
-                       # to check scope first
-                       return
-               if t.type is TYPE_START_TAG and (t.name is 'input' or t.name is 'keygen' or t.name is 'textarea')
-                       parse_error()
-                       unless is_in_select_scope 'select', NS_HTML
-                               return
-                       loop
-                               el = open_els.shift()
-                               if el.name is 'select' and el.namespace is NS_HTML
-                                       break
-                       reset_ins_mode()
-                       process_token t
-                       return
-               if t.type is TYPE_START_TAG and (t.name is 'script' or t.name is 'template')
-                       ins_mode_in_head t
-                       return
-               if t.type is TYPE_EOF
-                       ins_mode_in_body t
-                       return
-               # Anything else
-               parse_error()
-               return
-
-       # 8.2.5.4.17 http://www.w3.org/TR/html5/syntax.html#parsing-main-inselectintable
-       ins_mode_in_select_in_table = (t) ->
-               if t.type is TYPE_START_TAG and (t.name is 'caption' or t.name is 'table' or t.name is 'tbody' or t.name is 'tfoot' or t.name is 'thead' or t.name is 'tr' or t.name is 'td' or t.name is 'th')
-                       parse_error()
-                       loop
-                               el = open_els.shift()
-                               if el.name is 'select' and el.namespace is NS_HTML
-                                       break
-                       reset_ins_mode()
-                       process_token t
-                       return
-               if t.type is TYPE_END_TAG and (t.name is 'caption' or t.name is 'table' or t.name is 'tbody' or t.name is 'tfoot' or t.name is 'thead' or t.name is 'tr' or t.name is 'td' or t.name is 'th')
-                       parse_error()
-                       unless is_in_table_scope t.name, NS_HTML
-                               return
-                       loop
-                               el = open_els.shift()
-                               if el.name is 'select' and el.namespace is NS_HTML
-                                       break
-                       reset_ins_mode()
-                       process_token t
-                       return
-               # Anything else
-               ins_mode_in_select t
-               return
-
-       # 8.2.5.4.18 http://www.w3.org/TR/html5/syntax.html#parsing-main-intemplate
-       ins_mode_in_template = (t) ->
-               if t.type is TYPE_TEXT or t.type is TYPE_COMMENT or t.type is TYPE_DOCTYPE
-                       ins_mode_in_body t
-                       return
-               if (t.type is TYPE_START_TAG and (t.name is 'base' or t.name is 'basefont' or t.name is 'bgsound' or t.name is 'link' or t.name is 'meta' or t.name is 'noframes' or t.name is 'script' or t.name is 'style' or t.name is 'template' or t.name is 'title')) or (t.type is TYPE_END_TAG and t.name is 'template')
-                       ins_mode_in_head t
-                       return
-               if t.type is TYPE_START_TAG and (t.name is 'caption' or t.name is 'colgroup' or t.name is 'tbody' or t.name is 'tfoot' or t.name is 'thead')
-                       template_ins_modes.shift()
-                       template_ins_modes.unshift ins_mode_in_table
-                       ins_mode = ins_mode_in_table
-                       process_token t
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'col'
-                       template_ins_modes.shift()
-                       template_ins_modes.unshift ins_mode_in_column_group
-                       ins_mode = ins_mode_in_column_group
-                       process_token t
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'tr'
-                       template_ins_modes.shift()
-                       template_ins_modes.unshift ins_mode_in_table_body
-                       ins_mode = ins_mode_in_table_body
-                       process_token t
-                       return
-               if t.type is TYPE_START_TAG and (t.name is 'td' or t.name is 'th')
-                       template_ins_modes.shift()
-                       template_ins_modes.unshift ins_mode_in_row
-                       ins_mode = ins_mode_in_row
-                       process_token t
-                       return
-               if t.type is TYPE_START_TAG
-                       template_ins_modes.shift()
-                       template_ins_modes.unshift ins_mode_in_body
-                       ins_mode = ins_mode_in_body
-                       process_token t
-                       return
-               if t.type is TYPE_END_TAG
-                       parse_error()
-                       return
-               if t.type is TYPE_EOF
-                       unless template_tag_is_open()
-                               stop_parsing()
-                               return
-                       parse_error()
-                       loop
-                               el = open_els.shift()
-                               if el.name is 'template' and el.namespace is NS_HTML
-                                       break
-                       clear_afe_to_marker()
-                       template_ins_modes.shift()
-                       reset_ins_mode()
-                       process_token t
-               return
-
-       # 8.2.5.4.19 http://www.w3.org/TR/html5/syntax.html#parsing-main-afterbody
-       ins_mode_after_body = (t) ->
-               if is_space_tok t
-                       ins_mode_in_body t
-                       return
-               if t.type is TYPE_COMMENT
-                       first = open_els[open_els.length - 1]
-                       insert_comment t, [first, first.children.length]
-                       return
-               if t.type is TYPE_DOCTYPE
-                       parse_error()
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'html'
-                       ins_mode_in_body t
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'html'
-                       if flag_fragment_parsing
-                               parse_error()
-                               return
-                       ins_mode = ins_mode_after_after_body
-                       return
-               if t.type is TYPE_EOF
-                       stop_parsing()
-                       return
-               # Anything ELse
-               parse_error()
-               ins_mode = ins_mode_in_body
-               process_token t
-               return
-
-       # 8.2.5.4.20 http://www.w3.org/TR/html5/syntax.html#parsing-main-inframeset
-       ins_mode_in_frameset = (t) ->
-               if is_space_tok t
-                       insert_character t
-                       return
-               if t.type is TYPE_COMMENT
-                       insert_comment t
-                       return
-               if t.type is TYPE_DOCTYPE
-                       parse_error()
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'html'
-                       ins_mode_in_body t
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'frameset'
-                       insert_html_element t
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'frameset'
-                       if open_els.length is 1
-                               parse_error()
-                               return # fragment case
-                       open_els.shift()
-                       if flag_fragment_parsing is false and open_els[0].name isnt 'frameset'
-                               ins_mode = ins_mode_after_frameset
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'frame'
-                       insert_html_element t
-                       open_els.shift()
-                       t.acknowledge_self_closing()
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'noframes'
-                       ins_mode_in_head t
-                       return
-               if t.type is TYPE_EOF
-                       if open_els.length isnt 1
-                               parse_error()
-                       stop_parsing()
-                       return
-               # Anything else
-               parse_error()
-               return
-
-       # 8.2.5.4.21 http://www.w3.org/TR/html5/syntax.html#parsing-main-afterframeset
-       ins_mode_after_frameset = (t) ->
-               if is_space_tok t
-                       insert_character t
-                       return
-               if t.type is TYPE_COMMENT
-                       insert_comment t
-                       return
-               if t.type is TYPE_DOCTYPE
-                       parse_error()
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'html'
-                       ins_mode_in_body t
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'html'
-                       ins_mode = ins_mode_after_after_frameset
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'noframes'
-                       ins_mode_in_head t
-                       return
-               if t.type is TYPE_EOF
-                       stop_parsing()
-                       return
-               # Anything else
-               parse_error()
-               return
-
-       # 8.2.5.4.22 http://www.w3.org/TR/html5/syntax.html#the-after-after-body-insertion-mode
-       ins_mode_after_after_body = (t) ->
-               if t.type is TYPE_COMMENT
-                       insert_comment t, [doc, doc.children.length]
-                       return
-               if t.type is TYPE_DOCTYPE or is_space_tok(t) or (t.type is TYPE_START_TAG and t.name is 'html')
-                       ins_mode_in_body t
-                       return
-               if t.type is TYPE_EOF
-                       stop_parsing()
-                       return
-               # Anything else
-               parse_error()
-               ins_mode = ins_mode_in_body
-               process_token t
-               return
-
-       # 8.2.5.4.23 http://www.w3.org/TR/html5/syntax.html#the-after-after-frameset-insertion-mode
-       ins_mode_after_after_frameset = (t) ->
-               if t.type is TYPE_COMMENT
-                       insert_comment t, [doc, doc.children.length]
-                       return
-               if t.type is TYPE_DOCTYPE or is_space_tok(t) or (t.type is TYPE_START_TAG and t.name is 'html')
-                       ins_mode_in_body t
-                       return
-               if t.type is TYPE_EOF
-                       stop_parsing()
-                       return
-               if t.type is TYPE_START_TAG and t.name is 'noframes'
-                       ins_mode_in_head t
-                       return
-               # Anything else
-               parse_error()
-               return
-
-       # 8.2.5.5 http://www.w3.org/TR/html5/syntax.html#parsing-main-inforeign
-       has_color_face_or_size = (t) ->
-               for a in t.attrs_a
-                       if a[0] is 'color' or a[0] is 'face' or a[0] is 'size'
-                               return true
-               return false
-       in_foreign_content_end_script = ->
-               open_els.shift()
-               # fixfull
-               return
-       in_foreign_content_other_start = (t) ->
-               acn = adjusted_current_node()
-               if acn.namespace is NS_MATHML
-                       adjust_mathml_attributes t
-               if acn.namespace is NS_SVG and svg_name_fixes[t.name]?
-                       t.name = svg_name_fixes[t.name]
-               if acn.namespace is NS_SVG
-                       adjust_svg_attributes t
-               adjust_foreign_attributes t
-               insert_foreign_element t, acn.namespace
-               if t.flag 'self-closing'
-                       if t.name is 'script'
-                               t.acknowledge_self_closing()
-                               in_foreign_content_end_script()
-                               # fixfull
-                       else
-                               open_els.shift()
-                               t.acknowledge_self_closing()
-               return
-       in_foreign_content = (t) ->
-               if t.type is TYPE_TEXT and t.text is "\u0000"
-                       parse_error()
-                       insert_character new_character_token "\ufffd"
-                       return
-               if is_space_tok t
-                       insert_character t
-                       return
-               if t.type is TYPE_TEXT
-                       flag_frameset_ok = false
-                       insert_character t
-                       return
-               if t.type is TYPE_COMMENT
-                       insert_comment t
-                       return
-               if t.type is TYPE_DOCTYPE
-                       parse_error()
-                       return
-               if t.type is TYPE_START_TAG and (t.name is 'b' or t.name is 'big' or t.name is 'blockquote' or t.name is 'body' or t.name is 'br' or t.name is 'center' or t.name is 'code' or t.name is 'dd' or t.name is 'div' or t.name is 'dl' or t.name is 'dt' or t.name is 'em' or t.name is 'embed' or t.name is 'h1' or t.name is 'h2' or t.name is 'h3' or t.name is 'h4' or t.name is 'h5' or t.name is 'h6' or t.name is 'head' or t.name is 'hr' or t.name is 'i' or t.name is 'img' or t.name is 'li' or t.name is 'listing' or t.name is 'main' or t.name is 'meta' or t.name is 'nobr' or t.name is 'ol' or t.name is 'p' or t.name is 'pre' or t.name is 'ruby' or t.name is 's' or t.name is 'small' or t.name is 'span' or t.name is 'strong' or t.name is 'strike' or t.name is 'sub' or t.name is 'sup' or t.name is 'table' or t.name is 'tt' or t.name is 'u' or t.name is 'ul' or t.name is 'var' or (t.name is 'font' and has_color_face_or_size(t)))
-                       parse_error()
-                       if flag_fragment_parsing
-                               in_foreign_content_other_start t
-                               return
-                       loop # is this safe?
-                               open_els.shift()
-                               if is_mathml_text_integration_point(open_els[0]) or is_html_integration(open_els[0]) or open_els[0].namespace is NS_HTML
-                                       break
-                       process_token t
-                       return
-               if t.type is TYPE_START_TAG
-                       in_foreign_content_other_start t
-                       return
-               if t.type is TYPE_END_TAG and t.name is 'script' and open_els[0].name is 'script' and open_els[0].namespace is NS_SVG
-                       in_foreign_content_end_script()
-                       return
-               if t.type is TYPE_END_TAG
-                       i = 0
-                       node = open_els[i]
-                       if node.name.toLowerCase() isnt t.name
-                               parse_error()
-                       loop
-                               if node is open_els[open_els.length - 1]
-                                       return
-                               if node.name.toLowerCase() is t.name
-                                       loop
-                                               el = open_els.shift()
-                                               if el is node
-                                                       return
-                               i += 1
-                               node = open_els[i]
-                               if node.namespace is NS_HTML
-                                       break
-                       ins_mode t # explicitly call HTML insertion mode
-               return
-
-
-       # 8.2.4.1 http://www.w3.org/TR/html5/syntax.html#data-state
-       tok_state_data = ->
-               switch c = txt.charAt(cur++)
-                       when '&'
-                               return new_text_node parse_character_reference()
-                       when '<'
-                               tok_state = tok_state_tag_open
-                       when "\u0000"
-                               parse_error()
-                               return new_text_node c
-                       when '' # EOF
-                               return new_eof_token()
-                       else
-                               return new_text_node c
-               return null
-
-       # 8.2.4.2 http://www.w3.org/TR/html5/syntax.html#character-reference-in-data-state
-       # not needed: tok_state_character_reference_in_data = ->
-       # just call parse_character_reference()
-
-       # 8.2.4.3 http://www.w3.org/TR/html5/syntax.html#rcdata-state
-       tok_state_rcdata = ->
-               switch c = txt.charAt(cur++)
-                       when '&'
-                               return new_text_node parse_character_reference()
-                       when '<'
-                               tok_state = tok_state_rcdata_less_than_sign
-                       when "\u0000"
-                               parse_error()
-                               return new_character_token "\ufffd"
-                       when '' # EOF
-                               return new_eof_token()
-                       else
-                               return new_character_token c
-               return null
-
-       # 8.2.4.4 http://www.w3.org/TR/html5/syntax.html#character-reference-in-rcdata-state
-       # not needed: tok_state_character_reference_in_rcdata = ->
-       # just call parse_character_reference()
-
-       # 8.2.4.5 http://www.w3.org/TR/html5/syntax.html#rawtext-state
-       tok_state_rawtext = ->
-               switch c = txt.charAt(cur++)
-                       when '<'
-                               tok_state = tok_state_rawtext_less_than_sign
-                       when "\u0000"
-                               parse_error()
-                               return new_character_token "\ufffd"
-                       when '' # EOF
-                               return new_eof_token()
-                       else
-                               return new_character_token c
-               return null
-
-       # 8.2.4.6 http://www.w3.org/TR/html5/syntax.html#script-data-state
-       tok_state_script_data = ->
-               switch c = txt.charAt(cur++)
-                       when '<'
-                               tok_state = tok_state_script_data_less_than_sign
-                       when "\u0000"
-                               parse_error()
-                               return new_character_token "\ufffd"
-                       when '' # EOF
-                               return new_eof_token()
-                       else
-                               return new_character_token c
-               return null
-
-       # 8.2.4.7 http://www.w3.org/TR/html5/syntax.html#plaintext-state
-       tok_state_plaintext = ->
-               switch c = txt.charAt(cur++)
-                       when "\u0000"
-                               parse_error()
-                               return new_character_token "\ufffd"
-                       when '' # EOF
-                               return new_eof_token()
-                       else
-                               return new_character_token c
-               return null
-
-
-       # 8.2.4.8 http://www.w3.org/TR/html5/syntax.html#tag-open-state
-       tok_state_tag_open = ->
-               c = txt.charAt(cur++)
-               if c is '!'
-                       tok_state = tok_state_markup_declaration_open
-                       return
-               if c is '/'
-                       tok_state = tok_state_end_tag_open
-                       return
-               if is_uc_alpha(c)
-                       tok_cur_tag = new_open_tag c.toLowerCase()
-                       tok_state = tok_state_tag_name
-                       return
-               if is_lc_alpha(c)
-                       tok_cur_tag = new_open_tag c
-                       tok_state = tok_state_tag_name
-                       return
-               if c is '?'
-                       parse_error()
-                       tok_cur_tag = new_comment_token '?' # FIXME right?
-                       tok_state = tok_state_bogus_comment
-                       return
-               # Anything else
-               parse_error()
-               tok_state = tok_state_data
-               cur -= 1 # we didn't parse/handle the char after <
-               return new_text_node '<'
-
-       # 8.2.4.9 http://www.w3.org/TR/html5/syntax.html#end-tag-open-state
-       tok_state_end_tag_open = ->
-               c = txt.charAt(cur++)
-               if is_uc_alpha(c)
-                       tok_cur_tag = new_end_tag c.toLowerCase()
-                       tok_state = tok_state_tag_name
-                       return
-               if is_lc_alpha(c)
-                       tok_cur_tag = new_end_tag c
-                       tok_state = tok_state_tag_name
-                       return
-               if c is '>'
-                       parse_error()
-                       tok_state = tok_state_data
-                       return
-               if c is '' # EOF
-                       parse_error()
-                       tok_state = tok_state_data
-                       return new_text_node '</'
-               # Anything else
-               parse_error()
-               tok_cur_tag = new_comment_token c
-               tok_state = tok_state_bogus_comment
-               return null
-
-       # 8.2.4.10 http://www.w3.org/TR/html5/syntax.html#tag-name-state
-       tok_state_tag_name = ->
-               switch c = txt.charAt(cur++)
-                       when "\t", "\n", "\u000c", ' '
-                               tok_state = tok_state_before_attribute_name
-                       when '/'
-                               tok_state = tok_state_self_closing_start_tag
-                       when '>'
-                               tok_state = tok_state_data
-                               tmp = tok_cur_tag
-                               tok_cur_tag = null
-                               return tmp
-                       when "\u0000"
-                               parse_error()
-                               tok_cur_tag.name += "\ufffd"
-                       when '' # EOF
-                               parse_error()
-                               tok_state = tok_state_data
-                       else
-                               if is_uc_alpha(c)
-                                       tok_cur_tag.name += c.toLowerCase()
-                               else
-                                       tok_cur_tag.name += c
-               return null
-
-       # 8.2.4.11 http://www.w3.org/TR/html5/syntax.html#rcdata-less-than-sign-state
-       tok_state_rcdata_less_than_sign = ->
-               c = txt.charAt(cur++)
-               if c is '/'
-                       temporary_buffer = ''
-                       tok_state = tok_state_rcdata_end_tag_open
-                       return null
-               # Anything else
-               tok_state = tok_state_rcdata
-               cur -= 1 # reconsume the input character
-               return new_character_token '<'
-
-       # 8.2.4.12 http://www.w3.org/TR/html5/syntax.html#rcdata-end-tag-open-state
-       tok_state_rcdata_end_tag_open = ->
-               c = txt.charAt(cur++)
-               if is_uc_alpha(c)
-                       tok_cur_tag = new_end_tag c.toLowerCase()
-                       temporary_buffer += c
-                       tok_state = tok_state_rcdata_end_tag_name
-                       return null
-               if is_lc_alpha(c)
-                       tok_cur_tag = new_end_tag c
-                       temporary_buffer += c
-                       tok_state = tok_state_rcdata_end_tag_name
-                       return null
-               # Anything else
-               tok_state = tok_state_rcdata
-               cur -= 1 # reconsume the input character
-               return new_character_token "</" # fixfull separate these
-
-       # http://www.w3.org/TR/html5/syntax.html#appropriate-end-tag-token
-       is_appropriate_end_tag = (t) ->
-               # fixfull: this assumes that open_els[0].name is "the tag name of the last
-               # start tag to have been emitted from this tokenizer"
-               return t.type is TYPE_END_TAG and t.name is open_els[0].name
-
-       # 8.2.4.13 http://www.w3.org/TR/html5/syntax.html#rcdata-end-tag-name-state
-       tok_state_rcdata_end_tag_name = ->
-               c = txt.charAt(cur++)
-               if c is "\t" or c is "\n" or c is "\u000c" or c is ' '
-                       if is_appropriate_end_tag tok_cur_tag
-                               tok_state = tok_state_before_attribute_name
-                               return
-                       # else fall through to "Anything else"
-               if c is '/'
-                       if is_appropriate_end_tag tok_cur_tag
-                               tok_state = tok_state_self_closing_start_tag # FIXME spec typo?
-                               return
-                       # else fall through to "Anything else"
-               if c is '>'
-                       if is_appropriate_end_tag tok_cur_tag
-                               tok_state = tok_state_data
-                               return tok_cur_tag
-                       # else fall through to "Anything else"
-               if is_uc_alpha(c)
-                       tok_cur_tag.name += c.toLowerCase()
-                       temporary_buffer += c
-                       return null
-               if is_lc_alpha(c)
-                       tok_cur_tag.name += c
-                       temporary_buffer += c
-                       return null
-               # Anything else
-               tok_state = tok_state_rcdata
-               cur -= 1 # reconsume the input character
-               return new_character_token '</' + temporary_buffer # fixfull separate these
-
-       # 8.2.4.14 http://www.w3.org/TR/html5/syntax.html#rawtext-less-than-sign-state
-       tok_state_rawtext_less_than_sign = ->
-               c = txt.charAt(cur++)
-               if c is '/'
-                       temporary_buffer = ''
-                       tok_state = tok_state_rawtext_end_tag_open
-                       return null
-               # Anything else
-               tok_state = tok_state_rawtext
-               cur -= 1 # reconsume the input character
-               return new_character_token '<'
-
-       # 8.2.4.15 http://www.w3.org/TR/html5/syntax.html#rawtext-end-tag-open-state
-       tok_state_rawtext_end_tag_open = ->
-               c = txt.charAt(cur++)
-               if is_uc_alpha(c)
-                       tok_cur_tag = new_end_tag c.toLowerCase()
-                       temporary_buffer += c
-                       tok_state = tok_state_rawtext_end_tag_name
-                       return null
-               if is_lc_alpha(c)
-                       tok_cur_tag = new_end_tag c
-                       temporary_buffer += c
-                       tok_state = tok_state_rawtext_end_tag_name
-                       return null
-               # Anything else
-               tok_state = tok_state_rawtext
-               cur -= 1 # reconsume the input character
-               return new_character_token "</" # fixfull separate these
-
-       # 8.2.4.16 http://www.w3.org/TR/html5/syntax.html#rawtext-end-tag-name-state
-       tok_state_rawtext_end_tag_name = ->
-               c = txt.charAt(cur++)
-               if c is "\t" or c is "\n" or c is "\u000c" or c is ' '
-                       if is_appropriate_end_tag tok_cur_tag
-                               tok_state = tok_state_before_attribute_name
-                               return
-                       # else fall through to "Anything else"
-               if c is '/'
-                       if is_appropriate_end_tag tok_cur_tag
-                               tok_state = tok_state_self_closing_start_tag
-                               return
-                       # else fall through to "Anything else"
-               if c is '>'
-                       if is_appropriate_end_tag tok_cur_tag
-                               tok_state = tok_state_data
-                               return tok_cur_tag
-                       # else fall through to "Anything else"
-               if is_uc_alpha(c)
-                       tok_cur_tag.name += c.toLowerCase()
-                       temporary_buffer += c
-                       return null
-               if is_lc_alpha(c)
-                       tok_cur_tag.name += c
-                       temporary_buffer += c
-                       return null
-               # Anything else
-               tok_state = tok_state_rawtext
-               cur -= 1 # reconsume the input character
-               return new_character_token '</' + temporary_buffer # fixfull separate these
-
-       # 8.2.4.17 http://www.w3.org/TR/html5/syntax.html#script-data-less-than-sign-state
-       tok_state_script_data_less_than_sign = ->
-               c = txt.charAt(cur++)
-               if c is '/'
-                       temporary_buffer = ''
-                       tok_state = tok_state_script_data_end_tag_open
-                       return
-               if c is '!'
-                       tok_state = tok_state_script_data_escape_start
-                       return new_character_token '<!' # fixfull split
-               # Anything else
-               tok_state = tok_state_script_data
-               cur -= 1 # Reconsume
-               return new_character_token '<'
-
-       # 8.2.4.18 http://www.w3.org/TR/html5/syntax.html#script-data-end-tag-open-state
-       tok_state_script_data_end_tag_open = ->
-               c = txt.charAt(cur++)
-               if is_uc_alpha(c)
-                       tok_cur_tag = new_end_tag c.toLowerCase()
-                       temporary_buffer += c
-                       tok_state = tok_state_script_data_end_tag_name
-                       return
-               if is_lc_alpha(c)
-                       tok_cur_tag = new_end_tag c
-                       temporary_buffer += c
-                       tok_state = tok_state_script_data_end_tag_name
-                       return
-               # Anything else
-               tok_state = tok_state_script_data
-               cur -= 1 # Reconsume
-               return new_character_token '</'
-
-       # 8.2.4.19 http://www.w3.org/TR/html5/syntax.html#script-data-end-tag-open-state
-       tok_state_script_data_end_tag_name = ->
-               c = txt.charAt(cur++)
-               if c is "\t" or c is "\n" or c is "\u000c" or c is ' '
-                       if is_appropriate_end_tag tok_cur_tag
-                               tok_state = tok_state_before_attribute_name
-                               return
-                       # fall through
-               if c is '/'
-                       if is_appropriate_end_tag tok_cur_tag
-                               tok_state = tok_state_self_closing_start_tag
-                               return
-                       # fall through
-               if c is '>'
-                       if is_appropriate_end_tag tok_cur_tag
-                               tok_state = tok_state_data
-                               return tok_cur_tag
-                       # fall through
-               if is_uc_alpha(c)
-                       tok_cur_tag.name += c.toLowerCase()
-                       temporary_buffer += c
-                       return
-               if is_lc_alpha(c)
-                       tok_cur_tag.name += c
-                       temporary_buffer += c
-                       return
-               # Anything else
-               tok_state = tok_state_script_data
-               cur -= 1 # Reconsume
-               return new_character_token "</#{temporary_buffer}" # fixfull split
-
-       # 8.2.4.20 http://www.w3.org/TR/html5/syntax.html#script-data-escape-start-state
-       tok_state_script_data_escape_start = ->
-               c = txt.charAt(cur++)
-               if c is '-'
-                       tok_state = tok_state_script_data_escape_start_dash
-                       return new_character_token '-'
-               # Anything else
-               tok_state = tok_state_script_data
-               cur -= 1 # Reconsume
-               return
-
-       # 8.2.4.21 http://www.w3.org/TR/html5/syntax.html#script-data-escape-start-dash-state
-       tok_state_script_data_escape_start_dash = ->
-               c = txt.charAt(cur++)
-               if c is '-'
-                       tok_state = tok_state_script_data_escaped_dash_dash
-                       return new_character_token '-'
-               # Anything else
-               tok_state = tok_state_script_data
-               cur -= 1 # Reconsume
-               return
-
-       # 8.2.4.22 http://www.w3.org/TR/html5/syntax.html#script-data-escaped-state
-       tok_state_script_data_escaped = ->
-               c = txt.charAt(cur++)
-               if c is '-'
-                       tok_state = tok_state_script_data_escaped_dash
-                       return new_character_token '-'
-               if c is '<'
-                       tok_state = tok_state_script_data_escaped_less_than_sign
-                       return
-               if c is "\u0000"
-                       parse_error()
-                       return new_character_token "\ufffd"
-               if c is '' # EOF
-                       tok_state = tok_state_data
-                       parse_error()
-                       cur -= 1 # Reconsume
-                       return
-               # Anything else
-               return new_character_token c
-
-       # 8.2.4.23 http://www.w3.org/TR/html5/syntax.html#script-data-escaped-dash-state
-       tok_state_script_data_escaped_dash = ->
-               c = txt.charAt(cur++)
-               if c is '-'
-                       tok_state = tok_state_script_data_escaped_dash_dash
-                       return new_character_token '-'
-               if c is '<'
-                       tok_state = tok_state_script_data_escaped_less_than_sign
-                       return
-               if c is "\u0000"
-                       parse_error()
-                       tok_state = tok_state_script_data_escaped
-                       return new_character_token "\ufffd"
-               if c is '' # EOF
-                       tok_state = tok_state_data
-                       parse_error()
-                       cur -= 1 # Reconsume
-                       return
-               # Anything else
-               tok_state = tok_state_script_data_escaped
-               return new_character_token c
-
-       # 8.2.4.24 http://www.w3.org/TR/html5/syntax.html#script-data-escaped-dash-dash-state
-       tok_state_script_data_escaped_dash_dash = ->
-               c = txt.charAt(cur++)
-               if c is '-'
-                       return new_character_token '-'
-               if c is '<'
-                       tok_state = tok_state_script_data_escaped_less_than_sign
-                       return
-               if c is '>'
-                       tok_state = tok_state_script_data
-                       return new_character_token '>'
-               if c is "\u0000"
-                       parse_error()
-                       tok_state = tok_state_script_data_escaped
-                       return new_character_token "\ufffd"
-               if c is '' # EOF
-                       parse_error()
-                       tok_state = tok_state_data
-                       cur -= 1 # Reconsume
-                       return
-               # Anything else
-               tok_state = tok_state_script_data_escaped
-               return new_character_token c
-
-       # 8.2.4.25 http://www.w3.org/TR/html5/syntax.html#script-data-escaped-less-than-sign-state
-       tok_state_script_data_escaped_less_than_sign = ->
-               c = txt.charAt(cur++)
-               if c is '/'
-                       temporary_buffer = ''
-                       tok_state = tok_state_script_data_escaped_end_tag_open
-                       return
-               if is_uc_alpha(c)
-                       temporary_buffer = c.toLowerCase() # yes, really
-                       tok_state = tok_state_script_data_double_escape_start
-                       return new_character_token "<#{c}" # fixfull split
-               if is_lc_alpha(c)
-                       temporary_buffer = c
-                       tok_state = tok_state_script_data_double_escape_start
-                       return new_character_token "<#{c}" # fixfull split
-               # Anything else
-               tok_state = tok_state_script_data_escaped
-               cur -= 1 # Reconsume
-               return new_character_token '<'
-
-       # 8.2.4.26 http://www.w3.org/TR/html5/syntax.html#script-data-escaped-end-tag-open-state
-       tok_state_script_data_escaped_end_tag_open = ->
-               c = txt.charAt(cur++)
-               if is_uc_alpha(c)
-                       tok_cur_tag = new_end_tag c.toLowerCase()
-                       temporary_buffer += c
-                       tok_state = tok_state_script_data_escaped_end_tag_name
-                       return
-               if is_lc_alpha(c)
-                       tok_cur_tag = new_end_tag c
-                       temporary_buffer += c
-                       tok_state = tok_state_script_data_escaped_end_tag_name
-                       return
-               # Anything else
-               tok_state = tok_state_script_data_escaped
-               cur -= 1 # Reconsume
-               return new_character_token '</' # fixfull split
-
-       # 8.2.4.27 http://www.w3.org/TR/html5/syntax.html#script-data-escaped-end-tag-name-state
-       tok_state_script_data_escaped_end_tag_name = ->
-               c = txt.charAt(cur++)
-               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
-                       if is_appropriate_end_tag tok_cur_tag
-                               tok_state = tok_state_before_attribute_name
-                               return
-                       # fall through
-               if c is '/'
-                       if is_appropriate_end_tag tok_cur_tag
-                               tok_state = tok_state_self_closing_start_tag
-                               return
-                       # fall through
-               if c is '>'
-                       if is_appropriate_end_tag tok_cur_tag
-                               tok_state = tok_state_data
-                               return tok_cur_tag
-                       # fall through
-               if is_uc_alpha(c)
-                       tok_cur_tag.name += c.toLowerCase()
-                       temporary_buffer += c.toLowerCase()
-                       return
-               if is_lc_alpha(c)
-                       tok_cur_tag.name += c
-                       temporary_buffer += c.toLowerCase()
-                       return
-               # Anything else
-               tok_state = tok_state_script_data_escaped
-               cur -= 1 # Reconsume
-               return new_character_token "</#{temporary_buffer}" # fixfull split
-
-       # 8.2.4.28 http://www.w3.org/TR/html5/syntax.html#script-data-double-escape-start-state
-       tok_state_script_data_double_escape_start = ->
-               c = txt.charAt(cur++)
-               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' ' or c is '/' or c is '>'
-                       if temporary_buffer is 'script'
-                               tok_state = tok_state_script_data_double_escaped
-                       else
-                               tok_state = tok_state_script_data_escaped
-                       return new_character_token c
-               if is_uc_alpha(c)
-                       temporary_buffer += c.toLowerCase() # yes, really lowercase
-                       return new_character_token c
-               if is_lc_alpha(c)
-                       temporary_buffer += c
-                       return new_character_token c
-               # Anything else
-               tok_state = tok_state_script_data_escaped
-               cur -= 1 # Reconsume
-               return
-
-       # 8.2.4.29 http://www.w3.org/TR/html5/syntax.html#script-data-double-escaped-state
-       tok_state_script_data_double_escaped = ->
-               c = txt.charAt(cur++)
-               if c is '-'
-                       tok_state = tok_state_script_data_double_escaped_dash
-                       return new_character_token '-'
-               if c is '<'
-                       tok_state = tok_state_script_data_double_escaped_less_than_sign
-                       return new_character_token '<'
-               if c is "\u0000"
-                       parse_error()
-                       return new_character_token "\ufffd"
-               if c is '' # EOF
-                       parse_error()
-                       tok_state = tok_state_data
-                       cur -= 1 # Reconsume
-                       return
-               # Anything else
-               return new_character_token c
-
-       # 8.2.4.30 http://www.w3.org/TR/html5/syntax.html#script-data-double-escaped-dash-state
-       tok_state_script_data_double_escaped_dash = ->
-               c = txt.charAt(cur++)
-               if c is '-'
-                       tok_state = tok_state_script_data_double_escaped_dash_dash
-                       return new_character_token '-'
-               if c is '<'
-                       tok_state = tok_state_script_data_double_escaped_less_than_sign
-                       return new_character_token '<'
-               if c is "\u0000"
-                       parse_error()
-                       tok_state = tok_state_script_data_double_escaped
-                       return new_character_token "\ufffd"
-               if c is '' # EOF
-                       parse_error()
-                       tok_state = tok_state_data
-                       cur -= 1 # Reconsume
-                       return
-               # Anything else
-               tok_state = tok_state_script_data_double_escaped
-               return new_character_token c
-
-       # 8.2.4.31 http://www.w3.org/TR/html5/syntax.html#script-data-double-escaped-dash-dash-state
-       tok_state_script_data_double_escaped_dash_dash = ->
-               c = txt.charAt(cur++)
-               if c is '-'
-                       return new_character_token '-'
-               if c is '<'
-                       tok_state = tok_state_script_data_double_escaped_less_than_sign
-                       return new_character_token '<'
-               if c is '>'
-                       tok_state = tok_state_script_data
-                       return new_character_token '>'
-               if c is "\u0000"
-                       parse_error()
-                       tok_state = tok_state_script_data_double_escaped
-                       return new_character_token "\ufffd"
-               if c is '' # EOF
-                       parse_error()
-                       tok_state = tok_state_data
-                       cur -= 1 # Reconsume
-                       return
-               # Anything else
-               tok_state = tok_state_script_data_double_escaped
-               return new_character_token c
-
-       # 8.2.4.32 http://www.w3.org/TR/html5/syntax.html#script-data-double-escaped-less-than-sign-state
-       tok_state_script_data_double_escaped_less_than_sign = ->
-               c = txt.charAt(cur++)
-               if c is '/'
-                       temporary_buffer = ''
-                       tok_state = tok_state_script_data_double_escape_end
-                       return new_character_token '/'
-               # Anything else
-               tok_state = tok_state_script_data_double_escaped
-               cur -= 1 # Reconsume
-               return
-
-       # 8.2.4.33 http://www.w3.org/TR/html5/syntax.html#script-data-double-escape-end-state
-       tok_state_script_data_double_escape_end = ->
-               c = txt.charAt(cur++)
-               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' ' or c is '/' or c is '>'
-                       if temporary_buffer is 'script'
-                               tok_state = tok_state_script_data_escaped
-                       else
-                               tok_state = tok_state_script_data_double_escaped
-                       return new_character_token c
-               if is_uc_alpha(c)
-                       temporary_buffer += c.toLowerCase() # yes, really lowercase
-                       return new_character_token c
-               if is_lc_alpha(c)
-                       temporary_buffer += c
-                       return new_character_token c
-               # Anything else
-               tok_state = tok_state_script_data_double_escaped
-               cur -= 1 # Reconsume
-               return
-
-       # 8.2.4.34 http://www.w3.org/TR/html5/syntax.html#before-attribute-name-state
-       tok_state_before_attribute_name = ->
-               attr_name = null
-               switch c = txt.charAt(cur++)
-                       when "\t", "\n", "\u000c", ' '
-                               return null
-                       when '/'
-                               tok_state = tok_state_self_closing_start_tag
-                               return null
-                       when '>'
-                               tok_state = tok_state_data
-                               tmp = tok_cur_tag
-                               tok_cur_tag = null
-                               return tmp
-                       when "\u0000"
-                               parse_error()
-                               attr_name = "\ufffd"
-                       when '"', "'", '<', '='
-                               parse_error()
-                               attr_name = c
-                       when '' # EOF
-                               parse_error()
-                               tok_state = tok_state_data
-                       else
-                               if is_uc_alpha(c)
-                                       attr_name = c.toLowerCase()
-                               else
-                                       attr_name = c
-               if attr_name?
-                       tok_cur_tag.attrs_a.unshift [attr_name, '']
-                       tok_state = tok_state_attribute_name
-               return null
-
-       # 8.2.4.35 http://www.w3.org/TR/html5/syntax.html#attribute-name-state
-       tok_state_attribute_name = ->
-               switch c = txt.charAt(cur++)
-                       when "\t", "\n", "\u000c", ' '
-                               tok_state = tok_state_after_attribute_name
-                       when '/'
-                               tok_state = tok_state_self_closing_start_tag
-                       when '='
-                               tok_state = tok_state_before_attribute_value
-                       when '>'
-                               tok_state = tok_state_data
-                               tmp = tok_cur_tag
-                               tok_cur_tag = null
-                               return tmp
-                       when "\u0000"
-                               parse_error()
-                               tok_cur_tag.attrs_a[0][0] += "\ufffd"
-                       when '"', "'", '<'
-                               parse_error()
-                               tok_cur_tag.attrs_a[0][0] += c
-                       when '' # EOF
-                               parse_error()
-                               tok_state = tok_state_data
-                       else
-                               if is_uc_alpha(c)
-                                       tok_cur_tag.attrs_a[0][0] += c.toLowerCase()
-                               else
-                                       tok_cur_tag.attrs_a[0][0] += c
-               return null
-
-       # 8.2.4.36 http://www.w3.org/TR/html5/syntax.html#after-attribute-name-state
-       tok_state_after_attribute_name = ->
-               c = txt.charAt(cur++)
-               if c is "\t" or c is "\n" or c is "\u000c" or c is ' '
-                       return
-               if c is '/'
-                       tok_state = tok_state_self_closing_start_tag
-                       return
-               if c is '='
-                       tok_state = tok_state_before_attribute_value
-                       return
-               if c is '>'
-                       tok_state = tok_state_data
-                       return tok_cur_tag
-               if is_uc_alpha(c)
-                       tok_cur_tag.attrs_a.unshift [c.toLowerCase(), '']
-                       tok_state = tok_state_attribute_name
-                       return
-               if c is "\u0000"
-                       parse_error()
-                       tok_cur_tag.attrs_a.unshift ["\ufffd", '']
-                       tok_state = tok_state_attribute_name
-                       return
-               if c is '' # EOF
-                       parse_error()
-                       tok_state = tok_state_data
-                       cur -= 1 # reconsume
-                       return
-               if c is '"' or c is "'" or c is '<'
-                       parse_error()
-                       # fall through to Anything else
-               # Anything else
-               tok_cur_tag.attrs_a.unshift [c, '']
-               tok_state = tok_state_attribute_name
-               return
-
-       # 8.2.4.37 http://www.w3.org/TR/html5/syntax.html#before-attribute-value-state
-       tok_state_before_attribute_value = ->
-               switch c = txt.charAt(cur++)
-                       when "\t", "\n", "\u000c", ' '
-                               return null
-                       when '"'
-                               tok_state = tok_state_attribute_value_double_quoted
-                       when '&'
-                               tok_state = tok_state_attribute_value_unquoted
-                               cur -= 1
-                       when "'"
-                               tok_state = tok_state_attribute_value_single_quoted
-                       when "\u0000"
-                               # Parse error
-                               tok_cur_tag.attrs_a[0][1] += "\ufffd"
-                               tok_state = tok_state_attribute_value_unquoted
-                       when '>'
-                               # Parse error
-                               tok_state = tok_state_data
-                               tmp = tok_cur_tag
-                               tok_cur_tag = null
-                               return tmp
-                       when '' # EOF
-                               parse_error()
-                               tok_state = tok_state_data
-                       else
-                               tok_cur_tag.attrs_a[0][1] += c
-                               tok_state = tok_state_attribute_value_unquoted
-               return null
-
-       # 8.2.4.38 http://www.w3.org/TR/html5/syntax.html#attribute-value-(double-quoted)-state
-       tok_state_attribute_value_double_quoted = ->
-               switch c = txt.charAt(cur++)
-                       when '"'
-                               tok_state = tok_state_after_attribute_value_quoted
-                       when '&'
-                               tok_cur_tag.attrs_a[0][1] += parse_character_reference '"', true
-                       when "\u0000"
-                               # Parse error
-                               tok_cur_tag.attrs_a[0][1] += "\ufffd"
-                       when '' # EOF
-                               parse_error()
-                               tok_state = tok_state_data
-                       else
-                               tok_cur_tag.attrs_a[0][1] += c
-               return null
-
-       # 8.2.4.39 http://www.w3.org/TR/html5/syntax.html#attribute-value-(single-quoted)-state
-       tok_state_attribute_value_single_quoted = ->
-               switch c = txt.charAt(cur++)
-                       when "'"
-                               tok_state = tok_state_after_attribute_value_quoted
-                       when '&'
-                               tok_cur_tag.attrs_a[0][1] += parse_character_reference "'", true
-                       when "\u0000"
-                               # Parse error
-                               tok_cur_tag.attrs_a[0][1] += "\ufffd"
-                       when '' # EOF
-                               parse_error()
-                               tok_state = tok_state_data
-                       else
-                               tok_cur_tag.attrs_a[0][1] += c
-               return null
-
-       # 8.2.4.40 http://www.w3.org/TR/html5/syntax.html#attribute-value-(unquoted)-state
-       tok_state_attribute_value_unquoted = ->
-               switch c = txt.charAt(cur++)
-                       when "\t", "\n", "\u000c", ' '
-                               tok_state = tok_state_before_attribute_name
-                       when '&'
-                               tok_cur_tag.attrs_a[0][1] += parse_character_reference '>', true
-                       when '>'
-                               tok_state = tok_state_data
-                               tmp = tok_cur_tag
-                               tok_cur_tag = null
-                               return tmp
-                       when "\u0000"
-                               tok_cur_tag.attrs_a[0][1] += "\ufffd"
-                       when '' # EOF
-                               parse_error()
-                               tok_state = tok_state_data
-                       else
-                               # Parse Error if ', <, = or ` (backtick)
-                               tok_cur_tag.attrs_a[0][1] += c
-               return null
-
-       # 8.2.4.42 http://www.w3.org/TR/html5/syntax.html#after-attribute-value-(quoted)-state
-       tok_state_after_attribute_value_quoted = ->
-               switch c = txt.charAt(cur++)
-                       when "\t", "\n", "\u000c", ' '
-                               tok_state = tok_state_before_attribute_name
-                       when '/'
-                               tok_state = tok_state_self_closing_start_tag
-                       when '>'
-                               tok_state = tok_state_data
-                               tmp = tok_cur_tag
-                               tok_cur_tag = null
-                               return tmp
-                       when '' # EOF
-                               parse_error()
-                               tok_state = tok_state_data
-                       else
-                               # Parse Error
-                               tok_state = tok_state_before_attribute_name
-                               cur -= 1 # we didn't handle that char
-               return null
-
-       # 8.2.4.43 http://www.w3.org/TR/html5/syntax.html#self-closing-start-tag-state
-       tok_state_self_closing_start_tag = ->
-               c = txt.charAt(cur++)
-               if c is '>'
-                       tok_cur_tag.flag 'self-closing', true
-                       tok_state = tok_state_data
-                       return tok_cur_tag
-               if c is ''
-                       parse_error()
-                       tok_state = tok_state_data
-                       cur -= 1 # Reconsume
-                       return
-               # Anything else
-               parse_error()
-               tok_state = tok_state_before_attribute_name
-               cur -= 1 # Reconsume
-               return
-
-       # 8.2.4.44 http://www.w3.org/TR/html5/syntax.html#bogus-comment-state
-       # WARNING: put a comment token in tok_cur_tag before setting this state
-       tok_state_bogus_comment = ->
-               next_gt = txt.indexOf '>', cur
-               if next_gt is -1
-                       val = txt.substr cur
-                       cur = txt.length
-               else
-                       val = txt.substr cur, (next_gt - cur)
-                       cur = next_gt + 1
-               val = val.replace(new RegExp("\u0000", 'g'), "\ufffd")
-               tok_cur_tag.text += val
-               tok_state = tok_state_data
-               return tok_cur_tag
-
-       # 8.2.4.45 http://www.w3.org/TR/html5/syntax.html#markup-declaration-open-state
-       tok_state_markup_declaration_open = ->
-               if txt.substr(cur, 2) is '--'
-                       cur += 2
-                       tok_cur_tag = new_comment_token ''
-                       tok_state = tok_state_comment_start
-                       return
-               if txt.substr(cur, 7).toLowerCase() is 'doctype'
-                       cur += 7
-                       tok_state = tok_state_doctype
-                       return
-               acn = adjusted_current_node()
-               if acn and acn.namespace isnt NS_HTML and txt.substr(cur, 7) is '[CDATA['
-                       cur += 7
-                       tok_state = tok_state_cdata_section
-                       return
-               # Otherwise
-               parse_error()
-               tok_cur_tag = new_comment_token ''
-               tok_state = tok_state_bogus_comment
-               return
-
-       # 8.2.4.46 http://www.w3.org/TR/html5/syntax.html#comment-start-state
-       tok_state_comment_start = ->
-               switch c = txt.charAt(cur++)
-                       when '-'
-                               tok_state = tok_state_comment_start_dash
-                       when "\u0000"
-                               parse_error()
-                               tok_state = tok_state_comment
-                               return new_character_token "\ufffd"
-                       when '>'
-                               parse_error()
-                               tok_state = tok_state_data
-                               return tok_cur_tag
-                       when '' # EOF
-                               parse_error()
-                               tok_state = tok_state_data
-                               cur -= 1 # Reconsume
-                               return tok_cur_tag
-                       else
-                               tok_cur_tag.text += c
-                               tok_state = tok_state_comment
-               return null
-
-       # 8.2.4.47 http://www.w3.org/TR/html5/syntax.html#comment-start-dash-state
-       tok_state_comment_start_dash = ->
-               switch c = txt.charAt(cur++)
-                       when '-'
-                               tok_state = tok_state_comment_end
-                       when "\u0000"
-                               parse_error()
-                               tok_cur_tag.text += "-\ufffd"
-                               tok_state = tok_state_comment
-                       when '>'
-                               parse_error()
-                               tok_state = tok_state_data
-                               return tok_cur_tag
-                       when '' # EOF
-                               parse_error()
-                               tok_state = tok_state_data
-                               cur -= 1 # Reconsume
-                               return tok_cur_tag
-                       else
-                               tok_cur_tag.text += "-#{c}"
-                               tok_state = tok_state_comment
-               return null
-
-       # 8.2.4.48 http://www.w3.org/TR/html5/syntax.html#comment-state
-       tok_state_comment = ->
-               switch c = txt.charAt(cur++)
-                       when '-'
-                               tok_state = tok_state_comment_end_dash
-                       when "\u0000"
-                               parse_error()
-                               tok_cur_tag.text += "\ufffd"
-                       when '' # EOF
-                               parse_error()
-                               tok_state = tok_state_data
-                               cur -= 1 # Reconsume
-                               return tok_cur_tag
-                       else
-                               tok_cur_tag.text += c
-               return null
-
-       # 8.2.4.49 http://www.w3.org/TR/html5/syntax.html#comment-end-dash-state
-       tok_state_comment_end_dash = ->
-               switch c = txt.charAt(cur++)
-                       when '-'
-                               tok_state = tok_state_comment_end
-                       when "\u0000"
-                               parse_error()
-                               tok_cur_tag.text += "-\ufffd"
-                               tok_state = tok_state_comment
-                       when '' # EOF
-                               parse_error()
-                               tok_state = tok_state_data
-                               cur -= 1 # Reconsume
-                               return tok_cur_tag
-                       else
-                               tok_cur_tag.text += "-#{c}"
-                               tok_state = tok_state_comment
-               return null
-
-       # 8.2.4.50 http://www.w3.org/TR/html5/syntax.html#comment-end-state
-       tok_state_comment_end = ->
-               switch c = txt.charAt(cur++)
-                       when '>'
-                               tok_state = tok_state_data
-                               return tok_cur_tag
-                       when "\u0000"
-                               parse_error()
-                               tok_cur_tag.text += "--\ufffd"
-                               tok_state = tok_state_comment
-                       when '!'
-                               parse_error()
-                               tok_state = tok_state_comment_end_bang
-                       when '-'
-                               parse_error()
-                               tok_cur_tag.text += '-'
-                       when '' # EOF
-                               parse_error()
-                               tok_state = tok_state_data
-                               cur -= 1 # Reconsume
-                               return tok_cur_tag
-                       else
-                               parse_error()
-                               tok_cur_tag.text += "--#{c}"
-                               tok_state = tok_state_comment
-               return null
-
-       # 8.2.4.51 http://www.w3.org/TR/html5/syntax.html#comment-end-bang-state
-       tok_state_comment_end_bang = ->
-               switch c = txt.charAt(cur++)
-                       when '-'
-                               tok_cur_tag.text += "--!#{c}"
-                               tok_state = tok_state_comment_end_dash
-                       when '>'
-                               tok_state = tok_state_data
-                               return tok_cur_tag
-                       when "\u0000"
-                               parse_error()
-                               tok_cur_tag.text += "--!\ufffd"
-                               tok_state = tok_state_comment
-                       when '' # EOF
-                               parse_error()
-                               tok_state = tok_state_data
-                               cur -= 1 # Reconsume
-                               return tok_cur_tag
-                       else
-                               tok_cur_tag.text += "--!#{c}"
-                               tok_state = tok_state_comment
-               return null
-
-       # 8.2.4.52 http://www.w3.org/TR/html5/syntax.html#doctype-state
-       tok_state_doctype = ->
-               switch c = txt.charAt(cur++)
-                       when "\t", "\u000a", "\u000c", ' '
-                               tok_state = tok_state_before_doctype_name
-                       when '' # EOF
-                               parse_error()
-                               tok_state = tok_state_data
-                               el = new_doctype_token ''
-                               el.flag 'force-quirks', true
-                               cur -= 1 # Reconsume
-                               return el
-                       else
-                               parse_error()
-                               tok_state = tok_state_before_doctype_name
-                               cur -= 1 # Reconsume
-               return null
-
-       # 8.2.4.52 http://www.w3.org/TR/html5/syntax.html#doctype-state
-       tok_state_before_doctype_name = ->
-               c = txt.charAt(cur++)
-               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
-                       return
-               if is_uc_alpha(c)
-                       tok_cur_tag = new_doctype_token c.toLowerCase()
-                       tok_state = tok_state_doctype_name
-                       return
-               if c is "\u0000"
-                       parse_error()
-                       tok_cur_tag = new_doctype_token "\ufffd"
-                       tok_state = tok_state_doctype_name
-                       return
-               if c is '>'
-                       parse_error()
-                       el = new_doctype_token ''
-                       el.flag 'force-quirks', true
-                       tok_state = tok_state_data
-                       return el
-               if c is '' # EOF
-                       parse_error()
-                       tok_state = tok_state_data
-                       el = new_doctype_token ''
-                       el.flag 'force-quirks', true
-                       cur -= 1 # Reconsume
-                       return el
-               # Anything else
-               tok_cur_tag = new_doctype_token c
-               tok_state = tok_state_doctype_name
-               return null
-
-       # 8.2.4.54 http://www.w3.org/TR/html5/syntax.html#doctype-name-state
-       tok_state_doctype_name = ->
-               c = txt.charAt(cur++)
-               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
-                       tok_state = tok_state_after_doctype_name
-                       return
-               if c is '>'
-                       tok_state = tok_state_data
-                       return tok_cur_tag
-               if is_uc_alpha(c)
-                       tok_cur_tag.name += c.toLowerCase()
-                       return
-               if c is "\u0000"
-                       parse_error()
-                       tok_cur_tag.name += "\ufffd"
-                       return
-               if c is '' # EOF
-                       parse_error()
-                       tok_state = tok_state_data
-                       tok_cur_tag.flag 'force-quirks', true
-                       cur -= 1 # Reconsume
-                       return tok_cur_tag
-               # Anything else
-               tok_cur_tag.name += c
-               return null
-
-       # 8.2.4.55 http://www.w3.org/TR/html5/syntax.html#after-doctype-name-state
-       tok_state_after_doctype_name = ->
-               c = txt.charAt(cur++)
-               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
-                       return
-               if c is '>'
-                       tok_state = tok_state_data
-                       return tok_cur_tag
-               if c is '' # EOF
-                       parse_error()
-                       tok_state = tok_state_data
-                       tok_cur_tag.flag 'force-quirks', true
-                       cur -= 1 # Reconsume
-                       return tok_cur_tag
-               # Anything else
-               if txt.substr(cur - 1, 6).toLowerCase() is 'public'
-                       cur += 5
-                       tok_state = tok_state_after_doctype_public_keyword
-                       return
-               if txt.substr(cur - 1, 6).toLowerCase() is 'system'
-                       cur += 5
-                       tok_state = tok_state_after_doctype_system_keyword
-                       return
-               parse_error()
-               tok_cur_tag.flag 'force-quirks', true
-               tok_state = tok_state_bogus_doctype
-               return null
-
-       # 8.2.4.56 http://www.w3.org/TR/html5/syntax.html#after-doctype-public-keyword-state
-       tok_state_after_doctype_public_keyword = ->
-               c = txt.charAt(cur++)
-               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
-                       tok_state = tok_state_before_doctype_public_identifier
-                       return
-               if c is '"'
-                       parse_error()
-                       tok_cur_tag.public_identifier = ''
-                       tok_state = tok_state_doctype_public_identifier_double_quoted
-                       return
-               if c is "'"
-                       parse_error()
-                       tok_cur_tag.public_identifier = ''
-                       tok_state = tok_state_doctype_public_identifier_single_quoted
-                       return
-               if c is '>'
-                       parse_error()
-                       tok_cur_tag.flag 'force-quirks', true
-                       tok_state = tok_state_data
-                       return tok_cur_tag
-               if c is '' # EOF
-                       parse_error()
-                       tok_state = tok_state_data
-                       tok_cur_tag.flag 'force-quirks', true
-                       cur -= 1 # Reconsume
-                       return tok_cur_tag
-               # Anything else
-               parse_error()
-               tok_cur_tag.flag 'force-quirks', true
-               tok_state = tok_state_bogus_doctype
-               return null
-
-       # 8.2.4.57 http://www.w3.org/TR/html5/syntax.html#before-doctype-public-identifier-state
-       tok_state_before_doctype_public_identifier = ->
-               c = txt.charAt(cur++)
-               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
-                       return
-               if c is '"'
-                       parse_error()
-                       tok_cur_tag.public_identifier = ''
-                       tok_state = tok_state_doctype_public_identifier_double_quoted
-                       return
-               if c is "'"
-                       parse_error()
-                       tok_cur_tag.public_identifier = ''
-                       tok_state = tok_state_doctype_public_identifier_single_quoted
-                       return
-               if c is '>'
-                       parse_error()
-                       tok_cur_tag.flag 'force-quirks', true
-                       tok_state = tok_state_data
-                       return tok_cur_tag
-               if c is '' # EOF
-                       parse_error()
-                       tok_state = tok_state_data
-                       tok_cur_tag.flag 'force-quirks', true
-                       cur -= 1 # Reconsume
-                       return tok_cur_tag
-               # Anything else
-               parse_error()
-               tok_cur_tag.flag 'force-quirks', true
-               tok_state = tok_state_bogus_doctype
-               return null
-
-
-       # 8.2.4.58 http://www.w3.org/TR/html5/syntax.html#doctype-public-identifier-(double-quoted)-state
-       tok_state_doctype_public_identifier_double_quoted = ->
-               c = txt.charAt(cur++)
-               if c is '"'
-                       tok_state = tok_state_after_doctype_public_identifier
-                       return
-               if c is "\u0000"
-                       parse_error()
-                       tok_cur_tag.public_identifier += "\ufffd"
-                       return
-               if c is '>'
-                       parse_error()
-                       tok_cur_tag.flag 'force-quirks', true
-                       tok_state = tok_state_data
-                       return tok_cur_tag
-               if c is '' # EOF
-                       parse_error()
-                       tok_state = tok_state_data
-                       tok_cur_tag.flag 'force-quirks', true
-                       cur -= 1 # Reconsume
-                       return tok_cur_tag
-               # Anything else
-               tok_cur_tag.public_identifier += c
-               return null
-
-       # 8.2.4.59 http://www.w3.org/TR/html5/syntax.html#doctype-public-identifier-(single-quoted)-state
-       tok_state_doctype_public_identifier_single_quoted = ->
-               c = txt.charAt(cur++)
-               if c is "'"
-                       tok_state = tok_state_after_doctype_public_identifier
-                       return
-               if c is "\u0000"
-                       parse_error()
-                       tok_cur_tag.public_identifier += "\ufffd"
-                       return
-               if c is '>'
-                       parse_error()
-                       tok_cur_tag.flag 'force-quirks', true
-                       tok_state = tok_state_data
-                       return tok_cur_tag
-               if c is '' # EOF
-                       parse_error()
-                       tok_state = tok_state_data
-                       tok_cur_tag.flag 'force-quirks', true
-                       cur -= 1 # Reconsume
-                       return tok_cur_tag
-               # Anything else
-               tok_cur_tag.public_identifier += c
-               return null
-
-       # 8.2.4.60 http://www.w3.org/TR/html5/syntax.html#after-doctype-public-identifier-state
-       tok_state_after_doctype_public_identifier = ->
-               c = txt.charAt(cur++)
-               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
-                       tok_state = tok_state_between_doctype_public_and_system_identifiers
-                       return
-               if c is '>'
-                       tok_state = tok_state_data
-                       return tok_cur_tag
-               if c is '"'
-                       parse_error()
-                       tok_cur_tag.system_identifier = ''
-                       tok_state = tok_state_doctype_system_identifier_double_quoted
-                       return
-               if c is "'"
-                       parse_error()
-                       tok_cur_tag.system_identifier = ''
-                       tok_state = tok_state_doctype_system_identifier_single_quoted
-                       return
-               if c is '' # EOF
-                       parse_error()
-                       tok_state = tok_state_data
-                       tok_cur_tag.flag 'force-quirks', true
-                       cur -= 1 # Reconsume
-                       return tok_cur_tag
-               # Anything else
-               parse_error()
-               tok_cur_tag.flag 'force-quirks', true
-               tok_state = tok_state_bogus_doctype
-               return null
-
-       # 8.2.4.61 http://www.w3.org/TR/html5/syntax.html#between-doctype-public-and-system-identifiers-state
-       tok_state_between_doctype_public_and_system_identifiers = ->
-               c = txt.charAt(cur++)
-               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
-                       return
-               if c is '>'
-                       tok_state = tok_state_data
-                       return tok_cur_tag
-               if c is '"'
-                       parse_error()
-                       tok_cur_tag.system_identifier = ''
-                       tok_state = tok_state_doctype_system_identifier_double_quoted
-                       return
-               if c is "'"
-                       parse_error()
-                       tok_cur_tag.system_identifier = ''
-                       tok_state = tok_state_doctype_system_identifier_single_quoted
-                       return
-               if c is '' # EOF
-                       parse_error()
-                       tok_state = tok_state_data
-                       tok_cur_tag.flag 'force-quirks', true
-                       cur -= 1 # Reconsume
-                       return tok_cur_tag
-               # Anything else
-               parse_error()
-               tok_cur_tag.flag 'force-quirks', true
-               tok_state = tok_state_bogus_doctype
-               return null
-
-       # 8.2.4.62 http://www.w3.org/TR/html5/syntax.html#after-doctype-system-keyword-state
-       tok_state_after_doctype_system_keyword = ->
-               c = txt.charAt(cur++)
-               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
-                       tok_state = tok_state_before_doctype_system_identifier
-                       return
-               if c is '"'
-                       parse_error()
-                       tok_cur_tag.system_identifier = ''
-                       tok_state = tok_state_doctype_system_identifier_double_quoted
-                       return
-               if c is "'"
-                       parse_error()
-                       tok_cur_tag.system_identifier = ''
-                       tok_state = tok_state_doctype_system_identifier_single_quoted
-                       return
-               if c is '>'
-                       parse_error()
-                       tok_cur_tag.flag 'force-quirks', true
-                       tok_state = tok_state_data
-                       return tok_cur_tag
-               if c is '' # EOF
-                       parse_error()
-                       tok_state = tok_state_data
-                       tok_cur_tag.flag 'force-quirks', true
-                       cur -= 1 # Reconsume
-                       return tok_cur_tag
-               # Anything else
-               parse_error()
-               tok_cur_tag.flag 'force-quirks', true
-               tok_state = tok_state_bogus_doctype
-               return null
-
-       # 8.2.4.63 http://www.w3.org/TR/html5/syntax.html#before-doctype-system-identifier-state
-       tok_state_before_doctype_system_identifier = ->
-               c = txt.charAt(cur++)
-               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
-                       return
-               if c is '"'
-                       tok_cur_tag.system_identifier = ''
-                       tok_state = tok_state_doctype_system_identifier_double_quoted
-                       return
-               if c is "'"
-                       tok_cur_tag.system_identifier = ''
-                       tok_state = tok_state_doctype_system_identifier_single_quoted
-                       return
-               if c is '>'
-                       parse_error()
-                       tok_cur_tag.flag 'force-quirks', true
-                       tok_state = tok_state_data
-                       return tok_cur_tag
-               if c is '' # EOF
-                       parse_error()
-                       tok_state = tok_state_data
-                       tok_cur_tag.flag 'force-quirks', true
-                       cur -= 1 # Reconsume
-                       return tok_cur_tag
-               # Anything else
-               parse_error()
-               tok_cur_tag.flag 'force-quirks', true
-               tok_state = tok_state_bogus_doctype
-               return null
-
-       # 8.2.4.64 http://www.w3.org/TR/html5/syntax.html#doctype-system-identifier-(double-quoted)-state
-       tok_state_doctype_system_identifier_double_quoted = ->
-               c = txt.charAt(cur++)
-               if c is '"'
-                       tok_state = tok_state_after_doctype_system_identifier
-                       return
-               if c is "\u0000"
-                       parse_error()
-                       tok_cur_tag.system_identifier += "\ufffd"
-                       return
-               if c is '>'
-                       parse_error()
-                       tok_cur_tag.flag 'force-quirks', true
-                       tok_state = tok_state_data
-                       return tok_cur_tag
-               if c is '' # EOF
-                       parse_error()
-                       tok_state = tok_state_data
-                       tok_cur_tag.flag 'force-quirks', true
-                       cur -= 1 # Reconsume
-                       return tok_cur_tag
-               # Anything else
-               tok_cur_tag.system_identifier += c
-               return null
-
-       # 8.2.4.65 http://www.w3.org/TR/html5/syntax.html#doctype-system-identifier-(single-quoted)-state
-       tok_state_doctype_system_identifier_single_quoted = ->
-               c = txt.charAt(cur++)
-               if c is "'"
-                       tok_state = tok_state_after_doctype_system_identifier
-                       return
-               if c is "\u0000"
-                       parse_error()
-                       tok_cur_tag.system_identifier += "\ufffd"
-                       return
-               if c is '>'
-                       parse_error()
-                       tok_cur_tag.flag 'force-quirks', true
-                       tok_state = tok_state_data
-                       return tok_cur_tag
-               if c is '' # EOF
-                       parse_error()
-                       tok_state = tok_state_data
-                       tok_cur_tag.flag 'force-quirks', true
-                       cur -= 1 # Reconsume
-                       return tok_cur_tag
-               # Anything else
-               tok_cur_tag.system_identifier += c
-               return null
-
-       # 8.2.4.66 http://www.w3.org/TR/html5/syntax.html#after-doctype-system-identifier-state
-       tok_state_after_doctype_system_identifier = ->
-               c = txt.charAt(cur++)
-               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
-                       return
-               if c is '>'
-                       tok_state = tok_state_data
-                       return tok_cur_tag
-               if c is '' # EOF
-                       parse_error()
-                       tok_state = tok_state_data
-                       tok_cur_tag.flag 'force-quirks', true
-                       cur -= 1 # Reconsume
-                       return tok_cur_tag
-               # Anything else
-               parse_error()
-               # do _not_ tok_cur_tag.flag 'force-quirks', true
-               tok_state = tok_state_bogus_doctype
-               return null
-
-       # 8.2.4.67 http://www.w3.org/TR/html5/syntax.html#bogus-doctype-state
-       tok_state_bogus_doctype = ->
-               c = txt.charAt(cur++)
-               if c is '>'
-                       tok_state = tok_state_data
-                       return tok_cur_tag
-               if c is '' # EOF
-                       tok_state = tok_state_data
-                       cur -= 1 # Reconsume
-                       return tok_cur_tag
-               # Anything else
-               return null
-
-       # 8.2.4.68 http://www.w3.org/TR/html5/syntax.html#cdata-section-state
-       tok_state_cdata_section = ->
-               tok_state = tok_state_data
-               next_gt = txt.indexOf ']]>', cur
-               if next_gt is -1
-                       val = txt.substr cur
-                       cur = txt.length
-               else
-                       val = txt.substr cur, (next_gt - cur)
-                       cur = next_gt + 3
-               val = val.replace(new RegExp("\u0000", 'g'), "\ufffd")
-               if val.length > 0
-                       return new_character_token val # fixfull split
-               return null
-
-       # 8.2.4.69 http://www.w3.org/TR/html5/syntax.html#consume-a-character-reference
-       # Don't set this as a state, just call it
-       # returns a string (NOT a text node)
-       parse_character_reference = (allowed_char = null, in_attr = false) ->
-               if cur >= txt.length
-                       return '&'
-               switch c = txt.charAt(cur)
-                       when "\t", "\n", "\u000c", ' ', '<', '&', '', allowed_char
-                               # explicitly not a parse error
-                               return '&'
-                       when ';'
-                               # there has to be "one or more" alnums between & and ; to be a parse error
-                               return '&'
-                       when '#'
-                               if cur + 1 >= txt.length
-                                       return '&'
-                               if txt.charAt(cur + 1).toLowerCase() is 'x'
-                                       base = 16
-                                       charset = hex_chars
-                                       start = cur + 2
-                               else
-                                       charset = digits
-                                       start = cur + 1
-                                       base = 10
-                               i = 0
-                               while start + i < txt.length and charset.indexOf(txt.charAt(start + i)) > -1
-                                       i += 1
-                               if i is 0
-                                       return '&'
-                               cur = start + i
-                               if txt.charAt(start + i) is ';'
-                                       cur += 1
-                               else
-                                       parse_error()
-                               code_point = txt.substr(start, i)
-                               while code_point.charAt(0) is '0' and code_point.length > 1
-                                       code_point = code_point.substr 1
-                               code_point = parseInt(code_point, base)
-                               if unicode_fixes[code_point]?
-                                       parse_error()
-                                       return unicode_fixes[code_point]
-                               else
-                                       if (code_point >= 0xd800 and code_point <= 0xdfff) or code_point > 0x10ffff
-                                               parse_error()
-                                               return "\ufffd"
-                                       else
-                                               if (code_point >= 0x0001 and code_point <= 0x0008) or (code_point >= 0x000D and code_point <= 0x001F) or (code_point >= 0x007F and code_point <= 0x009F) or (code_point >= 0xFDD0 and code_point <= 0xFDEF) or code_point is 0x000B or code_point is 0xFFFE or code_point is 0xFFFF or code_point is 0x1FFFE or code_point is 0x1FFFF or code_point is 0x2FFFE or code_point is 0x2FFFF or code_point is 0x3FFFE or code_point is 0x3FFFF or code_point is 0x4FFFE or code_point is 0x4FFFF or code_point is 0x5FFFE or code_point is 0x5FFFF or code_point is 0x6FFFE or code_point is 0x6FFFF or code_point is 0x7FFFE or code_point is 0x7FFFF or code_point is 0x8FFFE or code_point is 0x8FFFF or code_point is 0x9FFFE or code_point is 0x9FFFF or code_point is 0xAFFFE or code_point is 0xAFFFF or code_point is 0xBFFFE or code_point is 0xBFFFF or code_point is 0xCFFFE or code_point is 0xCFFFF or code_point is 0xDFFFE or code_point is 0xDFFFF or code_point is 0xEFFFE or code_point is 0xEFFFF or code_point is 0xFFFFE or code_point is 0xFFFFF or code_point is 0x10FFFE or code_point is 0x10FFFF
-                                                       parse_error()
-                                               return from_code_point code_point
-                               return
-                       else
-                               for i in [0...31]
-                                       if alnum.indexOf(txt.charAt(cur + i)) is -1
-                                               break
-                               if i is 0
-                                       # exit early, because parse_error() below needs at least one alnum
-                                       return '&'
-                               if txt.charAt(cur + i) is ';'
-                                       decoded = decode_named_char_ref txt.substr(cur, i)
-                                       i += 1 # scan past the ';' (after, so we dno't pass it to decode)
-                                       if decoded?
-                                               cur += i
-                                               return decoded
-                                       # else FALL THROUGH (check for match without last char(s) or ";")
-                               # no ';' terminator (only legacy char refs)
-                               max = i
-                               for i in [2..max] # no prefix matches, so ok to check shortest first
-                                       c = legacy_char_refs[txt.substr(cur, i)]
-                                       if c?
-                                               if in_attr
-                                                       if txt.charAt(cur + i) is '='
-                                                               # "because some legacy user agents will
-                                                               # misinterpret the markup in those cases"
-                                                               parse_error()
-                                                               return '&'
-                                                       if alnum.indexOf(txt.charAt(cur + i)) > -1
-                                                               # this makes attributes forgiving about url args
-                                                               return '&'
-                                               # ok, and besides the weird exceptions for attributes...
-                                               # return the matching char
-                                               cur += i # consume entity chars
-                                               parse_error() # because no terminating ";"
-                                               return c
-                               parse_error()
-                               return '&'
-               return # never reached
-
-       eat_next_token_if_newline = ->
-               old_cur = cur
-               t = null
-               until t?
-                       t = tok_state()
-               if t.type is TYPE_TEXT
-                       # definition of a newline depends on whether it was a character ref or not
-                       if cur - old_cur is 1
-                               # not a character reference
-                               if t.text is "\u000d" or t.text is "\u000a"
-                                       return
-                       else
-                               if t.text is "\u000a"
-                                       return
-               # not a "newline"
-               cur = old_cur
-               return
-
-       # tree constructor initialization
-       # see comments on TYPE_TAG/etc for the structure of this data
-       txt = args_html
-       cur = 0
-       doc = new Node TYPE_TAG, name: 'document', namespace: NS_HTML
-       doc.flag 'quirks mode', QUIRKS_NO # TODO bugreport spec for not specifying this
-       fragment_root = null # fragment parsing algorithm returns children of this
-       open_els = []
-       afe = [] # active formatting elements
-       template_ins_modes = []
-       ins_mode = ins_mode_initial
-       original_ins_mode = ins_mode # TODO check spec
-       flag_scripting = args.scripting ? true # TODO might need an extra flag to get <noscript> to parse correctly
-       flag_frameset_ok = true
-       flag_parsing = true
-       flag_foster_parenting = false
-       form_element_pointer = null
-       temporary_buffer = null
-       pending_table_character_tokens = []
-       head_element_pointer = null
-       flag_fragment_parsing = false
-       context_element = null
-       prev_node_id = 0 # just for debugging
-
-       # tokenizer initialization
-       tok_state = tok_state_data
-
-       parse_init = ->
-               # fragment parsing (text arg)
-               if args.fragment?
-                       # this handles the fragment from the tests in the format described here:
-                       # https://github.com/html5lib/html5lib-tests/blob/master/tree-construction/README.md
-                       f = args.fragment
-                       ns = NS_HTML
-                       if f.substr(0, 5) is 'math '
-                               f = f.substr 5
-                               ns = NS_MATHML
-                       else if f.substr(0, 4) is 'svg '
-                               f = f.substr 4
-                               ns = NS_SVG
-                       t = new_open_tag f
-                       context_element = token_to_element t, ns
-                       context_element.document = new Node TYPE_TAG, name: 'document', namespace: NS_HTML
-                       context_element.document.flag 'quirks mode', QUIRKS_NO
-               # fragment parsing (Node arg)
-               if args.context?
-                       context_element = args.context
-
-               # http://www.w3.org/TR/html5/syntax.html#parsing-html-fragments
-               # fragment parsing algorithm
-               if context_element?
-                       flag_fragment_parsing = true
-                       doc = new Node TYPE_TAG, name: 'html', namespace: NS_HTML
-                       # search up the tree from context, to try to find it's document,
-                       # because this file only puts a "document" property on the root
-                       # element.
-                       old_doc = null
-                       el = context_element
-                       loop
-                               if el.document?
-                                       old_doc = el.document
-                                       break
-                               if el.parent
-                                       el = el.parent
-                               else
-                                       break
-                       if old_doc
-                               doc.flag 'quirks mode', old_doc.flag 'quirks mode'
-                       # set tok_state
-                       if context_element.namespace is NS_HTML
-                               switch context_element.name
-                                       when 'title', 'textarea'
-                                               tok_state = tok_state_rcdata
-                                       when 'style', 'xmp', 'iframe', 'noembed', 'noframes'
-                                               tok_state = tok_state_rawtext
-                                       when 'script'
-                                               tok_state = tok_state_script_data
-                                       when 'noscript'
-                                               if flag_scripting
-                                                       tok_state = tok_state_rawtext
-                                       when 'plaintext'
-                                               tok_state = tok_state_plaintext
-                       fragment_root = new Node TYPE_TAG, name: 'html', namespace: NS_HTML
-                       doc.children.push fragment_root
-                       fragment_root.document = doc
-                       open_els = [fragment_root]
-                       if context_element.name is 'template' and context_element.namespace is NS_HTML
-                               template_ins_modes.unshift ins_mode_in_template
-                       # fixfull create token for context (it should have it's original one already)
-                       reset_ins_mode()
-                       # set form_element pointer... in the foreign doc?!
-                       el = context_element
-                       loop
-                               if el.name is 'form' and el.namespace is NS_HTML
-                                       form_element_pointer = el
-                                       break
-                               if el.parent
-                                       el = el.parent
-                               else
-                                       break
-
-               # text pre-processing
-               # FIXME check http://www.w3.org/TR/html5/syntax.html#preprocessing-the-input-stream
-               txt = txt.replace(new RegExp("\r\n", 'g'), "\n") # fixfull spec doesn't say this
-               txt = txt.replace(new RegExp("\r", 'g'), "\n") # fixfull spec doesn't say this
-
-               return
-
-       # http://www.w3.org/TR/html5/syntax.html#tree-construction
-       parse_main_loop = ->
-               while flag_parsing
-                       t = tok_state()
-                       if t?
-                               process_token t
-                               # fixfull parse error if has self-closing flag, but it wasn't acknolwedged
-               return
-       parse_init()
-       parse_main_loop()
-
-       if flag_fragment_parsing
-               return fragment_root.children
-       return doc.children
-
-exports.parse_html = parse_html
-exports.debug_log_reset = debug_log_reset
-exports.debug_log_each = debug_log_each
-exports.TYPE_TAG = TYPE_TAG
-exports.TYPE_TEXT = TYPE_TEXT
-exports.TYPE_COMMENT = TYPE_COMMENT
-exports.TYPE_DOCTYPE = TYPE_DOCTYPE
-exports.NS_HTML = NS_HTML
-exports.NS_MATHML = NS_MATHML
-exports.NS_SVG = NS_SVG
-exports.QUIRKS_NO = QUIRKS_NO
-exports.QUIRKS_LIMITED = QUIRKS_LIMITED
-exports.QUIRKS_YES = QUIRKS_YES
diff --git a/parser.coffee b/parser.coffee
new file mode 100644 (file)
index 0000000..804c257
--- /dev/null
@@ -0,0 +1,4746 @@
+# Copyright 2015 Jason Woofenden
+# This file implements an HTML5 parser
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Affero General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
+# This file implements a thorough parser for html5, meant to be used by a
+# WYSIWYG editor.
+
+# The implementation is a pretty direct implementation of the parsing algorithm
+# described here:
+#
+#     http://www.w3.org/TR/html5/syntax.html
+#
+# except for some places marked "WHATWG" that are implemented as described here:
+#
+#     https://html.spec.whatwg.org/multipage/syntax.html
+#
+# This code passes all of the tests in the .dat files at:
+#
+#     https://github.com/JasonWoof/html5lib-tests/tree/patch-1/tree-construction
+
+
+##################################
+## how to use this code
+##################################
+#
+# See README.md for how to run this file in the browser or in node.js.
+#
+# This file exports a single useful function: parse_tml, and some constants
+# (see the bottom of this file for those.)
+#
+# Call it like this:
+#
+#     wheic_parser.parse("<p><b>hi</p>")
+#
+# Or, if you don't want <html><head><body>/etc, do this:
+#
+#     wheic_parser.parse("<p><b>hi</p>", {fragment: "body"})
+#
+# return value is an array of Nodes, see "class Node" below.
+
+# This code is a work in progress, eg try search this file for "fixfull",
+# "TODO" and "FIXME"
+
+
+# Notes:  stacks/lists
+#
+# Jason was frequently confused by the terminology used to refer to different
+# parts of the stacks and lists in the spec, so he made this chart to help keep
+# his head straight:
+#
+# stacks grow downward (current element is index=0)
+#
+# example: open_els = [a, b, c, d, e, f, g]
+#
+# "grows downwards" means it's visualized like this: (index: el "names")
+#
+#   6: g "start of the list", "topmost", "first"
+#   5: f
+#   4: e "previous" (to d), "above", "before"
+#   3: d   (previous/next are relative to this element)
+#   2: c "next", "after", "lower", "below"
+#   1: b
+#   0: a "end of the list", "current node", "bottommost", "last"
+
+if (typeof module) isnt 'undefined' and module.exports?
+       context = 'module'
+       exports = module.exports
+else
+       context = 'browser'
+       window.wheic_parser = {}
+       exports = window.wheic_parser
+
+from_code_point = (x) ->
+       if String.fromCodePoint?
+               return String.fromCodePoint x
+       else
+               if x <= 0xffff
+                       return String.fromCharCode x
+               x -= 0x10000
+               return String.fromCharCode((x >> 10) + 0xd800, (x % 0x400) + 0xdc00)
+
+# Each node is an obect of the Node class. Here are the Node types:
+TYPE_TAG = 0 # name, {attributes}, [children]
+TYPE_TEXT = 1 # "text"
+TYPE_COMMENT = 2
+TYPE_DOCTYPE = 3
+# the following types are emited by the tokenizer, but shouldn't end up in the tree:
+TYPE_START_TAG = 4 # name, [attributes ([key,value]...) in reverse order], [children]
+TYPE_END_TAG = 5 # name
+TYPE_EOF = 6
+TYPE_AFE_MARKER = 7 # http://www.w3.org/TR/html5/syntax.html#reconstruct-the-active-formatting-elements
+TYPE_AAA_BOOKMARK = 8 # http://www.w3.org/TR/html5/syntax.html#adoption-agency-algorithm
+
+# namespace constants
+NS_HTML = 1
+NS_MATHML = 2
+NS_SVG = 3
+
+# quirks mode constants
+QUIRKS_NO = 1
+QUIRKS_LIMITED = 2
+QUIRKS_YES = 3
+
+# queue up debug logs, so eg they can be shown only for tests that fail
+g_debug_log = []
+debug_log_reset = ->
+       g_debug_log = []
+       return
+debug_log = (str) ->
+       g_debug_log.push str
+       return
+debug_log_each = (cb) ->
+       for str in g_debug_log
+               cb str
+       return
+
+prev_node_id = 0
+class Node
+       constructor: (type, args = {}) ->
+               @type = type # one of the TYPE_* constants above
+               @name = args.name ? '' # tag name
+               @text = args.text ? '' # contents for text/comment nodes
+               @attrs = args.attrs ? {}
+               @attrs_a = args.attr_k ? [] # attrs in progress, TYPE_START_TAG only
+               @children = args.children ? []
+               @namespace = args.namespace ? NS_HTML
+               @parent = args.parent ? null
+               @token = args.token ? null
+               @flags = args.flags ? {}
+               if args.id?
+                       @id = "#{args.id}+"
+               else
+                       @id = "#{++prev_node_id}"
+       acknowledge_self_closing: ->
+               if @token?
+                       @token.flag 'did_self_close', true
+               else
+                       @flag 'did_self_close', true
+               return
+       flag: (key, value = null) ->
+               if value?
+                       @flags[key] = value
+               else
+                       return @flags[key]
+               return
+
+# helpers: (only take args that are normally known when parser creates nodes)
+new_open_tag = (name) ->
+       return new Node TYPE_START_TAG, name: name
+new_end_tag = (name) ->
+       return new Node TYPE_END_TAG, name: name
+new_element = (name) ->
+       return new Node TYPE_TAG, name: name
+new_text_node = (txt) ->
+       return new Node TYPE_TEXT, text: txt
+new_character_token = new_text_node
+new_comment_token = (txt) ->
+       return new Node TYPE_COMMENT, text: txt
+new_doctype_token = (name) ->
+       return new Node TYPE_DOCTYPE, name: name
+new_eof_token = ->
+       return new Node TYPE_EOF
+new_afe_marker = ->
+       return new Node TYPE_AFE_MARKER
+new_aaa_bookmark = ->
+       return new Node TYPE_AAA_BOOKMARK
+
+lc_alpha = "abcdefghijklmnopqrstuvwxyz"
+uc_alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+digits = "0123456789"
+alnum = lc_alpha + uc_alpha + digits
+hex_chars = digits + "abcdefABCDEF"
+
+is_uc_alpha = (str) ->
+       return str.length is 1 and uc_alpha.indexOf(str) > -1
+is_lc_alpha = (str) ->
+       return str.length is 1 and lc_alpha.indexOf(str) > -1
+
+# some SVG elements have dashes in them
+tag_name_chars = alnum + "-"
+
+# http://www.w3.org/TR/html5/infrastructure.html#space-character
+space_chars = "\u0009\u000a\u000c\u000d\u0020"
+is_space = (txt) ->
+       return txt.length is 1 and space_chars.indexOf(txt) > -1
+is_space_tok = (t) ->
+       return t.type is TYPE_TEXT && t.text.length is 1 and space_chars.indexOf(t.text) > -1
+
+is_input_hidden_tok = (t) ->
+       return false unless t.type is TYPE_START_TAG
+       for a in t.attrs_a
+               if a[0] is 'type'
+                       if a[1].toLowerCase() is 'hidden'
+                               return true
+                       return false
+       return false
+
+# https://en.wikipedia.org/wiki/Whitespace_character#Unicode
+whitespace_chars = "\u0009\u000a\u000b\u000c\u000d\u0020\u0085\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000"
+
+unicode_fixes = {}
+unicode_fixes[0x00] = "\uFFFD"
+unicode_fixes[0x80] = "\u20AC"
+unicode_fixes[0x82] = "\u201A"
+unicode_fixes[0x83] = "\u0192"
+unicode_fixes[0x84] = "\u201E"
+unicode_fixes[0x85] = "\u2026"
+unicode_fixes[0x86] = "\u2020"
+unicode_fixes[0x87] = "\u2021"
+unicode_fixes[0x88] = "\u02C6"
+unicode_fixes[0x89] = "\u2030"
+unicode_fixes[0x8A] = "\u0160"
+unicode_fixes[0x8B] = "\u2039"
+unicode_fixes[0x8C] = "\u0152"
+unicode_fixes[0x8E] = "\u017D"
+unicode_fixes[0x91] = "\u2018"
+unicode_fixes[0x92] = "\u2019"
+unicode_fixes[0x93] = "\u201C"
+unicode_fixes[0x94] = "\u201D"
+unicode_fixes[0x95] = "\u2022"
+unicode_fixes[0x96] = "\u2013"
+unicode_fixes[0x97] = "\u2014"
+unicode_fixes[0x98] = "\u02DC"
+unicode_fixes[0x99] = "\u2122"
+unicode_fixes[0x9A] = "\u0161"
+unicode_fixes[0x9B] = "\u203A"
+unicode_fixes[0x9C] = "\u0153"
+unicode_fixes[0x9E] = "\u017E"
+unicode_fixes[0x9F] = "\u0178"
+
+quirks_yes_pi_prefixes = [
+       "+//silmaril//dtd html pro v0r11 19970101//"
+       "-//as//dtd html 3.0 aswedit + extensions//"
+       "-//advasoft ltd//dtd html 3.0 aswedit + extensions//"
+       "-//ietf//dtd html 2.0 level 1//"
+       "-//ietf//dtd html 2.0 level 2//"
+       "-//ietf//dtd html 2.0 strict level 1//"
+       "-//ietf//dtd html 2.0 strict level 2//"
+       "-//ietf//dtd html 2.0 strict//"
+       "-//ietf//dtd html 2.0//"
+       "-//ietf//dtd html 2.1e//"
+       "-//ietf//dtd html 3.0//"
+       "-//ietf//dtd html 3.2 final//"
+       "-//ietf//dtd html 3.2//"
+       "-//ietf//dtd html 3//"
+       "-//ietf//dtd html level 0//"
+       "-//ietf//dtd html level 1//"
+       "-//ietf//dtd html level 2//"
+       "-//ietf//dtd html level 3//"
+       "-//ietf//dtd html strict level 0//"
+       "-//ietf//dtd html strict level 1//"
+       "-//ietf//dtd html strict level 2//"
+       "-//ietf//dtd html strict level 3//"
+       "-//ietf//dtd html strict//"
+       "-//ietf//dtd html//"
+       "-//metrius//dtd metrius presentational//"
+       "-//microsoft//dtd internet explorer 2.0 html strict//"
+       "-//microsoft//dtd internet explorer 2.0 html//"
+       "-//microsoft//dtd internet explorer 2.0 tables//"
+       "-//microsoft//dtd internet explorer 3.0 html strict//"
+       "-//microsoft//dtd internet explorer 3.0 html//"
+       "-//microsoft//dtd internet explorer 3.0 tables//"
+       "-//netscape comm. corp.//dtd html//"
+       "-//netscape comm. corp.//dtd strict html//"
+       "-//o'reilly and associates//dtd html 2.0//"
+       "-//o'reilly and associates//dtd html extended 1.0//"
+       "-//o'reilly and associates//dtd html extended relaxed 1.0//"
+       "-//sq//dtd html 2.0 hotmetal + extensions//"
+       "-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//"
+       "-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//"
+       "-//spyglass//dtd html 2.0 extended//"
+       "-//sun microsystems corp.//dtd hotjava html//"
+       "-//sun microsystems corp.//dtd hotjava strict html//"
+       "-//w3c//dtd html 3 1995-03-24//"
+       "-//w3c//dtd html 3.2 draft//"
+       "-//w3c//dtd html 3.2 final//"
+       "-//w3c//dtd html 3.2//"
+       "-//w3c//dtd html 3.2s draft//"
+       "-//w3c//dtd html 4.0 frameset//"
+       "-//w3c//dtd html 4.0 transitional//"
+       "-//w3c//dtd html experimental 19960712//"
+       "-//w3c//dtd html experimental 970421//"
+       "-//w3c//dtd w3 html//"
+       "-//w3o//dtd w3 html 3.0//"
+       "-//webtechs//dtd mozilla html 2.0//"
+       "-//webtechs//dtd mozilla html//"
+]
+
+# These are the character references that don't need a terminating semicolon
+# min length: 2, max: 6, none are a prefix of any other.
+legacy_char_refs = {
+       Aacute: 'Á', aacute: 'á', Acirc: 'Â', acirc: 'â', acute: '´', AElig: 'Æ',
+       aelig: 'æ', Agrave: 'À', agrave: 'à', AMP: '&', amp: '&', Aring: 'Å',
+       aring: 'å', Atilde: 'Ã', atilde: 'ã', Auml: 'Ä', auml: 'ä', brvbar: '¦',
+       Ccedil: 'Ç', ccedil: 'ç', cedil: '¸', cent: '¢', COPY: '©', copy: '©',
+       curren: '¤', deg: '°', divide: '÷', Eacute: 'É', eacute: 'é', Ecirc: 'Ê',
+       ecirc: 'ê', Egrave: 'È', egrave: 'è', ETH: 'Ð', eth: 'ð', Euml: 'Ë',
+       euml: 'ë', frac12: '½', frac14: '¼', frac34: '¾', GT: '>', gt: '>',
+       Iacute: 'Í', iacute: 'í', Icirc: 'Î', icirc: 'î', iexcl: '¡', Igrave: 'Ì',
+       igrave: 'ì', iquest: '¿', Iuml: 'Ï', iuml: 'ï', laquo: '«', LT: '<',
+       lt: '<', macr: '¯', micro: 'µ', middot: '·', nbsp: "\u00a0", not: '¬',
+       Ntilde: 'Ñ', ntilde: 'ñ', Oacute: 'Ó', oacute: 'ó', Ocirc: 'Ô', ocirc: 'ô',
+       Ograve: 'Ò', ograve: 'ò', ordf: 'ª', ordm: 'º', Oslash: 'Ø', oslash: 'ø',
+       Otilde: 'Õ', otilde: 'õ', Ouml: 'Ö', ouml: 'ö', para: '¶', plusmn: '±',
+       pound: '£', QUOT: '"', quot: '"', raquo: '»', REG: '®', reg: '®', sect: '§',
+       shy: '­', sup1: '¹', sup2: '²', sup3: '³', szlig: 'ß', THORN: 'Þ', thorn: 'þ',
+       times: '×', Uacute: 'Ú', uacute: 'ú', Ucirc: 'Û', ucirc: 'û', Ugrave: 'Ù',
+       ugrave: 'ù', uml: '¨', Uuml: 'Ü', uuml: 'ü', Yacute: 'Ý', yacute: 'ý',
+       yen: '¥', yuml: 'ÿ'
+}
+
+void_elements = ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr']
+raw_text_elements = ['script', 'style']
+escapable_raw_text_elements = ['textarea', 'title']
+# http://www.w3.org/TR/SVG/ 1.1 (Second Edition)
+svg_elements = [
+       'a', 'altGlyph', 'altGlyphDef', 'altGlyphItem', 'animate', 'animateColor',
+       'animateMotion', 'animateTransform', 'circle', 'clipPath', 'color-profile',
+       'cursor', 'defs', 'desc', 'ellipse', 'feBlend', 'feColorMatrix',
+       'feComponentTransfer', 'feComposite', 'feConvolveMatrix',
+       'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood',
+       'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage',
+       'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight',
+       'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence', 'filter',
+       'font', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src',
+       'font-face-uri', 'foreignObject', 'g', 'glyph', 'glyphRef', 'hkern',
+       'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata',
+       'missing-glyph', 'mpath', 'path', 'pattern', 'polygon', 'polyline',
+       'radialGradient', 'rect', 'script', 'set', 'stop', 'style', 'svg',
+       'switch', 'symbol', 'text', 'textPath', 'title', 'tref', 'tspan', 'use',
+       'view', 'vkern'
+]
+
+# http://www.w3.org/TR/MathML/ Version 3.0 2nd Edition
+mathml_elements = [
+       'abs', 'and', 'annotation', 'annotation-xml', 'apply', 'approx', 'arccos',
+       'arccosh', 'arccot', 'arccoth', 'arccsc', 'arccsch', 'arcsec', 'arcsech',
+       'arcsin', 'arcsinh', 'arctan', 'arctanh', 'arg', 'bind', 'bvar', 'card',
+       'cartesianproduct', 'cbytes', 'ceiling', 'cerror', 'ci', 'cn', 'codomain',
+       'complexes', 'compose', 'condition', 'conjugate', 'cos', 'cosh', 'cot',
+       'coth', 'cs', 'csc', 'csch', 'csymbol', 'curl', 'declare', 'degree',
+       'determinant', 'diff', 'divergence', 'divide', 'domain',
+       'domainofapplication', 'emptyset', 'eq', 'equivalent', 'eulergamma',
+       'exists', 'exp', 'exponentiale', 'factorial', 'factorof', 'false', 'floor',
+       'fn', 'forall', 'gcd', 'geq', 'grad', 'gt', 'ident', 'image', 'imaginary',
+       'imaginaryi', 'implies', 'in', 'infinity', 'int', 'integers', 'intersect',
+       'interval', 'inverse', 'lambda', 'laplacian', 'lcm', 'leq', 'limit',
+       'list', 'ln', 'log', 'logbase', 'lowlimit', 'lt', 'maction', 'maligngroup',
+       'malignmark', 'math', 'matrix', 'matrixrow', 'max', 'mean', 'median',
+       'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mi', 'min',
+       'minus', 'mlabeledtr', 'mlongdiv', 'mmultiscripts', 'mn', 'mo', 'mode',
+       'moment', 'momentabout', 'mover', 'mpadded', 'mphantom', 'mprescripts',
+       'mroot', 'mrow', 'ms', 'mscarries', 'mscarry', 'msgroup', 'msline',
+       'mspace', 'msqrt', 'msrow', 'mstack', 'mstyle', 'msub', 'msubsup', 'msup',
+       'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'naturalnumbers',
+       'neq', 'none', 'not', 'notanumber', 'notin', 'notprsubset', 'notsubset',
+       'or', 'otherwise', 'outerproduct', 'partialdiff', 'pi', 'piece',
+       'piecewise', 'plus', 'power', 'primes', 'product', 'prsubset', 'quotient',
+       'rationals', 'real', 'reals', 'reln', 'rem', 'root', 'scalarproduct',
+       'sdev', 'sec', 'sech', 'selector', 'semantics', 'sep', 'set', 'setdiff',
+       'share', 'sin', 'sinh', 'span', 'subset', 'sum', 'tan', 'tanh', 'tendsto',
+       'times', 'transpose', 'true', 'union', 'uplimit', 'variance', 'vector',
+       'vectorproduct', 'xor'
+]
+# foreign_elements = [svg_elements..., mathml_elements...]
+#normal_elements = All other allowed HTML elements are normal elements.
+
+special_elements = {
+       # HTML:
+       address:NS_HTML, applet:NS_HTML, area:NS_HTML, article:NS_HTML,
+       aside:NS_HTML, base:NS_HTML, basefont:NS_HTML, bgsound:NS_HTML,
+       blockquote:NS_HTML, body:NS_HTML, br:NS_HTML, button:NS_HTML,
+       caption:NS_HTML, center:NS_HTML, col:NS_HTML, colgroup:NS_HTML, dd:NS_HTML,
+       details:NS_HTML, dir:NS_HTML, div:NS_HTML, dl:NS_HTML, dt:NS_HTML,
+       embed:NS_HTML, fieldset:NS_HTML, figcaption:NS_HTML, figure:NS_HTML,
+       footer:NS_HTML, form:NS_HTML, frame:NS_HTML, frameset:NS_HTML, h1:NS_HTML,
+       h2:NS_HTML, h3:NS_HTML, h4:NS_HTML, h5:NS_HTML, h6:NS_HTML, head:NS_HTML,
+       header:NS_HTML, hgroup:NS_HTML, hr:NS_HTML, html:NS_HTML, iframe:NS_HTML,
+       img:NS_HTML, input:NS_HTML, isindex:NS_HTML, li:NS_HTML, link:NS_HTML,
+       listing:NS_HTML, main:NS_HTML, marquee:NS_HTML,
+
+       menu:NS_HTML,menuitem:NS_HTML, # WHATWG adds these
+
+       meta:NS_HTML, nav:NS_HTML, noembed:NS_HTML, noframes:NS_HTML,
+       noscript:NS_HTML, object:NS_HTML, ol:NS_HTML, p:NS_HTML, param:NS_HTML,
+       plaintext:NS_HTML, pre:NS_HTML, script:NS_HTML, section:NS_HTML,
+       select:NS_HTML, source:NS_HTML, style:NS_HTML, summary:NS_HTML,
+       table:NS_HTML, tbody:NS_HTML, td:NS_HTML, template:NS_HTML,
+       textarea:NS_HTML, tfoot:NS_HTML, th:NS_HTML, thead:NS_HTML, title:NS_HTML,
+       tr:NS_HTML, track:NS_HTML, ul:NS_HTML, wbr:NS_HTML, xmp:NS_HTML,
+
+       # MathML:
+       mi:NS_MATHML, mo:NS_MATHML, mn:NS_MATHML, ms:NS_MATHML, mtext:NS_MATHML,
+       'annotation-xml':NS_MATHML,
+
+       # SVG:
+       foreignObject:NS_SVG, desc:NS_SVG, title:NS_SVG
+}
+
+formatting_elements = {
+        a: true, b: true, big: true, code: true, em: true, font: true, i: true,
+        nobr: true, s: true, small: true, strike: true, strong: true, tt: true,
+        u: true
+}
+
+mathml_text_integration = {
+       mi: NS_MATHML, mo: NS_MATHML, mn: NS_MATHML, ms: NS_MATHML, mtext: NS_MATHML
+}
+is_mathml_text_integration_point = (el) ->
+       return mathml_text_integration[el.name] is el.namespace
+is_html_integration = (el) -> # DON'T PASS A TOKEN
+       if el.namespace is NS_MATHML
+               if el.name is 'annotation-xml'
+                       if el.attrs.encoding?
+                               if el.attrs.encoding.toLowerCase() is 'text/html'
+                                       return true
+                               if el.attrs.encoding.toLowerCase() is 'application/xhtml+xml'
+                                       return true
+               return false
+       if el.namespace is NS_SVG
+               if el.name is 'foreignObject' or el.name is 'desc' or el.name is 'title'
+                       return true
+       return false
+
+h_tags = {
+       h1:NS_HTML, h2:NS_HTML, h3:NS_HTML, h4:NS_HTML, h5:NS_HTML, h6:NS_HTML
+}
+
+foster_parenting_targets = {
+       table: NS_HTML
+       tbody: NS_HTML
+       tfoot: NS_HTML
+       thead: NS_HTML
+       tr: NS_HTML
+}
+
+end_tag_implied = {
+       dd: NS_HTML
+       dt: NS_HTML
+       li: NS_HTML
+       option: NS_HTML
+       optgroup: NS_HTML
+       p: NS_HTML
+       rb: NS_HTML
+       rp: NS_HTML
+       rt: NS_HTML
+       rtc: NS_HTML
+}
+
+el_is_special = (e) ->
+       return special_elements[e.name] is e.namespace
+
+adp_els = { address: NS_HTML, div: NS_HTML, p: NS_HTML }
+el_is_special_not_adp = (el) ->
+       return special_elements[el.name] is el.namespace and adp_els[el.name] isnt el.namespace
+
+svg_name_fixes = {
+       altglyph: 'altGlyph'
+       altglyphdef: 'altGlyphDef'
+       altglyphitem: 'altGlyphItem'
+       animatecolor: 'animateColor'
+       animatemotion: 'animateMotion'
+       animatetransform: 'animateTransform'
+       clippath: 'clipPath'
+       feblend: 'feBlend'
+       fecolormatrix: 'feColorMatrix'
+       fecomponenttransfer: 'feComponentTransfer'
+       fecomposite: 'feComposite'
+       feconvolvematrix: 'feConvolveMatrix'
+       fediffuselighting: 'feDiffuseLighting'
+       fedisplacementmap: 'feDisplacementMap'
+       fedistantlight: 'feDistantLight'
+       fedropshadow: 'feDropShadow'
+       feflood: 'feFlood'
+       fefunca: 'feFuncA'
+       fefuncb: 'feFuncB'
+       fefuncg: 'feFuncG'
+       fefuncr: 'feFuncR'
+       fegaussianblur: 'feGaussianBlur'
+       feimage: 'feImage'
+       femerge: 'feMerge'
+       femergenode: 'feMergeNode'
+       femorphology: 'feMorphology'
+       feoffset: 'feOffset'
+       fepointlight: 'fePointLight'
+       fespecularlighting: 'feSpecularLighting'
+       fespotlight: 'feSpotLight'
+       fetile: 'feTile'
+       feturbulence: 'feTurbulence'
+       foreignobject: 'foreignObject'
+       glyphref: 'glyphRef'
+       lineargradient: 'linearGradient'
+       radialgradient: 'radialGradient'
+       textpath: 'textPath'
+}
+svg_attribute_fixes = {
+       attributename: 'attributeName'
+       attributetype: 'attributeType'
+       basefrequency: 'baseFrequency'
+       baseprofile: 'baseProfile'
+       calcmode: 'calcMode'
+       clippathunits: 'clipPathUnits'
+       contentscripttype: 'contentScriptType'
+       contentstyletype: 'contentStyleType'
+       diffuseconstant: 'diffuseConstant'
+       edgemode: 'edgeMode'
+       externalresourcesrequired: 'externalResourcesRequired'
+       # WHATWG removes this: filterres: 'filterRes'
+       filterunits: 'filterUnits'
+       glyphref: 'glyphRef'
+       gradienttransform: 'gradientTransform'
+       gradientunits: 'gradientUnits'
+       kernelmatrix: 'kernelMatrix'
+       kernelunitlength: 'kernelUnitLength'
+       keypoints: 'keyPoints'
+       keysplines: 'keySplines'
+       keytimes: 'keyTimes'
+       lengthadjust: 'lengthAdjust'
+       limitingconeangle: 'limitingConeAngle'
+       markerheight: 'markerHeight'
+       markerunits: 'markerUnits'
+       markerwidth: 'markerWidth'
+       maskcontentunits: 'maskContentUnits'
+       maskunits: 'maskUnits'
+       numoctaves: 'numOctaves'
+       pathlength: 'pathLength'
+       patterncontentunits: 'patternContentUnits'
+       patterntransform: 'patternTransform'
+       patternunits: 'patternUnits'
+       pointsatx: 'pointsAtX'
+       pointsaty: 'pointsAtY'
+       pointsatz: 'pointsAtZ'
+       preservealpha: 'preserveAlpha'
+       preserveaspectratio: 'preserveAspectRatio'
+       primitiveunits: 'primitiveUnits'
+       refx: 'refX'
+       refy: 'refY'
+       repeatcount: 'repeatCount'
+       repeatdur: 'repeatDur'
+       requiredextensions: 'requiredExtensions'
+       requiredfeatures: 'requiredFeatures'
+       specularconstant: 'specularConstant'
+       specularexponent: 'specularExponent'
+       spreadmethod: 'spreadMethod'
+       startoffset: 'startOffset'
+       stddeviation: 'stdDeviation'
+       stitchtiles: 'stitchTiles'
+       surfacescale: 'surfaceScale'
+       systemlanguage: 'systemLanguage'
+       tablevalues: 'tableValues'
+       targetx: 'targetX'
+       targety: 'targetY'
+       textlength: 'textLength'
+       viewbox: 'viewBox'
+       viewtarget: 'viewTarget'
+       xchannelselector: 'xChannelSelector'
+       ychannelselector: 'yChannelSelector'
+       zoomandpan: 'zoomAndPan'
+}
+foreign_attr_fixes = {
+       'xlink:actuate': 'xlink actuate'
+       'xlink:arcrole': 'xlink arcrole'
+       'xlink:href': 'xlink href'
+       'xlink:role': 'xlink role'
+       'xlink:show': 'xlink show'
+       'xlink:title': 'xlink title'
+       'xlink:type': 'xlink type'
+       'xml:base': 'xml base'
+       'xml:lang': 'xml lang'
+       'xml:space': 'xml space'
+       'xmlns': 'xmlns'
+       'xmlns:xlink': 'xmlns xlink'
+}
+adjust_mathml_attributes = (t) ->
+       for a in t.attrs_a
+               if a[0] is 'definitionurl'
+                       a[0] = 'definitionURL'
+       return
+adjust_svg_attributes = (t) ->
+       for a in t.attrs_a
+               if svg_attribute_fixes[a[0]]?
+                       a[0] = svg_attribute_fixes[a[0]]
+       return
+adjust_foreign_attributes = (t) ->
+       # fixfull
+       for a in t.attrs_a
+               if foreign_attr_fixes[a[0]]?
+                       a[0] = foreign_attr_fixes[a[0]]
+       return
+
+# decode_named_char_ref()
+#
+# The list of named character references is _huge_ so if we're running in a
+# browser, we get the browser to decode them, rather than increasing the code
+# size to include the table.
+if context is 'module'
+       _decode_named_char_ref = require './parser_no_browser_helper.coffee'
+else
+       # TODO test this in IE8
+       decode_named_char_ref_el = document.createElement('textarea')
+       _decode_named_char_ref = (txt) ->
+               txt = "&#{txt};"
+               decode_named_char_ref_el.innerHTML = txt
+               decoded = decode_named_char_ref_el.value
+               return null if decoded is txt
+               return decoded
+# Pass the name of a named entity _that has a terminating semicolon_
+# Entities without terminating semicolons should use legacy_char_refs[]
+# Do not include the "&" or ";" in your argument, eg pass "alpha"
+decode_named_char_ref_cache = {}
+decode_named_char_ref = (txt) ->
+       decoded = decode_named_char_ref_cache[txt]
+       return decoded if decoded?
+       decoded = _decode_named_char_ref txt
+       return decode_named_char_ref_cache[txt] = decoded
+
+parse_html = (args_html, args = {}) ->
+       txt = null
+       cur = null # index of next char in txt to be parsed
+       # declare doc and tokenizer variables so they're in scope below
+       doc = null
+       open_els = null # stack of open elements
+       afe = null # active formatting elements
+       template_ins_modes = null
+       ins_mode = null
+       original_ins_mode = null
+       tok_state = null
+       tok_cur_tag = null # partially parsed tag
+       flag_scripting = null
+       flag_frameset_ok = null
+       flag_parsing = null
+       flag_foster_parenting = null
+       form_element_pointer = null
+       temporary_buffer = null
+       pending_table_character_tokens = null
+       head_element_pointer = null
+       flag_fragment_parsing = null
+       context_element = null
+
+       stop_parsing = ->
+               flag_parsing = false
+               return
+
+       parse_error = ->
+               if args.error_cb?
+                       args.error_cb cur
+               return
+
+       # http://www.w3.org/TR/html5/syntax.html#push-onto-the-list-of-active-formatting-elements
+       # "Noah's Ark clause" but with three
+       afe_push = (new_el) ->
+               matches = 0
+               for el, i in afe
+                       if el.type is TYPE_AFE_MARKER
+                               break
+                       if el.name is new_el.name and el.namespace is new_el.namespace
+                               attrs_match = true
+                               for k, v of el.attrs
+                                       unless new_el.attrs[k] is v
+                                               attrs_match = false
+                                               break
+                               if attrs_match
+                                       for k, v of new_el.attrs
+                                               unless el.attrs[k] is v
+                                                       attrs_match = false
+                                                       break
+                               if attrs_match
+                                       matches += 1
+                                       if matches is 3
+                                               afe.splice i, 1
+                                               break
+               afe.unshift new_el
+               return
+
+       afe_push_marker = ->
+               afe.unshift new_afe_marker()
+               return
+
+       # the functions below impliment the Tree Contstruction algorithm
+       # http://www.w3.org/TR/html5/syntax.html#tree-construction
+
+       # But first... the helpers
+       template_tag_is_open = ->
+               for el in open_els
+                       if el.name is 'template' and el.namespace is NS_HTML
+                               return true
+               return false
+       is_in_scope_x = (tag_name, scope, namespace) ->
+               for el in open_els
+                       if el.name is tag_name and (namespace is null or namespace is el.namespace)
+                               return true
+                       if scope[el.name] is el.namespace
+                               return false
+               return false
+       is_in_scope_x_y = (tag_name, scope, scope2, namespace) ->
+               for el in open_els
+                       if el.name is tag_name and (namespace is null or namespace is el.namespace)
+                               return true
+                       if scope[el.name] is el.namespace
+                               return false
+                       if scope2[el.name] is el.namespace
+                               return false
+               return false
+       standard_scopers = {
+               applet: NS_HTML, caption: NS_HTML, html: NS_HTML, table: NS_HTML,
+               td: NS_HTML, th: NS_HTML, marquee: NS_HTML, object: NS_HTML,
+               template: NS_HTML,
+
+               mi: NS_MATHML, mo: NS_MATHML, mn: NS_MATHML, ms: NS_MATHML,
+               mtext: NS_MATHML, 'annotation-xml': NS_MATHML,
+
+               foreignObject: NS_SVG, desc: NS_SVG, title: NS_SVG
+       }
+       button_scopers = button: NS_HTML
+       li_scopers = ol: NS_HTML, ul: NS_HTML
+       table_scopers = html: NS_HTML, table: NS_HTML, template: NS_HTML
+       is_in_scope = (tag_name, namespace = null) ->
+               return is_in_scope_x tag_name, standard_scopers, namespace
+       is_in_button_scope = (tag_name, namespace = null) ->
+               return is_in_scope_x_y tag_name, standard_scopers, button_scopers, namespace
+       is_in_table_scope = (tag_name, namespace = null) ->
+               return is_in_scope_x tag_name, table_scopers, namespace
+       # aka is_in_list_item_scope
+       is_in_li_scope = (tag_name, namespace = null) ->
+               return is_in_scope_x_y tag_name, standard_scopers, li_scopers, namespace
+       is_in_select_scope = (tag_name, namespace = null) ->
+               for t in open_els
+                       if t.name is tag_name and (namespace is null or namespace is t.namespace)
+                               return true
+                       if t.namespace isnt NS_HTML and t.name isnt 'optgroup' and t.name isnt 'option'
+                               return false
+               return false
+       # this checks for a particular element, not by name
+       # this requires a namespace match
+       el_is_in_scope = (needle) ->
+               for el in open_els
+                       if el is needle
+                               return true
+                       if standard_scopers[el.name] is el.namespace
+                               return false
+               return false
+
+       clear_to_table_stopers = {
+               'table': true
+               'template': true
+               'html': true
+       }
+       clear_stack_to_table_context = ->
+               loop
+                       if clear_to_table_stopers[open_els[0].name]?
+                               break
+                       open_els.shift()
+               return
+       clear_to_table_body_stopers = {
+               tbody: NS_HTML
+               tfoot: NS_HTML
+               thead: NS_HTML
+               template: NS_HTML
+               html: NS_HTML
+       }
+       clear_stack_to_table_body_context = ->
+               loop
+                       if clear_to_table_body_stopers[open_els[0].name] is open_els[0].namespace
+                               break
+                       open_els.shift()
+               return
+       clear_to_table_row_stopers = {
+               'tr': true
+               'template': true
+               'html': true
+       }
+       clear_stack_to_table_row_context = ->
+               loop
+                       if clear_to_table_row_stopers[open_els[0].name]?
+                               break
+                       open_els.shift()
+               return
+       clear_afe_to_marker = ->
+               loop
+                       return unless afe.length > 0 # this happens in fragment case, ?spec error
+                       el = afe.shift()
+                       if el.type is TYPE_AFE_MARKER
+                               return
+               return
+
+       # 8.2.3.1 ...
+       # http://www.w3.org/TR/html5/syntax.html#reset-the-insertion-mode-appropriately
+       reset_ins_mode = ->
+               # 1. Let last be false.
+               last = false
+               # 2. Let node be the last node in the stack of open elements.
+               node_i = 0
+               node = open_els[node_i]
+               # 3. Loop: If node is the first node in the stack of open elements,
+               # then set last to true, and, if the parser was originally created as
+               # part of the HTML fragment parsing algorithm (fragment case) set node
+               # to the context element.
+               loop
+                       if node_i is open_els.length - 1
+                               last = true
+                               if flag_fragment_parsing
+                                       node = context_element
+                       # 4. If node is a select element, run these substeps:
+                       if node.name is 'select' and node.namespace is NS_HTML
+                               # 1. If last is true, jump to the step below labeled done.
+                               unless last
+                                       # 2. Let ancestor be node.
+                                       ancestor_i = node_i
+                                       ancestor = node
+                                       # 3. Loop: If ancestor is the first node in the stack of
+                                       # open elements, jump to the step below labeled done.
+                                       loop
+                                               if ancestor_i is open_els.length - 1
+                                                       break
+                                               # 4. Let ancestor be the node before ancestor in the stack
+                                               # of open elements.
+                                               ancestor_i += 1
+                                               ancestor = open_els[ancestor_i]
+                                               # 5. If ancestor is a template node, jump to the step below
+                                               # labeled done.
+                                               if ancestor.name is 'template' and ancestor.namespace is NS_HTML
+                                                       break
+                                               # 6. If ancestor is a table node, switch the insertion mode
+                                               # to "in select in table" and abort these steps.
+                                               if ancestor.name is 'table' and ancestor.namespace is NS_HTML
+                                                       ins_mode = ins_mode_in_select_in_table
+                                                       return
+                                               # 7. Jump back to the step labeled loop.
+                               # 8. Done: Switch the insertion mode to "in select" and abort
+                               # these steps.
+                               ins_mode = ins_mode_in_select
+                               return
+                       # 5. If node is a td or th element and last is false, then switch
+                       # the insertion mode to "in cell" and abort these steps.
+                       if (node.name is 'td' or node.name is 'th') and node.namespace is NS_HTML and last is false
+                               ins_mode = ins_mode_in_cell
+                               return
+                       # 6. If node is a tr element, then switch the insertion mode to "in
+                       # row" and abort these steps.
+                       if node.name is 'tr' and node.namespace is NS_HTML
+                               ins_mode = ins_mode_in_row
+                               return
+                       # 7. If node is a tbody, thead, or tfoot element, then switch the
+                       # insertion mode to "in table body" and abort these steps.
+                       if (node.name is 'tbody' or node.name is 'thead' or node.name is 'tfoot') and node.namespace is NS_HTML
+                               ins_mode = ins_mode_in_table_body
+                               return
+                       # 8. If node is a caption element, then switch the insertion mode
+                       # to "in caption" and abort these steps.
+                       if node.name is 'caption' and node.namespace is NS_HTML
+                               ins_mode = ins_mode_in_caption
+                               return
+                       # 9. If node is a colgroup element, then switch the insertion mode
+                       # to "in column group" and abort these steps.
+                       if node.name is 'colgroup' and node.namespace is NS_HTML
+                               ins_mode = ins_mode_in_column_group
+                               return
+                       # 10. If node is a table element, then switch the insertion mode to
+                       # "in table" and abort these steps.
+                       if node.name is 'table' and node.namespace is NS_HTML
+                               ins_mode = ins_mode_in_table
+                               return
+                       # 11. If node is a template element, then switch the insertion mode
+                       # to the current template insertion mode and abort these steps.
+                       if node.name is 'template' and node.namespace is NS_HTML
+                               ins_mode = template_ins_modes[0]
+                               return
+                       # 12. If node is a head element and last is true, then switch the
+                       # insertion mode to "in body" ("in body"! not "in head"!) and abort
+                       # these steps. (fragment case)
+                       if node.name is 'head' and node.namespace is NS_HTML and last
+                               ins_mode = ins_mode_in_body
+                               return
+                       # 13. If node is a head element and last is false, then switch the
+                       # insertion mode to "in head" and abort these steps.
+                       if node.name is 'head' and node.namespace is NS_HTML and last is false
+                               ins_mode = ins_mode_in_head
+                               return
+                       # 14. If node is a body element, then switch the insertion mode to
+                       # "in body" and abort these steps.
+                       if node.name is 'body' and node.namespace is NS_HTML
+                               ins_mode = ins_mode_in_body
+                               return
+                       # 15. If node is a frameset element, then switch the insertion mode
+                       # to "in frameset" and abort these steps. (fragment case)
+                       if node.name is 'frameset' and node.namespace is NS_HTML
+                               ins_mode = ins_mode_in_frameset
+                               return
+                       # 16. If node is an html element, run these substeps:
+                       if node.name is 'html' and node.namespace is NS_HTML
+                               # 1. If the head element pointer is null, switch the insertion
+                               # mode to "before head" and abort these steps. (fragment case)
+                               if head_element_pointer is null
+                                       ins_mode = ins_mode_before_head
+                               else
+                                       # 2. Otherwise, the head element pointer is not null,
+                                       # switch the insertion mode to "after head" and abort these
+                                       # steps.
+                                       ins_mode = ins_mode_after_head
+                               return
+                       # 17. If last is true, then switch the insertion mode to "in body"
+                       # and abort these steps. (fragment case)
+                       if last
+                               ins_mode = ins_mode_in_body
+                               return
+                       # 18. Let node now be the node before node in the stack of open
+                       # elements.
+                       node_i += 1
+                       node = open_els[node_i]
+                       # 19. Return to the step labeled loop.
+               return
+
+       # 8.2.3.2
+
+       # http://www.w3.org/TR/html5/syntax.html#adjusted-current-node
+       adjusted_current_node = ->
+               if open_els.length is 1 and flag_fragment_parsing
+                       return context_element
+               return open_els[0]
+
+       # http://www.w3.org/TR/html5/syntax.html#reconstruct-the-active-formatting-elements
+       # this implementation is structured (mostly) as described at the link above.
+       # capitalized comments are the "labels" described at the link above.
+       reconstruct_afe = ->
+               return if afe.length is 0
+               if afe[0].type is TYPE_AFE_MARKER or afe[0] in open_els
+                       return
+               # Rewind
+               i = 0
+               loop
+                       if i is afe.length - 1
+                               break
+                       i += 1
+                       if afe[i].type is TYPE_AFE_MARKER or afe[i] in open_els
+                               i -= 1 # Advance
+                               break
+               # Create
+               loop
+                       el = insert_html_element afe[i].token
+                       afe[i] = el
+                       break if i is 0
+                       i -= 1 # Advance
+               return
+
+       # http://www.w3.org/TR/html5/syntax.html#adoption-agency-algorithm
+       # adoption agency algorithm
+       # overview here:
+       #   http://www.w3.org/TR/html5/syntax.html#misnested-tags:-b-i-/b-/i
+       #   http://www.w3.org/TR/html5/syntax.html#misnested-tags:-b-p-/b-/p
+       #   http://www.w3.org/TR/html5/syntax.html#unclosed-formatting-elements
+       adoption_agency = (subject) ->
+# this block implements tha W3C spec
+#              # 1. If the current node is an HTML element whose tag name is subject,
+#              # then run these substeps:
+#              #
+#              # 1. Let element be the current node.
+#              #
+#              # 2. Pop element off the stack of open elements.
+#              #
+#              # 3. If element is also in the list of active formatting elements,
+#              # remove the element from the list.
+#              #
+#              # 4. Abort the adoption agency algorithm.
+#              if open_els[0].name is subject and open_els[0].namespace is NS_HTML
+#                      el = open_els.shift()
+#                      # remove it from the list of active formatting elements (if found)
+#                      for t, i in afe
+#                              if t is el
+#                                      afe.splice i, 1
+#                                      break
+#                      return
+# WHATWG: https://html.spec.whatwg.org/multipage/syntax.html#adoption-agency-algorithm
+               # If the current node is an HTML element whose tag name is subject, and
+               # the current node is not in the list of active formatting elements,
+               # then pop the current node off the stack of open elements, and abort
+               # these steps.
+               if open_els[0].name is subject and open_els[0].namespace is NS_HTML
+                       # remove it from the list of active formatting elements (if found)
+                       in_afe = false
+                       for el, i in afe
+                               if el is open_els[0]
+                                       in_afe = true
+                                       break
+                       unless in_afe
+                               open_els.shift()
+                               return
+                       # fall through
+# END WHATWG
+               outer = 0
+               loop
+                       if outer >= 8
+                               return
+                       outer += 1
+                       # 5. Let formatting element be the last element in the list of
+                       # active formatting elements that: is between the end of the list
+                       # and the last scope marker in the list, if any, or the start of
+                       # the list otherwise, and  has the tag name subject.
+                       fe = null
+                       for t, fe_of_afe in afe
+                               if t.type is TYPE_AFE_MARKER
+                                       break
+                               if t.name is subject
+                                       fe = t
+                                       break
+                       # If there is no such element, then abort these steps and instead
+                       # act as described in the "any other end tag" entry above.
+                       if fe is null
+                               in_body_any_other_end_tag subject
+                               return
+                       # 6. If formatting element is not in the stack of open elements,
+                       # then this is a parse error; remove the element from the list, and
+                       # abort these steps.
+                       in_open_els = false
+                       for t, fe_of_open_els in open_els
+                               if t is fe
+                                       in_open_els = true
+                                       break
+                       unless in_open_els
+                               parse_error()
+                               # "remove it from the list" must mean afe, since it's not in open_els
+                               afe.splice fe_of_afe, 1
+                               return
+                       # 7. If formatting element is in the stack of open elements, but
+                       # the element is not in scope, then this is a parse error; abort
+                       # these steps.
+                       unless el_is_in_scope fe
+                               parse_error()
+                               return
+                       # 8. If formatting element is not the current node, this is a parse
+                       # error. (But do not abort these steps.)
+                       unless open_els[0] is fe
+                               parse_error()
+                               # continue
+                       # 9. Let furthest block be the topmost node in the stack of open
+                       # elements that is lower in the stack than formatting element, and
+                       # is an element in the special category. There might not be one.
+                       fb = null
+                       fb_of_open_els = null
+                       for t, i in open_els
+                               if t is fe
+                                       break
+                               if el_is_special t
+                                       fb = t
+                                       fb_of_open_els = i
+                                       # and continue, to see if there's one that's more "topmost"
+                       # 10. If there is no furthest block, then the UA must first pop all
+                       # the nodes from the bottom of the stack of open elements, from the
+                       # current node up to and including formatting element, then remove
+                       # formatting element from the list of active formatting elements,
+                       # and finally abort these steps.
+                       if fb is null
+                               loop
+                                       t = open_els.shift()
+                                       if t is fe
+                                               afe.splice fe_of_afe, 1
+                                               return
+                       # 11. Let common ancestor be the element immediately above
+                       # formatting element in the stack of open elements.
+                       ca = open_els[fe_of_open_els + 1] # common ancestor
+
+                       node_above = open_els[fb_of_open_els + 1] # next node if node isn't in open_els anymore
+                       # 12. Let a bookmark note the position of formatting element in the list of active formatting elements relative to the elements on either side of it in the list.
+                       bookmark = new_aaa_bookmark()
+                       for t, i in afe
+                               if t is fe
+                                       afe.splice i, 0, bookmark
+                                       break
+                       node = last_node = fb
+                       inner = 0
+                       loop
+                               inner += 1
+                               # 3. Let node be the element immediately above node in the
+                               # stack of open elements, or if node is no longer in the stack
+                               # of open elements (e.g. because it got removed by this
+                               # algorithm), the element that was immediately above node in
+                               # the stack of open elements before node was removed.
+                               node_next = null
+                               for t, i in open_els
+                                       if t is node
+                                               node_next = open_els[i + 1]
+                                               break
+                               node = node_next ? node_above
+                               # TODO make sure node_above gets re-set if/when node is removed from open_els
+
+                               # 4. If node is formatting element, then go to the next step in
+                               # the overall algorithm.
+                               if node is fe
+                                       break
+                               # 5. If inner loop counter is greater than three and node is in
+                               # the list of active formatting elements, then remove node from
+                               # the list of active formatting elements.
+                               node_in_afe = false
+                               for t, i in afe
+                                       if t is node
+                                               if inner > 3
+                                                       afe.splice i, 1
+                                               else
+                                                       node_in_afe = true
+                                               break
+                               # 6. If node is not in the list of active formatting elements,
+                               # then remove node from the stack of open elements and then go
+                               # back to the step labeled inner loop.
+                               unless node_in_afe
+                                       for t, i in open_els
+                                               if t is node
+                                                       node_above = open_els[i + 1]
+                                                       open_els.splice i, 1
+                                                       break
+                                       continue
+                               # 7. create an element for the token for which the element node
+                               # was created, in the HTML namespace, with common ancestor as
+                               # the intended parent; replace the entry for node in the list
+                               # of active formatting elements with an entry for the new
+                               # element, replace the entry for node in the stack of open
+                               # elements with an entry for the new element, and let node be
+                               # the new element.
+                               new_node = token_to_element node.token, NS_HTML, ca
+                               for t, i in afe
+                                       if t is node
+                                               afe[i] = new_node
+                                               break
+                               for t, i in open_els
+                                       if t is node
+                                               node_above = open_els[i + 1]
+                                               open_els[i] = new_node
+                                               break
+                               node = new_node
+                               # 8. If last node is furthest block, then move the
+                               # aforementioned bookmark to be immediately after the new node
+                               # in the list of active formatting elements.
+                               if last_node is fb
+                                       for t, i in afe
+                                               if t is bookmark
+                                                       afe.splice i, 1
+                                                       break
+                                       for t, i in afe
+                                               if t is node
+                                                       # "after" means lower
+                                                       afe.splice i, 0, bookmark # "after as <-
+                                                       break
+                               # 9. Insert last node into node, first removing it from its
+                               # previous parent node if any.
+                               if last_node.parent?
+                                       for c, i in last_node.parent.children
+                                               if c is last_node
+                                                       last_node.parent.children.splice i, 1
+                                                       break
+                               node.children.push last_node
+                               last_node.parent = node
+                               # 10. Let last node be node.
+                               last_node = node
+                               # 11. Return to the step labeled inner loop.
+                       # 14. Insert whatever last node ended up being in the previous step
+                       # at the appropriate place for inserting a node, but using common
+                       # ancestor as the override target.
+
+                       # In the case where fe is immediately followed by fb:
+                       #   * inner loop exits out early (node==fe)
+                       #   * last_node is fb
+                       #   * last_node is still in the tree (not a duplicate)
+                       if last_node.parent?
+                               for c, i in last_node.parent.children
+                                       if c is last_node
+                                               last_node.parent.children.splice i, 1
+                                               break
+                       # can't use standard insert token thing, because it's already in
+                       # open_els and must stay at it's current position in open_els
+                       dest = adjusted_insertion_location ca
+                       dest[0].children.splice dest[1], 0, last_node
+                       last_node.parent = dest[0]
+                       # 15. Create an element for the token for which formatting element
+                       # was created, in the HTML namespace, with furthest block as the
+                       # intended parent.
+                       new_element = token_to_element fe.token, NS_HTML, fb
+                       # 16. Take all of the child nodes of furthest block and append them
+                       # to the element created in the last step.
+                       while fb.children.length
+                               t = fb.children.shift()
+                               t.parent = new_element
+                               new_element.children.push t
+                       # 17. Append that new element to furthest block.
+                       new_element.parent = fb
+                       fb.children.push new_element
+                       # 18. Remove formatting element from the list of active formatting
+                       # elements, and insert the new element into the list of active
+                       # formatting elements at the position of the aforementioned
+                       # bookmark.
+                       for t, i in afe
+                               if t is fe
+                                       afe.splice i, 1
+                                       break
+                       for t, i in afe
+                               if t is bookmark
+                                       afe[i] = new_element
+                                       break
+                       # 19. Remove formatting element from the stack of open elements,
+                       # and insert the new element into the stack of open elements
+                       # immediately below the position of furthest block in that stack.
+                       for t, i in open_els
+                               if t is fe
+                                       open_els.splice i, 1
+                                       break
+                       for t, i in open_els
+                               if t is fb
+                                       open_els.splice i, 0, new_element
+                                       break
+                       # 20. Jump back to the step labeled outer loop.
+               return
+
+       # http://www.w3.org/TR/html5/syntax.html#close-a-p-element
+       close_p_element = ->
+               generate_implied_end_tags 'p' # arg is exception
+               unless open_els[0].name is 'p' and open_els[0].namespace is NS_HTML
+                       parse_error()
+               while open_els.length > 1 # just in case
+                       el = open_els.shift()
+                       if el.name is 'p' and el.namespace is NS_HTML
+                               return
+               return
+       close_p_if_in_button_scope = ->
+               if is_in_button_scope 'p', NS_HTML
+                       close_p_element()
+               return
+
+       # http://www.w3.org/TR/html5/syntax.html#insert-a-character
+       # aka insert_a_character = (t) ->
+       insert_character = (t) ->
+               dest = adjusted_insertion_location()
+               # fixfull check for Document node
+               if dest[1] > 0
+                       prev = dest[0].children[dest[1] - 1]
+                       if prev.type is TYPE_TEXT
+                               prev.text += t.text
+                               return
+               dest[0].children.splice dest[1], 0, t
+               return
+
+       # 8.2.5 http://www.w3.org/TR/html5/syntax.html#tree-construction
+       process_token = (t) ->
+               acn = adjusted_current_node()
+               unless acn?
+                       ins_mode t
+                       return
+               if acn.namespace is NS_HTML
+                       ins_mode t
+                       return
+               if is_mathml_text_integration_point(acn)
+                       if t.type is TYPE_START_TAG and not (t.name is 'mglyph' or t.name is 'malignmark')
+                               ins_mode t
+                               return
+                       if t.type is TYPE_TEXT
+                               ins_mode t
+                               return
+               if acn.namespace is NS_MATHML and acn.name is 'annotation-xml' and t.type is TYPE_START_TAG and t.name is 'svg'
+                       ins_mode t
+                       return
+               if is_html_integration acn
+                       if t.type is TYPE_START_TAG or t.type is TYPE_TEXT
+                               ins_mode t
+                               return
+               if t.type is TYPE_EOF
+                       ins_mode t
+                       return
+               in_foreign_content t
+               return
+
+       # 8.2.5.1
+       # http://www.w3.org/TR/html5/syntax.html#creating-and-inserting-nodes
+       # http://www.w3.org/TR/html5/syntax.html#appropriate-place-for-inserting-a-node
+       adjusted_insertion_location = (override_target = null) ->
+               # 1. If there was an override target specified, then let target be the
+               # override target.
+               if override_target?
+                       target = override_target
+               else # Otherwise, let target be the current node.
+                       target = open_els[0]
+               # 2. Determine the adjusted insertion location using the first matching
+               # steps from the following list:
+               #
+               # If foster parenting is enabled and target is a table, tbody, tfoot,
+               # thead, or tr element Foster parenting happens when content is
+               # misnested in tables.
+               if flag_foster_parenting and foster_parenting_targets[target.name] is target.namespace
+                       loop # once. this is here so we can ``break`` to "abort these substeps"
+                               # 1. Let last template be the last template element in the
+                               # stack of open elements, if any.
+                               last_template = null
+                               last_template_i = null
+                               for el, i in open_els
+                                       if el.name is 'template' and el.namespace is NS_HTML
+                                               last_template = el
+                                               last_template_i = i
+                                               break
+                               # 2. Let last table be the last table element in the stack of
+                               # open elements, if any.
+                               last_table = null
+                               last_table_i
+                               for el, i in open_els
+                                       if el.name is 'table' and el.namespace is NS_HTML
+                                               last_table = el
+                                               last_table_i = i
+                                               break
+                               # 3. If there is a last template and either there is no last
+                               # table, or there is one, but last template is lower (more
+                               # recently added) than last table in the stack of open
+                               # elements, then: let adjusted insertion location be inside
+                               # last template's template contents, after its last child (if
+                               # any), and abort these substeps.
+                               if last_template and (last_table is null or last_template_i < last_table_i)
+                                       target = last_template # fixfull should be it's contents
+                                       target_i = target.children.length
+                                       break
+                               # 4. If there is no last table, then let adjusted insertion
+                               # location be inside the first element in the stack of open
+                               # elements (the html element), after its last child (if any),
+                               # and abort these substeps. (fragment case)
+                               if last_table is null
+                                       # this is odd
+                                       target = open_els[open_els.length - 1]
+                                       target_i = target.children.length
+                                       break
+                               # 5. If last table has a parent element, then let adjusted
+                               # insertion location be inside last table's parent element,
+                               # immediately before last table, and abort these substeps.
+                               if last_table.parent?
+                                       for c, i in last_table.parent.children
+                                               if c is last_table
+                                                       target = last_table.parent
+                                                       target_i = i
+                                                       break
+                                       break
+                               # 6. Let previous element be the element immediately above last
+                               # table in the stack of open elements.
+                               #
+                               # huh? how could it not have a parent?
+                               previous_element = open_els[last_table_i + 1]
+                               # 7. Let adjusted insertion location be inside previous
+                               # element, after its last child (if any).
+                               target = previous_element
+                               target_i = target.children.length
+                               # Note: These steps are involved in part because it's possible
+                               # for elements, the table element in this case in particular,
+                               # to have been moved by a script around in the DOM, or indeed
+                               # removed from the DOM entirely, after the element was inserted
+                               # by the parser.
+                               break # don't really loop
+               else
+                       # Otherwise Let adjusted insertion location be inside target, after
+                       # its last child (if any).
+                       target_i = target.children.length
+
+               # 3. If the adjusted insertion location is inside a template element,
+               # let it instead be inside the template element's template contents,
+               # after its last child (if any).
+               # fixfull (template)
+
+               # 4. Return the adjusted insertion location.
+               return [target, target_i]
+
+       # http://www.w3.org/TR/html5/syntax.html#create-an-element-for-the-token
+       # aka create_an_element_for_token
+       token_to_element = (t, namespace, intended_parent) ->
+               # convert attributes into a hash
+               attrs = {}
+               for a in t.attrs_a
+                       attrs[a[0]] = a[1] # TODO check what to do with dupilcate attrs
+               el = new Node TYPE_TAG, name: t.name, namespace: namespace, attrs: attrs, token: t
+
+               # TODO 2. If the newly created element has an xmlns attribute in the
+               # XMLNS namespace whose value is not exactly the same as the element's
+               # namespace, that is a parse error. Similarly, if the newly created
+               # element has an xmlns:xlink attribute in the XMLNS namespace whose
+               # value is not the XLink Namespace, that is a parse error.
+
+               # fixfull: the spec says stuff about form pointers and ownerDocument
+
+               return el
+
+       # http://www.w3.org/TR/html5/syntax.html#insert-a-foreign-element
+       insert_foreign_element = (token, namespace) ->
+               ail = adjusted_insertion_location()
+               ail_el = ail[0]
+               ail_i = ail[1]
+               el = token_to_element token, namespace, ail_el
+               # TODO skip this next step if it's broken (eg ail_el is document with child already)
+               el.parent = ail_el
+               ail_el.children.splice ail_i, 0, el
+               open_els.unshift el
+               return el
+       # http://www.w3.org/TR/html5/syntax.html#insert-an-html-element
+       insert_html_element = (token) ->
+               return insert_foreign_element token, NS_HTML
+
+       # http://www.w3.org/TR/html5/syntax.html#insert-a-comment
+       # position should be [node, index_within_children]
+       insert_comment = (t, position = null) ->
+               position ?= adjusted_insertion_location()
+               position[0].children.splice position[1], 0, t
+               return
+
+       # 8.2.5.2
+       # http://www.w3.org/TR/html5/syntax.html#generic-raw-text-element-parsing-algorithm
+       parse_generic_raw_text = (t) ->
+               insert_html_element t
+               tok_state = tok_state_rawtext
+               original_ins_mode = ins_mode
+               ins_mode = ins_mode_text
+               return
+       parse_generic_rcdata_text = (t) ->
+               insert_html_element t
+               tok_state = tok_state_rcdata
+               original_ins_mode = ins_mode
+               ins_mode = ins_mode_text
+               return
+
+       # 8.2.5.3 http://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags
+       # http://www.w3.org/TR/html5/syntax.html#generate-implied-end-tags
+       generate_implied_end_tags = (except = null) ->
+               while end_tag_implied[open_els[0].name] is open_els[0].namespace and open_els[0].name isnt except
+                       open_els.shift()
+               return
+
+       # 8.2.5.4 The rules for parsing tokens in HTML content
+       # http://www.w3.org/TR/html5/syntax.html#parsing-main-inhtml
+
+       # 8.2.5.4.1 The "initial" insertion mode
+       # http://www.w3.org/TR/html5/syntax.html#the-initial-insertion-mode
+       is_quirks_yes_doctype = (t) ->
+               if t.flag 'force-quirks'
+                       return true
+               if t.name isnt 'html'
+                       return true
+               if t.public_identifier?
+                       pi = t.public_identifier.toLowerCase()
+                       for p in quirks_yes_pi_prefixes
+                               if pi.substr(0, p.length) is p
+                                       return true
+                       if pi is '-//w3o//dtd w3 html strict 3.0//en//' or pi is '-/w3c/dtd html 4.0 transitional/en' or pi is 'html'
+                               return true
+               if t.system_identifier?
+                       if t.system_identifier.toLowerCase() is 'http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd'
+                               return true
+               else if t.public_identifier?
+                       # already did this: pi = t.public_identifier.toLowerCase()
+                       if pi.substr(0, 32) is '-//w3c//dtd html 4.01 frameset//' or pi.substr(0, 36) is '-//w3c//dtd html 4.01 transitional//'
+                               return true
+               return false
+       is_quirks_limited_doctype = (t) ->
+               if t.public_identifier?
+                       pi = t.public_identifier.toLowerCase()
+                       if pi.substr(0, 32) is '-//w3c//dtd xhtml 1.0 frameset//' or pi.substr(0, 36) is '-//w3c//dtd xhtml 1.0 transitional//'
+                               return true
+                       if t.system_identifier?
+                               if pi.substr(0, 32) is '-//w3c//dtd html 4.01 frameset//' or pi.substr(0, 36) is '-//w3c//dtd html 4.01 transitional//'
+                                       return true
+               return false
+       ins_mode_initial = (t) ->
+               if is_space_tok t
+                       return
+               if t.type is TYPE_COMMENT
+                       # ?fixfull
+                       doc.children.push t
+                       return
+               if t.type is TYPE_DOCTYPE
+                       # fixfull syntax error from first paragraph and following bullets
+                       # fixfull set doc.doctype
+                       # fixfull is the "not an iframe srcdoc" thing relevant?
+                       if is_quirks_yes_doctype t
+                               doc.flag 'quirks mode', QUIRKS_YES
+                       else if is_quirks_limited_doctype t
+                               doc.flag 'quirks mode', QUIRKS_LIMITED
+                       doc.children.push t
+                       ins_mode = ins_mode_before_html
+                       return
+               # Anything else
+               # fixfull not iframe srcdoc?
+               parse_error()
+               doc.flag 'quirks mode', QUIRKS_YES
+               ins_mode = ins_mode_before_html
+               process_token t
+               return
+
+       # 8.2.5.4.2 http://www.w3.org/TR/html5/syntax.html#the-before-html-insertion-mode
+       ins_mode_before_html = (t) ->
+               if t.type is TYPE_DOCTYPE
+                       parse_error()
+                       return
+               if t.type is TYPE_COMMENT
+                       doc.children.push t
+                       return
+               if is_space_tok t
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'html'
+                       el = token_to_element t, NS_HTML, doc
+                       doc.children.push el
+                       el.document = doc
+                       open_els.unshift(el)
+                       # fixfull (big paragraph in spec about manifest, fragment, urls, etc)
+                       ins_mode = ins_mode_before_head
+                       return
+               if t.type is TYPE_END_TAG
+                       if t.name is 'head' or t.name is 'body' or t.name is 'html' or t.name is 'br'
+                               # fall through to "anything else"
+                       else
+                               parse_error()
+                               return
+               # Anything else
+               el = token_to_element new_open_tag('html'), NS_HTML, doc
+               doc.children.push el
+               el.document = doc
+               open_els.unshift el
+               # ?fixfull browsing context
+               ins_mode = ins_mode_before_head
+               process_token t
+               return
+
+       # 8.2.5.4.3 http://www.w3.org/TR/html5/syntax.html#the-before-head-insertion-mode
+       ins_mode_before_head = (t) ->
+               if is_space_tok t
+                       return
+               if t.type is TYPE_COMMENT
+                       insert_comment t
+                       return
+               if t.type is TYPE_DOCTYPE
+                       parse_error()
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'html'
+                       ins_mode_in_body t
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'head'
+                       el = insert_html_element t
+                       head_element_pointer = el
+                       ins_mode = ins_mode_in_head
+                       return
+               if t.type is TYPE_END_TAG
+                       if t.name is 'head' or t.name is 'body' or t.name is 'html' or t.name is 'br'
+                               # fall through to Anything else below
+                       else
+                               parse_error()
+                               return
+               # Anything else
+               el = insert_html_element new_open_tag 'head'
+               head_element_pointer = el
+               ins_mode = ins_mode_in_head
+               process_token t
+               return
+
+       # 8.2.5.4.4 http://www.w3.org/TR/html5/syntax.html#parsing-main-inhead
+       ins_mode_in_head_else = (t) -> # factored out for same-as-spec flow control
+               open_els.shift() # spec says this will be a 'head' node
+               ins_mode = ins_mode_after_head
+               process_token t
+               return
+       ins_mode_in_head = (t) ->
+               if t.type is TYPE_TEXT and (t.text is "\t" or t.text is "\n" or t.text is "\u000c" or t.text is ' ')
+                       insert_character t
+                       return
+               if t.type is TYPE_COMMENT
+                       insert_comment t
+                       return
+               if t.type is TYPE_DOCTYPE
+                       parse_error()
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'html'
+                       ins_mode_in_body t
+                       return
+               if t.type is TYPE_START_TAG and (t.name is 'base' or t.name is 'basefont' or t.name is 'bgsound' or t.name is 'link')
+                       el = insert_html_element t
+                       open_els.shift()
+                       t.acknowledge_self_closing()
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'meta'
+                       el = insert_html_element t
+                       open_els.shift()
+                       t.acknowledge_self_closing()
+                       # fixfull encoding stuff
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'title'
+                       parse_generic_rcdata_text t
+                       return
+               if t.type is TYPE_START_TAG and ((t.name is 'noscript' and flag_scripting) or t.name is 'noframes' or t.name is 'style')
+                       parse_generic_raw_text t
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'noscript' and flag_scripting is false
+                       insert_html_element t
+                       ins_mode = ins_mode_in_head_noscript
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'script'
+                       ail = adjusted_insertion_location()
+                       el = token_to_element t, NS_HTML, ail
+                       el.flag 'parser-inserted', true
+                       # fixfull frament case
+                       ail[0].children.splice ail[1], 0, el
+                       open_els.unshift el
+                       tok_state = tok_state_script_data
+                       original_ins_mode = ins_mode # make sure orig... is defined
+                       ins_mode = ins_mode_text
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'head'
+                       open_els.shift() # will be a head element... spec says so
+                       ins_mode = ins_mode_after_head
+                       return
+               if t.type is TYPE_END_TAG and (t.name is 'body' or t.name is 'html' or t.name is 'br')
+                       ins_mode_in_head_else t
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'template'
+                       insert_html_element t
+                       afe_push_marker()
+                       flag_frameset_ok = false
+                       ins_mode = ins_mode_in_template
+                       template_ins_modes.unshift ins_mode_in_template
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'template'
+                       if template_tag_is_open()
+                               generate_implied_end_tags
+                               if open_els[0].name isnt 'template'
+                                       parse_error()
+                               loop
+                                       el = open_els.shift()
+                                       if el.name is 'template' and el.namespace is NS_HTML
+                                               break
+                               clear_afe_to_marker()
+                               template_ins_modes.shift()
+                               reset_ins_mode()
+                       else
+                               parse_error()
+                       return
+               if (t.type is TYPE_START_TAG and t.name is 'head') or t.type is TYPE_END_TAG
+                       parse_error()
+                       return
+               ins_mode_in_head_else t
+               return
+
+       # 8.2.5.4.5 http://www.w3.org/TR/html5/syntax.html#parsing-main-inheadnoscript
+       ins_mode_in_head_noscript_else = (t) ->
+               parse_error()
+               open_els.shift()
+               ins_mode = ins_mode_in_head
+               process_token t
+               return
+       ins_mode_in_head_noscript = (t) ->
+               if t.type is TYPE_DOCTYPE
+                       parse_error()
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'html'
+                       ins_mode_in_body t
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'noscript'
+                       open_els.shift()
+                       ins_mode = ins_mode_in_head
+                       return
+               if is_space_tok(t) or t.type is TYPE_COMMENT or (t.type is TYPE_START_TAG and (t.name is 'basefont' or t.name is 'bgsound' or t.name is 'link' or t.name is 'meta' or t.name is 'noframes' or t.name is 'style'))
+                       ins_mode_in_head t
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'br'
+                       ins_mode_in_head_noscript_else t
+                       return
+               if (t.type is TYPE_START_TAG and (t.name is 'head' or t.name is 'noscript')) or t.type is TYPE_END_TAG
+                       parse_error()
+                       return
+               # Anything else
+               ins_mode_in_head_noscript_else t
+               return
+
+       # 8.2.5.4.6 http://www.w3.org/TR/html5/syntax.html#the-after-head-insertion-mode
+       ins_mode_after_head_else = (t) ->
+               body_tok = new_open_tag 'body'
+               insert_html_element body_tok
+               ins_mode = ins_mode_in_body
+               process_token t
+               return
+       ins_mode_after_head = (t) ->
+               if is_space_tok t
+                       insert_character t
+                       return
+               if t.type is TYPE_COMMENT
+                       insert_comment t
+                       return
+               if t.type is TYPE_DOCTYPE
+                       parse_error()
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'html'
+                       ins_mode_in_body t
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'body'
+                       insert_html_element t
+                       flag_frameset_ok = false
+                       ins_mode = ins_mode_in_body
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'frameset'
+                       insert_html_element t
+                       ins_mode = ins_mode_in_frameset
+                       return
+               if t.type is TYPE_START_TAG and (t.name is 'base' or t.name is 'basefont' or t.name is 'bgsound' or t.name is 'link' or t.name is 'meta' or t.name is 'noframes' or t.name is 'script' or t.name is 'style' or t.name is 'template' or t.name is 'title')
+                       parse_error()
+                       open_els.unshift head_element_pointer
+                       ins_mode_in_head t
+                       for el, i in open_els
+                               if el is head_element_pointer
+                                       open_els.splice i, 1
+                                       return
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'template'
+                       ins_mode_in_head t
+                       return
+               if t.type is TYPE_END_TAG and (t.name is 'body' or t.name is 'html' or t.name is 'br')
+                       ins_mode_after_head_else t
+                       return
+               if (t.type is TYPE_START_TAG and t.name is 'head') or t.type is TYPE_END_TAG
+                       parse_error()
+                       return
+               # Anything else
+               ins_mode_after_head_else t
+               return
+
+       # 8.2.5.4.7 http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody
+       in_body_any_other_end_tag = (name) -> # factored out because adoption agency calls it
+               node = open_els[0]
+               loop
+                       if node.name is name and node.namespace is NS_HTML
+                               generate_implied_end_tags name # arg is exception
+                               unless node is open_els[0]
+                                       parse_error()
+                               loop
+                                       el = open_els.shift()
+                                       if el is node
+                                               return
+                       if special_elements[node.name] is node.namespace
+                               parse_error()
+                               return
+                       for el, i in open_els
+                               if node is el
+                                       node = open_els[i + 1]
+                                       break
+               return
+       ins_mode_in_body = (t) ->
+               if t.type is TYPE_TEXT and t.text is "\u0000"
+                       parse_error()
+                       return
+               if is_space_tok t
+                       reconstruct_afe()
+                       insert_character t
+                       return
+               if t.type is TYPE_TEXT
+                       reconstruct_afe()
+                       insert_character t
+                       flag_frameset_ok = false
+                       return
+               if t.type is TYPE_COMMENT
+                       insert_comment t
+                       return
+               if t.type is TYPE_DOCTYPE
+                       parse_error()
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'html'
+                       parse_error()
+                       return if template_tag_is_open()
+                       root_attrs = open_els[open_els.length - 1].attrs
+                       for a in t.attrs_a
+                               root_attrs[a[0]] = a[1] unless root_attrs[a[0]]?
+                       return
+
+               if (t.type is TYPE_START_TAG and (t.name is 'base' or t.name is 'basefont' or t.name is 'bgsound' or t.name is 'link' or t.name is 'meta' or t.name is 'noframes' or t.name is 'script' or t.name is 'style' or t.name is 'template' or t.name is 'title')) or (t.type is TYPE_END_TAG and t.name is 'template')
+                       ins_mode_in_head t
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'body'
+                       parse_error()
+                       return if open_els.length < 2
+                       second = open_els[open_els.length - 2]
+                       return unless second.namespace is NS_HTML
+                       return unless second.name is 'body'
+                       return if template_tag_is_open()
+                       flag_frameset_ok = false
+                       for a in t.attrs_a
+                               second.attrs[a[0]] = a[1] unless second.attrs[a[0]]?
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'frameset'
+                       parse_error()
+                       return if open_els.length < 2
+                       second_i = open_els.length - 2
+                       second = open_els[second_i]
+                       return unless second.namespace is NS_HTML
+                       return unless second.name is 'body'
+                       if flag_frameset_ok is false
+                               return
+                       if second.parent?
+                               for el, i in second.parent.children
+                                       if el is second
+                                               second.parent.children.splice i, 1
+                                               break
+                       open_els.splice second_i, 1
+                       # pop everything except the "root html element"
+                       while open_els.length > 1
+                               open_els.shift()
+                       insert_html_element t
+                       ins_mode = ins_mode_in_frameset
+                       return
+               if t.type is TYPE_EOF
+                       ok_tags = {
+                               dd:NS_HTML, dt:NS_HTML, li:NS_HTML, p:NS_HTML, tbody:NS_HTML,
+                               td:NS_HTML, tfoot:NS_HTML, th:NS_HTML, thead:NS_HTML,
+                               tr:NS_HTML, body:NS_HTML, html:NS_HTML,
+                       }
+                       for el in open_els
+                               unless ok_tags[t.name] is el.namespace
+                                       parse_error()
+                                       break
+                       if template_ins_modes.length > 0
+                               ins_mode_in_template t
+                       else
+                               stop_parsing()
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'body'
+                       unless is_in_scope 'body', NS_HTML
+                               parse_error()
+                               return
+                       ok_tags = {
+                               dd:NS_HTML, dt:NS_HTML, li:NS_HTML, optgroup:NS_HTML,
+                               option:NS_HTML, p:NS_HTML, rb:NS_HTML, rp:NS_HTML, rt:NS_HTML,
+                               rtc:NS_HTML, tbody:NS_HTML, td:NS_HTML, tfoot:NS_HTML,
+                               th:NS_HTML, thead:NS_HTML, tr:NS_HTML, body:NS_HTML,
+                               html:NS_HTML
+                       }
+                       for el in open_els
+                               unless ok_tags[t.name] is el.namespace
+                                       parse_error()
+                                       break
+                       ins_mode = ins_mode_after_body
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'html'
+                       unless is_in_scope 'body', NS_HTML
+                               parse_error()
+                               return
+                       ok_tags = {
+                               dd:NS_HTML, dt:NS_HTML, li:NS_HTML, optgroup:NS_HTML,
+                               option:NS_HTML, p:NS_HTML, rb:NS_HTML, rp:NS_HTML, rt:NS_HTML,
+                               rtc:NS_HTML, tbody:NS_HTML, td:NS_HTML, tfoot:NS_HTML,
+                               th:NS_HTML, thead:NS_HTML, tr:NS_HTML, body:NS_HTML,
+                               html:NS_HTML
+                       }
+                       for el in open_els
+                               unless ok_tags[t.name] is el.namespace
+                                       parse_error()
+                                       break
+                       ins_mode = ins_mode_after_body
+                       process_token t
+                       return
+               if t.type is TYPE_START_TAG and (t.name is 'address' or t.name is 'article' or t.name is 'aside' or t.name is 'blockquote' or t.name is 'center' or t.name is 'details' or t.name is 'dialog' or t.name is 'dir' or t.name is 'div' or t.name is 'dl' or t.name is 'fieldset' or t.name is 'figcaption' or t.name is 'figure' or t.name is 'footer' or t.name is 'header' or t.name is 'hgroup' or t.name is 'main' or t.name is 'nav' or t.name is 'ol' or t.name is 'p' or t.name is 'section' or t.name is 'summary' or t.name is 'ul')
+                       close_p_if_in_button_scope()
+                       insert_html_element t
+                       return
+               if t.type is TYPE_START_TAG and h_tags[t.name]?
+                       close_p_if_in_button_scope()
+                       if h_tags[open_els[0].name] is open_els[0].namespace
+                               parse_error()
+                               open_els.shift()
+                       insert_html_element t
+                       return
+               if t.type is TYPE_START_TAG and (t.name is 'pre' or t.name is 'listing')
+                       close_p_if_in_button_scope()
+                       insert_html_element t
+                       eat_next_token_if_newline()
+                       flag_frameset_ok = false
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'form'
+                       unless form_element_pointer is null or template_tag_is_open()
+                               parse_error()
+                               return
+                       close_p_if_in_button_scope()
+                       el = insert_html_element t
+                       unless template_tag_is_open()
+                               form_element_pointer = el
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'li'
+                       flag_frameset_ok = false
+                       for node in open_els
+                               if node.name is 'li' and node.namespace is NS_HTML
+                                       generate_implied_end_tags 'li' # arg is exception
+                                       if open_els[0].name isnt 'li' or open_els[0].namespace isnt NS_HTML
+                                               parse_error()
+                                       loop
+                                               el = open_els.shift()
+                                               if el.name is 'li' and el.namespace is NS_HTML
+                                                       break
+                                       break
+                               if el_is_special_not_adp node
+                                               break
+                       close_p_if_in_button_scope()
+                       insert_html_element t
+                       return
+               if t.type is TYPE_START_TAG and (t.name is 'dd' or t.name is 'dt')
+                       flag_frameset_ok = false
+                       for node in open_els
+                               if node.name is 'dd' and node.namespace is NS_HTML
+                                       generate_implied_end_tags 'dd' # arg is exception
+                                       if open_els[0].name isnt 'dd' or open_els[0].namespace isnt NS_HTML
+                                               parse_error()
+                                       loop
+                                               el = open_els.shift()
+                                               if el.name is 'dd' and el.namespace is NS_HTML
+                                                       break
+                                       break
+                               if node.name is 'dt' and node.namespace is NS_HTML
+                                       generate_implied_end_tags 'dt' # arg is exception
+                                       if open_els[0].name isnt 'dt' or open_els[0].namespace isnt NS_HTML
+                                               parse_error()
+                                       loop
+                                               el = open_els.shift()
+                                               if el.name is 'dt' and el.namespace is NS_HTML
+                                                       break
+                                       break
+                               if el_is_special_not_adp node
+                                       break
+                       close_p_if_in_button_scope()
+                       insert_html_element t
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'plaintext'
+                       close_p_if_in_button_scope()
+                       insert_html_element t
+                       tok_state = tok_state_plaintext
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'button'
+                       if is_in_scope 'button', NS_HTML
+                               parse_error()
+                               generate_implied_end_tags()
+                               loop
+                                       el = open_els.shift()
+                                       if el.name is 'button' and el.namespace is NS_HTML
+                                               break
+                       reconstruct_afe()
+                       insert_html_element t
+                       flag_frameset_ok = false
+                       return
+               if t.type is TYPE_END_TAG and (t.name is 'address' or t.name is 'article' or t.name is 'aside' or t.name is 'blockquote' or t.name is 'button' or t.name is 'center' or t.name is 'details' or t.name is 'dialog' or t.name is 'dir' or t.name is 'div' or t.name is 'dl' or t.name is 'fieldset' or t.name is 'figcaption' or t.name is 'figure' or t.name is 'footer' or t.name is 'header' or t.name is 'hgroup' or t.name is 'listing' or t.name is 'main' or t.name is 'nav' or t.name is 'ol' or t.name is 'pre' or t.name is 'section' or t.name is 'summary' or t.name is 'ul')
+                       unless is_in_scope t.name, NS_HTML
+                               parse_error()
+                               return
+                       generate_implied_end_tags()
+                       unless open_els[0].name is t.name and open_els[0].namespace is NS_HTML
+                               parse_error()
+                       loop
+                               el = open_els.shift()
+                               if el.name is t.name and el.namespace is NS_HTML
+                                       return
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'form'
+                       unless template_tag_is_open()
+                               node = form_element_pointer
+                               form_element_pointer = null
+                               if node is null or not el_is_in_scope node
+                                       parse_error()
+                                       return
+                               generate_implied_end_tags()
+                               if open_els[0] isnt node
+                                       parse_error()
+                               for el, i in open_els
+                                       if el is node
+                                               open_els.splice i, 1
+                                               break
+                       else
+                               unless is_in_scope 'form', NS_HTML
+                                       parse_error()
+                                       return
+                               generate_implied_end_tags()
+                               if open_els[0].name isnt 'form' or open_els[0].namespace isnt NS_HTML
+                                       parse_error()
+                               loop
+                                       el = open_els.shift()
+                                       if el.name is 'form' and el.namespace is NS_HTML
+                                               break
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'p'
+                       unless is_in_button_scope 'p', NS_HTML
+                               parse_error()
+                               insert_html_element new_open_tag 'p'
+                       close_p_element()
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'li'
+                       unless is_in_li_scope 'li', NS_HTML
+                               parse_error()
+                               return
+                       generate_implied_end_tags 'li' # arg is exception
+                       if open_els[0].name isnt 'li' or open_els[0].namespace isnt NS_HTML
+                               parse_error()
+                       loop
+                               el = open_els.shift()
+                               if el.name is 'li' and el.namespace is NS_HTML
+                                       break
+                       return
+               if t.type is TYPE_END_TAG and (t.name is 'dd' or t.name is 'dt')
+                       unless is_in_scope t.name, NS_HTML
+                               parse_error()
+                               return
+                       generate_implied_end_tags t.name # arg is exception
+                       if open_els[0].name isnt t.name or open_els[0].namespace isnt NS_HTML
+                               parse_error()
+                       loop
+                               el = open_els.shift()
+                               if el.name is t.name and el.namespace is NS_HTML
+                                       break
+                       return
+               if t.type is TYPE_END_TAG and h_tags[t.name]?
+                       h_in_scope = false
+                       for el in open_els
+                               if h_tags[el.name] is el.namespace
+                                       h_in_scope = true
+                                       break
+                               if standard_scopers[el.name] is el.namespace
+                                       break
+                       unless h_in_scope
+                               parse_error()
+                               return
+                       generate_implied_end_tags()
+                       if open_els[0].name isnt t.name or open_els[0].namespace isnt NS_HTML
+                               parse_error()
+                       loop
+                               el = open_els.shift()
+                               if h_tags[el.name] is el.namespace
+                                       break
+                       return
+               # deep breath!
+               if t.type is TYPE_START_TAG and t.name is 'a'
+                       # If the list of active formatting elements contains an a element
+                       # between the end of the list and the last marker on the list (or
+                       # the start of the list if there is no marker on the list), then
+                       # this is a parse error; run the adoption agency algorithm for the
+                       # tag name "a", then remove that element from the list of active
+                       # formatting elements and the stack of open elements if the
+                       # adoption agency algorithm didn't already remove it (it might not
+                       # have if the element is not in table scope).
+                       found = false
+                       for el in afe
+                               if el.type is TYPE_AFE_MARKER
+                                       break
+                               if el.name is 'a' and el.namespace is NS_HTML
+                                       found = el
+                       if found?
+                               parse_error()
+                               adoption_agency 'a'
+                               for el, i in afe
+                                       if el is found
+                                               afe.splice i, 1
+                               for el, i in open_els
+                                       if el is found
+                                               open_els.splice i, 1
+                       reconstruct_afe()
+                       el = insert_html_element t
+                       afe_push el
+                       return
+               if t.type is TYPE_START_TAG and (t.name is 'b' or t.name is 'big' or t.name is 'code' or t.name is 'em' or t.name is 'font' or t.name is 'i' or t.name is 's' or t.name is 'small' or t.name is 'strike' or t.name is 'strong' or t.name is 'tt' or t.name is 'u')
+                       reconstruct_afe()
+                       el = insert_html_element t
+                       afe_push el
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'nobr'
+                       reconstruct_afe()
+                       if is_in_scope 'nobr', NS_HTML
+                               parse_error()
+                               adoption_agency 'nobr'
+                               reconstruct_afe()
+                       el = insert_html_element t
+                       afe_push el
+                       return
+               if t.type is TYPE_END_TAG and (t.name is 'a' or t.name is 'b' or t.name is 'big' or t.name is 'code' or t.name is 'em' or t.name is 'font' or t.name is 'i' or t.name is 'nobr' or t.name is 's' or t.name is 'small' or t.name is 'strike' or t.name is 'strong' or t.name is 'tt' or t.name is 'u')
+                       adoption_agency t.name
+                       return
+               if t.type is TYPE_START_TAG and (t.name is 'applet' or t.name is 'marquee' or t.name is 'object')
+                       reconstruct_afe()
+                       insert_html_element t
+                       afe_push_marker()
+                       flag_frameset_ok = false
+                       return
+               if t.type is TYPE_END_TAG and (t.name is 'applet' or t.name is 'marquee' or t.name is 'object')
+                       unless is_in_scope t.name, NS_HTML
+                               parse_error()
+                               return
+                       generate_implied_end_tags()
+                       if open_els[0].name isnt t.name or open_els[0].namespace isnt NS_HTML
+                               parse_error()
+                       loop
+                               el = open_els.shift()
+                               if el.name is t.name and el.namespace is NS_HTML
+                                       break
+                       clear_afe_to_marker()
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'table'
+                       unless doc.flag('quirks mode') is QUIRKS_YES
+                               close_p_if_in_button_scope() # test
+                       insert_html_element t
+                       flag_frameset_ok = false
+                       ins_mode = ins_mode_in_table
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'br'
+                       parse_error()
+                       # W3C: t.type = TYPE_START_TAG
+                       t = new_open_tag 'br' # WHATWG
+                       # fall through
+               if t.type is TYPE_START_TAG and (t.name is 'area' or t.name is 'br' or t.name is 'embed' or t.name is 'img' or t.name is 'keygen' or t.name is 'wbr')
+                       reconstruct_afe()
+                       insert_html_element t
+                       open_els.shift()
+                       t.acknowledge_self_closing()
+                       flag_frameset_ok = false
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'input'
+                       reconstruct_afe()
+                       insert_html_element t
+                       open_els.shift()
+                       t.acknowledge_self_closing()
+                       unless is_input_hidden_tok t
+                               flag_frameset_ok = false
+                       return
+               if t.type is TYPE_START_TAG and (t.name is 'menuitem' or t.name is 'param' or t.name is 'source' or t.name is 'track')
+                       # WHATWG adds 'menuitem' for this block
+                       insert_html_element t
+                       open_els.shift()
+                       t.acknowledge_self_closing()
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'hr'
+                       close_p_if_in_button_scope()
+                       insert_html_element t
+                       open_els.shift()
+                       t.acknowledge_self_closing()
+                       flag_frameset_ok = false
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'image'
+                       parse_error()
+                       t.name = 'img'
+                       process_token t
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'isindex'
+                       parse_error()
+                       if template_tag_is_open() is false and form_element_pointer isnt null
+                               return
+                       t.acknowledge_self_closing()
+                       flag_frameset_ok = false
+                       close_p_if_in_button_scope()
+                       el = insert_html_element new_open_tag 'form'
+                       unless template_tag_is_open()
+                               form_element_pointer = el
+                       for a in t.attrs_a
+                               if a[0] is 'action'
+                                       el.attrs['action'] = a[1]
+                                       break
+                       insert_html_element new_open_tag 'hr'
+                       open_els.shift()
+                       reconstruct_afe()
+                       insert_html_element new_open_tag 'label'
+                       # note: this is a little out-of-spec-order so we only have to scan t.attrs_a once
+                       input_el = new_open_tag 'input'
+                       prompt = null
+                       for a in t.attrs_a
+                               if a[0] is 'prompt'
+                                       prompt = a[1]
+                               if a[0] isnt 'name' and a[0] isnt 'action' and a[0] isnt 'prompt'
+                                       input_el.attrs_a.push [a[0], a[1]]
+                       input_el.attrs_a.push ['name', 'isindex']
+                       # fixfull this next bit is in english... internationalize?
+                       prompt ?= "This is a searchable index. Enter search keywords: "
+                       insert_character new_character_token prompt # fixfull split
+                       # TODO submit typo "balue" in spec
+                       insert_html_element input_el
+                       open_els.shift()
+                       # insert_character '' # you can put chars here if promt attr missing
+                       open_els.shift()
+                       insert_html_element new_open_tag 'hr'
+                       open_els.shift()
+                       open_els.shift()
+                       unless template_tag_is_open()
+                               form_element_pointer = null
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'textarea'
+                       insert_html_element t
+                       eat_next_token_if_newline()
+                       tok_state = tok_state_rcdata
+                       original_ins_mode = ins_mode
+                       flag_frameset_ok = false
+                       ins_mode = ins_mode_text
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'xmp'
+                       close_p_if_in_button_scope()
+                       reconstruct_afe()
+                       flag_frameset_ok = false
+                       parse_generic_raw_text t
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'iframe'
+                       flag_frameset_ok = false
+                       parse_generic_raw_text t
+                       return
+               if t.type is TYPE_START_TAG and (t.name is 'noembed' or (t.name is 'noscript' and flag_scripting))
+                       parse_generic_raw_text t
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'select'
+                       reconstruct_afe()
+                       insert_html_element t
+                       flag_frameset_ok = false
+                       if ins_mode is ins_mode_in_table or ins_mode is ins_mode_in_caption or ins_mode is ins_mode_in_table_body or ins_mode is ins_mode_in_row or ins_mode is ins_mode_in_cell
+                               ins_mode = ins_mode_in_select_in_table
+                       else
+                               ins_mode = ins_mode_in_select
+                       return
+               if t.type is TYPE_START_TAG and (t.name is 'optgroup' or t.name is 'option')
+                       if open_els[0].name is 'option' and open_els[0].namespace is NS_HTML
+                               open_els.shift()
+                       reconstruct_afe()
+                       insert_html_element t
+                       return
+# this comment block implements the W3C spec
+#              if t.type is TYPE_START_TAG and (t.name is 'rb' or t.name is 'rp' or t.name is 'rtc')
+#                      if is_in_scope 'ruby', NS_HTML
+#                              generate_implied_end_tags()
+#                              unless open_els[0].name is 'ruby' and open_els[0].namespace is NS_HTML
+#                                      parse_error()
+#                      insert_html_element t
+#                      return
+#              if t.type is TYPE_START_TAG and t.name is 'rt'
+#                      if is_in_scope 'ruby', NS_HTML
+#                              generate_implied_end_tags 'rtc' # arg is exception
+#                              unless (open_els[0].name is 'ruby' or open_els[0].name is 'rtc') and open_els[0].namespace is NS_HTML
+#                                      parse_error()
+#                      insert_html_element t
+#                      return
+# below implements the WHATWG spec https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
+               if t.type is TYPE_START_TAG and (t.name is 'rb' or t.name is 'rtc')
+                       if is_in_scope 'ruby', NS_HTML
+                               generate_implied_end_tags()
+                               unless open_els[0].name is 'ruby' and open_els[0].namespace is NS_HTML
+                                       parse_error()
+                       insert_html_element t
+                       return
+               if t.type is TYPE_START_TAG and (t.name is 'rp' or t.name is 'rt')
+                       if is_in_scope 'ruby', NS_HTML
+                               generate_implied_end_tags 'rtc'
+                               unless (open_els[0].name is 'ruby' or open_els[0].name is 'rtc') and open_els[0].namespace is NS_HTML
+                                       parse_error()
+                       insert_html_element t
+                       return
+# end WHATWG chunk
+               if t.type is TYPE_START_TAG and t.name is 'math'
+                       reconstruct_afe()
+                       adjust_mathml_attributes t
+                       adjust_foreign_attributes t
+                       insert_foreign_element t, NS_MATHML
+                       if t.flag 'self-closing'
+                               open_els.shift()
+                               t.acknowledge_self_closing()
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'svg'
+                       reconstruct_afe()
+                       adjust_svg_attributes t
+                       adjust_foreign_attributes t
+                       insert_foreign_element t, NS_SVG
+                       if t.flag 'self-closing'
+                               open_els.shift()
+                               t.acknowledge_self_closing()
+                       return
+               if t.type is TYPE_START_TAG and (t.name is 'caption' or t.name is 'col' or t.name is 'colgroup' or t.name is 'frame' or t.name is 'head' or t.name is 'tbody' or t.name is 'td' or t.name is 'tfoot' or t.name is 'th' or t.name is 'thead' or t.name is 'tr')
+                       parse_error()
+                       return
+               if t.type is TYPE_START_TAG # any other start tag
+                       reconstruct_afe()
+                       insert_html_element t
+                       return
+               if t.type is TYPE_END_TAG # any other end tag
+                       in_body_any_other_end_tag t.name
+                       return
+               return
+
+       # 8.2.5.4.8 http://www.w3.org/TR/html5/syntax.html#parsing-main-incdata
+       ins_mode_text = (t) ->
+               if t.type is TYPE_TEXT
+                       insert_character t
+                       return
+               if t.type is TYPE_EOF
+                       parse_error()
+                       if open_els[0].name is 'script' and open_els[0].namespace is NS_HTML
+                               open_els[0].flag 'already started', true
+                       open_els.shift()
+                       ins_mode = original_ins_mode
+                       process_token t
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'script'
+                       open_els.shift()
+                       ins_mode = original_ins_mode
+                       # fixfull the spec seems to assume that I'm going to run the script
+                       # http://www.w3.org/TR/html5/syntax.html#scriptEndTag
+                       return
+               if t.type is TYPE_END_TAG
+                       open_els.shift()
+                       ins_mode = original_ins_mode
+                       return
+               return
+
+       # the functions below implement the tokenizer stats described here:
+       # http://www.w3.org/TR/html5/syntax.html#tokenization
+
+       # 8.2.5.4.9 http://www.w3.org/TR/html5/syntax.html#parsing-main-intable
+       ins_mode_in_table_else = (t) ->
+               parse_error()
+               flag_foster_parenting = true
+               ins_mode_in_body t
+               flag_foster_parenting = false
+               return
+       ins_mode_in_table = (t) ->
+               switch t.type
+                       when TYPE_TEXT
+                               if (open_els[0].name is 'table' or open_els[0].name is 'tbody' or open_els[0].name is 'tfoot' or open_els[0].name is 'thead' or open_els[0].name is 'tr') and open_els[0].namespace is NS_HTML
+                                       pending_table_character_tokens = []
+                                       original_ins_mode = ins_mode
+                                       ins_mode = ins_mode_in_table_text
+                                       process_token t
+                               else
+                                       ins_mode_in_table_else t
+                       when TYPE_COMMENT
+                               insert_comment t
+                       when TYPE_DOCTYPE
+                               parse_error()
+                       when TYPE_START_TAG
+                               switch t.name
+                                       when 'caption'
+                                               clear_stack_to_table_context()
+                                               afe_push_marker()
+                                               insert_html_element t
+                                               ins_mode = ins_mode_in_caption
+                                       when 'colgroup'
+                                               clear_stack_to_table_context()
+                                               insert_html_element t
+                                               ins_mode = ins_mode_in_column_group
+                                       when 'col'
+                                               clear_stack_to_table_context()
+                                               insert_html_element new_open_tag 'colgroup'
+                                               ins_mode = ins_mode_in_column_group
+                                               process_token t
+                                       when 'tbody', 'tfoot', 'thead'
+                                               clear_stack_to_table_context()
+                                               insert_html_element t
+                                               ins_mode = ins_mode_in_table_body
+                                       when 'td', 'th', 'tr'
+                                               clear_stack_to_table_context()
+                                               insert_html_element new_open_tag 'tbody'
+                                               ins_mode = ins_mode_in_table_body
+                                               process_token t
+                                       when 'table'
+                                               parse_error()
+                                               if is_in_table_scope 'table', NS_HTML
+                                                       loop
+                                                               el = open_els.shift()
+                                                               if el.name is 'table' and el.namespace is NS_HTML
+                                                                       break
+                                                       reset_ins_mode()
+                                                       process_token t
+                                       when 'style', 'script', 'template'
+                                               ins_mode_in_head t
+                                       when 'input'
+                                               unless is_input_hidden_tok t
+                                                       ins_mode_in_table_else t
+                                               else
+                                                       parse_error()
+                                                       el = insert_html_element t
+                                                       open_els.shift()
+                                                       t.acknowledge_self_closing()
+                                       when 'form'
+                                               parse_error()
+                                               if form_element_pointer?
+                                                       return
+                                               if template_tag_is_open()
+                                                       return
+                                               form_element_pointer = insert_html_element t
+                                               open_els.shift()
+                                       else
+                                               ins_mode_in_table_else t
+                       when TYPE_END_TAG
+                               switch t.name
+                                       when 'table'
+                                               if is_in_table_scope 'table', NS_HTML
+                                                       loop
+                                                               el = open_els.shift()
+                                                               if el.name is 'table' and el.namespace is NS_HTML
+                                                                       break
+                                                       reset_ins_mode()
+                                               else
+                                                       parse_error()
+                                       when 'body', 'caption', 'col', 'colgroup', 'html', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr'
+                                               parse_error()
+                                       when 'template'
+                                               ins_mode_in_head t
+                                       else
+                                               ins_mode_in_table_else t
+                       when TYPE_EOF
+                               ins_mode_in_body t
+                       else
+                               ins_mode_in_table_else t
+               return
+
+
+       # 8.2.5.4.10 http://www.w3.org/TR/html5/syntax.html#parsing-main-intabletext
+       ins_mode_in_table_text = (t) ->
+               if t.type is TYPE_TEXT and t.text is "\u0000"
+                       # from javascript?
+                       parse_error()
+                       return
+               if t.type is TYPE_TEXT
+                       pending_table_character_tokens.push t
+                       return
+               # Anything else
+               all_space = true
+               for old in pending_table_character_tokens
+                       unless is_space_tok old
+                               all_space = false
+                               break
+               if all_space
+                       for old in pending_table_character_tokens
+                               insert_character old
+               else
+                       for old in pending_table_character_tokens
+                               ins_mode_in_table_else old
+               pending_table_character_tokens = []
+               ins_mode = original_ins_mode
+               process_token t
+               return
+
+       # 8.2.5.4.11 http://www.w3.org/TR/html5/syntax.html#parsing-main-incaption
+       ins_mode_in_caption = (t) ->
+               if t.type is TYPE_END_TAG and t.name is 'caption'
+                       if is_in_table_scope 'caption', NS_HTML
+                               generate_implied_end_tags()
+                               if open_els[0].name isnt 'caption'
+                                       parse_error()
+                               loop
+                                       el = open_els.shift()
+                                       if el.name is 'caption' and el.namespace is NS_HTML
+                                               break
+                               clear_afe_to_marker()
+                               ins_mode = ins_mode_in_table
+                       else
+                               parse_error()
+                               # fragment case
+                       return
+               if (t.type is TYPE_START_TAG and (t.name is 'caption' or t.name is 'col' or t.name is 'colgroup' or t.name is 'tbody' or t.name is 'td' or t.name is 'tfoot' or t.name is 'th' or t.name is 'thead' or t.name is 'tr')) or t.type is TYPE_END_TAG and t.name is 'table'
+                       parse_error()
+                       if is_in_table_scope 'caption', NS_HTML
+                               loop
+                                       el = open_els.shift()
+                                       if el.name is 'caption' and el.namespace is NS_HTML
+                                               break
+                               clear_afe_to_marker()
+                               ins_mode = ins_mode_in_table
+                               process_token t
+                       # else fragment case
+                       return
+               if t.type is TYPE_END_TAG and (t.name is 'body' or t.name is 'col' or t.name is 'colgroup' or t.name is 'html' or t.name is 'tbody' or t.name is 'td' or t.name is 'tfoot' or t.name is 'th' or t.name is 'thead' or t.name is 'tr')
+                       parse_error()
+                       return
+               # Anything else
+               ins_mode_in_body t
+               return
+
+       # 8.2.5.4.12 http://www.w3.org/TR/html5/syntax.html#parsing-main-incolgroup
+       ins_mode_in_column_group = (t) ->
+               if is_space_tok t
+                       insert_character t
+                       return
+               if t.type is TYPE_COMMENT
+                       insert_comment t
+                       return
+               if t.type is TYPE_DOCTYPE
+                       parse_error()
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'html'
+                       ins_mode_in_body t
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'col'
+                       el = insert_html_element t
+                       open_els.shift()
+                       t.acknowledge_self_closing()
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'colgroup'
+                       if open_els[0].name is 'colgroup' and open_els.namespace is NS_HTML
+                               open_els.shift()
+                               ins_mode = ins_mode_in_table
+                       else
+                               parse_error()
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'col'
+                       parse_error()
+                       return
+               if (t.type is TYPE_START_TAG or t.type is TYPE_END_TAG) and t.name is 'template'
+                       ins_mode_in_head t
+                       return
+               if t.type is TYPE_EOF
+                       ins_mode_in_body t
+                       return
+               # Anything else
+               if open_els[0].name isnt 'colgroup'
+                       parse_error()
+                       return
+               open_els.shift()
+               ins_mode = ins_mode_in_table
+               process_token t
+               return
+
+       # 8.2.5.4.13 http://www.w3.org/TR/html5/syntax.html#parsing-main-intbody
+       ins_mode_in_table_body = (t) ->
+               if t.type is TYPE_START_TAG and t.name is 'tr'
+                       clear_stack_to_table_body_context()
+                       insert_html_element t
+                       ins_mode = ins_mode_in_row
+                       return
+               if t.type is TYPE_START_TAG and (t.name is 'th' or t.name is 'td')
+                       parse_error()
+                       clear_stack_to_table_body_context()
+                       insert_html_element new_open_tag 'tr'
+                       ins_mode = ins_mode_in_row
+                       process_token t
+                       return
+               if t.type is TYPE_END_TAG and (t.name is 'tbody' or t.name is 'tfoot' or t.name is 'thead')
+                       unless is_in_table_scope t.name, NS_HTML
+                               parse_error()
+                               return
+                       clear_stack_to_table_body_context()
+                       open_els.shift()
+                       ins_mode = ins_mode_in_table
+                       return
+               if (t.type is TYPE_START_TAG and (t.name is 'caption' or t.name is 'col' or t.name is 'colgroup' or t.name is 'tbody' or t.name is 'tfoot' or t.name is 'thead')) or (t.type is TYPE_END_TAG and t.name is 'table')
+                       has = false
+                       for el in open_els
+                               if el.namespace is NS_HTML and (el.name is 'tbody' or el.name is 'tfoot' or el.name is 'thead')
+                                       has = true
+                                       break
+                               if table_scopers[el.name] is el.namespace
+                                       break
+                       if !has
+                               parse_error()
+                               return
+                       clear_stack_to_table_body_context()
+                       open_els.shift()
+                       ins_mode = ins_mode_in_table
+                       process_token t
+                       return
+               if t.type is TYPE_END_TAG and (t.name is 'body' or t.name is 'caption' or t.name is 'col' or t.name is 'colgroup' or t.name is 'html' or t.name is 'td' or t.name is 'th' or t.name is 'tr')
+                       parse_error()
+                       return
+               # Anything else
+               ins_mode_in_table t
+               return
+
+       # 8.2.5.4.14 http://www.w3.org/TR/html5/syntax.html#parsing-main-intr
+       ins_mode_in_row = (t) ->
+               if t.type is TYPE_START_TAG and (t.name is 'th' or t.name is 'td')
+                       clear_stack_to_table_row_context()
+                       insert_html_element t
+                       ins_mode = ins_mode_in_cell
+                       afe_push_marker()
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'tr'
+                       if is_in_table_scope 'tr', NS_HTML
+                               clear_stack_to_table_row_context()
+                               open_els.shift()
+                               ins_mode = ins_mode_in_table_body
+                       else
+                               parse_error()
+                       return
+               if (t.type is TYPE_START_TAG and (t.name is 'caption' or t.name is 'col' or t.name is 'colgroup' or t.name is 'tbody' or t.name is 'tfoot' or t.name is 'thead' or t.name is 'tr')) or t.type is TYPE_END_TAG and t.name is 'table'
+                       if is_in_table_scope 'tr', NS_HTML
+                               clear_stack_to_table_row_context()
+                               open_els.shift()
+                               ins_mode = ins_mode_in_table_body
+                               process_token t
+                       else
+                               parse_error()
+                       return
+               if t.type is TYPE_END_TAG and (t.name is 'tbody' or t.name is 'tfoot' or t.name is 'thead')
+                       if is_in_table_scope t.name, NS_HTML
+                               if is_in_table_scope 'tr', NS_HTML
+                                       clear_stack_to_table_row_context()
+                                       open_els.shift()
+                                       ins_mode = ins_mode_in_table_body
+                                       process_token t
+                       else
+                               parse_error()
+                       return
+               if t.type is TYPE_END_TAG and (t.name is 'body' or t.name is 'caption' or t.name is 'col' or t.name is 'colgroup' or t.name is 'html' or t.name is 'td' or t.name is 'th')
+                       parse_error()
+                       return
+               # Anything else
+               ins_mode_in_table t
+               return
+
+       # http://www.w3.org/TR/html5/syntax.html#close-the-cell
+       close_the_cell = ->
+               generate_implied_end_tags()
+               unless (open_els[0].name is 'td' or open_els[0] is 'th') and open_els[0].namespace is NS_HTML
+                       parse_error()
+               loop
+                       el = open_els.shift()
+                       if el.namespace is NS_HTML and (el.name is 'td' or el.name is 'th')
+                               break
+               clear_afe_to_marker()
+               ins_mode = ins_mode_in_row
+               return
+
+       # 8.2.5.4.15 http://www.w3.org/TR/html5/syntax.html#parsing-main-intd
+       ins_mode_in_cell = (t) ->
+               if t.type is TYPE_END_TAG and (t.name is 'td' or t.name is 'th')
+                       if is_in_table_scope t.name, NS_HTML
+                               generate_implied_end_tags()
+                               unless (open_els[0].name is t.name) and open_els[0].namespace is NS_HTML
+                                       parse_error()
+                               loop
+                                       el = open_els.shift()
+                                       if el.name is t.name and el.namespace is NS_HTML
+                                               break
+                               clear_afe_to_marker()
+                               ins_mode = ins_mode_in_row
+                       else
+                               parse_error()
+                       return
+               if t.type is TYPE_START_TAG and (t.name is 'caption' or t.name is 'col' or t.name is 'colgroup' or t.name is 'tbody' or t.name is 'td' or t.name is 'tfoot' or t.name is 'th' or t.name is 'thead' or t.name is 'tr')
+                       has = false
+                       for el in open_els
+                               if el.namespace is NS_HTML and (el.name is 'td' or el.name is 'th')
+                                       has = true
+                                       break
+                               if table_scopers[el.name] is el.namespace
+                                       break
+                       if !has
+                               parse_error()
+                               return
+                       close_the_cell()
+                       process_token t
+                       return
+               if t.type is TYPE_END_TAG and (t.name is 'body' or t.name is 'caption' or t.name is 'col' or t.name is 'colgroup' or t.name is 'html')
+                       parse_error()
+                       return
+               if t.type is TYPE_END_TAG and (t.name is 'table' or t.name is 'tbody' or t.name is 'tfoot' or t.name is 'thead' or t.name is 'tr')
+                       if is_in_table_scope t.name, NS_HTML
+                               close_the_cell()
+                               process_token t
+                       else
+                               parse_error()
+                       return
+               # Anything Else
+               ins_mode_in_body t
+               return
+
+       # 8.2.5.4.16 http://www.w3.org/TR/html5/syntax.html#parsing-main-inselect
+       ins_mode_in_select = (t) ->
+               if t.type is TYPE_TEXT and t.text is "\u0000"
+                       parse_error()
+                       return
+               if t.type is TYPE_TEXT
+                       insert_character t
+                       return
+               if t.type is TYPE_COMMENT
+                       insert_comment t
+                       return
+               if t.type is TYPE_DOCTYPE
+                       parse_error()
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'html'
+                       ins_mode_in_body t
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'option'
+                       if open_els[0].name is 'option' and open_els[0].namespace is NS_HTML
+                               open_els.shift()
+                       insert_html_element t
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'optgroup'
+                       if open_els[0].name is 'option' and open_els[0].namespace is NS_HTML
+                               open_els.shift()
+                       if open_els[0].name is 'optgroup' and open_els[0].namespace is NS_HTML
+                               open_els.shift()
+                       insert_html_element t
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'optgroup'
+                       if open_els[0].name is 'option' and open_els[0].namespace is NS_HTML
+                               if open_els[1].name is 'optgroup' and open_els[0].namespace is NS_HTML
+                                       open_els.shift()
+                       if open_els[0].name is 'optgroup' and open_els[0].namespace is NS_HTML
+                               open_els.shift()
+                       else
+                               parse_error()
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'option'
+                       if open_els[0].name is 'option' and open_els[0].namespace is NS_HTML
+                               open_els.shift()
+                       else
+                               parse_error()
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'select'
+                       if is_in_select_scope 'select', NS_HTML
+                               loop
+                                       el = open_els.shift()
+                                       if el.name is 'select' and el.namespace is NS_HTML
+                                               break
+                               reset_ins_mode()
+                       else
+                               parse_error()
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'select'
+                       parse_error()
+                       loop
+                               el = open_els.shift()
+                               if el.name is 'select' and el.namespace is NS_HTML
+                                       break
+                       reset_ins_mode()
+                       # spec says that this is the same as </select> but it doesn't say
+                       # to check scope first
+                       return
+               if t.type is TYPE_START_TAG and (t.name is 'input' or t.name is 'keygen' or t.name is 'textarea')
+                       parse_error()
+                       unless is_in_select_scope 'select', NS_HTML
+                               return
+                       loop
+                               el = open_els.shift()
+                               if el.name is 'select' and el.namespace is NS_HTML
+                                       break
+                       reset_ins_mode()
+                       process_token t
+                       return
+               if t.type is TYPE_START_TAG and (t.name is 'script' or t.name is 'template')
+                       ins_mode_in_head t
+                       return
+               if t.type is TYPE_EOF
+                       ins_mode_in_body t
+                       return
+               # Anything else
+               parse_error()
+               return
+
+       # 8.2.5.4.17 http://www.w3.org/TR/html5/syntax.html#parsing-main-inselectintable
+       ins_mode_in_select_in_table = (t) ->
+               if t.type is TYPE_START_TAG and (t.name is 'caption' or t.name is 'table' or t.name is 'tbody' or t.name is 'tfoot' or t.name is 'thead' or t.name is 'tr' or t.name is 'td' or t.name is 'th')
+                       parse_error()
+                       loop
+                               el = open_els.shift()
+                               if el.name is 'select' and el.namespace is NS_HTML
+                                       break
+                       reset_ins_mode()
+                       process_token t
+                       return
+               if t.type is TYPE_END_TAG and (t.name is 'caption' or t.name is 'table' or t.name is 'tbody' or t.name is 'tfoot' or t.name is 'thead' or t.name is 'tr' or t.name is 'td' or t.name is 'th')
+                       parse_error()
+                       unless is_in_table_scope t.name, NS_HTML
+                               return
+                       loop
+                               el = open_els.shift()
+                               if el.name is 'select' and el.namespace is NS_HTML
+                                       break
+                       reset_ins_mode()
+                       process_token t
+                       return
+               # Anything else
+               ins_mode_in_select t
+               return
+
+       # 8.2.5.4.18 http://www.w3.org/TR/html5/syntax.html#parsing-main-intemplate
+       ins_mode_in_template = (t) ->
+               if t.type is TYPE_TEXT or t.type is TYPE_COMMENT or t.type is TYPE_DOCTYPE
+                       ins_mode_in_body t
+                       return
+               if (t.type is TYPE_START_TAG and (t.name is 'base' or t.name is 'basefont' or t.name is 'bgsound' or t.name is 'link' or t.name is 'meta' or t.name is 'noframes' or t.name is 'script' or t.name is 'style' or t.name is 'template' or t.name is 'title')) or (t.type is TYPE_END_TAG and t.name is 'template')
+                       ins_mode_in_head t
+                       return
+               if t.type is TYPE_START_TAG and (t.name is 'caption' or t.name is 'colgroup' or t.name is 'tbody' or t.name is 'tfoot' or t.name is 'thead')
+                       template_ins_modes.shift()
+                       template_ins_modes.unshift ins_mode_in_table
+                       ins_mode = ins_mode_in_table
+                       process_token t
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'col'
+                       template_ins_modes.shift()
+                       template_ins_modes.unshift ins_mode_in_column_group
+                       ins_mode = ins_mode_in_column_group
+                       process_token t
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'tr'
+                       template_ins_modes.shift()
+                       template_ins_modes.unshift ins_mode_in_table_body
+                       ins_mode = ins_mode_in_table_body
+                       process_token t
+                       return
+               if t.type is TYPE_START_TAG and (t.name is 'td' or t.name is 'th')
+                       template_ins_modes.shift()
+                       template_ins_modes.unshift ins_mode_in_row
+                       ins_mode = ins_mode_in_row
+                       process_token t
+                       return
+               if t.type is TYPE_START_TAG
+                       template_ins_modes.shift()
+                       template_ins_modes.unshift ins_mode_in_body
+                       ins_mode = ins_mode_in_body
+                       process_token t
+                       return
+               if t.type is TYPE_END_TAG
+                       parse_error()
+                       return
+               if t.type is TYPE_EOF
+                       unless template_tag_is_open()
+                               stop_parsing()
+                               return
+                       parse_error()
+                       loop
+                               el = open_els.shift()
+                               if el.name is 'template' and el.namespace is NS_HTML
+                                       break
+                       clear_afe_to_marker()
+                       template_ins_modes.shift()
+                       reset_ins_mode()
+                       process_token t
+               return
+
+       # 8.2.5.4.19 http://www.w3.org/TR/html5/syntax.html#parsing-main-afterbody
+       ins_mode_after_body = (t) ->
+               if is_space_tok t
+                       ins_mode_in_body t
+                       return
+               if t.type is TYPE_COMMENT
+                       first = open_els[open_els.length - 1]
+                       insert_comment t, [first, first.children.length]
+                       return
+               if t.type is TYPE_DOCTYPE
+                       parse_error()
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'html'
+                       ins_mode_in_body t
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'html'
+                       if flag_fragment_parsing
+                               parse_error()
+                               return
+                       ins_mode = ins_mode_after_after_body
+                       return
+               if t.type is TYPE_EOF
+                       stop_parsing()
+                       return
+               # Anything ELse
+               parse_error()
+               ins_mode = ins_mode_in_body
+               process_token t
+               return
+
+       # 8.2.5.4.20 http://www.w3.org/TR/html5/syntax.html#parsing-main-inframeset
+       ins_mode_in_frameset = (t) ->
+               if is_space_tok t
+                       insert_character t
+                       return
+               if t.type is TYPE_COMMENT
+                       insert_comment t
+                       return
+               if t.type is TYPE_DOCTYPE
+                       parse_error()
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'html'
+                       ins_mode_in_body t
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'frameset'
+                       insert_html_element t
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'frameset'
+                       if open_els.length is 1
+                               parse_error()
+                               return # fragment case
+                       open_els.shift()
+                       if flag_fragment_parsing is false and open_els[0].name isnt 'frameset'
+                               ins_mode = ins_mode_after_frameset
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'frame'
+                       insert_html_element t
+                       open_els.shift()
+                       t.acknowledge_self_closing()
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'noframes'
+                       ins_mode_in_head t
+                       return
+               if t.type is TYPE_EOF
+                       if open_els.length isnt 1
+                               parse_error()
+                       stop_parsing()
+                       return
+               # Anything else
+               parse_error()
+               return
+
+       # 8.2.5.4.21 http://www.w3.org/TR/html5/syntax.html#parsing-main-afterframeset
+       ins_mode_after_frameset = (t) ->
+               if is_space_tok t
+                       insert_character t
+                       return
+               if t.type is TYPE_COMMENT
+                       insert_comment t
+                       return
+               if t.type is TYPE_DOCTYPE
+                       parse_error()
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'html'
+                       ins_mode_in_body t
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'html'
+                       ins_mode = ins_mode_after_after_frameset
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'noframes'
+                       ins_mode_in_head t
+                       return
+               if t.type is TYPE_EOF
+                       stop_parsing()
+                       return
+               # Anything else
+               parse_error()
+               return
+
+       # 8.2.5.4.22 http://www.w3.org/TR/html5/syntax.html#the-after-after-body-insertion-mode
+       ins_mode_after_after_body = (t) ->
+               if t.type is TYPE_COMMENT
+                       insert_comment t, [doc, doc.children.length]
+                       return
+               if t.type is TYPE_DOCTYPE or is_space_tok(t) or (t.type is TYPE_START_TAG and t.name is 'html')
+                       ins_mode_in_body t
+                       return
+               if t.type is TYPE_EOF
+                       stop_parsing()
+                       return
+               # Anything else
+               parse_error()
+               ins_mode = ins_mode_in_body
+               process_token t
+               return
+
+       # 8.2.5.4.23 http://www.w3.org/TR/html5/syntax.html#the-after-after-frameset-insertion-mode
+       ins_mode_after_after_frameset = (t) ->
+               if t.type is TYPE_COMMENT
+                       insert_comment t, [doc, doc.children.length]
+                       return
+               if t.type is TYPE_DOCTYPE or is_space_tok(t) or (t.type is TYPE_START_TAG and t.name is 'html')
+                       ins_mode_in_body t
+                       return
+               if t.type is TYPE_EOF
+                       stop_parsing()
+                       return
+               if t.type is TYPE_START_TAG and t.name is 'noframes'
+                       ins_mode_in_head t
+                       return
+               # Anything else
+               parse_error()
+               return
+
+       # 8.2.5.5 http://www.w3.org/TR/html5/syntax.html#parsing-main-inforeign
+       has_color_face_or_size = (t) ->
+               for a in t.attrs_a
+                       if a[0] is 'color' or a[0] is 'face' or a[0] is 'size'
+                               return true
+               return false
+       in_foreign_content_end_script = ->
+               open_els.shift()
+               # fixfull
+               return
+       in_foreign_content_other_start = (t) ->
+               acn = adjusted_current_node()
+               if acn.namespace is NS_MATHML
+                       adjust_mathml_attributes t
+               if acn.namespace is NS_SVG and svg_name_fixes[t.name]?
+                       t.name = svg_name_fixes[t.name]
+               if acn.namespace is NS_SVG
+                       adjust_svg_attributes t
+               adjust_foreign_attributes t
+               insert_foreign_element t, acn.namespace
+               if t.flag 'self-closing'
+                       if t.name is 'script'
+                               t.acknowledge_self_closing()
+                               in_foreign_content_end_script()
+                               # fixfull
+                       else
+                               open_els.shift()
+                               t.acknowledge_self_closing()
+               return
+       in_foreign_content = (t) ->
+               if t.type is TYPE_TEXT and t.text is "\u0000"
+                       parse_error()
+                       insert_character new_character_token "\ufffd"
+                       return
+               if is_space_tok t
+                       insert_character t
+                       return
+               if t.type is TYPE_TEXT
+                       flag_frameset_ok = false
+                       insert_character t
+                       return
+               if t.type is TYPE_COMMENT
+                       insert_comment t
+                       return
+               if t.type is TYPE_DOCTYPE
+                       parse_error()
+                       return
+               if t.type is TYPE_START_TAG and (t.name is 'b' or t.name is 'big' or t.name is 'blockquote' or t.name is 'body' or t.name is 'br' or t.name is 'center' or t.name is 'code' or t.name is 'dd' or t.name is 'div' or t.name is 'dl' or t.name is 'dt' or t.name is 'em' or t.name is 'embed' or t.name is 'h1' or t.name is 'h2' or t.name is 'h3' or t.name is 'h4' or t.name is 'h5' or t.name is 'h6' or t.name is 'head' or t.name is 'hr' or t.name is 'i' or t.name is 'img' or t.name is 'li' or t.name is 'listing' or t.name is 'main' or t.name is 'meta' or t.name is 'nobr' or t.name is 'ol' or t.name is 'p' or t.name is 'pre' or t.name is 'ruby' or t.name is 's' or t.name is 'small' or t.name is 'span' or t.name is 'strong' or t.name is 'strike' or t.name is 'sub' or t.name is 'sup' or t.name is 'table' or t.name is 'tt' or t.name is 'u' or t.name is 'ul' or t.name is 'var' or (t.name is 'font' and has_color_face_or_size(t)))
+                       parse_error()
+                       if flag_fragment_parsing
+                               in_foreign_content_other_start t
+                               return
+                       loop # is this safe?
+                               open_els.shift()
+                               if is_mathml_text_integration_point(open_els[0]) or is_html_integration(open_els[0]) or open_els[0].namespace is NS_HTML
+                                       break
+                       process_token t
+                       return
+               if t.type is TYPE_START_TAG
+                       in_foreign_content_other_start t
+                       return
+               if t.type is TYPE_END_TAG and t.name is 'script' and open_els[0].name is 'script' and open_els[0].namespace is NS_SVG
+                       in_foreign_content_end_script()
+                       return
+               if t.type is TYPE_END_TAG
+                       i = 0
+                       node = open_els[i]
+                       if node.name.toLowerCase() isnt t.name
+                               parse_error()
+                       loop
+                               if node is open_els[open_els.length - 1]
+                                       return
+                               if node.name.toLowerCase() is t.name
+                                       loop
+                                               el = open_els.shift()
+                                               if el is node
+                                                       return
+                               i += 1
+                               node = open_els[i]
+                               if node.namespace is NS_HTML
+                                       break
+                       ins_mode t # explicitly call HTML insertion mode
+               return
+
+
+       # 8.2.4.1 http://www.w3.org/TR/html5/syntax.html#data-state
+       tok_state_data = ->
+               switch c = txt.charAt(cur++)
+                       when '&'
+                               return new_text_node parse_character_reference()
+                       when '<'
+                               tok_state = tok_state_tag_open
+                       when "\u0000"
+                               parse_error()
+                               return new_text_node c
+                       when '' # EOF
+                               return new_eof_token()
+                       else
+                               return new_text_node c
+               return null
+
+       # 8.2.4.2 http://www.w3.org/TR/html5/syntax.html#character-reference-in-data-state
+       # not needed: tok_state_character_reference_in_data = ->
+       # just call parse_character_reference()
+
+       # 8.2.4.3 http://www.w3.org/TR/html5/syntax.html#rcdata-state
+       tok_state_rcdata = ->
+               switch c = txt.charAt(cur++)
+                       when '&'
+                               return new_text_node parse_character_reference()
+                       when '<'
+                               tok_state = tok_state_rcdata_less_than_sign
+                       when "\u0000"
+                               parse_error()
+                               return new_character_token "\ufffd"
+                       when '' # EOF
+                               return new_eof_token()
+                       else
+                               return new_character_token c
+               return null
+
+       # 8.2.4.4 http://www.w3.org/TR/html5/syntax.html#character-reference-in-rcdata-state
+       # not needed: tok_state_character_reference_in_rcdata = ->
+       # just call parse_character_reference()
+
+       # 8.2.4.5 http://www.w3.org/TR/html5/syntax.html#rawtext-state
+       tok_state_rawtext = ->
+               switch c = txt.charAt(cur++)
+                       when '<'
+                               tok_state = tok_state_rawtext_less_than_sign
+                       when "\u0000"
+                               parse_error()
+                               return new_character_token "\ufffd"
+                       when '' # EOF
+                               return new_eof_token()
+                       else
+                               return new_character_token c
+               return null
+
+       # 8.2.4.6 http://www.w3.org/TR/html5/syntax.html#script-data-state
+       tok_state_script_data = ->
+               switch c = txt.charAt(cur++)
+                       when '<'
+                               tok_state = tok_state_script_data_less_than_sign
+                       when "\u0000"
+                               parse_error()
+                               return new_character_token "\ufffd"
+                       when '' # EOF
+                               return new_eof_token()
+                       else
+                               return new_character_token c
+               return null
+
+       # 8.2.4.7 http://www.w3.org/TR/html5/syntax.html#plaintext-state
+       tok_state_plaintext = ->
+               switch c = txt.charAt(cur++)
+                       when "\u0000"
+                               parse_error()
+                               return new_character_token "\ufffd"
+                       when '' # EOF
+                               return new_eof_token()
+                       else
+                               return new_character_token c
+               return null
+
+
+       # 8.2.4.8 http://www.w3.org/TR/html5/syntax.html#tag-open-state
+       tok_state_tag_open = ->
+               c = txt.charAt(cur++)
+               if c is '!'
+                       tok_state = tok_state_markup_declaration_open
+                       return
+               if c is '/'
+                       tok_state = tok_state_end_tag_open
+                       return
+               if is_uc_alpha(c)
+                       tok_cur_tag = new_open_tag c.toLowerCase()
+                       tok_state = tok_state_tag_name
+                       return
+               if is_lc_alpha(c)
+                       tok_cur_tag = new_open_tag c
+                       tok_state = tok_state_tag_name
+                       return
+               if c is '?'
+                       parse_error()
+                       tok_cur_tag = new_comment_token '?' # FIXME right?
+                       tok_state = tok_state_bogus_comment
+                       return
+               # Anything else
+               parse_error()
+               tok_state = tok_state_data
+               cur -= 1 # we didn't parse/handle the char after <
+               return new_text_node '<'
+
+       # 8.2.4.9 http://www.w3.org/TR/html5/syntax.html#end-tag-open-state
+       tok_state_end_tag_open = ->
+               c = txt.charAt(cur++)
+               if is_uc_alpha(c)
+                       tok_cur_tag = new_end_tag c.toLowerCase()
+                       tok_state = tok_state_tag_name
+                       return
+               if is_lc_alpha(c)
+                       tok_cur_tag = new_end_tag c
+                       tok_state = tok_state_tag_name
+                       return
+               if c is '>'
+                       parse_error()
+                       tok_state = tok_state_data
+                       return
+               if c is '' # EOF
+                       parse_error()
+                       tok_state = tok_state_data
+                       return new_text_node '</'
+               # Anything else
+               parse_error()
+               tok_cur_tag = new_comment_token c
+               tok_state = tok_state_bogus_comment
+               return null
+
+       # 8.2.4.10 http://www.w3.org/TR/html5/syntax.html#tag-name-state
+       tok_state_tag_name = ->
+               switch c = txt.charAt(cur++)
+                       when "\t", "\n", "\u000c", ' '
+                               tok_state = tok_state_before_attribute_name
+                       when '/'
+                               tok_state = tok_state_self_closing_start_tag
+                       when '>'
+                               tok_state = tok_state_data
+                               tmp = tok_cur_tag
+                               tok_cur_tag = null
+                               return tmp
+                       when "\u0000"
+                               parse_error()
+                               tok_cur_tag.name += "\ufffd"
+                       when '' # EOF
+                               parse_error()
+                               tok_state = tok_state_data
+                       else
+                               if is_uc_alpha(c)
+                                       tok_cur_tag.name += c.toLowerCase()
+                               else
+                                       tok_cur_tag.name += c
+               return null
+
+       # 8.2.4.11 http://www.w3.org/TR/html5/syntax.html#rcdata-less-than-sign-state
+       tok_state_rcdata_less_than_sign = ->
+               c = txt.charAt(cur++)
+               if c is '/'
+                       temporary_buffer = ''
+                       tok_state = tok_state_rcdata_end_tag_open
+                       return null
+               # Anything else
+               tok_state = tok_state_rcdata
+               cur -= 1 # reconsume the input character
+               return new_character_token '<'
+
+       # 8.2.4.12 http://www.w3.org/TR/html5/syntax.html#rcdata-end-tag-open-state
+       tok_state_rcdata_end_tag_open = ->
+               c = txt.charAt(cur++)
+               if is_uc_alpha(c)
+                       tok_cur_tag = new_end_tag c.toLowerCase()
+                       temporary_buffer += c
+                       tok_state = tok_state_rcdata_end_tag_name
+                       return null
+               if is_lc_alpha(c)
+                       tok_cur_tag = new_end_tag c
+                       temporary_buffer += c
+                       tok_state = tok_state_rcdata_end_tag_name
+                       return null
+               # Anything else
+               tok_state = tok_state_rcdata
+               cur -= 1 # reconsume the input character
+               return new_character_token "</" # fixfull separate these
+
+       # http://www.w3.org/TR/html5/syntax.html#appropriate-end-tag-token
+       is_appropriate_end_tag = (t) ->
+               # fixfull: this assumes that open_els[0].name is "the tag name of the last
+               # start tag to have been emitted from this tokenizer"
+               return t.type is TYPE_END_TAG and t.name is open_els[0].name
+
+       # 8.2.4.13 http://www.w3.org/TR/html5/syntax.html#rcdata-end-tag-name-state
+       tok_state_rcdata_end_tag_name = ->
+               c = txt.charAt(cur++)
+               if c is "\t" or c is "\n" or c is "\u000c" or c is ' '
+                       if is_appropriate_end_tag tok_cur_tag
+                               tok_state = tok_state_before_attribute_name
+                               return
+                       # else fall through to "Anything else"
+               if c is '/'
+                       if is_appropriate_end_tag tok_cur_tag
+                               tok_state = tok_state_self_closing_start_tag # FIXME spec typo?
+                               return
+                       # else fall through to "Anything else"
+               if c is '>'
+                       if is_appropriate_end_tag tok_cur_tag
+                               tok_state = tok_state_data
+                               return tok_cur_tag
+                       # else fall through to "Anything else"
+               if is_uc_alpha(c)
+                       tok_cur_tag.name += c.toLowerCase()
+                       temporary_buffer += c
+                       return null
+               if is_lc_alpha(c)
+                       tok_cur_tag.name += c
+                       temporary_buffer += c
+                       return null
+               # Anything else
+               tok_state = tok_state_rcdata
+               cur -= 1 # reconsume the input character
+               return new_character_token '</' + temporary_buffer # fixfull separate these
+
+       # 8.2.4.14 http://www.w3.org/TR/html5/syntax.html#rawtext-less-than-sign-state
+       tok_state_rawtext_less_than_sign = ->
+               c = txt.charAt(cur++)
+               if c is '/'
+                       temporary_buffer = ''
+                       tok_state = tok_state_rawtext_end_tag_open
+                       return null
+               # Anything else
+               tok_state = tok_state_rawtext
+               cur -= 1 # reconsume the input character
+               return new_character_token '<'
+
+       # 8.2.4.15 http://www.w3.org/TR/html5/syntax.html#rawtext-end-tag-open-state
+       tok_state_rawtext_end_tag_open = ->
+               c = txt.charAt(cur++)
+               if is_uc_alpha(c)
+                       tok_cur_tag = new_end_tag c.toLowerCase()
+                       temporary_buffer += c
+                       tok_state = tok_state_rawtext_end_tag_name
+                       return null
+               if is_lc_alpha(c)
+                       tok_cur_tag = new_end_tag c
+                       temporary_buffer += c
+                       tok_state = tok_state_rawtext_end_tag_name
+                       return null
+               # Anything else
+               tok_state = tok_state_rawtext
+               cur -= 1 # reconsume the input character
+               return new_character_token "</" # fixfull separate these
+
+       # 8.2.4.16 http://www.w3.org/TR/html5/syntax.html#rawtext-end-tag-name-state
+       tok_state_rawtext_end_tag_name = ->
+               c = txt.charAt(cur++)
+               if c is "\t" or c is "\n" or c is "\u000c" or c is ' '
+                       if is_appropriate_end_tag tok_cur_tag
+                               tok_state = tok_state_before_attribute_name
+                               return
+                       # else fall through to "Anything else"
+               if c is '/'
+                       if is_appropriate_end_tag tok_cur_tag
+                               tok_state = tok_state_self_closing_start_tag
+                               return
+                       # else fall through to "Anything else"
+               if c is '>'
+                       if is_appropriate_end_tag tok_cur_tag
+                               tok_state = tok_state_data
+                               return tok_cur_tag
+                       # else fall through to "Anything else"
+               if is_uc_alpha(c)
+                       tok_cur_tag.name += c.toLowerCase()
+                       temporary_buffer += c
+                       return null
+               if is_lc_alpha(c)
+                       tok_cur_tag.name += c
+                       temporary_buffer += c
+                       return null
+               # Anything else
+               tok_state = tok_state_rawtext
+               cur -= 1 # reconsume the input character
+               return new_character_token '</' + temporary_buffer # fixfull separate these
+
+       # 8.2.4.17 http://www.w3.org/TR/html5/syntax.html#script-data-less-than-sign-state
+       tok_state_script_data_less_than_sign = ->
+               c = txt.charAt(cur++)
+               if c is '/'
+                       temporary_buffer = ''
+                       tok_state = tok_state_script_data_end_tag_open
+                       return
+               if c is '!'
+                       tok_state = tok_state_script_data_escape_start
+                       return new_character_token '<!' # fixfull split
+               # Anything else
+               tok_state = tok_state_script_data
+               cur -= 1 # Reconsume
+               return new_character_token '<'
+
+       # 8.2.4.18 http://www.w3.org/TR/html5/syntax.html#script-data-end-tag-open-state
+       tok_state_script_data_end_tag_open = ->
+               c = txt.charAt(cur++)
+               if is_uc_alpha(c)
+                       tok_cur_tag = new_end_tag c.toLowerCase()
+                       temporary_buffer += c
+                       tok_state = tok_state_script_data_end_tag_name
+                       return
+               if is_lc_alpha(c)
+                       tok_cur_tag = new_end_tag c
+                       temporary_buffer += c
+                       tok_state = tok_state_script_data_end_tag_name
+                       return
+               # Anything else
+               tok_state = tok_state_script_data
+               cur -= 1 # Reconsume
+               return new_character_token '</'
+
+       # 8.2.4.19 http://www.w3.org/TR/html5/syntax.html#script-data-end-tag-open-state
+       tok_state_script_data_end_tag_name = ->
+               c = txt.charAt(cur++)
+               if c is "\t" or c is "\n" or c is "\u000c" or c is ' '
+                       if is_appropriate_end_tag tok_cur_tag
+                               tok_state = tok_state_before_attribute_name
+                               return
+                       # fall through
+               if c is '/'
+                       if is_appropriate_end_tag tok_cur_tag
+                               tok_state = tok_state_self_closing_start_tag
+                               return
+                       # fall through
+               if c is '>'
+                       if is_appropriate_end_tag tok_cur_tag
+                               tok_state = tok_state_data
+                               return tok_cur_tag
+                       # fall through
+               if is_uc_alpha(c)
+                       tok_cur_tag.name += c.toLowerCase()
+                       temporary_buffer += c
+                       return
+               if is_lc_alpha(c)
+                       tok_cur_tag.name += c
+                       temporary_buffer += c
+                       return
+               # Anything else
+               tok_state = tok_state_script_data
+               cur -= 1 # Reconsume
+               return new_character_token "</#{temporary_buffer}" # fixfull split
+
+       # 8.2.4.20 http://www.w3.org/TR/html5/syntax.html#script-data-escape-start-state
+       tok_state_script_data_escape_start = ->
+               c = txt.charAt(cur++)
+               if c is '-'
+                       tok_state = tok_state_script_data_escape_start_dash
+                       return new_character_token '-'
+               # Anything else
+               tok_state = tok_state_script_data
+               cur -= 1 # Reconsume
+               return
+
+       # 8.2.4.21 http://www.w3.org/TR/html5/syntax.html#script-data-escape-start-dash-state
+       tok_state_script_data_escape_start_dash = ->
+               c = txt.charAt(cur++)
+               if c is '-'
+                       tok_state = tok_state_script_data_escaped_dash_dash
+                       return new_character_token '-'
+               # Anything else
+               tok_state = tok_state_script_data
+               cur -= 1 # Reconsume
+               return
+
+       # 8.2.4.22 http://www.w3.org/TR/html5/syntax.html#script-data-escaped-state
+       tok_state_script_data_escaped = ->
+               c = txt.charAt(cur++)
+               if c is '-'
+                       tok_state = tok_state_script_data_escaped_dash
+                       return new_character_token '-'
+               if c is '<'
+                       tok_state = tok_state_script_data_escaped_less_than_sign
+                       return
+               if c is "\u0000"
+                       parse_error()
+                       return new_character_token "\ufffd"
+               if c is '' # EOF
+                       tok_state = tok_state_data
+                       parse_error()
+                       cur -= 1 # Reconsume
+                       return
+               # Anything else
+               return new_character_token c
+
+       # 8.2.4.23 http://www.w3.org/TR/html5/syntax.html#script-data-escaped-dash-state
+       tok_state_script_data_escaped_dash = ->
+               c = txt.charAt(cur++)
+               if c is '-'
+                       tok_state = tok_state_script_data_escaped_dash_dash
+                       return new_character_token '-'
+               if c is '<'
+                       tok_state = tok_state_script_data_escaped_less_than_sign
+                       return
+               if c is "\u0000"
+                       parse_error()
+                       tok_state = tok_state_script_data_escaped
+                       return new_character_token "\ufffd"
+               if c is '' # EOF
+                       tok_state = tok_state_data
+                       parse_error()
+                       cur -= 1 # Reconsume
+                       return
+               # Anything else
+               tok_state = tok_state_script_data_escaped
+               return new_character_token c
+
+       # 8.2.4.24 http://www.w3.org/TR/html5/syntax.html#script-data-escaped-dash-dash-state
+       tok_state_script_data_escaped_dash_dash = ->
+               c = txt.charAt(cur++)
+               if c is '-'
+                       return new_character_token '-'
+               if c is '<'
+                       tok_state = tok_state_script_data_escaped_less_than_sign
+                       return
+               if c is '>'
+                       tok_state = tok_state_script_data
+                       return new_character_token '>'
+               if c is "\u0000"
+                       parse_error()
+                       tok_state = tok_state_script_data_escaped
+                       return new_character_token "\ufffd"
+               if c is '' # EOF
+                       parse_error()
+                       tok_state = tok_state_data
+                       cur -= 1 # Reconsume
+                       return
+               # Anything else
+               tok_state = tok_state_script_data_escaped
+               return new_character_token c
+
+       # 8.2.4.25 http://www.w3.org/TR/html5/syntax.html#script-data-escaped-less-than-sign-state
+       tok_state_script_data_escaped_less_than_sign = ->
+               c = txt.charAt(cur++)
+               if c is '/'
+                       temporary_buffer = ''
+                       tok_state = tok_state_script_data_escaped_end_tag_open
+                       return
+               if is_uc_alpha(c)
+                       temporary_buffer = c.toLowerCase() # yes, really
+                       tok_state = tok_state_script_data_double_escape_start
+                       return new_character_token "<#{c}" # fixfull split
+               if is_lc_alpha(c)
+                       temporary_buffer = c
+                       tok_state = tok_state_script_data_double_escape_start
+                       return new_character_token "<#{c}" # fixfull split
+               # Anything else
+               tok_state = tok_state_script_data_escaped
+               cur -= 1 # Reconsume
+               return new_character_token '<'
+
+       # 8.2.4.26 http://www.w3.org/TR/html5/syntax.html#script-data-escaped-end-tag-open-state
+       tok_state_script_data_escaped_end_tag_open = ->
+               c = txt.charAt(cur++)
+               if is_uc_alpha(c)
+                       tok_cur_tag = new_end_tag c.toLowerCase()
+                       temporary_buffer += c
+                       tok_state = tok_state_script_data_escaped_end_tag_name
+                       return
+               if is_lc_alpha(c)
+                       tok_cur_tag = new_end_tag c
+                       temporary_buffer += c
+                       tok_state = tok_state_script_data_escaped_end_tag_name
+                       return
+               # Anything else
+               tok_state = tok_state_script_data_escaped
+               cur -= 1 # Reconsume
+               return new_character_token '</' # fixfull split
+
+       # 8.2.4.27 http://www.w3.org/TR/html5/syntax.html#script-data-escaped-end-tag-name-state
+       tok_state_script_data_escaped_end_tag_name = ->
+               c = txt.charAt(cur++)
+               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
+                       if is_appropriate_end_tag tok_cur_tag
+                               tok_state = tok_state_before_attribute_name
+                               return
+                       # fall through
+               if c is '/'
+                       if is_appropriate_end_tag tok_cur_tag
+                               tok_state = tok_state_self_closing_start_tag
+                               return
+                       # fall through
+               if c is '>'
+                       if is_appropriate_end_tag tok_cur_tag
+                               tok_state = tok_state_data
+                               return tok_cur_tag
+                       # fall through
+               if is_uc_alpha(c)
+                       tok_cur_tag.name += c.toLowerCase()
+                       temporary_buffer += c.toLowerCase()
+                       return
+               if is_lc_alpha(c)
+                       tok_cur_tag.name += c
+                       temporary_buffer += c.toLowerCase()
+                       return
+               # Anything else
+               tok_state = tok_state_script_data_escaped
+               cur -= 1 # Reconsume
+               return new_character_token "</#{temporary_buffer}" # fixfull split
+
+       # 8.2.4.28 http://www.w3.org/TR/html5/syntax.html#script-data-double-escape-start-state
+       tok_state_script_data_double_escape_start = ->
+               c = txt.charAt(cur++)
+               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' ' or c is '/' or c is '>'
+                       if temporary_buffer is 'script'
+                               tok_state = tok_state_script_data_double_escaped
+                       else
+                               tok_state = tok_state_script_data_escaped
+                       return new_character_token c
+               if is_uc_alpha(c)
+                       temporary_buffer += c.toLowerCase() # yes, really lowercase
+                       return new_character_token c
+               if is_lc_alpha(c)
+                       temporary_buffer += c
+                       return new_character_token c
+               # Anything else
+               tok_state = tok_state_script_data_escaped
+               cur -= 1 # Reconsume
+               return
+
+       # 8.2.4.29 http://www.w3.org/TR/html5/syntax.html#script-data-double-escaped-state
+       tok_state_script_data_double_escaped = ->
+               c = txt.charAt(cur++)
+               if c is '-'
+                       tok_state = tok_state_script_data_double_escaped_dash
+                       return new_character_token '-'
+               if c is '<'
+                       tok_state = tok_state_script_data_double_escaped_less_than_sign
+                       return new_character_token '<'
+               if c is "\u0000"
+                       parse_error()
+                       return new_character_token "\ufffd"
+               if c is '' # EOF
+                       parse_error()
+                       tok_state = tok_state_data
+                       cur -= 1 # Reconsume
+                       return
+               # Anything else
+               return new_character_token c
+
+       # 8.2.4.30 http://www.w3.org/TR/html5/syntax.html#script-data-double-escaped-dash-state
+       tok_state_script_data_double_escaped_dash = ->
+               c = txt.charAt(cur++)
+               if c is '-'
+                       tok_state = tok_state_script_data_double_escaped_dash_dash
+                       return new_character_token '-'
+               if c is '<'
+                       tok_state = tok_state_script_data_double_escaped_less_than_sign
+                       return new_character_token '<'
+               if c is "\u0000"
+                       parse_error()
+                       tok_state = tok_state_script_data_double_escaped
+                       return new_character_token "\ufffd"
+               if c is '' # EOF
+                       parse_error()
+                       tok_state = tok_state_data
+                       cur -= 1 # Reconsume
+                       return
+               # Anything else
+               tok_state = tok_state_script_data_double_escaped
+               return new_character_token c
+
+       # 8.2.4.31 http://www.w3.org/TR/html5/syntax.html#script-data-double-escaped-dash-dash-state
+       tok_state_script_data_double_escaped_dash_dash = ->
+               c = txt.charAt(cur++)
+               if c is '-'
+                       return new_character_token '-'
+               if c is '<'
+                       tok_state = tok_state_script_data_double_escaped_less_than_sign
+                       return new_character_token '<'
+               if c is '>'
+                       tok_state = tok_state_script_data
+                       return new_character_token '>'
+               if c is "\u0000"
+                       parse_error()
+                       tok_state = tok_state_script_data_double_escaped
+                       return new_character_token "\ufffd"
+               if c is '' # EOF
+                       parse_error()
+                       tok_state = tok_state_data
+                       cur -= 1 # Reconsume
+                       return
+               # Anything else
+               tok_state = tok_state_script_data_double_escaped
+               return new_character_token c
+
+       # 8.2.4.32 http://www.w3.org/TR/html5/syntax.html#script-data-double-escaped-less-than-sign-state
+       tok_state_script_data_double_escaped_less_than_sign = ->
+               c = txt.charAt(cur++)
+               if c is '/'
+                       temporary_buffer = ''
+                       tok_state = tok_state_script_data_double_escape_end
+                       return new_character_token '/'
+               # Anything else
+               tok_state = tok_state_script_data_double_escaped
+               cur -= 1 # Reconsume
+               return
+
+       # 8.2.4.33 http://www.w3.org/TR/html5/syntax.html#script-data-double-escape-end-state
+       tok_state_script_data_double_escape_end = ->
+               c = txt.charAt(cur++)
+               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' ' or c is '/' or c is '>'
+                       if temporary_buffer is 'script'
+                               tok_state = tok_state_script_data_escaped
+                       else
+                               tok_state = tok_state_script_data_double_escaped
+                       return new_character_token c
+               if is_uc_alpha(c)
+                       temporary_buffer += c.toLowerCase() # yes, really lowercase
+                       return new_character_token c
+               if is_lc_alpha(c)
+                       temporary_buffer += c
+                       return new_character_token c
+               # Anything else
+               tok_state = tok_state_script_data_double_escaped
+               cur -= 1 # Reconsume
+               return
+
+       # 8.2.4.34 http://www.w3.org/TR/html5/syntax.html#before-attribute-name-state
+       tok_state_before_attribute_name = ->
+               attr_name = null
+               switch c = txt.charAt(cur++)
+                       when "\t", "\n", "\u000c", ' '
+                               return null
+                       when '/'
+                               tok_state = tok_state_self_closing_start_tag
+                               return null
+                       when '>'
+                               tok_state = tok_state_data
+                               tmp = tok_cur_tag
+                               tok_cur_tag = null
+                               return tmp
+                       when "\u0000"
+                               parse_error()
+                               attr_name = "\ufffd"
+                       when '"', "'", '<', '='
+                               parse_error()
+                               attr_name = c
+                       when '' # EOF
+                               parse_error()
+                               tok_state = tok_state_data
+                       else
+                               if is_uc_alpha(c)
+                                       attr_name = c.toLowerCase()
+                               else
+                                       attr_name = c
+               if attr_name?
+                       tok_cur_tag.attrs_a.unshift [attr_name, '']
+                       tok_state = tok_state_attribute_name
+               return null
+
+       # 8.2.4.35 http://www.w3.org/TR/html5/syntax.html#attribute-name-state
+       tok_state_attribute_name = ->
+               switch c = txt.charAt(cur++)
+                       when "\t", "\n", "\u000c", ' '
+                               tok_state = tok_state_after_attribute_name
+                       when '/'
+                               tok_state = tok_state_self_closing_start_tag
+                       when '='
+                               tok_state = tok_state_before_attribute_value
+                       when '>'
+                               tok_state = tok_state_data
+                               tmp = tok_cur_tag
+                               tok_cur_tag = null
+                               return tmp
+                       when "\u0000"
+                               parse_error()
+                               tok_cur_tag.attrs_a[0][0] += "\ufffd"
+                       when '"', "'", '<'
+                               parse_error()
+                               tok_cur_tag.attrs_a[0][0] += c
+                       when '' # EOF
+                               parse_error()
+                               tok_state = tok_state_data
+                       else
+                               if is_uc_alpha(c)
+                                       tok_cur_tag.attrs_a[0][0] += c.toLowerCase()
+                               else
+                                       tok_cur_tag.attrs_a[0][0] += c
+               return null
+
+       # 8.2.4.36 http://www.w3.org/TR/html5/syntax.html#after-attribute-name-state
+       tok_state_after_attribute_name = ->
+               c = txt.charAt(cur++)
+               if c is "\t" or c is "\n" or c is "\u000c" or c is ' '
+                       return
+               if c is '/'
+                       tok_state = tok_state_self_closing_start_tag
+                       return
+               if c is '='
+                       tok_state = tok_state_before_attribute_value
+                       return
+               if c is '>'
+                       tok_state = tok_state_data
+                       return tok_cur_tag
+               if is_uc_alpha(c)
+                       tok_cur_tag.attrs_a.unshift [c.toLowerCase(), '']
+                       tok_state = tok_state_attribute_name
+                       return
+               if c is "\u0000"
+                       parse_error()
+                       tok_cur_tag.attrs_a.unshift ["\ufffd", '']
+                       tok_state = tok_state_attribute_name
+                       return
+               if c is '' # EOF
+                       parse_error()
+                       tok_state = tok_state_data
+                       cur -= 1 # reconsume
+                       return
+               if c is '"' or c is "'" or c is '<'
+                       parse_error()
+                       # fall through to Anything else
+               # Anything else
+               tok_cur_tag.attrs_a.unshift [c, '']
+               tok_state = tok_state_attribute_name
+               return
+
+       # 8.2.4.37 http://www.w3.org/TR/html5/syntax.html#before-attribute-value-state
+       tok_state_before_attribute_value = ->
+               switch c = txt.charAt(cur++)
+                       when "\t", "\n", "\u000c", ' '
+                               return null
+                       when '"'
+                               tok_state = tok_state_attribute_value_double_quoted
+                       when '&'
+                               tok_state = tok_state_attribute_value_unquoted
+                               cur -= 1
+                       when "'"
+                               tok_state = tok_state_attribute_value_single_quoted
+                       when "\u0000"
+                               # Parse error
+                               tok_cur_tag.attrs_a[0][1] += "\ufffd"
+                               tok_state = tok_state_attribute_value_unquoted
+                       when '>'
+                               # Parse error
+                               tok_state = tok_state_data
+                               tmp = tok_cur_tag
+                               tok_cur_tag = null
+                               return tmp
+                       when '' # EOF
+                               parse_error()
+                               tok_state = tok_state_data
+                       else
+                               tok_cur_tag.attrs_a[0][1] += c
+                               tok_state = tok_state_attribute_value_unquoted
+               return null
+
+       # 8.2.4.38 http://www.w3.org/TR/html5/syntax.html#attribute-value-(double-quoted)-state
+       tok_state_attribute_value_double_quoted = ->
+               switch c = txt.charAt(cur++)
+                       when '"'
+                               tok_state = tok_state_after_attribute_value_quoted
+                       when '&'
+                               tok_cur_tag.attrs_a[0][1] += parse_character_reference '"', true
+                       when "\u0000"
+                               # Parse error
+                               tok_cur_tag.attrs_a[0][1] += "\ufffd"
+                       when '' # EOF
+                               parse_error()
+                               tok_state = tok_state_data
+                       else
+                               tok_cur_tag.attrs_a[0][1] += c
+               return null
+
+       # 8.2.4.39 http://www.w3.org/TR/html5/syntax.html#attribute-value-(single-quoted)-state
+       tok_state_attribute_value_single_quoted = ->
+               switch c = txt.charAt(cur++)
+                       when "'"
+                               tok_state = tok_state_after_attribute_value_quoted
+                       when '&'
+                               tok_cur_tag.attrs_a[0][1] += parse_character_reference "'", true
+                       when "\u0000"
+                               # Parse error
+                               tok_cur_tag.attrs_a[0][1] += "\ufffd"
+                       when '' # EOF
+                               parse_error()
+                               tok_state = tok_state_data
+                       else
+                               tok_cur_tag.attrs_a[0][1] += c
+               return null
+
+       # 8.2.4.40 http://www.w3.org/TR/html5/syntax.html#attribute-value-(unquoted)-state
+       tok_state_attribute_value_unquoted = ->
+               switch c = txt.charAt(cur++)
+                       when "\t", "\n", "\u000c", ' '
+                               tok_state = tok_state_before_attribute_name
+                       when '&'
+                               tok_cur_tag.attrs_a[0][1] += parse_character_reference '>', true
+                       when '>'
+                               tok_state = tok_state_data
+                               tmp = tok_cur_tag
+                               tok_cur_tag = null
+                               return tmp
+                       when "\u0000"
+                               tok_cur_tag.attrs_a[0][1] += "\ufffd"
+                       when '' # EOF
+                               parse_error()
+                               tok_state = tok_state_data
+                       else
+                               # Parse Error if ', <, = or ` (backtick)
+                               tok_cur_tag.attrs_a[0][1] += c
+               return null
+
+       # 8.2.4.42 http://www.w3.org/TR/html5/syntax.html#after-attribute-value-(quoted)-state
+       tok_state_after_attribute_value_quoted = ->
+               switch c = txt.charAt(cur++)
+                       when "\t", "\n", "\u000c", ' '
+                               tok_state = tok_state_before_attribute_name
+                       when '/'
+                               tok_state = tok_state_self_closing_start_tag
+                       when '>'
+                               tok_state = tok_state_data
+                               tmp = tok_cur_tag
+                               tok_cur_tag = null
+                               return tmp
+                       when '' # EOF
+                               parse_error()
+                               tok_state = tok_state_data
+                       else
+                               # Parse Error
+                               tok_state = tok_state_before_attribute_name
+                               cur -= 1 # we didn't handle that char
+               return null
+
+       # 8.2.4.43 http://www.w3.org/TR/html5/syntax.html#self-closing-start-tag-state
+       tok_state_self_closing_start_tag = ->
+               c = txt.charAt(cur++)
+               if c is '>'
+                       tok_cur_tag.flag 'self-closing', true
+                       tok_state = tok_state_data
+                       return tok_cur_tag
+               if c is ''
+                       parse_error()
+                       tok_state = tok_state_data
+                       cur -= 1 # Reconsume
+                       return
+               # Anything else
+               parse_error()
+               tok_state = tok_state_before_attribute_name
+               cur -= 1 # Reconsume
+               return
+
+       # 8.2.4.44 http://www.w3.org/TR/html5/syntax.html#bogus-comment-state
+       # WARNING: put a comment token in tok_cur_tag before setting this state
+       tok_state_bogus_comment = ->
+               next_gt = txt.indexOf '>', cur
+               if next_gt is -1
+                       val = txt.substr cur
+                       cur = txt.length
+               else
+                       val = txt.substr cur, (next_gt - cur)
+                       cur = next_gt + 1
+               val = val.replace(new RegExp("\u0000", 'g'), "\ufffd")
+               tok_cur_tag.text += val
+               tok_state = tok_state_data
+               return tok_cur_tag
+
+       # 8.2.4.45 http://www.w3.org/TR/html5/syntax.html#markup-declaration-open-state
+       tok_state_markup_declaration_open = ->
+               if txt.substr(cur, 2) is '--'
+                       cur += 2
+                       tok_cur_tag = new_comment_token ''
+                       tok_state = tok_state_comment_start
+                       return
+               if txt.substr(cur, 7).toLowerCase() is 'doctype'
+                       cur += 7
+                       tok_state = tok_state_doctype
+                       return
+               acn = adjusted_current_node()
+               if acn and acn.namespace isnt NS_HTML and txt.substr(cur, 7) is '[CDATA['
+                       cur += 7
+                       tok_state = tok_state_cdata_section
+                       return
+               # Otherwise
+               parse_error()
+               tok_cur_tag = new_comment_token ''
+               tok_state = tok_state_bogus_comment
+               return
+
+       # 8.2.4.46 http://www.w3.org/TR/html5/syntax.html#comment-start-state
+       tok_state_comment_start = ->
+               switch c = txt.charAt(cur++)
+                       when '-'
+                               tok_state = tok_state_comment_start_dash
+                       when "\u0000"
+                               parse_error()
+                               tok_state = tok_state_comment
+                               return new_character_token "\ufffd"
+                       when '>'
+                               parse_error()
+                               tok_state = tok_state_data
+                               return tok_cur_tag
+                       when '' # EOF
+                               parse_error()
+                               tok_state = tok_state_data
+                               cur -= 1 # Reconsume
+                               return tok_cur_tag
+                       else
+                               tok_cur_tag.text += c
+                               tok_state = tok_state_comment
+               return null
+
+       # 8.2.4.47 http://www.w3.org/TR/html5/syntax.html#comment-start-dash-state
+       tok_state_comment_start_dash = ->
+               switch c = txt.charAt(cur++)
+                       when '-'
+                               tok_state = tok_state_comment_end
+                       when "\u0000"
+                               parse_error()
+                               tok_cur_tag.text += "-\ufffd"
+                               tok_state = tok_state_comment
+                       when '>'
+                               parse_error()
+                               tok_state = tok_state_data
+                               return tok_cur_tag
+                       when '' # EOF
+                               parse_error()
+                               tok_state = tok_state_data
+                               cur -= 1 # Reconsume
+                               return tok_cur_tag
+                       else
+                               tok_cur_tag.text += "-#{c}"
+                               tok_state = tok_state_comment
+               return null
+
+       # 8.2.4.48 http://www.w3.org/TR/html5/syntax.html#comment-state
+       tok_state_comment = ->
+               switch c = txt.charAt(cur++)
+                       when '-'
+                               tok_state = tok_state_comment_end_dash
+                       when "\u0000"
+                               parse_error()
+                               tok_cur_tag.text += "\ufffd"
+                       when '' # EOF
+                               parse_error()
+                               tok_state = tok_state_data
+                               cur -= 1 # Reconsume
+                               return tok_cur_tag
+                       else
+                               tok_cur_tag.text += c
+               return null
+
+       # 8.2.4.49 http://www.w3.org/TR/html5/syntax.html#comment-end-dash-state
+       tok_state_comment_end_dash = ->
+               switch c = txt.charAt(cur++)
+                       when '-'
+                               tok_state = tok_state_comment_end
+                       when "\u0000"
+                               parse_error()
+                               tok_cur_tag.text += "-\ufffd"
+                               tok_state = tok_state_comment
+                       when '' # EOF
+                               parse_error()
+                               tok_state = tok_state_data
+                               cur -= 1 # Reconsume
+                               return tok_cur_tag
+                       else
+                               tok_cur_tag.text += "-#{c}"
+                               tok_state = tok_state_comment
+               return null
+
+       # 8.2.4.50 http://www.w3.org/TR/html5/syntax.html#comment-end-state
+       tok_state_comment_end = ->
+               switch c = txt.charAt(cur++)
+                       when '>'
+                               tok_state = tok_state_data
+                               return tok_cur_tag
+                       when "\u0000"
+                               parse_error()
+                               tok_cur_tag.text += "--\ufffd"
+                               tok_state = tok_state_comment
+                       when '!'
+                               parse_error()
+                               tok_state = tok_state_comment_end_bang
+                       when '-'
+                               parse_error()
+                               tok_cur_tag.text += '-'
+                       when '' # EOF
+                               parse_error()
+                               tok_state = tok_state_data
+                               cur -= 1 # Reconsume
+                               return tok_cur_tag
+                       else
+                               parse_error()
+                               tok_cur_tag.text += "--#{c}"
+                               tok_state = tok_state_comment
+               return null
+
+       # 8.2.4.51 http://www.w3.org/TR/html5/syntax.html#comment-end-bang-state
+       tok_state_comment_end_bang = ->
+               switch c = txt.charAt(cur++)
+                       when '-'
+                               tok_cur_tag.text += "--!#{c}"
+                               tok_state = tok_state_comment_end_dash
+                       when '>'
+                               tok_state = tok_state_data
+                               return tok_cur_tag
+                       when "\u0000"
+                               parse_error()
+                               tok_cur_tag.text += "--!\ufffd"
+                               tok_state = tok_state_comment
+                       when '' # EOF
+                               parse_error()
+                               tok_state = tok_state_data
+                               cur -= 1 # Reconsume
+                               return tok_cur_tag
+                       else
+                               tok_cur_tag.text += "--!#{c}"
+                               tok_state = tok_state_comment
+               return null
+
+       # 8.2.4.52 http://www.w3.org/TR/html5/syntax.html#doctype-state
+       tok_state_doctype = ->
+               switch c = txt.charAt(cur++)
+                       when "\t", "\u000a", "\u000c", ' '
+                               tok_state = tok_state_before_doctype_name
+                       when '' # EOF
+                               parse_error()
+                               tok_state = tok_state_data
+                               el = new_doctype_token ''
+                               el.flag 'force-quirks', true
+                               cur -= 1 # Reconsume
+                               return el
+                       else
+                               parse_error()
+                               tok_state = tok_state_before_doctype_name
+                               cur -= 1 # Reconsume
+               return null
+
+       # 8.2.4.52 http://www.w3.org/TR/html5/syntax.html#doctype-state
+       tok_state_before_doctype_name = ->
+               c = txt.charAt(cur++)
+               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
+                       return
+               if is_uc_alpha(c)
+                       tok_cur_tag = new_doctype_token c.toLowerCase()
+                       tok_state = tok_state_doctype_name
+                       return
+               if c is "\u0000"
+                       parse_error()
+                       tok_cur_tag = new_doctype_token "\ufffd"
+                       tok_state = tok_state_doctype_name
+                       return
+               if c is '>'
+                       parse_error()
+                       el = new_doctype_token ''
+                       el.flag 'force-quirks', true
+                       tok_state = tok_state_data
+                       return el
+               if c is '' # EOF
+                       parse_error()
+                       tok_state = tok_state_data
+                       el = new_doctype_token ''
+                       el.flag 'force-quirks', true
+                       cur -= 1 # Reconsume
+                       return el
+               # Anything else
+               tok_cur_tag = new_doctype_token c
+               tok_state = tok_state_doctype_name
+               return null
+
+       # 8.2.4.54 http://www.w3.org/TR/html5/syntax.html#doctype-name-state
+       tok_state_doctype_name = ->
+               c = txt.charAt(cur++)
+               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
+                       tok_state = tok_state_after_doctype_name
+                       return
+               if c is '>'
+                       tok_state = tok_state_data
+                       return tok_cur_tag
+               if is_uc_alpha(c)
+                       tok_cur_tag.name += c.toLowerCase()
+                       return
+               if c is "\u0000"
+                       parse_error()
+                       tok_cur_tag.name += "\ufffd"
+                       return
+               if c is '' # EOF
+                       parse_error()
+                       tok_state = tok_state_data
+                       tok_cur_tag.flag 'force-quirks', true
+                       cur -= 1 # Reconsume
+                       return tok_cur_tag
+               # Anything else
+               tok_cur_tag.name += c
+               return null
+
+       # 8.2.4.55 http://www.w3.org/TR/html5/syntax.html#after-doctype-name-state
+       tok_state_after_doctype_name = ->
+               c = txt.charAt(cur++)
+               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
+                       return
+               if c is '>'
+                       tok_state = tok_state_data
+                       return tok_cur_tag
+               if c is '' # EOF
+                       parse_error()
+                       tok_state = tok_state_data
+                       tok_cur_tag.flag 'force-quirks', true
+                       cur -= 1 # Reconsume
+                       return tok_cur_tag
+               # Anything else
+               if txt.substr(cur - 1, 6).toLowerCase() is 'public'
+                       cur += 5
+                       tok_state = tok_state_after_doctype_public_keyword
+                       return
+               if txt.substr(cur - 1, 6).toLowerCase() is 'system'
+                       cur += 5
+                       tok_state = tok_state_after_doctype_system_keyword
+                       return
+               parse_error()
+               tok_cur_tag.flag 'force-quirks', true
+               tok_state = tok_state_bogus_doctype
+               return null
+
+       # 8.2.4.56 http://www.w3.org/TR/html5/syntax.html#after-doctype-public-keyword-state
+       tok_state_after_doctype_public_keyword = ->
+               c = txt.charAt(cur++)
+               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
+                       tok_state = tok_state_before_doctype_public_identifier
+                       return
+               if c is '"'
+                       parse_error()
+                       tok_cur_tag.public_identifier = ''
+                       tok_state = tok_state_doctype_public_identifier_double_quoted
+                       return
+               if c is "'"
+                       parse_error()
+                       tok_cur_tag.public_identifier = ''
+                       tok_state = tok_state_doctype_public_identifier_single_quoted
+                       return
+               if c is '>'
+                       parse_error()
+                       tok_cur_tag.flag 'force-quirks', true
+                       tok_state = tok_state_data
+                       return tok_cur_tag
+               if c is '' # EOF
+                       parse_error()
+                       tok_state = tok_state_data
+                       tok_cur_tag.flag 'force-quirks', true
+                       cur -= 1 # Reconsume
+                       return tok_cur_tag
+               # Anything else
+               parse_error()
+               tok_cur_tag.flag 'force-quirks', true
+               tok_state = tok_state_bogus_doctype
+               return null
+
+       # 8.2.4.57 http://www.w3.org/TR/html5/syntax.html#before-doctype-public-identifier-state
+       tok_state_before_doctype_public_identifier = ->
+               c = txt.charAt(cur++)
+               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
+                       return
+               if c is '"'
+                       parse_error()
+                       tok_cur_tag.public_identifier = ''
+                       tok_state = tok_state_doctype_public_identifier_double_quoted
+                       return
+               if c is "'"
+                       parse_error()
+                       tok_cur_tag.public_identifier = ''
+                       tok_state = tok_state_doctype_public_identifier_single_quoted
+                       return
+               if c is '>'
+                       parse_error()
+                       tok_cur_tag.flag 'force-quirks', true
+                       tok_state = tok_state_data
+                       return tok_cur_tag
+               if c is '' # EOF
+                       parse_error()
+                       tok_state = tok_state_data
+                       tok_cur_tag.flag 'force-quirks', true
+                       cur -= 1 # Reconsume
+                       return tok_cur_tag
+               # Anything else
+               parse_error()
+               tok_cur_tag.flag 'force-quirks', true
+               tok_state = tok_state_bogus_doctype
+               return null
+
+
+       # 8.2.4.58 http://www.w3.org/TR/html5/syntax.html#doctype-public-identifier-(double-quoted)-state
+       tok_state_doctype_public_identifier_double_quoted = ->
+               c = txt.charAt(cur++)
+               if c is '"'
+                       tok_state = tok_state_after_doctype_public_identifier
+                       return
+               if c is "\u0000"
+                       parse_error()
+                       tok_cur_tag.public_identifier += "\ufffd"
+                       return
+               if c is '>'
+                       parse_error()
+                       tok_cur_tag.flag 'force-quirks', true
+                       tok_state = tok_state_data
+                       return tok_cur_tag
+               if c is '' # EOF
+                       parse_error()
+                       tok_state = tok_state_data
+                       tok_cur_tag.flag 'force-quirks', true
+                       cur -= 1 # Reconsume
+                       return tok_cur_tag
+               # Anything else
+               tok_cur_tag.public_identifier += c
+               return null
+
+       # 8.2.4.59 http://www.w3.org/TR/html5/syntax.html#doctype-public-identifier-(single-quoted)-state
+       tok_state_doctype_public_identifier_single_quoted = ->
+               c = txt.charAt(cur++)
+               if c is "'"
+                       tok_state = tok_state_after_doctype_public_identifier
+                       return
+               if c is "\u0000"
+                       parse_error()
+                       tok_cur_tag.public_identifier += "\ufffd"
+                       return
+               if c is '>'
+                       parse_error()
+                       tok_cur_tag.flag 'force-quirks', true
+                       tok_state = tok_state_data
+                       return tok_cur_tag
+               if c is '' # EOF
+                       parse_error()
+                       tok_state = tok_state_data
+                       tok_cur_tag.flag 'force-quirks', true
+                       cur -= 1 # Reconsume
+                       return tok_cur_tag
+               # Anything else
+               tok_cur_tag.public_identifier += c
+               return null
+
+       # 8.2.4.60 http://www.w3.org/TR/html5/syntax.html#after-doctype-public-identifier-state
+       tok_state_after_doctype_public_identifier = ->
+               c = txt.charAt(cur++)
+               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
+                       tok_state = tok_state_between_doctype_public_and_system_identifiers
+                       return
+               if c is '>'
+                       tok_state = tok_state_data
+                       return tok_cur_tag
+               if c is '"'
+                       parse_error()
+                       tok_cur_tag.system_identifier = ''
+                       tok_state = tok_state_doctype_system_identifier_double_quoted
+                       return
+               if c is "'"
+                       parse_error()
+                       tok_cur_tag.system_identifier = ''
+                       tok_state = tok_state_doctype_system_identifier_single_quoted
+                       return
+               if c is '' # EOF
+                       parse_error()
+                       tok_state = tok_state_data
+                       tok_cur_tag.flag 'force-quirks', true
+                       cur -= 1 # Reconsume
+                       return tok_cur_tag
+               # Anything else
+               parse_error()
+               tok_cur_tag.flag 'force-quirks', true
+               tok_state = tok_state_bogus_doctype
+               return null
+
+       # 8.2.4.61 http://www.w3.org/TR/html5/syntax.html#between-doctype-public-and-system-identifiers-state
+       tok_state_between_doctype_public_and_system_identifiers = ->
+               c = txt.charAt(cur++)
+               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
+                       return
+               if c is '>'
+                       tok_state = tok_state_data
+                       return tok_cur_tag
+               if c is '"'
+                       parse_error()
+                       tok_cur_tag.system_identifier = ''
+                       tok_state = tok_state_doctype_system_identifier_double_quoted
+                       return
+               if c is "'"
+                       parse_error()
+                       tok_cur_tag.system_identifier = ''
+                       tok_state = tok_state_doctype_system_identifier_single_quoted
+                       return
+               if c is '' # EOF
+                       parse_error()
+                       tok_state = tok_state_data
+                       tok_cur_tag.flag 'force-quirks', true
+                       cur -= 1 # Reconsume
+                       return tok_cur_tag
+               # Anything else
+               parse_error()
+               tok_cur_tag.flag 'force-quirks', true
+               tok_state = tok_state_bogus_doctype
+               return null
+
+       # 8.2.4.62 http://www.w3.org/TR/html5/syntax.html#after-doctype-system-keyword-state
+       tok_state_after_doctype_system_keyword = ->
+               c = txt.charAt(cur++)
+               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
+                       tok_state = tok_state_before_doctype_system_identifier
+                       return
+               if c is '"'
+                       parse_error()
+                       tok_cur_tag.system_identifier = ''
+                       tok_state = tok_state_doctype_system_identifier_double_quoted
+                       return
+               if c is "'"
+                       parse_error()
+                       tok_cur_tag.system_identifier = ''
+                       tok_state = tok_state_doctype_system_identifier_single_quoted
+                       return
+               if c is '>'
+                       parse_error()
+                       tok_cur_tag.flag 'force-quirks', true
+                       tok_state = tok_state_data
+                       return tok_cur_tag
+               if c is '' # EOF
+                       parse_error()
+                       tok_state = tok_state_data
+                       tok_cur_tag.flag 'force-quirks', true
+                       cur -= 1 # Reconsume
+                       return tok_cur_tag
+               # Anything else
+               parse_error()
+               tok_cur_tag.flag 'force-quirks', true
+               tok_state = tok_state_bogus_doctype
+               return null
+
+       # 8.2.4.63 http://www.w3.org/TR/html5/syntax.html#before-doctype-system-identifier-state
+       tok_state_before_doctype_system_identifier = ->
+               c = txt.charAt(cur++)
+               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
+                       return
+               if c is '"'
+                       tok_cur_tag.system_identifier = ''
+                       tok_state = tok_state_doctype_system_identifier_double_quoted
+                       return
+               if c is "'"
+                       tok_cur_tag.system_identifier = ''
+                       tok_state = tok_state_doctype_system_identifier_single_quoted
+                       return
+               if c is '>'
+                       parse_error()
+                       tok_cur_tag.flag 'force-quirks', true
+                       tok_state = tok_state_data
+                       return tok_cur_tag
+               if c is '' # EOF
+                       parse_error()
+                       tok_state = tok_state_data
+                       tok_cur_tag.flag 'force-quirks', true
+                       cur -= 1 # Reconsume
+                       return tok_cur_tag
+               # Anything else
+               parse_error()
+               tok_cur_tag.flag 'force-quirks', true
+               tok_state = tok_state_bogus_doctype
+               return null
+
+       # 8.2.4.64 http://www.w3.org/TR/html5/syntax.html#doctype-system-identifier-(double-quoted)-state
+       tok_state_doctype_system_identifier_double_quoted = ->
+               c = txt.charAt(cur++)
+               if c is '"'
+                       tok_state = tok_state_after_doctype_system_identifier
+                       return
+               if c is "\u0000"
+                       parse_error()
+                       tok_cur_tag.system_identifier += "\ufffd"
+                       return
+               if c is '>'
+                       parse_error()
+                       tok_cur_tag.flag 'force-quirks', true
+                       tok_state = tok_state_data
+                       return tok_cur_tag
+               if c is '' # EOF
+                       parse_error()
+                       tok_state = tok_state_data
+                       tok_cur_tag.flag 'force-quirks', true
+                       cur -= 1 # Reconsume
+                       return tok_cur_tag
+               # Anything else
+               tok_cur_tag.system_identifier += c
+               return null
+
+       # 8.2.4.65 http://www.w3.org/TR/html5/syntax.html#doctype-system-identifier-(single-quoted)-state
+       tok_state_doctype_system_identifier_single_quoted = ->
+               c = txt.charAt(cur++)
+               if c is "'"
+                       tok_state = tok_state_after_doctype_system_identifier
+                       return
+               if c is "\u0000"
+                       parse_error()
+                       tok_cur_tag.system_identifier += "\ufffd"
+                       return
+               if c is '>'
+                       parse_error()
+                       tok_cur_tag.flag 'force-quirks', true
+                       tok_state = tok_state_data
+                       return tok_cur_tag
+               if c is '' # EOF
+                       parse_error()
+                       tok_state = tok_state_data
+                       tok_cur_tag.flag 'force-quirks', true
+                       cur -= 1 # Reconsume
+                       return tok_cur_tag
+               # Anything else
+               tok_cur_tag.system_identifier += c
+               return null
+
+       # 8.2.4.66 http://www.w3.org/TR/html5/syntax.html#after-doctype-system-identifier-state
+       tok_state_after_doctype_system_identifier = ->
+               c = txt.charAt(cur++)
+               if c is "\t" or c is "\u000a" or c is "\u000c" or c is ' '
+                       return
+               if c is '>'
+                       tok_state = tok_state_data
+                       return tok_cur_tag
+               if c is '' # EOF
+                       parse_error()
+                       tok_state = tok_state_data
+                       tok_cur_tag.flag 'force-quirks', true
+                       cur -= 1 # Reconsume
+                       return tok_cur_tag
+               # Anything else
+               parse_error()
+               # do _not_ tok_cur_tag.flag 'force-quirks', true
+               tok_state = tok_state_bogus_doctype
+               return null
+
+       # 8.2.4.67 http://www.w3.org/TR/html5/syntax.html#bogus-doctype-state
+       tok_state_bogus_doctype = ->
+               c = txt.charAt(cur++)
+               if c is '>'
+                       tok_state = tok_state_data
+                       return tok_cur_tag
+               if c is '' # EOF
+                       tok_state = tok_state_data
+                       cur -= 1 # Reconsume
+                       return tok_cur_tag
+               # Anything else
+               return null
+
+       # 8.2.4.68 http://www.w3.org/TR/html5/syntax.html#cdata-section-state
+       tok_state_cdata_section = ->
+               tok_state = tok_state_data
+               next_gt = txt.indexOf ']]>', cur
+               if next_gt is -1
+                       val = txt.substr cur
+                       cur = txt.length
+               else
+                       val = txt.substr cur, (next_gt - cur)
+                       cur = next_gt + 3
+               val = val.replace(new RegExp("\u0000", 'g'), "\ufffd")
+               if val.length > 0
+                       return new_character_token val # fixfull split
+               return null
+
+       # 8.2.4.69 http://www.w3.org/TR/html5/syntax.html#consume-a-character-reference
+       # Don't set this as a state, just call it
+       # returns a string (NOT a text node)
+       parse_character_reference = (allowed_char = null, in_attr = false) ->
+               if cur >= txt.length
+                       return '&'
+               switch c = txt.charAt(cur)
+                       when "\t", "\n", "\u000c", ' ', '<', '&', '', allowed_char
+                               # explicitly not a parse error
+                               return '&'
+                       when ';'
+                               # there has to be "one or more" alnums between & and ; to be a parse error
+                               return '&'
+                       when '#'
+                               if cur + 1 >= txt.length
+                                       return '&'
+                               if txt.charAt(cur + 1).toLowerCase() is 'x'
+                                       base = 16
+                                       charset = hex_chars
+                                       start = cur + 2
+                               else
+                                       charset = digits
+                                       start = cur + 1
+                                       base = 10
+                               i = 0
+                               while start + i < txt.length and charset.indexOf(txt.charAt(start + i)) > -1
+                                       i += 1
+                               if i is 0
+                                       return '&'
+                               cur = start + i
+                               if txt.charAt(start + i) is ';'
+                                       cur += 1
+                               else
+                                       parse_error()
+                               code_point = txt.substr(start, i)
+                               while code_point.charAt(0) is '0' and code_point.length > 1
+                                       code_point = code_point.substr 1
+                               code_point = parseInt(code_point, base)
+                               if unicode_fixes[code_point]?
+                                       parse_error()
+                                       return unicode_fixes[code_point]
+                               else
+                                       if (code_point >= 0xd800 and code_point <= 0xdfff) or code_point > 0x10ffff
+                                               parse_error()
+                                               return "\ufffd"
+                                       else
+                                               if (code_point >= 0x0001 and code_point <= 0x0008) or (code_point >= 0x000D and code_point <= 0x001F) or (code_point >= 0x007F and code_point <= 0x009F) or (code_point >= 0xFDD0 and code_point <= 0xFDEF) or code_point is 0x000B or code_point is 0xFFFE or code_point is 0xFFFF or code_point is 0x1FFFE or code_point is 0x1FFFF or code_point is 0x2FFFE or code_point is 0x2FFFF or code_point is 0x3FFFE or code_point is 0x3FFFF or code_point is 0x4FFFE or code_point is 0x4FFFF or code_point is 0x5FFFE or code_point is 0x5FFFF or code_point is 0x6FFFE or code_point is 0x6FFFF or code_point is 0x7FFFE or code_point is 0x7FFFF or code_point is 0x8FFFE or code_point is 0x8FFFF or code_point is 0x9FFFE or code_point is 0x9FFFF or code_point is 0xAFFFE or code_point is 0xAFFFF or code_point is 0xBFFFE or code_point is 0xBFFFF or code_point is 0xCFFFE or code_point is 0xCFFFF or code_point is 0xDFFFE or code_point is 0xDFFFF or code_point is 0xEFFFE or code_point is 0xEFFFF or code_point is 0xFFFFE or code_point is 0xFFFFF or code_point is 0x10FFFE or code_point is 0x10FFFF
+                                                       parse_error()
+                                               return from_code_point code_point
+                               return
+                       else
+                               for i in [0...31]
+                                       if alnum.indexOf(txt.charAt(cur + i)) is -1
+                                               break
+                               if i is 0
+                                       # exit early, because parse_error() below needs at least one alnum
+                                       return '&'
+                               if txt.charAt(cur + i) is ';'
+                                       decoded = decode_named_char_ref txt.substr(cur, i)
+                                       i += 1 # scan past the ';' (after, so we dno't pass it to decode)
+                                       if decoded?
+                                               cur += i
+                                               return decoded
+                                       # else FALL THROUGH (check for match without last char(s) or ";")
+                               # no ';' terminator (only legacy char refs)
+                               max = i
+                               for i in [2..max] # no prefix matches, so ok to check shortest first
+                                       c = legacy_char_refs[txt.substr(cur, i)]
+                                       if c?
+                                               if in_attr
+                                                       if txt.charAt(cur + i) is '='
+                                                               # "because some legacy user agents will
+                                                               # misinterpret the markup in those cases"
+                                                               parse_error()
+                                                               return '&'
+                                                       if alnum.indexOf(txt.charAt(cur + i)) > -1
+                                                               # this makes attributes forgiving about url args
+                                                               return '&'
+                                               # ok, and besides the weird exceptions for attributes...
+                                               # return the matching char
+                                               cur += i # consume entity chars
+                                               parse_error() # because no terminating ";"
+                                               return c
+                               parse_error()
+                               return '&'
+               return # never reached
+
+       eat_next_token_if_newline = ->
+               old_cur = cur
+               t = null
+               until t?
+                       t = tok_state()
+               if t.type is TYPE_TEXT
+                       # definition of a newline depends on whether it was a character ref or not
+                       if cur - old_cur is 1
+                               # not a character reference
+                               if t.text is "\u000d" or t.text is "\u000a"
+                                       return
+                       else
+                               if t.text is "\u000a"
+                                       return
+               # not a "newline"
+               cur = old_cur
+               return
+
+       # tree constructor initialization
+       # see comments on TYPE_TAG/etc for the structure of this data
+       txt = args_html
+       cur = 0
+       doc = new Node TYPE_TAG, name: 'document', namespace: NS_HTML
+       doc.flag 'quirks mode', QUIRKS_NO # TODO bugreport spec for not specifying this
+       fragment_root = null # fragment parsing algorithm returns children of this
+       open_els = []
+       afe = [] # active formatting elements
+       template_ins_modes = []
+       ins_mode = ins_mode_initial
+       original_ins_mode = ins_mode # TODO check spec
+       flag_scripting = args.scripting ? true # TODO might need an extra flag to get <noscript> to parse correctly
+       flag_frameset_ok = true
+       flag_parsing = true
+       flag_foster_parenting = false
+       form_element_pointer = null
+       temporary_buffer = null
+       pending_table_character_tokens = []
+       head_element_pointer = null
+       flag_fragment_parsing = false
+       context_element = null
+       prev_node_id = 0 # just for debugging
+
+       # tokenizer initialization
+       tok_state = tok_state_data
+
+       parse_init = ->
+               # fragment parsing (text arg)
+               if args.fragment?
+                       # this handles the fragment from the tests in the format described here:
+                       # https://github.com/html5lib/html5lib-tests/blob/master/tree-construction/README.md
+                       f = args.fragment
+                       ns = NS_HTML
+                       if f.substr(0, 5) is 'math '
+                               f = f.substr 5
+                               ns = NS_MATHML
+                       else if f.substr(0, 4) is 'svg '
+                               f = f.substr 4
+                               ns = NS_SVG
+                       t = new_open_tag f
+                       context_element = token_to_element t, ns
+                       context_element.document = new Node TYPE_TAG, name: 'document', namespace: NS_HTML
+                       context_element.document.flag 'quirks mode', QUIRKS_NO
+               # fragment parsing (Node arg)
+               if args.context?
+                       context_element = args.context
+
+               # http://www.w3.org/TR/html5/syntax.html#parsing-html-fragments
+               # fragment parsing algorithm
+               if context_element?
+                       flag_fragment_parsing = true
+                       doc = new Node TYPE_TAG, name: 'html', namespace: NS_HTML
+                       # search up the tree from context, to try to find it's document,
+                       # because this file only puts a "document" property on the root
+                       # element.
+                       old_doc = null
+                       el = context_element
+                       loop
+                               if el.document?
+                                       old_doc = el.document
+                                       break
+                               if el.parent
+                                       el = el.parent
+                               else
+                                       break
+                       if old_doc
+                               doc.flag 'quirks mode', old_doc.flag 'quirks mode'
+                       # set tok_state
+                       if context_element.namespace is NS_HTML
+                               switch context_element.name
+                                       when 'title', 'textarea'
+                                               tok_state = tok_state_rcdata
+                                       when 'style', 'xmp', 'iframe', 'noembed', 'noframes'
+                                               tok_state = tok_state_rawtext
+                                       when 'script'
+                                               tok_state = tok_state_script_data
+                                       when 'noscript'
+                                               if flag_scripting
+                                                       tok_state = tok_state_rawtext
+                                       when 'plaintext'
+                                               tok_state = tok_state_plaintext
+                       fragment_root = new Node TYPE_TAG, name: 'html', namespace: NS_HTML
+                       doc.children.push fragment_root
+                       fragment_root.document = doc
+                       open_els = [fragment_root]
+                       if context_element.name is 'template' and context_element.namespace is NS_HTML
+                               template_ins_modes.unshift ins_mode_in_template
+                       # fixfull create token for context (it should have it's original one already)
+                       reset_ins_mode()
+                       # set form_element pointer... in the foreign doc?!
+                       el = context_element
+                       loop
+                               if el.name is 'form' and el.namespace is NS_HTML
+                                       form_element_pointer = el
+                                       break
+                               if el.parent
+                                       el = el.parent
+                               else
+                                       break
+
+               # text pre-processing
+               # FIXME check http://www.w3.org/TR/html5/syntax.html#preprocessing-the-input-stream
+               txt = txt.replace(new RegExp("\r\n", 'g'), "\n") # fixfull spec doesn't say this
+               txt = txt.replace(new RegExp("\r", 'g'), "\n") # fixfull spec doesn't say this
+
+               return
+
+       # http://www.w3.org/TR/html5/syntax.html#tree-construction
+       parse_main_loop = ->
+               while flag_parsing
+                       t = tok_state()
+                       if t?
+                               process_token t
+                               # fixfull parse error if has self-closing flag, but it wasn't acknolwedged
+               return
+       parse_init()
+       parse_main_loop()
+
+       if flag_fragment_parsing
+               return fragment_root.children
+       return doc.children
+
+exports.parse = parse_html
+exports.debug_log_reset = debug_log_reset
+exports.debug_log_each = debug_log_each
+exports.TYPE_TAG = TYPE_TAG
+exports.TYPE_TEXT = TYPE_TEXT
+exports.TYPE_COMMENT = TYPE_COMMENT
+exports.TYPE_DOCTYPE = TYPE_DOCTYPE
+exports.NS_HTML = NS_HTML
+exports.NS_MATHML = NS_MATHML
+exports.NS_SVG = NS_SVG
+exports.QUIRKS_NO = QUIRKS_NO
+exports.QUIRKS_LIMITED = QUIRKS_LIMITED
+exports.QUIRKS_YES = QUIRKS_YES
diff --git a/parser_no_browser_helper.coffee b/parser_no_browser_helper.coffee
new file mode 100644 (file)
index 0000000..16151f1
--- /dev/null
@@ -0,0 +1,9 @@
+# This file is used by the parser when it is _not_ run in a browser.
+
+# This module exports a single function which will decode any of the character
+# references that have a terminating semicolon from the html5 spec at
+# https://www.w3.org/TR/html5/entities.json
+# Do not include the "&" or ";" in your argument, eg pass "alpha"
+module.exports = (txt) ->
+       return named_entities_with_terminators[txt] ? null
+named_entities_with_terminators = {"Aacute":"Á","aacute":"á","Abreve":"Ă","abreve":"ă","ac":"∾","acd":"∿","acE":"∾̳","Acirc":"Â","acirc":"â","acute":"´","Acy":"А","acy":"а","AElig":"Æ","aelig":"æ","af":"⁡","Afr":"𝔄","afr":"𝔞","Agrave":"À","agrave":"à","alefsym":"ℵ","aleph":"ℵ","Alpha":"Α","alpha":"α","Amacr":"Ā","amacr":"ā","amalg":"⨿","AMP":"&","amp":"&","And":"⩓","and":"∧","andand":"⩕","andd":"⩜","andslope":"⩘","andv":"⩚","ang":"∠","ange":"⦤","angle":"∠","angmsd":"∡","angmsdaa":"⦨","angmsdab":"⦩","angmsdac":"⦪","angmsdad":"⦫","angmsdae":"⦬","angmsdaf":"⦭","angmsdag":"⦮","angmsdah":"⦯","angrt":"∟","angrtvb":"⊾","angrtvbd":"⦝","angsph":"∢","angst":"Å","angzarr":"⍼","Aogon":"Ą","aogon":"ą","Aopf":"𝔸","aopf":"𝕒","ap":"≈","apacir":"⩯","apE":"⩰","ape":"≊","apid":"≋","apos":"'","ApplyFunction":"⁡","approx":"≈","approxeq":"≊","Aring":"Å","aring":"å","Ascr":"𝒜","ascr":"𝒶","Assign":"≔","ast":"*","asymp":"≈","asympeq":"≍","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","awconint":"∳","awint":"⨑","backcong":"≌","backepsilon":"϶","backprime":"‵","backsim":"∽","backsimeq":"⋍","Backslash":"∖","Barv":"⫧","barvee":"⊽","Barwed":"⌆","barwed":"⌅","barwedge":"⌅","bbrk":"⎵","bbrktbrk":"⎶","bcong":"≌","Bcy":"Б","bcy":"б","bdquo":"„","becaus":"∵","Because":"∵","because":"∵","bemptyv":"⦰","bepsi":"϶","bernou":"ℬ","Bernoullis":"ℬ","Beta":"Β","beta":"β","beth":"ℶ","between":"≬","Bfr":"𝔅","bfr":"𝔟","bigcap":"⋂","bigcirc":"◯","bigcup":"⋃","bigodot":"⨀","bigoplus":"⨁","bigotimes":"⨂","bigsqcup":"⨆","bigstar":"★","bigtriangledown":"▽","bigtriangleup":"△","biguplus":"⨄","bigvee":"⋁","bigwedge":"⋀","bkarow":"⤍","blacklozenge":"⧫","blacksquare":"▪","blacktriangle":"▴","blacktriangledown":"▾","blacktriangleleft":"◂","blacktriangleright":"▸","blank":"␣","blk12":"▒","blk14":"░","blk34":"▓","block":"█","bne":"=⃥","bnequiv":"≡⃥","bNot":"⫭","bnot":"⌐","Bopf":"𝔹","bopf":"𝕓","bot":"⊥","bottom":"⊥","bowtie":"⋈","boxbox":"⧉","boxDL":"╗","boxDl":"╖","boxdL":"╕","boxdl":"┐","boxDR":"╔","boxDr":"╓","boxdR":"╒","boxdr":"┌","boxH":"═","boxh":"─","boxHD":"╦","boxHd":"╤","boxhD":"╥","boxhd":"┬","boxHU":"╩","boxHu":"╧","boxhU":"╨","boxhu":"┴","boxminus":"⊟","boxplus":"⊞","boxtimes":"⊠","boxUL":"╝","boxUl":"╜","boxuL":"╛","boxul":"┘","boxUR":"╚","boxUr":"╙","boxuR":"╘","boxur":"└","boxV":"║","boxv":"│","boxVH":"╬","boxVh":"╫","boxvH":"╪","boxvh":"┼","boxVL":"╣","boxVl":"╢","boxvL":"╡","boxvl":"┤","boxVR":"╠","boxVr":"╟","boxvR":"╞","boxvr":"├","bprime":"‵","Breve":"˘","breve":"˘","brvbar":"¦","Bscr":"ℬ","bscr":"𝒷","bsemi":"⁏","bsim":"∽","bsime":"⋍","bsol":"\\","bsolb":"⧅","bsolhsub":"⟈","bull":"•","bullet":"•","bump":"≎","bumpE":"⪮","bumpe":"≏","Bumpeq":"≎","bumpeq":"≏","Cacute":"Ć","cacute":"ć","Cap":"⋒","cap":"∩","capand":"⩄","capbrcup":"⩉","capcap":"⩋","capcup":"⩇","capdot":"⩀","CapitalDifferentialD":"ⅅ","caps":"∩︀","caret":"⁁","caron":"ˇ","Cayleys":"ℭ","ccaps":"⩍","Ccaron":"Č","ccaron":"č","Ccedil":"Ç","ccedil":"ç","Ccirc":"Ĉ","ccirc":"ĉ","Cconint":"∰","ccups":"⩌","ccupssm":"⩐","Cdot":"Ċ","cdot":"ċ","cedil":"¸","Cedilla":"¸","cemptyv":"⦲","cent":"¢","CenterDot":"·","centerdot":"·","Cfr":"ℭ","cfr":"𝔠","CHcy":"Ч","chcy":"ч","check":"✓","checkmark":"✓","Chi":"Χ","chi":"χ","cir":"○","circ":"ˆ","circeq":"≗","circlearrowleft":"↺","circlearrowright":"↻","circledast":"⊛","circledcirc":"⊚","circleddash":"⊝","CircleDot":"⊙","circledR":"®","circledS":"Ⓢ","CircleMinus":"⊖","CirclePlus":"⊕","CircleTimes":"⊗","cirE":"⧃","cire":"≗","cirfnint":"⨐","cirmid":"⫯","cirscir":"⧂","ClockwiseContourIntegral":"∲","CloseCurlyDoubleQuote":"”","CloseCurlyQuote":"’","clubs":"♣","clubsuit":"♣","Colon":"∷","colon":":","Colone":"⩴","colone":"≔","coloneq":"≔","comma":",","commat":"@","comp":"∁","compfn":"∘","complement":"∁","complexes":"ℂ","cong":"≅","congdot":"⩭","Congruent":"≡","Conint":"∯","conint":"∮","ContourIntegral":"∮","Copf":"ℂ","copf":"𝕔","coprod":"∐","Coproduct":"∐","COPY":"©","copy":"©","copysr":"℗","CounterClockwiseContourIntegral":"∳","crarr":"↵","Cross":"⨯","cross":"✗","Cscr":"𝒞","cscr":"𝒸","csub":"⫏","csube":"⫑","csup":"⫐","csupe":"⫒","ctdot":"⋯","cudarrl":"⤸","cudarrr":"⤵","cuepr":"⋞","cuesc":"⋟","cularr":"↶","cularrp":"⤽","Cup":"⋓","cup":"∪","cupbrcap":"⩈","CupCap":"≍","cupcap":"⩆","cupcup":"⩊","cupdot":"⊍","cupor":"⩅","cups":"∪︀","curarr":"↷","curarrm":"⤼","curlyeqprec":"⋞","curlyeqsucc":"⋟","curlyvee":"⋎","curlywedge":"⋏","curren":"¤","curvearrowleft":"↶","curvearrowright":"↷","cuvee":"⋎","cuwed":"⋏","cwconint":"∲","cwint":"∱","cylcty":"⌭","Dagger":"‡","dagger":"†","daleth":"ℸ","Darr":"↡","dArr":"⇓","darr":"↓","dash":"‐","Dashv":"⫤","dashv":"⊣","dbkarow":"⤏","dblac":"˝","Dcaron":"Ď","dcaron":"ď","Dcy":"Д","dcy":"д","DD":"ⅅ","dd":"ⅆ","ddagger":"‡","ddarr":"⇊","DDotrahd":"⤑","ddotseq":"⩷","deg":"°","Del":"∇","Delta":"Δ","delta":"δ","demptyv":"⦱","dfisht":"⥿","Dfr":"𝔇","dfr":"𝔡","dHar":"⥥","dharl":"⇃","dharr":"⇂","DiacriticalAcute":"´","DiacriticalDot":"˙","DiacriticalDoubleAcute":"˝","DiacriticalGrave":"`","DiacriticalTilde":"˜","diam":"⋄","Diamond":"⋄","diamond":"⋄","diamondsuit":"♦","diams":"♦","die":"¨","DifferentialD":"ⅆ","digamma":"ϝ","disin":"⋲","div":"÷","divide":"÷","divideontimes":"⋇","divonx":"⋇","DJcy":"Ђ","djcy":"ђ","dlcorn":"⌞","dlcrop":"⌍","dollar":"$","Dopf":"𝔻","dopf":"𝕕","Dot":"¨","dot":"˙","DotDot":"⃜","doteq":"≐","doteqdot":"≑","DotEqual":"≐","dotminus":"∸","dotplus":"∔","dotsquare":"⊡","doublebarwedge":"⌆","DoubleContourIntegral":"∯","DoubleDot":"¨","DoubleDownArrow":"⇓","DoubleLeftArrow":"⇐","DoubleLeftRightArrow":"⇔","DoubleLeftTee":"⫤","DoubleLongLeftArrow":"⟸","DoubleLongLeftRightArrow":"⟺","DoubleLongRightArrow":"⟹","DoubleRightArrow":"⇒","DoubleRightTee":"⊨","DoubleUpArrow":"⇑","DoubleUpDownArrow":"⇕","DoubleVerticalBar":"∥","DownArrow":"↓","Downarrow":"⇓","downarrow":"↓","DownArrowBar":"⤓","DownArrowUpArrow":"⇵","DownBreve":"̑","downdownarrows":"⇊","downharpoonleft":"⇃","downharpoonright":"⇂","DownLeftRightVector":"⥐","DownLeftTeeVector":"⥞","DownLeftVector":"↽","DownLeftVectorBar":"⥖","DownRightTeeVector":"⥟","DownRightVector":"⇁","DownRightVectorBar":"⥗","DownTee":"⊤","DownTeeArrow":"↧","drbkarow":"⤐","drcorn":"⌟","drcrop":"⌌","Dscr":"𝒟","dscr":"𝒹","DScy":"Ѕ","dscy":"ѕ","dsol":"⧶","Dstrok":"Đ","dstrok":"đ","dtdot":"⋱","dtri":"▿","dtrif":"▾","duarr":"⇵","duhar":"⥯","dwangle":"⦦","DZcy":"Џ","dzcy":"џ","dzigrarr":"⟿","Eacute":"É","eacute":"é","easter":"⩮","Ecaron":"Ě","ecaron":"ě","ecir":"≖","Ecirc":"Ê","ecirc":"ê","ecolon":"≕","Ecy":"Э","ecy":"э","eDDot":"⩷","Edot":"Ė","eDot":"≑","edot":"ė","ee":"ⅇ","efDot":"≒","Efr":"𝔈","efr":"𝔢","eg":"⪚","Egrave":"È","egrave":"è","egs":"⪖","egsdot":"⪘","el":"⪙","Element":"∈","elinters":"⏧","ell":"ℓ","els":"⪕","elsdot":"⪗","Emacr":"Ē","emacr":"ē","empty":"∅","emptyset":"∅","EmptySmallSquare":"◻","emptyv":"∅","EmptyVerySmallSquare":"▫","emsp":" ","emsp13":" ","emsp14":" ","ENG":"Ŋ","eng":"ŋ","ensp":" ","Eogon":"Ę","eogon":"ę","Eopf":"𝔼","eopf":"𝕖","epar":"⋕","eparsl":"⧣","eplus":"⩱","epsi":"ε","Epsilon":"Ε","epsilon":"ε","epsiv":"ϵ","eqcirc":"≖","eqcolon":"≕","eqsim":"≂","eqslantgtr":"⪖","eqslantless":"⪕","Equal":"⩵","equals":"=","EqualTilde":"≂","equest":"≟","Equilibrium":"⇌","equiv":"≡","equivDD":"⩸","eqvparsl":"⧥","erarr":"⥱","erDot":"≓","Escr":"ℰ","escr":"ℯ","esdot":"≐","Esim":"⩳","esim":"≂","Eta":"Η","eta":"η","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","euro":"€","excl":"!","exist":"∃","Exists":"∃","expectation":"ℰ","ExponentialE":"ⅇ","exponentiale":"ⅇ","fallingdotseq":"≒","Fcy":"Ф","fcy":"ф","female":"♀","ffilig":"ffi","fflig":"ff","ffllig":"ffl","Ffr":"𝔉","ffr":"𝔣","filig":"fi","FilledSmallSquare":"◼","FilledVerySmallSquare":"▪","fjlig":"fj","flat":"♭","fllig":"fl","fltns":"▱","fnof":"ƒ","Fopf":"𝔽","fopf":"𝕗","ForAll":"∀","forall":"∀","fork":"⋔","forkv":"⫙","Fouriertrf":"ℱ","fpartint":"⨍","frac12":"½","frac13":"⅓","frac14":"¼","frac15":"⅕","frac16":"⅙","frac18":"⅛","frac23":"⅔","frac25":"⅖","frac34":"¾","frac35":"⅗","frac38":"⅜","frac45":"⅘","frac56":"⅚","frac58":"⅝","frac78":"⅞","frasl":"⁄","frown":"⌢","Fscr":"ℱ","fscr":"𝒻","gacute":"ǵ","Gamma":"Γ","gamma":"γ","Gammad":"Ϝ","gammad":"ϝ","gap":"⪆","Gbreve":"Ğ","gbreve":"ğ","Gcedil":"Ģ","Gcirc":"Ĝ","gcirc":"ĝ","Gcy":"Г","gcy":"г","Gdot":"Ġ","gdot":"ġ","gE":"≧","ge":"≥","gEl":"⪌","gel":"⋛","geq":"≥","geqq":"≧","geqslant":"⩾","ges":"⩾","gescc":"⪩","gesdot":"⪀","gesdoto":"⪂","gesdotol":"⪄","gesl":"⋛︀","gesles":"⪔","Gfr":"𝔊","gfr":"𝔤","Gg":"⋙","gg":"≫","ggg":"⋙","gimel":"ℷ","GJcy":"Ѓ","gjcy":"ѓ","gl":"≷","gla":"⪥","glE":"⪒","glj":"⪤","gnap":"⪊","gnapprox":"⪊","gnE":"≩","gne":"⪈","gneq":"⪈","gneqq":"≩","gnsim":"⋧","Gopf":"𝔾","gopf":"𝕘","grave":"`","GreaterEqual":"≥","GreaterEqualLess":"⋛","GreaterFullEqual":"≧","GreaterGreater":"⪢","GreaterLess":"≷","GreaterSlantEqual":"⩾","GreaterTilde":"≳","Gscr":"𝒢","gscr":"ℊ","gsim":"≳","gsime":"⪎","gsiml":"⪐","GT":">","Gt":"≫","gt":">","gtcc":"⪧","gtcir":"⩺","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","Hacek":"ˇ","hairsp":" ","half":"½","hamilt":"ℋ","HARDcy":"Ъ","hardcy":"ъ","hArr":"⇔","harr":"↔","harrcir":"⥈","harrw":"↭","Hat":"^","hbar":"ℏ","Hcirc":"Ĥ","hcirc":"ĥ","hearts":"♥","heartsuit":"♥","hellip":"…","hercon":"⊹","Hfr":"ℌ","hfr":"𝔥","HilbertSpace":"ℋ","hksearow":"⤥","hkswarow":"⤦","hoarr":"⇿","homtht":"∻","hookleftarrow":"↩","hookrightarrow":"↪","Hopf":"ℍ","hopf":"𝕙","horbar":"―","HorizontalLine":"─","Hscr":"ℋ","hscr":"𝒽","hslash":"ℏ","Hstrok":"Ħ","hstrok":"ħ","HumpDownHump":"≎","HumpEqual":"≏","hybull":"⁃","hyphen":"‐","Iacute":"Í","iacute":"í","ic":"⁣","Icirc":"Î","icirc":"î","Icy":"И","icy":"и","Idot":"İ","IEcy":"Е","iecy":"е","iexcl":"¡","iff":"⇔","Ifr":"ℑ","ifr":"𝔦","Igrave":"Ì","igrave":"ì","ii":"ⅈ","iiiint":"⨌","iiint":"∭","iinfin":"⧜","iiota":"℩","IJlig":"IJ","ijlig":"ij","Im":"ℑ","Imacr":"Ī","imacr":"ī","image":"ℑ","ImaginaryI":"ⅈ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","imof":"⊷","imped":"Ƶ","Implies":"⇒","in":"∈","incare":"℅","infin":"∞","infintie":"⧝","inodot":"ı","Int":"∬","int":"∫","intcal":"⊺","integers":"ℤ","Integral":"∫","intercal":"⊺","Intersection":"⋂","intlarhk":"⨗","intprod":"⨼","InvisibleComma":"⁣","InvisibleTimes":"⁢","IOcy":"Ё","iocy":"ё","Iogon":"Į","iogon":"į","Iopf":"𝕀","iopf":"𝕚","Iota":"Ι","iota":"ι","iprod":"⨼","iquest":"¿","Iscr":"ℐ","iscr":"𝒾","isin":"∈","isindot":"⋵","isinE":"⋹","isins":"⋴","isinsv":"⋳","isinv":"∈","it":"⁢","Itilde":"Ĩ","itilde":"ĩ","Iukcy":"І","iukcy":"і","Iuml":"Ï","iuml":"ï","Jcirc":"Ĵ","jcirc":"ĵ","Jcy":"Й","jcy":"й","Jfr":"𝔍","jfr":"𝔧","jmath":"ȷ","Jopf":"𝕁","jopf":"𝕛","Jscr":"𝒥","jscr":"𝒿","Jsercy":"Ј","jsercy":"ј","Jukcy":"Є","jukcy":"є","Kappa":"Κ","kappa":"κ","kappav":"ϰ","Kcedil":"Ķ","kcedil":"ķ","Kcy":"К","kcy":"к","Kfr":"𝔎","kfr":"𝔨","kgreen":"ĸ","KHcy":"Х","khcy":"х","KJcy":"Ќ","kjcy":"ќ","Kopf":"𝕂","kopf":"𝕜","Kscr":"𝒦","kscr":"𝓀","lAarr":"⇚","Lacute":"Ĺ","lacute":"ĺ","laemptyv":"⦴","lagran":"ℒ","Lambda":"Λ","lambda":"λ","Lang":"⟪","lang":"⟨","langd":"⦑","langle":"⟨","lap":"⪅","Laplacetrf":"ℒ","laquo":"«","Larr":"↞","lArr":"⇐","larr":"←","larrb":"⇤","larrbfs":"⤟","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","lat":"⪫","lAtail":"⤛","latail":"⤙","late":"⪭","lates":"⪭︀","lBarr":"⤎","lbarr":"⤌","lbbrk":"❲","lbrace":"{","lbrack":"[","lbrke":"⦋","lbrksld":"⦏","lbrkslu":"⦍","Lcaron":"Ľ","lcaron":"ľ","Lcedil":"Ļ","lcedil":"ļ","lceil":"⌈","lcub":"{","Lcy":"Л","lcy":"л","ldca":"⤶","ldquo":"“","ldquor":"„","ldrdhar":"⥧","ldrushar":"⥋","ldsh":"↲","lE":"≦","le":"≤","LeftAngleBracket":"⟨","LeftArrow":"←","Leftarrow":"⇐","leftarrow":"←","LeftArrowBar":"⇤","LeftArrowRightArrow":"⇆","leftarrowtail":"↢","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVector":"⇃","LeftDownVectorBar":"⥙","LeftFloor":"⌊","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","LeftRightArrow":"↔","Leftrightarrow":"⇔","leftrightarrow":"↔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","LeftRightVector":"⥎","LeftTee":"⊣","LeftTeeArrow":"↤","LeftTeeVector":"⥚","leftthreetimes":"⋋","LeftTriangle":"⊲","LeftTriangleBar":"⧏","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVector":"↿","LeftUpVectorBar":"⥘","LeftVector":"↼","LeftVectorBar":"⥒","lEg":"⪋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","les":"⩽","lescc":"⪨","lesdot":"⩿","lesdoto":"⪁","lesdotor":"⪃","lesg":"⋚︀","lesges":"⪓","lessapprox":"⪅","lessdot":"⋖","lesseqgtr":"⋚","lesseqqgtr":"⪋","LessEqualGreater":"⋚","LessFullEqual":"≦","LessGreater":"≶","lessgtr":"≶","LessLess":"⪡","lesssim":"≲","LessSlantEqual":"⩽","LessTilde":"≲","lfisht":"⥼","lfloor":"⌊","Lfr":"𝔏","lfr":"𝔩","lg":"≶","lgE":"⪑","lHar":"⥢","lhard":"↽","lharu":"↼","lharul":"⥪","lhblk":"▄","LJcy":"Љ","ljcy":"љ","Ll":"⋘","ll":"≪","llarr":"⇇","llcorner":"⌞","Lleftarrow":"⇚","llhard":"⥫","lltri":"◺","Lmidot":"Ŀ","lmidot":"ŀ","lmoust":"⎰","lmoustache":"⎰","lnap":"⪉","lnapprox":"⪉","lnE":"≨","lne":"⪇","lneq":"⪇","lneqq":"≨","lnsim":"⋦","loang":"⟬","loarr":"⇽","lobrk":"⟦","LongLeftArrow":"⟵","Longleftarrow":"⟸","longleftarrow":"⟵","LongLeftRightArrow":"⟷","Longleftrightarrow":"⟺","longleftrightarrow":"⟷","longmapsto":"⟼","LongRightArrow":"⟶","Longrightarrow":"⟹","longrightarrow":"⟶","looparrowleft":"↫","looparrowright":"↬","lopar":"⦅","Lopf":"𝕃","lopf":"𝕝","loplus":"⨭","lotimes":"⨴","lowast":"∗","lowbar":"_","LowerLeftArrow":"↙","LowerRightArrow":"↘","loz":"◊","lozenge":"◊","lozf":"⧫","lpar":"(","lparlt":"⦓","lrarr":"⇆","lrcorner":"⌟","lrhar":"⇋","lrhard":"⥭","lrm":"‎","lrtri":"⊿","lsaquo":"‹","Lscr":"ℒ","lscr":"𝓁","Lsh":"↰","lsh":"↰","lsim":"≲","lsime":"⪍","lsimg":"⪏","lsqb":"[","lsquo":"‘","lsquor":"‚","Lstrok":"Ł","lstrok":"ł","LT":"<","Lt":"≪","lt":"<","ltcc":"⪦","ltcir":"⩹","ltdot":"⋖","lthree":"⋋","ltimes":"⋉","ltlarr":"⥶","ltquest":"⩻","ltri":"◃","ltrie":"⊴","ltrif":"◂","ltrPar":"⦖","lurdshar":"⥊","luruhar":"⥦","lvertneqq":"≨︀","lvnE":"≨︀","macr":"¯","male":"♂","malt":"✠","maltese":"✠","Map":"⤅","map":"↦","mapsto":"↦","mapstodown":"↧","mapstoleft":"↤","mapstoup":"↥","marker":"▮","mcomma":"⨩","Mcy":"М","mcy":"м","mdash":"—","mDDot":"∺","measuredangle":"∡","MediumSpace":" ","Mellintrf":"ℳ","Mfr":"𝔐","mfr":"𝔪","mho":"℧","micro":"µ","mid":"∣","midast":"*","midcir":"⫰","middot":"·","minus":"−","minusb":"⊟","minusd":"∸","minusdu":"⨪","MinusPlus":"∓","mlcp":"⫛","mldr":"…","mnplus":"∓","models":"⊧","Mopf":"𝕄","mopf":"𝕞","mp":"∓","Mscr":"ℳ","mscr":"𝓂","mstpos":"∾","Mu":"Μ","mu":"μ","multimap":"⊸","mumap":"⊸","nabla":"∇","Nacute":"Ń","nacute":"ń","nang":"∠⃒","nap":"≉","napE":"⩰̸","napid":"≋̸","napos":"ʼn","napprox":"≉","natur":"♮","natural":"♮","naturals":"ℕ","nbsp":" ","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","Ncaron":"Ň","ncaron":"ň","Ncedil":"Ņ","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","Ncy":"Н","ncy":"н","ndash":"–","ne":"≠","nearhk":"⤤","neArr":"⇗","nearr":"↗","nearrow":"↗","nedot":"≐̸","NegativeMediumSpace":"​","NegativeThickSpace":"​","NegativeThinSpace":"​","NegativeVeryThinSpace":"​","nequiv":"≢","nesear":"⤨","nesim":"≂̸","NestedGreaterGreater":"≫","NestedLessLess":"≪","NewLine":"\n","nexist":"∄","nexists":"∄","Nfr":"𝔑","nfr":"𝔫","ngE":"≧̸","nge":"≱","ngeq":"≱","ngeqq":"≧̸","ngeqslant":"⩾̸","nges":"⩾̸","nGg":"⋙̸","ngsim":"≵","nGt":"≫⃒","ngt":"≯","ngtr":"≯","nGtv":"≫̸","nhArr":"⇎","nharr":"↮","nhpar":"⫲","ni":"∋","nis":"⋼","nisd":"⋺","niv":"∋","NJcy":"Њ","njcy":"њ","nlArr":"⇍","nlarr":"↚","nldr":"‥","nlE":"≦̸","nle":"≰","nLeftarrow":"⇍","nleftarrow":"↚","nLeftrightarrow":"⇎","nleftrightarrow":"↮","nleq":"≰","nleqq":"≦̸","nleqslant":"⩽̸","nles":"⩽̸","nless":"≮","nLl":"⋘̸","nlsim":"≴","nLt":"≪⃒","nlt":"≮","nltri":"⋪","nltrie":"⋬","nLtv":"≪̸","nmid":"∤","NoBreak":"⁠","NonBreakingSpace":" ","Nopf":"ℕ","nopf":"𝕟","Not":"⫬","not":"¬","NotCongruent":"≢","NotCupCap":"≭","NotDoubleVerticalBar":"∦","NotElement":"∉","NotEqual":"≠","NotEqualTilde":"≂̸","NotExists":"∄","NotGreater":"≯","NotGreaterEqual":"≱","NotGreaterFullEqual":"≧̸","NotGreaterGreater":"≫̸","NotGreaterLess":"≹","NotGreaterSlantEqual":"⩾̸","NotGreaterTilde":"≵","NotHumpDownHump":"≎̸","NotHumpEqual":"≏̸","notin":"∉","notindot":"⋵̸","notinE":"⋹̸","notinva":"∉","notinvb":"⋷","notinvc":"⋶","NotLeftTriangle":"⋪","NotLeftTriangleBar":"⧏̸","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangle":"⋫","NotRightTriangleBar":"⧐̸","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","npar":"∦","nparallel":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","npre":"⪯̸","nprec":"⊀","npreceq":"⪯̸","nrArr":"⇏","nrarr":"↛","nrarrc":"⤳̸","nrarrw":"↝̸","nRightarrow":"⇏","nrightarrow":"↛","nrtri":"⋫","nrtrie":"⋭","nsc":"⊁","nsccue":"⋡","nsce":"⪰̸","Nscr":"𝒩","nscr":"𝓃","nshortmid":"∤","nshortparallel":"∦","nsim":"≁","nsime":"≄","nsimeq":"≄","nsmid":"∤","nspar":"∦","nsqsube":"⋢","nsqsupe":"⋣","nsub":"⊄","nsubE":"⫅̸","nsube":"⊈","nsubset":"⊂⃒","nsubseteq":"⊈","nsubseteqq":"⫅̸","nsucc":"⊁","nsucceq":"⪰̸","nsup":"⊅","nsupE":"⫆̸","nsupe":"⊉","nsupset":"⊃⃒","nsupseteq":"⊉","nsupseteqq":"⫆̸","ntgl":"≹","Ntilde":"Ñ","ntilde":"ñ","ntlg":"≸","ntriangleleft":"⋪","ntrianglelefteq":"⋬","ntriangleright":"⋫","ntrianglerighteq":"⋭","Nu":"Ν","nu":"ν","num":"#","numero":"№","numsp":" ","nvap":"≍⃒","nVDash":"⊯","nVdash":"⊮","nvDash":"⊭","nvdash":"⊬","nvge":"≥⃒","nvgt":">⃒","nvHarr":"⤄","nvinfin":"⧞","nvlArr":"⤂","nvle":"≤⃒","nvlt":"<⃒","nvltrie":"⊴⃒","nvrArr":"⤃","nvrtrie":"⊵⃒","nvsim":"∼⃒","nwarhk":"⤣","nwArr":"⇖","nwarr":"↖","nwarrow":"↖","nwnear":"⤧","Oacute":"Ó","oacute":"ó","oast":"⊛","ocir":"⊚","Ocirc":"Ô","ocirc":"ô","Ocy":"О","ocy":"о","odash":"⊝","Odblac":"Ő","odblac":"ő","odiv":"⨸","odot":"⊙","odsold":"⦼","OElig":"Œ","oelig":"œ","ofcir":"⦿","Ofr":"𝔒","ofr":"𝔬","ogon":"˛","Ograve":"Ò","ograve":"ò","ogt":"⧁","ohbar":"⦵","ohm":"Ω","oint":"∮","olarr":"↺","olcir":"⦾","olcross":"⦻","oline":"‾","olt":"⧀","Omacr":"Ō","omacr":"ō","Omega":"Ω","omega":"ω","Omicron":"Ο","omicron":"ο","omid":"⦶","ominus":"⊖","Oopf":"𝕆","oopf":"𝕠","opar":"⦷","OpenCurlyDoubleQuote":"“","OpenCurlyQuote":"‘","operp":"⦹","oplus":"⊕","Or":"⩔","or":"∨","orarr":"↻","ord":"⩝","order":"ℴ","orderof":"ℴ","ordf":"ª","ordm":"º","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oS":"Ⓢ","Oscr":"𝒪","oscr":"ℴ","Oslash":"Ø","oslash":"ø","osol":"⊘","Otilde":"Õ","otilde":"õ","Otimes":"⨷","otimes":"⊗","otimesas":"⨶","Ouml":"Ö","ouml":"ö","ovbar":"⌽","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","par":"∥","para":"¶","parallel":"∥","parsim":"⫳","parsl":"⫽","part":"∂","PartialD":"∂","Pcy":"П","pcy":"п","percnt":"%","period":".","permil":"‰","perp":"⊥","pertenk":"‱","Pfr":"𝔓","pfr":"𝔭","Phi":"Φ","phi":"φ","phiv":"ϕ","phmmat":"ℳ","phone":"☎","Pi":"Π","pi":"π","pitchfork":"⋔","piv":"ϖ","planck":"ℏ","planckh":"ℎ","plankv":"ℏ","plus":"+","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plusdo":"∔","plusdu":"⨥","pluse":"⩲","PlusMinus":"±","plusmn":"±","plussim":"⨦","plustwo":"⨧","pm":"±","Poincareplane":"ℌ","pointint":"⨕","Popf":"ℙ","popf":"𝕡","pound":"£","Pr":"⪻","pr":"≺","prap":"⪷","prcue":"≼","prE":"⪳","pre":"⪯","prec":"≺","precapprox":"⪷","preccurlyeq":"≼","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","precsim":"≾","Prime":"″","prime":"′","primes":"ℙ","prnap":"⪹","prnE":"⪵","prnsim":"⋨","prod":"∏","Product":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","Proportion":"∷","Proportional":"∝","propto":"∝","prsim":"≾","prurel":"⊰","Pscr":"𝒫","pscr":"𝓅","Psi":"Ψ","psi":"ψ","puncsp":" ","Qfr":"𝔔","qfr":"𝔮","qint":"⨌","Qopf":"ℚ","qopf":"𝕢","qprime":"⁗","Qscr":"𝒬","qscr":"𝓆","quaternions":"ℍ","quatint":"⨖","quest":"?","questeq":"≟","QUOT":"\"","quot":"\"","rAarr":"⇛","race":"∽̱","Racute":"Ŕ","racute":"ŕ","radic":"√","raemptyv":"⦳","Rang":"⟫","rang":"⟩","rangd":"⦒","range":"⦥","rangle":"⟩","raquo":"»","Rarr":"↠","rArr":"⇒","rarr":"→","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarrfs":"⤞","rarrhk":"↪","rarrlp":"↬","rarrpl":"⥅","rarrsim":"⥴","Rarrtl":"⤖","rarrtl":"↣","rarrw":"↝","rAtail":"⤜","ratail":"⤚","ratio":"∶","rationals":"ℚ","RBarr":"⤐","rBarr":"⤏","rbarr":"⤍","rbbrk":"❳","rbrace":"}","rbrack":"]","rbrke":"⦌","rbrksld":"⦎","rbrkslu":"⦐","Rcaron":"Ř","rcaron":"ř","Rcedil":"Ŗ","rcedil":"ŗ","rceil":"⌉","rcub":"}","Rcy":"Р","rcy":"р","rdca":"⤷","rdldhar":"⥩","rdquo":"”","rdquor":"”","rdsh":"↳","Re":"ℜ","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","rect":"▭","REG":"®","reg":"®","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","rfisht":"⥽","rfloor":"⌋","Rfr":"ℜ","rfr":"𝔯","rHar":"⥤","rhard":"⇁","rharu":"⇀","rharul":"⥬","Rho":"Ρ","rho":"ρ","rhov":"ϱ","RightAngleBracket":"⟩","RightArrow":"→","Rightarrow":"⇒","rightarrow":"→","RightArrowBar":"⇥","RightArrowLeftArrow":"⇄","rightarrowtail":"↣","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVector":"⇂","RightDownVectorBar":"⥕","RightFloor":"⌋","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","RightTee":"⊢","RightTeeArrow":"↦","RightTeeVector":"⥛","rightthreetimes":"⋌","RightTriangle":"⊳","RightTriangleBar":"⧐","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVector":"↾","RightUpVectorBar":"⥔","RightVector":"⇀","RightVectorBar":"⥓","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"‏","rmoust":"⎱","rmoustache":"⎱","rnmid":"⫮","roang":"⟭","roarr":"⇾","robrk":"⟧","ropar":"⦆","Ropf":"ℝ","ropf":"𝕣","roplus":"⨮","rotimes":"⨵","RoundImplies":"⥰","rpar":")","rpargt":"⦔","rppolint":"⨒","rrarr":"⇉","Rrightarrow":"⇛","rsaquo":"›","Rscr":"ℛ","rscr":"𝓇","Rsh":"↱","rsh":"↱","rsqb":"]","rsquo":"’","rsquor":"’","rthree":"⋌","rtimes":"⋊","rtri":"▹","rtrie":"⊵","rtrif":"▸","rtriltri":"⧎","RuleDelayed":"⧴","ruluhar":"⥨","rx":"℞","Sacute":"Ś","sacute":"ś","sbquo":"‚","Sc":"⪼","sc":"≻","scap":"⪸","Scaron":"Š","scaron":"š","sccue":"≽","scE":"⪴","sce":"⪰","Scedil":"Ş","scedil":"ş","Scirc":"Ŝ","scirc":"ŝ","scnap":"⪺","scnE":"⪶","scnsim":"⋩","scpolint":"⨓","scsim":"≿","Scy":"С","scy":"с","sdot":"⋅","sdotb":"⊡","sdote":"⩦","searhk":"⤥","seArr":"⇘","searr":"↘","searrow":"↘","sect":"§","semi":";","seswar":"⤩","setminus":"∖","setmn":"∖","sext":"✶","Sfr":"𝔖","sfr":"𝔰","sfrown":"⌢","sharp":"♯","SHCHcy":"Щ","shchcy":"щ","SHcy":"Ш","shcy":"ш","ShortDownArrow":"↓","ShortLeftArrow":"←","shortmid":"∣","shortparallel":"∥","ShortRightArrow":"→","ShortUpArrow":"↑","shy":"­","Sigma":"Σ","sigma":"σ","sigmaf":"ς","sigmav":"ς","sim":"∼","simdot":"⩪","sime":"≃","simeq":"≃","simg":"⪞","simgE":"⪠","siml":"⪝","simlE":"⪟","simne":"≆","simplus":"⨤","simrarr":"⥲","slarr":"←","SmallCircle":"∘","smallsetminus":"∖","smashp":"⨳","smeparsl":"⧤","smid":"∣","smile":"⌣","smt":"⪪","smte":"⪬","smtes":"⪬︀","SOFTcy":"Ь","softcy":"ь","sol":"/","solb":"⧄","solbar":"⌿","Sopf":"𝕊","sopf":"𝕤","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","Sqrt":"√","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","squ":"□","Square":"□","square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","squarf":"▪","squf":"▪","srarr":"→","Sscr":"𝒮","sscr":"𝓈","ssetmn":"∖","ssmile":"⌣","sstarf":"⋆","Star":"⋆","star":"☆","starf":"★","straightepsilon":"ϵ","straightphi":"ϕ","strns":"¯","Sub":"⋐","sub":"⊂","subdot":"⪽","subE":"⫅","sube":"⊆","subedot":"⫃","submult":"⫁","subnE":"⫋","subne":"⊊","subplus":"⪿","subrarr":"⥹","Subset":"⋐","subset":"⊂","subseteq":"⊆","subseteqq":"⫅","SubsetEqual":"⊆","subsetneq":"⊊","subsetneqq":"⫋","subsim":"⫇","subsub":"⫕","subsup":"⫓","succ":"≻","succapprox":"⪸","succcurlyeq":"≽","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","SuchThat":"∋","Sum":"∑","sum":"∑","sung":"♪","Sup":"⋑","sup":"⊃","sup1":"¹","sup2":"²","sup3":"³","supdot":"⪾","supdsub":"⫘","supE":"⫆","supe":"⊇","supedot":"⫄","Superset":"⊃","SupersetEqual":"⊇","suphsol":"⟉","suphsub":"⫗","suplarr":"⥻","supmult":"⫂","supnE":"⫌","supne":"⊋","supplus":"⫀","Supset":"⋑","supset":"⊃","supseteq":"⊇","supseteqq":"⫆","supsetneq":"⊋","supsetneqq":"⫌","supsim":"⫈","supsub":"⫔","supsup":"⫖","swarhk":"⤦","swArr":"⇙","swarr":"↙","swarrow":"↙","swnwar":"⤪","szlig":"ß","Tab":"\t","target":"⌖","Tau":"Τ","tau":"τ","tbrk":"⎴","Tcaron":"Ť","tcaron":"ť","Tcedil":"Ţ","tcedil":"ţ","Tcy":"Т","tcy":"т","tdot":"⃛","telrec":"⌕","Tfr":"𝔗","tfr":"𝔱","there4":"∴","Therefore":"∴","therefore":"∴","Theta":"Θ","theta":"θ","thetasym":"ϑ","thetav":"ϑ","thickapprox":"≈","thicksim":"∼","ThickSpace":"  ","thinsp":" ","ThinSpace":" ","thkap":"≈","thksim":"∼","THORN":"Þ","thorn":"þ","Tilde":"∼","tilde":"˜","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","times":"×","timesb":"⊠","timesbar":"⨱","timesd":"⨰","tint":"∭","toea":"⤨","top":"⊤","topbot":"⌶","topcir":"⫱","Topf":"𝕋","topf":"𝕥","topfork":"⫚","tosa":"⤩","tprime":"‴","TRADE":"™","trade":"™","triangle":"▵","triangledown":"▿","triangleleft":"◃","trianglelefteq":"⊴","triangleq":"≜","triangleright":"▹","trianglerighteq":"⊵","tridot":"◬","trie":"≜","triminus":"⨺","TripleDot":"⃛","triplus":"⨹","trisb":"⧍","tritime":"⨻","trpezium":"⏢","Tscr":"𝒯","tscr":"𝓉","TScy":"Ц","tscy":"ц","TSHcy":"Ћ","tshcy":"ћ","Tstrok":"Ŧ","tstrok":"ŧ","twixt":"≬","twoheadleftarrow":"↞","twoheadrightarrow":"↠","Uacute":"Ú","uacute":"ú","Uarr":"↟","uArr":"⇑","uarr":"↑","Uarrocir":"⥉","Ubrcy":"Ў","ubrcy":"ў","Ubreve":"Ŭ","ubreve":"ŭ","Ucirc":"Û","ucirc":"û","Ucy":"У","ucy":"у","udarr":"⇅","Udblac":"Ű","udblac":"ű","udhar":"⥮","ufisht":"⥾","Ufr":"𝔘","ufr":"𝔲","Ugrave":"Ù","ugrave":"ù","uHar":"⥣","uharl":"↿","uharr":"↾","uhblk":"▀","ulcorn":"⌜","ulcorner":"⌜","ulcrop":"⌏","ultri":"◸","Umacr":"Ū","umacr":"ū","uml":"¨","UnderBar":"_","UnderBrace":"⏟","UnderBracket":"⎵","UnderParenthesis":"⏝","Union":"⋃","UnionPlus":"⊎","Uogon":"Ų","uogon":"ų","Uopf":"𝕌","uopf":"𝕦","UpArrow":"↑","Uparrow":"⇑","uparrow":"↑","UpArrowBar":"⤒","UpArrowDownArrow":"⇅","UpDownArrow":"↕","Updownarrow":"⇕","updownarrow":"↕","UpEquilibrium":"⥮","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","UpperLeftArrow":"↖","UpperRightArrow":"↗","Upsi":"ϒ","upsi":"υ","upsih":"ϒ","Upsilon":"Υ","upsilon":"υ","UpTee":"⊥","UpTeeArrow":"↥","upuparrows":"⇈","urcorn":"⌝","urcorner":"⌝","urcrop":"⌎","Uring":"Ů","uring":"ů","urtri":"◹","Uscr":"𝒰","uscr":"𝓊","utdot":"⋰","Utilde":"Ũ","utilde":"ũ","utri":"▵","utrif":"▴","uuarr":"⇈","Uuml":"Ü","uuml":"ü","uwangle":"⦧","vangrt":"⦜","varepsilon":"ϵ","varkappa":"ϰ","varnothing":"∅","varphi":"ϕ","varpi":"ϖ","varpropto":"∝","vArr":"⇕","varr":"↕","varrho":"ϱ","varsigma":"ς","varsubsetneq":"⊊︀","varsubsetneqq":"⫋︀","varsupsetneq":"⊋︀","varsupsetneqq":"⫌︀","vartheta":"ϑ","vartriangleleft":"⊲","vartriangleright":"⊳","Vbar":"⫫","vBar":"⫨","vBarv":"⫩","Vcy":"В","vcy":"в","VDash":"⊫","Vdash":"⊩","vDash":"⊨","vdash":"⊢","Vdashl":"⫦","Vee":"⋁","vee":"∨","veebar":"⊻","veeeq":"≚","vellip":"⋮","Verbar":"‖","verbar":"|","Vert":"‖","vert":"|","VerticalBar":"∣","VerticalLine":"|","VerticalSeparator":"❘","VerticalTilde":"≀","VeryThinSpace":" ","Vfr":"𝔙","vfr":"𝔳","vltri":"⊲","vnsub":"⊂⃒","vnsup":"⊃⃒","Vopf":"𝕍","vopf":"𝕧","vprop":"∝","vrtri":"⊳","Vscr":"𝒱","vscr":"𝓋","vsubnE":"⫋︀","vsubne":"⊊︀","vsupnE":"⫌︀","vsupne":"⊋︀","Vvdash":"⊪","vzigzag":"⦚","Wcirc":"Ŵ","wcirc":"ŵ","wedbar":"⩟","Wedge":"⋀","wedge":"∧","wedgeq":"≙","weierp":"℘","Wfr":"𝔚","wfr":"𝔴","Wopf":"𝕎","wopf":"𝕨","wp":"℘","wr":"≀","wreath":"≀","Wscr":"𝒲","wscr":"𝓌","xcap":"⋂","xcirc":"◯","xcup":"⋃","xdtri":"▽","Xfr":"𝔛","xfr":"𝔵","xhArr":"⟺","xharr":"⟷","Xi":"Ξ","xi":"ξ","xlArr":"⟸","xlarr":"⟵","xmap":"⟼","xnis":"⋻","xodot":"⨀","Xopf":"𝕏","xopf":"𝕩","xoplus":"⨁","xotime":"⨂","xrArr":"⟹","xrarr":"⟶","Xscr":"𝒳","xscr":"𝓍","xsqcup":"⨆","xuplus":"⨄","xutri":"△","xvee":"⋁","xwedge":"⋀","Yacute":"Ý","yacute":"ý","YAcy":"Я","yacy":"я","Ycirc":"Ŷ","ycirc":"ŷ","Ycy":"Ы","ycy":"ы","yen":"¥","Yfr":"𝔜","yfr":"𝔶","YIcy":"Ї","yicy":"ї","Yopf":"𝕐","yopf":"𝕪","Yscr":"𝒴","yscr":"𝓎","YUcy":"Ю","yucy":"ю","Yuml":"Ÿ","yuml":"ÿ","Zacute":"Ź","zacute":"ź","Zcaron":"Ž","zcaron":"ž","Zcy":"З","zcy":"з","Zdot":"Ż","zdot":"ż","zeetrf":"ℨ","ZeroWidthSpace":"​","Zeta":"Ζ","zeta":"ζ","Zfr":"ℨ","zfr":"𝔷","ZHcy":"Ж","zhcy":"ж","zigrarr":"⇝","Zopf":"ℤ","zopf":"𝕫","Zscr":"𝒵","zscr":"𝓏","zwj":"‍","zwnj":"‌"}
diff --git a/parser_tests.coffee b/parser_tests.coffee
new file mode 100644 (file)
index 0000000..5cc99bf
--- /dev/null
@@ -0,0 +1,8019 @@
+# Copyright (c) 2006-2015 Jason Woofenden, James Graham, Geoffrey Sneddon, and
+# other contributors
+#
+# The values in the following data structure were extracted from the project at
+# https://github.com/html5lib/html5lib-tests which has the following notice:
+#
+# Copyright (c) 2006-2013 James Graham, Geoffrey Sneddon, and
+# other contributors
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be
+# included in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# The rest of this file was written by Jason Woofenden in 2015-2016, and is
+# released under the terms of the CC0 license:
+# http://creativecommons.org/publicdomain/zero/1.0/ and into the public domain
+
+tests = [
+       {
+               name: "adoption01.dat #1"
+               html: "<a><p></a></p>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|     <p>\n|       <a>\n"
+       }, {
+               name: "adoption01.dat #2"
+               html: "<a>1<p>2</a>3</p>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       \"1\"\n|     <p>\n|       <a>\n|         \"2\"\n|       \"3\"\n"
+       }, {
+               name: "adoption01.dat #3"
+               html: "<a>1<button>2</a>3</button>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       \"1\"\n|     <button>\n|       <a>\n|         \"2\"\n|       \"3\"\n"
+       }, {
+               name: "adoption01.dat #4"
+               html: "<a>1<b>2</a>3</b>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       \"1\"\n|       <b>\n|         \"2\"\n|     <b>\n|       \"3\"\n"
+       }, {
+               name: "adoption01.dat #5"
+               html: "<a>1<div>2<div>3</a>4</div>5</div>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       \"1\"\n|     <div>\n|       <a>\n|         \"2\"\n|       <div>\n|         <a>\n|           \"3\"\n|         \"4\"\n|       \"5\"\n"
+       }, {
+               name: "adoption01.dat #6"
+               html: "<table><a>1<p>2</a>3</p>"
+               errors: 10
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       \"1\"\n|     <p>\n|       <a>\n|         \"2\"\n|       \"3\"\n|     <table>\n"
+       }, {
+               name: "adoption01.dat #7"
+               html: "<b><b><a><p></a>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <b>\n|         <a>\n|         <p>\n|           <a>\n"
+       }, {
+               name: "adoption01.dat #8"
+               html: "<b><a><b><p></a>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <a>\n|         <b>\n|       <b>\n|         <p>\n|           <a>\n"
+       }, {
+               name: "adoption01.dat #9"
+               html: "<a><b><b><p></a>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <b>\n|         <b>\n|     <b>\n|       <b>\n|         <p>\n|           <a>\n"
+       }, {
+               name: "adoption01.dat #10"
+               html: "<p>1<s id=\"A\">2<b id=\"B\">3</p>4</s>5</b>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       \"1\"\n|       <s>\n|         id=\"A\"\n|         \"2\"\n|         <b>\n|           id=\"B\"\n|           \"3\"\n|     <s>\n|       id=\"A\"\n|       <b>\n|         id=\"B\"\n|         \"4\"\n|     <b>\n|       id=\"B\"\n|       \"5\"\n"
+       }, {
+               name: "adoption01.dat #11"
+               html: "<table><a>1<td>2</td>3</table>"
+               errors: 5
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       \"1\"\n|     <a>\n|       \"3\"\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"2\"\n"
+       }, {
+               name: "adoption01.dat #12"
+               html: "<table>A<td>B</td>C</table>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"AC\"\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"B\"\n"
+       }, {
+               name: "adoption01.dat #13"
+               html: "<a><svg><tr><input></a>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <svg svg>\n|         <svg tr>\n|           <svg input>\n"
+       }, {
+               name: "adoption01.dat #14"
+               html: "<div><a><b><div><div><div><div><div><div><div><div><div><div></a>"
+               errors: 10
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <a>\n|         <b>\n|       <b>\n|         <div>\n|           <a>\n|           <div>\n|             <a>\n|             <div>\n|               <a>\n|               <div>\n|                 <a>\n|                 <div>\n|                   <a>\n|                   <div>\n|                     <a>\n|                     <div>\n|                       <a>\n|                       <div>\n|                         <a>\n|                           <div>\n|                             <div>\n"
+       }, {
+               name: "adoption01.dat #15"
+               html: "<div><a><b><u><i><code><div></a>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <a>\n|         <b>\n|           <u>\n|             <i>\n|               <code>\n|       <u>\n|         <i>\n|           <code>\n|             <div>\n|               <a>\n"
+       }, {
+               name: "adoption01.dat #16"
+               html: "<b><b><b><b>x</b></b></b></b>y"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <b>\n|         <b>\n|           <b>\n|             \"x\"\n|     \"y\"\n"
+       }, {
+               name: "adoption01.dat #17"
+               html: "<p><b><b><b><b><p>x"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <b>\n|         <b>\n|           <b>\n|             <b>\n|     <p>\n|       <b>\n|         <b>\n|           <b>\n|             \"x\"\n"
+       }, {
+               name: "adoption02.dat #1"
+               html: "<b>1<i>2<p>3</b>4"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       \"1\"\n|       <i>\n|         \"2\"\n|     <i>\n|       <p>\n|         <b>\n|           \"3\"\n|         \"4\"\n"
+       }, {
+               name: "adoption02.dat #2"
+               html: "<a><div><style></style><address><a>"
+               errors: 5
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|     <div>\n|       <a>\n|         <style>\n|       <address>\n|         <a>\n|         <a>\n"
+       }, {
+               name: "comments01.dat #1"
+               html: "FOO<!-- BAR -->BAZ"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <!--  BAR  -->\n|     \"BAZ\"\n"
+       }, {
+               name: "comments01.dat #2"
+               html: "FOO<!-- BAR --!>BAZ"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <!--  BAR  -->\n|     \"BAZ\"\n"
+       }, {
+               name: "comments01.dat #3"
+               html: "FOO<!-- BAR --   >BAZ"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <!--  BAR --   >BAZ -->\n"
+       }, {
+               name: "comments01.dat #4"
+               html: "FOO<!-- BAR -- <QUX> -- MUX -->BAZ"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <!--  BAR -- <QUX> -- MUX  -->\n|     \"BAZ\"\n"
+       }, {
+               name: "comments01.dat #5"
+               html: "FOO<!-- BAR -- <QUX> -- MUX --!>BAZ"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <!--  BAR -- <QUX> -- MUX  -->\n|     \"BAZ\"\n"
+       }, {
+               name: "comments01.dat #6"
+               html: "FOO<!-- BAR -- <QUX> -- MUX -- >BAZ"
+               errors: 5
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <!--  BAR -- <QUX> -- MUX -- >BAZ -->\n"
+       }, {
+               name: "comments01.dat #7"
+               html: "FOO<!---->BAZ"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <!--  -->\n|     \"BAZ\"\n"
+       }, {
+               name: "comments01.dat #8"
+               html: "FOO<!--->BAZ"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <!--  -->\n|     \"BAZ\"\n"
+       }, {
+               name: "comments01.dat #9"
+               html: "FOO<!-->BAZ"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <!--  -->\n|     \"BAZ\"\n"
+       }, {
+               name: "comments01.dat #10"
+               html: "<?xml version=\"1.0\">Hi"
+               errors: 2
+               expected: "| <!-- ?xml version=\"1.0\" -->\n| <html>\n|   <head>\n|   <body>\n|     \"Hi\"\n"
+       }, {
+               name: "comments01.dat #11"
+               html: "<?xml version=\"1.0\">"
+               errors: 2
+               expected: "| <!-- ?xml version=\"1.0\" -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "comments01.dat #12"
+               html: "<?xml version"
+               errors: 2
+               expected: "| <!-- ?xml version -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "comments01.dat #13"
+               html: "FOO<!----->BAZ"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <!-- - -->\n|     \"BAZ\"\n"
+       }, {
+               name: "comments01.dat #14"
+               html: "<html><!-- comment --><title>Comment before head</title>"
+               errors: 1
+               expected: "| <html>\n|   <!--  comment  -->\n|   <head>\n|     <title>\n|       \"Comment before head\"\n|   <body>\n"
+       }, {
+               name: "doctype01.dat #1"
+               html: "<!DOCTYPE html>Hello"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #2"
+               html: "<!dOctYpE HtMl>Hello"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #3"
+               html: "<!DOCTYPEhtml>Hello"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #4"
+               html: "<!DOCTYPE>Hello"
+               errors: 3
+               expected: "| <!DOCTYPE >\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #5"
+               html: "<!DOCTYPE >Hello"
+               errors: 2
+               expected: "| <!DOCTYPE >\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #6"
+               html: "<!DOCTYPE potato>Hello"
+               errors: 1
+               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #7"
+               html: "<!DOCTYPE potato >Hello"
+               errors: 1
+               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #8"
+               html: "<!DOCTYPE potato taco>Hello"
+               errors: 2
+               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #9"
+               html: "<!DOCTYPE potato taco \"ddd>Hello"
+               errors: 2
+               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #10"
+               html: "<!DOCTYPE potato sYstEM>Hello"
+               errors: 2
+               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #11"
+               html: "<!DOCTYPE potato sYstEM    >Hello"
+               errors: 2
+               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #12"
+               html: "<!DOCTYPE   potato       sYstEM  ggg>Hello"
+               errors: 2
+               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #13"
+               html: "<!DOCTYPE potato SYSTEM taco  >Hello"
+               errors: 2
+               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #14"
+               html: "<!DOCTYPE potato SYSTEM 'taco\"'>Hello"
+               errors: 1
+               expected: "| <!DOCTYPE potato \"\" \"taco\"\">\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #15"
+               html: "<!DOCTYPE potato SYSTEM \"taco\">Hello"
+               errors: 1
+               expected: "| <!DOCTYPE potato \"\" \"taco\">\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #16"
+               html: "<!DOCTYPE potato SYSTEM \"tai'co\">Hello"
+               errors: 1
+               expected: "| <!DOCTYPE potato \"\" \"tai'co\">\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #17"
+               html: "<!DOCTYPE potato SYSTEMtaco \"ddd\">Hello"
+               errors: 2
+               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #18"
+               html: "<!DOCTYPE potato grass SYSTEM taco>Hello"
+               errors: 2
+               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #19"
+               html: "<!DOCTYPE potato pUbLIc>Hello"
+               errors: 2
+               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #20"
+               html: "<!DOCTYPE potato pUbLIc >Hello"
+               errors: 2
+               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #21"
+               html: "<!DOCTYPE potato pUbLIcgoof>Hello"
+               errors: 2
+               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #22"
+               html: "<!DOCTYPE potato PUBLIC goof>Hello"
+               errors: 2
+               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #23"
+               html: "<!DOCTYPE potato PUBLIC \"go'of\">Hello"
+               errors: 1
+               expected: "| <!DOCTYPE potato \"go'of\" \"\">\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #24"
+               html: "<!DOCTYPE potato PUBLIC 'go'of'>Hello"
+               errors: 2
+               expected: "| <!DOCTYPE potato \"go\" \"\">\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #25"
+               html: "<!DOCTYPE potato PUBLIC 'go:hh   of' >Hello"
+               errors: 1
+               expected: "| <!DOCTYPE potato \"go:hh   of\" \"\">\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #26"
+               html: "<!DOCTYPE potato PUBLIC \"W3C-//dfdf\" SYSTEM ggg>Hello"
+               errors: 2
+               expected: "| <!DOCTYPE potato \"W3C-//dfdf\" \"\">\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #27"
+               html: "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\n   \"http://www.w3.org/TR/html4/strict.dtd\">Hello"
+               expected: "| <!DOCTYPE html \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #28"
+               html: "<!DOCTYPE ...>Hello"
+               errors: 1
+               expected: "| <!DOCTYPE ...>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
+       }, {
+               name: "doctype01.dat #29"
+               html: "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"
+               errors: 1
+               expected: "| <!DOCTYPE html \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "doctype01.dat #30"
+               html: "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">"
+               errors: 1
+               expected: "| <!DOCTYPE html \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "doctype01.dat #31"
+               html: "<!DOCTYPE root-element [SYSTEM OR PUBLIC FPI] \"uri\" [ \n<!-- internal declarations -->\n]>"
+               errors: 2
+               expected: "| <!DOCTYPE root-element>\n| <html>\n|   <head>\n|   <body>\n|     \"]>\"\n"
+       }, {
+               name: "doctype01.dat #32"
+               html: "<!DOCTYPE html PUBLIC\n  \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\"\n    \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">"
+               errors: 1
+               expected: "| <!DOCTYPE html \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "doctype01.dat #33"
+               html: "<!DOCTYPE HTML SYSTEM \"http://www.w3.org/DTD/HTML4-strict.dtd\"><body><b>Mine!</b></body>"
+               errors: 1
+               expected: "| <!DOCTYPE html \"\" \"http://www.w3.org/DTD/HTML4-strict.dtd\">\n| <html>\n|   <head>\n|   <body>\n|     <b>\n|       \"Mine!\"\n"
+       }, {
+               name: "doctype01.dat #34"
+               html: "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\"http://www.w3.org/TR/html4/strict.dtd\">"
+               errors: 1
+               expected: "| <!DOCTYPE html \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "doctype01.dat #35"
+               html: "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"'http://www.w3.org/TR/html4/strict.dtd'>"
+               errors: 1
+               expected: "| <!DOCTYPE html \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "doctype01.dat #36"
+               html: "<!DOCTYPE HTML PUBLIC\"-//W3C//DTD HTML 4.01//EN\"'http://www.w3.org/TR/html4/strict.dtd'>"
+               errors: 2
+               expected: "| <!DOCTYPE html \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "doctype01.dat #37"
+               html: "<!DOCTYPE HTML PUBLIC'-//W3C//DTD HTML 4.01//EN''http://www.w3.org/TR/html4/strict.dtd'>"
+               errors: 2
+               expected: "| <!DOCTYPE html \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #1"
+               html: "<svg><![CDATA[foo\nbar]]>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"foo\nbar\"\n"
+       }, {
+               name: "domjs-unsafe.dat #2"
+               html: "<svg><![CDATA[foo\rbar]]>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"foo\nbar\"\n"
+       }, {
+               name: "domjs-unsafe.dat #3"
+               html: "<svg><![CDATA[foo\r\nbar]]>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"foo\nbar\"\n"
+       }, {
+               name: "domjs-unsafe.dat #4"
+               html: "<script>a='\u0000'</script>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"a='�'\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #5"
+               html: "<script type=\"data\"><!--\u0000</script>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--�\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #6"
+               html: "<script type=\"data\"><!--foo\u0000</script>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--foo�\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #7"
+               html: "<script type=\"data\"><!-- foo-\u0000</script>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!-- foo-�\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #8"
+               html: "<script type=\"data\"><!-- foo--\u0000</script>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!-- foo--�\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #9"
+               html: "<script type=\"data\"><!-- foo-"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!-- foo-\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #10"
+               html: "<script type=\"data\"><!-- foo-<</script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!-- foo-<\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #11"
+               html: "<script type=\"data\"><!-- foo-<S"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!-- foo-<S\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #12"
+               html: "<script type=\"data\"><!-- foo-</SCRIPT>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!-- foo-\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #13"
+               html: "<script type=\"data\"><!--<p></script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--<p>\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #14"
+               html: "<script type=\"data\"><!--<script></script></script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--<script></script>\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #15"
+               html: "<script type=\"data\"><!--<script>\u0000</script></script>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--<script>�</script>\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #16"
+               html: "<script type=\"data\"><!--<script>-\u0000</script></script>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--<script>-�</script>\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #17"
+               html: "<script type=\"data\"><!--<script>--\u0000</script></script>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--<script>--�</script>\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #18"
+               html: "<script type=\"data\"><!--<script>---</script></script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--<script>---</script>\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #19"
+               html: "<script type=\"data\"><!--<script></scrip></SCRIPT></script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--<script></scrip></SCRIPT>\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #20"
+               html: "<script type=\"data\"><!--<script></scrip </SCRIPT></script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--<script></scrip </SCRIPT>\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #21"
+               html: "<script type=\"data\"><!--<script></scrip/</SCRIPT></script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--<script></scrip/</SCRIPT>\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #22"
+               html: "<script type=\"data\"></scrip/></script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"</scrip/>\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #23"
+               html: "<script type=\"data\"></scrip ></script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"</scrip >\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #24"
+               html: "<script type=\"data\"><!--</scrip></script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--</scrip>\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #25"
+               html: "<script type=\"data\"><!--</scrip </script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--</scrip \"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #26"
+               html: "<script type=\"data\"><!--</scrip/</script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--</scrip/\"\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #27"
+               html: "<!DOCTYPE html><!DOCTYPE html>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #28"
+               html: "<html><!DOCTYPE html>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #29"
+               html: "<html><head><!DOCTYPE html></head>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #30"
+               html: "<html><head></head><!DOCTYPE html>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #31"
+               html: "<body></body><!DOCTYPE html>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #32"
+               html: "<table><!DOCTYPE html></table>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n"
+       }, {
+               name: "domjs-unsafe.dat #33"
+               html: "<select><!DOCTYPE html></select>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n"
+       }, {
+               name: "domjs-unsafe.dat #34"
+               html: "<table><colgroup><!DOCTYPE html></colgroup></table>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <colgroup>\n"
+       }, {
+               name: "domjs-unsafe.dat #35"
+               html: "<table><colgroup><!--test--></colgroup></table>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <colgroup>\n|         <!-- test -->\n"
+       }, {
+               name: "domjs-unsafe.dat #36"
+               html: "<table><colgroup><html></colgroup></table>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <colgroup>\n"
+       }, {
+               name: "domjs-unsafe.dat #37"
+               html: "<table><colgroup> foo</colgroup></table>"
+               errors: 5
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"foo\"\n|     <table>\n|       <colgroup>\n|         \" \"\n"
+       }, {
+               name: "domjs-unsafe.dat #38"
+               html: "<select><!--test--></select>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <!-- test -->\n"
+       }, {
+               name: "domjs-unsafe.dat #39"
+               html: "<select><html></select>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n"
+       }, {
+               name: "domjs-unsafe.dat #40"
+               html: "<frameset><html></frameset>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "domjs-unsafe.dat #41"
+               html: "<frameset></frameset><html>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "domjs-unsafe.dat #42"
+               html: "<frameset></frameset><!DOCTYPE html>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "domjs-unsafe.dat #43"
+               html: "<html><body></body></html><!DOCTYPE html>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "domjs-unsafe.dat #44"
+               html: "<svg><!DOCTYPE html></svg>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n"
+       }, {
+               name: "domjs-unsafe.dat #45"
+               html: "<svg><font></font></svg>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg font>\n"
+       }, {
+               name: "domjs-unsafe.dat #46"
+               html: "<svg><font id=foo></font></svg>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg font>\n|         id=\"foo\"\n"
+       }, {
+               name: "domjs-unsafe.dat #47"
+               html: "<svg><font size=4></font></svg>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|     <font>\n|       size=\"4\"\n"
+       }, {
+               name: "domjs-unsafe.dat #48"
+               html: "<svg><font color=red></font></svg>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|     <font>\n|       color=\"red\"\n"
+       }, {
+               name: "domjs-unsafe.dat #49"
+               html: "<svg><font font=sans></font></svg>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg font>\n|         font=\"sans\"\n"
+       }, {
+               name: "entities01.dat #1"
+               html: "FOO&gt;BAR"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO>BAR\"\n"
+       }, {
+               name: "entities01.dat #2"
+               html: "FOO&gtBAR"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO>BAR\"\n"
+       }, {
+               name: "entities01.dat #3"
+               html: "FOO&gt BAR"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO> BAR\"\n"
+       }, {
+               name: "entities01.dat #4"
+               html: "FOO&gt;;;BAR"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO>;;BAR\"\n"
+       }, {
+               name: "entities01.dat #5"
+               html: "I'm &notit; I tell you"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"I'm ¬it; I tell you\"\n"
+       }, {
+               name: "entities01.dat #6"
+               html: "I'm &notin; I tell you"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"I'm ∉ I tell you\"\n"
+       }, {
+               name: "entities01.dat #7"
+               html: "FOO& BAR"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO& BAR\"\n"
+       }, {
+               name: "entities01.dat #8"
+               html: "FOO&<BAR>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO&\"\n|     <bar>\n"
+       }, {
+               name: "entities01.dat #9"
+               html: "FOO&&&&gt;BAR"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO&&&>BAR\"\n"
+       }, {
+               name: "entities01.dat #10"
+               html: "FOO&#41;BAR"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO)BAR\"\n"
+       }, {
+               name: "entities01.dat #11"
+               html: "FOO&#x41;BAR"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOABAR\"\n"
+       }, {
+               name: "entities01.dat #12"
+               html: "FOO&#X41;BAR"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOABAR\"\n"
+       }, {
+               name: "entities01.dat #13"
+               html: "FOO&#BAR"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO&#BAR\"\n"
+       }, {
+               name: "entities01.dat #14"
+               html: "FOO&#ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO&#ZOO\"\n"
+       }, {
+               name: "entities01.dat #15"
+               html: "FOO&#xBAR"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOºR\"\n"
+       }, {
+               name: "entities01.dat #16"
+               html: "FOO&#xZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO&#xZOO\"\n"
+       }, {
+               name: "entities01.dat #17"
+               html: "FOO&#XZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO&#XZOO\"\n"
+       }, {
+               name: "entities01.dat #18"
+               html: "FOO&#41BAR"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO)BAR\"\n"
+       }, {
+               name: "entities01.dat #19"
+               html: "FOO&#x41BAR"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO䆺R\"\n"
+       }, {
+               name: "entities01.dat #20"
+               html: "FOO&#x41ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOAZOO\"\n"
+       }, {
+               name: "entities01.dat #21"
+               html: "FOO&#x0000;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�ZOO\"\n"
+       }, {
+               name: "entities01.dat #22"
+               html: "FOO&#x0078;ZOO"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOxZOO\"\n"
+       }, {
+               name: "entities01.dat #23"
+               html: "FOO&#x0079;ZOO"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOyZOO\"\n"
+       }, {
+               name: "entities01.dat #24"
+               html: "FOO&#x0080;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO€ZOO\"\n"
+       }, {
+               name: "entities01.dat #25"
+               html: "FOO&#x0081;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\81ZOO\"\n"
+       }, {
+               name: "entities01.dat #26"
+               html: "FOO&#x0082;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO‚ZOO\"\n"
+       }, {
+               name: "entities01.dat #27"
+               html: "FOO&#x0083;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOƒZOO\"\n"
+       }, {
+               name: "entities01.dat #28"
+               html: "FOO&#x0084;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO„ZOO\"\n"
+       }, {
+               name: "entities01.dat #29"
+               html: "FOO&#x0085;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO…ZOO\"\n"
+       }, {
+               name: "entities01.dat #30"
+               html: "FOO&#x0086;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO†ZOO\"\n"
+       }, {
+               name: "entities01.dat #31"
+               html: "FOO&#x0087;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO‡ZOO\"\n"
+       }, {
+               name: "entities01.dat #32"
+               html: "FOO&#x0088;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOˆZOO\"\n"
+       }, {
+               name: "entities01.dat #33"
+               html: "FOO&#x0089;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO‰ZOO\"\n"
+       }, {
+               name: "entities01.dat #34"
+               html: "FOO&#x008A;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOŠZOO\"\n"
+       }, {
+               name: "entities01.dat #35"
+               html: "FOO&#x008B;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO‹ZOO\"\n"
+       }, {
+               name: "entities01.dat #36"
+               html: "FOO&#x008C;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOŒZOO\"\n"
+       }, {
+               name: "entities01.dat #37"
+               html: "FOO&#x008D;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\8dZOO\"\n"
+       }, {
+               name: "entities01.dat #38"
+               html: "FOO&#x008E;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOŽZOO\"\n"
+       }, {
+               name: "entities01.dat #39"
+               html: "FOO&#x008F;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\8fZOO\"\n"
+       }, {
+               name: "entities01.dat #40"
+               html: "FOO&#x0090;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\90ZOO\"\n"
+       }, {
+               name: "entities01.dat #41"
+               html: "FOO&#x0091;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO‘ZOO\"\n"
+       }, {
+               name: "entities01.dat #42"
+               html: "FOO&#x0092;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO’ZOO\"\n"
+       }, {
+               name: "entities01.dat #43"
+               html: "FOO&#x0093;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO“ZOO\"\n"
+       }, {
+               name: "entities01.dat #44"
+               html: "FOO&#x0094;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO”ZOO\"\n"
+       }, {
+               name: "entities01.dat #45"
+               html: "FOO&#x0095;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO•ZOO\"\n"
+       }, {
+               name: "entities01.dat #46"
+               html: "FOO&#x0096;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO–ZOO\"\n"
+       }, {
+               name: "entities01.dat #47"
+               html: "FOO&#x0097;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO—ZOO\"\n"
+       }, {
+               name: "entities01.dat #48"
+               html: "FOO&#x0098;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO˜ZOO\"\n"
+       }, {
+               name: "entities01.dat #49"
+               html: "FOO&#x0099;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO™ZOO\"\n"
+       }, {
+               name: "entities01.dat #50"
+               html: "FOO&#x009A;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOšZOO\"\n"
+       }, {
+               name: "entities01.dat #51"
+               html: "FOO&#x009B;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO›ZOO\"\n"
+       }, {
+               name: "entities01.dat #52"
+               html: "FOO&#x009C;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOœZOO\"\n"
+       }, {
+               name: "entities01.dat #53"
+               html: "FOO&#x009D;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\9dZOO\"\n"
+       }, {
+               name: "entities01.dat #54"
+               html: "FOO&#x009E;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOžZOO\"\n"
+       }, {
+               name: "entities01.dat #55"
+               html: "FOO&#x009F;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOŸZOO\"\n"
+       }, {
+               name: "entities01.dat #56"
+               html: "FOO&#x00A0;ZOO"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO ZOO\"\n"
+       }, {
+               name: "entities01.dat #57"
+               html: "FOO&#xD7FF;ZOO"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO퟿ZOO\"\n"
+       }, {
+               name: "entities01.dat #58"
+               html: "FOO&#xD800;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�ZOO\"\n"
+       }, {
+               name: "entities01.dat #59"
+               html: "FOO&#xD801;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�ZOO\"\n"
+       }, {
+               name: "entities01.dat #60"
+               html: "FOO&#xDFFE;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�ZOO\"\n"
+       }, {
+               name: "entities01.dat #61"
+               html: "FOO&#xDFFF;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�ZOO\"\n"
+       }, {
+               name: "entities01.dat #62"
+               html: "FOO&#xE000;ZOO"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOZOO\"\n"
+       }, {
+               name: "entities01.dat #63"
+               html: "FOO&#x10FFFE;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO􏿾ZOO\"\n"
+       }, {
+               name: "entities01.dat #64"
+               html: "FOO&#x1087D4;ZOO"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO􈟔ZOO\"\n"
+       }, {
+               name: "entities01.dat #65"
+               html: "FOO&#x10FFFF;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO􏿿ZOO\"\n"
+       }, {
+               name: "entities01.dat #66"
+               html: "FOO&#x110000;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�ZOO\"\n"
+       }, {
+               name: "entities01.dat #67"
+               html: "FOO&#xFFFFFF;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�ZOO\"\n"
+       }, {
+               name: "entities01.dat #68"
+               html: "FOO&#11111111111"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�\"\n"
+       }, {
+               name: "entities01.dat #69"
+               html: "FOO&#1111111111"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�\"\n"
+       }, {
+               name: "entities01.dat #70"
+               html: "FOO&#111111111111"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�\"\n"
+       }, {
+               name: "entities01.dat #71"
+               html: "FOO&#11111111111ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�ZOO\"\n"
+       }, {
+               name: "entities01.dat #72"
+               html: "FOO&#1111111111ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�ZOO\"\n"
+       }, {
+               name: "entities01.dat #73"
+               html: "FOO&#111111111111ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�ZOO\"\n"
+       }, {
+               name: "entities02.dat #1"
+               html: "<div bar=\"ZZ&gt;YY\"></div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ>YY\"\n"
+       }, {
+               name: "entities02.dat #2"
+               html: "<div bar=\"ZZ&\"></div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&\"\n"
+       }, {
+               name: "entities02.dat #3"
+               html: "<div bar='ZZ&'></div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&\"\n"
+       }, {
+               name: "entities02.dat #4"
+               html: "<div bar=ZZ&></div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&\"\n"
+       }, {
+               name: "entities02.dat #5"
+               html: "<div bar=\"ZZ&gt=YY\"></div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&gt=YY\"\n"
+       }, {
+               name: "entities02.dat #6"
+               html: "<div bar=\"ZZ&gt0YY\"></div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&gt0YY\"\n"
+       }, {
+               name: "entities02.dat #7"
+               html: "<div bar=\"ZZ&gt9YY\"></div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&gt9YY\"\n"
+       }, {
+               name: "entities02.dat #8"
+               html: "<div bar=\"ZZ&gtaYY\"></div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&gtaYY\"\n"
+       }, {
+               name: "entities02.dat #9"
+               html: "<div bar=\"ZZ&gtZYY\"></div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&gtZYY\"\n"
+       }, {
+               name: "entities02.dat #10"
+               html: "<div bar=\"ZZ&gt YY\"></div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ> YY\"\n"
+       }, {
+               name: "entities02.dat #11"
+               html: "<div bar=\"ZZ&gt\"></div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ>\"\n"
+       }, {
+               name: "entities02.dat #12"
+               html: "<div bar='ZZ&gt'></div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ>\"\n"
+       }, {
+               name: "entities02.dat #13"
+               html: "<div bar=ZZ&gt></div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ>\"\n"
+       }, {
+               name: "entities02.dat #14"
+               html: "<div bar=\"ZZ&pound_id=23\"></div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ£_id=23\"\n"
+       }, {
+               name: "entities02.dat #15"
+               html: "<div bar=\"ZZ&prod_id=23\"></div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&prod_id=23\"\n"
+       }, {
+               name: "entities02.dat #16"
+               html: "<div bar=\"ZZ&pound;_id=23\"></div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ£_id=23\"\n"
+       }, {
+               name: "entities02.dat #17"
+               html: "<div bar=\"ZZ&prod;_id=23\"></div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ∏_id=23\"\n"
+       }, {
+               name: "entities02.dat #18"
+               html: "<div bar=\"ZZ&pound=23\"></div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&pound=23\"\n"
+       }, {
+               name: "entities02.dat #19"
+               html: "<div bar=\"ZZ&prod=23\"></div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&prod=23\"\n"
+       }, {
+               name: "entities02.dat #20"
+               html: "<div>ZZ&pound_id=23</div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"ZZ£_id=23\"\n"
+       }, {
+               name: "entities02.dat #21"
+               html: "<div>ZZ&prod_id=23</div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"ZZ&prod_id=23\"\n"
+       }, {
+               name: "entities02.dat #22"
+               html: "<div>ZZ&pound;_id=23</div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"ZZ£_id=23\"\n"
+       }, {
+               name: "entities02.dat #23"
+               html: "<div>ZZ&prod;_id=23</div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"ZZ∏_id=23\"\n"
+       }, {
+               name: "entities02.dat #24"
+               html: "<div>ZZ&pound=23</div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"ZZ£=23\"\n"
+       }, {
+               name: "entities02.dat #25"
+               html: "<div>ZZ&prod=23</div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"ZZ&prod=23\"\n"
+       }, {
+               name: "entities02.dat #26"
+               html: "<div>ZZ&AElig=</div>"
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"ZZÆ=\"\n"
+       }, {
+               name: "foreign-fragment.dat #1"
+               html: "<nobr>X"
+               errors: 3
+               fragment: "svg path"
+               expected: "| <svg nobr>\n|   \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #2"
+               html: "<font color></font>X"
+               errors: 1
+               fragment: "svg path"
+               expected: "| <svg font>\n|   color=\"\"\n| \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #3"
+               html: "<font></font>X"
+               fragment: "svg path"
+               expected: "| <svg font>\n| \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #4"
+               html: "<g></path>X"
+               errors: 3
+               fragment: "svg path"
+               expected: "| <svg g>\n|   \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #5"
+               html: "</path>X"
+               errors: 1
+               fragment: "svg path"
+               expected: "| \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #6"
+               html: "</foreignObject>X"
+               errors: 1
+               fragment: "svg foreignObject"
+               expected: "| \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #7"
+               html: "</desc>X"
+               errors: 1
+               fragment: "svg desc"
+               expected: "| \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #8"
+               html: "</title>X"
+               errors: 1
+               fragment: "svg title"
+               expected: "| \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #9"
+               html: "</svg>X"
+               errors: 1
+               fragment: "svg svg"
+               expected: "| \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #10"
+               html: "</mfenced>X"
+               errors: 1
+               fragment: "math mfenced"
+               expected: "| \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #11"
+               html: "</malignmark>X"
+               errors: 1
+               fragment: "math malignmark"
+               expected: "| \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #12"
+               html: "</math>X"
+               errors: 1
+               fragment: "math math"
+               expected: "| \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #13"
+               html: "</annotation-xml>X"
+               errors: 1
+               fragment: "math annotation-xml"
+               expected: "| \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #14"
+               html: "</mtext>X"
+               errors: 1
+               fragment: "math mtext"
+               expected: "| \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #15"
+               html: "</mi>X"
+               errors: 1
+               fragment: "math mi"
+               expected: "| \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #16"
+               html: "</mo>X"
+               errors: 1
+               fragment: "math mo"
+               expected: "| \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #17"
+               html: "</mn>X"
+               errors: 1
+               fragment: "math mn"
+               expected: "| \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #18"
+               html: "</ms>X"
+               errors: 1
+               fragment: "math ms"
+               expected: "| \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #19"
+               html: "<b></b><mglyph/><i></i><malignmark/><u></u><ms/>X"
+               errors: 3
+               fragment: "math ms"
+               expected: "| <b>\n| <math mglyph>\n| <i>\n| <math malignmark>\n| <u>\n| <ms>\n|   \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #20"
+               html: "<malignmark></malignmark>"
+               fragment: "math ms"
+               expected: "| <math malignmark>\n"
+       }, {
+               name: "foreign-fragment.dat #21"
+               html: "<div></div>"
+               fragment: "math ms"
+               expected: "| <div>\n"
+       }, {
+               name: "foreign-fragment.dat #22"
+               html: "<figure></figure>"
+               fragment: "math ms"
+               expected: "| <figure>\n"
+       }, {
+               name: "foreign-fragment.dat #23"
+               html: "<b></b><mglyph/><i></i><malignmark/><u></u><mn/>X"
+               errors: 3
+               fragment: "math mn"
+               expected: "| <b>\n| <math mglyph>\n| <i>\n| <math malignmark>\n| <u>\n| <mn>\n|   \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #24"
+               html: "<malignmark></malignmark>"
+               fragment: "math mn"
+               expected: "| <math malignmark>\n"
+       }, {
+               name: "foreign-fragment.dat #25"
+               html: "<div></div>"
+               fragment: "math mn"
+               expected: "| <div>\n"
+       }, {
+               name: "foreign-fragment.dat #26"
+               html: "<figure></figure>"
+               fragment: "math mn"
+               expected: "| <figure>\n"
+       }, {
+               name: "foreign-fragment.dat #27"
+               html: "<b></b><mglyph/><i></i><malignmark/><u></u><mo/>X"
+               errors: 3
+               fragment: "math mo"
+               expected: "| <b>\n| <math mglyph>\n| <i>\n| <math malignmark>\n| <u>\n| <mo>\n|   \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #28"
+               html: "<malignmark></malignmark>"
+               fragment: "math mo"
+               expected: "| <math malignmark>\n"
+       }, {
+               name: "foreign-fragment.dat #29"
+               html: "<div></div>"
+               fragment: "math mo"
+               expected: "| <div>\n"
+       }, {
+               name: "foreign-fragment.dat #30"
+               html: "<figure></figure>"
+               fragment: "math mo"
+               expected: "| <figure>\n"
+       }, {
+               name: "foreign-fragment.dat #31"
+               html: "<b></b><mglyph/><i></i><malignmark/><u></u><mi/>X"
+               errors: 3
+               fragment: "math mi"
+               expected: "| <b>\n| <math mglyph>\n| <i>\n| <math malignmark>\n| <u>\n| <mi>\n|   \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #32"
+               html: "<malignmark></malignmark>"
+               fragment: "math mi"
+               expected: "| <math malignmark>\n"
+       }, {
+               name: "foreign-fragment.dat #33"
+               html: "<div></div>"
+               fragment: "math mi"
+               expected: "| <div>\n"
+       }, {
+               name: "foreign-fragment.dat #34"
+               html: "<figure></figure>"
+               fragment: "math mi"
+               expected: "| <figure>\n"
+       }, {
+               name: "foreign-fragment.dat #35"
+               html: "<b></b><mglyph/><i></i><malignmark/><u></u><mtext/>X"
+               errors: 3
+               fragment: "math mtext"
+               expected: "| <b>\n| <math mglyph>\n| <i>\n| <math malignmark>\n| <u>\n| <mtext>\n|   \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #36"
+               html: "<malignmark></malignmark>"
+               fragment: "math mtext"
+               expected: "| <math malignmark>\n"
+       }, {
+               name: "foreign-fragment.dat #37"
+               html: "<div></div>"
+               fragment: "math mtext"
+               expected: "| <div>\n"
+       }, {
+               name: "foreign-fragment.dat #38"
+               html: "<figure></figure>"
+               fragment: "math mtext"
+               expected: "| <figure>\n"
+       }, {
+               name: "foreign-fragment.dat #39"
+               html: "<div></div>"
+               errors: 1
+               fragment: "math annotation-xml"
+               expected: "| <math div>\n"
+       }, {
+               name: "foreign-fragment.dat #40"
+               html: "<figure></figure>"
+               fragment: "math annotation-xml"
+               expected: "| <math figure>\n"
+       }, {
+               name: "foreign-fragment.dat #41"
+               html: "<div></div>"
+               errors: 1
+               fragment: "math math"
+               expected: "| <math div>\n"
+       }, {
+               name: "foreign-fragment.dat #42"
+               html: "<figure></figure>"
+               fragment: "math math"
+               expected: "| <math figure>\n"
+       }, {
+               name: "foreign-fragment.dat #43"
+               html: "<div></div>"
+               fragment: "svg foreignObject"
+               expected: "| <div>\n"
+       }, {
+               name: "foreign-fragment.dat #44"
+               html: "<figure></figure>"
+               fragment: "svg foreignObject"
+               expected: "| <figure>\n"
+       }, {
+               name: "foreign-fragment.dat #45"
+               html: "<div></div>"
+               fragment: "svg title"
+               expected: "| <div>\n"
+       }, {
+               name: "foreign-fragment.dat #46"
+               html: "<figure></figure>"
+               fragment: "svg title"
+               expected: "| <figure>\n"
+       }, {
+               name: "foreign-fragment.dat #47"
+               html: "<figure></figure>"
+               fragment: "svg desc"
+               expected: "| <figure>\n"
+       }, {
+               name: "foreign-fragment.dat #48"
+               html: "<div><h1>X</h1></div>"
+               errors: 2
+               fragment: "svg svg"
+               expected: "| <svg div>\n|   <svg h1>\n|     \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #49"
+               html: "<div></div>"
+               errors: 1
+               fragment: "svg svg"
+               expected: "| <svg div>\n"
+       }, {
+               name: "foreign-fragment.dat #50"
+               html: "<div></div>"
+               fragment: "svg desc"
+               expected: "| <div>\n"
+       }, {
+               name: "foreign-fragment.dat #51"
+               html: "<figure></figure>"
+               fragment: "svg desc"
+               expected: "| <figure>\n"
+       }, {
+               name: "foreign-fragment.dat #52"
+               html: "<plaintext><foo>"
+               errors: 2
+               fragment: "svg desc"
+               expected: "| <plaintext>\n|   \"<foo>\"\n"
+       }, {
+               name: "foreign-fragment.dat #53"
+               html: "<frameset>X"
+               errors: 1
+               fragment: "svg desc"
+               expected: "| \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #54"
+               html: "<head>X"
+               errors: 1
+               fragment: "svg desc"
+               expected: "| \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #55"
+               html: "<body>X"
+               errors: 1
+               fragment: "svg desc"
+               expected: "| \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #56"
+               html: "<html>X"
+               errors: 1
+               fragment: "svg desc"
+               expected: "| \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #57"
+               html: "<html class=\"foo\">X"
+               errors: 1
+               fragment: "svg desc"
+               expected: "| \"X\"\n"
+       }, {
+               name: "foreign-fragment.dat #58"
+               html: "<body class=\"foo\">X"
+               errors: 1
+               fragment: "svg desc"
+               expected: "| \"X\"\n"
+       }, {
+               name: "html5test-com.dat #1"
+               html: "<div<div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div<div>\n"
+       }, {
+               name: "html5test-com.dat #2"
+               html: "<div foo<bar=''>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       foo<bar=\"\"\n"
+       }, {
+               name: "html5test-com.dat #3"
+               html: "<div foo=`bar`>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       foo=\"`bar`\"\n"
+       }, {
+               name: "html5test-com.dat #4"
+               html: "<div \\\"foo=''>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \\\"foo=\"\"\n"
+       }, {
+               name: "html5test-com.dat #5"
+               html: "<a href='\\nbar'></a>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       href=\"\\nbar\"\n"
+       }, {
+               name: "html5test-com.dat #6"
+               html: "<!DOCTYPE html>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "html5test-com.dat #7"
+               html: "&lang;&rang;"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"⟨⟩\"\n"
+       }, {
+               name: "html5test-com.dat #8"
+               html: "&apos;"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"'\"\n"
+       }, {
+               name: "html5test-com.dat #9"
+               html: "&ImaginaryI;"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"ⅈ\"\n"
+       }, {
+               name: "html5test-com.dat #10"
+               html: "&Kopf;"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"𝕂\"\n"
+       }, {
+               name: "html5test-com.dat #11"
+               html: "&notinva;"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"∉\"\n"
+       }, {
+               name: "html5test-com.dat #12"
+               html: "<?import namespace=\"foo\" implementation=\"#bar\">"
+               errors: 2
+               expected: "| <!-- ?import namespace=\"foo\" implementation=\"#bar\" -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "html5test-com.dat #13"
+               html: "<!--foo--bar-->"
+               errors: 2
+               expected: "| <!-- foo--bar -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "html5test-com.dat #14"
+               html: "<![CDATA[x]]>"
+               errors: 2
+               expected: "| <!-- [CDATA[x]] -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "html5test-com.dat #15"
+               html: "<textarea><!--</textarea>--></textarea>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"<!--\"\n|     \"-->\"\n"
+       }, {
+               name: "html5test-com.dat #16"
+               html: "<textarea><!--</textarea>-->"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"<!--\"\n|     \"-->\"\n"
+       }, {
+               name: "html5test-com.dat #17"
+               html: "<style><!--</style>--></style>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <style>\n|       \"<!--\"\n|   <body>\n|     \"-->\"\n"
+       }, {
+               name: "html5test-com.dat #18"
+               html: "<style><!--</style>-->"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <style>\n|       \"<!--\"\n|   <body>\n|     \"-->\"\n"
+       }, {
+               name: "html5test-com.dat #19"
+               html: "<ul><li>A </li> <li>B</li></ul>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ul>\n|       <li>\n|         \"A \"\n|       \" \"\n|       <li>\n|         \"B\"\n"
+       }, {
+               name: "html5test-com.dat #20"
+               html: "<table><form><input type=hidden><input></form><div></div></table>"
+               errors: 8
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <input>\n|     <div>\n|     <table>\n|       <form>\n|       <input>\n|         type=\"hidden\"\n"
+       }, {
+               name: "html5test-com.dat #21"
+               html: "<i>A<b>B<p></i>C</b>D"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <i>\n|       \"A\"\n|       <b>\n|         \"B\"\n|     <b>\n|     <p>\n|       <b>\n|         <i>\n|         \"C\"\n|       \"D\"\n"
+       }, {
+               name: "html5test-com.dat #22"
+               html: "<div></div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n"
+       }, {
+               name: "html5test-com.dat #23"
+               html: "<svg></svg>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n"
+       }, {
+               name: "html5test-com.dat #24"
+               html: "<math></math>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n"
+       }, {
+               name: "inbody01.dat #1"
+               html: "<button>1</foo>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <button>\n|       \"1\"\n"
+       }, {
+               name: "inbody01.dat #2"
+               html: "<foo>1<p>2</foo>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <foo>\n|       \"1\"\n|       <p>\n|         \"2\"\n"
+       }, {
+               name: "inbody01.dat #3"
+               html: "<dd>1</foo>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <dd>\n|       \"1\"\n"
+       }, {
+               name: "inbody01.dat #4"
+               html: "<foo>1<dd>2</foo>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <foo>\n|       \"1\"\n|       <dd>\n|         \"2\"\n"
+       }, {
+               name: "isindex.dat #1"
+               html: "<isindex>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <form>\n|       <hr>\n|       <label>\n|         \"This is a searchable index. Enter search keywords: \"\n|         <input>\n|           name=\"isindex\"\n|       <hr>\n"
+       }, {
+               name: "isindex.dat #2"
+               html: "<isindex name=\"A\" action=\"B\" prompt=\"C\" foo=\"D\">"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <form>\n|       action=\"B\"\n|       <hr>\n|       <label>\n|         \"C\"\n|         <input>\n|           foo=\"D\"\n|           name=\"isindex\"\n|       <hr>\n"
+       }, {
+               name: "isindex.dat #3"
+               html: "<form><isindex>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <form>\n"
+       }, {
+               name: "main-element.dat #1"
+               html: "<!doctype html><p>foo<main>bar<p>baz"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       \"foo\"\n|     <main>\n|       \"bar\"\n|       <p>\n|         \"baz\"\n"
+       }, {
+               name: "main-element.dat #2"
+               html: "<!doctype html><main><p>foo</main>bar"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <main>\n|       <p>\n|         \"foo\"\n|     \"bar\"\n"
+       }, {
+               name: "main-element.dat #3"
+               html: "<!DOCTYPE html>xxx<svg><x><g><a><main><b>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"xxx\"\n|     <svg svg>\n|       <svg x>\n|         <svg g>\n|           <svg a>\n|     <main>\n|       <b>\n"
+       }, {
+               name: "math.dat #1"
+               html: "<math><tr><td><mo><tr>"
+               fragment: "td"
+               expected: "| <math math>\n|   <math tr>\n|     <math td>\n|       <math mo>\n"
+       }, {
+               name: "math.dat #2"
+               html: "<math><tr><td><mo><tr>"
+               fragment: "tr"
+               expected: "| <math math>\n|   <math tr>\n|     <math td>\n|       <math mo>\n"
+       }, {
+               name: "math.dat #3"
+               html: "<math><thead><mo><tbody>"
+               fragment: "thead"
+               expected: "| <math math>\n|   <math thead>\n|     <math mo>\n"
+       }, {
+               name: "math.dat #4"
+               html: "<math><tfoot><mo><tbody>"
+               fragment: "tfoot"
+               expected: "| <math math>\n|   <math tfoot>\n|     <math mo>\n"
+       }, {
+               name: "math.dat #5"
+               html: "<math><tbody><mo><tfoot>"
+               fragment: "tbody"
+               expected: "| <math math>\n|   <math tbody>\n|     <math mo>\n"
+       }, {
+               name: "math.dat #6"
+               html: "<math><tbody><mo></table>"
+               fragment: "tbody"
+               expected: "| <math math>\n|   <math tbody>\n|     <math mo>\n"
+       }, {
+               name: "math.dat #7"
+               html: "<math><thead><mo></table>"
+               fragment: "tbody"
+               expected: "| <math math>\n|   <math thead>\n|     <math mo>\n"
+       }, {
+               name: "math.dat #8"
+               html: "<math><tfoot><mo></table>"
+               fragment: "tbody"
+               expected: "| <math math>\n|   <math tfoot>\n|     <math mo>\n"
+       }, {
+               name: "namespace-sensitivity.dat #1"
+               html: "<body><table><tr><td><svg><td><foreignObject><span></td>Foo"
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"Foo\"\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <svg svg>\n|               <svg td>\n|                 <svg foreignObject>\n|                   <span>\n"
+       }, {
+               name: "pending-spec-changes.dat #1"
+               html: "<input type=\"hidden\"><frameset>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "pending-spec-changes.dat #2"
+               html: "<!DOCTYPE html><table><caption><svg>foo</table>bar"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <svg svg>\n|           \"foo\"\n|     \"bar\"\n"
+       }, {
+               name: "pending-spec-changes.dat #3"
+               html: "<table><tr><td><svg><desc><td></desc><circle>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <svg svg>\n|               <svg desc>\n|           <td>\n|             <circle>\n"
+       }, {
+               name: "pending-spec-changes-plain-text-unsafe.dat #1"
+               html: "<body><table>\u0000filler\u0000text\u0000"
+               errors: 18
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"fillertext\"\n|     <table>\n"
+       }, {
+               name: "plain-text-unsafe.dat #1"
+               html: "FOO&#x000D;ZOO"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\rZOO\"\n"
+       }, {
+               name: "plain-text-unsafe.dat #2"
+               html: "<html>\u0000<frameset></frameset>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "plain-text-unsafe.dat #3"
+               html: "<html> \u0000 <frameset></frameset>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "plain-text-unsafe.dat #4"
+               html: "<html>a\u0000a<frameset></frameset>"
+               errors: 5
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"aa\"\n"
+       }, {
+               name: "plain-text-unsafe.dat #5"
+               html: "<html>\u0000\u0000<frameset></frameset>"
+               errors: 6
+               expected: "| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "plain-text-unsafe.dat #6"
+               html: "<html>\u0000\n <frameset></frameset>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "plain-text-unsafe.dat #7"
+               html: "<html><select>\u0000"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n"
+       }, {
+               name: "plain-text-unsafe.dat #8"
+               html: "\u0000"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "plain-text-unsafe.dat #9"
+               html: "<body>\u0000"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "plain-text-unsafe.dat #10"
+               html: "<plaintext>\u0000filler\u0000text\u0000"
+               errors: 5
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <plaintext>\n|       \"�filler�text�\"\n"
+       }, {
+               name: "plain-text-unsafe.dat #11"
+               html: "<svg><![CDATA[\u0000filler\u0000text\u0000]]>"
+               errors: 5
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"�filler�text�\"\n"
+       }, {
+               name: "plain-text-unsafe.dat #12"
+               html: "<body><!\u0000>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <!-- � -->\n"
+       }, {
+               name: "plain-text-unsafe.dat #13"
+               html: "<body><!\u0000filler\u0000text>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <!-- �filler�text -->\n"
+       }, {
+               name: "plain-text-unsafe.dat #14"
+               html: "<body><svg><foreignObject>\u0000filler\u0000text"
+               errors: 6
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg foreignObject>\n|         \"fillertext\"\n"
+       }, {
+               name: "plain-text-unsafe.dat #15"
+               html: "<svg>\u0000filler\u0000text"
+               errors: 6
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"�filler�text\"\n"
+       }, {
+               name: "plain-text-unsafe.dat #16"
+               html: "<svg>\u0000<frameset>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"�\"\n|       <svg frameset>\n"
+       }, {
+               name: "plain-text-unsafe.dat #17"
+               html: "<svg>\u0000 <frameset>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"� \"\n|       <svg frameset>\n"
+       }, {
+               name: "plain-text-unsafe.dat #18"
+               html: "<svg>\u0000a<frameset>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"�a\"\n|       <svg frameset>\n"
+       }, {
+               name: "plain-text-unsafe.dat #19"
+               html: "<svg>\u0000</svg><frameset>"
+               errors: 5
+               expected: "| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "plain-text-unsafe.dat #20"
+               html: "<svg>\u0000 </svg><frameset>"
+               errors: 5
+               expected: "| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "plain-text-unsafe.dat #21"
+               html: "<svg>\u0000a</svg><frameset>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"�a\"\n"
+       }, {
+               name: "plain-text-unsafe.dat #22"
+               html: "<svg><path></path></svg><frameset>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "plain-text-unsafe.dat #23"
+               html: "<svg><p><frameset>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "plain-text-unsafe.dat #24"
+               html: "<!DOCTYPE html><pre>\r\n\r\nA</pre>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n|       \"\nA\"\n"
+       }, {
+               name: "plain-text-unsafe.dat #25"
+               html: "<!DOCTYPE html><pre>\r\rA</pre>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n|       \"\nA\"\n"
+       }, {
+               name: "plain-text-unsafe.dat #26"
+               html: "<!DOCTYPE html><pre>\rA</pre>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n|       \"A\"\n"
+       }, {
+               name: "plain-text-unsafe.dat #27"
+               html: "<!DOCTYPE html><table><tr><td><math><mtext>\u0000a"
+               errors: 3
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <math math>\n|               <math mtext>\n|                 \"a\"\n"
+       }, {
+               name: "plain-text-unsafe.dat #28"
+               html: "<!DOCTYPE html><table><tr><td><svg><foreignObject>\u0000a"
+               errors: 3
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <svg svg>\n|               <svg foreignObject>\n|                 \"a\"\n"
+       }, {
+               name: "plain-text-unsafe.dat #29"
+               html: "<!DOCTYPE html><math><mi>a\u0000b"
+               errors: 3
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         \"ab\"\n"
+       }, {
+               name: "plain-text-unsafe.dat #30"
+               html: "<!DOCTYPE html><math><mo>a\u0000b"
+               errors: 3
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mo>\n|         \"ab\"\n"
+       }, {
+               name: "plain-text-unsafe.dat #31"
+               html: "<!DOCTYPE html><math><mn>a\u0000b"
+               errors: 3
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mn>\n|         \"ab\"\n"
+       }, {
+               name: "plain-text-unsafe.dat #32"
+               html: "<!DOCTYPE html><math><ms>a\u0000b"
+               errors: 3
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math ms>\n|         \"ab\"\n"
+       }, {
+               name: "plain-text-unsafe.dat #33"
+               html: "<!DOCTYPE html><math><mtext>a\u0000b"
+               errors: 3
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mtext>\n|         \"ab\"\n"
+       }, {
+               name: "ruby.dat #1"
+               html: "<html><ruby>a<rb>b<rb></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rb>\n|         \"b\"\n|       <rb>\n"
+       }, {
+               name: "ruby.dat #2"
+               html: "<html><ruby>a<rb>b<rt></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rb>\n|         \"b\"\n|       <rt>\n"
+       }, {
+               name: "ruby.dat #3"
+               html: "<html><ruby>a<rb>b<rtc></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rb>\n|         \"b\"\n|       <rtc>\n"
+       }, {
+               name: "ruby.dat #4"
+               html: "<html><ruby>a<rb>b<rp></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rb>\n|         \"b\"\n|       <rp>\n"
+       }, {
+               name: "ruby.dat #5"
+               html: "<html><ruby>a<rb>b<span></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rb>\n|         \"b\"\n|         <span>\n"
+       }, {
+               name: "ruby.dat #6"
+               html: "<html><ruby>a<rt>b<rb></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rt>\n|         \"b\"\n|       <rb>\n"
+       }, {
+               name: "ruby.dat #7"
+               html: "<html><ruby>a<rt>b<rt></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rt>\n|         \"b\"\n|       <rt>\n"
+       }, {
+               name: "ruby.dat #8"
+               html: "<html><ruby>a<rt>b<rtc></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rt>\n|         \"b\"\n|       <rtc>\n"
+       }, {
+               name: "ruby.dat #9"
+               html: "<html><ruby>a<rt>b<rp></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rt>\n|         \"b\"\n|       <rp>\n"
+       }, {
+               name: "ruby.dat #10"
+               html: "<html><ruby>a<rt>b<span></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rt>\n|         \"b\"\n|         <span>\n"
+       }, {
+               name: "ruby.dat #11"
+               html: "<html><ruby>a<rtc>b<rb></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rtc>\n|         \"b\"\n|       <rb>\n"
+       }, {
+               name: "ruby.dat #12"
+               html: "<html><ruby>a<rtc>b<rt>c<rt>d</ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rtc>\n|         \"b\"\n|         <rt>\n|           \"c\"\n|         <rt>\n|           \"d\"\n"
+       }, {
+               name: "ruby.dat #13"
+               html: "<html><ruby>a<rtc>b<rtc></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rtc>\n|         \"b\"\n|       <rtc>\n"
+       }, {
+               name: "ruby.dat #14"
+               html: "<html><ruby>a<rtc>b<rp></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rtc>\n|         \"b\"\n|         <rp>\n"
+       }, {
+               name: "ruby.dat #15"
+               html: "<html><ruby>a<rtc>b<span></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rtc>\n|         \"b\"\n|         <span>\n"
+       }, {
+               name: "ruby.dat #16"
+               html: "<html><ruby>a<rp>b<rb></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rp>\n|         \"b\"\n|       <rb>\n"
+       }, {
+               name: "ruby.dat #17"
+               html: "<html><ruby>a<rp>b<rt></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rp>\n|         \"b\"\n|       <rt>\n"
+       }, {
+               name: "ruby.dat #18"
+               html: "<html><ruby>a<rp>b<rtc></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rp>\n|         \"b\"\n|       <rtc>\n"
+       }, {
+               name: "ruby.dat #19"
+               html: "<html><ruby>a<rp>b<rp></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rp>\n|         \"b\"\n|       <rp>\n"
+       }, {
+               name: "ruby.dat #20"
+               html: "<html><ruby>a<rp>b<span></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rp>\n|         \"b\"\n|         <span>\n"
+       }, {
+               name: "ruby.dat #21"
+               html: "<html><ruby><rtc><ruby>a<rb>b<rt></ruby></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       <rtc>\n|         <ruby>\n|           \"a\"\n|           <rb>\n|             \"b\"\n|           <rt>\n"
+       }, {
+               name: "scriptdata01.dat #1"
+               html: "FOO<script>'Hello'</script>BAR"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'Hello'\"\n|     \"BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #2"
+               html: "FOO<script></script>BAR"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|     \"BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #3"
+               html: "FOO<script></script >BAR"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|     \"BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #4"
+               html: "FOO<script></script/>BAR"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|     \"BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #5"
+               html: "FOO<script></script/ >BAR"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|     \"BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #6"
+               html: "FOO<script type=\"text/plain\"></scriptx>BAR"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       type=\"text/plain\"\n|       \"</scriptx>BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #7"
+               html: "FOO<script></script foo=\">\" dd>BAR"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|     \"BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #8"
+               html: "FOO<script>'<'</script>BAR"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'<'\"\n|     \"BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #9"
+               html: "FOO<script>'<!'</script>BAR"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'<!'\"\n|     \"BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #10"
+               html: "FOO<script>'<!-'</script>BAR"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'<!-'\"\n|     \"BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #11"
+               html: "FOO<script>'<!--'</script>BAR"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'<!--'\"\n|     \"BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #12"
+               html: "FOO<script>'<!---'</script>BAR"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'<!---'\"\n|     \"BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #13"
+               html: "FOO<script>'<!-->'</script>BAR"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'<!-->'\"\n|     \"BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #14"
+               html: "FOO<script>'<!-->'</script>BAR"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'<!-->'\"\n|     \"BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #15"
+               html: "FOO<script>'<!-- potato'</script>BAR"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'<!-- potato'\"\n|     \"BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #16"
+               html: "FOO<script>'<!-- <sCrIpt'</script>BAR"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'<!-- <sCrIpt'\"\n|     \"BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #17"
+               html: "FOO<script type=\"text/plain\">'<!-- <sCrIpt>'</script>BAR"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       type=\"text/plain\"\n|       \"'<!-- <sCrIpt>'</script>BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #18"
+               html: "FOO<script type=\"text/plain\">'<!-- <sCrIpt> -'</script>BAR"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       type=\"text/plain\"\n|       \"'<!-- <sCrIpt> -'</script>BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #19"
+               html: "FOO<script type=\"text/plain\">'<!-- <sCrIpt> --'</script>BAR"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       type=\"text/plain\"\n|       \"'<!-- <sCrIpt> --'</script>BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #20"
+               html: "FOO<script>'<!-- <sCrIpt> -->'</script>BAR"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'<!-- <sCrIpt> -->'\"\n|     \"BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #21"
+               html: "FOO<script type=\"text/plain\">'<!-- <sCrIpt> --!>'</script>BAR"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       type=\"text/plain\"\n|       \"'<!-- <sCrIpt> --!>'</script>BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #22"
+               html: "FOO<script type=\"text/plain\">'<!-- <sCrIpt> -- >'</script>BAR"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       type=\"text/plain\"\n|       \"'<!-- <sCrIpt> -- >'</script>BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #23"
+               html: "FOO<script type=\"text/plain\">'<!-- <sCrIpt '</script>BAR"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       type=\"text/plain\"\n|       \"'<!-- <sCrIpt '</script>BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #24"
+               html: "FOO<script type=\"text/plain\">'<!-- <sCrIpt/'</script>BAR"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       type=\"text/plain\"\n|       \"'<!-- <sCrIpt/'</script>BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #25"
+               html: "FOO<script type=\"text/plain\">'<!-- <sCrIpt\\'</script>BAR"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       type=\"text/plain\"\n|       \"'<!-- <sCrIpt\\'\"\n|     \"BAR\"\n"
+       }, {
+               name: "scriptdata01.dat #26"
+               html: "FOO<script type=\"text/plain\">'<!-- <sCrIpt/'</script>BAR</script>QUX"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       type=\"text/plain\"\n|       \"'<!-- <sCrIpt/'</script>BAR\"\n|     \"QUX\"\n"
+       }, {
+               name: "scriptdata01.dat #27"
+               html: "FOO<script><!--<script>-></script>--></script>QUX"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"<!--<script>-></script>-->\"\n|     \"QUX\"\n"
+       }, {
+               name: "tables01.dat #1"
+               html: "<table><th>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <th>\n"
+       }, {
+               name: "tables01.dat #2"
+               html: "<table><td>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n"
+       }, {
+               name: "tables01.dat #3"
+               html: "<table><col foo='bar'>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <colgroup>\n|         <col>\n|           foo=\"bar\"\n"
+       }, {
+               name: "tables01.dat #4"
+               html: "<table><colgroup></html>foo"
+               errors: 6
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"foo\"\n|     <table>\n|       <colgroup>\n"
+       }, {
+               name: "tables01.dat #5"
+               html: "<table></table><p>foo"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|     <p>\n|       \"foo\"\n"
+       }, {
+               name: "tables01.dat #6"
+               html: "<table></body></caption></col></colgroup></html></tbody></td></tfoot></th></thead></tr><td>"
+               errors: 14
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n"
+       }, {
+               name: "tables01.dat #7"
+               html: "<table><select><option>3</select></table>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n|         \"3\"\n|     <table>\n"
+       }, {
+               name: "tables01.dat #8"
+               html: "<table><select><table></table></select></table>"
+               errors: 6
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|     <table>\n|     <table>\n"
+       }, {
+               name: "tables01.dat #9"
+               html: "<table><select></table>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|     <table>\n"
+       }, {
+               name: "tables01.dat #10"
+               html: "<table><select><option>A<tr><td>B</td></tr></table>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n|         \"A\"\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"B\"\n"
+       }, {
+               name: "tables01.dat #11"
+               html: "<table><td></body></caption></col></colgroup></html>foo"
+               errors: 8
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"foo\"\n"
+       }, {
+               name: "tables01.dat #12"
+               html: "<table><td>A</table>B"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"A\"\n|     \"B\"\n"
+       }, {
+               name: "tables01.dat #13"
+               html: "<table><tr><caption>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|       <caption>\n"
+       }, {
+               name: "tables01.dat #14"
+               html: "<table><tr></body></caption></col></colgroup></html></td></th><td>foo"
+               errors: 9
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"foo\"\n"
+       }, {
+               name: "tables01.dat #15"
+               html: "<table><td><tr>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|         <tr>\n"
+       }, {
+               name: "tables01.dat #16"
+               html: "<table><td><button><td>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <button>\n|           <td>\n"
+       }, {
+               name: "tables01.dat #17"
+               html: "<table><tr><td><svg><desc><td>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <svg svg>\n|               <svg desc>\n|           <td>\n"
+       }, {
+               name: "template.dat #1"
+               html: "<body><template>Hello</template>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         \"Hello\"\n"
+       }, {
+               name: "template.dat #2"
+               html: "<template>Hello</template>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         \"Hello\"\n|   <body>\n"
+       }, {
+               name: "template.dat #3"
+               html: "<template></template><div></div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|   <body>\n|     <div>\n"
+       }, {
+               name: "template.dat #4"
+               html: "<html><template>Hello</template>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         \"Hello\"\n|   <body>\n"
+       }, {
+               name: "template.dat #5"
+               html: "<head><template><div></div></template></head>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <div>\n|   <body>\n"
+       }, {
+               name: "template.dat #6"
+               html: "<div><template><div><span></template><b>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <template>\n|         content\n|           <div>\n|             <span>\n|       <b>\n"
+       }, {
+               name: "template.dat #7"
+               html: "<div><template></div>Hello"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <template>\n|         content\n|           \"Hello\"\n"
+       }, {
+               name: "template.dat #8"
+               html: "<div></template></div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n"
+       }, {
+               name: "template.dat #9"
+               html: "<table><template></template></table>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <template>\n|         content\n"
+       }, {
+               name: "template.dat #10"
+               html: "<table><template></template></div>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <template>\n|         content\n"
+       }, {
+               name: "template.dat #11"
+               html: "<table><div><template></template></div>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <template>\n|         content\n|     <table>\n"
+       }, {
+               name: "template.dat #12"
+               html: "<table><template></template><div></div>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|     <table>\n|       <template>\n|         content\n"
+       }, {
+               name: "template.dat #13"
+               html: "<table>   <template></template></table>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       \"   \"\n|       <template>\n|         content\n"
+       }, {
+               name: "template.dat #14"
+               html: "<table><tbody><template></template></tbody>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <template>\n|           content\n"
+       }, {
+               name: "template.dat #15"
+               html: "<table><tbody><template></tbody></template>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <template>\n|           content\n"
+       }, {
+               name: "template.dat #16"
+               html: "<table><tbody><template></template></tbody></table>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <template>\n|           content\n"
+       }, {
+               name: "template.dat #17"
+               html: "<table><thead><template></template></thead>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <thead>\n|         <template>\n|           content\n"
+       }, {
+               name: "template.dat #18"
+               html: "<table><tfoot><template></template></tfoot>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tfoot>\n|         <template>\n|           content\n"
+       }, {
+               name: "template.dat #19"
+               html: "<select><template></template></select>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <template>\n|         content\n"
+       }, {
+               name: "template.dat #20"
+               html: "<select><template><option></option></template></select>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <template>\n|         content\n|           <option>\n"
+       }, {
+               name: "template.dat #21"
+               html: "<template><option></option></select><option></option></template>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <option>\n|         <option>\n|   <body>\n"
+       }, {
+               name: "template.dat #22"
+               html: "<select><template></template><option></select>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <template>\n|         content\n|       <option>\n"
+       }, {
+               name: "template.dat #23"
+               html: "<select><option><template></template></select>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n|         <template>\n|           content\n"
+       }, {
+               name: "template.dat #24"
+               html: "<select><template>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <template>\n|         content\n"
+       }, {
+               name: "template.dat #25"
+               html: "<select><option></option><template>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n|       <template>\n|         content\n"
+       }, {
+               name: "template.dat #26"
+               html: "<select><option></option><template><option>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n|       <template>\n|         content\n|           <option>\n"
+       }, {
+               name: "template.dat #27"
+               html: "<table><thead><template><td></template></table>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <thead>\n|         <template>\n|           content\n|             <td>\n"
+       }, {
+               name: "template.dat #28"
+               html: "<table><template><thead></template></table>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <template>\n|         content\n|           <thead>\n"
+       }, {
+               name: "template.dat #29"
+               html: "<body><table><template><td></tr><div></template></table>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <template>\n|         content\n|           <td>\n|             <div>\n"
+       }, {
+               name: "template.dat #30"
+               html: "<table><template><thead></template></thead></table>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <template>\n|         content\n|           <thead>\n"
+       }, {
+               name: "template.dat #31"
+               html: "<table><thead><template><tr></template></table>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <thead>\n|         <template>\n|           content\n|             <tr>\n"
+       }, {
+               name: "template.dat #32"
+               html: "<table><template><tr></template></table>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <template>\n|         content\n|           <tr>\n"
+       }, {
+               name: "template.dat #33"
+               html: "<table><tr><template><td>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <template>\n|             content\n|               <td>\n"
+       }, {
+               name: "template.dat #34"
+               html: "<table><template><tr><template><td></template></tr></template></table>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <template>\n|         content\n|           <tr>\n|             <template>\n|               content\n|                 <td>\n"
+       }, {
+               name: "template.dat #35"
+               html: "<table><template><tr><template><td></td></template></tr></template></table>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <template>\n|         content\n|           <tr>\n|             <template>\n|               content\n|                 <td>\n"
+       }, {
+               name: "template.dat #36"
+               html: "<table><template><td></template>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <template>\n|         content\n|           <td>\n"
+       }, {
+               name: "template.dat #37"
+               html: "<body><template><td></td></template>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <td>\n"
+       }, {
+               name: "template.dat #38"
+               html: "<body><template><template><tr></tr></template><td></td></template>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <tr>\n|         <td>\n"
+       }, {
+               name: "template.dat #39"
+               html: "<table><colgroup><template><col>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <colgroup>\n|         <template>\n|           content\n|             <col>\n"
+       }, {
+               name: "template.dat #40"
+               html: "<frameset><template><frame></frame></template></frameset>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <frameset>\n|     <frame>\n"
+       }, {
+               name: "template.dat #41"
+               html: "<template><frame></frame></frameset><frame></frame></template>"
+               errors: 6
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|   <body>\n"
+       }, {
+               name: "template.dat #42"
+               html: "<template><div><frameset><span></span></div><span></span></template>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <div>\n|           <span>\n|         <span>\n|   <body>\n"
+       }, {
+               name: "template.dat #43"
+               html: "<body><template><div><frameset><span></span></div><span></span></template></body>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <div>\n|           <span>\n|         <span>\n"
+       }, {
+               name: "template.dat #44"
+               html: "<body><template><script>var i = 1;</script><td></td></template>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <script>\n|           \"var i = 1;\"\n|         <td>\n"
+       }, {
+               name: "template.dat #45"
+               html: "<body><template><tr><div></div></tr></template>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <tr>\n|         <div>\n"
+       }, {
+               name: "template.dat #46"
+               html: "<body><template><tr></tr><td></td></template>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <tr>\n|         <tr>\n|           <td>\n"
+       }, {
+               name: "template.dat #47"
+               html: "<body><template><td></td></tr><td></td></template>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <td>\n|         <td>\n"
+       }, {
+               name: "template.dat #48"
+               html: "<body><template><td></td><tbody><td></td></template>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <td>\n|         <td>\n"
+       }, {
+               name: "template.dat #49"
+               html: "<body><template><td></td><caption></caption><td></td></template>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <td>\n|         <td>\n"
+       }, {
+               name: "template.dat #50"
+               html: "<body><template><td></td><colgroup></caption><td></td></template>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <td>\n|         <td>\n"
+       }, {
+               name: "template.dat #51"
+               html: "<body><template><td></td></table><td></td></template>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <td>\n|         <td>\n"
+       }, {
+               name: "template.dat #52"
+               html: "<body><template><tr></tr><tbody><tr></tr></template>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <tr>\n|         <tr>\n"
+       }, {
+               name: "template.dat #53"
+               html: "<body><template><tr></tr><caption><tr></tr></template>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <tr>\n|         <tr>\n"
+       }, {
+               name: "template.dat #54"
+               html: "<body><template><tr></tr></table><tr></tr></template>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <tr>\n|         <tr>\n"
+       }, {
+               name: "template.dat #55"
+               html: "<body><template><thead></thead><caption></caption><tbody></tbody></template>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <thead>\n|         <caption>\n|         <tbody>\n"
+       }, {
+               name: "template.dat #56"
+               html: "<body><template><thead></thead></table><tbody></tbody></template></body>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <thead>\n|         <tbody>\n"
+       }, {
+               name: "template.dat #57"
+               html: "<body><template><div><tr></tr></div></template>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <div>\n"
+       }, {
+               name: "template.dat #58"
+               html: "<body><template><em>Hello</em></template>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <em>\n|           \"Hello\"\n"
+       }, {
+               name: "template.dat #59"
+               html: "<body><template><!--comment--></template>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <!-- comment -->\n"
+       }, {
+               name: "template.dat #60"
+               html: "<body><template><style></style><td></td></template>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <style>\n|         <td>\n"
+       }, {
+               name: "template.dat #61"
+               html: "<body><template><meta><td></td></template>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <meta>\n|         <td>\n"
+       }, {
+               name: "template.dat #62"
+               html: "<body><template><link><td></td></template>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <link>\n|         <td>\n"
+       }, {
+               name: "template.dat #63"
+               html: "<body><template><template><tr></tr></template><td></td></template>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <tr>\n|         <td>\n"
+       }, {
+               name: "template.dat #64"
+               html: "<body><table><colgroup><template><col></col></template></colgroup></table></body>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <colgroup>\n|         <template>\n|           content\n|             <col>\n"
+       }, {
+               name: "template.dat #65"
+               html: "<body a=b><template><div></div><body c=d><div></div></body></template></body>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     a=\"b\"\n|     <template>\n|       content\n|         <div>\n|         <div>\n"
+       }, {
+               name: "template.dat #66"
+               html: "<html a=b><template><div><html b=c><span></template>"
+               errors: 3
+               expected: "| <html>\n|   a=\"b\"\n|   <head>\n|     <template>\n|       content\n|         <div>\n|           <span>\n|   <body>\n"
+       }, {
+               name: "template.dat #67"
+               html: "<html a=b><template><col></col><html b=c><col></col></template>"
+               errors: 4
+               expected: "| <html>\n|   a=\"b\"\n|   <head>\n|     <template>\n|       content\n|         <col>\n|         <col>\n|   <body>\n"
+       }, {
+               name: "template.dat #68"
+               html: "<html a=b><template><frame></frame><html b=c><frame></frame></template>"
+               errors: 6
+               expected: "| <html>\n|   a=\"b\"\n|   <head>\n|     <template>\n|       content\n|   <body>\n"
+       }, {
+               name: "template.dat #69"
+               html: "<body><template><tr></tr><template></template><td></td></template>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <tr>\n|         <template>\n|           content\n|         <tr>\n|           <td>\n"
+       }, {
+               name: "template.dat #70"
+               html: "<body><template><thead></thead><template><tr></tr></template><tr></tr><tfoot></tfoot></template>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <thead>\n|         <template>\n|           content\n|             <tr>\n|         <tbody>\n|           <tr>\n|         <tfoot>\n"
+       }, {
+               name: "template.dat #71"
+               html: "<body><template><template><b><template></template></template>text</template>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <b>\n|               <template>\n|                 content\n|         \"text\"\n"
+       }, {
+               name: "template.dat #72"
+               html: "<body><template><col><colgroup>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <col>\n"
+       }, {
+               name: "template.dat #73"
+               html: "<body><template><col></colgroup>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <col>\n"
+       }, {
+               name: "template.dat #74"
+               html: "<body><template><col><colgroup></template></body>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <col>\n"
+       }, {
+               name: "template.dat #75"
+               html: "<body><template><col><div>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <col>\n"
+       }, {
+               name: "template.dat #76"
+               html: "<body><template><col></div>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <col>\n"
+       }, {
+               name: "template.dat #77"
+               html: "<body><template><col>Hello"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <col>\n"
+       }, {
+               name: "template.dat #78"
+               html: "<body><template><i><menu>Foo</i>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <i>\n|         <menu>\n|           <i>\n|             \"Foo\"\n"
+       }, {
+               name: "template.dat #79"
+               html: "<body><template></div><div>Foo</div><template></template><tr></tr>"
+               errors: 5
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <div>\n|           \"Foo\"\n|         <template>\n|           content\n"
+       }, {
+               name: "template.dat #80"
+               html: "<body><div><template></div><tr><td>Foo</td></tr></template>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <template>\n|         content\n|           <tr>\n|             <td>\n|               \"Foo\"\n"
+       }, {
+               name: "template.dat #81"
+               html: "<template></figcaption><sub><table></table>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <sub>\n|           <table>\n|   <body>\n"
+       }, {
+               name: "template.dat #82"
+               html: "<template><template>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|   <body>\n"
+       }, {
+               name: "template.dat #83"
+               html: "<template><div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <div>\n|   <body>\n"
+       }, {
+               name: "template.dat #84"
+               html: "<template><template><div>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <div>\n|   <body>\n"
+       }, {
+               name: "template.dat #85"
+               html: "<template><template><table>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <table>\n|   <body>\n"
+       }, {
+               name: "template.dat #86"
+               html: "<template><template><tbody>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <tbody>\n|   <body>\n"
+       }, {
+               name: "template.dat #87"
+               html: "<template><template><tr>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <tr>\n|   <body>\n"
+       }, {
+               name: "template.dat #88"
+               html: "<template><template><td>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <td>\n|   <body>\n"
+       }, {
+               name: "template.dat #89"
+               html: "<template><template><caption>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <caption>\n|   <body>\n"
+       }, {
+               name: "template.dat #90"
+               html: "<template><template><colgroup>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <colgroup>\n|   <body>\n"
+       }, {
+               name: "template.dat #91"
+               html: "<template><template><col>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <col>\n|   <body>\n"
+       }, {
+               name: "template.dat #92"
+               html: "<template><template><tbody><select>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <tbody>\n|             <select>\n|   <body>\n"
+       }, {
+               name: "template.dat #93"
+               html: "<template><template><table>Foo"
+               errors: 6
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             \"Foo\"\n|             <table>\n|   <body>\n"
+       }, {
+               name: "template.dat #94"
+               html: "<template><template><frame>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|   <body>\n"
+       }, {
+               name: "template.dat #95"
+               html: "<template><template><script>var i"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <script>\n|               \"var i\"\n|   <body>\n"
+       }, {
+               name: "template.dat #96"
+               html: "<template><template><style>var i"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <style>\n|               \"var i\"\n|   <body>\n"
+       }, {
+               name: "template.dat #97"
+               html: "<template><table></template><body><span>Foo"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <table>\n|   <body>\n|     <span>\n|       \"Foo\"\n"
+       }, {
+               name: "template.dat #98"
+               html: "<template><td></template><body><span>Foo"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <td>\n|   <body>\n|     <span>\n|       \"Foo\"\n"
+       }, {
+               name: "template.dat #99"
+               html: "<template><object></template><body><span>Foo"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <object>\n|   <body>\n|     <span>\n|       \"Foo\"\n"
+       }, {
+               name: "template.dat #100"
+               html: "<template><svg><template>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <svg svg>\n|           <svg template>\n|   <body>\n"
+       }, {
+               name: "template.dat #101"
+               html: "<template><svg><foo><template><foreignObject><div></template><div>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <svg svg>\n|           <svg foo>\n|             <svg template>\n|               <svg foreignObject>\n|                 <div>\n|   <body>\n|     <div>\n"
+       }, {
+               name: "template.dat #102"
+               html: "<dummy><template><span></dummy>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <dummy>\n|       <template>\n|         content\n|           <span>\n"
+       }, {
+               name: "template.dat #103"
+               html: "<body><table><tr><td><select><template>Foo</template><caption>A</table>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <select>\n|               <template>\n|                 content\n|                   \"Foo\"\n|       <caption>\n|         \"A\"\n"
+       }, {
+               name: "template.dat #104"
+               html: "<body></body><template>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n"
+       }, {
+               name: "template.dat #105"
+               html: "<head></head><template>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|   <body>\n"
+       }, {
+               name: "template.dat #106"
+               html: "<head></head><template>Foo</template>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         \"Foo\"\n|   <body>\n"
+       }, {
+               name: "template.dat #107"
+               html: "<!DOCTYPE HTML><dummy><table><template><table><template><table><script>"
+               errors: 4
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <dummy>\n|       <table>\n|         <template>\n|           content\n|             <table>\n|               <template>\n|                 content\n|                   <table>\n|                     <script>\n"
+       }, {
+               name: "template.dat #108"
+               html: "<template><a><table><a>"
+               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <a>\n|           <a>\n|           <table>\n|   <body>\n"
+       }, {
+               name: "tests10.dat #1"
+               html: "<!DOCTYPE html><svg></svg>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n"
+       }, {
+               name: "tests10.dat #2"
+               html: "<!DOCTYPE html><svg></svg><![CDATA[a]]>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|     <!-- [CDATA[a]] -->\n"
+       }, {
+               name: "tests10.dat #3"
+               html: "<!DOCTYPE html><body><svg></svg>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n"
+       }, {
+               name: "tests10.dat #4"
+               html: "<!DOCTYPE html><body><select><svg></svg></select>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n"
+       }, {
+               name: "tests10.dat #5"
+               html: "<!DOCTYPE html><body><select><option><svg></svg></option></select>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n"
+       }, {
+               name: "tests10.dat #6"
+               html: "<!DOCTYPE html><body><table><svg></svg></table>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|     <table>\n"
+       }, {
+               name: "tests10.dat #7"
+               html: "<!DOCTYPE html><body><table><svg><g>foo</g></svg></table>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg g>\n|         \"foo\"\n|     <table>\n"
+       }, {
+               name: "tests10.dat #8"
+               html: "<!DOCTYPE html><body><table><svg><g>foo</g><g>bar</g></svg></table>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg g>\n|         \"foo\"\n|       <svg g>\n|         \"bar\"\n|     <table>\n"
+       }, {
+               name: "tests10.dat #9"
+               html: "<!DOCTYPE html><body><table><tbody><svg><g>foo</g><g>bar</g></svg></tbody></table>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg g>\n|         \"foo\"\n|       <svg g>\n|         \"bar\"\n|     <table>\n|       <tbody>\n"
+       }, {
+               name: "tests10.dat #10"
+               html: "<!DOCTYPE html><body><table><tbody><tr><svg><g>foo</g><g>bar</g></svg></tr></tbody></table>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg g>\n|         \"foo\"\n|       <svg g>\n|         \"bar\"\n|     <table>\n|       <tbody>\n|         <tr>\n"
+       }, {
+               name: "tests10.dat #11"
+               html: "<!DOCTYPE html><body><table><tbody><tr><td><svg><g>foo</g><g>bar</g></svg></td></tr></tbody></table>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <svg svg>\n|               <svg g>\n|                 \"foo\"\n|               <svg g>\n|                 \"bar\"\n"
+       }, {
+               name: "tests10.dat #12"
+               html: "<!DOCTYPE html><body><table><tbody><tr><td><svg><g>foo</g><g>bar</g></svg><p>baz</td></tr></tbody></table>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <svg svg>\n|               <svg g>\n|                 \"foo\"\n|               <svg g>\n|                 \"bar\"\n|             <p>\n|               \"baz\"\n"
+       }, {
+               name: "tests10.dat #13"
+               html: "<!DOCTYPE html><body><table><caption><svg><g>foo</g><g>bar</g></svg><p>baz</caption></table>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <svg svg>\n|           <svg g>\n|             \"foo\"\n|           <svg g>\n|             \"bar\"\n|         <p>\n|           \"baz\"\n"
+       }, {
+               name: "tests10.dat #14"
+               html: "<!DOCTYPE html><body><table><caption><svg><g>foo</g><g>bar</g><p>baz</table><p>quux"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <svg svg>\n|           <svg g>\n|             \"foo\"\n|           <svg g>\n|             \"bar\"\n|         <p>\n|           \"baz\"\n|     <p>\n|       \"quux\"\n"
+       }, {
+               name: "tests10.dat #15"
+               html: "<!DOCTYPE html><body><table><caption><svg><g>foo</g><g>bar</g>baz</table><p>quux"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <svg svg>\n|           <svg g>\n|             \"foo\"\n|           <svg g>\n|             \"bar\"\n|           \"baz\"\n|     <p>\n|       \"quux\"\n"
+       }, {
+               name: "tests10.dat #16"
+               html: "<!DOCTYPE html><body><table><colgroup><svg><g>foo</g><g>bar</g><p>baz</table><p>quux"
+               errors: 6
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg g>\n|         \"foo\"\n|       <svg g>\n|         \"bar\"\n|     <p>\n|       \"baz\"\n|     <table>\n|       <colgroup>\n|     <p>\n|       \"quux\"\n"
+       }, {
+               name: "tests10.dat #17"
+               html: "<!DOCTYPE html><body><table><tr><td><select><svg><g>foo</g><g>bar</g><p>baz</table><p>quux"
+               errors: 7
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <select>\n|               \"foobarbaz\"\n|     <p>\n|       \"quux\"\n"
+       }, {
+               name: "tests10.dat #18"
+               html: "<!DOCTYPE html><body><table><select><svg><g>foo</g><g>bar</g><p>baz</table><p>quux"
+               errors: 8
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       \"foobarbaz\"\n|     <table>\n|     <p>\n|       \"quux\"\n"
+       }, {
+               name: "tests10.dat #19"
+               html: "<!DOCTYPE html><body></body></html><svg><g>foo</g><g>bar</g><p>baz"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg g>\n|         \"foo\"\n|       <svg g>\n|         \"bar\"\n|     <p>\n|       \"baz\"\n"
+       }, {
+               name: "tests10.dat #20"
+               html: "<!DOCTYPE html><body></body><svg><g>foo</g><g>bar</g><p>baz"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg g>\n|         \"foo\"\n|       <svg g>\n|         \"bar\"\n|     <p>\n|       \"baz\"\n"
+       }, {
+               name: "tests10.dat #21"
+               html: "<!DOCTYPE html><frameset><svg><g></g><g></g><p><span>"
+               errors: 8
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "tests10.dat #22"
+               html: "<!DOCTYPE html><frameset></frameset><svg><g></g><g></g><p><span>"
+               errors: 7
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "tests10.dat #23"
+               html: "<!DOCTYPE html><body xlink:href=foo><svg xlink:href=foo></svg>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     xlink:href=\"foo\"\n|     <svg svg>\n|       xlink href=\"foo\"\n"
+       }, {
+               name: "tests10.dat #24"
+               html: "<!DOCTYPE html><body xlink:href=foo xml:lang=en><svg><g xml:lang=en xlink:href=foo></g></svg>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     xlink:href=\"foo\"\n|     xml:lang=\"en\"\n|     <svg svg>\n|       <svg g>\n|         xlink href=\"foo\"\n|         xml lang=\"en\"\n"
+       }, {
+               name: "tests10.dat #25"
+               html: "<!DOCTYPE html><body xlink:href=foo xml:lang=en><svg><g xml:lang=en xlink:href=foo /></svg>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     xlink:href=\"foo\"\n|     xml:lang=\"en\"\n|     <svg svg>\n|       <svg g>\n|         xlink href=\"foo\"\n|         xml lang=\"en\"\n"
+       }, {
+               name: "tests10.dat #26"
+               html: "<!DOCTYPE html><body xlink:href=foo xml:lang=en><svg><g xml:lang=en xlink:href=foo />bar</svg>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     xlink:href=\"foo\"\n|     xml:lang=\"en\"\n|     <svg svg>\n|       <svg g>\n|         xlink href=\"foo\"\n|         xml lang=\"en\"\n|       \"bar\"\n"
+       }, {
+               name: "tests10.dat #27"
+               html: "<svg></path>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n"
+       }, {
+               name: "tests10.dat #28"
+               html: "<div><svg></div>a"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <svg svg>\n|     \"a\"\n"
+       }, {
+               name: "tests10.dat #29"
+               html: "<div><svg><path></div>a"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <svg svg>\n|         <svg path>\n|     \"a\"\n"
+       }, {
+               name: "tests10.dat #30"
+               html: "<div><svg><path></svg><path>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <svg svg>\n|         <svg path>\n|       <path>\n"
+       }, {
+               name: "tests10.dat #31"
+               html: "<div><svg><path><foreignObject><math></div>a"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <svg svg>\n|         <svg path>\n|           <svg foreignObject>\n|             <math math>\n|               \"a\"\n"
+       }, {
+               name: "tests10.dat #32"
+               html: "<div><svg><path><foreignObject><p></div>a"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <svg svg>\n|         <svg path>\n|           <svg foreignObject>\n|             <p>\n|               \"a\"\n"
+       }, {
+               name: "tests10.dat #33"
+               html: "<!DOCTYPE html><svg><desc><div><svg><ul>a"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg desc>\n|         <div>\n|           <svg svg>\n|           <ul>\n|             \"a\"\n"
+       }, {
+               name: "tests10.dat #34"
+               html: "<!DOCTYPE html><svg><desc><svg><ul>a"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg desc>\n|         <svg svg>\n|         <ul>\n|           \"a\"\n"
+       }, {
+               name: "tests10.dat #35"
+               html: "<!DOCTYPE html><p><svg><desc><p>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <svg svg>\n|         <svg desc>\n|           <p>\n"
+       }, {
+               name: "tests10.dat #36"
+               html: "<!DOCTYPE html><p><svg><title><p>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <svg svg>\n|         <svg title>\n|           <p>\n"
+       }, {
+               name: "tests10.dat #37"
+               html: "<div><svg><path><foreignObject><p></foreignObject><p>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <svg svg>\n|         <svg path>\n|           <svg foreignObject>\n|             <p>\n|             <p>\n"
+       }, {
+               name: "tests10.dat #38"
+               html: "<math><mi><div><object><div><span></span></div></object></div></mi><mi>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         <div>\n|           <object>\n|             <div>\n|               <span>\n|       <math mi>\n"
+       }, {
+               name: "tests10.dat #39"
+               html: "<math><mi><svg><foreignObject><div><div></div></div></foreignObject></svg></mi><mi>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         <svg svg>\n|           <svg foreignObject>\n|             <div>\n|               <div>\n|       <math mi>\n"
+       }, {
+               name: "tests10.dat #40"
+               html: "<svg><script></script><path>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg script>\n|       <svg path>\n"
+       }, {
+               name: "tests10.dat #41"
+               html: "<table><svg></svg><tr>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|     <table>\n|       <tbody>\n|         <tr>\n"
+       }, {
+               name: "tests10.dat #42"
+               html: "<math><mi><mglyph>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         <math mglyph>\n"
+       }, {
+               name: "tests10.dat #43"
+               html: "<math><mi><malignmark>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         <math malignmark>\n"
+       }, {
+               name: "tests10.dat #44"
+               html: "<math><mo><mglyph>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mo>\n|         <math mglyph>\n"
+       }, {
+               name: "tests10.dat #45"
+               html: "<math><mo><malignmark>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mo>\n|         <math malignmark>\n"
+       }, {
+               name: "tests10.dat #46"
+               html: "<math><mn><mglyph>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mn>\n|         <math mglyph>\n"
+       }, {
+               name: "tests10.dat #47"
+               html: "<math><mn><malignmark>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mn>\n|         <math malignmark>\n"
+       }, {
+               name: "tests10.dat #48"
+               html: "<math><ms><mglyph>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math ms>\n|         <math mglyph>\n"
+       }, {
+               name: "tests10.dat #49"
+               html: "<math><ms><malignmark>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math ms>\n|         <math malignmark>\n"
+       }, {
+               name: "tests10.dat #50"
+               html: "<math><mtext><mglyph>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mtext>\n|         <math mglyph>\n"
+       }, {
+               name: "tests10.dat #51"
+               html: "<math><mtext><malignmark>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mtext>\n|         <math malignmark>\n"
+       }, {
+               name: "tests10.dat #52"
+               html: "<math><annotation-xml><svg></svg></annotation-xml><mi>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|         <svg svg>\n|       <math mi>\n"
+       }, {
+               name: "tests10.dat #53"
+               html: "<math><annotation-xml><svg><foreignObject><div><math><mi></mi></math><span></span></div></foreignObject><path></path></svg></annotation-xml><mi>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|         <svg svg>\n|           <svg foreignObject>\n|             <div>\n|               <math math>\n|                 <math mi>\n|               <span>\n|           <svg path>\n|       <math mi>\n"
+       }, {
+               name: "tests10.dat #54"
+               html: "<math><annotation-xml><svg><foreignObject><math><mi><svg></svg></mi><mo></mo></math><span></span></foreignObject><path></path></svg></annotation-xml><mi>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|         <svg svg>\n|           <svg foreignObject>\n|             <math math>\n|               <math mi>\n|                 <svg svg>\n|               <math mo>\n|             <span>\n|           <svg path>\n|       <math mi>\n"
+       }, {
+               name: "tests11.dat #1"
+               html: "<!DOCTYPE html><body><svg attributeName='' attributeType='' baseFrequency='' baseProfile='' calcMode='' clipPathUnits='' diffuseConstant='' edgeMode='' filterUnits='' glyphRef='' gradientTransform='' gradientUnits='' kernelMatrix='' kernelUnitLength='' keyPoints='' keySplines='' keyTimes='' lengthAdjust='' limitingConeAngle='' markerHeight='' markerUnits='' markerWidth='' maskContentUnits='' maskUnits='' numOctaves='' pathLength='' patternContentUnits='' patternTransform='' patternUnits='' pointsAtX='' pointsAtY='' pointsAtZ='' preserveAlpha='' preserveAspectRatio='' primitiveUnits='' refX='' refY='' repeatCount='' repeatDur='' requiredExtensions='' requiredFeatures='' specularConstant='' specularExponent='' spreadMethod='' startOffset='' stdDeviation='' stitchTiles='' surfaceScale='' systemLanguage='' tableValues='' targetX='' targetY='' textLength='' viewBox='' viewTarget='' xChannelSelector='' yChannelSelector='' zoomAndPan=''></svg>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       attributeName=\"\"\n|       attributeType=\"\"\n|       baseFrequency=\"\"\n|       baseProfile=\"\"\n|       calcMode=\"\"\n|       clipPathUnits=\"\"\n|       diffuseConstant=\"\"\n|       edgeMode=\"\"\n|       filterUnits=\"\"\n|       glyphRef=\"\"\n|       gradientTransform=\"\"\n|       gradientUnits=\"\"\n|       kernelMatrix=\"\"\n|       kernelUnitLength=\"\"\n|       keyPoints=\"\"\n|       keySplines=\"\"\n|       keyTimes=\"\"\n|       lengthAdjust=\"\"\n|       limitingConeAngle=\"\"\n|       markerHeight=\"\"\n|       markerUnits=\"\"\n|       markerWidth=\"\"\n|       maskContentUnits=\"\"\n|       maskUnits=\"\"\n|       numOctaves=\"\"\n|       pathLength=\"\"\n|       patternContentUnits=\"\"\n|       patternTransform=\"\"\n|       patternUnits=\"\"\n|       pointsAtX=\"\"\n|       pointsAtY=\"\"\n|       pointsAtZ=\"\"\n|       preserveAlpha=\"\"\n|       preserveAspectRatio=\"\"\n|       primitiveUnits=\"\"\n|       refX=\"\"\n|       refY=\"\"\n|       repeatCount=\"\"\n|       repeatDur=\"\"\n|       requiredExtensions=\"\"\n|       requiredFeatures=\"\"\n|       specularConstant=\"\"\n|       specularExponent=\"\"\n|       spreadMethod=\"\"\n|       startOffset=\"\"\n|       stdDeviation=\"\"\n|       stitchTiles=\"\"\n|       surfaceScale=\"\"\n|       systemLanguage=\"\"\n|       tableValues=\"\"\n|       targetX=\"\"\n|       targetY=\"\"\n|       textLength=\"\"\n|       viewBox=\"\"\n|       viewTarget=\"\"\n|       xChannelSelector=\"\"\n|       yChannelSelector=\"\"\n|       zoomAndPan=\"\"\n"
+       }, {
+               name: "tests11.dat #2"
+               html: "<!DOCTYPE html><BODY><SVG ATTRIBUTENAME='' ATTRIBUTETYPE='' BASEFREQUENCY='' BASEPROFILE='' CALCMODE='' CLIPPATHUNITS='' DIFFUSECONSTANT='' EDGEMODE='' FILTERUNITS='' GLYPHREF='' GRADIENTTRANSFORM='' GRADIENTUNITS='' KERNELMATRIX='' KERNELUNITLENGTH='' KEYPOINTS='' KEYSPLINES='' KEYTIMES='' LENGTHADJUST='' LIMITINGCONEANGLE='' MARKERHEIGHT='' MARKERUNITS='' MARKERWIDTH='' MASKCONTENTUNITS='' MASKUNITS='' NUMOCTAVES='' PATHLENGTH='' PATTERNCONTENTUNITS='' PATTERNTRANSFORM='' PATTERNUNITS='' POINTSATX='' POINTSATY='' POINTSATZ='' PRESERVEALPHA='' PRESERVEASPECTRATIO='' PRIMITIVEUNITS='' REFX='' REFY='' REPEATCOUNT='' REPEATDUR='' REQUIREDEXTENSIONS='' REQUIREDFEATURES='' SPECULARCONSTANT='' SPECULAREXPONENT='' SPREADMETHOD='' STARTOFFSET='' STDDEVIATION='' STITCHTILES='' SURFACESCALE='' SYSTEMLANGUAGE='' TABLEVALUES='' TARGETX='' TARGETY='' TEXTLENGTH='' VIEWBOX='' VIEWTARGET='' XCHANNELSELECTOR='' YCHANNELSELECTOR='' ZOOMANDPAN=''></SVG>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       attributeName=\"\"\n|       attributeType=\"\"\n|       baseFrequency=\"\"\n|       baseProfile=\"\"\n|       calcMode=\"\"\n|       clipPathUnits=\"\"\n|       diffuseConstant=\"\"\n|       edgeMode=\"\"\n|       filterUnits=\"\"\n|       glyphRef=\"\"\n|       gradientTransform=\"\"\n|       gradientUnits=\"\"\n|       kernelMatrix=\"\"\n|       kernelUnitLength=\"\"\n|       keyPoints=\"\"\n|       keySplines=\"\"\n|       keyTimes=\"\"\n|       lengthAdjust=\"\"\n|       limitingConeAngle=\"\"\n|       markerHeight=\"\"\n|       markerUnits=\"\"\n|       markerWidth=\"\"\n|       maskContentUnits=\"\"\n|       maskUnits=\"\"\n|       numOctaves=\"\"\n|       pathLength=\"\"\n|       patternContentUnits=\"\"\n|       patternTransform=\"\"\n|       patternUnits=\"\"\n|       pointsAtX=\"\"\n|       pointsAtY=\"\"\n|       pointsAtZ=\"\"\n|       preserveAlpha=\"\"\n|       preserveAspectRatio=\"\"\n|       primitiveUnits=\"\"\n|       refX=\"\"\n|       refY=\"\"\n|       repeatCount=\"\"\n|       repeatDur=\"\"\n|       requiredExtensions=\"\"\n|       requiredFeatures=\"\"\n|       specularConstant=\"\"\n|       specularExponent=\"\"\n|       spreadMethod=\"\"\n|       startOffset=\"\"\n|       stdDeviation=\"\"\n|       stitchTiles=\"\"\n|       surfaceScale=\"\"\n|       systemLanguage=\"\"\n|       tableValues=\"\"\n|       targetX=\"\"\n|       targetY=\"\"\n|       textLength=\"\"\n|       viewBox=\"\"\n|       viewTarget=\"\"\n|       xChannelSelector=\"\"\n|       yChannelSelector=\"\"\n|       zoomAndPan=\"\"\n"
+       }, {
+               name: "tests11.dat #3"
+               html: "<!DOCTYPE html><body><svg attributename='' attributetype='' basefrequency='' baseprofile='' calcmode='' clippathunits='' diffuseconstant='' edgemode='' filterunits='' filterres='' glyphref='' gradienttransform='' gradientunits='' kernelmatrix='' kernelunitlength='' keypoints='' keysplines='' keytimes='' lengthadjust='' limitingconeangle='' markerheight='' markerunits='' markerwidth='' maskcontentunits='' maskunits='' numoctaves='' pathlength='' patterncontentunits='' patterntransform='' patternunits='' pointsatx='' pointsaty='' pointsatz='' preservealpha='' preserveaspectratio='' primitiveunits='' refx='' refy='' repeatcount='' repeatdur='' requiredextensions='' requiredfeatures='' specularconstant='' specularexponent='' spreadmethod='' startoffset='' stddeviation='' stitchtiles='' surfacescale='' systemlanguage='' tablevalues='' targetx='' targety='' textlength='' viewbox='' viewtarget='' xchannelselector='' ychannelselector='' zoomandpan=''></svg>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       attributeName=\"\"\n|       attributeType=\"\"\n|       baseFrequency=\"\"\n|       baseProfile=\"\"\n|       calcMode=\"\"\n|       clipPathUnits=\"\"\n|       diffuseConstant=\"\"\n|       edgeMode=\"\"\n|       filterUnits=\"\"\n|       filterres=\"\"\n|       glyphRef=\"\"\n|       gradientTransform=\"\"\n|       gradientUnits=\"\"\n|       kernelMatrix=\"\"\n|       kernelUnitLength=\"\"\n|       keyPoints=\"\"\n|       keySplines=\"\"\n|       keyTimes=\"\"\n|       lengthAdjust=\"\"\n|       limitingConeAngle=\"\"\n|       markerHeight=\"\"\n|       markerUnits=\"\"\n|       markerWidth=\"\"\n|       maskContentUnits=\"\"\n|       maskUnits=\"\"\n|       numOctaves=\"\"\n|       pathLength=\"\"\n|       patternContentUnits=\"\"\n|       patternTransform=\"\"\n|       patternUnits=\"\"\n|       pointsAtX=\"\"\n|       pointsAtY=\"\"\n|       pointsAtZ=\"\"\n|       preserveAlpha=\"\"\n|       preserveAspectRatio=\"\"\n|       primitiveUnits=\"\"\n|       refX=\"\"\n|       refY=\"\"\n|       repeatCount=\"\"\n|       repeatDur=\"\"\n|       requiredExtensions=\"\"\n|       requiredFeatures=\"\"\n|       specularConstant=\"\"\n|       specularExponent=\"\"\n|       spreadMethod=\"\"\n|       startOffset=\"\"\n|       stdDeviation=\"\"\n|       stitchTiles=\"\"\n|       surfaceScale=\"\"\n|       systemLanguage=\"\"\n|       tableValues=\"\"\n|       targetX=\"\"\n|       targetY=\"\"\n|       textLength=\"\"\n|       viewBox=\"\"\n|       viewTarget=\"\"\n|       xChannelSelector=\"\"\n|       yChannelSelector=\"\"\n|       zoomAndPan=\"\"\n"
+       }, {
+               name: "tests11.dat #4"
+               html: "<!DOCTYPE html><body><math attributeName='' attributeType='' baseFrequency='' baseProfile='' calcMode='' clipPathUnits='' diffuseConstant='' edgeMode='' filterUnits='' glyphRef='' gradientTransform='' gradientUnits='' kernelMatrix='' kernelUnitLength='' keyPoints='' keySplines='' keyTimes='' lengthAdjust='' limitingConeAngle='' markerHeight='' markerUnits='' markerWidth='' maskContentUnits='' maskUnits='' numOctaves='' pathLength='' patternContentUnits='' patternTransform='' patternUnits='' pointsAtX='' pointsAtY='' pointsAtZ='' preserveAlpha='' preserveAspectRatio='' primitiveUnits='' refX='' refY='' repeatCount='' repeatDur='' requiredExtensions='' requiredFeatures='' specularConstant='' specularExponent='' spreadMethod='' startOffset='' stdDeviation='' stitchTiles='' surfaceScale='' systemLanguage='' tableValues='' targetX='' targetY='' textLength='' viewBox='' viewTarget='' xChannelSelector='' yChannelSelector='' zoomAndPan=''></math>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       attributename=\"\"\n|       attributetype=\"\"\n|       basefrequency=\"\"\n|       baseprofile=\"\"\n|       calcmode=\"\"\n|       clippathunits=\"\"\n|       diffuseconstant=\"\"\n|       edgemode=\"\"\n|       filterunits=\"\"\n|       glyphref=\"\"\n|       gradienttransform=\"\"\n|       gradientunits=\"\"\n|       kernelmatrix=\"\"\n|       kernelunitlength=\"\"\n|       keypoints=\"\"\n|       keysplines=\"\"\n|       keytimes=\"\"\n|       lengthadjust=\"\"\n|       limitingconeangle=\"\"\n|       markerheight=\"\"\n|       markerunits=\"\"\n|       markerwidth=\"\"\n|       maskcontentunits=\"\"\n|       maskunits=\"\"\n|       numoctaves=\"\"\n|       pathlength=\"\"\n|       patterncontentunits=\"\"\n|       patterntransform=\"\"\n|       patternunits=\"\"\n|       pointsatx=\"\"\n|       pointsaty=\"\"\n|       pointsatz=\"\"\n|       preservealpha=\"\"\n|       preserveaspectratio=\"\"\n|       primitiveunits=\"\"\n|       refx=\"\"\n|       refy=\"\"\n|       repeatcount=\"\"\n|       repeatdur=\"\"\n|       requiredextensions=\"\"\n|       requiredfeatures=\"\"\n|       specularconstant=\"\"\n|       specularexponent=\"\"\n|       spreadmethod=\"\"\n|       startoffset=\"\"\n|       stddeviation=\"\"\n|       stitchtiles=\"\"\n|       surfacescale=\"\"\n|       systemlanguage=\"\"\n|       tablevalues=\"\"\n|       targetx=\"\"\n|       targety=\"\"\n|       textlength=\"\"\n|       viewbox=\"\"\n|       viewtarget=\"\"\n|       xchannelselector=\"\"\n|       ychannelselector=\"\"\n|       zoomandpan=\"\"\n"
+       }, {
+               name: "tests11.dat #5"
+               html: "<!DOCTYPE html><body><svg><altGlyph /><altGlyphDef /><altGlyphItem /><animateColor /><animateMotion /><animateTransform /><clipPath /><feBlend /><feColorMatrix /><feComponentTransfer /><feComposite /><feConvolveMatrix /><feDiffuseLighting /><feDisplacementMap /><feDistantLight /><feFlood /><feFuncA /><feFuncB /><feFuncG /><feFuncR /><feGaussianBlur /><feImage /><feMerge /><feMergeNode /><feMorphology /><feOffset /><fePointLight /><feSpecularLighting /><feSpotLight /><feTile /><feTurbulence /><foreignObject /><glyphRef /><linearGradient /><radialGradient /><textPath /></svg>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg altGlyph>\n|       <svg altGlyphDef>\n|       <svg altGlyphItem>\n|       <svg animateColor>\n|       <svg animateMotion>\n|       <svg animateTransform>\n|       <svg clipPath>\n|       <svg feBlend>\n|       <svg feColorMatrix>\n|       <svg feComponentTransfer>\n|       <svg feComposite>\n|       <svg feConvolveMatrix>\n|       <svg feDiffuseLighting>\n|       <svg feDisplacementMap>\n|       <svg feDistantLight>\n|       <svg feFlood>\n|       <svg feFuncA>\n|       <svg feFuncB>\n|       <svg feFuncG>\n|       <svg feFuncR>\n|       <svg feGaussianBlur>\n|       <svg feImage>\n|       <svg feMerge>\n|       <svg feMergeNode>\n|       <svg feMorphology>\n|       <svg feOffset>\n|       <svg fePointLight>\n|       <svg feSpecularLighting>\n|       <svg feSpotLight>\n|       <svg feTile>\n|       <svg feTurbulence>\n|       <svg foreignObject>\n|       <svg glyphRef>\n|       <svg linearGradient>\n|       <svg radialGradient>\n|       <svg textPath>\n"
+       }, {
+               name: "tests11.dat #6"
+               html: "<!DOCTYPE html><body><svg><altglyph /><altglyphdef /><altglyphitem /><animatecolor /><animatemotion /><animatetransform /><clippath /><feblend /><fecolormatrix /><fecomponenttransfer /><fecomposite /><feconvolvematrix /><fediffuselighting /><fedisplacementmap /><fedistantlight /><feflood /><fefunca /><fefuncb /><fefuncg /><fefuncr /><fegaussianblur /><feimage /><femerge /><femergenode /><femorphology /><feoffset /><fepointlight /><fespecularlighting /><fespotlight /><fetile /><feturbulence /><foreignobject /><glyphref /><lineargradient /><radialgradient /><textpath /></svg>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg altGlyph>\n|       <svg altGlyphDef>\n|       <svg altGlyphItem>\n|       <svg animateColor>\n|       <svg animateMotion>\n|       <svg animateTransform>\n|       <svg clipPath>\n|       <svg feBlend>\n|       <svg feColorMatrix>\n|       <svg feComponentTransfer>\n|       <svg feComposite>\n|       <svg feConvolveMatrix>\n|       <svg feDiffuseLighting>\n|       <svg feDisplacementMap>\n|       <svg feDistantLight>\n|       <svg feFlood>\n|       <svg feFuncA>\n|       <svg feFuncB>\n|       <svg feFuncG>\n|       <svg feFuncR>\n|       <svg feGaussianBlur>\n|       <svg feImage>\n|       <svg feMerge>\n|       <svg feMergeNode>\n|       <svg feMorphology>\n|       <svg feOffset>\n|       <svg fePointLight>\n|       <svg feSpecularLighting>\n|       <svg feSpotLight>\n|       <svg feTile>\n|       <svg feTurbulence>\n|       <svg foreignObject>\n|       <svg glyphRef>\n|       <svg linearGradient>\n|       <svg radialGradient>\n|       <svg textPath>\n"
+       }, {
+               name: "tests11.dat #7"
+               html: "<!DOCTYPE html><BODY><SVG><ALTGLYPH /><ALTGLYPHDEF /><ALTGLYPHITEM /><ANIMATECOLOR /><ANIMATEMOTION /><ANIMATETRANSFORM /><CLIPPATH /><FEBLEND /><FECOLORMATRIX /><FECOMPONENTTRANSFER /><FECOMPOSITE /><FECONVOLVEMATRIX /><FEDIFFUSELIGHTING /><FEDISPLACEMENTMAP /><FEDISTANTLIGHT /><FEFLOOD /><FEFUNCA /><FEFUNCB /><FEFUNCG /><FEFUNCR /><FEGAUSSIANBLUR /><FEIMAGE /><FEMERGE /><FEMERGENODE /><FEMORPHOLOGY /><FEOFFSET /><FEPOINTLIGHT /><FESPECULARLIGHTING /><FESPOTLIGHT /><FETILE /><FETURBULENCE /><FOREIGNOBJECT /><GLYPHREF /><LINEARGRADIENT /><RADIALGRADIENT /><TEXTPATH /></SVG>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg altGlyph>\n|       <svg altGlyphDef>\n|       <svg altGlyphItem>\n|       <svg animateColor>\n|       <svg animateMotion>\n|       <svg animateTransform>\n|       <svg clipPath>\n|       <svg feBlend>\n|       <svg feColorMatrix>\n|       <svg feComponentTransfer>\n|       <svg feComposite>\n|       <svg feConvolveMatrix>\n|       <svg feDiffuseLighting>\n|       <svg feDisplacementMap>\n|       <svg feDistantLight>\n|       <svg feFlood>\n|       <svg feFuncA>\n|       <svg feFuncB>\n|       <svg feFuncG>\n|       <svg feFuncR>\n|       <svg feGaussianBlur>\n|       <svg feImage>\n|       <svg feMerge>\n|       <svg feMergeNode>\n|       <svg feMorphology>\n|       <svg feOffset>\n|       <svg fePointLight>\n|       <svg feSpecularLighting>\n|       <svg feSpotLight>\n|       <svg feTile>\n|       <svg feTurbulence>\n|       <svg foreignObject>\n|       <svg glyphRef>\n|       <svg linearGradient>\n|       <svg radialGradient>\n|       <svg textPath>\n"
+       }, {
+               name: "tests11.dat #8"
+               html: "<!DOCTYPE html><body><math><altGlyph /><altGlyphDef /><altGlyphItem /><animateColor /><animateMotion /><animateTransform /><clipPath /><feBlend /><feColorMatrix /><feComponentTransfer /><feComposite /><feConvolveMatrix /><feDiffuseLighting /><feDisplacementMap /><feDistantLight /><feFlood /><feFuncA /><feFuncB /><feFuncG /><feFuncR /><feGaussianBlur /><feImage /><feMerge /><feMergeNode /><feMorphology /><feOffset /><fePointLight /><feSpecularLighting /><feSpotLight /><feTile /><feTurbulence /><foreignObject /><glyphRef /><linearGradient /><radialGradient /><textPath /></math>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math altglyph>\n|       <math altglyphdef>\n|       <math altglyphitem>\n|       <math animatecolor>\n|       <math animatemotion>\n|       <math animatetransform>\n|       <math clippath>\n|       <math feblend>\n|       <math fecolormatrix>\n|       <math fecomponenttransfer>\n|       <math fecomposite>\n|       <math feconvolvematrix>\n|       <math fediffuselighting>\n|       <math fedisplacementmap>\n|       <math fedistantlight>\n|       <math feflood>\n|       <math fefunca>\n|       <math fefuncb>\n|       <math fefuncg>\n|       <math fefuncr>\n|       <math fegaussianblur>\n|       <math feimage>\n|       <math femerge>\n|       <math femergenode>\n|       <math femorphology>\n|       <math feoffset>\n|       <math fepointlight>\n|       <math fespecularlighting>\n|       <math fespotlight>\n|       <math fetile>\n|       <math feturbulence>\n|       <math foreignobject>\n|       <math glyphref>\n|       <math lineargradient>\n|       <math radialgradient>\n|       <math textpath>\n"
+       }, {
+               name: "tests11.dat #9"
+               html: "<!DOCTYPE html><body><svg><solidColor /></svg>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg solidcolor>\n"
+       }, {
+               name: "tests12.dat #1"
+               html: "<!DOCTYPE html><body><p>foo<math><mtext><i>baz</i></mtext><annotation-xml><svg><desc><b>eggs</b></desc><g><foreignObject><P>spam<TABLE><tr><td><img></td></table></foreignObject></g><g>quux</g></svg></annotation-xml></math>bar"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       \"foo\"\n|       <math math>\n|         <math mtext>\n|           <i>\n|             \"baz\"\n|         <math annotation-xml>\n|           <svg svg>\n|             <svg desc>\n|               <b>\n|                 \"eggs\"\n|             <svg g>\n|               <svg foreignObject>\n|                 <p>\n|                   \"spam\"\n|                 <table>\n|                   <tbody>\n|                     <tr>\n|                       <td>\n|                         <img>\n|             <svg g>\n|               \"quux\"\n|       \"bar\"\n"
+       }, {
+               name: "tests12.dat #2"
+               html: "<!DOCTYPE html><body>foo<math><mtext><i>baz</i></mtext><annotation-xml><svg><desc><b>eggs</b></desc><g><foreignObject><P>spam<TABLE><tr><td><img></td></table></foreignObject></g><g>quux</g></svg></annotation-xml></math>bar"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"foo\"\n|     <math math>\n|       <math mtext>\n|         <i>\n|           \"baz\"\n|       <math annotation-xml>\n|         <svg svg>\n|           <svg desc>\n|             <b>\n|               \"eggs\"\n|           <svg g>\n|             <svg foreignObject>\n|               <p>\n|                 \"spam\"\n|               <table>\n|                 <tbody>\n|                   <tr>\n|                     <td>\n|                       <img>\n|           <svg g>\n|             \"quux\"\n|     \"bar\"\n"
+       }, {
+               name: "tests14.dat #1"
+               html: "<!DOCTYPE html><html><body><xyz:abc></xyz:abc>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <xyz:abc>\n"
+       }, {
+               name: "tests14.dat #2"
+               html: "<!DOCTYPE html><html><body><xyz:abc></xyz:abc><span></span>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <xyz:abc>\n|     <span>\n"
+       }, {
+               name: "tests14.dat #3"
+               html: "<!DOCTYPE html><html><html abc:def=gh><xyz:abc></xyz:abc>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   abc:def=\"gh\"\n|   <head>\n|   <body>\n|     <xyz:abc>\n"
+       }, {
+               name: "tests14.dat #4"
+               html: "<!DOCTYPE html><html xml:lang=bar><html xml:lang=foo>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   xml:lang=\"bar\"\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests14.dat #5"
+               html: "<!DOCTYPE html><html 123=456>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   123=\"456\"\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests14.dat #6"
+               html: "<!DOCTYPE html><html 123=456><html 789=012>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   123=\"456\"\n|   789=\"012\"\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests14.dat #7"
+               html: "<!DOCTYPE html><html><body 789=012>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     789=\"012\"\n"
+       }, {
+               name: "tests15.dat #1"
+               html: "<!DOCTYPE html><p><b><i><u></p> <p>X"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <b>\n|         <i>\n|           <u>\n|     <b>\n|       <i>\n|         <u>\n|           \" \"\n|           <p>\n|             \"X\"\n"
+       }, {
+               name: "tests15.dat #2"
+               html: "<p><b><i><u></p>\n<p>X"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <b>\n|         <i>\n|           <u>\n|     <b>\n|       <i>\n|         <u>\n|           \"\n\"\n|           <p>\n|             \"X\"\n"
+       }, {
+               name: "tests15.dat #3"
+               html: "<!doctype html></html> <head>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \" \"\n"
+       }, {
+               name: "tests15.dat #4"
+               html: "<!doctype html></body><meta>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <meta>\n"
+       }, {
+               name: "tests15.dat #5"
+               html: "<html></html><!-- foo -->"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n| <!--  foo  -->\n"
+       }, {
+               name: "tests15.dat #6"
+               html: "<!doctype html></body><title>X</title>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <title>\n|       \"X\"\n"
+       }, {
+               name: "tests15.dat #7"
+               html: "<!doctype html><table> X<meta></table>"
+               errors: 3
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \" X\"\n|     <meta>\n|     <table>\n"
+       }, {
+               name: "tests15.dat #8"
+               html: "<!doctype html><table> x</table>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \" x\"\n|     <table>\n"
+       }, {
+               name: "tests15.dat #9"
+               html: "<!doctype html><table> x </table>"
+               errors: 3
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \" x \"\n|     <table>\n"
+       }, {
+               name: "tests15.dat #10"
+               html: "<!doctype html><table><tr> x</table>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \" x\"\n|     <table>\n|       <tbody>\n|         <tr>\n"
+       }, {
+               name: "tests15.dat #11"
+               html: "<!doctype html><table>X<style> <tr>x </style> </table>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"X\"\n|     <table>\n|       <style>\n|         \" <tr>x \"\n|       \" \"\n"
+       }, {
+               name: "tests15.dat #12"
+               html: "<!doctype html><div><table><a>foo</a> <tr><td>bar</td> </tr></table></div>"
+               errors: 5
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <a>\n|         \"foo\"\n|       <table>\n|         \" \"\n|         <tbody>\n|           <tr>\n|             <td>\n|               \"bar\"\n|             \" \"\n"
+       }, {
+               name: "tests15.dat #13"
+               html: "<frame></frame></frame><frameset><frame><frameset><frame></frameset><noframes></frameset><noframes>"
+               errors: 7
+               expected: "| <html>\n|   <head>\n|   <frameset>\n|     <frame>\n|     <frameset>\n|       <frame>\n|     <noframes>\n|       \"</frameset><noframes>\"\n"
+       }, {
+               name: "tests15.dat #14"
+               html: "<!DOCTYPE html><object></html>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <object>\n"
+       }, {
+               name: "tests16.dat #1"
+               html: "<!doctype html><script>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|   <body>\n"
+       }, {
+               name: "tests16.dat #2"
+               html: "<!doctype html><script>a"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"a\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #3"
+               html: "<!doctype html><script><"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #4"
+               html: "<!doctype html><script></"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #5"
+               html: "<!doctype html><script></S"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</S\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #6"
+               html: "<!doctype html><script></SC"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</SC\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #7"
+               html: "<!doctype html><script></SCR"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</SCR\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #8"
+               html: "<!doctype html><script></SCRI"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</SCRI\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #9"
+               html: "<!doctype html><script></SCRIP"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</SCRIP\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #10"
+               html: "<!doctype html><script></SCRIPT"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</SCRIPT\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #11"
+               html: "<!doctype html><script></SCRIPT "
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|   <body>\n"
+       }, {
+               name: "tests16.dat #12"
+               html: "<!doctype html><script></s"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</s\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #13"
+               html: "<!doctype html><script></sc"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</sc\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #14"
+               html: "<!doctype html><script></scr"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</scr\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #15"
+               html: "<!doctype html><script></scri"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</scri\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #16"
+               html: "<!doctype html><script></scrip"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</scrip\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #17"
+               html: "<!doctype html><script></script"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</script\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #18"
+               html: "<!doctype html><script></script "
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|   <body>\n"
+       }, {
+               name: "tests16.dat #19"
+               html: "<!doctype html><script><!"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #20"
+               html: "<!doctype html><script><!a"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!a\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #21"
+               html: "<!doctype html><script><!-"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!-\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #22"
+               html: "<!doctype html><script><!-a"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!-a\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #23"
+               html: "<!doctype html><script><!--"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #24"
+               html: "<!doctype html><script><!--a"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--a\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #25"
+               html: "<!doctype html><script><!--<"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #26"
+               html: "<!doctype html><script><!--<a"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<a\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #27"
+               html: "<!doctype html><script><!--</"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--</\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #28"
+               html: "<!doctype html><script><!--</script"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--</script\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #29"
+               html: "<!doctype html><script><!--</script "
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #30"
+               html: "<!doctype html><script><!--<s"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<s\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #31"
+               html: "<!doctype html><script><!--<script"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #32"
+               html: "<!doctype html><script><!--<script "
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script \"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #33"
+               html: "<!doctype html><script><!--<script <"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script <\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #34"
+               html: "<!doctype html><script><!--<script <a"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script <a\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #35"
+               html: "<!doctype html><script><!--<script </"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #36"
+               html: "<!doctype html><script><!--<script </s"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </s\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #37"
+               html: "<!doctype html><script><!--<script </script"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #38"
+               html: "<!doctype html><script><!--<script </scripta"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </scripta\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #39"
+               html: "<!doctype html><script><!--<script </script "
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script \"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #40"
+               html: "<!doctype html><script><!--<script </script>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script>\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #41"
+               html: "<!doctype html><script><!--<script </script/"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script/\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #42"
+               html: "<!doctype html><script><!--<script </script <"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script <\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #43"
+               html: "<!doctype html><script><!--<script </script <a"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script <a\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #44"
+               html: "<!doctype html><script><!--<script </script </"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script </\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #45"
+               html: "<!doctype html><script><!--<script </script </script"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script </script\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #46"
+               html: "<!doctype html><script><!--<script </script </script "
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script \"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #47"
+               html: "<!doctype html><script><!--<script </script </script/"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script \"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #48"
+               html: "<!doctype html><script><!--<script </script </script>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script \"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #49"
+               html: "<!doctype html><script><!--<script -"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #50"
+               html: "<!doctype html><script><!--<script -a"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -a\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #51"
+               html: "<!doctype html><script><!--<script -<"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -<\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #52"
+               html: "<!doctype html><script><!--<script --"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #53"
+               html: "<!doctype html><script><!--<script --a"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --a\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #54"
+               html: "<!doctype html><script><!--<script --<"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --<\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #55"
+               html: "<!doctype html><script><!--<script -->"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -->\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #56"
+               html: "<!doctype html><script><!--<script --><"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --><\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #57"
+               html: "<!doctype html><script><!--<script --></"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --></\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #58"
+               html: "<!doctype html><script><!--<script --></script"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --></script\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #59"
+               html: "<!doctype html><script><!--<script --></script "
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -->\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #60"
+               html: "<!doctype html><script><!--<script --></script/"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -->\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #61"
+               html: "<!doctype html><script><!--<script --></script>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -->\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #62"
+               html: "<!doctype html><script><!--<script><\\/script>--></script>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script><\\/script>-->\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #63"
+               html: "<!doctype html><script><!--<script></scr'+'ipt>--></script>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></scr'+'ipt>-->\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #64"
+               html: "<!doctype html><script><!--<script></script><script></script></script>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #65"
+               html: "<!doctype html><script><!--<script></script><script></script>--><!--</script>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>--><!--\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #66"
+               html: "<!doctype html><script><!--<script></script><script></script>-- ></script>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>-- >\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #67"
+               html: "<!doctype html><script><!--<script></script><script></script>- -></script>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>- ->\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #68"
+               html: "<!doctype html><script><!--<script></script><script></script>- - ></script>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>- - >\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #69"
+               html: "<!doctype html><script><!--<script></script><script></script>-></script>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>->\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #70"
+               html: "<!doctype html><script><!--<script>--!></script>X"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script>--!></script>X\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #71"
+               html: "<!doctype html><script><!--<scr'+'ipt></script>--></script>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<scr'+'ipt>\"\n|   <body>\n|     \"-->\"\n"
+       }, {
+               name: "tests16.dat #72"
+               html: "<!doctype html><script><!--<script></scr'+'ipt></script>X"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></scr'+'ipt></script>X\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #73"
+               html: "<!doctype html><style><!--<style></style>--></style>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <style>\n|       \"<!--<style>\"\n|   <body>\n|     \"-->\"\n"
+       }, {
+               name: "tests16.dat #74"
+               html: "<!doctype html><style><!--</style>X"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <style>\n|       \"<!--\"\n|   <body>\n|     \"X\"\n"
+       }, {
+               name: "tests16.dat #75"
+               html: "<!doctype html><style><!--...</style>...--></style>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <style>\n|       \"<!--...\"\n|   <body>\n|     \"...-->\"\n"
+       }, {
+               name: "tests16.dat #76"
+               html: "<!doctype html><style><!--<br><html xmlns:v=\"urn:schemas-microsoft-com:vml\"><!--[if !mso]><style></style>X"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <style>\n|       \"<!--<br><html xmlns:v=\"urn:schemas-microsoft-com:vml\"><!--[if !mso]><style>\"\n|   <body>\n|     \"X\"\n"
+       }, {
+               name: "tests16.dat #77"
+               html: "<!doctype html><style><!--...<style><!--...--!></style>--></style>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <style>\n|       \"<!--...<style><!--...--!>\"\n|   <body>\n|     \"-->\"\n"
+       }, {
+               name: "tests16.dat #78"
+               html: "<!doctype html><style><!--...</style><!-- --><style>@import ...</style>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <style>\n|       \"<!--...\"\n|     <!--   -->\n|     <style>\n|       \"@import ...\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #79"
+               html: "<!doctype html><style>...<style><!--...</style><!-- --></style>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <style>\n|       \"...<style><!--...\"\n|     <!--   -->\n|   <body>\n"
+       }, {
+               name: "tests16.dat #80"
+               html: "<!doctype html><style>...<!--[if IE]><style>...</style>X"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <style>\n|       \"...<!--[if IE]><style>...\"\n|   <body>\n|     \"X\"\n"
+       }, {
+               name: "tests16.dat #81"
+               html: "<!doctype html><title><!--<title></title>--></title>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <title>\n|       \"<!--<title>\"\n|   <body>\n|     \"-->\"\n"
+       }, {
+               name: "tests16.dat #82"
+               html: "<!doctype html><title>&lt;/title></title>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <title>\n|       \"</title>\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #83"
+               html: "<!doctype html><title>foo/title><link></head><body>X"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <title>\n|       \"foo/title><link></head><body>X\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #84"
+               html: "<!doctype html><noscript><!--<noscript></noscript>--></noscript>"
+               scripting: true
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noscript>\n|       \"<!--<noscript>\"\n|   <body>\n|     \"-->\"\n"
+       }, {
+               name: "tests16.dat #85"
+               html: "<!doctype html><noscript><!--<noscript></noscript>--></noscript>"
+               scripting: false
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noscript>\n|       <!-- <noscript></noscript> -->\n|   <body>\n"
+       }, {
+               name: "tests16.dat #86"
+               html: "<!doctype html><noscript><!--</noscript>X<noscript>--></noscript>"
+               scripting: true
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noscript>\n|       \"<!--\"\n|   <body>\n|     \"X\"\n|     <noscript>\n|       \"-->\"\n"
+       }, {
+               name: "tests16.dat #87"
+               html: "<!doctype html><noscript><!--</noscript>X<noscript>--></noscript>"
+               scripting: false
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noscript>\n|       <!-- </noscript>X<noscript> -->\n|   <body>\n"
+       }, {
+               name: "tests16.dat #88"
+               html: "<!doctype html><noscript><iframe></noscript>X"
+               scripting: true
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noscript>\n|       \"<iframe>\"\n|   <body>\n|     \"X\"\n"
+       }, {
+               name: "tests16.dat #89"
+               html: "<!doctype html><noscript><iframe></noscript>X"
+               scripting: false
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noscript>\n|   <body>\n|     <iframe>\n|       \"</noscript>X\"\n"
+       }, {
+               name: "tests16.dat #90"
+               html: "<!doctype html><noframes><!--<noframes></noframes>--></noframes>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noframes>\n|       \"<!--<noframes>\"\n|   <body>\n|     \"-->\"\n"
+       }, {
+               name: "tests16.dat #91"
+               html: "<!doctype html><noframes><body><script><!--...</script></body></noframes></html>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noframes>\n|       \"<body><script><!--...</script></body>\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #92"
+               html: "<!doctype html><textarea><!--<textarea></textarea>--></textarea>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"<!--<textarea>\"\n|     \"-->\"\n"
+       }, {
+               name: "tests16.dat #93"
+               html: "<!doctype html><textarea>&lt;/textarea></textarea>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"</textarea>\"\n"
+       }, {
+               name: "tests16.dat #94"
+               html: "<!doctype html><textarea>&lt;</textarea>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"<\"\n"
+       }, {
+               name: "tests16.dat #95"
+               html: "<!doctype html><textarea>a&lt;b</textarea>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"a<b\"\n"
+       }, {
+               name: "tests16.dat #96"
+               html: "<!doctype html><iframe><!--<iframe></iframe>--></iframe>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <iframe>\n|       \"<!--<iframe>\"\n|     \"-->\"\n"
+       }, {
+               name: "tests16.dat #97"
+               html: "<!doctype html><iframe>...<!--X->...<!--/X->...</iframe>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <iframe>\n|       \"...<!--X->...<!--/X->...\"\n"
+       }, {
+               name: "tests16.dat #98"
+               html: "<!doctype html><xmp><!--<xmp></xmp>--></xmp>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <xmp>\n|       \"<!--<xmp>\"\n|     \"-->\"\n"
+       }, {
+               name: "tests16.dat #99"
+               html: "<!doctype html><noembed><!--<noembed></noembed>--></noembed>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <noembed>\n|       \"<!--<noembed>\"\n|     \"-->\"\n"
+       }, {
+               name: "tests16.dat #100"
+               html: "<script>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|   <body>\n"
+       }, {
+               name: "tests16.dat #101"
+               html: "<script>a"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"a\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #102"
+               html: "<script><"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #103"
+               html: "<script></"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #104"
+               html: "<script></S"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</S\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #105"
+               html: "<script></SC"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</SC\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #106"
+               html: "<script></SCR"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</SCR\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #107"
+               html: "<script></SCRI"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</SCRI\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #108"
+               html: "<script></SCRIP"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</SCRIP\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #109"
+               html: "<script></SCRIPT"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</SCRIPT\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #110"
+               html: "<script></SCRIPT "
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|   <body>\n"
+       }, {
+               name: "tests16.dat #111"
+               html: "<script></s"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</s\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #112"
+               html: "<script></sc"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</sc\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #113"
+               html: "<script></scr"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</scr\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #114"
+               html: "<script></scri"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</scri\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #115"
+               html: "<script></scrip"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</scrip\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #116"
+               html: "<script></script"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</script\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #117"
+               html: "<script></script "
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|   <body>\n"
+       }, {
+               name: "tests16.dat #118"
+               html: "<script><!"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #119"
+               html: "<script><!a"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!a\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #120"
+               html: "<script><!-"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!-\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #121"
+               html: "<script><!-a"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!-a\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #122"
+               html: "<script><!--"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #123"
+               html: "<script><!--a"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--a\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #124"
+               html: "<script><!--<"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #125"
+               html: "<script><!--<a"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<a\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #126"
+               html: "<script><!--</"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--</\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #127"
+               html: "<script><!--</script"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--</script\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #128"
+               html: "<script><!--</script "
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #129"
+               html: "<script><!--<s"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<s\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #130"
+               html: "<script><!--<script"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #131"
+               html: "<script><!--<script "
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script \"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #132"
+               html: "<script><!--<script <"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script <\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #133"
+               html: "<script><!--<script <a"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script <a\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #134"
+               html: "<script><!--<script </"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #135"
+               html: "<script><!--<script </s"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </s\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #136"
+               html: "<script><!--<script </script"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #137"
+               html: "<script><!--<script </scripta"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </scripta\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #138"
+               html: "<script><!--<script </script "
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script \"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #139"
+               html: "<script><!--<script </script>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script>\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #140"
+               html: "<script><!--<script </script/"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script/\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #141"
+               html: "<script><!--<script </script <"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script <\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #142"
+               html: "<script><!--<script </script <a"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script <a\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #143"
+               html: "<script><!--<script </script </"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script </\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #144"
+               html: "<script><!--<script </script </script"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script </script\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #145"
+               html: "<script><!--<script </script </script "
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script \"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #146"
+               html: "<script><!--<script </script </script/"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script \"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #147"
+               html: "<script><!--<script </script </script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script \"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #148"
+               html: "<script><!--<script -"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #149"
+               html: "<script><!--<script -a"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -a\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #150"
+               html: "<script><!--<script --"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #151"
+               html: "<script><!--<script --a"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --a\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #152"
+               html: "<script><!--<script -->"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -->\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #153"
+               html: "<script><!--<script --><"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --><\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #154"
+               html: "<script><!--<script --></"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --></\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #155"
+               html: "<script><!--<script --></script"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --></script\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #156"
+               html: "<script><!--<script --></script "
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -->\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #157"
+               html: "<script><!--<script --></script/"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -->\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #158"
+               html: "<script><!--<script --></script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -->\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #159"
+               html: "<script><!--<script><\\/script>--></script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script><\\/script>-->\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #160"
+               html: "<script><!--<script></scr'+'ipt>--></script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></scr'+'ipt>-->\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #161"
+               html: "<script><!--<script></script><script></script></script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #162"
+               html: "<script><!--<script></script><script></script>--><!--</script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>--><!--\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #163"
+               html: "<script><!--<script></script><script></script>-- ></script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>-- >\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #164"
+               html: "<script><!--<script></script><script></script>- -></script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>- ->\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #165"
+               html: "<script><!--<script></script><script></script>- - ></script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>- - >\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #166"
+               html: "<script><!--<script></script><script></script>-></script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>->\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #167"
+               html: "<script><!--<script>--!></script>X"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script>--!></script>X\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #168"
+               html: "<script><!--<scr'+'ipt></script>--></script>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<scr'+'ipt>\"\n|   <body>\n|     \"-->\"\n"
+       }, {
+               name: "tests16.dat #169"
+               html: "<script><!--<script></scr'+'ipt></script>X"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></scr'+'ipt></script>X\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #170"
+               html: "<style><!--<style></style>--></style>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <style>\n|       \"<!--<style>\"\n|   <body>\n|     \"-->\"\n"
+       }, {
+               name: "tests16.dat #171"
+               html: "<style><!--</style>X"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <style>\n|       \"<!--\"\n|   <body>\n|     \"X\"\n"
+       }, {
+               name: "tests16.dat #172"
+               html: "<style><!--...</style>...--></style>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <style>\n|       \"<!--...\"\n|   <body>\n|     \"...-->\"\n"
+       }, {
+               name: "tests16.dat #173"
+               html: "<style><!--<br><html xmlns:v=\"urn:schemas-microsoft-com:vml\"><!--[if !mso]><style></style>X"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <style>\n|       \"<!--<br><html xmlns:v=\"urn:schemas-microsoft-com:vml\"><!--[if !mso]><style>\"\n|   <body>\n|     \"X\"\n"
+       }, {
+               name: "tests16.dat #174"
+               html: "<style><!--...<style><!--...--!></style>--></style>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <style>\n|       \"<!--...<style><!--...--!>\"\n|   <body>\n|     \"-->\"\n"
+       }, {
+               name: "tests16.dat #175"
+               html: "<style><!--...</style><!-- --><style>@import ...</style>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <style>\n|       \"<!--...\"\n|     <!--   -->\n|     <style>\n|       \"@import ...\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #176"
+               html: "<style>...<style><!--...</style><!-- --></style>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <style>\n|       \"...<style><!--...\"\n|     <!--   -->\n|   <body>\n"
+       }, {
+               name: "tests16.dat #177"
+               html: "<style>...<!--[if IE]><style>...</style>X"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <style>\n|       \"...<!--[if IE]><style>...\"\n|   <body>\n|     \"X\"\n"
+       }, {
+               name: "tests16.dat #178"
+               html: "<title><!--<title></title>--></title>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <title>\n|       \"<!--<title>\"\n|   <body>\n|     \"-->\"\n"
+       }, {
+               name: "tests16.dat #179"
+               html: "<title>&lt;/title></title>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <title>\n|       \"</title>\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #180"
+               html: "<title>foo/title><link></head><body>X"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <title>\n|       \"foo/title><link></head><body>X\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #181"
+               html: "<noscript><!--<noscript></noscript>--></noscript>"
+               scripting: true
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <noscript>\n|       \"<!--<noscript>\"\n|   <body>\n|     \"-->\"\n"
+       }, {
+               name: "tests16.dat #182"
+               html: "<noscript><!--<noscript></noscript>--></noscript>"
+               scripting: false
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <noscript>\n|       <!-- <noscript></noscript> -->\n|   <body>\n"
+       }, {
+               name: "tests16.dat #183"
+               html: "<noscript><!--</noscript>X<noscript>--></noscript>"
+               scripting: true
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <noscript>\n|       \"<!--\"\n|   <body>\n|     \"X\"\n|     <noscript>\n|       \"-->\"\n"
+       }, {
+               name: "tests16.dat #184"
+               html: "<noscript><!--</noscript>X<noscript>--></noscript>"
+               scripting: false
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <noscript>\n|       <!-- </noscript>X<noscript> -->\n|   <body>\n"
+       }, {
+               name: "tests16.dat #185"
+               html: "<noscript><iframe></noscript>X"
+               scripting: true
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <noscript>\n|       \"<iframe>\"\n|   <body>\n|     \"X\"\n"
+       }, {
+               name: "tests16.dat #186"
+               html: "<noscript><iframe></noscript>X"
+               scripting: false
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <noscript>\n|   <body>\n|     <iframe>\n|       \"</noscript>X\"\n"
+       }, {
+               name: "tests16.dat #187"
+               html: "<noframes><!--<noframes></noframes>--></noframes>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <noframes>\n|       \"<!--<noframes>\"\n|   <body>\n|     \"-->\"\n"
+       }, {
+               name: "tests16.dat #188"
+               html: "<noframes><body><script><!--...</script></body></noframes></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <noframes>\n|       \"<body><script><!--...</script></body>\"\n|   <body>\n"
+       }, {
+               name: "tests16.dat #189"
+               html: "<textarea><!--<textarea></textarea>--></textarea>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"<!--<textarea>\"\n|     \"-->\"\n"
+       }, {
+               name: "tests16.dat #190"
+               html: "<textarea>&lt;/textarea></textarea>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"</textarea>\"\n"
+       }, {
+               name: "tests16.dat #191"
+               html: "<iframe><!--<iframe></iframe>--></iframe>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <iframe>\n|       \"<!--<iframe>\"\n|     \"-->\"\n"
+       }, {
+               name: "tests16.dat #192"
+               html: "<iframe>...<!--X->...<!--/X->...</iframe>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <iframe>\n|       \"...<!--X->...<!--/X->...\"\n"
+       }, {
+               name: "tests16.dat #193"
+               html: "<xmp><!--<xmp></xmp>--></xmp>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <xmp>\n|       \"<!--<xmp>\"\n|     \"-->\"\n"
+       }, {
+               name: "tests16.dat #194"
+               html: "<noembed><!--<noembed></noembed>--></noembed>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <noembed>\n|       \"<!--<noembed>\"\n|     \"-->\"\n"
+       }, {
+               name: "tests16.dat #195"
+               html: "<!doctype html><table>\n"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       \"\n\"\n"
+       }, {
+               name: "tests16.dat #196"
+               html: "<!doctype html><table><td><span><font></span><span>"
+               errors: 3
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <span>\n|               <font>\n|             <font>\n|               <span>\n"
+       }, {
+               name: "tests16.dat #197"
+               html: "<!doctype html><form><table></form><form></table></form>"
+               errors: 5
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <form>\n|       <table>\n|         <form>\n"
+       }, {
+               name: "tests17.dat #1"
+               html: "<!doctype html><table><tbody><select><tr>"
+               errors: 3
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|     <table>\n|       <tbody>\n|         <tr>\n"
+       }, {
+               name: "tests17.dat #2"
+               html: "<!doctype html><table><tr><select><td>"
+               errors: 3
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n"
+       }, {
+               name: "tests17.dat #3"
+               html: "<!doctype html><table><tr><td><select><td>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <select>\n|           <td>\n"
+       }, {
+               name: "tests17.dat #4"
+               html: "<!doctype html><table><tr><th><select><td>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <th>\n|             <select>\n|           <td>\n"
+       }, {
+               name: "tests17.dat #5"
+               html: "<!doctype html><table><caption><select><tr>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <select>\n|       <tbody>\n|         <tr>\n"
+       }, {
+               name: "tests17.dat #6"
+               html: "<!doctype html><select><tr>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n"
+       }, {
+               name: "tests17.dat #7"
+               html: "<!doctype html><select><td>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n"
+       }, {
+               name: "tests17.dat #8"
+               html: "<!doctype html><select><th>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n"
+       }, {
+               name: "tests17.dat #9"
+               html: "<!doctype html><select><tbody>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n"
+       }, {
+               name: "tests17.dat #10"
+               html: "<!doctype html><select><thead>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n"
+       }, {
+               name: "tests17.dat #11"
+               html: "<!doctype html><select><tfoot>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n"
+       }, {
+               name: "tests17.dat #12"
+               html: "<!doctype html><select><caption>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n"
+       }, {
+               name: "tests17.dat #13"
+               html: "<!doctype html><table><tr></table>a"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|     \"a\"\n"
+       }, {
+               name: "tests18.dat #1"
+               html: "<!doctype html><plaintext></plaintext>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <plaintext>\n|       \"</plaintext>\"\n"
+       }, {
+               name: "tests18.dat #2"
+               html: "<!doctype html><table><plaintext></plaintext>"
+               errors: 14
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <plaintext>\n|       \"</plaintext>\"\n|     <table>\n"
+       }, {
+               name: "tests18.dat #3"
+               html: "<!doctype html><table><tbody><plaintext></plaintext>"
+               errors: 14
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <plaintext>\n|       \"</plaintext>\"\n|     <table>\n|       <tbody>\n"
+       }, {
+               name: "tests18.dat #4"
+               html: "<!doctype html><table><tbody><tr><plaintext></plaintext>"
+               errors: 14
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <plaintext>\n|       \"</plaintext>\"\n|     <table>\n|       <tbody>\n|         <tr>\n"
+       }, {
+               name: "tests18.dat #5"
+               html: "<!doctype html><table><td><plaintext></plaintext>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <plaintext>\n|               \"</plaintext>\"\n"
+       }, {
+               name: "tests18.dat #6"
+               html: "<!doctype html><table><caption><plaintext></plaintext>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <plaintext>\n|           \"</plaintext>\"\n"
+       }, {
+               name: "tests18.dat #7"
+               html: "<!doctype html><table><tr><style></script></style>abc"
+               errors: 4
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"abc\"\n|     <table>\n|       <tbody>\n|         <tr>\n|           <style>\n|             \"</script>\"\n"
+       }, {
+               name: "tests18.dat #8"
+               html: "<!doctype html><table><tr><script></style></script>abc"
+               errors: 4
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"abc\"\n|     <table>\n|       <tbody>\n|         <tr>\n|           <script>\n|             \"</style>\"\n"
+       }, {
+               name: "tests18.dat #9"
+               html: "<!doctype html><table><caption><style></script></style>abc"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <style>\n|           \"</script>\"\n|         \"abc\"\n"
+       }, {
+               name: "tests18.dat #10"
+               html: "<!doctype html><table><td><style></script></style>abc"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <style>\n|               \"</script>\"\n|             \"abc\"\n"
+       }, {
+               name: "tests18.dat #11"
+               html: "<!doctype html><select><script></style></script>abc"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <script>\n|         \"</style>\"\n|       \"abc\"\n"
+       }, {
+               name: "tests18.dat #12"
+               html: "<!doctype html><table><select><script></style></script>abc"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <script>\n|         \"</style>\"\n|       \"abc\"\n|     <table>\n"
+       }, {
+               name: "tests18.dat #13"
+               html: "<!doctype html><table><tr><select><script></style></script>abc"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <script>\n|         \"</style>\"\n|       \"abc\"\n|     <table>\n|       <tbody>\n|         <tr>\n"
+       }, {
+               name: "tests18.dat #14"
+               html: "<!doctype html><frameset></frameset><noframes>abc"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|   <noframes>\n|     \"abc\"\n"
+       }, {
+               name: "tests18.dat #15"
+               html: "<!doctype html><frameset></frameset><noframes>abc</noframes><!--abc-->"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|   <noframes>\n|     \"abc\"\n|   <!-- abc -->\n"
+       }, {
+               name: "tests18.dat #16"
+               html: "<!doctype html><frameset></frameset></html><noframes>abc"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|   <noframes>\n|     \"abc\"\n"
+       }, {
+               name: "tests18.dat #17"
+               html: "<!doctype html><frameset></frameset></html><noframes>abc</noframes><!--abc-->"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|   <noframes>\n|     \"abc\"\n| <!-- abc -->\n"
+       }, {
+               name: "tests18.dat #18"
+               html: "<!doctype html><table><tr></tbody><tfoot>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|       <tfoot>\n"
+       }, {
+               name: "tests18.dat #19"
+               html: "<!doctype html><table><td><svg></svg>abc<td>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <svg svg>\n|             \"abc\"\n|           <td>\n"
+       }, {
+               name: "tests19.dat #1"
+               html: "<!doctype html><math><mn DefinitionUrl=\"foo\">"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mn>\n|         definitionURL=\"foo\"\n"
+       }, {
+               name: "tests19.dat #2"
+               html: "<!doctype html><html></p><!--foo-->"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <!-- foo -->\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests19.dat #3"
+               html: "<!doctype html><head></head></p><!--foo-->"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <!-- foo -->\n|   <body>\n"
+       }, {
+               name: "tests19.dat #4"
+               html: "<!doctype html><body><p><pre>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <pre>\n"
+       }, {
+               name: "tests19.dat #5"
+               html: "<!doctype html><body><p><listing>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <listing>\n"
+       }, {
+               name: "tests19.dat #6"
+               html: "<!doctype html><p><plaintext>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <plaintext>\n"
+       }, {
+               name: "tests19.dat #7"
+               html: "<!doctype html><p><h1>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <h1>\n"
+       }, {
+               name: "tests19.dat #8"
+               html: "<!doctype html><form><isindex>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <form>\n"
+       }, {
+               name: "tests19.dat #9"
+               html: "<!doctype html><isindex action=\"POST\">"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <form>\n|       action=\"POST\"\n|       <hr>\n|       <label>\n|         \"This is a searchable index. Enter search keywords: \"\n|         <input>\n|           name=\"isindex\"\n|       <hr>\n"
+       }, {
+               name: "tests19.dat #10"
+               html: "<!doctype html><isindex prompt=\"this is isindex\">"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <form>\n|       <hr>\n|       <label>\n|         \"this is isindex\"\n|         <input>\n|           name=\"isindex\"\n|       <hr>\n"
+       }, {
+               name: "tests19.dat #11"
+               html: "<!doctype html><isindex type=\"hidden\">"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <form>\n|       <hr>\n|       <label>\n|         \"This is a searchable index. Enter search keywords: \"\n|         <input>\n|           name=\"isindex\"\n|           type=\"hidden\"\n|       <hr>\n"
+       }, {
+               name: "tests19.dat #12"
+               html: "<!doctype html><isindex name=\"foo\">"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <form>\n|       <hr>\n|       <label>\n|         \"This is a searchable index. Enter search keywords: \"\n|         <input>\n|           name=\"isindex\"\n|       <hr>\n"
+       }, {
+               name: "tests19.dat #13"
+               html: "<!doctype html><ruby><p><rp>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       <p>\n|       <rp>\n"
+       }, {
+               name: "tests19.dat #14"
+               html: "<!doctype html><ruby><div><span><rp>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       <div>\n|         <span>\n|           <rp>\n"
+       }, {
+               name: "tests19.dat #15"
+               html: "<!doctype html><ruby><div><p><rp>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       <div>\n|         <p>\n|         <rp>\n"
+       }, {
+               name: "tests19.dat #16"
+               html: "<!doctype html><ruby><p><rt>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       <p>\n|       <rt>\n"
+       }, {
+               name: "tests19.dat #17"
+               html: "<!doctype html><ruby><div><span><rt>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       <div>\n|         <span>\n|           <rt>\n"
+       }, {
+               name: "tests19.dat #18"
+               html: "<!doctype html><ruby><div><p><rt>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       <div>\n|         <p>\n|         <rt>\n"
+       }, {
+               name: "tests19.dat #19"
+               html: "<html><ruby>a<rb>b<rt></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rb>\n|         \"b\"\n|       <rt>\n"
+       }, {
+               name: "tests19.dat #20"
+               html: "<html><ruby>a<rp>b<rt></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rp>\n|         \"b\"\n|       <rt>\n"
+       }, {
+               name: "tests19.dat #21"
+               html: "<html><ruby>a<rt>b<rt></ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rt>\n|         \"b\"\n|       <rt>\n"
+       }, {
+               name: "tests19.dat #22"
+               html: "<html><ruby>a<rtc>b<rt>c<rb>d</ruby></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rtc>\n|         \"b\"\n|         <rt>\n|           \"c\"\n|       <rb>\n|         \"d\"\n"
+       }, {
+               name: "tests19.dat #23"
+               html: "<!doctype html><math/><foo>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|     <foo>\n"
+       }, {
+               name: "tests19.dat #24"
+               html: "<!doctype html><svg/><foo>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|     <foo>\n"
+       }, {
+               name: "tests19.dat #25"
+               html: "<!doctype html><div></body><!--foo-->"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <div>\n|   <!-- foo -->\n"
+       }, {
+               name: "tests19.dat #26"
+               html: "<!doctype html><h1><div><h3><span></h1>foo"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <h1>\n|       <div>\n|         <h3>\n|           <span>\n|         \"foo\"\n"
+       }, {
+               name: "tests19.dat #27"
+               html: "<!doctype html><p></h3>foo"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       \"foo\"\n"
+       }, {
+               name: "tests19.dat #28"
+               html: "<!doctype html><h3><li>abc</h2>foo"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <h3>\n|       <li>\n|         \"abc\"\n|     \"foo\"\n"
+       }, {
+               name: "tests19.dat #29"
+               html: "<!doctype html><table>abc<!--foo-->"
+               errors: 4
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"abc\"\n|     <table>\n|       <!-- foo -->\n"
+       }, {
+               name: "tests19.dat #30"
+               html: "<!doctype html><table>  <!--foo-->"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       \"  \"\n|       <!-- foo -->\n"
+       }, {
+               name: "tests19.dat #31"
+               html: "<!doctype html><table> b <!--foo-->"
+               errors: 4
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \" b \"\n|     <table>\n|       <!-- foo -->\n"
+       }, {
+               name: "tests19.dat #32"
+               html: "<!doctype html><select><option><option>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n|       <option>\n"
+       }, {
+               name: "tests19.dat #33"
+               html: "<!doctype html><select><option></optgroup>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n"
+       }, {
+               name: "tests19.dat #34"
+               html: "<!doctype html><select><option></optgroup>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n"
+       }, {
+               name: "tests19.dat #35"
+               html: "<!doctype html><dd><optgroup><dd>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <dd>\n|       <optgroup>\n|     <dd>\n"
+       }, {
+               name: "tests19.dat #36"
+               html: "<!doctype html><p><math><mi><p><h1>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <math math>\n|         <math mi>\n|           <p>\n|           <h1>\n"
+       }, {
+               name: "tests19.dat #37"
+               html: "<!doctype html><p><math><mo><p><h1>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <math math>\n|         <math mo>\n|           <p>\n|           <h1>\n"
+       }, {
+               name: "tests19.dat #38"
+               html: "<!doctype html><p><math><mn><p><h1>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <math math>\n|         <math mn>\n|           <p>\n|           <h1>\n"
+       }, {
+               name: "tests19.dat #39"
+               html: "<!doctype html><p><math><ms><p><h1>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <math math>\n|         <math ms>\n|           <p>\n|           <h1>\n"
+       }, {
+               name: "tests19.dat #40"
+               html: "<!doctype html><p><math><mtext><p><h1>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <math math>\n|         <math mtext>\n|           <p>\n|           <h1>\n"
+       }, {
+               name: "tests19.dat #41"
+               html: "<!doctype html><frameset></noframes>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "tests19.dat #42"
+               html: "<!doctype html><html c=d><body></html><html a=b>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   a=\"b\"\n|   c=\"d\"\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests19.dat #43"
+               html: "<!doctype html><html c=d><frameset></frameset></html><html a=b>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   a=\"b\"\n|   c=\"d\"\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "tests19.dat #44"
+               html: "<!doctype html><html><frameset></frameset></html><!--foo-->"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n| <!-- foo -->\n"
+       }, {
+               name: "tests19.dat #45"
+               html: "<!doctype html><html><frameset></frameset></html>  "
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|   \"  \"\n"
+       }, {
+               name: "tests19.dat #46"
+               html: "<!doctype html><html><frameset></frameset></html>abc"
+               errors: 3
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "tests19.dat #47"
+               html: "<!doctype html><html><frameset></frameset></html><p>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "tests19.dat #48"
+               html: "<!doctype html><html><frameset></frameset></html></p>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "tests19.dat #49"
+               html: "<html><frameset></frameset></html><!doctype html>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "tests19.dat #50"
+               html: "<!doctype html><body><frameset>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests19.dat #51"
+               html: "<!doctype html><p><frameset><frame>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|     <frame>\n"
+       }, {
+               name: "tests19.dat #52"
+               html: "<!doctype html><p>a<frameset>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       \"a\"\n"
+       }, {
+               name: "tests19.dat #53"
+               html: "<!doctype html><p> <frameset><frame>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|     <frame>\n"
+       }, {
+               name: "tests19.dat #54"
+               html: "<!doctype html><pre><frameset>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n"
+       }, {
+               name: "tests19.dat #55"
+               html: "<!doctype html><listing><frameset>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <listing>\n"
+       }, {
+               name: "tests19.dat #56"
+               html: "<!doctype html><li><frameset>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <li>\n"
+       }, {
+               name: "tests19.dat #57"
+               html: "<!doctype html><dd><frameset>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <dd>\n"
+       }, {
+               name: "tests19.dat #58"
+               html: "<!doctype html><dt><frameset>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <dt>\n"
+       }, {
+               name: "tests19.dat #59"
+               html: "<!doctype html><button><frameset>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <button>\n"
+       }, {
+               name: "tests19.dat #60"
+               html: "<!doctype html><applet><frameset>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <applet>\n"
+       }, {
+               name: "tests19.dat #61"
+               html: "<!doctype html><marquee><frameset>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <marquee>\n"
+       }, {
+               name: "tests19.dat #62"
+               html: "<!doctype html><object><frameset>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <object>\n"
+       }, {
+               name: "tests19.dat #63"
+               html: "<!doctype html><table><frameset>"
+               errors: 3
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n"
+       }, {
+               name: "tests19.dat #64"
+               html: "<!doctype html><area><frameset>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <area>\n"
+       }, {
+               name: "tests19.dat #65"
+               html: "<!doctype html><basefont><frameset>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <basefont>\n|   <frameset>\n"
+       }, {
+               name: "tests19.dat #66"
+               html: "<!doctype html><bgsound><frameset>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <bgsound>\n|   <frameset>\n"
+       }, {
+               name: "tests19.dat #67"
+               html: "<!doctype html><br><frameset>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <br>\n"
+       }, {
+               name: "tests19.dat #68"
+               html: "<!doctype html><embed><frameset>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <embed>\n"
+       }, {
+               name: "tests19.dat #69"
+               html: "<!doctype html><img><frameset>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <img>\n"
+       }, {
+               name: "tests19.dat #70"
+               html: "<!doctype html><input><frameset>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <input>\n"
+       }, {
+               name: "tests19.dat #71"
+               html: "<!doctype html><keygen><frameset>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <keygen>\n"
+       }, {
+               name: "tests19.dat #72"
+               html: "<!doctype html><wbr><frameset>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <wbr>\n"
+       }, {
+               name: "tests19.dat #73"
+               html: "<!doctype html><hr><frameset>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <hr>\n"
+       }, {
+               name: "tests19.dat #74"
+               html: "<!doctype html><textarea></textarea><frameset>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <textarea>\n"
+       }, {
+               name: "tests19.dat #75"
+               html: "<!doctype html><xmp></xmp><frameset>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <xmp>\n"
+       }, {
+               name: "tests19.dat #76"
+               html: "<!doctype html><iframe></iframe><frameset>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <iframe>\n"
+       }, {
+               name: "tests19.dat #77"
+               html: "<!doctype html><select></select><frameset>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n"
+       }, {
+               name: "tests19.dat #78"
+               html: "<!doctype html><svg></svg><frameset><frame>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|     <frame>\n"
+       }, {
+               name: "tests19.dat #79"
+               html: "<!doctype html><math></math><frameset><frame>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|     <frame>\n"
+       }, {
+               name: "tests19.dat #80"
+               html: "<!doctype html><svg><foreignObject><div> <frameset><frame>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|     <frame>\n"
+       }, {
+               name: "tests19.dat #81"
+               html: "<!doctype html><svg>a</svg><frameset><frame>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"a\"\n"
+       }, {
+               name: "tests19.dat #82"
+               html: "<!doctype html><svg> </svg><frameset><frame>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|     <frame>\n"
+       }, {
+               name: "tests19.dat #83"
+               html: "<html>aaa<frameset></frameset>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"aaa\"\n"
+       }, {
+               name: "tests19.dat #84"
+               html: "<html> a <frameset></frameset>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"a \"\n"
+       }, {
+               name: "tests19.dat #85"
+               html: "<!doctype html><div><frameset>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "tests19.dat #86"
+               html: "<!doctype html><div><body><frameset>"
+               errors: 3
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <div>\n"
+       }, {
+               name: "tests19.dat #87"
+               html: "<!doctype html><p><math></p>a"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <math math>\n|     \"a\"\n"
+       }, {
+               name: "tests19.dat #88"
+               html: "<!doctype html><p><math><mn><span></p>a"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <math math>\n|         <math mn>\n|           <span>\n|             <p>\n|             \"a\"\n"
+       }, {
+               name: "tests19.dat #89"
+               html: "<!doctype html><math></html>"
+               errors: 3
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n"
+       }, {
+               name: "tests19.dat #90"
+               html: "<!doctype html><meta charset=\"ascii\">"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <meta>\n|       charset=\"ascii\"\n|   <body>\n"
+       }, {
+               name: "tests19.dat #91"
+               html: "<!doctype html><meta http-equiv=\"content-type\" content=\"text/html;charset=ascii\">"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <meta>\n|       content=\"text/html;charset=ascii\"\n|       http-equiv=\"content-type\"\n|   <body>\n"
+       }, {
+               name: "tests19.dat #92"
+               html: "<!doctype html><head><!--aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa--><meta charset=\"utf8\">"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <!-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -->\n|     <meta>\n|       charset=\"utf8\"\n|   <body>\n"
+       }, {
+               name: "tests19.dat #93"
+               html: "<!doctype html><html a=b><head></head><html c=d>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   a=\"b\"\n|   c=\"d\"\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests19.dat #94"
+               html: "<!doctype html><image/>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <img>\n"
+       }, {
+               name: "tests19.dat #95"
+               html: "<!doctype html>a<i>b<table>c<b>d</i>e</b>f"
+               errors: 9
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"a\"\n|     <i>\n|       \"bc\"\n|       <b>\n|         \"de\"\n|       \"f\"\n|       <table>\n"
+       }, {
+               name: "tests19.dat #96"
+               html: "<!doctype html><table><i>a<b>b<div>c<a>d</i>e</b>f"
+               errors: 17
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <i>\n|       \"a\"\n|       <b>\n|         \"b\"\n|     <b>\n|     <div>\n|       <b>\n|         <i>\n|           \"c\"\n|           <a>\n|             \"d\"\n|         <a>\n|           \"e\"\n|       <a>\n|         \"f\"\n|     <table>\n"
+       }, {
+               name: "tests19.dat #97"
+               html: "<!doctype html><i>a<b>b<div>c<a>d</i>e</b>f"
+               errors: 5
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <i>\n|       \"a\"\n|       <b>\n|         \"b\"\n|     <b>\n|     <div>\n|       <b>\n|         <i>\n|           \"c\"\n|           <a>\n|             \"d\"\n|         <a>\n|           \"e\"\n|       <a>\n|         \"f\"\n"
+       }, {
+               name: "tests19.dat #98"
+               html: "<!doctype html><table><i>a<b>b<div>c</i>"
+               errors: 9
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <i>\n|       \"a\"\n|       <b>\n|         \"b\"\n|     <b>\n|       <div>\n|         <i>\n|           \"c\"\n|     <table>\n"
+       }, {
+               name: "tests19.dat #99"
+               html: "<!doctype html><table><i>a<b>b<div>c<a>d</i>e</b>f"
+               errors: 17
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <i>\n|       \"a\"\n|       <b>\n|         \"b\"\n|     <b>\n|     <div>\n|       <b>\n|         <i>\n|           \"c\"\n|           <a>\n|             \"d\"\n|         <a>\n|           \"e\"\n|       <a>\n|         \"f\"\n|     <table>\n"
+       }, {
+               name: "tests19.dat #100"
+               html: "<!doctype html><table><i>a<div>b<tr>c<b>d</i>e"
+               errors: 11
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <i>\n|       \"a\"\n|       <div>\n|         \"b\"\n|     <i>\n|       \"c\"\n|       <b>\n|         \"d\"\n|     <b>\n|       \"e\"\n|     <table>\n|       <tbody>\n|         <tr>\n"
+       }, {
+               name: "tests19.dat #101"
+               html: "<!doctype html><table><td><table><i>a<div>b<b>c</i>d"
+               errors: 12
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <i>\n|               \"a\"\n|             <div>\n|               <i>\n|                 \"b\"\n|                 <b>\n|                   \"c\"\n|               <b>\n|                 \"d\"\n|             <table>\n"
+       }, {
+               name: "tests19.dat #102"
+               html: "<!doctype html><body><bgsound>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <bgsound>\n"
+       }, {
+               name: "tests19.dat #103"
+               html: "<!doctype html><body><basefont>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <basefont>\n"
+       }, {
+               name: "tests19.dat #104"
+               html: "<!doctype html><a><b></a><basefont>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <b>\n|     <basefont>\n"
+       }, {
+               name: "tests19.dat #105"
+               html: "<!doctype html><a><b></a><bgsound>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <b>\n|     <bgsound>\n"
+       }, {
+               name: "tests19.dat #106"
+               html: "<!doctype html><figcaption><article></figcaption>a"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <figcaption>\n|       <article>\n|     \"a\"\n"
+       }, {
+               name: "tests19.dat #107"
+               html: "<!doctype html><summary><article></summary>a"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <summary>\n|       <article>\n|     \"a\"\n"
+       }, {
+               name: "tests19.dat #108"
+               html: "<!doctype html><p><a><plaintext>b"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <a>\n|     <plaintext>\n|       <a>\n|         \"b\"\n"
+       }, {
+               name: "tests19.dat #109"
+               html: "<!DOCTYPE html><div>a<a></div>b<p>c</p>d"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"a\"\n|       <a>\n|     <a>\n|       \"b\"\n|       <p>\n|         \"c\"\n|       \"d\"\n"
+       }, {
+               name: "tests1.dat #1"
+               html: "Test"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"Test\"\n"
+       }, {
+               name: "tests1.dat #2"
+               html: "<p>One<p>Two"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       \"One\"\n|     <p>\n|       \"Two\"\n"
+       }, {
+               name: "tests1.dat #3"
+               html: "Line1<br>Line2<br>Line3<br>Line4"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"Line1\"\n|     <br>\n|     \"Line2\"\n|     <br>\n|     \"Line3\"\n|     <br>\n|     \"Line4\"\n"
+       }, {
+               name: "tests1.dat #4"
+               html: "<html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #5"
+               html: "<head>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #6"
+               html: "<body>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #7"
+               html: "<html><head>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #8"
+               html: "<html><head></head>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #9"
+               html: "<html><head></head><body>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #10"
+               html: "<html><head></head><body></body>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #11"
+               html: "<html><head><body></body></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #12"
+               html: "<html><head></body></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #13"
+               html: "<html><head><body></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #14"
+               html: "<html><body></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #15"
+               html: "<body></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #16"
+               html: "<head></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #17"
+               html: "</head>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #18"
+               html: "</body>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #19"
+               html: "</html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #20"
+               html: "<b><table><td><i></table>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <table>\n|         <tbody>\n|           <tr>\n|             <td>\n|               <i>\n"
+       }, {
+               name: "tests1.dat #21"
+               html: "<b><table><td></b><i></table>X"
+               errors: 5
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <table>\n|         <tbody>\n|           <tr>\n|             <td>\n|               <i>\n|       \"X\"\n"
+       }, {
+               name: "tests1.dat #22"
+               html: "<h1>Hello<h2>World"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <h1>\n|       \"Hello\"\n|     <h2>\n|       \"World\"\n"
+       }, {
+               name: "tests1.dat #23"
+               html: "<a><p>X<a>Y</a>Z</p></a>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|     <p>\n|       <a>\n|         \"X\"\n|       <a>\n|         \"Y\"\n|       \"Z\"\n"
+       }, {
+               name: "tests1.dat #24"
+               html: "<b><button>foo</b>bar"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|     <button>\n|       <b>\n|         \"foo\"\n|       \"bar\"\n"
+       }, {
+               name: "tests1.dat #25"
+               html: "<!DOCTYPE html><span><button>foo</span>bar"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <span>\n|       <button>\n|         \"foobar\"\n"
+       }, {
+               name: "tests1.dat #26"
+               html: "<p><b><div><marquee></p></b></div>X"
+               errors: 6
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <b>\n|     <div>\n|       <b>\n|         <marquee>\n|           <p>\n|           \"X\"\n"
+       }, {
+               name: "tests1.dat #27"
+               html: "<script><div></script></div><title><p></title><p><p>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<div>\"\n|     <title>\n|       \"<p>\"\n|   <body>\n|     <p>\n|     <p>\n"
+       }, {
+               name: "tests1.dat #28"
+               html: "<!--><div>--<!-->"
+               errors: 4
+               expected: "| <!--  -->\n| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"--\"\n|       <!--  -->\n"
+       }, {
+               name: "tests1.dat #29"
+               html: "<p><hr></p>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <hr>\n|     <p>\n"
+       }, {
+               name: "tests1.dat #30"
+               html: "<select><b><option><select><option></b></select>X"
+               errors: 6
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n|     <option>\n|       \"X\"\n"
+       }, {
+               name: "tests1.dat #31"
+               html: "<a><table><td><a><table></table><a></tr><a></table><b>X</b>C<a>Y"
+               errors: 9
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <a>\n|       <table>\n|         <tbody>\n|           <tr>\n|             <td>\n|               <a>\n|                 <table>\n|               <a>\n|     <a>\n|       <b>\n|         \"X\"\n|       \"C\"\n|     <a>\n|       \"Y\"\n"
+       }, {
+               name: "tests1.dat #32"
+               html: "<a X>0<b>1<a Y>2"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       x=\"\"\n|       \"0\"\n|       <b>\n|         \"1\"\n|     <b>\n|       <a>\n|         y=\"\"\n|         \"2\"\n"
+       }, {
+               name: "tests1.dat #33"
+               html: "<!-----><font><div>hello<table>excite!<b>me!<th><i>please!</tr><!--X-->"
+               errors: 16
+               expected: "| <!-- - -->\n| <html>\n|   <head>\n|   <body>\n|     <font>\n|       <div>\n|         \"helloexcite!\"\n|         <b>\n|           \"me!\"\n|         <table>\n|           <tbody>\n|             <tr>\n|               <th>\n|                 <i>\n|                   \"please!\"\n|             <!-- X -->\n"
+       }, {
+               name: "tests1.dat #34"
+               html: "<!DOCTYPE html><li>hello<li>world<ul>how<li>do</ul>you</body><!--do-->"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <li>\n|       \"hello\"\n|     <li>\n|       \"world\"\n|       <ul>\n|         \"how\"\n|         <li>\n|           \"do\"\n|       \"you\"\n|   <!-- do -->\n"
+       }, {
+               name: "tests1.dat #35"
+               html: "<!DOCTYPE html>A<option>B<optgroup>C<select>D</option>E"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"A\"\n|     <option>\n|       \"B\"\n|     <optgroup>\n|       \"C\"\n|       <select>\n|         \"DE\"\n"
+       }, {
+               name: "tests1.dat #36"
+               html: "<"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"<\"\n"
+       }, {
+               name: "tests1.dat #37"
+               html: "<#"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"<#\"\n"
+       }, {
+               name: "tests1.dat #38"
+               html: "</"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"</\"\n"
+       }, {
+               name: "tests1.dat #39"
+               html: "</#"
+               errors: 2
+               expected: "| <!-- # -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #40"
+               html: "<?"
+               errors: 2
+               expected: "| <!-- ? -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #41"
+               html: "<?#"
+               errors: 2
+               expected: "| <!-- ?# -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #42"
+               html: "<!"
+               errors: 2
+               expected: "| <!--  -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #43"
+               html: "<!#"
+               errors: 2
+               expected: "| <!-- # -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #44"
+               html: "<?COMMENT?>"
+               errors: 2
+               expected: "| <!-- ?COMMENT? -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #45"
+               html: "<!COMMENT>"
+               errors: 2
+               expected: "| <!-- COMMENT -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #46"
+               html: "</ COMMENT >"
+               errors: 2
+               expected: "| <!--  COMMENT  -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #47"
+               html: "<?COM--MENT?>"
+               errors: 2
+               expected: "| <!-- ?COM--MENT? -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #48"
+               html: "<!COM--MENT>"
+               errors: 2
+               expected: "| <!-- COM--MENT -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #49"
+               html: "</ COM--MENT >"
+               errors: 2
+               expected: "| <!--  COM--MENT  -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #50"
+               html: "<!DOCTYPE html><style> EOF"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <style>\n|       \" EOF\"\n|   <body>\n"
+       }, {
+               name: "tests1.dat #51"
+               html: "<!DOCTYPE html><script> <!-- </script> --> </script> EOF"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \" <!-- \"\n|     \" \"\n|   <body>\n|     \"-->  EOF\"\n"
+       }, {
+               name: "tests1.dat #52"
+               html: "<b><p></b>TEST"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|     <p>\n|       <b>\n|       \"TEST\"\n"
+       }, {
+               name: "tests1.dat #53"
+               html: "<p id=a><b><p id=b></b>TEST"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       id=\"a\"\n|       <b>\n|     <p>\n|       id=\"b\"\n|       \"TEST\"\n"
+       }, {
+               name: "tests1.dat #54"
+               html: "<b id=a><p><b id=b></p></b>TEST"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       id=\"a\"\n|       <p>\n|         <b>\n|           id=\"b\"\n|       \"TEST\"\n"
+       }, {
+               name: "tests1.dat #55"
+               html: "<!DOCTYPE html><title>U-test</title><body><div><p>Test<u></p></div></body>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <title>\n|       \"U-test\"\n|   <body>\n|     <div>\n|       <p>\n|         \"Test\"\n|         <u>\n"
+       }, {
+               name: "tests1.dat #56"
+               html: "<!DOCTYPE html><font><table></font></table></font>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <font>\n|       <table>\n"
+       }, {
+               name: "tests1.dat #57"
+               html: "<font><p>hello<b>cruel</font>world"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <font>\n|     <p>\n|       <font>\n|         \"hello\"\n|         <b>\n|           \"cruel\"\n|       <b>\n|         \"world\"\n"
+       }, {
+               name: "tests1.dat #58"
+               html: "<b>Test</i>Test"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       \"TestTest\"\n"
+       }, {
+               name: "tests1.dat #59"
+               html: "<b>A<cite>B<div>C"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       \"A\"\n|       <cite>\n|         \"B\"\n|         <div>\n|           \"C\"\n"
+       }, {
+               name: "tests1.dat #60"
+               html: "<b>A<cite>B<div>C</cite>D"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       \"A\"\n|       <cite>\n|         \"B\"\n|         <div>\n|           \"CD\"\n"
+       }, {
+               name: "tests1.dat #61"
+               html: "<b>A<cite>B<div>C</b>D"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       \"A\"\n|       <cite>\n|         \"B\"\n|     <div>\n|       <b>\n|         \"C\"\n|       \"D\"\n"
+       }, {
+               name: "tests1.dat #62"
+               html: ""
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #63"
+               html: "<DIV>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n"
+       }, {
+               name: "tests1.dat #64"
+               html: "<DIV> abc"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc\"\n"
+       }, {
+               name: "tests1.dat #65"
+               html: "<DIV> abc <B>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n"
+       }, {
+               name: "tests1.dat #66"
+               html: "<DIV> abc <B> def"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def\"\n"
+       }, {
+               name: "tests1.dat #67"
+               html: "<DIV> abc <B> def <I>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def \"\n|         <i>\n"
+       }, {
+               name: "tests1.dat #68"
+               html: "<DIV> abc <B> def <I> ghi"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def \"\n|         <i>\n|           \" ghi\"\n"
+       }, {
+               name: "tests1.dat #69"
+               html: "<DIV> abc <B> def <I> ghi <P>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def \"\n|         <i>\n|           \" ghi \"\n|           <p>\n"
+       }, {
+               name: "tests1.dat #70"
+               html: "<DIV> abc <B> def <I> ghi <P> jkl"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def \"\n|         <i>\n|           \" ghi \"\n|           <p>\n|             \" jkl\"\n"
+       }, {
+               name: "tests1.dat #71"
+               html: "<DIV> abc <B> def <I> ghi <P> jkl </B>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def \"\n|         <i>\n|           \" ghi \"\n|       <i>\n|         <p>\n|           <b>\n|             \" jkl \"\n"
+       }, {
+               name: "tests1.dat #72"
+               html: "<DIV> abc <B> def <I> ghi <P> jkl </B> mno"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def \"\n|         <i>\n|           \" ghi \"\n|       <i>\n|         <p>\n|           <b>\n|             \" jkl \"\n|           \" mno\"\n"
+       }, {
+               name: "tests1.dat #73"
+               html: "<DIV> abc <B> def <I> ghi <P> jkl </B> mno </I>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def \"\n|         <i>\n|           \" ghi \"\n|       <i>\n|       <p>\n|         <i>\n|           <b>\n|             \" jkl \"\n|           \" mno \"\n"
+       }, {
+               name: "tests1.dat #74"
+               html: "<DIV> abc <B> def <I> ghi <P> jkl </B> mno </I> pqr"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def \"\n|         <i>\n|           \" ghi \"\n|       <i>\n|       <p>\n|         <i>\n|           <b>\n|             \" jkl \"\n|           \" mno \"\n|         \" pqr\"\n"
+       }, {
+               name: "tests1.dat #75"
+               html: "<DIV> abc <B> def <I> ghi <P> jkl </B> mno </I> pqr </P>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def \"\n|         <i>\n|           \" ghi \"\n|       <i>\n|       <p>\n|         <i>\n|           <b>\n|             \" jkl \"\n|           \" mno \"\n|         \" pqr \"\n"
+       }, {
+               name: "tests1.dat #76"
+               html: "<DIV> abc <B> def <I> ghi <P> jkl </B> mno </I> pqr </P> stu"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def \"\n|         <i>\n|           \" ghi \"\n|       <i>\n|       <p>\n|         <i>\n|           <b>\n|             \" jkl \"\n|           \" mno \"\n|         \" pqr \"\n|       \" stu\"\n"
+       }, {
+               name: "tests1.dat #77"
+               html: "<test attribute---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <test>\n|       attribute----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------=\"\"\n"
+       }, {
+               name: "tests1.dat #78"
+               html: "<a href=\"blah\">aba<table><a href=\"foo\">br<tr><td></td></tr>x</table>aoe"
+               errors: 8
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       href=\"blah\"\n|       \"aba\"\n|       <a>\n|         href=\"foo\"\n|         \"br\"\n|       <a>\n|         href=\"foo\"\n|         \"x\"\n|       <table>\n|         <tbody>\n|           <tr>\n|             <td>\n|     <a>\n|       href=\"foo\"\n|       \"aoe\"\n"
+       }, {
+               name: "tests1.dat #79"
+               html: "<a href=\"blah\">aba<table><tr><td><a href=\"foo\">br</td></tr>x</table>aoe"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       href=\"blah\"\n|       \"abax\"\n|       <table>\n|         <tbody>\n|           <tr>\n|             <td>\n|               <a>\n|                 href=\"foo\"\n|                 \"br\"\n|       \"aoe\"\n"
+       }, {
+               name: "tests1.dat #80"
+               html: "<table><a href=\"blah\">aba<tr><td><a href=\"foo\">br</td></tr>x</table>aoe"
+               errors: 8
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       href=\"blah\"\n|       \"aba\"\n|     <a>\n|       href=\"blah\"\n|       \"x\"\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <a>\n|               href=\"foo\"\n|               \"br\"\n|     <a>\n|       href=\"blah\"\n|       \"aoe\"\n"
+       }, {
+               name: "tests1.dat #81"
+               html: "<a href=a>aa<marquee>aa<a href=b>bb</marquee>aa"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       href=\"a\"\n|       \"aa\"\n|       <marquee>\n|         \"aa\"\n|         <a>\n|           href=\"b\"\n|           \"bb\"\n|       \"aa\"\n"
+       }, {
+               name: "tests1.dat #82"
+               html: "<wbr><strike><code></strike><code><strike></code>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <wbr>\n|     <strike>\n|       <code>\n|     <code>\n|       <code>\n|         <strike>\n"
+       }, {
+               name: "tests1.dat #83"
+               html: "<!DOCTYPE html><spacer>foo"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <spacer>\n|       \"foo\"\n"
+       }, {
+               name: "tests1.dat #84"
+               html: "<title><meta></title><link><title><meta></title>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <title>\n|       \"<meta>\"\n|     <link>\n|     <title>\n|       \"<meta>\"\n|   <body>\n"
+       }, {
+               name: "tests1.dat #85"
+               html: "<style><!--</style><meta><script>--><link></script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <style>\n|       \"<!--\"\n|     <meta>\n|     <script>\n|       \"--><link>\"\n|   <body>\n"
+       }, {
+               name: "tests1.dat #86"
+               html: "<head><meta></head><link>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <meta>\n|     <link>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #87"
+               html: "<table><tr><tr><td><td><span><th><span>X</table>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|         <tr>\n|           <td>\n|           <td>\n|             <span>\n|           <th>\n|             <span>\n|               \"X\"\n"
+       }, {
+               name: "tests1.dat #88"
+               html: "<body><body><base><link><meta><title><p></title><body><p></body>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <base>\n|     <link>\n|     <meta>\n|     <title>\n|       \"<p>\"\n|     <p>\n"
+       }, {
+               name: "tests1.dat #89"
+               html: "<textarea><p></textarea>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"<p>\"\n"
+       }, {
+               name: "tests1.dat #90"
+               html: "<p><image></p>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <img>\n"
+       }, {
+               name: "tests1.dat #91"
+               html: "<a><table><a></table><p><a><div><a>"
+               errors: 10
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <a>\n|       <table>\n|     <p>\n|       <a>\n|     <div>\n|       <a>\n"
+       }, {
+               name: "tests1.dat #92"
+               html: "<head></p><meta><p>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <meta>\n|   <body>\n|     <p>\n"
+       }, {
+               name: "tests1.dat #93"
+               html: "<head></html><meta><p>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <meta>\n|     <p>\n"
+       }, {
+               name: "tests1.dat #94"
+               html: "<b><table><td><i></table>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <table>\n|         <tbody>\n|           <tr>\n|             <td>\n|               <i>\n"
+       }, {
+               name: "tests1.dat #95"
+               html: "<b><table><td></b><i></table>"
+               errors: 5
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <table>\n|         <tbody>\n|           <tr>\n|             <td>\n|               <i>\n"
+       }, {
+               name: "tests1.dat #96"
+               html: "<h1><h2>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <h1>\n|     <h2>\n"
+       }, {
+               name: "tests1.dat #97"
+               html: "<a><p><a></a></p></a>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|     <p>\n|       <a>\n|       <a>\n"
+       }, {
+               name: "tests1.dat #98"
+               html: "<b><button></b></button></b>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|     <button>\n|       <b>\n"
+       }, {
+               name: "tests1.dat #99"
+               html: "<p><b><div><marquee></p></b></div>"
+               errors: 6
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <b>\n|     <div>\n|       <b>\n|         <marquee>\n|           <p>\n"
+       }, {
+               name: "tests1.dat #100"
+               html: "<script></script></div><title></title><p><p>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|     <title>\n|   <body>\n|     <p>\n|     <p>\n"
+       }, {
+               name: "tests1.dat #101"
+               html: "<p><hr></p>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <hr>\n|     <p>\n"
+       }, {
+               name: "tests1.dat #102"
+               html: "<select><b><option><select><option></b></select>"
+               errors: 6
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n|     <option>\n"
+       }, {
+               name: "tests1.dat #103"
+               html: "<html><head><title></title><body></body></html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <title>\n|   <body>\n"
+       }, {
+               name: "tests1.dat #104"
+               html: "<a><table><td><a><table></table><a></tr><a></table><a>"
+               errors: 10
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <a>\n|       <table>\n|         <tbody>\n|           <tr>\n|             <td>\n|               <a>\n|                 <table>\n|               <a>\n|     <a>\n"
+       }, {
+               name: "tests1.dat #105"
+               html: "<ul><li></li><div><li></div><li><li><div><li><address><li><b><em></b><li></ul>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ul>\n|       <li>\n|       <div>\n|         <li>\n|       <li>\n|       <li>\n|         <div>\n|       <li>\n|         <address>\n|       <li>\n|         <b>\n|           <em>\n|       <li>\n"
+       }, {
+               name: "tests1.dat #106"
+               html: "<ul><li><ul></li><li>a</li></ul></li></ul>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ul>\n|       <li>\n|         <ul>\n|           <li>\n|             \"a\"\n"
+       }, {
+               name: "tests1.dat #107"
+               html: "<frameset><frame><frameset><frame></frameset><noframes></noframes></frameset>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <frameset>\n|     <frame>\n|     <frameset>\n|       <frame>\n|     <noframes>\n"
+       }, {
+               name: "tests1.dat #108"
+               html: "<h1><table><td><h3></table><h3></h1>"
+               errors: 5
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <h1>\n|       <table>\n|         <tbody>\n|           <tr>\n|             <td>\n|               <h3>\n|     <h3>\n"
+       }, {
+               name: "tests1.dat #109"
+               html: "<table><colgroup><col><colgroup><col><col><col><colgroup><col><col><thead><tr><td></table>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <colgroup>\n|         <col>\n|       <colgroup>\n|         <col>\n|         <col>\n|         <col>\n|       <colgroup>\n|         <col>\n|         <col>\n|       <thead>\n|         <tr>\n|           <td>\n"
+       }, {
+               name: "tests1.dat #110"
+               html: "<table><col><tbody><col><tr><col><td><col></table><col>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <colgroup>\n|         <col>\n|       <tbody>\n|       <colgroup>\n|         <col>\n|       <tbody>\n|         <tr>\n|       <colgroup>\n|         <col>\n|       <tbody>\n|         <tr>\n|           <td>\n|       <colgroup>\n|         <col>\n"
+       }, {
+               name: "tests1.dat #111"
+               html: "<table><colgroup><tbody><colgroup><tr><colgroup><td><colgroup></table><colgroup>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <colgroup>\n|       <tbody>\n|       <colgroup>\n|       <tbody>\n|         <tr>\n|       <colgroup>\n|       <tbody>\n|         <tr>\n|           <td>\n|       <colgroup>\n"
+       }, {
+               name: "tests1.dat #112"
+               html: "</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: 85
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <br>\n|     <p>\n"
+       }, {
+               name: "tests1.dat #113"
+               html: "<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: 111
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <br>\n|     <table>\n|       <tbody>\n|         <tr>\n|     <p>\n"
+       }, {
+               name: "tests1.dat #114"
+               html: "<frameset>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "tests20.dat #1"
+               html: "<!doctype html><p><button><button>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|       <button>\n"
+       }, {
+               name: "tests20.dat #2"
+               html: "<!doctype html><p><button><address>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <address>\n"
+       }, {
+               name: "tests20.dat #3"
+               html: "<!doctype html><p><button><blockquote>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <blockquote>\n"
+       }, {
+               name: "tests20.dat #4"
+               html: "<!doctype html><p><button><menu>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <menu>\n"
+       }, {
+               name: "tests20.dat #5"
+               html: "<!doctype html><p><button><p>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <p>\n"
+       }, {
+               name: "tests20.dat #6"
+               html: "<!doctype html><p><button><ul>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <ul>\n"
+       }, {
+               name: "tests20.dat #7"
+               html: "<!doctype html><p><button><h1>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <h1>\n"
+       }, {
+               name: "tests20.dat #8"
+               html: "<!doctype html><p><button><h6>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <h6>\n"
+       }, {
+               name: "tests20.dat #9"
+               html: "<!doctype html><p><button><listing>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <listing>\n"
+       }, {
+               name: "tests20.dat #10"
+               html: "<!doctype html><p><button><pre>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <pre>\n"
+       }, {
+               name: "tests20.dat #11"
+               html: "<!doctype html><p><button><form>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <form>\n"
+       }, {
+               name: "tests20.dat #12"
+               html: "<!doctype html><p><button><li>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <li>\n"
+       }, {
+               name: "tests20.dat #13"
+               html: "<!doctype html><p><button><dd>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <dd>\n"
+       }, {
+               name: "tests20.dat #14"
+               html: "<!doctype html><p><button><dt>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <dt>\n"
+       }, {
+               name: "tests20.dat #15"
+               html: "<!doctype html><p><button><plaintext>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <plaintext>\n"
+       }, {
+               name: "tests20.dat #16"
+               html: "<!doctype html><p><button><table>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <table>\n"
+       }, {
+               name: "tests20.dat #17"
+               html: "<!doctype html><p><button><hr>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <hr>\n"
+       }, {
+               name: "tests20.dat #18"
+               html: "<!doctype html><p><button><xmp>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <xmp>\n"
+       }, {
+               name: "tests20.dat #19"
+               html: "<!doctype html><p><button></p>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <p>\n"
+       }, {
+               name: "tests20.dat #20"
+               html: "<!doctype html><address><button></address>a"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <address>\n|       <button>\n|     \"a\"\n"
+       }, {
+               name: "tests20.dat #21"
+               html: "<!doctype html><address><button></address>a"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <address>\n|       <button>\n|     \"a\"\n"
+       }, {
+               name: "tests20.dat #22"
+               html: "<p><table></p>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <p>\n|       <table>\n"
+       }, {
+               name: "tests20.dat #23"
+               html: "<!doctype html><svg>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n"
+       }, {
+               name: "tests20.dat #24"
+               html: "<!doctype html><p><figcaption>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <figcaption>\n"
+       }, {
+               name: "tests20.dat #25"
+               html: "<!doctype html><p><summary>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <summary>\n"
+       }, {
+               name: "tests20.dat #26"
+               html: "<!doctype html><form><table><form>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <form>\n|       <table>\n"
+       }, {
+               name: "tests20.dat #27"
+               html: "<!doctype html><table><form><form>"
+               errors: 3
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <form>\n"
+       }, {
+               name: "tests20.dat #28"
+               html: "<!doctype html><table><form></table><form>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <form>\n"
+       }, {
+               name: "tests20.dat #29"
+               html: "<!doctype html><svg><foreignObject><p>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg foreignObject>\n|         <p>\n"
+       }, {
+               name: "tests20.dat #30"
+               html: "<!doctype html><svg><title>abc"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg title>\n|         \"abc\"\n"
+       }, {
+               name: "tests20.dat #31"
+               html: "<option><span><option>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <option>\n|       <span>\n|         <option>\n"
+       }, {
+               name: "tests20.dat #32"
+               html: "<option><option>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <option>\n|     <option>\n"
+       }, {
+               name: "tests20.dat #33"
+               html: "<math><annotation-xml><div>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|     <div>\n"
+       }, {
+               name: "tests20.dat #34"
+               html: "<math><annotation-xml encoding=\"application/svg+xml\"><div>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|         encoding=\"application/svg+xml\"\n|     <div>\n"
+       }, {
+               name: "tests20.dat #35"
+               html: "<math><annotation-xml encoding=\"application/xhtml+xml\"><div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|         encoding=\"application/xhtml+xml\"\n|         <div>\n"
+       }, {
+               name: "tests20.dat #36"
+               html: "<math><annotation-xml encoding=\"aPPlication/xhtmL+xMl\"><div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|         encoding=\"aPPlication/xhtmL+xMl\"\n|         <div>\n"
+       }, {
+               name: "tests20.dat #37"
+               html: "<math><annotation-xml encoding=\"text/html\"><div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|         encoding=\"text/html\"\n|         <div>\n"
+       }, {
+               name: "tests20.dat #38"
+               html: "<math><annotation-xml encoding=\"Text/htmL\"><div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|         encoding=\"Text/htmL\"\n|         <div>\n"
+       }, {
+               name: "tests20.dat #39"
+               html: "<math><annotation-xml encoding=\" text/html \"><div>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|         encoding=\" text/html \"\n|     <div>\n"
+       }, {
+               name: "tests21.dat #1"
+               html: "<svg><![CDATA[foo]]>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"foo\"\n"
+       }, {
+               name: "tests21.dat #2"
+               html: "<math><![CDATA[foo]]>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       \"foo\"\n"
+       }, {
+               name: "tests21.dat #3"
+               html: "<div><![CDATA[foo]]>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <!-- [CDATA[foo]] -->\n"
+       }, {
+               name: "tests21.dat #4"
+               html: "<svg><![CDATA[foo"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"foo\"\n"
+       }, {
+               name: "tests21.dat #5"
+               html: "<svg><![CDATA[foo"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"foo\"\n"
+       }, {
+               name: "tests21.dat #6"
+               html: "<svg><![CDATA["
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n"
+       }, {
+               name: "tests21.dat #7"
+               html: "<svg><![CDATA[]]>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n"
+       }, {
+               name: "tests21.dat #8"
+               html: "<svg><![CDATA[]] >]]>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"]] >\"\n"
+       }, {
+               name: "tests21.dat #9"
+               html: "<svg><![CDATA[]] >]]>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"]] >\"\n"
+       }, {
+               name: "tests21.dat #10"
+               html: "<svg><![CDATA[]]"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"]]\"\n"
+       }, {
+               name: "tests21.dat #11"
+               html: "<svg><![CDATA[]"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"]\"\n"
+       }, {
+               name: "tests21.dat #12"
+               html: "<svg><![CDATA[]>a"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"]>a\"\n"
+       }, {
+               name: "tests21.dat #13"
+               html: "<!DOCTYPE html><svg><![CDATA[foo]]]>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"foo]\"\n"
+       }, {
+               name: "tests21.dat #14"
+               html: "<!DOCTYPE html><svg><![CDATA[foo]]]]>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"foo]]\"\n"
+       }, {
+               name: "tests21.dat #15"
+               html: "<!DOCTYPE html><svg><![CDATA[foo]]]]]>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"foo]]]\"\n"
+       }, {
+               name: "tests21.dat #16"
+               html: "<svg><foreignObject><div><![CDATA[foo]]>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg foreignObject>\n|         <div>\n|           <!-- [CDATA[foo]] -->\n"
+       }, {
+               name: "tests21.dat #17"
+               html: "<svg><![CDATA[<svg>]]>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"<svg>\"\n"
+       }, {
+               name: "tests21.dat #18"
+               html: "<svg><![CDATA[</svg>a]]>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"</svg>a\"\n"
+       }, {
+               name: "tests21.dat #19"
+               html: "<svg><![CDATA[<svg>a"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"<svg>a\"\n"
+       }, {
+               name: "tests21.dat #20"
+               html: "<svg><![CDATA[</svg>a"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"</svg>a\"\n"
+       }, {
+               name: "tests21.dat #21"
+               html: "<svg><![CDATA[<svg>]]><path>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"<svg>\"\n|       <svg path>\n"
+       }, {
+               name: "tests21.dat #22"
+               html: "<svg><![CDATA[<svg>]]></path>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"<svg>\"\n"
+       }, {
+               name: "tests21.dat #23"
+               html: "<svg><![CDATA[<svg>]]><!--path-->"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"<svg>\"\n|       <!-- path -->\n"
+       }, {
+               name: "tests21.dat #24"
+               html: "<svg><![CDATA[<svg>]]>path"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"<svg>path\"\n"
+       }, {
+               name: "tests21.dat #25"
+               html: "<svg><![CDATA[<!--svg-->]]>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"<!--svg-->\"\n"
+       }, {
+               name: "tests22.dat #1"
+               html: "<a><b><big><em><strong><div>X</a>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <b>\n|         <big>\n|           <em>\n|             <strong>\n|     <big>\n|       <em>\n|         <strong>\n|           <div>\n|             <a>\n|               \"X\"\n"
+       }, {
+               name: "tests22.dat #2"
+               html: "<a><b><div id=1><div id=2><div id=3><div id=4><div id=5><div id=6><div id=7><div id=8>A</a>"
+               errors: 10
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <b>\n|     <b>\n|       <div>\n|         id=\"1\"\n|         <a>\n|         <div>\n|           id=\"2\"\n|           <a>\n|           <div>\n|             id=\"3\"\n|             <a>\n|             <div>\n|               id=\"4\"\n|               <a>\n|               <div>\n|                 id=\"5\"\n|                 <a>\n|                 <div>\n|                   id=\"6\"\n|                   <a>\n|                   <div>\n|                     id=\"7\"\n|                     <a>\n|                     <div>\n|                       id=\"8\"\n|                       <a>\n|                         \"A\"\n"
+       }, {
+               name: "tests22.dat #3"
+               html: "<a><b><div id=1><div id=2><div id=3><div id=4><div id=5><div id=6><div id=7><div id=8><div id=9>A</a>"
+               errors: 10
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <b>\n|     <b>\n|       <div>\n|         id=\"1\"\n|         <a>\n|         <div>\n|           id=\"2\"\n|           <a>\n|           <div>\n|             id=\"3\"\n|             <a>\n|             <div>\n|               id=\"4\"\n|               <a>\n|               <div>\n|                 id=\"5\"\n|                 <a>\n|                 <div>\n|                   id=\"6\"\n|                   <a>\n|                   <div>\n|                     id=\"7\"\n|                     <a>\n|                     <div>\n|                       id=\"8\"\n|                       <a>\n|                         <div>\n|                           id=\"9\"\n|                           \"A\"\n"
+       }, {
+               name: "tests22.dat #4"
+               html: "<a><b><div id=1><div id=2><div id=3><div id=4><div id=5><div id=6><div id=7><div id=8><div id=9><div id=10>A</a>"
+               errors: 10
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <b>\n|     <b>\n|       <div>\n|         id=\"1\"\n|         <a>\n|         <div>\n|           id=\"2\"\n|           <a>\n|           <div>\n|             id=\"3\"\n|             <a>\n|             <div>\n|               id=\"4\"\n|               <a>\n|               <div>\n|                 id=\"5\"\n|                 <a>\n|                 <div>\n|                   id=\"6\"\n|                   <a>\n|                   <div>\n|                     id=\"7\"\n|                     <a>\n|                     <div>\n|                       id=\"8\"\n|                       <a>\n|                         <div>\n|                           id=\"9\"\n|                           <div>\n|                             id=\"10\"\n|                             \"A\"\n"
+       }, {
+               name: "tests22.dat #5"
+               html: "<cite><b><cite><i><cite><i><cite><i><div>X</b>TEST"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <cite>\n|       <b>\n|         <cite>\n|           <i>\n|             <cite>\n|               <i>\n|                 <cite>\n|                   <i>\n|       <i>\n|         <i>\n|           <div>\n|             <b>\n|               \"X\"\n|             \"TEST\"\n"
+       }, {
+               name: "tests23.dat #1"
+               html: "<p><font size=4><font color=red><font size=4><font size=4><font size=4><font size=4><font size=4><font color=red><p>X"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <font>\n|         size=\"4\"\n|         <font>\n|           color=\"red\"\n|           <font>\n|             size=\"4\"\n|             <font>\n|               size=\"4\"\n|               <font>\n|                 size=\"4\"\n|                 <font>\n|                   size=\"4\"\n|                   <font>\n|                     size=\"4\"\n|                     <font>\n|                       color=\"red\"\n|     <p>\n|       <font>\n|         color=\"red\"\n|         <font>\n|           size=\"4\"\n|           <font>\n|             size=\"4\"\n|             <font>\n|               size=\"4\"\n|               <font>\n|                 color=\"red\"\n|                 \"X\"\n"
+       }, {
+               name: "tests23.dat #2"
+               html: "<p><font size=4><font size=4><font size=4><font size=4><p>X"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <font>\n|         size=\"4\"\n|         <font>\n|           size=\"4\"\n|           <font>\n|             size=\"4\"\n|             <font>\n|               size=\"4\"\n|     <p>\n|       <font>\n|         size=\"4\"\n|         <font>\n|           size=\"4\"\n|           <font>\n|             size=\"4\"\n|             \"X\"\n"
+       }, {
+               name: "tests23.dat #3"
+               html: "<p><font size=4><font size=4><font size=4><font size=\"5\"><font size=4><p>X"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <font>\n|         size=\"4\"\n|         <font>\n|           size=\"4\"\n|           <font>\n|             size=\"4\"\n|             <font>\n|               size=\"5\"\n|               <font>\n|                 size=\"4\"\n|     <p>\n|       <font>\n|         size=\"4\"\n|         <font>\n|           size=\"4\"\n|           <font>\n|             size=\"5\"\n|             <font>\n|               size=\"4\"\n|               \"X\"\n"
+       }, {
+               name: "tests23.dat #4"
+               html: "<p><font size=4 id=a><font size=4 id=b><font size=4><font size=4><p>X"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <font>\n|         id=\"a\"\n|         size=\"4\"\n|         <font>\n|           id=\"b\"\n|           size=\"4\"\n|           <font>\n|             size=\"4\"\n|             <font>\n|               size=\"4\"\n|     <p>\n|       <font>\n|         id=\"a\"\n|         size=\"4\"\n|         <font>\n|           id=\"b\"\n|           size=\"4\"\n|           <font>\n|             size=\"4\"\n|             <font>\n|               size=\"4\"\n|               \"X\"\n"
+       }, {
+               name: "tests23.dat #5"
+               html: "<p><b id=a><b id=a><b id=a><b><object><b id=a><b id=a>X</object><p>Y"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <b>\n|         id=\"a\"\n|         <b>\n|           id=\"a\"\n|           <b>\n|             id=\"a\"\n|             <b>\n|               <object>\n|                 <b>\n|                   id=\"a\"\n|                   <b>\n|                     id=\"a\"\n|                     \"X\"\n|     <p>\n|       <b>\n|         id=\"a\"\n|         <b>\n|           id=\"a\"\n|           <b>\n|             id=\"a\"\n|             <b>\n|               \"Y\"\n"
+       }, {
+               name: "tests24.dat #1"
+               html: "<!DOCTYPE html>&NotEqualTilde;"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"≂̸\"\n"
+       }, {
+               name: "tests24.dat #2"
+               html: "<!DOCTYPE html>&NotEqualTilde;A"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"≂̸A\"\n"
+       }, {
+               name: "tests24.dat #3"
+               html: "<!DOCTYPE html>&ThickSpace;"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"  \"\n"
+       }, {
+               name: "tests24.dat #4"
+               html: "<!DOCTYPE html>&ThickSpace;A"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"  A\"\n"
+       }, {
+               name: "tests24.dat #5"
+               html: "<!DOCTYPE html>&NotSubset;"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"⊂⃒\"\n"
+       }, {
+               name: "tests24.dat #6"
+               html: "<!DOCTYPE html>&NotSubset;A"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"⊂⃒A\"\n"
+       }, {
+               name: "tests24.dat #7"
+               html: "<!DOCTYPE html>&Gopf;"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"𝔾\"\n"
+       }, {
+               name: "tests24.dat #8"
+               html: "<!DOCTYPE html>&Gopf;A"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"𝔾A\"\n"
+       }, {
+               name: "tests25.dat #1"
+               html: "<!DOCTYPE html><body><foo>A"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <foo>\n|       \"A\"\n"
+       }, {
+               name: "tests25.dat #2"
+               html: "<!DOCTYPE html><body><area>A"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <area>\n|     \"A\"\n"
+       }, {
+               name: "tests25.dat #3"
+               html: "<!DOCTYPE html><body><base>A"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <base>\n|     \"A\"\n"
+       }, {
+               name: "tests25.dat #4"
+               html: "<!DOCTYPE html><body><basefont>A"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <basefont>\n|     \"A\"\n"
+       }, {
+               name: "tests25.dat #5"
+               html: "<!DOCTYPE html><body><bgsound>A"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <bgsound>\n|     \"A\"\n"
+       }, {
+               name: "tests25.dat #6"
+               html: "<!DOCTYPE html><body><br>A"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <br>\n|     \"A\"\n"
+       }, {
+               name: "tests25.dat #7"
+               html: "<!DOCTYPE html><body><col>A"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"A\"\n"
+       }, {
+               name: "tests25.dat #8"
+               html: "<!DOCTYPE html><body><command>A"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <command>\n|       \"A\"\n"
+       }, {
+               name: "tests25.dat #9"
+               html: "<!DOCTYPE html><body><menuitem>A"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <menuitem>\n|     \"A\"\n"
+       }, {
+               name: "tests25.dat #10"
+               html: "<!DOCTYPE html><body><embed>A"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <embed>\n|     \"A\"\n"
+       }, {
+               name: "tests25.dat #11"
+               html: "<!DOCTYPE html><body><frame>A"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"A\"\n"
+       }, {
+               name: "tests25.dat #12"
+               html: "<!DOCTYPE html><body><hr>A"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <hr>\n|     \"A\"\n"
+       }, {
+               name: "tests25.dat #13"
+               html: "<!DOCTYPE html><body><img>A"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <img>\n|     \"A\"\n"
+       }, {
+               name: "tests25.dat #14"
+               html: "<!DOCTYPE html><body><input>A"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <input>\n|     \"A\"\n"
+       }, {
+               name: "tests25.dat #15"
+               html: "<!DOCTYPE html><body><keygen>A"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <keygen>\n|     \"A\"\n"
+       }, {
+               name: "tests25.dat #16"
+               html: "<!DOCTYPE html><body><link>A"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <link>\n|     \"A\"\n"
+       }, {
+               name: "tests25.dat #17"
+               html: "<!DOCTYPE html><body><meta>A"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <meta>\n|     \"A\"\n"
+       }, {
+               name: "tests25.dat #18"
+               html: "<!DOCTYPE html><body><param>A"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <param>\n|     \"A\"\n"
+       }, {
+               name: "tests25.dat #19"
+               html: "<!DOCTYPE html><body><source>A"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <source>\n|     \"A\"\n"
+       }, {
+               name: "tests25.dat #20"
+               html: "<!DOCTYPE html><body><track>A"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <track>\n|     \"A\"\n"
+       }, {
+               name: "tests25.dat #21"
+               html: "<!DOCTYPE html><body><wbr>A"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <wbr>\n|     \"A\"\n"
+       }, {
+               name: "tests26.dat #1"
+               html: "<!DOCTYPE html><body><a href='#1'><nobr>1<nobr></a><br><a href='#2'><nobr>2<nobr></a><br><a href='#3'><nobr>3<nobr></a>"
+               errors: 10
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <a>\n|       href=\"#1\"\n|       <nobr>\n|         \"1\"\n|       <nobr>\n|     <nobr>\n|       <br>\n|       <a>\n|         href=\"#2\"\n|     <a>\n|       href=\"#2\"\n|       <nobr>\n|         \"2\"\n|       <nobr>\n|     <nobr>\n|       <br>\n|       <a>\n|         href=\"#3\"\n|     <a>\n|       href=\"#3\"\n|       <nobr>\n|         \"3\"\n|       <nobr>\n"
+       }, {
+               name: "tests26.dat #2"
+               html: "<!DOCTYPE html><body><b><nobr>1<nobr></b><i><nobr>2<nobr></i>3"
+               errors: 7
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <nobr>\n|         \"1\"\n|       <nobr>\n|     <nobr>\n|       <i>\n|     <i>\n|       <nobr>\n|         \"2\"\n|       <nobr>\n|     <nobr>\n|       \"3\"\n"
+       }, {
+               name: "tests26.dat #3"
+               html: "<!DOCTYPE html><body><b><nobr>1<table><nobr></b><i><nobr>2<nobr></i>3"
+               errors: 14
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <nobr>\n|         \"1\"\n|         <nobr>\n|           <i>\n|         <i>\n|           <nobr>\n|             \"2\"\n|           <nobr>\n|         <nobr>\n|           \"3\"\n|         <table>\n"
+       }, {
+               name: "tests26.dat #4"
+               html: "<!DOCTYPE html><body><b><nobr>1<table><tr><td><nobr></b><i><nobr>2<nobr></i>3"
+               errors: 6
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <nobr>\n|         \"1\"\n|         <table>\n|           <tbody>\n|             <tr>\n|               <td>\n|                 <nobr>\n|                   <i>\n|                 <i>\n|                   <nobr>\n|                     \"2\"\n|                   <nobr>\n|                 <nobr>\n|                   \"3\"\n"
+       }, {
+               name: "tests26.dat #5"
+               html: "<!DOCTYPE html><body><b><nobr>1<div><nobr></b><i><nobr>2<nobr></i>3"
+               errors: 9
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <nobr>\n|         \"1\"\n|     <div>\n|       <b>\n|         <nobr>\n|         <nobr>\n|       <nobr>\n|         <i>\n|       <i>\n|         <nobr>\n|           \"2\"\n|         <nobr>\n|       <nobr>\n|         \"3\"\n"
+       }, {
+               name: "tests26.dat #6"
+               html: "<!DOCTYPE html><body><b><nobr>1<nobr></b><div><i><nobr>2<nobr></i>3"
+               errors: 7
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <nobr>\n|         \"1\"\n|       <nobr>\n|     <div>\n|       <nobr>\n|         <i>\n|       <i>\n|         <nobr>\n|           \"2\"\n|         <nobr>\n|       <nobr>\n|         \"3\"\n"
+       }, {
+               name: "tests26.dat #7"
+               html: "<!DOCTYPE html><body><b><nobr>1<nobr><ins></b><i><nobr>"
+               errors: 5
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <nobr>\n|         \"1\"\n|       <nobr>\n|         <ins>\n|     <nobr>\n|       <i>\n|     <i>\n|       <nobr>\n"
+       }, {
+               name: "tests26.dat #8"
+               html: "<!DOCTYPE html><body><b><nobr>1<ins><nobr></b><i>2"
+               errors: 4
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <nobr>\n|         \"1\"\n|         <ins>\n|       <nobr>\n|     <nobr>\n|       <i>\n|         \"2\"\n"
+       }, {
+               name: "tests26.dat #9"
+               html: "<!DOCTYPE html><body><b>1<nobr></b><i><nobr>2</i>"
+               errors: 4
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <b>\n|       \"1\"\n|       <nobr>\n|     <nobr>\n|       <i>\n|     <i>\n|       <nobr>\n|         \"2\"\n"
+       }, {
+               name: "tests26.dat #10"
+               html: "<p><code x</code></p>\n"
+               errors: 5
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <code>\n|         code=\"\"\n|         x<=\"\"\n|     <code>\n|       code=\"\"\n|       x<=\"\"\n|       \"\n\"\n"
+       }, {
+               name: "tests26.dat #11"
+               html: "<!DOCTYPE html><svg><foreignObject><p><i></p>a"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg foreignObject>\n|         <p>\n|           <i>\n|         <i>\n|           \"a\"\n"
+       }, {
+               name: "tests26.dat #12"
+               html: "<!DOCTYPE html><table><tr><td><svg><foreignObject><p><i></p>a"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <svg svg>\n|               <svg foreignObject>\n|                 <p>\n|                   <i>\n|                 <i>\n|                   \"a\"\n"
+       }, {
+               name: "tests26.dat #13"
+               html: "<!DOCTYPE html><math><mtext><p><i></p>a"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mtext>\n|         <p>\n|           <i>\n|         <i>\n|           \"a\"\n"
+       }, {
+               name: "tests26.dat #14"
+               html: "<!DOCTYPE html><table><tr><td><math><mtext><p><i></p>a"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <math math>\n|               <math mtext>\n|                 <p>\n|                   <i>\n|                 <i>\n|                   \"a\"\n"
+       }, {
+               name: "tests26.dat #15"
+               html: "<!DOCTYPE html><body><div><!/div>a"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <!-- /div -->\n|       \"a\"\n"
+       }, {
+               name: "tests26.dat #16"
+               html: "<button><p><button>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <button>\n|       <p>\n|     <button>\n"
+       }, {
+               name: "tests2.dat #1"
+               html: "<!DOCTYPE html>Test"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"Test\"\n"
+       }, {
+               name: "tests2.dat #2"
+               html: "<textarea>test</div>test"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"test</div>test\"\n"
+       }, {
+               name: "tests2.dat #3"
+               html: "<table><td>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n"
+       }, {
+               name: "tests2.dat #4"
+               html: "<table><td>test</tbody></table>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"test\"\n"
+       }, {
+               name: "tests2.dat #5"
+               html: "<frame>test"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"test\"\n"
+       }, {
+               name: "tests2.dat #6"
+               html: "<!DOCTYPE html><frameset>test"
+               errors: 5
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "tests2.dat #7"
+               html: "<!DOCTYPE html><frameset> te st"
+               errors: 5
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|     \"  \"\n"
+       }, {
+               name: "tests2.dat #8"
+               html: "<!DOCTYPE html><frameset></frameset> te st"
+               errors: 4
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|   \"  \"\n"
+       }, {
+               name: "tests2.dat #9"
+               html: "<!DOCTYPE html><frameset><!DOCTYPE html>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "tests2.dat #10"
+               html: "<!DOCTYPE html><font><p><b>test</font>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <font>\n|     <p>\n|       <font>\n|         <b>\n|           \"test\"\n"
+       }, {
+               name: "tests2.dat #11"
+               html: "<!DOCTYPE html><dt><div><dd>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <dt>\n|       <div>\n|     <dd>\n"
+       }, {
+               name: "tests2.dat #12"
+               html: "<script></x"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</x\"\n|   <body>\n"
+       }, {
+               name: "tests2.dat #13"
+               html: "<table><plaintext><td>"
+               errors: 7
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <plaintext>\n|       \"<td>\"\n|     <table>\n"
+       }, {
+               name: "tests2.dat #14"
+               html: "<plaintext></plaintext>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <plaintext>\n|       \"</plaintext>\"\n"
+       }, {
+               name: "tests2.dat #15"
+               html: "<!DOCTYPE html><table><tr>TEST"
+               errors: 5
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"TEST\"\n|     <table>\n|       <tbody>\n|         <tr>\n"
+       }, {
+               name: "tests2.dat #16"
+               html: "<!DOCTYPE html><body t1=1><body t2=2><body t3=3 t4=4>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     t1=\"1\"\n|     t2=\"2\"\n|     t3=\"3\"\n|     t4=\"4\"\n"
+       }, {
+               name: "tests2.dat #17"
+               html: "</b test"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests2.dat #18"
+               html: "<!DOCTYPE html></b test<b &=&amp>X"
+               errors: 4
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"X\"\n"
+       }, {
+               name: "tests2.dat #19"
+               html: "<!doctypehtml><scrIPt type=text/x-foobar;baz>X</SCRipt"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       type=\"text/x-foobar;baz\"\n|       \"X</SCRipt\"\n|   <body>\n"
+       }, {
+               name: "tests2.dat #20"
+               html: "&"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"&\"\n"
+       }, {
+               name: "tests2.dat #21"
+               html: "&#"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"&#\"\n"
+       }, {
+               name: "tests2.dat #22"
+               html: "&#X"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"&#X\"\n"
+       }, {
+               name: "tests2.dat #23"
+               html: "&#x"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"&#x\"\n"
+       }, {
+               name: "tests2.dat #24"
+               html: "&#45"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"-\"\n"
+       }, {
+               name: "tests2.dat #25"
+               html: "&x-test"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"&x-test\"\n"
+       }, {
+               name: "tests2.dat #26"
+               html: "<!doctypehtml><p><li>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <li>\n"
+       }, {
+               name: "tests2.dat #27"
+               html: "<!doctypehtml><p><dt>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <dt>\n"
+       }, {
+               name: "tests2.dat #28"
+               html: "<!doctypehtml><p><dd>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <dd>\n"
+       }, {
+               name: "tests2.dat #29"
+               html: "<!doctypehtml><p><form>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <form>\n"
+       }, {
+               name: "tests2.dat #30"
+               html: "<!DOCTYPE html><p></P>X"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     \"X\"\n"
+       }, {
+               name: "tests2.dat #31"
+               html: "&AMP"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"&\"\n"
+       }, {
+               name: "tests2.dat #32"
+               html: "&AMp;"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"&AMp;\"\n"
+       }, {
+               name: "tests2.dat #33"
+               html: "<!DOCTYPE html><html><head></head><body><thisISasillyTESTelementNameToMakeSureCrazyTagNamesArePARSEDcorrectLY>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <thisisasillytestelementnametomakesurecrazytagnamesareparsedcorrectly>\n"
+       }, {
+               name: "tests2.dat #34"
+               html: "<!DOCTYPE html>X</body>X"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"XX\"\n"
+       }, {
+               name: "tests2.dat #35"
+               html: "<!DOCTYPE html><!-- X"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <!--  X -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests2.dat #36"
+               html: "<!DOCTYPE html><table><caption>test TEST</caption><td>test"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         \"test TEST\"\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"test\"\n"
+       }, {
+               name: "tests2.dat #37"
+               html: "<!DOCTYPE html><select><option><optgroup>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n|       <optgroup>\n"
+       }, {
+               name: "tests2.dat #38"
+               html: "<!DOCTYPE html><select><optgroup><option></optgroup><option><select><option>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <optgroup>\n|         <option>\n|       <option>\n|     <option>\n"
+       }, {
+               name: "tests2.dat #39"
+               html: "<!DOCTYPE html><select><optgroup><option><optgroup>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <optgroup>\n|         <option>\n|       <optgroup>\n"
+       }, {
+               name: "tests2.dat #40"
+               html: "<!DOCTYPE html><datalist><option>foo</datalist>bar"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <datalist>\n|       <option>\n|         \"foo\"\n|     \"bar\"\n"
+       }, {
+               name: "tests2.dat #41"
+               html: "<!DOCTYPE html><font><input><input></font>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <font>\n|       <input>\n|       <input>\n"
+       }, {
+               name: "tests2.dat #42"
+               html: "<!DOCTYPE html><!-- XXX - XXX -->"
+               expected: "| <!DOCTYPE html>\n| <!--  XXX - XXX  -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests2.dat #43"
+               html: "<!DOCTYPE html><!-- XXX - XXX"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <!--  XXX - XXX -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests2.dat #44"
+               html: "<!DOCTYPE html><!-- XXX - XXX - XXX -->"
+               expected: "| <!DOCTYPE html>\n| <!--  XXX - XXX - XXX  -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests2.dat #45"
+               html: "<isindex test=x name=x>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <form>\n|       <hr>\n|       <label>\n|         \"This is a searchable index. Enter search keywords: \"\n|         <input>\n|           name=\"isindex\"\n|           test=\"x\"\n|       <hr>\n"
+       }, {
+               name: "tests2.dat #46"
+               html: "test\ntest"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"test\ntest\"\n"
+       }, {
+               name: "tests2.dat #47"
+               html: "<!DOCTYPE html><body><title>test</body></title>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <title>\n|       \"test</body>\"\n"
+       }, {
+               name: "tests2.dat #48"
+               html: "<!DOCTYPE html><body><title>X</title><meta name=z><link rel=foo><style>\nx { content:\"</style\" } </style>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <title>\n|       \"X\"\n|     <meta>\n|       name=\"z\"\n|     <link>\n|       rel=\"foo\"\n|     <style>\n|       \"\nx { content:\"</style\" } \"\n"
+       }, {
+               name: "tests2.dat #49"
+               html: "<!DOCTYPE html><select><optgroup></optgroup></select>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <optgroup>\n"
+       }, {
+               name: "tests2.dat #50"
+               html: " \n "
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests2.dat #51"
+               html: "<!DOCTYPE html>  <html>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests2.dat #52"
+               html: "<!DOCTYPE html><script>\n</script>  <title>x</title>  </head>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"\n\"\n|     \"  \"\n|     <title>\n|       \"x\"\n|     \"  \"\n|   <body>\n"
+       }, {
+               name: "tests2.dat #53"
+               html: "<!DOCTYPE html><html><body><html id=x>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   id=\"x\"\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests2.dat #54"
+               html: "<!DOCTYPE html>X</body><html id=\"x\">"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   id=\"x\"\n|   <head>\n|   <body>\n|     \"X\"\n"
+       }, {
+               name: "tests2.dat #55"
+               html: "<!DOCTYPE html><head><html id=x>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   id=\"x\"\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests2.dat #56"
+               html: "<!DOCTYPE html>X</html>X"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"XX\"\n"
+       }, {
+               name: "tests2.dat #57"
+               html: "<!DOCTYPE html>X</html> "
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"X \"\n"
+       }, {
+               name: "tests2.dat #58"
+               html: "<!DOCTYPE html>X</html><p>X"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"X\"\n|     <p>\n|       \"X\"\n"
+       }, {
+               name: "tests2.dat #59"
+               html: "<!DOCTYPE html>X<p/x/y/z>"
+               errors: 3
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"X\"\n|     <p>\n|       x=\"\"\n|       y=\"\"\n|       z=\"\"\n"
+       }, {
+               name: "tests2.dat #60"
+               html: "<!DOCTYPE html><!--x--"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <!-- x -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests2.dat #61"
+               html: "<!DOCTYPE html><table><tr><td></p></table>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <p>\n"
+       }, {
+               name: "tests2.dat #62"
+               html: "<!DOCTYPE <!DOCTYPE HTML>><!--<!--x-->-->"
+               errors: 3
+               expected: "| <!DOCTYPE <!doctype>\n| <html>\n|   <head>\n|   <body>\n|     \">\"\n|     <!-- <!--x -->\n|     \"-->\"\n"
+       }, {
+               name: "tests2.dat #63"
+               html: "<!doctype html><div><form></form><div></div></div>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <form>\n|       <div>\n"
+       }, {
+               name: "tests3.dat #1"
+               html: "<head></head><style></style>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <style>\n|   <body>\n"
+       }, {
+               name: "tests3.dat #2"
+               html: "<head></head><script></script>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|   <body>\n"
+       }, {
+               name: "tests3.dat #3"
+               html: "<head></head><!-- --><style></style><!-- --><script></script>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|     <style>\n|     <script>\n|   <!--   -->\n|   <!--   -->\n|   <body>\n"
+       }, {
+               name: "tests3.dat #4"
+               html: "<head></head><!-- -->x<style></style><!-- --><script></script>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <!--   -->\n|   <body>\n|     \"x\"\n|     <style>\n|     <!--   -->\n|     <script>\n"
+       }, {
+               name: "tests3.dat #5"
+               html: "<!DOCTYPE html><html><head></head><body><pre>\n</pre></body></html>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n"
+       }, {
+               name: "tests3.dat #6"
+               html: "<!DOCTYPE html><html><head></head><body><pre>\nfoo</pre></body></html>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n|       \"foo\"\n"
+       }, {
+               name: "tests3.dat #7"
+               html: "<!DOCTYPE html><html><head></head><body><pre>\n\nfoo</pre></body></html>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n|       \"\nfoo\"\n"
+       }, {
+               name: "tests3.dat #8"
+               html: "<!DOCTYPE html><html><head></head><body><pre>\nfoo\n</pre></body></html>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n|       \"foo\n\"\n"
+       }, {
+               name: "tests3.dat #9"
+               html: "<!DOCTYPE html><html><head></head><body><pre>x</pre><span>\n</span></body></html>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n|       \"x\"\n|     <span>\n|       \"\n\"\n"
+       }, {
+               name: "tests3.dat #10"
+               html: "<!DOCTYPE html><html><head></head><body><pre>x\ny</pre></body></html>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n|       \"x\ny\"\n"
+       }, {
+               name: "tests3.dat #11"
+               html: "<!DOCTYPE html><html><head></head><body><pre>x<div>\ny</pre></body></html>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n|       \"x\"\n|       <div>\n|         \"\ny\"\n"
+       }, {
+               name: "tests3.dat #12"
+               html: "<!DOCTYPE html><pre>&#x0a;&#x0a;A</pre>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n|       \"\nA\"\n"
+       }, {
+               name: "tests3.dat #13"
+               html: "<!DOCTYPE html><HTML><META><HEAD></HEAD></HTML>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <meta>\n|   <body>\n"
+       }, {
+               name: "tests3.dat #14"
+               html: "<!DOCTYPE html><HTML><HEAD><head></HEAD></HTML>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests3.dat #15"
+               html: "<textarea>foo<span>bar</span><i>baz"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"foo<span>bar</span><i>baz\"\n"
+       }, {
+               name: "tests3.dat #16"
+               html: "<title>foo<span>bar</em><i>baz"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <title>\n|       \"foo<span>bar</em><i>baz\"\n|   <body>\n"
+       }, {
+               name: "tests3.dat #17"
+               html: "<!DOCTYPE html><textarea>\n</textarea>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <textarea>\n"
+       }, {
+               name: "tests3.dat #18"
+               html: "<!DOCTYPE html><textarea>\nfoo</textarea>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"foo\"\n"
+       }, {
+               name: "tests3.dat #19"
+               html: "<!DOCTYPE html><textarea>\n\nfoo</textarea>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"\nfoo\"\n"
+       }, {
+               name: "tests3.dat #20"
+               html: "<!DOCTYPE html><html><head></head><body><ul><li><div><p><li></ul></body></html>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <ul>\n|       <li>\n|         <div>\n|           <p>\n|       <li>\n"
+       }, {
+               name: "tests3.dat #21"
+               html: "<!doctype html><nobr><nobr><nobr>"
+               errors: 3
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <nobr>\n|     <nobr>\n|     <nobr>\n"
+       }, {
+               name: "tests3.dat #22"
+               html: "<!doctype html><nobr><nobr></nobr><nobr>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <nobr>\n|     <nobr>\n|     <nobr>\n"
+       }, {
+               name: "tests3.dat #23"
+               html: "<!doctype html><html><body><p><table></table></body></html>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <table>\n"
+       }, {
+               name: "tests3.dat #24"
+               html: "<p><table></table>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <table>\n"
+       }, {
+               name: "tests4.dat #1"
+               html: "direct div content"
+               fragment: "div"
+               expected: "| \"direct div content\"\n"
+       }, {
+               name: "tests4.dat #2"
+               html: "direct textarea content"
+               fragment: "textarea"
+               expected: "| \"direct textarea content\"\n"
+       }, {
+               name: "tests4.dat #3"
+               html: "textarea content with <em>pseudo</em> <foo>markup"
+               fragment: "textarea"
+               expected: "| \"textarea content with <em>pseudo</em> <foo>markup\"\n"
+       }, {
+               name: "tests4.dat #4"
+               html: "this is &#x0043;DATA inside a <style> element"
+               fragment: "style"
+               expected: "| \"this is &#x0043;DATA inside a <style> element\"\n"
+       }, {
+               name: "tests4.dat #5"
+               html: "</plaintext>"
+               fragment: "plaintext"
+               expected: "| \"</plaintext>\"\n"
+       }, {
+               name: "tests4.dat #6"
+               html: "setting html's innerHTML"
+               fragment: "html"
+               expected: "| <head>\n| <body>\n|   \"setting html's innerHTML\"\n"
+       }, {
+               name: "tests4.dat #7"
+               html: "<title>setting head's innerHTML</title>"
+               fragment: "head"
+               expected: "| <title>\n|   \"setting head's innerHTML\"\n"
+       }, {
+               name: "tests5.dat #1"
+               html: "<style> <!-- </style>x"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <style>\n|       \" <!-- \"\n|   <body>\n|     \"x\"\n"
+       }, {
+               name: "tests5.dat #2"
+               html: "<style> <!-- </style> --> </style>x"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <style>\n|       \" <!-- \"\n|     \" \"\n|   <body>\n|     \"--> x\"\n"
+       }, {
+               name: "tests5.dat #3"
+               html: "<style> <!--> </style>x"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <style>\n|       \" <!--> \"\n|   <body>\n|     \"x\"\n"
+       }, {
+               name: "tests5.dat #4"
+               html: "<style> <!---> </style>x"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <style>\n|       \" <!---> \"\n|   <body>\n|     \"x\"\n"
+       }, {
+               name: "tests5.dat #5"
+               html: "<iframe> <!---> </iframe>x"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <iframe>\n|       \" <!---> \"\n|     \"x\"\n"
+       }, {
+               name: "tests5.dat #6"
+               html: "<iframe> <!--- </iframe>->x</iframe> --> </iframe>x"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <iframe>\n|       \" <!--- \"\n|     \"->x --> x\"\n"
+       }, {
+               name: "tests5.dat #7"
+               html: "<script> <!-- </script> --> </script>x"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <script>\n|       \" <!-- \"\n|     \" \"\n|   <body>\n|     \"--> x\"\n"
+       }, {
+               name: "tests5.dat #8"
+               html: "<title> <!-- </title> --> </title>x"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <title>\n|       \" <!-- \"\n|     \" \"\n|   <body>\n|     \"--> x\"\n"
+       }, {
+               name: "tests5.dat #9"
+               html: "<textarea> <!--- </textarea>->x</textarea> --> </textarea>x"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \" <!--- \"\n|     \"->x --> x\"\n"
+       }, {
+               name: "tests5.dat #10"
+               html: "<style> <!</-- </style>x"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <style>\n|       \" <!</-- \"\n|   <body>\n|     \"x\"\n"
+       }, {
+               name: "tests5.dat #11"
+               html: "<p><xmp></xmp>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <xmp>\n"
+       }, {
+               name: "tests5.dat #12"
+               html: "<xmp> <!-- > --> </xmp>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <xmp>\n|       \" <!-- > --> \"\n"
+       }, {
+               name: "tests5.dat #13"
+               html: "<title>&amp;</title>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <title>\n|       \"&\"\n|   <body>\n"
+       }, {
+               name: "tests5.dat #14"
+               html: "<title><!--&amp;--></title>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <title>\n|       \"<!--&-->\"\n|   <body>\n"
+       }, {
+               name: "tests5.dat #15"
+               html: "<title><!--</title>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <title>\n|       \"<!--\"\n|   <body>\n"
+       }, {
+               name: "tests5.dat #16"
+               html: "<noscript><!--</noscript>--></noscript>"
+               scripting: true
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <noscript>\n|       \"<!--\"\n|   <body>\n|     \"-->\"\n"
+       }, {
+               name: "tests5.dat #17"
+               html: "<noscript><!--</noscript>--></noscript>"
+               scripting: false
+               errors: 1
+               expected: "| <html>\n|   <head>\n|     <noscript>\n|       <!-- </noscript> -->\n|   <body>\n"
+       }, {
+               name: "tests6.dat #1"
+               html: "<!doctype html></head> <head>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   \" \"\n|   <body>\n"
+       }, {
+               name: "tests6.dat #2"
+               html: "<!doctype html><form><div></form><div>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <form>\n|       <div>\n|         <div>\n"
+       }, {
+               name: "tests6.dat #3"
+               html: "<!doctype html><title>&amp;</title>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <title>\n|       \"&\"\n|   <body>\n"
+       }, {
+               name: "tests6.dat #4"
+               html: "<!doctype html><title><!--&amp;--></title>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <title>\n|       \"<!--&-->\"\n|   <body>\n"
+       }, {
+               name: "tests6.dat #5"
+               html: "<!doctype>"
+               errors: 3
+               expected: "| <!DOCTYPE >\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests6.dat #6"
+               html: "<!---x"
+               errors: 2
+               expected: "| <!-- -x -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests6.dat #7"
+               html: "<body>\n<div>"
+               errors: 2
+               fragment: "div"
+               expected: "| \"\n\"\n| <div>\n"
+       }, {
+               name: "tests6.dat #8"
+               html: "<frameset></frameset>\nfoo"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <frameset>\n|   \"\n\"\n"
+       }, {
+               name: "tests6.dat #9"
+               html: "<frameset></frameset>\n<noframes>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <frameset>\n|   \"\n\"\n|   <noframes>\n"
+       }, {
+               name: "tests6.dat #10"
+               html: "<frameset></frameset>\n<div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <frameset>\n|   \"\n\"\n"
+       }, {
+               name: "tests6.dat #11"
+               html: "<frameset></frameset>\n</html>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <frameset>\n|   \"\n\"\n"
+       }, {
+               name: "tests6.dat #12"
+               html: "<frameset></frameset>\n</div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <frameset>\n|   \"\n\"\n"
+       }, {
+               name: "tests6.dat #13"
+               html: "<form><form>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <form>\n"
+       }, {
+               name: "tests6.dat #14"
+               html: "<button><button>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <button>\n|     <button>\n"
+       }, {
+               name: "tests6.dat #15"
+               html: "<table><tr><td></th>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n"
+       }, {
+               name: "tests6.dat #16"
+               html: "<table><caption><td>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|       <tbody>\n|         <tr>\n|           <td>\n"
+       }, {
+               name: "tests6.dat #17"
+               html: "<table><caption><div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <div>\n"
+       }, {
+               name: "tests6.dat #18"
+               html: "</caption><div>"
+               errors: 2
+               fragment: "caption"
+               expected: "| <div>\n"
+       }, {
+               name: "tests6.dat #19"
+               html: "<table><caption><div></caption>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <div>\n"
+       }, {
+               name: "tests6.dat #20"
+               html: "<table><caption></table>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n"
+       }, {
+               name: "tests6.dat #21"
+               html: "</table><div>"
+               errors: 2
+               fragment: "caption"
+               expected: "| <div>\n"
+       }, {
+               name: "tests6.dat #22"
+               html: "<table><caption></body></col></colgroup></html></tbody></td></tfoot></th></thead></tr>"
+               errors: 12
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n"
+       }, {
+               name: "tests6.dat #23"
+               html: "<table><caption><div></div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <div>\n"
+       }, {
+               name: "tests6.dat #24"
+               html: "<table><tr><td></body></caption></col></colgroup></html>"
+               errors: 7
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n"
+       }, {
+               name: "tests6.dat #25"
+               html: "</table></tbody></tfoot></thead></tr><div>"
+               errors: 6
+               fragment: "td"
+               expected: "| <div>\n"
+       }, {
+               name: "tests6.dat #26"
+               html: "<table><colgroup>foo"
+               errors: 5
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"foo\"\n|     <table>\n|       <colgroup>\n"
+       }, {
+               name: "tests6.dat #27"
+               html: "foo<col>"
+               errors: 3
+               fragment: "colgroup"
+               expected: "| <col>\n"
+       }, {
+               name: "tests6.dat #28"
+               html: "<table><colgroup></col>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <colgroup>\n"
+       }, {
+               name: "tests6.dat #29"
+               html: "<frameset><div>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "tests6.dat #30"
+               html: "</frameset><frame>"
+               errors: 1
+               fragment: "frameset"
+               expected: "| <frame>\n"
+       }, {
+               name: "tests6.dat #31"
+               html: "<frameset></div>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "tests6.dat #32"
+               html: "</body><div>"
+               errors: 2
+               fragment: "body"
+               expected: "| <div>\n"
+       }, {
+               name: "tests6.dat #33"
+               html: "<table><tr><div>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|     <table>\n|       <tbody>\n|         <tr>\n"
+       }, {
+               name: "tests6.dat #34"
+               html: "</tr><td>"
+               errors: 1
+               fragment: "tr"
+               expected: "| <td>\n"
+       }, {
+               name: "tests6.dat #35"
+               html: "</tbody></tfoot></thead><td>"
+               errors: 3
+               fragment: "tr"
+               expected: "| <td>\n"
+       }, {
+               name: "tests6.dat #36"
+               html: "<table><tr><div><td>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n"
+       }, {
+               name: "tests6.dat #37"
+               html: "<caption><col><colgroup><tbody><tfoot><thead><tr>"
+               errors: 6
+               fragment: "tbody"
+               expected: "| <tr>\n"
+       }, {
+               name: "tests6.dat #38"
+               html: "<table><tbody></thead>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n"
+       }, {
+               name: "tests6.dat #39"
+               html: "</table><tr>"
+               errors: 1
+               fragment: "tbody"
+               expected: "| <tr>\n"
+       }, {
+               name: "tests6.dat #40"
+               html: "<table><tbody></body></caption></col></colgroup></html></td></th></tr>"
+               errors: 10
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n"
+       }, {
+               name: "tests6.dat #41"
+               html: "<table><tbody></div>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n"
+       }, {
+               name: "tests6.dat #42"
+               html: "<table><table>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|     <table>\n"
+       }, {
+               name: "tests6.dat #43"
+               html: "<table></body></caption></col></colgroup></html></tbody></td></tfoot></th></thead></tr>"
+               errors: 13
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n"
+       }, {
+               name: "tests6.dat #44"
+               html: "</table><tr>"
+               errors: 1
+               fragment: "table"
+               expected: "| <tbody>\n|   <tr>\n"
+       }, {
+               name: "tests6.dat #45"
+               html: "<body></body></html>"
+               errors: 1
+               fragment: "html"
+               expected: "| <head>\n| <body>\n"
+       }, {
+               name: "tests6.dat #46"
+               html: "<html><frameset></frameset></html> "
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <frameset>\n|   \" \"\n"
+       }, {
+               name: "tests6.dat #47"
+               html: "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\"><html></html>"
+               expected: "| <!DOCTYPE html \"-//W3C//DTD HTML 4.01//EN\" \"\">\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests6.dat #48"
+               html: "<param><frameset></frameset>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "tests6.dat #49"
+               html: "<source><frameset></frameset>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "tests6.dat #50"
+               html: "<track><frameset></frameset>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "tests6.dat #51"
+               html: "</html><frameset></frameset>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "tests6.dat #52"
+               html: "</body><frameset></frameset>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "tests7.dat #1"
+               html: "<!doctype html><body><title>X</title>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <title>\n|       \"X\"\n"
+       }, {
+               name: "tests7.dat #2"
+               html: "<!doctype html><table><title>X</title></table>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <title>\n|       \"X\"\n|     <table>\n"
+       }, {
+               name: "tests7.dat #3"
+               html: "<!doctype html><head></head><title>X</title>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <title>\n|       \"X\"\n|   <body>\n"
+       }, {
+               name: "tests7.dat #4"
+               html: "<!doctype html></head><title>X</title>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <title>\n|       \"X\"\n|   <body>\n"
+       }, {
+               name: "tests7.dat #5"
+               html: "<!doctype html><table><meta></table>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <meta>\n|     <table>\n"
+       }, {
+               name: "tests7.dat #6"
+               html: "<!doctype html><table>X<tr><td><table> <meta></table></table>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"X\"\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <meta>\n|             <table>\n|               \" \"\n"
+       }, {
+               name: "tests7.dat #7"
+               html: "<!doctype html><html> <head>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests7.dat #8"
+               html: "<!doctype html> <head>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests7.dat #9"
+               html: "<!doctype html><table><style> <tr>x </style> </table>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <style>\n|         \" <tr>x \"\n|       \" \"\n"
+       }, {
+               name: "tests7.dat #10"
+               html: "<!doctype html><table><TBODY><script> <tr>x </script> </table>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <script>\n|           \" <tr>x \"\n|         \" \"\n"
+       }, {
+               name: "tests7.dat #11"
+               html: "<!doctype html><p><applet><p>X</p></applet>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <applet>\n|         <p>\n|           \"X\"\n"
+       }, {
+               name: "tests7.dat #12"
+               html: "<!doctype html><p><object type=\"application/x-non-existant-plugin\"><p>X</p></object>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <object>\n|         type=\"application/x-non-existant-plugin\"\n|         <p>\n|           \"X\"\n"
+       }, {
+               name: "tests7.dat #13"
+               html: "<!doctype html><listing>\nX</listing>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <listing>\n|       \"X\"\n"
+       }, {
+               name: "tests7.dat #14"
+               html: "<!doctype html><select><input>X"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|     <input>\n|     \"X\"\n"
+       }, {
+               name: "tests7.dat #15"
+               html: "<!doctype html><select><select>X"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|     \"X\"\n"
+       }, {
+               name: "tests7.dat #16"
+               html: "<!doctype html><table><input type=hidDEN></table>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <input>\n|         type=\"hidDEN\"\n"
+       }, {
+               name: "tests7.dat #17"
+               html: "<!doctype html><table>X<input type=hidDEN></table>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"X\"\n|     <table>\n|       <input>\n|         type=\"hidDEN\"\n"
+       }, {
+               name: "tests7.dat #18"
+               html: "<!doctype html><table>  <input type=hidDEN></table>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       \"  \"\n|       <input>\n|         type=\"hidDEN\"\n"
+       }, {
+               name: "tests7.dat #19"
+               html: "<!doctype html><table>  <input type='hidDEN'></table>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       \"  \"\n|       <input>\n|         type=\"hidDEN\"\n"
+       }, {
+               name: "tests7.dat #20"
+               html: "<!doctype html><table><input type=\" hidden\"><input type=hidDEN></table>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <input>\n|       type=\" hidden\"\n|     <table>\n|       <input>\n|         type=\"hidDEN\"\n"
+       }, {
+               name: "tests7.dat #21"
+               html: "<!doctype html><table><select>X<tr>"
+               errors: 3
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       \"X\"\n|     <table>\n|       <tbody>\n|         <tr>\n"
+       }, {
+               name: "tests7.dat #22"
+               html: "<!doctype html><select>X</select>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       \"X\"\n"
+       }, {
+               name: "tests7.dat #23"
+               html: "<!DOCTYPE hTmL><html></html>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests7.dat #24"
+               html: "<!DOCTYPE HTML><html></html>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "tests7.dat #25"
+               html: "<body>X</body></body>"
+               errors: 1
+               fragment: "html"
+               expected: "| <head>\n| <body>\n|   \"X\"\n"
+       }, {
+               name: "tests7.dat #26"
+               html: "<div><p>a</x> b"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <p>\n|         \"a b\"\n"
+       }, {
+               name: "tests7.dat #27"
+               html: "<table><tr><td><code></code> </table>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <code>\n|             \" \"\n"
+       }, {
+               name: "tests7.dat #28"
+               html: "<table><b><tr><td>aaa</td></tr>bbb</table>ccc"
+               errors: 6
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|     <b>\n|       \"bbb\"\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"aaa\"\n|     <b>\n|       \"ccc\"\n"
+       }, {
+               name: "tests7.dat #29"
+               html: "A<table><tr> B</tr> B</table>"
+               errors: 5
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"A B B\"\n|     <table>\n|       <tbody>\n|         <tr>\n"
+       }, {
+               name: "tests7.dat #30"
+               html: "A<table><tr> B</tr> </em>C</table>"
+               errors: 6
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"A BC\"\n|     <table>\n|       <tbody>\n|         <tr>\n|         \" \"\n"
+       }, {
+               name: "tests7.dat #31"
+               html: "<select><keygen>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|     <keygen>\n"
+       }, {
+               name: "tests8.dat #1"
+               html: "<div>\n<div></div>\n</span>x"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"\n\"\n|       <div>\n|       \"\nx\"\n"
+       }, {
+               name: "tests8.dat #2"
+               html: "<div>x<div></div>\n</span>x"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"x\"\n|       <div>\n|       \"\nx\"\n"
+       }, {
+               name: "tests8.dat #3"
+               html: "<div>x<div></div>x</span>x"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"x\"\n|       <div>\n|       \"xx\"\n"
+       }, {
+               name: "tests8.dat #4"
+               html: "<div>x<div></div>y</span>z"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"x\"\n|       <div>\n|       \"yz\"\n"
+       }, {
+               name: "tests8.dat #5"
+               html: "<table><div>x<div></div>x</span>x"
+               errors: 10
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"x\"\n|       <div>\n|       \"xx\"\n|     <table>\n"
+       }, {
+               name: "tests8.dat #6"
+               html: "x<table>x"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"xx\"\n|     <table>\n"
+       }, {
+               name: "tests8.dat #7"
+               html: "x<table><table>x"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"x\"\n|     <table>\n|     \"x\"\n|     <table>\n"
+       }, {
+               name: "tests8.dat #8"
+               html: "<b>a<div></div><div></b>y"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       \"a\"\n|       <div>\n|     <div>\n|       <b>\n|       \"y\"\n"
+       }, {
+               name: "tests8.dat #9"
+               html: "<a><div><p></a>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|     <div>\n|       <a>\n|       <p>\n|         <a>\n"
+       }, {
+               name: "tests9.dat #1"
+               html: "<!DOCTYPE html><math></math>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n"
+       }, {
+               name: "tests9.dat #2"
+               html: "<!DOCTYPE html><body><math></math>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n"
+       }, {
+               name: "tests9.dat #3"
+               html: "<!DOCTYPE html><math><mi>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n"
+       }, {
+               name: "tests9.dat #4"
+               html: "<!DOCTYPE html><math><annotation-xml><svg><u>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|         <svg svg>\n|     <u>\n"
+       }, {
+               name: "tests9.dat #5"
+               html: "<!DOCTYPE html><body><select><math></math></select>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n"
+       }, {
+               name: "tests9.dat #6"
+               html: "<!DOCTYPE html><body><select><option><math></math></option></select>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n"
+       }, {
+               name: "tests9.dat #7"
+               html: "<!DOCTYPE html><body><table><math></math></table>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|     <table>\n"
+       }, {
+               name: "tests9.dat #8"
+               html: "<!DOCTYPE html><body><table><math><mi>foo</mi></math></table>"
+               errors: 4
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         \"foo\"\n|     <table>\n"
+       }, {
+               name: "tests9.dat #9"
+               html: "<!DOCTYPE html><body><table><math><mi>foo</mi><mi>bar</mi></math></table>"
+               errors: 7
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         \"foo\"\n|       <math mi>\n|         \"bar\"\n|     <table>\n"
+       }, {
+               name: "tests9.dat #10"
+               html: "<!DOCTYPE html><body><table><tbody><math><mi>foo</mi><mi>bar</mi></math></tbody></table>"
+               errors: 7
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         \"foo\"\n|       <math mi>\n|         \"bar\"\n|     <table>\n|       <tbody>\n"
+       }, {
+               name: "tests9.dat #11"
+               html: "<!DOCTYPE html><body><table><tbody><tr><math><mi>foo</mi><mi>bar</mi></math></tr></tbody></table>"
+               errors: 7
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         \"foo\"\n|       <math mi>\n|         \"bar\"\n|     <table>\n|       <tbody>\n|         <tr>\n"
+       }, {
+               name: "tests9.dat #12"
+               html: "<!DOCTYPE html><body><table><tbody><tr><td><math><mi>foo</mi><mi>bar</mi></math></td></tr></tbody></table>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <math math>\n|               <math mi>\n|                 \"foo\"\n|               <math mi>\n|                 \"bar\"\n"
+       }, {
+               name: "tests9.dat #13"
+               html: "<!DOCTYPE html><body><table><tbody><tr><td><math><mi>foo</mi><mi>bar</mi></math><p>baz</td></tr></tbody></table>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <math math>\n|               <math mi>\n|                 \"foo\"\n|               <math mi>\n|                 \"bar\"\n|             <p>\n|               \"baz\"\n"
+       }, {
+               name: "tests9.dat #14"
+               html: "<!DOCTYPE html><body><table><caption><math><mi>foo</mi><mi>bar</mi></math><p>baz</caption></table>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <math math>\n|           <math mi>\n|             \"foo\"\n|           <math mi>\n|             \"bar\"\n|         <p>\n|           \"baz\"\n"
+       }, {
+               name: "tests9.dat #15"
+               html: "<!DOCTYPE html><body><table><caption><math><mi>foo</mi><mi>bar</mi><p>baz</table><p>quux"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <math math>\n|           <math mi>\n|             \"foo\"\n|           <math mi>\n|             \"bar\"\n|         <p>\n|           \"baz\"\n|     <p>\n|       \"quux\"\n"
+       }, {
+               name: "tests9.dat #16"
+               html: "<!DOCTYPE html><body><table><caption><math><mi>foo</mi><mi>bar</mi>baz</table><p>quux"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <math math>\n|           <math mi>\n|             \"foo\"\n|           <math mi>\n|             \"bar\"\n|           \"baz\"\n|     <p>\n|       \"quux\"\n"
+       }, {
+               name: "tests9.dat #17"
+               html: "<!DOCTYPE html><body><table><colgroup><math><mi>foo</mi><mi>bar</mi><p>baz</table><p>quux"
+               errors: 12
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         \"foo\"\n|       <math mi>\n|         \"bar\"\n|     <p>\n|       \"baz\"\n|     <table>\n|       <colgroup>\n|     <p>\n|       \"quux\"\n"
+       }, {
+               name: "tests9.dat #18"
+               html: "<!DOCTYPE html><body><table><tr><td><select><math><mi>foo</mi><mi>bar</mi><p>baz</table><p>quux"
+               errors: 7
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <select>\n|               \"foobarbaz\"\n|     <p>\n|       \"quux\"\n"
+       }, {
+               name: "tests9.dat #19"
+               html: "<!DOCTYPE html><body><table><select><math><mi>foo</mi><mi>bar</mi><p>baz</table><p>quux"
+               errors: 8
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       \"foobarbaz\"\n|     <table>\n|     <p>\n|       \"quux\"\n"
+       }, {
+               name: "tests9.dat #20"
+               html: "<!DOCTYPE html><body></body></html><math><mi>foo</mi><mi>bar</mi><p>baz"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         \"foo\"\n|       <math mi>\n|         \"bar\"\n|     <p>\n|       \"baz\"\n"
+       }, {
+               name: "tests9.dat #21"
+               html: "<!DOCTYPE html><body></body><math><mi>foo</mi><mi>bar</mi><p>baz"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         \"foo\"\n|       <math mi>\n|         \"bar\"\n|     <p>\n|       \"baz\"\n"
+       }, {
+               name: "tests9.dat #22"
+               html: "<!DOCTYPE html><frameset><math><mi></mi><mi></mi><p><span>"
+               errors: 8
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "tests9.dat #23"
+               html: "<!DOCTYPE html><frameset></frameset><math><mi></mi><mi></mi><p><span>"
+               errors: 7
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "tests9.dat #24"
+               html: "<!DOCTYPE html><body xlink:href=foo><math xlink:href=foo></math>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     xlink:href=\"foo\"\n|     <math math>\n|       xlink href=\"foo\"\n"
+       }, {
+               name: "tests9.dat #25"
+               html: "<!DOCTYPE html><body xlink:href=foo xml:lang=en><math><mi xml:lang=en xlink:href=foo></mi></math>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     xlink:href=\"foo\"\n|     xml:lang=\"en\"\n|     <math math>\n|       <math mi>\n|         xlink href=\"foo\"\n|         xml lang=\"en\"\n"
+       }, {
+               name: "tests9.dat #26"
+               html: "<!DOCTYPE html><body xlink:href=foo xml:lang=en><math><mi xml:lang=en xlink:href=foo /></math>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     xlink:href=\"foo\"\n|     xml:lang=\"en\"\n|     <math math>\n|       <math mi>\n|         xlink href=\"foo\"\n|         xml lang=\"en\"\n"
+       }, {
+               name: "tests9.dat #27"
+               html: "<!DOCTYPE html><body xlink:href=foo xml:lang=en><math><mi xml:lang=en xlink:href=foo />bar</math>"
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     xlink:href=\"foo\"\n|     xml:lang=\"en\"\n|     <math math>\n|       <math mi>\n|         xlink href=\"foo\"\n|         xml lang=\"en\"\n|       \"bar\"\n"
+       }, {
+               name: "tests_innerHTML_1.dat #1"
+               html: "<body><span>"
+               errors: 2
+               fragment: "body"
+               expected: "| <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #2"
+               html: "<span><body>"
+               errors: 2
+               fragment: "body"
+               expected: "| <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #3"
+               html: "<span><body>"
+               errors: 2
+               fragment: "div"
+               expected: "| <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #4"
+               html: "<body><span>"
+               errors: 1
+               fragment: "html"
+               expected: "| <head>\n| <body>\n|   <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #5"
+               html: "<frameset><span>"
+               errors: 2
+               fragment: "body"
+               expected: "| <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #6"
+               html: "<span><frameset>"
+               errors: 2
+               fragment: "body"
+               expected: "| <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #7"
+               html: "<span><frameset>"
+               errors: 2
+               fragment: "div"
+               expected: "| <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #8"
+               html: "<frameset><span>"
+               errors: 2
+               fragment: "html"
+               expected: "| <head>\n| <frameset>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #9"
+               html: "<table><tr>"
+               errors: 1
+               fragment: "table"
+               expected: "| <tbody>\n|   <tr>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #10"
+               html: "</table><tr>"
+               errors: 1
+               fragment: "table"
+               expected: "| <tbody>\n|   <tr>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #11"
+               html: "<a>"
+               errors: 2
+               fragment: "table"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #12"
+               html: "<a>"
+               errors: 2
+               fragment: "table"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #13"
+               html: "<a><caption>a"
+               errors: 2
+               fragment: "table"
+               expected: "| <a>\n| <caption>\n|   \"a\"\n"
+       }, {
+               name: "tests_innerHTML_1.dat #14"
+               html: "<a><colgroup><col>"
+               errors: 2
+               fragment: "table"
+               expected: "| <a>\n| <colgroup>\n|   <col>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #15"
+               html: "<a><tbody><tr>"
+               errors: 1
+               fragment: "table"
+               expected: "| <a>\n| <tbody>\n|   <tr>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #16"
+               html: "<a><tfoot><tr>"
+               errors: 1
+               fragment: "table"
+               expected: "| <a>\n| <tfoot>\n|   <tr>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #17"
+               html: "<a><thead><tr>"
+               errors: 1
+               fragment: "table"
+               expected: "| <a>\n| <thead>\n|   <tr>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #18"
+               html: "<a><tr>"
+               errors: 1
+               fragment: "table"
+               expected: "| <a>\n| <tbody>\n|   <tr>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #19"
+               html: "<a><th>"
+               errors: 2
+               fragment: "table"
+               expected: "| <a>\n| <tbody>\n|   <tr>\n|     <th>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #20"
+               html: "<a><td>"
+               errors: 2
+               fragment: "table"
+               expected: "| <a>\n| <tbody>\n|   <tr>\n|     <td>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #21"
+               html: "<table></table><tbody>"
+               errors: 1
+               fragment: "caption"
+               expected: "| <table>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #22"
+               html: "</table><span>"
+               errors: 2
+               fragment: "caption"
+               expected: "| <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #23"
+               html: "<span></table>"
+               errors: 2
+               fragment: "caption"
+               expected: "| <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #24"
+               html: "</caption><span>"
+               errors: 2
+               fragment: "caption"
+               expected: "| <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #25"
+               html: "<span></caption><span>"
+               errors: 2
+               fragment: "caption"
+               expected: "| <span>\n|   <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #26"
+               html: "<span><caption><span>"
+               errors: 2
+               fragment: "caption"
+               expected: "| <span>\n|   <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #27"
+               html: "<span><col><span>"
+               errors: 2
+               fragment: "caption"
+               expected: "| <span>\n|   <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #28"
+               html: "<span><colgroup><span>"
+               errors: 2
+               fragment: "caption"
+               expected: "| <span>\n|   <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #29"
+               html: "<span><html><span>"
+               errors: 2
+               fragment: "caption"
+               expected: "| <span>\n|   <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #30"
+               html: "<span><tbody><span>"
+               errors: 2
+               fragment: "caption"
+               expected: "| <span>\n|   <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #31"
+               html: "<span><td><span>"
+               errors: 2
+               fragment: "caption"
+               expected: "| <span>\n|   <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #32"
+               html: "<span><tfoot><span>"
+               errors: 2
+               fragment: "caption"
+               expected: "| <span>\n|   <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #33"
+               html: "<span><thead><span>"
+               errors: 2
+               fragment: "caption"
+               expected: "| <span>\n|   <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #34"
+               html: "<span><th><span>"
+               errors: 2
+               fragment: "caption"
+               expected: "| <span>\n|   <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #35"
+               html: "<span><tr><span>"
+               errors: 2
+               fragment: "caption"
+               expected: "| <span>\n|   <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #36"
+               html: "<span></table><span>"
+               errors: 2
+               fragment: "caption"
+               expected: "| <span>\n|   <span>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #37"
+               html: "</colgroup><col>"
+               errors: 1
+               fragment: "colgroup"
+               expected: "| <col>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #38"
+               html: "<a><col>"
+               errors: 1
+               fragment: "colgroup"
+               expected: "| <col>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #39"
+               html: "<caption><a>"
+               errors: 3
+               fragment: "tbody"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #40"
+               html: "<col><a>"
+               errors: 3
+               fragment: "tbody"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #41"
+               html: "<colgroup><a>"
+               errors: 3
+               fragment: "tbody"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #42"
+               html: "<tbody><a>"
+               errors: 3
+               fragment: "tbody"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #43"
+               html: "<tfoot><a>"
+               errors: 3
+               fragment: "tbody"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #44"
+               html: "<thead><a>"
+               errors: 3
+               fragment: "tbody"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #45"
+               html: "</table><a>"
+               errors: 3
+               fragment: "tbody"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #46"
+               html: "<a><tr>"
+               errors: 1
+               fragment: "tbody"
+               expected: "| <a>\n| <tr>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #47"
+               html: "<a><td>"
+               errors: 2
+               fragment: "tbody"
+               expected: "| <a>\n| <tr>\n|   <td>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #48"
+               html: "<a><td>"
+               errors: 2
+               fragment: "tbody"
+               expected: "| <a>\n| <tr>\n|   <td>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #49"
+               html: "<a><td>"
+               errors: 2
+               fragment: "tbody"
+               expected: "| <a>\n| <tr>\n|   <td>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #50"
+               html: "<td><table><tbody><a><tr>"
+               errors: 3
+               fragment: "tbody"
+               expected: "| <tr>\n|   <td>\n|     <a>\n|     <table>\n|       <tbody>\n|         <tr>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #51"
+               html: "</tr><td>"
+               errors: 1
+               fragment: "tr"
+               expected: "| <td>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #52"
+               html: "<td><table><a><tr></tr><tr>"
+               errors: 2
+               fragment: "tr"
+               expected: "| <td>\n|   <a>\n|   <table>\n|     <tbody>\n|       <tr>\n|       <tr>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #53"
+               html: "<caption><td>"
+               errors: 1
+               fragment: "tr"
+               expected: "| <td>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #54"
+               html: "<col><td>"
+               errors: 1
+               fragment: "tr"
+               expected: "| <td>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #55"
+               html: "<colgroup><td>"
+               errors: 1
+               fragment: "tr"
+               expected: "| <td>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #56"
+               html: "<tbody><td>"
+               errors: 1
+               fragment: "tr"
+               expected: "| <td>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #57"
+               html: "<tfoot><td>"
+               errors: 1
+               fragment: "tr"
+               expected: "| <td>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #58"
+               html: "<thead><td>"
+               errors: 1
+               fragment: "tr"
+               expected: "| <td>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #59"
+               html: "<tr><td>"
+               errors: 1
+               fragment: "tr"
+               expected: "| <td>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #60"
+               html: "</table><td>"
+               errors: 1
+               fragment: "tr"
+               expected: "| <td>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #61"
+               html: "<td><table></table><td>"
+               fragment: "tr"
+               expected: "| <td>\n|   <table>\n| <td>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #62"
+               html: "<td><table></table><td>"
+               fragment: "tr"
+               expected: "| <td>\n|   <table>\n| <td>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #63"
+               html: "<caption><a>"
+               errors: 2
+               fragment: "td"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #64"
+               html: "<col><a>"
+               errors: 2
+               fragment: "td"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #65"
+               html: "<colgroup><a>"
+               errors: 2
+               fragment: "td"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #66"
+               html: "<tbody><a>"
+               errors: 2
+               fragment: "td"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #67"
+               html: "<tfoot><a>"
+               errors: 2
+               fragment: "td"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #68"
+               html: "<th><a>"
+               errors: 2
+               fragment: "td"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #69"
+               html: "<thead><a>"
+               errors: 2
+               fragment: "td"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #70"
+               html: "<tr><a>"
+               errors: 2
+               fragment: "td"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #71"
+               html: "</table><a>"
+               errors: 2
+               fragment: "td"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #72"
+               html: "</tbody><a>"
+               errors: 2
+               fragment: "td"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #73"
+               html: "</td><a>"
+               errors: 2
+               fragment: "td"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #74"
+               html: "</tfoot><a>"
+               errors: 2
+               fragment: "td"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #75"
+               html: "</thead><a>"
+               errors: 2
+               fragment: "td"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #76"
+               html: "</th><a>"
+               errors: 2
+               fragment: "td"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #77"
+               html: "</tr><a>"
+               errors: 2
+               fragment: "td"
+               expected: "| <a>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #78"
+               html: "<table><td><td>"
+               errors: 2
+               fragment: "td"
+               expected: "| <table>\n|   <tbody>\n|     <tr>\n|       <td>\n|       <td>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #79"
+               html: "</select><option>"
+               errors: 2
+               fragment: "select"
+               expected: "| <option>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #80"
+               html: "<input><option>"
+               errors: 2
+               fragment: "select"
+               expected: "| <option>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #81"
+               html: "<keygen><option>"
+               errors: 2
+               fragment: "select"
+               expected: "| <option>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #82"
+               html: "<textarea><option>"
+               errors: 2
+               fragment: "select"
+               expected: "| <option>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #83"
+               html: "</html><!--abc-->"
+               errors: 1
+               fragment: "html"
+               expected: "| <head>\n| <body>\n| <!-- abc -->\n"
+       }, {
+               name: "tests_innerHTML_1.dat #84"
+               html: "</frameset><frame>"
+               errors: 1
+               fragment: "frameset"
+               expected: "| <frame>\n"
+       }, {
+               name: "tests_innerHTML_1.dat #85"
+               html: ""
+               fragment: "html"
+               expected: "| <head>\n| <body>\n"
+       }, {
+               name: "tricky01.dat #1"
+               html: "<b><p>Bold </b> Not bold</p>\nAlso not bold."
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|     <p>\n|       <b>\n|         \"Bold \"\n|       \" Not bold\"\n|     \"\nAlso not bold.\"\n"
+       }, {
+               name: "tricky01.dat #2"
+               html: "<html>\n<font color=red><i>Italic and Red<p>Italic and Red </font> Just italic.</p> Italic only.</i> Plain\n<p>I should not be red. <font color=red>Red. <i>Italic and red.</p>\n<p>Italic and red. </i> Red.</font> I should not be red.</p>\n<b>Bold <i>Bold and italic</b> Only Italic </i> Plain"
+               errors: 6
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <font>\n|       color=\"red\"\n|       <i>\n|         \"Italic and Red\"\n|     <i>\n|       <p>\n|         <font>\n|           color=\"red\"\n|           \"Italic and Red \"\n|         \" Just italic.\"\n|       \" Italic only.\"\n|     \" Plain\n\"\n|     <p>\n|       \"I should not be red. \"\n|       <font>\n|         color=\"red\"\n|         \"Red. \"\n|         <i>\n|           \"Italic and red.\"\n|     <font>\n|       color=\"red\"\n|       <i>\n|         \"\n\"\n|     <p>\n|       <font>\n|         color=\"red\"\n|         <i>\n|           \"Italic and red. \"\n|         \" Red.\"\n|       \" I should not be red.\"\n|     \"\n\"\n|     <b>\n|       \"Bold \"\n|       <i>\n|         \"Bold and italic\"\n|     <i>\n|       \" Only Italic \"\n|     \" Plain\"\n"
+       }, {
+               name: "tricky01.dat #3"
+               html: "<html><body>\n<p><font size=\"7\">First paragraph.</p>\n<p>Second paragraph.</p></font>\n<b><p><i>Bold and Italic</b> Italic</p>"
+               errors: 5
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"\n\"\n|     <p>\n|       <font>\n|         size=\"7\"\n|         \"First paragraph.\"\n|     <font>\n|       size=\"7\"\n|       \"\n\"\n|       <p>\n|         \"Second paragraph.\"\n|     \"\n\"\n|     <b>\n|     <p>\n|       <b>\n|         <i>\n|           \"Bold and Italic\"\n|       <i>\n|         \" Italic\"\n"
+       }, {
+               name: "tricky01.dat #4"
+               html: "<html>\n<dl>\n<dt><b>Boo\n<dd>Goo?\n</dl>\n</html>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <dl>\n|       \"\n\"\n|       <dt>\n|         <b>\n|           \"Boo\n\"\n|       <dd>\n|         <b>\n|           \"Goo?\n\"\n|     <b>\n|       \"\n\"\n"
+       }, {
+               name: "tricky01.dat #5"
+               html: "<html><body>\n<label><a><div>Hello<div>World</div></a></label>  \n</body></html>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"\n\"\n|     <label>\n|       <a>\n|       <div>\n|         <a>\n|           \"Hello\"\n|           <div>\n|             \"World\"\n|         \"  \n\"\n"
+       }, {
+               name: "tricky01.dat #6"
+               html: "<table><center> <font>a</center> <img> <tr><td> </td> </tr> </table>"
+               errors: 9
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <center>\n|       \" \"\n|       <font>\n|         \"a\"\n|     <font>\n|       <img>\n|       \" \"\n|     <table>\n|       \" \"\n|       <tbody>\n|         <tr>\n|           <td>\n|             \" \"\n|           \" \"\n|         \" \"\n"
+       }, {
+               name: "tricky01.dat #7"
+               html: "<table><tr><p><a><p>You should see this text."
+               errors: 31
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <a>\n|     <p>\n|       <a>\n|         \"You should see this text.\"\n|     <table>\n|       <tbody>\n|         <tr>\n"
+       }, {
+               name: "tricky01.dat #8"
+               html: "<TABLE>\n<TR>\n<CENTER><CENTER><TD></TD></TR><TR>\n<FONT>\n<TABLE><tr></tr></TABLE>\n</P>\n<a></font><font></a>\nThis page contains an insanely badly-nested tag sequence."
+               errors: 10
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <center>\n|       <center>\n|     <font>\n|       \"\n\"\n|     <table>\n|       \"\n\"\n|       <tbody>\n|         <tr>\n|           \"\n\"\n|           <td>\n|         <tr>\n|           \"\n\"\n|     <table>\n|       <tbody>\n|         <tr>\n|     <font>\n|       \"\n\"\n|       <p>\n|       \"\n\"\n|       <a>\n|     <a>\n|       <font>\n|     <font>\n|       \"\nThis page contains an insanely badly-nested tag sequence.\"\n"
+       }, {
+               name: "tricky01.dat #9"
+               html: "<html>\n<body>\n<b><nobr><div>This text is in a div inside a nobr</nobr>More text that should not be in the nobr, i.e., the\nnobr should have closed the div inside it implicitly. </b><pre>A pre tag outside everything else.</pre>\n</body>\n</html>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"\n\"\n|     <b>\n|       <nobr>\n|     <div>\n|       <b>\n|         <nobr>\n|           \"This text is in a div inside a nobr\"\n|         \"More text that should not be in the nobr, i.e., the\nnobr should have closed the div inside it implicitly. \"\n|       <pre>\n|         \"A pre tag outside everything else.\"\n|       \"\n\n\"\n"
+       }, {
+               name: "webkit01.dat #1"
+               html: "Test"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"Test\"\n"
+       }, {
+               name: "webkit01.dat #2"
+               html: "<div></div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n"
+       }, {
+               name: "webkit01.dat #3"
+               html: "<div>Test</div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"Test\"\n"
+       }, {
+               name: "webkit01.dat #4"
+               html: "<di"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "webkit01.dat #5"
+               html: "<div>Hello</div>\n<script>\nconsole.log(\"PASS\");\n</script>\n<div>Bye</div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"Hello\"\n|     \"\n\"\n|     <script>\n|       \"\nconsole.log(\"PASS\");\n\"\n|     \"\n\"\n|     <div>\n|       \"Bye\"\n"
+       }, {
+               name: "webkit01.dat #6"
+               html: "<div foo=\"bar\">Hello</div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       foo=\"bar\"\n|       \"Hello\"\n"
+       }, {
+               name: "webkit01.dat #7"
+               html: "<div>Hello</div>\n<script>\nconsole.log(\"FOO<span>BAR</span>BAZ\");\n</script>\n<div>Bye</div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"Hello\"\n|     \"\n\"\n|     <script>\n|       \"\nconsole.log(\"FOO<span>BAR</span>BAZ\");\n\"\n|     \"\n\"\n|     <div>\n|       \"Bye\"\n"
+       }, {
+               name: "webkit01.dat #8"
+               html: "<foo bar=\"baz\"></foo><potato quack=\"duck\"></potato>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <foo>\n|       bar=\"baz\"\n|     <potato>\n|       quack=\"duck\"\n"
+       }, {
+               name: "webkit01.dat #9"
+               html: "<foo bar=\"baz\"><potato quack=\"duck\"></potato></foo>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <foo>\n|       bar=\"baz\"\n|       <potato>\n|         quack=\"duck\"\n"
+       }, {
+               name: "webkit01.dat #10"
+               html: "<foo></foo bar=\"baz\"><potato></potato quack=\"duck\">"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <foo>\n|     <potato>\n"
+       }, {
+               name: "webkit01.dat #11"
+               html: "</ tttt>"
+               errors: 2
+               expected: "| <!--  tttt -->\n| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "webkit01.dat #12"
+               html: "<div FOO ><img><img></div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       foo=\"\"\n|       <img>\n|       <img>\n"
+       }, {
+               name: "webkit01.dat #13"
+               html: "<p>Test</p<p>Test2</p>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       \"TestTest2\"\n"
+       }, {
+               name: "webkit01.dat #14"
+               html: "<rdar://problem/6869687>"
+               errors: 5
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <rdar:>\n|       6869687=\"\"\n|       problem=\"\"\n"
+       }, {
+               name: "webkit01.dat #15"
+               html: "<A>test< /A>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       \"test< /A>\"\n"
+       }, {
+               name: "webkit01.dat #16"
+               html: "&lt;"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"<\"\n"
+       }, {
+               name: "webkit01.dat #17"
+               html: "<body foo='bar'><body foo='baz' yo='mama'>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     foo=\"bar\"\n|     yo=\"mama\"\n"
+       }, {
+               name: "webkit01.dat #18"
+               html: "<body></br foo=\"bar\"></body>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <br>\n"
+       }, {
+               name: "webkit01.dat #19"
+               html: "<bdy><br foo=\"bar\"></body>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <bdy>\n|       <br>\n|         foo=\"bar\"\n"
+       }, {
+               name: "webkit01.dat #20"
+               html: "<body></body></br foo=\"bar\">"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <br>\n"
+       }, {
+               name: "webkit01.dat #21"
+               html: "<bdy></body><br foo=\"bar\">"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <bdy>\n|       <br>\n|         foo=\"bar\"\n"
+       }, {
+               name: "webkit01.dat #22"
+               html: "<html><body></body></html><!-- Hi there -->"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n| <!--  Hi there  -->\n"
+       }, {
+               name: "webkit01.dat #23"
+               html: "<html><body></body></html>x<!-- Hi there -->"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"x\"\n|     <!--  Hi there  -->\n"
+       }, {
+               name: "webkit01.dat #24"
+               html: "<html><body></body></html>x<!-- Hi there --></html><!-- Again -->"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"x\"\n|     <!--  Hi there  -->\n| <!--  Again  -->\n"
+       }, {
+               name: "webkit01.dat #25"
+               html: "<html><body></body></html>x<!-- Hi there --></body></html><!-- Again -->"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"x\"\n|     <!--  Hi there  -->\n| <!--  Again  -->\n"
+       }, {
+               name: "webkit01.dat #26"
+               html: "<html><body><ruby><div><rp>xx</rp></div></ruby></body></html>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       <div>\n|         <rp>\n|           \"xx\"\n"
+       }, {
+               name: "webkit01.dat #27"
+               html: "<html><body><ruby><div><rt>xx</rt></div></ruby></body></html>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       <div>\n|         <rt>\n|           \"xx\"\n"
+       }, {
+               name: "webkit01.dat #28"
+               html: "<html><frameset><!--1--><noframes>A</noframes><!--2--></frameset><!--3--><noframes>B</noframes><!--4--></html><!--5--><noframes>C</noframes><!--6-->"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <frameset>\n|     <!-- 1 -->\n|     <noframes>\n|       \"A\"\n|     <!-- 2 -->\n|   <!-- 3 -->\n|   <noframes>\n|     \"B\"\n|   <!-- 4 -->\n|   <noframes>\n|     \"C\"\n| <!-- 5 -->\n| <!-- 6 -->\n"
+       }, {
+               name: "webkit01.dat #29"
+               html: "<select><option>A<select><option>B<select><option>C<select><option>D<select><option>E<select><option>F<select><option>G<select>"
+               errors: 6
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n|         \"A\"\n|     <option>\n|       \"B\"\n|       <select>\n|         <option>\n|           \"C\"\n|     <option>\n|       \"D\"\n|       <select>\n|         <option>\n|           \"E\"\n|     <option>\n|       \"F\"\n|       <select>\n|         <option>\n|           \"G\"\n"
+       }, {
+               name: "webkit01.dat #30"
+               html: "<dd><dd><dt><dt><dd><li><li>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <dd>\n|     <dd>\n|     <dt>\n|     <dt>\n|     <dd>\n|       <li>\n|       <li>\n"
+       }, {
+               name: "webkit01.dat #31"
+               html: "<div><b></div><div><nobr>a<nobr>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <b>\n|     <div>\n|       <b>\n|         <nobr>\n|           \"a\"\n|         <nobr>\n"
+       }, {
+               name: "webkit01.dat #32"
+               html: "<head></head>\n<body></body>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   \"\n\"\n|   <body>\n"
+       }, {
+               name: "webkit01.dat #33"
+               html: "<head></head> <style></style>ddd"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|     <style>\n|   \" \"\n|   <body>\n|     \"ddd\"\n"
+       }, {
+               name: "webkit01.dat #34"
+               html: "<kbd><table></kbd><col><select><tr>"
+               errors: 6
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <kbd>\n|       <select>\n|       <table>\n|         <colgroup>\n|           <col>\n|         <tbody>\n|           <tr>\n"
+       }, {
+               name: "webkit01.dat #35"
+               html: "<kbd><table></kbd><col><select><tr></table><div>"
+               errors: 6
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <kbd>\n|       <select>\n|       <table>\n|         <colgroup>\n|           <col>\n|         <tbody>\n|           <tr>\n|       <div>\n"
+       }, {
+               name: "webkit01.dat #36"
+               html: "<a><li><style></style><title></title></a>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|     <li>\n|       <a>\n|         <style>\n|         <title>\n"
+       }, {
+               name: "webkit01.dat #37"
+               html: "<font></p><p><meta><title></title></font>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <font>\n|       <p>\n|     <p>\n|       <font>\n|         <meta>\n|         <title>\n"
+       }, {
+               name: "webkit01.dat #38"
+               html: "<a><center><title></title><a>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|     <center>\n|       <a>\n|         <title>\n|       <a>\n"
+       }, {
+               name: "webkit01.dat #39"
+               html: "<svg><title><div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg title>\n|         <div>\n"
+       }, {
+               name: "webkit01.dat #40"
+               html: "<svg><title><rect><div>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg title>\n|         <rect>\n|           <div>\n"
+       }, {
+               name: "webkit01.dat #41"
+               html: "<svg><title><svg><div>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg title>\n|         <svg svg>\n|         <div>\n"
+       }, {
+               name: "webkit01.dat #42"
+               html: "<img <=\"\" FAIL>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <img>\n|       <=\"\"\n|       fail=\"\"\n"
+       }, {
+               name: "webkit01.dat #43"
+               html: "<ul><li><div id='foo'/>A</li><li>B<div>C</div></li></ul>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <ul>\n|       <li>\n|         <div>\n|           id=\"foo\"\n|           \"A\"\n|       <li>\n|         \"B\"\n|         <div>\n|           \"C\"\n"
+       }, {
+               name: "webkit01.dat #44"
+               html: "<svg><em><desc></em>"
+               errors: 3
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|     <em>\n|       <desc>\n"
+       }, {
+               name: "webkit01.dat #45"
+               html: "<table><tr><td><svg><desc><td></desc><circle>"
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <svg svg>\n|               <svg desc>\n|           <td>\n|             <circle>\n"
+       }, {
+               name: "webkit01.dat #46"
+               html: "<svg><tfoot></mi><td>"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg tfoot>\n|         <svg td>\n"
+       }, {
+               name: "webkit01.dat #47"
+               html: "<math><mrow><mrow><mn>1</mn></mrow><mi>a</mi></mrow></math>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mrow>\n|         <math mrow>\n|           <math mn>\n|             \"1\"\n|         <math mi>\n|           \"a\"\n"
+       }, {
+               name: "webkit01.dat #48"
+               html: "<!doctype html><input type=\"hidden\"><frameset>"
+               errors: 2
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
+       }, {
+               name: "webkit01.dat #49"
+               html: "<!doctype html><input type=\"button\"><frameset>"
+               errors: 1
+               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <input>\n|       type=\"button\"\n"
+       }, {
+               name: "webkit02.dat #1"
+               html: "<foo bar=qux/>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <foo>\n|       bar=\"qux/\"\n"
+       }, {
+               name: "webkit02.dat #2"
+               html: "<p id=\"status\"><noscript><strong>A</strong></noscript><span>B</span></p>"
+               scripting: true
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       id=\"status\"\n|       <noscript>\n|         \"<strong>A</strong>\"\n|       <span>\n|         \"B\"\n"
+       }, {
+               name: "webkit02.dat #3"
+               html: "<p id=\"status\"><noscript><strong>A</strong></noscript><span>B</span></p>"
+               scripting: false
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       id=\"status\"\n|       <noscript>\n|         <strong>\n|           \"A\"\n|       <span>\n|         \"B\"\n"
+       }, {
+               name: "webkit02.dat #4"
+               html: "<div><sarcasm><div></div></sarcasm></div>"
+               errors: 1
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <sarcasm>\n|         <div>\n"
+       }, {
+               name: "webkit02.dat #5"
+               html: "<html><body><img src=\"\" border=\"0\" alt=\"><div>A</div></body></html>"
+               errors: 2
+               expected: "| <html>\n|   <head>\n|   <body>\n"
+       }, {
+               name: "webkit02.dat #6"
+               html: "<table><td></tbody>A"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     \"A\"\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n"
+       }, {
+               name: "webkit02.dat #7"
+               html: "<table><td></thead>A"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"A\"\n"
+       }, {
+               name: "webkit02.dat #8"
+               html: "<table><td></tfoot>A"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"A\"\n"
+       }, {
+               name: "webkit02.dat #9"
+               html: "<table><thead><td></tbody>A"
+               errors: 4
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <thead>\n|         <tr>\n|           <td>\n|             \"A\"\n"
+       }, {
+               name: "webkit02.dat #10"
+               html: "<legend>test</legend>"
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <legend>\n|       \"test\"\n"
+       }, {
+               name: "webkit02.dat #11"
+               html: "<table><input>"
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <input>\n|     <table>\n"
+       }, {
+               name: "webkit02.dat #12"
+               html: "<b><em><foo><foo><aside></b>"
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <em>\n|         <foo>\n|           <foo>\n|     <em>\n|       <aside>\n|         <b>\n"
+       }, {
+               name: "webkit02.dat #13"
+               html: "<b><em><foo><foo><aside></b></em>"
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <em>\n|         <foo>\n|           <foo>\n|     <em>\n|     <aside>\n|       <em>\n|         <b>\n"
+       }, {
+               name: "webkit02.dat #14"
+               html: "<b><em><foo><foo><foo><aside></b>"
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <em>\n|         <foo>\n|           <foo>\n|             <foo>\n|     <aside>\n|       <b>\n"
+       }, {
+               name: "webkit02.dat #15"
+               html: "<b><em><foo><foo><foo><aside></b></em>"
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <em>\n|         <foo>\n|           <foo>\n|             <foo>\n|     <aside>\n|       <b>\n"
+       }, {
+               name: "webkit02.dat #16"
+               html: "<b><em><foo><foo><foo><foo><foo><foo><foo><foo><foo><foo><aside></b></em>"
+               fragment: "div"
+               expected: "| <b>\n|   <em>\n|     <foo>\n|       <foo>\n|         <foo>\n|           <foo>\n|             <foo>\n|               <foo>\n|                 <foo>\n|                   <foo>\n|                     <foo>\n|                       <foo>\n| <aside>\n|   <b>\n"
+       }, {
+               name: "webkit02.dat #17"
+               html: "<b><em><foo><foob><foob><foob><foob><fooc><fooc><fooc><fooc><food><aside></b></em>"
+               fragment: "div"
+               expected: "| <b>\n|   <em>\n|     <foo>\n|       <foob>\n|         <foob>\n|           <foob>\n|             <foob>\n|               <fooc>\n|                 <fooc>\n|                   <fooc>\n|                     <fooc>\n|                       <food>\n| <aside>\n|   <b>\n"
+       }, {
+               name: "webkit02.dat #18"
+               html: "<isindex action=\"x\">"
+               fragment: "table"
+               expected: "| <form>\n|   action=\"x\"\n|   <hr>\n|   <label>\n|     \"This is a searchable index. Enter search keywords: \"\n|     <input>\n|       name=\"isindex\"\n|   <hr>\n"
+       }, {
+               name: "webkit02.dat #19"
+               html: "<option><XH<optgroup></optgroup>"
+               fragment: "select"
+               expected: "| <option>\n"
+       }, {
+               name: "webkit02.dat #20"
+               html: "<svg><foreignObject><div>foo</div><plaintext></foreignObject></svg><div>bar</div>"
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg foreignObject>\n|         <div>\n|           \"foo\"\n|         <plaintext>\n|           \"</foreignObject></svg><div>bar</div>\"\n"
+       }, {
+               name: "webkit02.dat #21"
+               html: "<svg><foreignObject></foreignObject><title></svg>foo"
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg foreignObject>\n|       <svg title>\n|     \"foo\"\n"
+       }, {
+               name: "webkit02.dat #22"
+               html: "</foreignObject><plaintext><div>foo</div>"
+               expected: "| <html>\n|   <head>\n|   <body>\n|     <plaintext>\n|       \"<div>foo</div>\"\n"
+       }
+]
+
+if typeof module isnt 'undefined' and module.exports?
+       wheic_parser = require './parser.coffee'
+else
+       wheic_parser = window.wheic_parser
+
+serialize_els = (els, prefix = '| ') ->
+       ret = ''
+       for el in els
+               switch el.type
+                       when wheic_parser.TYPE_TAG
+                               ret += "#{prefix}<"
+                               if el.namespace is wheic_parser.NS_MATHML
+                                       ret += "math "
+                               if el.namespace is wheic_parser.NS_SVG
+                                       ret += "svg "
+                               ret += "#{el.name}>\n"
+                               attr_keys = []
+                               for k of el.attrs
+                                       attr_keys.push k
+                               attr_keys.sort() # TODO this should be "lexicographically by UTF-16 code unit"
+                               for k in attr_keys
+                                       ret += "#{prefix}  #{k}=\"#{el.attrs[k]}\"\n"
+                               if el.name is 'template' and el.namespace is wheic_parser.NS_HTML
+                                       ret += "#{prefix}  content\n"
+                                       ret += serialize_els el.children, "#{prefix}    "
+                               else
+                                       ret += serialize_els el.children, "#{prefix}  "
+                       when wheic_parser.TYPE_TEXT
+                               ret += "#{prefix}\"#{el.text}\"\n"
+                       when wheic_parser.TYPE_COMMENT
+                               ret += "#{prefix}<!-- #{el.text} -->\n"
+                       when wheic_parser.TYPE_DOCTYPE
+                               ret += "#{prefix}<!DOCTYPE #{el.name}"
+                               if (el.public_identifier? and el.public_identifier.length > 0) or (el.system_identifier? and el.system_identifier.length > 0)
+                                       ret += " \"#{el.public_identifier ? ''}\""
+                                       ret += " \"#{el.system_identifier ? ''}\""
+                               ret += ">\n"
+                       else
+                               ret += "#{prefix}UNKNOWN TAG TYPE #{el.type}"
+       return ret
+
+test_results = passed: 0, failed: 0
+test_parser = (args) ->
+       wheic_parser.debug_log_reset()
+       parse_errors = []
+       args.error_cb = (i) ->
+               parse_errors.push i
+       prev_node_id = 0 # reset counter
+       parsed = wheic_parser.parse args.html, args
+       serialized = serialize_els parsed
+       if serialized isnt args.expected
+               test_results.failed += 1
+               if test_results.failed is 1
+                       wheic_parser.debug_log_each (str) ->
+                               console.log str
+                       console.log "FAILED: \"#{args.name}\""
+                       console.log "      Input: #{args.html}"
+                       if args.fragment?
+                               console.log "   Fragment: #{args.fragment}"
+                       console.log "    Correct: #{args.expected}"
+                       console.log "     Output: #{serialized}"
+                       if parse_errors.length > 0
+                               console.log " parse errs: #{JSON.stringify parse_errors}"
+                       else
+                               console.log "   No parse errors"
+       else
+               test_results.passed += 1
+               # console.log "passed \"#{args.name}\""
+test_summary = ->
+       console.log "Tests passed: #{test_results.passed}, Failed: #{test_results.failed}"
+
+
+next_test = 0
+run_tests_and_breathe = ->
+       start_time = new Date()
+       loop
+               if next_test >= tests.length
+                       test_summary()
+                       return
+               test_parser tests[next_test]
+               next_test += 1
+               now = new Date()
+               if now - start_time > 100 # miliseconds
+                       break
+       setTimeout run_tests_and_breathe, 1
+run_tests_and_breathe()
index f0c7c82..5288014 100644 (file)
@@ -10,7 +10,7 @@
        <p>You'll need to run <code>make</code> to build the javascript files used on this page.</p>
        <p>If you don't have node.js and CoffeeScript installed, you can <a href="parser_tests_coffee.html">use the other test page</a> which compiles the CoffeeScript files on the fly in the browser.</p>
        <p>Check the inspector/console for test results.</p>
-       <script src="parse-html.js"></script>
-       <script src="test.js"></script>
+       <script src="parser.js"></script>
+       <script src="parser_tests.js"></script>
 </body>
 </html>
index 2f370ab..7d2fc4d 100644 (file)
@@ -10,8 +10,8 @@
        <p>This version of the test page compiles the CoffeeScript files in the browser, so you don't have to install CoffeeScript (or node.js).</p>
        <p>It can take a few seconds for the tests to compile.</p>
        <p>Check the inspector/console for test results.</p>
-       <script src="parse-html.coffee" type="text/coffeescript"></script>
-       <script src="test.coffee" type="text/coffeescript"></script>
+       <script src="parser.coffee" type="text/coffeescript"></script>
+       <script src="parser_tests.coffee" type="text/coffeescript"></script>
        <script src="coffee-script.js"></script>
 </body>
 </html>
diff --git a/test.coffee b/test.coffee
deleted file mode 100644 (file)
index fabb61b..0000000
+++ /dev/null
@@ -1,8019 +0,0 @@
-# Copyright (c) 2006-2015 Jason Woofenden, James Graham, Geoffrey Sneddon, and
-# other contributors
-#
-# The values in the following data structure were extracted from the project at
-# https://github.com/html5lib/html5lib-tests which has the following notice:
-#
-# Copyright (c) 2006-2013 James Graham, Geoffrey Sneddon, and
-# other contributors
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# The rest of this file was written by Jason Woofenden in 2015-2016, and is
-# released under the terms of the CC0 license:
-# http://creativecommons.org/publicdomain/zero/1.0/ and into the public domain
-
-tests = [
-       {
-               name: "adoption01.dat #1"
-               html: "<a><p></a></p>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|     <p>\n|       <a>\n"
-       }, {
-               name: "adoption01.dat #2"
-               html: "<a>1<p>2</a>3</p>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       \"1\"\n|     <p>\n|       <a>\n|         \"2\"\n|       \"3\"\n"
-       }, {
-               name: "adoption01.dat #3"
-               html: "<a>1<button>2</a>3</button>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       \"1\"\n|     <button>\n|       <a>\n|         \"2\"\n|       \"3\"\n"
-       }, {
-               name: "adoption01.dat #4"
-               html: "<a>1<b>2</a>3</b>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       \"1\"\n|       <b>\n|         \"2\"\n|     <b>\n|       \"3\"\n"
-       }, {
-               name: "adoption01.dat #5"
-               html: "<a>1<div>2<div>3</a>4</div>5</div>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       \"1\"\n|     <div>\n|       <a>\n|         \"2\"\n|       <div>\n|         <a>\n|           \"3\"\n|         \"4\"\n|       \"5\"\n"
-       }, {
-               name: "adoption01.dat #6"
-               html: "<table><a>1<p>2</a>3</p>"
-               errors: 10
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       \"1\"\n|     <p>\n|       <a>\n|         \"2\"\n|       \"3\"\n|     <table>\n"
-       }, {
-               name: "adoption01.dat #7"
-               html: "<b><b><a><p></a>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <b>\n|         <a>\n|         <p>\n|           <a>\n"
-       }, {
-               name: "adoption01.dat #8"
-               html: "<b><a><b><p></a>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <a>\n|         <b>\n|       <b>\n|         <p>\n|           <a>\n"
-       }, {
-               name: "adoption01.dat #9"
-               html: "<a><b><b><p></a>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <b>\n|         <b>\n|     <b>\n|       <b>\n|         <p>\n|           <a>\n"
-       }, {
-               name: "adoption01.dat #10"
-               html: "<p>1<s id=\"A\">2<b id=\"B\">3</p>4</s>5</b>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       \"1\"\n|       <s>\n|         id=\"A\"\n|         \"2\"\n|         <b>\n|           id=\"B\"\n|           \"3\"\n|     <s>\n|       id=\"A\"\n|       <b>\n|         id=\"B\"\n|         \"4\"\n|     <b>\n|       id=\"B\"\n|       \"5\"\n"
-       }, {
-               name: "adoption01.dat #11"
-               html: "<table><a>1<td>2</td>3</table>"
-               errors: 5
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       \"1\"\n|     <a>\n|       \"3\"\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"2\"\n"
-       }, {
-               name: "adoption01.dat #12"
-               html: "<table>A<td>B</td>C</table>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"AC\"\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"B\"\n"
-       }, {
-               name: "adoption01.dat #13"
-               html: "<a><svg><tr><input></a>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <svg svg>\n|         <svg tr>\n|           <svg input>\n"
-       }, {
-               name: "adoption01.dat #14"
-               html: "<div><a><b><div><div><div><div><div><div><div><div><div><div></a>"
-               errors: 10
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <a>\n|         <b>\n|       <b>\n|         <div>\n|           <a>\n|           <div>\n|             <a>\n|             <div>\n|               <a>\n|               <div>\n|                 <a>\n|                 <div>\n|                   <a>\n|                   <div>\n|                     <a>\n|                     <div>\n|                       <a>\n|                       <div>\n|                         <a>\n|                           <div>\n|                             <div>\n"
-       }, {
-               name: "adoption01.dat #15"
-               html: "<div><a><b><u><i><code><div></a>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <a>\n|         <b>\n|           <u>\n|             <i>\n|               <code>\n|       <u>\n|         <i>\n|           <code>\n|             <div>\n|               <a>\n"
-       }, {
-               name: "adoption01.dat #16"
-               html: "<b><b><b><b>x</b></b></b></b>y"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <b>\n|         <b>\n|           <b>\n|             \"x\"\n|     \"y\"\n"
-       }, {
-               name: "adoption01.dat #17"
-               html: "<p><b><b><b><b><p>x"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <b>\n|         <b>\n|           <b>\n|             <b>\n|     <p>\n|       <b>\n|         <b>\n|           <b>\n|             \"x\"\n"
-       }, {
-               name: "adoption02.dat #1"
-               html: "<b>1<i>2<p>3</b>4"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       \"1\"\n|       <i>\n|         \"2\"\n|     <i>\n|       <p>\n|         <b>\n|           \"3\"\n|         \"4\"\n"
-       }, {
-               name: "adoption02.dat #2"
-               html: "<a><div><style></style><address><a>"
-               errors: 5
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|     <div>\n|       <a>\n|         <style>\n|       <address>\n|         <a>\n|         <a>\n"
-       }, {
-               name: "comments01.dat #1"
-               html: "FOO<!-- BAR -->BAZ"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <!--  BAR  -->\n|     \"BAZ\"\n"
-       }, {
-               name: "comments01.dat #2"
-               html: "FOO<!-- BAR --!>BAZ"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <!--  BAR  -->\n|     \"BAZ\"\n"
-       }, {
-               name: "comments01.dat #3"
-               html: "FOO<!-- BAR --   >BAZ"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <!--  BAR --   >BAZ -->\n"
-       }, {
-               name: "comments01.dat #4"
-               html: "FOO<!-- BAR -- <QUX> -- MUX -->BAZ"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <!--  BAR -- <QUX> -- MUX  -->\n|     \"BAZ\"\n"
-       }, {
-               name: "comments01.dat #5"
-               html: "FOO<!-- BAR -- <QUX> -- MUX --!>BAZ"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <!--  BAR -- <QUX> -- MUX  -->\n|     \"BAZ\"\n"
-       }, {
-               name: "comments01.dat #6"
-               html: "FOO<!-- BAR -- <QUX> -- MUX -- >BAZ"
-               errors: 5
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <!--  BAR -- <QUX> -- MUX -- >BAZ -->\n"
-       }, {
-               name: "comments01.dat #7"
-               html: "FOO<!---->BAZ"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <!--  -->\n|     \"BAZ\"\n"
-       }, {
-               name: "comments01.dat #8"
-               html: "FOO<!--->BAZ"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <!--  -->\n|     \"BAZ\"\n"
-       }, {
-               name: "comments01.dat #9"
-               html: "FOO<!-->BAZ"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <!--  -->\n|     \"BAZ\"\n"
-       }, {
-               name: "comments01.dat #10"
-               html: "<?xml version=\"1.0\">Hi"
-               errors: 2
-               expected: "| <!-- ?xml version=\"1.0\" -->\n| <html>\n|   <head>\n|   <body>\n|     \"Hi\"\n"
-       }, {
-               name: "comments01.dat #11"
-               html: "<?xml version=\"1.0\">"
-               errors: 2
-               expected: "| <!-- ?xml version=\"1.0\" -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "comments01.dat #12"
-               html: "<?xml version"
-               errors: 2
-               expected: "| <!-- ?xml version -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "comments01.dat #13"
-               html: "FOO<!----->BAZ"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <!-- - -->\n|     \"BAZ\"\n"
-       }, {
-               name: "comments01.dat #14"
-               html: "<html><!-- comment --><title>Comment before head</title>"
-               errors: 1
-               expected: "| <html>\n|   <!--  comment  -->\n|   <head>\n|     <title>\n|       \"Comment before head\"\n|   <body>\n"
-       }, {
-               name: "doctype01.dat #1"
-               html: "<!DOCTYPE html>Hello"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #2"
-               html: "<!dOctYpE HtMl>Hello"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #3"
-               html: "<!DOCTYPEhtml>Hello"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #4"
-               html: "<!DOCTYPE>Hello"
-               errors: 3
-               expected: "| <!DOCTYPE >\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #5"
-               html: "<!DOCTYPE >Hello"
-               errors: 2
-               expected: "| <!DOCTYPE >\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #6"
-               html: "<!DOCTYPE potato>Hello"
-               errors: 1
-               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #7"
-               html: "<!DOCTYPE potato >Hello"
-               errors: 1
-               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #8"
-               html: "<!DOCTYPE potato taco>Hello"
-               errors: 2
-               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #9"
-               html: "<!DOCTYPE potato taco \"ddd>Hello"
-               errors: 2
-               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #10"
-               html: "<!DOCTYPE potato sYstEM>Hello"
-               errors: 2
-               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #11"
-               html: "<!DOCTYPE potato sYstEM    >Hello"
-               errors: 2
-               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #12"
-               html: "<!DOCTYPE   potato       sYstEM  ggg>Hello"
-               errors: 2
-               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #13"
-               html: "<!DOCTYPE potato SYSTEM taco  >Hello"
-               errors: 2
-               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #14"
-               html: "<!DOCTYPE potato SYSTEM 'taco\"'>Hello"
-               errors: 1
-               expected: "| <!DOCTYPE potato \"\" \"taco\"\">\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #15"
-               html: "<!DOCTYPE potato SYSTEM \"taco\">Hello"
-               errors: 1
-               expected: "| <!DOCTYPE potato \"\" \"taco\">\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #16"
-               html: "<!DOCTYPE potato SYSTEM \"tai'co\">Hello"
-               errors: 1
-               expected: "| <!DOCTYPE potato \"\" \"tai'co\">\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #17"
-               html: "<!DOCTYPE potato SYSTEMtaco \"ddd\">Hello"
-               errors: 2
-               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #18"
-               html: "<!DOCTYPE potato grass SYSTEM taco>Hello"
-               errors: 2
-               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #19"
-               html: "<!DOCTYPE potato pUbLIc>Hello"
-               errors: 2
-               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #20"
-               html: "<!DOCTYPE potato pUbLIc >Hello"
-               errors: 2
-               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #21"
-               html: "<!DOCTYPE potato pUbLIcgoof>Hello"
-               errors: 2
-               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #22"
-               html: "<!DOCTYPE potato PUBLIC goof>Hello"
-               errors: 2
-               expected: "| <!DOCTYPE potato>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #23"
-               html: "<!DOCTYPE potato PUBLIC \"go'of\">Hello"
-               errors: 1
-               expected: "| <!DOCTYPE potato \"go'of\" \"\">\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #24"
-               html: "<!DOCTYPE potato PUBLIC 'go'of'>Hello"
-               errors: 2
-               expected: "| <!DOCTYPE potato \"go\" \"\">\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #25"
-               html: "<!DOCTYPE potato PUBLIC 'go:hh   of' >Hello"
-               errors: 1
-               expected: "| <!DOCTYPE potato \"go:hh   of\" \"\">\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #26"
-               html: "<!DOCTYPE potato PUBLIC \"W3C-//dfdf\" SYSTEM ggg>Hello"
-               errors: 2
-               expected: "| <!DOCTYPE potato \"W3C-//dfdf\" \"\">\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #27"
-               html: "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\n   \"http://www.w3.org/TR/html4/strict.dtd\">Hello"
-               expected: "| <!DOCTYPE html \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #28"
-               html: "<!DOCTYPE ...>Hello"
-               errors: 1
-               expected: "| <!DOCTYPE ...>\n| <html>\n|   <head>\n|   <body>\n|     \"Hello\"\n"
-       }, {
-               name: "doctype01.dat #29"
-               html: "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"
-               errors: 1
-               expected: "| <!DOCTYPE html \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "doctype01.dat #30"
-               html: "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\"\n\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">"
-               errors: 1
-               expected: "| <!DOCTYPE html \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "doctype01.dat #31"
-               html: "<!DOCTYPE root-element [SYSTEM OR PUBLIC FPI] \"uri\" [ \n<!-- internal declarations -->\n]>"
-               errors: 2
-               expected: "| <!DOCTYPE root-element>\n| <html>\n|   <head>\n|   <body>\n|     \"]>\"\n"
-       }, {
-               name: "doctype01.dat #32"
-               html: "<!DOCTYPE html PUBLIC\n  \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\"\n    \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">"
-               errors: 1
-               expected: "| <!DOCTYPE html \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "doctype01.dat #33"
-               html: "<!DOCTYPE HTML SYSTEM \"http://www.w3.org/DTD/HTML4-strict.dtd\"><body><b>Mine!</b></body>"
-               errors: 1
-               expected: "| <!DOCTYPE html \"\" \"http://www.w3.org/DTD/HTML4-strict.dtd\">\n| <html>\n|   <head>\n|   <body>\n|     <b>\n|       \"Mine!\"\n"
-       }, {
-               name: "doctype01.dat #34"
-               html: "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\"http://www.w3.org/TR/html4/strict.dtd\">"
-               errors: 1
-               expected: "| <!DOCTYPE html \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "doctype01.dat #35"
-               html: "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"'http://www.w3.org/TR/html4/strict.dtd'>"
-               errors: 1
-               expected: "| <!DOCTYPE html \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "doctype01.dat #36"
-               html: "<!DOCTYPE HTML PUBLIC\"-//W3C//DTD HTML 4.01//EN\"'http://www.w3.org/TR/html4/strict.dtd'>"
-               errors: 2
-               expected: "| <!DOCTYPE html \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "doctype01.dat #37"
-               html: "<!DOCTYPE HTML PUBLIC'-//W3C//DTD HTML 4.01//EN''http://www.w3.org/TR/html4/strict.dtd'>"
-               errors: 2
-               expected: "| <!DOCTYPE html \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #1"
-               html: "<svg><![CDATA[foo\nbar]]>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"foo\nbar\"\n"
-       }, {
-               name: "domjs-unsafe.dat #2"
-               html: "<svg><![CDATA[foo\rbar]]>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"foo\nbar\"\n"
-       }, {
-               name: "domjs-unsafe.dat #3"
-               html: "<svg><![CDATA[foo\r\nbar]]>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"foo\nbar\"\n"
-       }, {
-               name: "domjs-unsafe.dat #4"
-               html: "<script>a='\u0000'</script>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"a='�'\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #5"
-               html: "<script type=\"data\"><!--\u0000</script>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--�\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #6"
-               html: "<script type=\"data\"><!--foo\u0000</script>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--foo�\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #7"
-               html: "<script type=\"data\"><!-- foo-\u0000</script>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!-- foo-�\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #8"
-               html: "<script type=\"data\"><!-- foo--\u0000</script>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!-- foo--�\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #9"
-               html: "<script type=\"data\"><!-- foo-"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!-- foo-\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #10"
-               html: "<script type=\"data\"><!-- foo-<</script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!-- foo-<\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #11"
-               html: "<script type=\"data\"><!-- foo-<S"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!-- foo-<S\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #12"
-               html: "<script type=\"data\"><!-- foo-</SCRIPT>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!-- foo-\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #13"
-               html: "<script type=\"data\"><!--<p></script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--<p>\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #14"
-               html: "<script type=\"data\"><!--<script></script></script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--<script></script>\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #15"
-               html: "<script type=\"data\"><!--<script>\u0000</script></script>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--<script>�</script>\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #16"
-               html: "<script type=\"data\"><!--<script>-\u0000</script></script>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--<script>-�</script>\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #17"
-               html: "<script type=\"data\"><!--<script>--\u0000</script></script>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--<script>--�</script>\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #18"
-               html: "<script type=\"data\"><!--<script>---</script></script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--<script>---</script>\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #19"
-               html: "<script type=\"data\"><!--<script></scrip></SCRIPT></script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--<script></scrip></SCRIPT>\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #20"
-               html: "<script type=\"data\"><!--<script></scrip </SCRIPT></script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--<script></scrip </SCRIPT>\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #21"
-               html: "<script type=\"data\"><!--<script></scrip/</SCRIPT></script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--<script></scrip/</SCRIPT>\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #22"
-               html: "<script type=\"data\"></scrip/></script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"</scrip/>\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #23"
-               html: "<script type=\"data\"></scrip ></script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"</scrip >\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #24"
-               html: "<script type=\"data\"><!--</scrip></script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--</scrip>\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #25"
-               html: "<script type=\"data\"><!--</scrip </script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--</scrip \"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #26"
-               html: "<script type=\"data\"><!--</scrip/</script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       type=\"data\"\n|       \"<!--</scrip/\"\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #27"
-               html: "<!DOCTYPE html><!DOCTYPE html>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #28"
-               html: "<html><!DOCTYPE html>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #29"
-               html: "<html><head><!DOCTYPE html></head>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #30"
-               html: "<html><head></head><!DOCTYPE html>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #31"
-               html: "<body></body><!DOCTYPE html>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #32"
-               html: "<table><!DOCTYPE html></table>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n"
-       }, {
-               name: "domjs-unsafe.dat #33"
-               html: "<select><!DOCTYPE html></select>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n"
-       }, {
-               name: "domjs-unsafe.dat #34"
-               html: "<table><colgroup><!DOCTYPE html></colgroup></table>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <colgroup>\n"
-       }, {
-               name: "domjs-unsafe.dat #35"
-               html: "<table><colgroup><!--test--></colgroup></table>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <colgroup>\n|         <!-- test -->\n"
-       }, {
-               name: "domjs-unsafe.dat #36"
-               html: "<table><colgroup><html></colgroup></table>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <colgroup>\n"
-       }, {
-               name: "domjs-unsafe.dat #37"
-               html: "<table><colgroup> foo</colgroup></table>"
-               errors: 5
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"foo\"\n|     <table>\n|       <colgroup>\n|         \" \"\n"
-       }, {
-               name: "domjs-unsafe.dat #38"
-               html: "<select><!--test--></select>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <!-- test -->\n"
-       }, {
-               name: "domjs-unsafe.dat #39"
-               html: "<select><html></select>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n"
-       }, {
-               name: "domjs-unsafe.dat #40"
-               html: "<frameset><html></frameset>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "domjs-unsafe.dat #41"
-               html: "<frameset></frameset><html>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "domjs-unsafe.dat #42"
-               html: "<frameset></frameset><!DOCTYPE html>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "domjs-unsafe.dat #43"
-               html: "<html><body></body></html><!DOCTYPE html>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "domjs-unsafe.dat #44"
-               html: "<svg><!DOCTYPE html></svg>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n"
-       }, {
-               name: "domjs-unsafe.dat #45"
-               html: "<svg><font></font></svg>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg font>\n"
-       }, {
-               name: "domjs-unsafe.dat #46"
-               html: "<svg><font id=foo></font></svg>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg font>\n|         id=\"foo\"\n"
-       }, {
-               name: "domjs-unsafe.dat #47"
-               html: "<svg><font size=4></font></svg>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|     <font>\n|       size=\"4\"\n"
-       }, {
-               name: "domjs-unsafe.dat #48"
-               html: "<svg><font color=red></font></svg>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|     <font>\n|       color=\"red\"\n"
-       }, {
-               name: "domjs-unsafe.dat #49"
-               html: "<svg><font font=sans></font></svg>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg font>\n|         font=\"sans\"\n"
-       }, {
-               name: "entities01.dat #1"
-               html: "FOO&gt;BAR"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO>BAR\"\n"
-       }, {
-               name: "entities01.dat #2"
-               html: "FOO&gtBAR"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO>BAR\"\n"
-       }, {
-               name: "entities01.dat #3"
-               html: "FOO&gt BAR"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO> BAR\"\n"
-       }, {
-               name: "entities01.dat #4"
-               html: "FOO&gt;;;BAR"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO>;;BAR\"\n"
-       }, {
-               name: "entities01.dat #5"
-               html: "I'm &notit; I tell you"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"I'm ¬it; I tell you\"\n"
-       }, {
-               name: "entities01.dat #6"
-               html: "I'm &notin; I tell you"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"I'm ∉ I tell you\"\n"
-       }, {
-               name: "entities01.dat #7"
-               html: "FOO& BAR"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO& BAR\"\n"
-       }, {
-               name: "entities01.dat #8"
-               html: "FOO&<BAR>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO&\"\n|     <bar>\n"
-       }, {
-               name: "entities01.dat #9"
-               html: "FOO&&&&gt;BAR"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO&&&>BAR\"\n"
-       }, {
-               name: "entities01.dat #10"
-               html: "FOO&#41;BAR"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO)BAR\"\n"
-       }, {
-               name: "entities01.dat #11"
-               html: "FOO&#x41;BAR"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOABAR\"\n"
-       }, {
-               name: "entities01.dat #12"
-               html: "FOO&#X41;BAR"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOABAR\"\n"
-       }, {
-               name: "entities01.dat #13"
-               html: "FOO&#BAR"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO&#BAR\"\n"
-       }, {
-               name: "entities01.dat #14"
-               html: "FOO&#ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO&#ZOO\"\n"
-       }, {
-               name: "entities01.dat #15"
-               html: "FOO&#xBAR"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOºR\"\n"
-       }, {
-               name: "entities01.dat #16"
-               html: "FOO&#xZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO&#xZOO\"\n"
-       }, {
-               name: "entities01.dat #17"
-               html: "FOO&#XZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO&#XZOO\"\n"
-       }, {
-               name: "entities01.dat #18"
-               html: "FOO&#41BAR"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO)BAR\"\n"
-       }, {
-               name: "entities01.dat #19"
-               html: "FOO&#x41BAR"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO䆺R\"\n"
-       }, {
-               name: "entities01.dat #20"
-               html: "FOO&#x41ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOAZOO\"\n"
-       }, {
-               name: "entities01.dat #21"
-               html: "FOO&#x0000;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�ZOO\"\n"
-       }, {
-               name: "entities01.dat #22"
-               html: "FOO&#x0078;ZOO"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOxZOO\"\n"
-       }, {
-               name: "entities01.dat #23"
-               html: "FOO&#x0079;ZOO"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOyZOO\"\n"
-       }, {
-               name: "entities01.dat #24"
-               html: "FOO&#x0080;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO€ZOO\"\n"
-       }, {
-               name: "entities01.dat #25"
-               html: "FOO&#x0081;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\81ZOO\"\n"
-       }, {
-               name: "entities01.dat #26"
-               html: "FOO&#x0082;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO‚ZOO\"\n"
-       }, {
-               name: "entities01.dat #27"
-               html: "FOO&#x0083;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOƒZOO\"\n"
-       }, {
-               name: "entities01.dat #28"
-               html: "FOO&#x0084;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO„ZOO\"\n"
-       }, {
-               name: "entities01.dat #29"
-               html: "FOO&#x0085;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO…ZOO\"\n"
-       }, {
-               name: "entities01.dat #30"
-               html: "FOO&#x0086;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO†ZOO\"\n"
-       }, {
-               name: "entities01.dat #31"
-               html: "FOO&#x0087;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO‡ZOO\"\n"
-       }, {
-               name: "entities01.dat #32"
-               html: "FOO&#x0088;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOˆZOO\"\n"
-       }, {
-               name: "entities01.dat #33"
-               html: "FOO&#x0089;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO‰ZOO\"\n"
-       }, {
-               name: "entities01.dat #34"
-               html: "FOO&#x008A;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOŠZOO\"\n"
-       }, {
-               name: "entities01.dat #35"
-               html: "FOO&#x008B;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO‹ZOO\"\n"
-       }, {
-               name: "entities01.dat #36"
-               html: "FOO&#x008C;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOŒZOO\"\n"
-       }, {
-               name: "entities01.dat #37"
-               html: "FOO&#x008D;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\8dZOO\"\n"
-       }, {
-               name: "entities01.dat #38"
-               html: "FOO&#x008E;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOŽZOO\"\n"
-       }, {
-               name: "entities01.dat #39"
-               html: "FOO&#x008F;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\8fZOO\"\n"
-       }, {
-               name: "entities01.dat #40"
-               html: "FOO&#x0090;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\90ZOO\"\n"
-       }, {
-               name: "entities01.dat #41"
-               html: "FOO&#x0091;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO‘ZOO\"\n"
-       }, {
-               name: "entities01.dat #42"
-               html: "FOO&#x0092;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO’ZOO\"\n"
-       }, {
-               name: "entities01.dat #43"
-               html: "FOO&#x0093;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO“ZOO\"\n"
-       }, {
-               name: "entities01.dat #44"
-               html: "FOO&#x0094;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO”ZOO\"\n"
-       }, {
-               name: "entities01.dat #45"
-               html: "FOO&#x0095;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO•ZOO\"\n"
-       }, {
-               name: "entities01.dat #46"
-               html: "FOO&#x0096;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO–ZOO\"\n"
-       }, {
-               name: "entities01.dat #47"
-               html: "FOO&#x0097;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO—ZOO\"\n"
-       }, {
-               name: "entities01.dat #48"
-               html: "FOO&#x0098;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO˜ZOO\"\n"
-       }, {
-               name: "entities01.dat #49"
-               html: "FOO&#x0099;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO™ZOO\"\n"
-       }, {
-               name: "entities01.dat #50"
-               html: "FOO&#x009A;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOšZOO\"\n"
-       }, {
-               name: "entities01.dat #51"
-               html: "FOO&#x009B;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO›ZOO\"\n"
-       }, {
-               name: "entities01.dat #52"
-               html: "FOO&#x009C;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOœZOO\"\n"
-       }, {
-               name: "entities01.dat #53"
-               html: "FOO&#x009D;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\9dZOO\"\n"
-       }, {
-               name: "entities01.dat #54"
-               html: "FOO&#x009E;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOžZOO\"\n"
-       }, {
-               name: "entities01.dat #55"
-               html: "FOO&#x009F;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOŸZOO\"\n"
-       }, {
-               name: "entities01.dat #56"
-               html: "FOO&#x00A0;ZOO"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO ZOO\"\n"
-       }, {
-               name: "entities01.dat #57"
-               html: "FOO&#xD7FF;ZOO"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO퟿ZOO\"\n"
-       }, {
-               name: "entities01.dat #58"
-               html: "FOO&#xD800;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�ZOO\"\n"
-       }, {
-               name: "entities01.dat #59"
-               html: "FOO&#xD801;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�ZOO\"\n"
-       }, {
-               name: "entities01.dat #60"
-               html: "FOO&#xDFFE;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�ZOO\"\n"
-       }, {
-               name: "entities01.dat #61"
-               html: "FOO&#xDFFF;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�ZOO\"\n"
-       }, {
-               name: "entities01.dat #62"
-               html: "FOO&#xE000;ZOO"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOOZOO\"\n"
-       }, {
-               name: "entities01.dat #63"
-               html: "FOO&#x10FFFE;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO􏿾ZOO\"\n"
-       }, {
-               name: "entities01.dat #64"
-               html: "FOO&#x1087D4;ZOO"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO􈟔ZOO\"\n"
-       }, {
-               name: "entities01.dat #65"
-               html: "FOO&#x10FFFF;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO􏿿ZOO\"\n"
-       }, {
-               name: "entities01.dat #66"
-               html: "FOO&#x110000;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�ZOO\"\n"
-       }, {
-               name: "entities01.dat #67"
-               html: "FOO&#xFFFFFF;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�ZOO\"\n"
-       }, {
-               name: "entities01.dat #68"
-               html: "FOO&#11111111111"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�\"\n"
-       }, {
-               name: "entities01.dat #69"
-               html: "FOO&#1111111111"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�\"\n"
-       }, {
-               name: "entities01.dat #70"
-               html: "FOO&#111111111111"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�\"\n"
-       }, {
-               name: "entities01.dat #71"
-               html: "FOO&#11111111111ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�ZOO\"\n"
-       }, {
-               name: "entities01.dat #72"
-               html: "FOO&#1111111111ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�ZOO\"\n"
-       }, {
-               name: "entities01.dat #73"
-               html: "FOO&#111111111111ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO�ZOO\"\n"
-       }, {
-               name: "entities02.dat #1"
-               html: "<div bar=\"ZZ&gt;YY\"></div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ>YY\"\n"
-       }, {
-               name: "entities02.dat #2"
-               html: "<div bar=\"ZZ&\"></div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&\"\n"
-       }, {
-               name: "entities02.dat #3"
-               html: "<div bar='ZZ&'></div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&\"\n"
-       }, {
-               name: "entities02.dat #4"
-               html: "<div bar=ZZ&></div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&\"\n"
-       }, {
-               name: "entities02.dat #5"
-               html: "<div bar=\"ZZ&gt=YY\"></div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&gt=YY\"\n"
-       }, {
-               name: "entities02.dat #6"
-               html: "<div bar=\"ZZ&gt0YY\"></div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&gt0YY\"\n"
-       }, {
-               name: "entities02.dat #7"
-               html: "<div bar=\"ZZ&gt9YY\"></div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&gt9YY\"\n"
-       }, {
-               name: "entities02.dat #8"
-               html: "<div bar=\"ZZ&gtaYY\"></div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&gtaYY\"\n"
-       }, {
-               name: "entities02.dat #9"
-               html: "<div bar=\"ZZ&gtZYY\"></div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&gtZYY\"\n"
-       }, {
-               name: "entities02.dat #10"
-               html: "<div bar=\"ZZ&gt YY\"></div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ> YY\"\n"
-       }, {
-               name: "entities02.dat #11"
-               html: "<div bar=\"ZZ&gt\"></div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ>\"\n"
-       }, {
-               name: "entities02.dat #12"
-               html: "<div bar='ZZ&gt'></div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ>\"\n"
-       }, {
-               name: "entities02.dat #13"
-               html: "<div bar=ZZ&gt></div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ>\"\n"
-       }, {
-               name: "entities02.dat #14"
-               html: "<div bar=\"ZZ&pound_id=23\"></div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ£_id=23\"\n"
-       }, {
-               name: "entities02.dat #15"
-               html: "<div bar=\"ZZ&prod_id=23\"></div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&prod_id=23\"\n"
-       }, {
-               name: "entities02.dat #16"
-               html: "<div bar=\"ZZ&pound;_id=23\"></div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ£_id=23\"\n"
-       }, {
-               name: "entities02.dat #17"
-               html: "<div bar=\"ZZ&prod;_id=23\"></div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ∏_id=23\"\n"
-       }, {
-               name: "entities02.dat #18"
-               html: "<div bar=\"ZZ&pound=23\"></div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&pound=23\"\n"
-       }, {
-               name: "entities02.dat #19"
-               html: "<div bar=\"ZZ&prod=23\"></div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       bar=\"ZZ&prod=23\"\n"
-       }, {
-               name: "entities02.dat #20"
-               html: "<div>ZZ&pound_id=23</div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"ZZ£_id=23\"\n"
-       }, {
-               name: "entities02.dat #21"
-               html: "<div>ZZ&prod_id=23</div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"ZZ&prod_id=23\"\n"
-       }, {
-               name: "entities02.dat #22"
-               html: "<div>ZZ&pound;_id=23</div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"ZZ£_id=23\"\n"
-       }, {
-               name: "entities02.dat #23"
-               html: "<div>ZZ&prod;_id=23</div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"ZZ∏_id=23\"\n"
-       }, {
-               name: "entities02.dat #24"
-               html: "<div>ZZ&pound=23</div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"ZZ£=23\"\n"
-       }, {
-               name: "entities02.dat #25"
-               html: "<div>ZZ&prod=23</div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"ZZ&prod=23\"\n"
-       }, {
-               name: "entities02.dat #26"
-               html: "<div>ZZ&AElig=</div>"
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"ZZÆ=\"\n"
-       }, {
-               name: "foreign-fragment.dat #1"
-               html: "<nobr>X"
-               errors: 3
-               fragment: "svg path"
-               expected: "| <svg nobr>\n|   \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #2"
-               html: "<font color></font>X"
-               errors: 1
-               fragment: "svg path"
-               expected: "| <svg font>\n|   color=\"\"\n| \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #3"
-               html: "<font></font>X"
-               fragment: "svg path"
-               expected: "| <svg font>\n| \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #4"
-               html: "<g></path>X"
-               errors: 3
-               fragment: "svg path"
-               expected: "| <svg g>\n|   \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #5"
-               html: "</path>X"
-               errors: 1
-               fragment: "svg path"
-               expected: "| \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #6"
-               html: "</foreignObject>X"
-               errors: 1
-               fragment: "svg foreignObject"
-               expected: "| \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #7"
-               html: "</desc>X"
-               errors: 1
-               fragment: "svg desc"
-               expected: "| \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #8"
-               html: "</title>X"
-               errors: 1
-               fragment: "svg title"
-               expected: "| \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #9"
-               html: "</svg>X"
-               errors: 1
-               fragment: "svg svg"
-               expected: "| \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #10"
-               html: "</mfenced>X"
-               errors: 1
-               fragment: "math mfenced"
-               expected: "| \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #11"
-               html: "</malignmark>X"
-               errors: 1
-               fragment: "math malignmark"
-               expected: "| \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #12"
-               html: "</math>X"
-               errors: 1
-               fragment: "math math"
-               expected: "| \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #13"
-               html: "</annotation-xml>X"
-               errors: 1
-               fragment: "math annotation-xml"
-               expected: "| \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #14"
-               html: "</mtext>X"
-               errors: 1
-               fragment: "math mtext"
-               expected: "| \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #15"
-               html: "</mi>X"
-               errors: 1
-               fragment: "math mi"
-               expected: "| \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #16"
-               html: "</mo>X"
-               errors: 1
-               fragment: "math mo"
-               expected: "| \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #17"
-               html: "</mn>X"
-               errors: 1
-               fragment: "math mn"
-               expected: "| \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #18"
-               html: "</ms>X"
-               errors: 1
-               fragment: "math ms"
-               expected: "| \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #19"
-               html: "<b></b><mglyph/><i></i><malignmark/><u></u><ms/>X"
-               errors: 3
-               fragment: "math ms"
-               expected: "| <b>\n| <math mglyph>\n| <i>\n| <math malignmark>\n| <u>\n| <ms>\n|   \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #20"
-               html: "<malignmark></malignmark>"
-               fragment: "math ms"
-               expected: "| <math malignmark>\n"
-       }, {
-               name: "foreign-fragment.dat #21"
-               html: "<div></div>"
-               fragment: "math ms"
-               expected: "| <div>\n"
-       }, {
-               name: "foreign-fragment.dat #22"
-               html: "<figure></figure>"
-               fragment: "math ms"
-               expected: "| <figure>\n"
-       }, {
-               name: "foreign-fragment.dat #23"
-               html: "<b></b><mglyph/><i></i><malignmark/><u></u><mn/>X"
-               errors: 3
-               fragment: "math mn"
-               expected: "| <b>\n| <math mglyph>\n| <i>\n| <math malignmark>\n| <u>\n| <mn>\n|   \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #24"
-               html: "<malignmark></malignmark>"
-               fragment: "math mn"
-               expected: "| <math malignmark>\n"
-       }, {
-               name: "foreign-fragment.dat #25"
-               html: "<div></div>"
-               fragment: "math mn"
-               expected: "| <div>\n"
-       }, {
-               name: "foreign-fragment.dat #26"
-               html: "<figure></figure>"
-               fragment: "math mn"
-               expected: "| <figure>\n"
-       }, {
-               name: "foreign-fragment.dat #27"
-               html: "<b></b><mglyph/><i></i><malignmark/><u></u><mo/>X"
-               errors: 3
-               fragment: "math mo"
-               expected: "| <b>\n| <math mglyph>\n| <i>\n| <math malignmark>\n| <u>\n| <mo>\n|   \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #28"
-               html: "<malignmark></malignmark>"
-               fragment: "math mo"
-               expected: "| <math malignmark>\n"
-       }, {
-               name: "foreign-fragment.dat #29"
-               html: "<div></div>"
-               fragment: "math mo"
-               expected: "| <div>\n"
-       }, {
-               name: "foreign-fragment.dat #30"
-               html: "<figure></figure>"
-               fragment: "math mo"
-               expected: "| <figure>\n"
-       }, {
-               name: "foreign-fragment.dat #31"
-               html: "<b></b><mglyph/><i></i><malignmark/><u></u><mi/>X"
-               errors: 3
-               fragment: "math mi"
-               expected: "| <b>\n| <math mglyph>\n| <i>\n| <math malignmark>\n| <u>\n| <mi>\n|   \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #32"
-               html: "<malignmark></malignmark>"
-               fragment: "math mi"
-               expected: "| <math malignmark>\n"
-       }, {
-               name: "foreign-fragment.dat #33"
-               html: "<div></div>"
-               fragment: "math mi"
-               expected: "| <div>\n"
-       }, {
-               name: "foreign-fragment.dat #34"
-               html: "<figure></figure>"
-               fragment: "math mi"
-               expected: "| <figure>\n"
-       }, {
-               name: "foreign-fragment.dat #35"
-               html: "<b></b><mglyph/><i></i><malignmark/><u></u><mtext/>X"
-               errors: 3
-               fragment: "math mtext"
-               expected: "| <b>\n| <math mglyph>\n| <i>\n| <math malignmark>\n| <u>\n| <mtext>\n|   \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #36"
-               html: "<malignmark></malignmark>"
-               fragment: "math mtext"
-               expected: "| <math malignmark>\n"
-       }, {
-               name: "foreign-fragment.dat #37"
-               html: "<div></div>"
-               fragment: "math mtext"
-               expected: "| <div>\n"
-       }, {
-               name: "foreign-fragment.dat #38"
-               html: "<figure></figure>"
-               fragment: "math mtext"
-               expected: "| <figure>\n"
-       }, {
-               name: "foreign-fragment.dat #39"
-               html: "<div></div>"
-               errors: 1
-               fragment: "math annotation-xml"
-               expected: "| <math div>\n"
-       }, {
-               name: "foreign-fragment.dat #40"
-               html: "<figure></figure>"
-               fragment: "math annotation-xml"
-               expected: "| <math figure>\n"
-       }, {
-               name: "foreign-fragment.dat #41"
-               html: "<div></div>"
-               errors: 1
-               fragment: "math math"
-               expected: "| <math div>\n"
-       }, {
-               name: "foreign-fragment.dat #42"
-               html: "<figure></figure>"
-               fragment: "math math"
-               expected: "| <math figure>\n"
-       }, {
-               name: "foreign-fragment.dat #43"
-               html: "<div></div>"
-               fragment: "svg foreignObject"
-               expected: "| <div>\n"
-       }, {
-               name: "foreign-fragment.dat #44"
-               html: "<figure></figure>"
-               fragment: "svg foreignObject"
-               expected: "| <figure>\n"
-       }, {
-               name: "foreign-fragment.dat #45"
-               html: "<div></div>"
-               fragment: "svg title"
-               expected: "| <div>\n"
-       }, {
-               name: "foreign-fragment.dat #46"
-               html: "<figure></figure>"
-               fragment: "svg title"
-               expected: "| <figure>\n"
-       }, {
-               name: "foreign-fragment.dat #47"
-               html: "<figure></figure>"
-               fragment: "svg desc"
-               expected: "| <figure>\n"
-       }, {
-               name: "foreign-fragment.dat #48"
-               html: "<div><h1>X</h1></div>"
-               errors: 2
-               fragment: "svg svg"
-               expected: "| <svg div>\n|   <svg h1>\n|     \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #49"
-               html: "<div></div>"
-               errors: 1
-               fragment: "svg svg"
-               expected: "| <svg div>\n"
-       }, {
-               name: "foreign-fragment.dat #50"
-               html: "<div></div>"
-               fragment: "svg desc"
-               expected: "| <div>\n"
-       }, {
-               name: "foreign-fragment.dat #51"
-               html: "<figure></figure>"
-               fragment: "svg desc"
-               expected: "| <figure>\n"
-       }, {
-               name: "foreign-fragment.dat #52"
-               html: "<plaintext><foo>"
-               errors: 2
-               fragment: "svg desc"
-               expected: "| <plaintext>\n|   \"<foo>\"\n"
-       }, {
-               name: "foreign-fragment.dat #53"
-               html: "<frameset>X"
-               errors: 1
-               fragment: "svg desc"
-               expected: "| \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #54"
-               html: "<head>X"
-               errors: 1
-               fragment: "svg desc"
-               expected: "| \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #55"
-               html: "<body>X"
-               errors: 1
-               fragment: "svg desc"
-               expected: "| \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #56"
-               html: "<html>X"
-               errors: 1
-               fragment: "svg desc"
-               expected: "| \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #57"
-               html: "<html class=\"foo\">X"
-               errors: 1
-               fragment: "svg desc"
-               expected: "| \"X\"\n"
-       }, {
-               name: "foreign-fragment.dat #58"
-               html: "<body class=\"foo\">X"
-               errors: 1
-               fragment: "svg desc"
-               expected: "| \"X\"\n"
-       }, {
-               name: "html5test-com.dat #1"
-               html: "<div<div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div<div>\n"
-       }, {
-               name: "html5test-com.dat #2"
-               html: "<div foo<bar=''>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       foo<bar=\"\"\n"
-       }, {
-               name: "html5test-com.dat #3"
-               html: "<div foo=`bar`>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       foo=\"`bar`\"\n"
-       }, {
-               name: "html5test-com.dat #4"
-               html: "<div \\\"foo=''>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \\\"foo=\"\"\n"
-       }, {
-               name: "html5test-com.dat #5"
-               html: "<a href='\\nbar'></a>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       href=\"\\nbar\"\n"
-       }, {
-               name: "html5test-com.dat #6"
-               html: "<!DOCTYPE html>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "html5test-com.dat #7"
-               html: "&lang;&rang;"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"⟨⟩\"\n"
-       }, {
-               name: "html5test-com.dat #8"
-               html: "&apos;"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"'\"\n"
-       }, {
-               name: "html5test-com.dat #9"
-               html: "&ImaginaryI;"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"ⅈ\"\n"
-       }, {
-               name: "html5test-com.dat #10"
-               html: "&Kopf;"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"𝕂\"\n"
-       }, {
-               name: "html5test-com.dat #11"
-               html: "&notinva;"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"∉\"\n"
-       }, {
-               name: "html5test-com.dat #12"
-               html: "<?import namespace=\"foo\" implementation=\"#bar\">"
-               errors: 2
-               expected: "| <!-- ?import namespace=\"foo\" implementation=\"#bar\" -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "html5test-com.dat #13"
-               html: "<!--foo--bar-->"
-               errors: 2
-               expected: "| <!-- foo--bar -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "html5test-com.dat #14"
-               html: "<![CDATA[x]]>"
-               errors: 2
-               expected: "| <!-- [CDATA[x]] -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "html5test-com.dat #15"
-               html: "<textarea><!--</textarea>--></textarea>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"<!--\"\n|     \"-->\"\n"
-       }, {
-               name: "html5test-com.dat #16"
-               html: "<textarea><!--</textarea>-->"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"<!--\"\n|     \"-->\"\n"
-       }, {
-               name: "html5test-com.dat #17"
-               html: "<style><!--</style>--></style>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <style>\n|       \"<!--\"\n|   <body>\n|     \"-->\"\n"
-       }, {
-               name: "html5test-com.dat #18"
-               html: "<style><!--</style>-->"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <style>\n|       \"<!--\"\n|   <body>\n|     \"-->\"\n"
-       }, {
-               name: "html5test-com.dat #19"
-               html: "<ul><li>A </li> <li>B</li></ul>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ul>\n|       <li>\n|         \"A \"\n|       \" \"\n|       <li>\n|         \"B\"\n"
-       }, {
-               name: "html5test-com.dat #20"
-               html: "<table><form><input type=hidden><input></form><div></div></table>"
-               errors: 8
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <input>\n|     <div>\n|     <table>\n|       <form>\n|       <input>\n|         type=\"hidden\"\n"
-       }, {
-               name: "html5test-com.dat #21"
-               html: "<i>A<b>B<p></i>C</b>D"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <i>\n|       \"A\"\n|       <b>\n|         \"B\"\n|     <b>\n|     <p>\n|       <b>\n|         <i>\n|         \"C\"\n|       \"D\"\n"
-       }, {
-               name: "html5test-com.dat #22"
-               html: "<div></div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n"
-       }, {
-               name: "html5test-com.dat #23"
-               html: "<svg></svg>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n"
-       }, {
-               name: "html5test-com.dat #24"
-               html: "<math></math>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n"
-       }, {
-               name: "inbody01.dat #1"
-               html: "<button>1</foo>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <button>\n|       \"1\"\n"
-       }, {
-               name: "inbody01.dat #2"
-               html: "<foo>1<p>2</foo>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <foo>\n|       \"1\"\n|       <p>\n|         \"2\"\n"
-       }, {
-               name: "inbody01.dat #3"
-               html: "<dd>1</foo>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <dd>\n|       \"1\"\n"
-       }, {
-               name: "inbody01.dat #4"
-               html: "<foo>1<dd>2</foo>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <foo>\n|       \"1\"\n|       <dd>\n|         \"2\"\n"
-       }, {
-               name: "isindex.dat #1"
-               html: "<isindex>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <form>\n|       <hr>\n|       <label>\n|         \"This is a searchable index. Enter search keywords: \"\n|         <input>\n|           name=\"isindex\"\n|       <hr>\n"
-       }, {
-               name: "isindex.dat #2"
-               html: "<isindex name=\"A\" action=\"B\" prompt=\"C\" foo=\"D\">"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <form>\n|       action=\"B\"\n|       <hr>\n|       <label>\n|         \"C\"\n|         <input>\n|           foo=\"D\"\n|           name=\"isindex\"\n|       <hr>\n"
-       }, {
-               name: "isindex.dat #3"
-               html: "<form><isindex>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <form>\n"
-       }, {
-               name: "main-element.dat #1"
-               html: "<!doctype html><p>foo<main>bar<p>baz"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       \"foo\"\n|     <main>\n|       \"bar\"\n|       <p>\n|         \"baz\"\n"
-       }, {
-               name: "main-element.dat #2"
-               html: "<!doctype html><main><p>foo</main>bar"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <main>\n|       <p>\n|         \"foo\"\n|     \"bar\"\n"
-       }, {
-               name: "main-element.dat #3"
-               html: "<!DOCTYPE html>xxx<svg><x><g><a><main><b>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"xxx\"\n|     <svg svg>\n|       <svg x>\n|         <svg g>\n|           <svg a>\n|     <main>\n|       <b>\n"
-       }, {
-               name: "math.dat #1"
-               html: "<math><tr><td><mo><tr>"
-               fragment: "td"
-               expected: "| <math math>\n|   <math tr>\n|     <math td>\n|       <math mo>\n"
-       }, {
-               name: "math.dat #2"
-               html: "<math><tr><td><mo><tr>"
-               fragment: "tr"
-               expected: "| <math math>\n|   <math tr>\n|     <math td>\n|       <math mo>\n"
-       }, {
-               name: "math.dat #3"
-               html: "<math><thead><mo><tbody>"
-               fragment: "thead"
-               expected: "| <math math>\n|   <math thead>\n|     <math mo>\n"
-       }, {
-               name: "math.dat #4"
-               html: "<math><tfoot><mo><tbody>"
-               fragment: "tfoot"
-               expected: "| <math math>\n|   <math tfoot>\n|     <math mo>\n"
-       }, {
-               name: "math.dat #5"
-               html: "<math><tbody><mo><tfoot>"
-               fragment: "tbody"
-               expected: "| <math math>\n|   <math tbody>\n|     <math mo>\n"
-       }, {
-               name: "math.dat #6"
-               html: "<math><tbody><mo></table>"
-               fragment: "tbody"
-               expected: "| <math math>\n|   <math tbody>\n|     <math mo>\n"
-       }, {
-               name: "math.dat #7"
-               html: "<math><thead><mo></table>"
-               fragment: "tbody"
-               expected: "| <math math>\n|   <math thead>\n|     <math mo>\n"
-       }, {
-               name: "math.dat #8"
-               html: "<math><tfoot><mo></table>"
-               fragment: "tbody"
-               expected: "| <math math>\n|   <math tfoot>\n|     <math mo>\n"
-       }, {
-               name: "namespace-sensitivity.dat #1"
-               html: "<body><table><tr><td><svg><td><foreignObject><span></td>Foo"
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"Foo\"\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <svg svg>\n|               <svg td>\n|                 <svg foreignObject>\n|                   <span>\n"
-       }, {
-               name: "pending-spec-changes.dat #1"
-               html: "<input type=\"hidden\"><frameset>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "pending-spec-changes.dat #2"
-               html: "<!DOCTYPE html><table><caption><svg>foo</table>bar"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <svg svg>\n|           \"foo\"\n|     \"bar\"\n"
-       }, {
-               name: "pending-spec-changes.dat #3"
-               html: "<table><tr><td><svg><desc><td></desc><circle>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <svg svg>\n|               <svg desc>\n|           <td>\n|             <circle>\n"
-       }, {
-               name: "pending-spec-changes-plain-text-unsafe.dat #1"
-               html: "<body><table>\u0000filler\u0000text\u0000"
-               errors: 18
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"fillertext\"\n|     <table>\n"
-       }, {
-               name: "plain-text-unsafe.dat #1"
-               html: "FOO&#x000D;ZOO"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\rZOO\"\n"
-       }, {
-               name: "plain-text-unsafe.dat #2"
-               html: "<html>\u0000<frameset></frameset>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "plain-text-unsafe.dat #3"
-               html: "<html> \u0000 <frameset></frameset>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "plain-text-unsafe.dat #4"
-               html: "<html>a\u0000a<frameset></frameset>"
-               errors: 5
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"aa\"\n"
-       }, {
-               name: "plain-text-unsafe.dat #5"
-               html: "<html>\u0000\u0000<frameset></frameset>"
-               errors: 6
-               expected: "| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "plain-text-unsafe.dat #6"
-               html: "<html>\u0000\n <frameset></frameset>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "plain-text-unsafe.dat #7"
-               html: "<html><select>\u0000"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n"
-       }, {
-               name: "plain-text-unsafe.dat #8"
-               html: "\u0000"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "plain-text-unsafe.dat #9"
-               html: "<body>\u0000"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "plain-text-unsafe.dat #10"
-               html: "<plaintext>\u0000filler\u0000text\u0000"
-               errors: 5
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <plaintext>\n|       \"�filler�text�\"\n"
-       }, {
-               name: "plain-text-unsafe.dat #11"
-               html: "<svg><![CDATA[\u0000filler\u0000text\u0000]]>"
-               errors: 5
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"�filler�text�\"\n"
-       }, {
-               name: "plain-text-unsafe.dat #12"
-               html: "<body><!\u0000>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <!-- � -->\n"
-       }, {
-               name: "plain-text-unsafe.dat #13"
-               html: "<body><!\u0000filler\u0000text>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <!-- �filler�text -->\n"
-       }, {
-               name: "plain-text-unsafe.dat #14"
-               html: "<body><svg><foreignObject>\u0000filler\u0000text"
-               errors: 6
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg foreignObject>\n|         \"fillertext\"\n"
-       }, {
-               name: "plain-text-unsafe.dat #15"
-               html: "<svg>\u0000filler\u0000text"
-               errors: 6
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"�filler�text\"\n"
-       }, {
-               name: "plain-text-unsafe.dat #16"
-               html: "<svg>\u0000<frameset>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"�\"\n|       <svg frameset>\n"
-       }, {
-               name: "plain-text-unsafe.dat #17"
-               html: "<svg>\u0000 <frameset>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"� \"\n|       <svg frameset>\n"
-       }, {
-               name: "plain-text-unsafe.dat #18"
-               html: "<svg>\u0000a<frameset>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"�a\"\n|       <svg frameset>\n"
-       }, {
-               name: "plain-text-unsafe.dat #19"
-               html: "<svg>\u0000</svg><frameset>"
-               errors: 5
-               expected: "| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "plain-text-unsafe.dat #20"
-               html: "<svg>\u0000 </svg><frameset>"
-               errors: 5
-               expected: "| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "plain-text-unsafe.dat #21"
-               html: "<svg>\u0000a</svg><frameset>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"�a\"\n"
-       }, {
-               name: "plain-text-unsafe.dat #22"
-               html: "<svg><path></path></svg><frameset>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "plain-text-unsafe.dat #23"
-               html: "<svg><p><frameset>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "plain-text-unsafe.dat #24"
-               html: "<!DOCTYPE html><pre>\r\n\r\nA</pre>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n|       \"\nA\"\n"
-       }, {
-               name: "plain-text-unsafe.dat #25"
-               html: "<!DOCTYPE html><pre>\r\rA</pre>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n|       \"\nA\"\n"
-       }, {
-               name: "plain-text-unsafe.dat #26"
-               html: "<!DOCTYPE html><pre>\rA</pre>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n|       \"A\"\n"
-       }, {
-               name: "plain-text-unsafe.dat #27"
-               html: "<!DOCTYPE html><table><tr><td><math><mtext>\u0000a"
-               errors: 3
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <math math>\n|               <math mtext>\n|                 \"a\"\n"
-       }, {
-               name: "plain-text-unsafe.dat #28"
-               html: "<!DOCTYPE html><table><tr><td><svg><foreignObject>\u0000a"
-               errors: 3
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <svg svg>\n|               <svg foreignObject>\n|                 \"a\"\n"
-       }, {
-               name: "plain-text-unsafe.dat #29"
-               html: "<!DOCTYPE html><math><mi>a\u0000b"
-               errors: 3
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         \"ab\"\n"
-       }, {
-               name: "plain-text-unsafe.dat #30"
-               html: "<!DOCTYPE html><math><mo>a\u0000b"
-               errors: 3
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mo>\n|         \"ab\"\n"
-       }, {
-               name: "plain-text-unsafe.dat #31"
-               html: "<!DOCTYPE html><math><mn>a\u0000b"
-               errors: 3
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mn>\n|         \"ab\"\n"
-       }, {
-               name: "plain-text-unsafe.dat #32"
-               html: "<!DOCTYPE html><math><ms>a\u0000b"
-               errors: 3
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math ms>\n|         \"ab\"\n"
-       }, {
-               name: "plain-text-unsafe.dat #33"
-               html: "<!DOCTYPE html><math><mtext>a\u0000b"
-               errors: 3
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mtext>\n|         \"ab\"\n"
-       }, {
-               name: "ruby.dat #1"
-               html: "<html><ruby>a<rb>b<rb></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rb>\n|         \"b\"\n|       <rb>\n"
-       }, {
-               name: "ruby.dat #2"
-               html: "<html><ruby>a<rb>b<rt></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rb>\n|         \"b\"\n|       <rt>\n"
-       }, {
-               name: "ruby.dat #3"
-               html: "<html><ruby>a<rb>b<rtc></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rb>\n|         \"b\"\n|       <rtc>\n"
-       }, {
-               name: "ruby.dat #4"
-               html: "<html><ruby>a<rb>b<rp></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rb>\n|         \"b\"\n|       <rp>\n"
-       }, {
-               name: "ruby.dat #5"
-               html: "<html><ruby>a<rb>b<span></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rb>\n|         \"b\"\n|         <span>\n"
-       }, {
-               name: "ruby.dat #6"
-               html: "<html><ruby>a<rt>b<rb></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rt>\n|         \"b\"\n|       <rb>\n"
-       }, {
-               name: "ruby.dat #7"
-               html: "<html><ruby>a<rt>b<rt></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rt>\n|         \"b\"\n|       <rt>\n"
-       }, {
-               name: "ruby.dat #8"
-               html: "<html><ruby>a<rt>b<rtc></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rt>\n|         \"b\"\n|       <rtc>\n"
-       }, {
-               name: "ruby.dat #9"
-               html: "<html><ruby>a<rt>b<rp></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rt>\n|         \"b\"\n|       <rp>\n"
-       }, {
-               name: "ruby.dat #10"
-               html: "<html><ruby>a<rt>b<span></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rt>\n|         \"b\"\n|         <span>\n"
-       }, {
-               name: "ruby.dat #11"
-               html: "<html><ruby>a<rtc>b<rb></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rtc>\n|         \"b\"\n|       <rb>\n"
-       }, {
-               name: "ruby.dat #12"
-               html: "<html><ruby>a<rtc>b<rt>c<rt>d</ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rtc>\n|         \"b\"\n|         <rt>\n|           \"c\"\n|         <rt>\n|           \"d\"\n"
-       }, {
-               name: "ruby.dat #13"
-               html: "<html><ruby>a<rtc>b<rtc></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rtc>\n|         \"b\"\n|       <rtc>\n"
-       }, {
-               name: "ruby.dat #14"
-               html: "<html><ruby>a<rtc>b<rp></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rtc>\n|         \"b\"\n|         <rp>\n"
-       }, {
-               name: "ruby.dat #15"
-               html: "<html><ruby>a<rtc>b<span></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rtc>\n|         \"b\"\n|         <span>\n"
-       }, {
-               name: "ruby.dat #16"
-               html: "<html><ruby>a<rp>b<rb></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rp>\n|         \"b\"\n|       <rb>\n"
-       }, {
-               name: "ruby.dat #17"
-               html: "<html><ruby>a<rp>b<rt></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rp>\n|         \"b\"\n|       <rt>\n"
-       }, {
-               name: "ruby.dat #18"
-               html: "<html><ruby>a<rp>b<rtc></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rp>\n|         \"b\"\n|       <rtc>\n"
-       }, {
-               name: "ruby.dat #19"
-               html: "<html><ruby>a<rp>b<rp></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rp>\n|         \"b\"\n|       <rp>\n"
-       }, {
-               name: "ruby.dat #20"
-               html: "<html><ruby>a<rp>b<span></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rp>\n|         \"b\"\n|         <span>\n"
-       }, {
-               name: "ruby.dat #21"
-               html: "<html><ruby><rtc><ruby>a<rb>b<rt></ruby></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       <rtc>\n|         <ruby>\n|           \"a\"\n|           <rb>\n|             \"b\"\n|           <rt>\n"
-       }, {
-               name: "scriptdata01.dat #1"
-               html: "FOO<script>'Hello'</script>BAR"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'Hello'\"\n|     \"BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #2"
-               html: "FOO<script></script>BAR"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|     \"BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #3"
-               html: "FOO<script></script >BAR"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|     \"BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #4"
-               html: "FOO<script></script/>BAR"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|     \"BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #5"
-               html: "FOO<script></script/ >BAR"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|     \"BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #6"
-               html: "FOO<script type=\"text/plain\"></scriptx>BAR"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       type=\"text/plain\"\n|       \"</scriptx>BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #7"
-               html: "FOO<script></script foo=\">\" dd>BAR"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|     \"BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #8"
-               html: "FOO<script>'<'</script>BAR"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'<'\"\n|     \"BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #9"
-               html: "FOO<script>'<!'</script>BAR"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'<!'\"\n|     \"BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #10"
-               html: "FOO<script>'<!-'</script>BAR"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'<!-'\"\n|     \"BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #11"
-               html: "FOO<script>'<!--'</script>BAR"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'<!--'\"\n|     \"BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #12"
-               html: "FOO<script>'<!---'</script>BAR"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'<!---'\"\n|     \"BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #13"
-               html: "FOO<script>'<!-->'</script>BAR"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'<!-->'\"\n|     \"BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #14"
-               html: "FOO<script>'<!-->'</script>BAR"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'<!-->'\"\n|     \"BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #15"
-               html: "FOO<script>'<!-- potato'</script>BAR"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'<!-- potato'\"\n|     \"BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #16"
-               html: "FOO<script>'<!-- <sCrIpt'</script>BAR"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'<!-- <sCrIpt'\"\n|     \"BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #17"
-               html: "FOO<script type=\"text/plain\">'<!-- <sCrIpt>'</script>BAR"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       type=\"text/plain\"\n|       \"'<!-- <sCrIpt>'</script>BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #18"
-               html: "FOO<script type=\"text/plain\">'<!-- <sCrIpt> -'</script>BAR"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       type=\"text/plain\"\n|       \"'<!-- <sCrIpt> -'</script>BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #19"
-               html: "FOO<script type=\"text/plain\">'<!-- <sCrIpt> --'</script>BAR"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       type=\"text/plain\"\n|       \"'<!-- <sCrIpt> --'</script>BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #20"
-               html: "FOO<script>'<!-- <sCrIpt> -->'</script>BAR"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"'<!-- <sCrIpt> -->'\"\n|     \"BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #21"
-               html: "FOO<script type=\"text/plain\">'<!-- <sCrIpt> --!>'</script>BAR"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       type=\"text/plain\"\n|       \"'<!-- <sCrIpt> --!>'</script>BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #22"
-               html: "FOO<script type=\"text/plain\">'<!-- <sCrIpt> -- >'</script>BAR"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       type=\"text/plain\"\n|       \"'<!-- <sCrIpt> -- >'</script>BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #23"
-               html: "FOO<script type=\"text/plain\">'<!-- <sCrIpt '</script>BAR"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       type=\"text/plain\"\n|       \"'<!-- <sCrIpt '</script>BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #24"
-               html: "FOO<script type=\"text/plain\">'<!-- <sCrIpt/'</script>BAR"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       type=\"text/plain\"\n|       \"'<!-- <sCrIpt/'</script>BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #25"
-               html: "FOO<script type=\"text/plain\">'<!-- <sCrIpt\\'</script>BAR"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       type=\"text/plain\"\n|       \"'<!-- <sCrIpt\\'\"\n|     \"BAR\"\n"
-       }, {
-               name: "scriptdata01.dat #26"
-               html: "FOO<script type=\"text/plain\">'<!-- <sCrIpt/'</script>BAR</script>QUX"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       type=\"text/plain\"\n|       \"'<!-- <sCrIpt/'</script>BAR\"\n|     \"QUX\"\n"
-       }, {
-               name: "scriptdata01.dat #27"
-               html: "FOO<script><!--<script>-></script>--></script>QUX"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"FOO\"\n|     <script>\n|       \"<!--<script>-></script>-->\"\n|     \"QUX\"\n"
-       }, {
-               name: "tables01.dat #1"
-               html: "<table><th>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <th>\n"
-       }, {
-               name: "tables01.dat #2"
-               html: "<table><td>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n"
-       }, {
-               name: "tables01.dat #3"
-               html: "<table><col foo='bar'>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <colgroup>\n|         <col>\n|           foo=\"bar\"\n"
-       }, {
-               name: "tables01.dat #4"
-               html: "<table><colgroup></html>foo"
-               errors: 6
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"foo\"\n|     <table>\n|       <colgroup>\n"
-       }, {
-               name: "tables01.dat #5"
-               html: "<table></table><p>foo"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|     <p>\n|       \"foo\"\n"
-       }, {
-               name: "tables01.dat #6"
-               html: "<table></body></caption></col></colgroup></html></tbody></td></tfoot></th></thead></tr><td>"
-               errors: 14
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n"
-       }, {
-               name: "tables01.dat #7"
-               html: "<table><select><option>3</select></table>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n|         \"3\"\n|     <table>\n"
-       }, {
-               name: "tables01.dat #8"
-               html: "<table><select><table></table></select></table>"
-               errors: 6
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|     <table>\n|     <table>\n"
-       }, {
-               name: "tables01.dat #9"
-               html: "<table><select></table>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|     <table>\n"
-       }, {
-               name: "tables01.dat #10"
-               html: "<table><select><option>A<tr><td>B</td></tr></table>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n|         \"A\"\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"B\"\n"
-       }, {
-               name: "tables01.dat #11"
-               html: "<table><td></body></caption></col></colgroup></html>foo"
-               errors: 8
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"foo\"\n"
-       }, {
-               name: "tables01.dat #12"
-               html: "<table><td>A</table>B"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"A\"\n|     \"B\"\n"
-       }, {
-               name: "tables01.dat #13"
-               html: "<table><tr><caption>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|       <caption>\n"
-       }, {
-               name: "tables01.dat #14"
-               html: "<table><tr></body></caption></col></colgroup></html></td></th><td>foo"
-               errors: 9
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"foo\"\n"
-       }, {
-               name: "tables01.dat #15"
-               html: "<table><td><tr>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|         <tr>\n"
-       }, {
-               name: "tables01.dat #16"
-               html: "<table><td><button><td>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <button>\n|           <td>\n"
-       }, {
-               name: "tables01.dat #17"
-               html: "<table><tr><td><svg><desc><td>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <svg svg>\n|               <svg desc>\n|           <td>\n"
-       }, {
-               name: "template.dat #1"
-               html: "<body><template>Hello</template>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         \"Hello\"\n"
-       }, {
-               name: "template.dat #2"
-               html: "<template>Hello</template>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         \"Hello\"\n|   <body>\n"
-       }, {
-               name: "template.dat #3"
-               html: "<template></template><div></div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|   <body>\n|     <div>\n"
-       }, {
-               name: "template.dat #4"
-               html: "<html><template>Hello</template>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         \"Hello\"\n|   <body>\n"
-       }, {
-               name: "template.dat #5"
-               html: "<head><template><div></div></template></head>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <div>\n|   <body>\n"
-       }, {
-               name: "template.dat #6"
-               html: "<div><template><div><span></template><b>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <template>\n|         content\n|           <div>\n|             <span>\n|       <b>\n"
-       }, {
-               name: "template.dat #7"
-               html: "<div><template></div>Hello"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <template>\n|         content\n|           \"Hello\"\n"
-       }, {
-               name: "template.dat #8"
-               html: "<div></template></div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n"
-       }, {
-               name: "template.dat #9"
-               html: "<table><template></template></table>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <template>\n|         content\n"
-       }, {
-               name: "template.dat #10"
-               html: "<table><template></template></div>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <template>\n|         content\n"
-       }, {
-               name: "template.dat #11"
-               html: "<table><div><template></template></div>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <template>\n|         content\n|     <table>\n"
-       }, {
-               name: "template.dat #12"
-               html: "<table><template></template><div></div>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|     <table>\n|       <template>\n|         content\n"
-       }, {
-               name: "template.dat #13"
-               html: "<table>   <template></template></table>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       \"   \"\n|       <template>\n|         content\n"
-       }, {
-               name: "template.dat #14"
-               html: "<table><tbody><template></template></tbody>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <template>\n|           content\n"
-       }, {
-               name: "template.dat #15"
-               html: "<table><tbody><template></tbody></template>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <template>\n|           content\n"
-       }, {
-               name: "template.dat #16"
-               html: "<table><tbody><template></template></tbody></table>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <template>\n|           content\n"
-       }, {
-               name: "template.dat #17"
-               html: "<table><thead><template></template></thead>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <thead>\n|         <template>\n|           content\n"
-       }, {
-               name: "template.dat #18"
-               html: "<table><tfoot><template></template></tfoot>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tfoot>\n|         <template>\n|           content\n"
-       }, {
-               name: "template.dat #19"
-               html: "<select><template></template></select>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <template>\n|         content\n"
-       }, {
-               name: "template.dat #20"
-               html: "<select><template><option></option></template></select>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <template>\n|         content\n|           <option>\n"
-       }, {
-               name: "template.dat #21"
-               html: "<template><option></option></select><option></option></template>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <option>\n|         <option>\n|   <body>\n"
-       }, {
-               name: "template.dat #22"
-               html: "<select><template></template><option></select>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <template>\n|         content\n|       <option>\n"
-       }, {
-               name: "template.dat #23"
-               html: "<select><option><template></template></select>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n|         <template>\n|           content\n"
-       }, {
-               name: "template.dat #24"
-               html: "<select><template>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <template>\n|         content\n"
-       }, {
-               name: "template.dat #25"
-               html: "<select><option></option><template>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n|       <template>\n|         content\n"
-       }, {
-               name: "template.dat #26"
-               html: "<select><option></option><template><option>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n|       <template>\n|         content\n|           <option>\n"
-       }, {
-               name: "template.dat #27"
-               html: "<table><thead><template><td></template></table>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <thead>\n|         <template>\n|           content\n|             <td>\n"
-       }, {
-               name: "template.dat #28"
-               html: "<table><template><thead></template></table>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <template>\n|         content\n|           <thead>\n"
-       }, {
-               name: "template.dat #29"
-               html: "<body><table><template><td></tr><div></template></table>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <template>\n|         content\n|           <td>\n|             <div>\n"
-       }, {
-               name: "template.dat #30"
-               html: "<table><template><thead></template></thead></table>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <template>\n|         content\n|           <thead>\n"
-       }, {
-               name: "template.dat #31"
-               html: "<table><thead><template><tr></template></table>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <thead>\n|         <template>\n|           content\n|             <tr>\n"
-       }, {
-               name: "template.dat #32"
-               html: "<table><template><tr></template></table>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <template>\n|         content\n|           <tr>\n"
-       }, {
-               name: "template.dat #33"
-               html: "<table><tr><template><td>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <template>\n|             content\n|               <td>\n"
-       }, {
-               name: "template.dat #34"
-               html: "<table><template><tr><template><td></template></tr></template></table>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <template>\n|         content\n|           <tr>\n|             <template>\n|               content\n|                 <td>\n"
-       }, {
-               name: "template.dat #35"
-               html: "<table><template><tr><template><td></td></template></tr></template></table>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <template>\n|         content\n|           <tr>\n|             <template>\n|               content\n|                 <td>\n"
-       }, {
-               name: "template.dat #36"
-               html: "<table><template><td></template>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <template>\n|         content\n|           <td>\n"
-       }, {
-               name: "template.dat #37"
-               html: "<body><template><td></td></template>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <td>\n"
-       }, {
-               name: "template.dat #38"
-               html: "<body><template><template><tr></tr></template><td></td></template>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <tr>\n|         <td>\n"
-       }, {
-               name: "template.dat #39"
-               html: "<table><colgroup><template><col>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <colgroup>\n|         <template>\n|           content\n|             <col>\n"
-       }, {
-               name: "template.dat #40"
-               html: "<frameset><template><frame></frame></template></frameset>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <frameset>\n|     <frame>\n"
-       }, {
-               name: "template.dat #41"
-               html: "<template><frame></frame></frameset><frame></frame></template>"
-               errors: 6
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|   <body>\n"
-       }, {
-               name: "template.dat #42"
-               html: "<template><div><frameset><span></span></div><span></span></template>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <div>\n|           <span>\n|         <span>\n|   <body>\n"
-       }, {
-               name: "template.dat #43"
-               html: "<body><template><div><frameset><span></span></div><span></span></template></body>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <div>\n|           <span>\n|         <span>\n"
-       }, {
-               name: "template.dat #44"
-               html: "<body><template><script>var i = 1;</script><td></td></template>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <script>\n|           \"var i = 1;\"\n|         <td>\n"
-       }, {
-               name: "template.dat #45"
-               html: "<body><template><tr><div></div></tr></template>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <tr>\n|         <div>\n"
-       }, {
-               name: "template.dat #46"
-               html: "<body><template><tr></tr><td></td></template>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <tr>\n|         <tr>\n|           <td>\n"
-       }, {
-               name: "template.dat #47"
-               html: "<body><template><td></td></tr><td></td></template>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <td>\n|         <td>\n"
-       }, {
-               name: "template.dat #48"
-               html: "<body><template><td></td><tbody><td></td></template>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <td>\n|         <td>\n"
-       }, {
-               name: "template.dat #49"
-               html: "<body><template><td></td><caption></caption><td></td></template>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <td>\n|         <td>\n"
-       }, {
-               name: "template.dat #50"
-               html: "<body><template><td></td><colgroup></caption><td></td></template>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <td>\n|         <td>\n"
-       }, {
-               name: "template.dat #51"
-               html: "<body><template><td></td></table><td></td></template>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <td>\n|         <td>\n"
-       }, {
-               name: "template.dat #52"
-               html: "<body><template><tr></tr><tbody><tr></tr></template>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <tr>\n|         <tr>\n"
-       }, {
-               name: "template.dat #53"
-               html: "<body><template><tr></tr><caption><tr></tr></template>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <tr>\n|         <tr>\n"
-       }, {
-               name: "template.dat #54"
-               html: "<body><template><tr></tr></table><tr></tr></template>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <tr>\n|         <tr>\n"
-       }, {
-               name: "template.dat #55"
-               html: "<body><template><thead></thead><caption></caption><tbody></tbody></template>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <thead>\n|         <caption>\n|         <tbody>\n"
-       }, {
-               name: "template.dat #56"
-               html: "<body><template><thead></thead></table><tbody></tbody></template></body>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <thead>\n|         <tbody>\n"
-       }, {
-               name: "template.dat #57"
-               html: "<body><template><div><tr></tr></div></template>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <div>\n"
-       }, {
-               name: "template.dat #58"
-               html: "<body><template><em>Hello</em></template>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <em>\n|           \"Hello\"\n"
-       }, {
-               name: "template.dat #59"
-               html: "<body><template><!--comment--></template>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <!-- comment -->\n"
-       }, {
-               name: "template.dat #60"
-               html: "<body><template><style></style><td></td></template>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <style>\n|         <td>\n"
-       }, {
-               name: "template.dat #61"
-               html: "<body><template><meta><td></td></template>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <meta>\n|         <td>\n"
-       }, {
-               name: "template.dat #62"
-               html: "<body><template><link><td></td></template>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <link>\n|         <td>\n"
-       }, {
-               name: "template.dat #63"
-               html: "<body><template><template><tr></tr></template><td></td></template>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <tr>\n|         <td>\n"
-       }, {
-               name: "template.dat #64"
-               html: "<body><table><colgroup><template><col></col></template></colgroup></table></body>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <colgroup>\n|         <template>\n|           content\n|             <col>\n"
-       }, {
-               name: "template.dat #65"
-               html: "<body a=b><template><div></div><body c=d><div></div></body></template></body>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     a=\"b\"\n|     <template>\n|       content\n|         <div>\n|         <div>\n"
-       }, {
-               name: "template.dat #66"
-               html: "<html a=b><template><div><html b=c><span></template>"
-               errors: 3
-               expected: "| <html>\n|   a=\"b\"\n|   <head>\n|     <template>\n|       content\n|         <div>\n|           <span>\n|   <body>\n"
-       }, {
-               name: "template.dat #67"
-               html: "<html a=b><template><col></col><html b=c><col></col></template>"
-               errors: 4
-               expected: "| <html>\n|   a=\"b\"\n|   <head>\n|     <template>\n|       content\n|         <col>\n|         <col>\n|   <body>\n"
-       }, {
-               name: "template.dat #68"
-               html: "<html a=b><template><frame></frame><html b=c><frame></frame></template>"
-               errors: 6
-               expected: "| <html>\n|   a=\"b\"\n|   <head>\n|     <template>\n|       content\n|   <body>\n"
-       }, {
-               name: "template.dat #69"
-               html: "<body><template><tr></tr><template></template><td></td></template>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <tr>\n|         <template>\n|           content\n|         <tr>\n|           <td>\n"
-       }, {
-               name: "template.dat #70"
-               html: "<body><template><thead></thead><template><tr></tr></template><tr></tr><tfoot></tfoot></template>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <thead>\n|         <template>\n|           content\n|             <tr>\n|         <tbody>\n|           <tr>\n|         <tfoot>\n"
-       }, {
-               name: "template.dat #71"
-               html: "<body><template><template><b><template></template></template>text</template>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <b>\n|               <template>\n|                 content\n|         \"text\"\n"
-       }, {
-               name: "template.dat #72"
-               html: "<body><template><col><colgroup>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <col>\n"
-       }, {
-               name: "template.dat #73"
-               html: "<body><template><col></colgroup>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <col>\n"
-       }, {
-               name: "template.dat #74"
-               html: "<body><template><col><colgroup></template></body>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <col>\n"
-       }, {
-               name: "template.dat #75"
-               html: "<body><template><col><div>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <col>\n"
-       }, {
-               name: "template.dat #76"
-               html: "<body><template><col></div>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <col>\n"
-       }, {
-               name: "template.dat #77"
-               html: "<body><template><col>Hello"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <col>\n"
-       }, {
-               name: "template.dat #78"
-               html: "<body><template><i><menu>Foo</i>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <i>\n|         <menu>\n|           <i>\n|             \"Foo\"\n"
-       }, {
-               name: "template.dat #79"
-               html: "<body><template></div><div>Foo</div><template></template><tr></tr>"
-               errors: 5
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n|         <div>\n|           \"Foo\"\n|         <template>\n|           content\n"
-       }, {
-               name: "template.dat #80"
-               html: "<body><div><template></div><tr><td>Foo</td></tr></template>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <template>\n|         content\n|           <tr>\n|             <td>\n|               \"Foo\"\n"
-       }, {
-               name: "template.dat #81"
-               html: "<template></figcaption><sub><table></table>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <sub>\n|           <table>\n|   <body>\n"
-       }, {
-               name: "template.dat #82"
-               html: "<template><template>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|   <body>\n"
-       }, {
-               name: "template.dat #83"
-               html: "<template><div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <div>\n|   <body>\n"
-       }, {
-               name: "template.dat #84"
-               html: "<template><template><div>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <div>\n|   <body>\n"
-       }, {
-               name: "template.dat #85"
-               html: "<template><template><table>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <table>\n|   <body>\n"
-       }, {
-               name: "template.dat #86"
-               html: "<template><template><tbody>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <tbody>\n|   <body>\n"
-       }, {
-               name: "template.dat #87"
-               html: "<template><template><tr>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <tr>\n|   <body>\n"
-       }, {
-               name: "template.dat #88"
-               html: "<template><template><td>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <td>\n|   <body>\n"
-       }, {
-               name: "template.dat #89"
-               html: "<template><template><caption>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <caption>\n|   <body>\n"
-       }, {
-               name: "template.dat #90"
-               html: "<template><template><colgroup>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <colgroup>\n|   <body>\n"
-       }, {
-               name: "template.dat #91"
-               html: "<template><template><col>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <col>\n|   <body>\n"
-       }, {
-               name: "template.dat #92"
-               html: "<template><template><tbody><select>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <tbody>\n|             <select>\n|   <body>\n"
-       }, {
-               name: "template.dat #93"
-               html: "<template><template><table>Foo"
-               errors: 6
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             \"Foo\"\n|             <table>\n|   <body>\n"
-       }, {
-               name: "template.dat #94"
-               html: "<template><template><frame>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|   <body>\n"
-       }, {
-               name: "template.dat #95"
-               html: "<template><template><script>var i"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <script>\n|               \"var i\"\n|   <body>\n"
-       }, {
-               name: "template.dat #96"
-               html: "<template><template><style>var i"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <template>\n|           content\n|             <style>\n|               \"var i\"\n|   <body>\n"
-       }, {
-               name: "template.dat #97"
-               html: "<template><table></template><body><span>Foo"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <table>\n|   <body>\n|     <span>\n|       \"Foo\"\n"
-       }, {
-               name: "template.dat #98"
-               html: "<template><td></template><body><span>Foo"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <td>\n|   <body>\n|     <span>\n|       \"Foo\"\n"
-       }, {
-               name: "template.dat #99"
-               html: "<template><object></template><body><span>Foo"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <object>\n|   <body>\n|     <span>\n|       \"Foo\"\n"
-       }, {
-               name: "template.dat #100"
-               html: "<template><svg><template>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <svg svg>\n|           <svg template>\n|   <body>\n"
-       }, {
-               name: "template.dat #101"
-               html: "<template><svg><foo><template><foreignObject><div></template><div>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <svg svg>\n|           <svg foo>\n|             <svg template>\n|               <svg foreignObject>\n|                 <div>\n|   <body>\n|     <div>\n"
-       }, {
-               name: "template.dat #102"
-               html: "<dummy><template><span></dummy>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <dummy>\n|       <template>\n|         content\n|           <span>\n"
-       }, {
-               name: "template.dat #103"
-               html: "<body><table><tr><td><select><template>Foo</template><caption>A</table>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <select>\n|               <template>\n|                 content\n|                   \"Foo\"\n|       <caption>\n|         \"A\"\n"
-       }, {
-               name: "template.dat #104"
-               html: "<body></body><template>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <template>\n|       content\n"
-       }, {
-               name: "template.dat #105"
-               html: "<head></head><template>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|   <body>\n"
-       }, {
-               name: "template.dat #106"
-               html: "<head></head><template>Foo</template>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         \"Foo\"\n|   <body>\n"
-       }, {
-               name: "template.dat #107"
-               html: "<!DOCTYPE HTML><dummy><table><template><table><template><table><script>"
-               errors: 4
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <dummy>\n|       <table>\n|         <template>\n|           content\n|             <table>\n|               <template>\n|                 content\n|                   <table>\n|                     <script>\n"
-       }, {
-               name: "template.dat #108"
-               html: "<template><a><table><a>"
-               expected: "| <html>\n|   <head>\n|     <template>\n|       content\n|         <a>\n|           <a>\n|           <table>\n|   <body>\n"
-       }, {
-               name: "tests10.dat #1"
-               html: "<!DOCTYPE html><svg></svg>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n"
-       }, {
-               name: "tests10.dat #2"
-               html: "<!DOCTYPE html><svg></svg><![CDATA[a]]>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|     <!-- [CDATA[a]] -->\n"
-       }, {
-               name: "tests10.dat #3"
-               html: "<!DOCTYPE html><body><svg></svg>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n"
-       }, {
-               name: "tests10.dat #4"
-               html: "<!DOCTYPE html><body><select><svg></svg></select>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n"
-       }, {
-               name: "tests10.dat #5"
-               html: "<!DOCTYPE html><body><select><option><svg></svg></option></select>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n"
-       }, {
-               name: "tests10.dat #6"
-               html: "<!DOCTYPE html><body><table><svg></svg></table>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|     <table>\n"
-       }, {
-               name: "tests10.dat #7"
-               html: "<!DOCTYPE html><body><table><svg><g>foo</g></svg></table>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg g>\n|         \"foo\"\n|     <table>\n"
-       }, {
-               name: "tests10.dat #8"
-               html: "<!DOCTYPE html><body><table><svg><g>foo</g><g>bar</g></svg></table>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg g>\n|         \"foo\"\n|       <svg g>\n|         \"bar\"\n|     <table>\n"
-       }, {
-               name: "tests10.dat #9"
-               html: "<!DOCTYPE html><body><table><tbody><svg><g>foo</g><g>bar</g></svg></tbody></table>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg g>\n|         \"foo\"\n|       <svg g>\n|         \"bar\"\n|     <table>\n|       <tbody>\n"
-       }, {
-               name: "tests10.dat #10"
-               html: "<!DOCTYPE html><body><table><tbody><tr><svg><g>foo</g><g>bar</g></svg></tr></tbody></table>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg g>\n|         \"foo\"\n|       <svg g>\n|         \"bar\"\n|     <table>\n|       <tbody>\n|         <tr>\n"
-       }, {
-               name: "tests10.dat #11"
-               html: "<!DOCTYPE html><body><table><tbody><tr><td><svg><g>foo</g><g>bar</g></svg></td></tr></tbody></table>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <svg svg>\n|               <svg g>\n|                 \"foo\"\n|               <svg g>\n|                 \"bar\"\n"
-       }, {
-               name: "tests10.dat #12"
-               html: "<!DOCTYPE html><body><table><tbody><tr><td><svg><g>foo</g><g>bar</g></svg><p>baz</td></tr></tbody></table>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <svg svg>\n|               <svg g>\n|                 \"foo\"\n|               <svg g>\n|                 \"bar\"\n|             <p>\n|               \"baz\"\n"
-       }, {
-               name: "tests10.dat #13"
-               html: "<!DOCTYPE html><body><table><caption><svg><g>foo</g><g>bar</g></svg><p>baz</caption></table>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <svg svg>\n|           <svg g>\n|             \"foo\"\n|           <svg g>\n|             \"bar\"\n|         <p>\n|           \"baz\"\n"
-       }, {
-               name: "tests10.dat #14"
-               html: "<!DOCTYPE html><body><table><caption><svg><g>foo</g><g>bar</g><p>baz</table><p>quux"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <svg svg>\n|           <svg g>\n|             \"foo\"\n|           <svg g>\n|             \"bar\"\n|         <p>\n|           \"baz\"\n|     <p>\n|       \"quux\"\n"
-       }, {
-               name: "tests10.dat #15"
-               html: "<!DOCTYPE html><body><table><caption><svg><g>foo</g><g>bar</g>baz</table><p>quux"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <svg svg>\n|           <svg g>\n|             \"foo\"\n|           <svg g>\n|             \"bar\"\n|           \"baz\"\n|     <p>\n|       \"quux\"\n"
-       }, {
-               name: "tests10.dat #16"
-               html: "<!DOCTYPE html><body><table><colgroup><svg><g>foo</g><g>bar</g><p>baz</table><p>quux"
-               errors: 6
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg g>\n|         \"foo\"\n|       <svg g>\n|         \"bar\"\n|     <p>\n|       \"baz\"\n|     <table>\n|       <colgroup>\n|     <p>\n|       \"quux\"\n"
-       }, {
-               name: "tests10.dat #17"
-               html: "<!DOCTYPE html><body><table><tr><td><select><svg><g>foo</g><g>bar</g><p>baz</table><p>quux"
-               errors: 7
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <select>\n|               \"foobarbaz\"\n|     <p>\n|       \"quux\"\n"
-       }, {
-               name: "tests10.dat #18"
-               html: "<!DOCTYPE html><body><table><select><svg><g>foo</g><g>bar</g><p>baz</table><p>quux"
-               errors: 8
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       \"foobarbaz\"\n|     <table>\n|     <p>\n|       \"quux\"\n"
-       }, {
-               name: "tests10.dat #19"
-               html: "<!DOCTYPE html><body></body></html><svg><g>foo</g><g>bar</g><p>baz"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg g>\n|         \"foo\"\n|       <svg g>\n|         \"bar\"\n|     <p>\n|       \"baz\"\n"
-       }, {
-               name: "tests10.dat #20"
-               html: "<!DOCTYPE html><body></body><svg><g>foo</g><g>bar</g><p>baz"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg g>\n|         \"foo\"\n|       <svg g>\n|         \"bar\"\n|     <p>\n|       \"baz\"\n"
-       }, {
-               name: "tests10.dat #21"
-               html: "<!DOCTYPE html><frameset><svg><g></g><g></g><p><span>"
-               errors: 8
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "tests10.dat #22"
-               html: "<!DOCTYPE html><frameset></frameset><svg><g></g><g></g><p><span>"
-               errors: 7
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "tests10.dat #23"
-               html: "<!DOCTYPE html><body xlink:href=foo><svg xlink:href=foo></svg>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     xlink:href=\"foo\"\n|     <svg svg>\n|       xlink href=\"foo\"\n"
-       }, {
-               name: "tests10.dat #24"
-               html: "<!DOCTYPE html><body xlink:href=foo xml:lang=en><svg><g xml:lang=en xlink:href=foo></g></svg>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     xlink:href=\"foo\"\n|     xml:lang=\"en\"\n|     <svg svg>\n|       <svg g>\n|         xlink href=\"foo\"\n|         xml lang=\"en\"\n"
-       }, {
-               name: "tests10.dat #25"
-               html: "<!DOCTYPE html><body xlink:href=foo xml:lang=en><svg><g xml:lang=en xlink:href=foo /></svg>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     xlink:href=\"foo\"\n|     xml:lang=\"en\"\n|     <svg svg>\n|       <svg g>\n|         xlink href=\"foo\"\n|         xml lang=\"en\"\n"
-       }, {
-               name: "tests10.dat #26"
-               html: "<!DOCTYPE html><body xlink:href=foo xml:lang=en><svg><g xml:lang=en xlink:href=foo />bar</svg>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     xlink:href=\"foo\"\n|     xml:lang=\"en\"\n|     <svg svg>\n|       <svg g>\n|         xlink href=\"foo\"\n|         xml lang=\"en\"\n|       \"bar\"\n"
-       }, {
-               name: "tests10.dat #27"
-               html: "<svg></path>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n"
-       }, {
-               name: "tests10.dat #28"
-               html: "<div><svg></div>a"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <svg svg>\n|     \"a\"\n"
-       }, {
-               name: "tests10.dat #29"
-               html: "<div><svg><path></div>a"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <svg svg>\n|         <svg path>\n|     \"a\"\n"
-       }, {
-               name: "tests10.dat #30"
-               html: "<div><svg><path></svg><path>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <svg svg>\n|         <svg path>\n|       <path>\n"
-       }, {
-               name: "tests10.dat #31"
-               html: "<div><svg><path><foreignObject><math></div>a"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <svg svg>\n|         <svg path>\n|           <svg foreignObject>\n|             <math math>\n|               \"a\"\n"
-       }, {
-               name: "tests10.dat #32"
-               html: "<div><svg><path><foreignObject><p></div>a"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <svg svg>\n|         <svg path>\n|           <svg foreignObject>\n|             <p>\n|               \"a\"\n"
-       }, {
-               name: "tests10.dat #33"
-               html: "<!DOCTYPE html><svg><desc><div><svg><ul>a"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg desc>\n|         <div>\n|           <svg svg>\n|           <ul>\n|             \"a\"\n"
-       }, {
-               name: "tests10.dat #34"
-               html: "<!DOCTYPE html><svg><desc><svg><ul>a"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg desc>\n|         <svg svg>\n|         <ul>\n|           \"a\"\n"
-       }, {
-               name: "tests10.dat #35"
-               html: "<!DOCTYPE html><p><svg><desc><p>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <svg svg>\n|         <svg desc>\n|           <p>\n"
-       }, {
-               name: "tests10.dat #36"
-               html: "<!DOCTYPE html><p><svg><title><p>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <svg svg>\n|         <svg title>\n|           <p>\n"
-       }, {
-               name: "tests10.dat #37"
-               html: "<div><svg><path><foreignObject><p></foreignObject><p>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <svg svg>\n|         <svg path>\n|           <svg foreignObject>\n|             <p>\n|             <p>\n"
-       }, {
-               name: "tests10.dat #38"
-               html: "<math><mi><div><object><div><span></span></div></object></div></mi><mi>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         <div>\n|           <object>\n|             <div>\n|               <span>\n|       <math mi>\n"
-       }, {
-               name: "tests10.dat #39"
-               html: "<math><mi><svg><foreignObject><div><div></div></div></foreignObject></svg></mi><mi>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         <svg svg>\n|           <svg foreignObject>\n|             <div>\n|               <div>\n|       <math mi>\n"
-       }, {
-               name: "tests10.dat #40"
-               html: "<svg><script></script><path>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg script>\n|       <svg path>\n"
-       }, {
-               name: "tests10.dat #41"
-               html: "<table><svg></svg><tr>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|     <table>\n|       <tbody>\n|         <tr>\n"
-       }, {
-               name: "tests10.dat #42"
-               html: "<math><mi><mglyph>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         <math mglyph>\n"
-       }, {
-               name: "tests10.dat #43"
-               html: "<math><mi><malignmark>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         <math malignmark>\n"
-       }, {
-               name: "tests10.dat #44"
-               html: "<math><mo><mglyph>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mo>\n|         <math mglyph>\n"
-       }, {
-               name: "tests10.dat #45"
-               html: "<math><mo><malignmark>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mo>\n|         <math malignmark>\n"
-       }, {
-               name: "tests10.dat #46"
-               html: "<math><mn><mglyph>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mn>\n|         <math mglyph>\n"
-       }, {
-               name: "tests10.dat #47"
-               html: "<math><mn><malignmark>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mn>\n|         <math malignmark>\n"
-       }, {
-               name: "tests10.dat #48"
-               html: "<math><ms><mglyph>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math ms>\n|         <math mglyph>\n"
-       }, {
-               name: "tests10.dat #49"
-               html: "<math><ms><malignmark>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math ms>\n|         <math malignmark>\n"
-       }, {
-               name: "tests10.dat #50"
-               html: "<math><mtext><mglyph>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mtext>\n|         <math mglyph>\n"
-       }, {
-               name: "tests10.dat #51"
-               html: "<math><mtext><malignmark>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mtext>\n|         <math malignmark>\n"
-       }, {
-               name: "tests10.dat #52"
-               html: "<math><annotation-xml><svg></svg></annotation-xml><mi>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|         <svg svg>\n|       <math mi>\n"
-       }, {
-               name: "tests10.dat #53"
-               html: "<math><annotation-xml><svg><foreignObject><div><math><mi></mi></math><span></span></div></foreignObject><path></path></svg></annotation-xml><mi>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|         <svg svg>\n|           <svg foreignObject>\n|             <div>\n|               <math math>\n|                 <math mi>\n|               <span>\n|           <svg path>\n|       <math mi>\n"
-       }, {
-               name: "tests10.dat #54"
-               html: "<math><annotation-xml><svg><foreignObject><math><mi><svg></svg></mi><mo></mo></math><span></span></foreignObject><path></path></svg></annotation-xml><mi>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|         <svg svg>\n|           <svg foreignObject>\n|             <math math>\n|               <math mi>\n|                 <svg svg>\n|               <math mo>\n|             <span>\n|           <svg path>\n|       <math mi>\n"
-       }, {
-               name: "tests11.dat #1"
-               html: "<!DOCTYPE html><body><svg attributeName='' attributeType='' baseFrequency='' baseProfile='' calcMode='' clipPathUnits='' diffuseConstant='' edgeMode='' filterUnits='' glyphRef='' gradientTransform='' gradientUnits='' kernelMatrix='' kernelUnitLength='' keyPoints='' keySplines='' keyTimes='' lengthAdjust='' limitingConeAngle='' markerHeight='' markerUnits='' markerWidth='' maskContentUnits='' maskUnits='' numOctaves='' pathLength='' patternContentUnits='' patternTransform='' patternUnits='' pointsAtX='' pointsAtY='' pointsAtZ='' preserveAlpha='' preserveAspectRatio='' primitiveUnits='' refX='' refY='' repeatCount='' repeatDur='' requiredExtensions='' requiredFeatures='' specularConstant='' specularExponent='' spreadMethod='' startOffset='' stdDeviation='' stitchTiles='' surfaceScale='' systemLanguage='' tableValues='' targetX='' targetY='' textLength='' viewBox='' viewTarget='' xChannelSelector='' yChannelSelector='' zoomAndPan=''></svg>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       attributeName=\"\"\n|       attributeType=\"\"\n|       baseFrequency=\"\"\n|       baseProfile=\"\"\n|       calcMode=\"\"\n|       clipPathUnits=\"\"\n|       diffuseConstant=\"\"\n|       edgeMode=\"\"\n|       filterUnits=\"\"\n|       glyphRef=\"\"\n|       gradientTransform=\"\"\n|       gradientUnits=\"\"\n|       kernelMatrix=\"\"\n|       kernelUnitLength=\"\"\n|       keyPoints=\"\"\n|       keySplines=\"\"\n|       keyTimes=\"\"\n|       lengthAdjust=\"\"\n|       limitingConeAngle=\"\"\n|       markerHeight=\"\"\n|       markerUnits=\"\"\n|       markerWidth=\"\"\n|       maskContentUnits=\"\"\n|       maskUnits=\"\"\n|       numOctaves=\"\"\n|       pathLength=\"\"\n|       patternContentUnits=\"\"\n|       patternTransform=\"\"\n|       patternUnits=\"\"\n|       pointsAtX=\"\"\n|       pointsAtY=\"\"\n|       pointsAtZ=\"\"\n|       preserveAlpha=\"\"\n|       preserveAspectRatio=\"\"\n|       primitiveUnits=\"\"\n|       refX=\"\"\n|       refY=\"\"\n|       repeatCount=\"\"\n|       repeatDur=\"\"\n|       requiredExtensions=\"\"\n|       requiredFeatures=\"\"\n|       specularConstant=\"\"\n|       specularExponent=\"\"\n|       spreadMethod=\"\"\n|       startOffset=\"\"\n|       stdDeviation=\"\"\n|       stitchTiles=\"\"\n|       surfaceScale=\"\"\n|       systemLanguage=\"\"\n|       tableValues=\"\"\n|       targetX=\"\"\n|       targetY=\"\"\n|       textLength=\"\"\n|       viewBox=\"\"\n|       viewTarget=\"\"\n|       xChannelSelector=\"\"\n|       yChannelSelector=\"\"\n|       zoomAndPan=\"\"\n"
-       }, {
-               name: "tests11.dat #2"
-               html: "<!DOCTYPE html><BODY><SVG ATTRIBUTENAME='' ATTRIBUTETYPE='' BASEFREQUENCY='' BASEPROFILE='' CALCMODE='' CLIPPATHUNITS='' DIFFUSECONSTANT='' EDGEMODE='' FILTERUNITS='' GLYPHREF='' GRADIENTTRANSFORM='' GRADIENTUNITS='' KERNELMATRIX='' KERNELUNITLENGTH='' KEYPOINTS='' KEYSPLINES='' KEYTIMES='' LENGTHADJUST='' LIMITINGCONEANGLE='' MARKERHEIGHT='' MARKERUNITS='' MARKERWIDTH='' MASKCONTENTUNITS='' MASKUNITS='' NUMOCTAVES='' PATHLENGTH='' PATTERNCONTENTUNITS='' PATTERNTRANSFORM='' PATTERNUNITS='' POINTSATX='' POINTSATY='' POINTSATZ='' PRESERVEALPHA='' PRESERVEASPECTRATIO='' PRIMITIVEUNITS='' REFX='' REFY='' REPEATCOUNT='' REPEATDUR='' REQUIREDEXTENSIONS='' REQUIREDFEATURES='' SPECULARCONSTANT='' SPECULAREXPONENT='' SPREADMETHOD='' STARTOFFSET='' STDDEVIATION='' STITCHTILES='' SURFACESCALE='' SYSTEMLANGUAGE='' TABLEVALUES='' TARGETX='' TARGETY='' TEXTLENGTH='' VIEWBOX='' VIEWTARGET='' XCHANNELSELECTOR='' YCHANNELSELECTOR='' ZOOMANDPAN=''></SVG>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       attributeName=\"\"\n|       attributeType=\"\"\n|       baseFrequency=\"\"\n|       baseProfile=\"\"\n|       calcMode=\"\"\n|       clipPathUnits=\"\"\n|       diffuseConstant=\"\"\n|       edgeMode=\"\"\n|       filterUnits=\"\"\n|       glyphRef=\"\"\n|       gradientTransform=\"\"\n|       gradientUnits=\"\"\n|       kernelMatrix=\"\"\n|       kernelUnitLength=\"\"\n|       keyPoints=\"\"\n|       keySplines=\"\"\n|       keyTimes=\"\"\n|       lengthAdjust=\"\"\n|       limitingConeAngle=\"\"\n|       markerHeight=\"\"\n|       markerUnits=\"\"\n|       markerWidth=\"\"\n|       maskContentUnits=\"\"\n|       maskUnits=\"\"\n|       numOctaves=\"\"\n|       pathLength=\"\"\n|       patternContentUnits=\"\"\n|       patternTransform=\"\"\n|       patternUnits=\"\"\n|       pointsAtX=\"\"\n|       pointsAtY=\"\"\n|       pointsAtZ=\"\"\n|       preserveAlpha=\"\"\n|       preserveAspectRatio=\"\"\n|       primitiveUnits=\"\"\n|       refX=\"\"\n|       refY=\"\"\n|       repeatCount=\"\"\n|       repeatDur=\"\"\n|       requiredExtensions=\"\"\n|       requiredFeatures=\"\"\n|       specularConstant=\"\"\n|       specularExponent=\"\"\n|       spreadMethod=\"\"\n|       startOffset=\"\"\n|       stdDeviation=\"\"\n|       stitchTiles=\"\"\n|       surfaceScale=\"\"\n|       systemLanguage=\"\"\n|       tableValues=\"\"\n|       targetX=\"\"\n|       targetY=\"\"\n|       textLength=\"\"\n|       viewBox=\"\"\n|       viewTarget=\"\"\n|       xChannelSelector=\"\"\n|       yChannelSelector=\"\"\n|       zoomAndPan=\"\"\n"
-       }, {
-               name: "tests11.dat #3"
-               html: "<!DOCTYPE html><body><svg attributename='' attributetype='' basefrequency='' baseprofile='' calcmode='' clippathunits='' diffuseconstant='' edgemode='' filterunits='' filterres='' glyphref='' gradienttransform='' gradientunits='' kernelmatrix='' kernelunitlength='' keypoints='' keysplines='' keytimes='' lengthadjust='' limitingconeangle='' markerheight='' markerunits='' markerwidth='' maskcontentunits='' maskunits='' numoctaves='' pathlength='' patterncontentunits='' patterntransform='' patternunits='' pointsatx='' pointsaty='' pointsatz='' preservealpha='' preserveaspectratio='' primitiveunits='' refx='' refy='' repeatcount='' repeatdur='' requiredextensions='' requiredfeatures='' specularconstant='' specularexponent='' spreadmethod='' startoffset='' stddeviation='' stitchtiles='' surfacescale='' systemlanguage='' tablevalues='' targetx='' targety='' textlength='' viewbox='' viewtarget='' xchannelselector='' ychannelselector='' zoomandpan=''></svg>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       attributeName=\"\"\n|       attributeType=\"\"\n|       baseFrequency=\"\"\n|       baseProfile=\"\"\n|       calcMode=\"\"\n|       clipPathUnits=\"\"\n|       diffuseConstant=\"\"\n|       edgeMode=\"\"\n|       filterUnits=\"\"\n|       filterres=\"\"\n|       glyphRef=\"\"\n|       gradientTransform=\"\"\n|       gradientUnits=\"\"\n|       kernelMatrix=\"\"\n|       kernelUnitLength=\"\"\n|       keyPoints=\"\"\n|       keySplines=\"\"\n|       keyTimes=\"\"\n|       lengthAdjust=\"\"\n|       limitingConeAngle=\"\"\n|       markerHeight=\"\"\n|       markerUnits=\"\"\n|       markerWidth=\"\"\n|       maskContentUnits=\"\"\n|       maskUnits=\"\"\n|       numOctaves=\"\"\n|       pathLength=\"\"\n|       patternContentUnits=\"\"\n|       patternTransform=\"\"\n|       patternUnits=\"\"\n|       pointsAtX=\"\"\n|       pointsAtY=\"\"\n|       pointsAtZ=\"\"\n|       preserveAlpha=\"\"\n|       preserveAspectRatio=\"\"\n|       primitiveUnits=\"\"\n|       refX=\"\"\n|       refY=\"\"\n|       repeatCount=\"\"\n|       repeatDur=\"\"\n|       requiredExtensions=\"\"\n|       requiredFeatures=\"\"\n|       specularConstant=\"\"\n|       specularExponent=\"\"\n|       spreadMethod=\"\"\n|       startOffset=\"\"\n|       stdDeviation=\"\"\n|       stitchTiles=\"\"\n|       surfaceScale=\"\"\n|       systemLanguage=\"\"\n|       tableValues=\"\"\n|       targetX=\"\"\n|       targetY=\"\"\n|       textLength=\"\"\n|       viewBox=\"\"\n|       viewTarget=\"\"\n|       xChannelSelector=\"\"\n|       yChannelSelector=\"\"\n|       zoomAndPan=\"\"\n"
-       }, {
-               name: "tests11.dat #4"
-               html: "<!DOCTYPE html><body><math attributeName='' attributeType='' baseFrequency='' baseProfile='' calcMode='' clipPathUnits='' diffuseConstant='' edgeMode='' filterUnits='' glyphRef='' gradientTransform='' gradientUnits='' kernelMatrix='' kernelUnitLength='' keyPoints='' keySplines='' keyTimes='' lengthAdjust='' limitingConeAngle='' markerHeight='' markerUnits='' markerWidth='' maskContentUnits='' maskUnits='' numOctaves='' pathLength='' patternContentUnits='' patternTransform='' patternUnits='' pointsAtX='' pointsAtY='' pointsAtZ='' preserveAlpha='' preserveAspectRatio='' primitiveUnits='' refX='' refY='' repeatCount='' repeatDur='' requiredExtensions='' requiredFeatures='' specularConstant='' specularExponent='' spreadMethod='' startOffset='' stdDeviation='' stitchTiles='' surfaceScale='' systemLanguage='' tableValues='' targetX='' targetY='' textLength='' viewBox='' viewTarget='' xChannelSelector='' yChannelSelector='' zoomAndPan=''></math>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       attributename=\"\"\n|       attributetype=\"\"\n|       basefrequency=\"\"\n|       baseprofile=\"\"\n|       calcmode=\"\"\n|       clippathunits=\"\"\n|       diffuseconstant=\"\"\n|       edgemode=\"\"\n|       filterunits=\"\"\n|       glyphref=\"\"\n|       gradienttransform=\"\"\n|       gradientunits=\"\"\n|       kernelmatrix=\"\"\n|       kernelunitlength=\"\"\n|       keypoints=\"\"\n|       keysplines=\"\"\n|       keytimes=\"\"\n|       lengthadjust=\"\"\n|       limitingconeangle=\"\"\n|       markerheight=\"\"\n|       markerunits=\"\"\n|       markerwidth=\"\"\n|       maskcontentunits=\"\"\n|       maskunits=\"\"\n|       numoctaves=\"\"\n|       pathlength=\"\"\n|       patterncontentunits=\"\"\n|       patterntransform=\"\"\n|       patternunits=\"\"\n|       pointsatx=\"\"\n|       pointsaty=\"\"\n|       pointsatz=\"\"\n|       preservealpha=\"\"\n|       preserveaspectratio=\"\"\n|       primitiveunits=\"\"\n|       refx=\"\"\n|       refy=\"\"\n|       repeatcount=\"\"\n|       repeatdur=\"\"\n|       requiredextensions=\"\"\n|       requiredfeatures=\"\"\n|       specularconstant=\"\"\n|       specularexponent=\"\"\n|       spreadmethod=\"\"\n|       startoffset=\"\"\n|       stddeviation=\"\"\n|       stitchtiles=\"\"\n|       surfacescale=\"\"\n|       systemlanguage=\"\"\n|       tablevalues=\"\"\n|       targetx=\"\"\n|       targety=\"\"\n|       textlength=\"\"\n|       viewbox=\"\"\n|       viewtarget=\"\"\n|       xchannelselector=\"\"\n|       ychannelselector=\"\"\n|       zoomandpan=\"\"\n"
-       }, {
-               name: "tests11.dat #5"
-               html: "<!DOCTYPE html><body><svg><altGlyph /><altGlyphDef /><altGlyphItem /><animateColor /><animateMotion /><animateTransform /><clipPath /><feBlend /><feColorMatrix /><feComponentTransfer /><feComposite /><feConvolveMatrix /><feDiffuseLighting /><feDisplacementMap /><feDistantLight /><feFlood /><feFuncA /><feFuncB /><feFuncG /><feFuncR /><feGaussianBlur /><feImage /><feMerge /><feMergeNode /><feMorphology /><feOffset /><fePointLight /><feSpecularLighting /><feSpotLight /><feTile /><feTurbulence /><foreignObject /><glyphRef /><linearGradient /><radialGradient /><textPath /></svg>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg altGlyph>\n|       <svg altGlyphDef>\n|       <svg altGlyphItem>\n|       <svg animateColor>\n|       <svg animateMotion>\n|       <svg animateTransform>\n|       <svg clipPath>\n|       <svg feBlend>\n|       <svg feColorMatrix>\n|       <svg feComponentTransfer>\n|       <svg feComposite>\n|       <svg feConvolveMatrix>\n|       <svg feDiffuseLighting>\n|       <svg feDisplacementMap>\n|       <svg feDistantLight>\n|       <svg feFlood>\n|       <svg feFuncA>\n|       <svg feFuncB>\n|       <svg feFuncG>\n|       <svg feFuncR>\n|       <svg feGaussianBlur>\n|       <svg feImage>\n|       <svg feMerge>\n|       <svg feMergeNode>\n|       <svg feMorphology>\n|       <svg feOffset>\n|       <svg fePointLight>\n|       <svg feSpecularLighting>\n|       <svg feSpotLight>\n|       <svg feTile>\n|       <svg feTurbulence>\n|       <svg foreignObject>\n|       <svg glyphRef>\n|       <svg linearGradient>\n|       <svg radialGradient>\n|       <svg textPath>\n"
-       }, {
-               name: "tests11.dat #6"
-               html: "<!DOCTYPE html><body><svg><altglyph /><altglyphdef /><altglyphitem /><animatecolor /><animatemotion /><animatetransform /><clippath /><feblend /><fecolormatrix /><fecomponenttransfer /><fecomposite /><feconvolvematrix /><fediffuselighting /><fedisplacementmap /><fedistantlight /><feflood /><fefunca /><fefuncb /><fefuncg /><fefuncr /><fegaussianblur /><feimage /><femerge /><femergenode /><femorphology /><feoffset /><fepointlight /><fespecularlighting /><fespotlight /><fetile /><feturbulence /><foreignobject /><glyphref /><lineargradient /><radialgradient /><textpath /></svg>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg altGlyph>\n|       <svg altGlyphDef>\n|       <svg altGlyphItem>\n|       <svg animateColor>\n|       <svg animateMotion>\n|       <svg animateTransform>\n|       <svg clipPath>\n|       <svg feBlend>\n|       <svg feColorMatrix>\n|       <svg feComponentTransfer>\n|       <svg feComposite>\n|       <svg feConvolveMatrix>\n|       <svg feDiffuseLighting>\n|       <svg feDisplacementMap>\n|       <svg feDistantLight>\n|       <svg feFlood>\n|       <svg feFuncA>\n|       <svg feFuncB>\n|       <svg feFuncG>\n|       <svg feFuncR>\n|       <svg feGaussianBlur>\n|       <svg feImage>\n|       <svg feMerge>\n|       <svg feMergeNode>\n|       <svg feMorphology>\n|       <svg feOffset>\n|       <svg fePointLight>\n|       <svg feSpecularLighting>\n|       <svg feSpotLight>\n|       <svg feTile>\n|       <svg feTurbulence>\n|       <svg foreignObject>\n|       <svg glyphRef>\n|       <svg linearGradient>\n|       <svg radialGradient>\n|       <svg textPath>\n"
-       }, {
-               name: "tests11.dat #7"
-               html: "<!DOCTYPE html><BODY><SVG><ALTGLYPH /><ALTGLYPHDEF /><ALTGLYPHITEM /><ANIMATECOLOR /><ANIMATEMOTION /><ANIMATETRANSFORM /><CLIPPATH /><FEBLEND /><FECOLORMATRIX /><FECOMPONENTTRANSFER /><FECOMPOSITE /><FECONVOLVEMATRIX /><FEDIFFUSELIGHTING /><FEDISPLACEMENTMAP /><FEDISTANTLIGHT /><FEFLOOD /><FEFUNCA /><FEFUNCB /><FEFUNCG /><FEFUNCR /><FEGAUSSIANBLUR /><FEIMAGE /><FEMERGE /><FEMERGENODE /><FEMORPHOLOGY /><FEOFFSET /><FEPOINTLIGHT /><FESPECULARLIGHTING /><FESPOTLIGHT /><FETILE /><FETURBULENCE /><FOREIGNOBJECT /><GLYPHREF /><LINEARGRADIENT /><RADIALGRADIENT /><TEXTPATH /></SVG>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg altGlyph>\n|       <svg altGlyphDef>\n|       <svg altGlyphItem>\n|       <svg animateColor>\n|       <svg animateMotion>\n|       <svg animateTransform>\n|       <svg clipPath>\n|       <svg feBlend>\n|       <svg feColorMatrix>\n|       <svg feComponentTransfer>\n|       <svg feComposite>\n|       <svg feConvolveMatrix>\n|       <svg feDiffuseLighting>\n|       <svg feDisplacementMap>\n|       <svg feDistantLight>\n|       <svg feFlood>\n|       <svg feFuncA>\n|       <svg feFuncB>\n|       <svg feFuncG>\n|       <svg feFuncR>\n|       <svg feGaussianBlur>\n|       <svg feImage>\n|       <svg feMerge>\n|       <svg feMergeNode>\n|       <svg feMorphology>\n|       <svg feOffset>\n|       <svg fePointLight>\n|       <svg feSpecularLighting>\n|       <svg feSpotLight>\n|       <svg feTile>\n|       <svg feTurbulence>\n|       <svg foreignObject>\n|       <svg glyphRef>\n|       <svg linearGradient>\n|       <svg radialGradient>\n|       <svg textPath>\n"
-       }, {
-               name: "tests11.dat #8"
-               html: "<!DOCTYPE html><body><math><altGlyph /><altGlyphDef /><altGlyphItem /><animateColor /><animateMotion /><animateTransform /><clipPath /><feBlend /><feColorMatrix /><feComponentTransfer /><feComposite /><feConvolveMatrix /><feDiffuseLighting /><feDisplacementMap /><feDistantLight /><feFlood /><feFuncA /><feFuncB /><feFuncG /><feFuncR /><feGaussianBlur /><feImage /><feMerge /><feMergeNode /><feMorphology /><feOffset /><fePointLight /><feSpecularLighting /><feSpotLight /><feTile /><feTurbulence /><foreignObject /><glyphRef /><linearGradient /><radialGradient /><textPath /></math>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math altglyph>\n|       <math altglyphdef>\n|       <math altglyphitem>\n|       <math animatecolor>\n|       <math animatemotion>\n|       <math animatetransform>\n|       <math clippath>\n|       <math feblend>\n|       <math fecolormatrix>\n|       <math fecomponenttransfer>\n|       <math fecomposite>\n|       <math feconvolvematrix>\n|       <math fediffuselighting>\n|       <math fedisplacementmap>\n|       <math fedistantlight>\n|       <math feflood>\n|       <math fefunca>\n|       <math fefuncb>\n|       <math fefuncg>\n|       <math fefuncr>\n|       <math fegaussianblur>\n|       <math feimage>\n|       <math femerge>\n|       <math femergenode>\n|       <math femorphology>\n|       <math feoffset>\n|       <math fepointlight>\n|       <math fespecularlighting>\n|       <math fespotlight>\n|       <math fetile>\n|       <math feturbulence>\n|       <math foreignobject>\n|       <math glyphref>\n|       <math lineargradient>\n|       <math radialgradient>\n|       <math textpath>\n"
-       }, {
-               name: "tests11.dat #9"
-               html: "<!DOCTYPE html><body><svg><solidColor /></svg>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg solidcolor>\n"
-       }, {
-               name: "tests12.dat #1"
-               html: "<!DOCTYPE html><body><p>foo<math><mtext><i>baz</i></mtext><annotation-xml><svg><desc><b>eggs</b></desc><g><foreignObject><P>spam<TABLE><tr><td><img></td></table></foreignObject></g><g>quux</g></svg></annotation-xml></math>bar"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       \"foo\"\n|       <math math>\n|         <math mtext>\n|           <i>\n|             \"baz\"\n|         <math annotation-xml>\n|           <svg svg>\n|             <svg desc>\n|               <b>\n|                 \"eggs\"\n|             <svg g>\n|               <svg foreignObject>\n|                 <p>\n|                   \"spam\"\n|                 <table>\n|                   <tbody>\n|                     <tr>\n|                       <td>\n|                         <img>\n|             <svg g>\n|               \"quux\"\n|       \"bar\"\n"
-       }, {
-               name: "tests12.dat #2"
-               html: "<!DOCTYPE html><body>foo<math><mtext><i>baz</i></mtext><annotation-xml><svg><desc><b>eggs</b></desc><g><foreignObject><P>spam<TABLE><tr><td><img></td></table></foreignObject></g><g>quux</g></svg></annotation-xml></math>bar"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"foo\"\n|     <math math>\n|       <math mtext>\n|         <i>\n|           \"baz\"\n|       <math annotation-xml>\n|         <svg svg>\n|           <svg desc>\n|             <b>\n|               \"eggs\"\n|           <svg g>\n|             <svg foreignObject>\n|               <p>\n|                 \"spam\"\n|               <table>\n|                 <tbody>\n|                   <tr>\n|                     <td>\n|                       <img>\n|           <svg g>\n|             \"quux\"\n|     \"bar\"\n"
-       }, {
-               name: "tests14.dat #1"
-               html: "<!DOCTYPE html><html><body><xyz:abc></xyz:abc>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <xyz:abc>\n"
-       }, {
-               name: "tests14.dat #2"
-               html: "<!DOCTYPE html><html><body><xyz:abc></xyz:abc><span></span>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <xyz:abc>\n|     <span>\n"
-       }, {
-               name: "tests14.dat #3"
-               html: "<!DOCTYPE html><html><html abc:def=gh><xyz:abc></xyz:abc>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   abc:def=\"gh\"\n|   <head>\n|   <body>\n|     <xyz:abc>\n"
-       }, {
-               name: "tests14.dat #4"
-               html: "<!DOCTYPE html><html xml:lang=bar><html xml:lang=foo>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   xml:lang=\"bar\"\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests14.dat #5"
-               html: "<!DOCTYPE html><html 123=456>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   123=\"456\"\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests14.dat #6"
-               html: "<!DOCTYPE html><html 123=456><html 789=012>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   123=\"456\"\n|   789=\"012\"\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests14.dat #7"
-               html: "<!DOCTYPE html><html><body 789=012>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     789=\"012\"\n"
-       }, {
-               name: "tests15.dat #1"
-               html: "<!DOCTYPE html><p><b><i><u></p> <p>X"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <b>\n|         <i>\n|           <u>\n|     <b>\n|       <i>\n|         <u>\n|           \" \"\n|           <p>\n|             \"X\"\n"
-       }, {
-               name: "tests15.dat #2"
-               html: "<p><b><i><u></p>\n<p>X"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <b>\n|         <i>\n|           <u>\n|     <b>\n|       <i>\n|         <u>\n|           \"\n\"\n|           <p>\n|             \"X\"\n"
-       }, {
-               name: "tests15.dat #3"
-               html: "<!doctype html></html> <head>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \" \"\n"
-       }, {
-               name: "tests15.dat #4"
-               html: "<!doctype html></body><meta>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <meta>\n"
-       }, {
-               name: "tests15.dat #5"
-               html: "<html></html><!-- foo -->"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n| <!--  foo  -->\n"
-       }, {
-               name: "tests15.dat #6"
-               html: "<!doctype html></body><title>X</title>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <title>\n|       \"X\"\n"
-       }, {
-               name: "tests15.dat #7"
-               html: "<!doctype html><table> X<meta></table>"
-               errors: 3
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \" X\"\n|     <meta>\n|     <table>\n"
-       }, {
-               name: "tests15.dat #8"
-               html: "<!doctype html><table> x</table>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \" x\"\n|     <table>\n"
-       }, {
-               name: "tests15.dat #9"
-               html: "<!doctype html><table> x </table>"
-               errors: 3
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \" x \"\n|     <table>\n"
-       }, {
-               name: "tests15.dat #10"
-               html: "<!doctype html><table><tr> x</table>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \" x\"\n|     <table>\n|       <tbody>\n|         <tr>\n"
-       }, {
-               name: "tests15.dat #11"
-               html: "<!doctype html><table>X<style> <tr>x </style> </table>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"X\"\n|     <table>\n|       <style>\n|         \" <tr>x \"\n|       \" \"\n"
-       }, {
-               name: "tests15.dat #12"
-               html: "<!doctype html><div><table><a>foo</a> <tr><td>bar</td> </tr></table></div>"
-               errors: 5
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <a>\n|         \"foo\"\n|       <table>\n|         \" \"\n|         <tbody>\n|           <tr>\n|             <td>\n|               \"bar\"\n|             \" \"\n"
-       }, {
-               name: "tests15.dat #13"
-               html: "<frame></frame></frame><frameset><frame><frameset><frame></frameset><noframes></frameset><noframes>"
-               errors: 7
-               expected: "| <html>\n|   <head>\n|   <frameset>\n|     <frame>\n|     <frameset>\n|       <frame>\n|     <noframes>\n|       \"</frameset><noframes>\"\n"
-       }, {
-               name: "tests15.dat #14"
-               html: "<!DOCTYPE html><object></html>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <object>\n"
-       }, {
-               name: "tests16.dat #1"
-               html: "<!doctype html><script>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|   <body>\n"
-       }, {
-               name: "tests16.dat #2"
-               html: "<!doctype html><script>a"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"a\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #3"
-               html: "<!doctype html><script><"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #4"
-               html: "<!doctype html><script></"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #5"
-               html: "<!doctype html><script></S"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</S\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #6"
-               html: "<!doctype html><script></SC"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</SC\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #7"
-               html: "<!doctype html><script></SCR"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</SCR\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #8"
-               html: "<!doctype html><script></SCRI"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</SCRI\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #9"
-               html: "<!doctype html><script></SCRIP"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</SCRIP\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #10"
-               html: "<!doctype html><script></SCRIPT"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</SCRIPT\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #11"
-               html: "<!doctype html><script></SCRIPT "
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|   <body>\n"
-       }, {
-               name: "tests16.dat #12"
-               html: "<!doctype html><script></s"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</s\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #13"
-               html: "<!doctype html><script></sc"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</sc\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #14"
-               html: "<!doctype html><script></scr"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</scr\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #15"
-               html: "<!doctype html><script></scri"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</scri\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #16"
-               html: "<!doctype html><script></scrip"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</scrip\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #17"
-               html: "<!doctype html><script></script"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"</script\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #18"
-               html: "<!doctype html><script></script "
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|   <body>\n"
-       }, {
-               name: "tests16.dat #19"
-               html: "<!doctype html><script><!"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #20"
-               html: "<!doctype html><script><!a"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!a\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #21"
-               html: "<!doctype html><script><!-"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!-\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #22"
-               html: "<!doctype html><script><!-a"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!-a\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #23"
-               html: "<!doctype html><script><!--"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #24"
-               html: "<!doctype html><script><!--a"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--a\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #25"
-               html: "<!doctype html><script><!--<"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #26"
-               html: "<!doctype html><script><!--<a"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<a\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #27"
-               html: "<!doctype html><script><!--</"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--</\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #28"
-               html: "<!doctype html><script><!--</script"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--</script\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #29"
-               html: "<!doctype html><script><!--</script "
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #30"
-               html: "<!doctype html><script><!--<s"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<s\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #31"
-               html: "<!doctype html><script><!--<script"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #32"
-               html: "<!doctype html><script><!--<script "
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script \"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #33"
-               html: "<!doctype html><script><!--<script <"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script <\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #34"
-               html: "<!doctype html><script><!--<script <a"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script <a\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #35"
-               html: "<!doctype html><script><!--<script </"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #36"
-               html: "<!doctype html><script><!--<script </s"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </s\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #37"
-               html: "<!doctype html><script><!--<script </script"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #38"
-               html: "<!doctype html><script><!--<script </scripta"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </scripta\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #39"
-               html: "<!doctype html><script><!--<script </script "
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script \"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #40"
-               html: "<!doctype html><script><!--<script </script>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script>\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #41"
-               html: "<!doctype html><script><!--<script </script/"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script/\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #42"
-               html: "<!doctype html><script><!--<script </script <"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script <\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #43"
-               html: "<!doctype html><script><!--<script </script <a"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script <a\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #44"
-               html: "<!doctype html><script><!--<script </script </"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script </\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #45"
-               html: "<!doctype html><script><!--<script </script </script"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script </script\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #46"
-               html: "<!doctype html><script><!--<script </script </script "
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script \"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #47"
-               html: "<!doctype html><script><!--<script </script </script/"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script \"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #48"
-               html: "<!doctype html><script><!--<script </script </script>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script \"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #49"
-               html: "<!doctype html><script><!--<script -"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #50"
-               html: "<!doctype html><script><!--<script -a"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -a\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #51"
-               html: "<!doctype html><script><!--<script -<"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -<\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #52"
-               html: "<!doctype html><script><!--<script --"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #53"
-               html: "<!doctype html><script><!--<script --a"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --a\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #54"
-               html: "<!doctype html><script><!--<script --<"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --<\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #55"
-               html: "<!doctype html><script><!--<script -->"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -->\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #56"
-               html: "<!doctype html><script><!--<script --><"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --><\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #57"
-               html: "<!doctype html><script><!--<script --></"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --></\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #58"
-               html: "<!doctype html><script><!--<script --></script"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --></script\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #59"
-               html: "<!doctype html><script><!--<script --></script "
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -->\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #60"
-               html: "<!doctype html><script><!--<script --></script/"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -->\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #61"
-               html: "<!doctype html><script><!--<script --></script>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -->\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #62"
-               html: "<!doctype html><script><!--<script><\\/script>--></script>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script><\\/script>-->\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #63"
-               html: "<!doctype html><script><!--<script></scr'+'ipt>--></script>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></scr'+'ipt>-->\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #64"
-               html: "<!doctype html><script><!--<script></script><script></script></script>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #65"
-               html: "<!doctype html><script><!--<script></script><script></script>--><!--</script>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>--><!--\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #66"
-               html: "<!doctype html><script><!--<script></script><script></script>-- ></script>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>-- >\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #67"
-               html: "<!doctype html><script><!--<script></script><script></script>- -></script>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>- ->\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #68"
-               html: "<!doctype html><script><!--<script></script><script></script>- - ></script>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>- - >\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #69"
-               html: "<!doctype html><script><!--<script></script><script></script>-></script>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>->\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #70"
-               html: "<!doctype html><script><!--<script>--!></script>X"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script>--!></script>X\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #71"
-               html: "<!doctype html><script><!--<scr'+'ipt></script>--></script>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<scr'+'ipt>\"\n|   <body>\n|     \"-->\"\n"
-       }, {
-               name: "tests16.dat #72"
-               html: "<!doctype html><script><!--<script></scr'+'ipt></script>X"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></scr'+'ipt></script>X\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #73"
-               html: "<!doctype html><style><!--<style></style>--></style>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <style>\n|       \"<!--<style>\"\n|   <body>\n|     \"-->\"\n"
-       }, {
-               name: "tests16.dat #74"
-               html: "<!doctype html><style><!--</style>X"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <style>\n|       \"<!--\"\n|   <body>\n|     \"X\"\n"
-       }, {
-               name: "tests16.dat #75"
-               html: "<!doctype html><style><!--...</style>...--></style>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <style>\n|       \"<!--...\"\n|   <body>\n|     \"...-->\"\n"
-       }, {
-               name: "tests16.dat #76"
-               html: "<!doctype html><style><!--<br><html xmlns:v=\"urn:schemas-microsoft-com:vml\"><!--[if !mso]><style></style>X"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <style>\n|       \"<!--<br><html xmlns:v=\"urn:schemas-microsoft-com:vml\"><!--[if !mso]><style>\"\n|   <body>\n|     \"X\"\n"
-       }, {
-               name: "tests16.dat #77"
-               html: "<!doctype html><style><!--...<style><!--...--!></style>--></style>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <style>\n|       \"<!--...<style><!--...--!>\"\n|   <body>\n|     \"-->\"\n"
-       }, {
-               name: "tests16.dat #78"
-               html: "<!doctype html><style><!--...</style><!-- --><style>@import ...</style>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <style>\n|       \"<!--...\"\n|     <!--   -->\n|     <style>\n|       \"@import ...\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #79"
-               html: "<!doctype html><style>...<style><!--...</style><!-- --></style>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <style>\n|       \"...<style><!--...\"\n|     <!--   -->\n|   <body>\n"
-       }, {
-               name: "tests16.dat #80"
-               html: "<!doctype html><style>...<!--[if IE]><style>...</style>X"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <style>\n|       \"...<!--[if IE]><style>...\"\n|   <body>\n|     \"X\"\n"
-       }, {
-               name: "tests16.dat #81"
-               html: "<!doctype html><title><!--<title></title>--></title>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <title>\n|       \"<!--<title>\"\n|   <body>\n|     \"-->\"\n"
-       }, {
-               name: "tests16.dat #82"
-               html: "<!doctype html><title>&lt;/title></title>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <title>\n|       \"</title>\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #83"
-               html: "<!doctype html><title>foo/title><link></head><body>X"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <title>\n|       \"foo/title><link></head><body>X\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #84"
-               html: "<!doctype html><noscript><!--<noscript></noscript>--></noscript>"
-               scripting: true
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noscript>\n|       \"<!--<noscript>\"\n|   <body>\n|     \"-->\"\n"
-       }, {
-               name: "tests16.dat #85"
-               html: "<!doctype html><noscript><!--<noscript></noscript>--></noscript>"
-               scripting: false
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noscript>\n|       <!-- <noscript></noscript> -->\n|   <body>\n"
-       }, {
-               name: "tests16.dat #86"
-               html: "<!doctype html><noscript><!--</noscript>X<noscript>--></noscript>"
-               scripting: true
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noscript>\n|       \"<!--\"\n|   <body>\n|     \"X\"\n|     <noscript>\n|       \"-->\"\n"
-       }, {
-               name: "tests16.dat #87"
-               html: "<!doctype html><noscript><!--</noscript>X<noscript>--></noscript>"
-               scripting: false
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noscript>\n|       <!-- </noscript>X<noscript> -->\n|   <body>\n"
-       }, {
-               name: "tests16.dat #88"
-               html: "<!doctype html><noscript><iframe></noscript>X"
-               scripting: true
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noscript>\n|       \"<iframe>\"\n|   <body>\n|     \"X\"\n"
-       }, {
-               name: "tests16.dat #89"
-               html: "<!doctype html><noscript><iframe></noscript>X"
-               scripting: false
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noscript>\n|   <body>\n|     <iframe>\n|       \"</noscript>X\"\n"
-       }, {
-               name: "tests16.dat #90"
-               html: "<!doctype html><noframes><!--<noframes></noframes>--></noframes>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noframes>\n|       \"<!--<noframes>\"\n|   <body>\n|     \"-->\"\n"
-       }, {
-               name: "tests16.dat #91"
-               html: "<!doctype html><noframes><body><script><!--...</script></body></noframes></html>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <noframes>\n|       \"<body><script><!--...</script></body>\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #92"
-               html: "<!doctype html><textarea><!--<textarea></textarea>--></textarea>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"<!--<textarea>\"\n|     \"-->\"\n"
-       }, {
-               name: "tests16.dat #93"
-               html: "<!doctype html><textarea>&lt;/textarea></textarea>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"</textarea>\"\n"
-       }, {
-               name: "tests16.dat #94"
-               html: "<!doctype html><textarea>&lt;</textarea>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"<\"\n"
-       }, {
-               name: "tests16.dat #95"
-               html: "<!doctype html><textarea>a&lt;b</textarea>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"a<b\"\n"
-       }, {
-               name: "tests16.dat #96"
-               html: "<!doctype html><iframe><!--<iframe></iframe>--></iframe>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <iframe>\n|       \"<!--<iframe>\"\n|     \"-->\"\n"
-       }, {
-               name: "tests16.dat #97"
-               html: "<!doctype html><iframe>...<!--X->...<!--/X->...</iframe>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <iframe>\n|       \"...<!--X->...<!--/X->...\"\n"
-       }, {
-               name: "tests16.dat #98"
-               html: "<!doctype html><xmp><!--<xmp></xmp>--></xmp>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <xmp>\n|       \"<!--<xmp>\"\n|     \"-->\"\n"
-       }, {
-               name: "tests16.dat #99"
-               html: "<!doctype html><noembed><!--<noembed></noembed>--></noembed>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <noembed>\n|       \"<!--<noembed>\"\n|     \"-->\"\n"
-       }, {
-               name: "tests16.dat #100"
-               html: "<script>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|   <body>\n"
-       }, {
-               name: "tests16.dat #101"
-               html: "<script>a"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"a\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #102"
-               html: "<script><"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #103"
-               html: "<script></"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #104"
-               html: "<script></S"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</S\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #105"
-               html: "<script></SC"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</SC\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #106"
-               html: "<script></SCR"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</SCR\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #107"
-               html: "<script></SCRI"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</SCRI\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #108"
-               html: "<script></SCRIP"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</SCRIP\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #109"
-               html: "<script></SCRIPT"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</SCRIPT\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #110"
-               html: "<script></SCRIPT "
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|   <body>\n"
-       }, {
-               name: "tests16.dat #111"
-               html: "<script></s"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</s\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #112"
-               html: "<script></sc"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</sc\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #113"
-               html: "<script></scr"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</scr\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #114"
-               html: "<script></scri"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</scri\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #115"
-               html: "<script></scrip"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</scrip\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #116"
-               html: "<script></script"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</script\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #117"
-               html: "<script></script "
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|   <body>\n"
-       }, {
-               name: "tests16.dat #118"
-               html: "<script><!"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #119"
-               html: "<script><!a"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!a\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #120"
-               html: "<script><!-"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!-\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #121"
-               html: "<script><!-a"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!-a\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #122"
-               html: "<script><!--"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #123"
-               html: "<script><!--a"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--a\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #124"
-               html: "<script><!--<"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #125"
-               html: "<script><!--<a"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<a\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #126"
-               html: "<script><!--</"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--</\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #127"
-               html: "<script><!--</script"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--</script\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #128"
-               html: "<script><!--</script "
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #129"
-               html: "<script><!--<s"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<s\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #130"
-               html: "<script><!--<script"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #131"
-               html: "<script><!--<script "
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script \"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #132"
-               html: "<script><!--<script <"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script <\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #133"
-               html: "<script><!--<script <a"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script <a\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #134"
-               html: "<script><!--<script </"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #135"
-               html: "<script><!--<script </s"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </s\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #136"
-               html: "<script><!--<script </script"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #137"
-               html: "<script><!--<script </scripta"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </scripta\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #138"
-               html: "<script><!--<script </script "
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script \"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #139"
-               html: "<script><!--<script </script>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script>\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #140"
-               html: "<script><!--<script </script/"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script/\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #141"
-               html: "<script><!--<script </script <"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script <\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #142"
-               html: "<script><!--<script </script <a"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script <a\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #143"
-               html: "<script><!--<script </script </"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script </\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #144"
-               html: "<script><!--<script </script </script"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script </script\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #145"
-               html: "<script><!--<script </script </script "
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script \"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #146"
-               html: "<script><!--<script </script </script/"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script \"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #147"
-               html: "<script><!--<script </script </script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script </script \"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #148"
-               html: "<script><!--<script -"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #149"
-               html: "<script><!--<script -a"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -a\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #150"
-               html: "<script><!--<script --"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #151"
-               html: "<script><!--<script --a"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --a\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #152"
-               html: "<script><!--<script -->"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -->\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #153"
-               html: "<script><!--<script --><"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --><\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #154"
-               html: "<script><!--<script --></"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --></\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #155"
-               html: "<script><!--<script --></script"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script --></script\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #156"
-               html: "<script><!--<script --></script "
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -->\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #157"
-               html: "<script><!--<script --></script/"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -->\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #158"
-               html: "<script><!--<script --></script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script -->\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #159"
-               html: "<script><!--<script><\\/script>--></script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script><\\/script>-->\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #160"
-               html: "<script><!--<script></scr'+'ipt>--></script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></scr'+'ipt>-->\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #161"
-               html: "<script><!--<script></script><script></script></script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #162"
-               html: "<script><!--<script></script><script></script>--><!--</script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>--><!--\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #163"
-               html: "<script><!--<script></script><script></script>-- ></script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>-- >\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #164"
-               html: "<script><!--<script></script><script></script>- -></script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>- ->\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #165"
-               html: "<script><!--<script></script><script></script>- - ></script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>- - >\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #166"
-               html: "<script><!--<script></script><script></script>-></script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></script><script></script>->\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #167"
-               html: "<script><!--<script>--!></script>X"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script>--!></script>X\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #168"
-               html: "<script><!--<scr'+'ipt></script>--></script>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<scr'+'ipt>\"\n|   <body>\n|     \"-->\"\n"
-       }, {
-               name: "tests16.dat #169"
-               html: "<script><!--<script></scr'+'ipt></script>X"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<!--<script></scr'+'ipt></script>X\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #170"
-               html: "<style><!--<style></style>--></style>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <style>\n|       \"<!--<style>\"\n|   <body>\n|     \"-->\"\n"
-       }, {
-               name: "tests16.dat #171"
-               html: "<style><!--</style>X"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <style>\n|       \"<!--\"\n|   <body>\n|     \"X\"\n"
-       }, {
-               name: "tests16.dat #172"
-               html: "<style><!--...</style>...--></style>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <style>\n|       \"<!--...\"\n|   <body>\n|     \"...-->\"\n"
-       }, {
-               name: "tests16.dat #173"
-               html: "<style><!--<br><html xmlns:v=\"urn:schemas-microsoft-com:vml\"><!--[if !mso]><style></style>X"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <style>\n|       \"<!--<br><html xmlns:v=\"urn:schemas-microsoft-com:vml\"><!--[if !mso]><style>\"\n|   <body>\n|     \"X\"\n"
-       }, {
-               name: "tests16.dat #174"
-               html: "<style><!--...<style><!--...--!></style>--></style>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <style>\n|       \"<!--...<style><!--...--!>\"\n|   <body>\n|     \"-->\"\n"
-       }, {
-               name: "tests16.dat #175"
-               html: "<style><!--...</style><!-- --><style>@import ...</style>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <style>\n|       \"<!--...\"\n|     <!--   -->\n|     <style>\n|       \"@import ...\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #176"
-               html: "<style>...<style><!--...</style><!-- --></style>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <style>\n|       \"...<style><!--...\"\n|     <!--   -->\n|   <body>\n"
-       }, {
-               name: "tests16.dat #177"
-               html: "<style>...<!--[if IE]><style>...</style>X"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <style>\n|       \"...<!--[if IE]><style>...\"\n|   <body>\n|     \"X\"\n"
-       }, {
-               name: "tests16.dat #178"
-               html: "<title><!--<title></title>--></title>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <title>\n|       \"<!--<title>\"\n|   <body>\n|     \"-->\"\n"
-       }, {
-               name: "tests16.dat #179"
-               html: "<title>&lt;/title></title>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <title>\n|       \"</title>\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #180"
-               html: "<title>foo/title><link></head><body>X"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <title>\n|       \"foo/title><link></head><body>X\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #181"
-               html: "<noscript><!--<noscript></noscript>--></noscript>"
-               scripting: true
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <noscript>\n|       \"<!--<noscript>\"\n|   <body>\n|     \"-->\"\n"
-       }, {
-               name: "tests16.dat #182"
-               html: "<noscript><!--<noscript></noscript>--></noscript>"
-               scripting: false
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <noscript>\n|       <!-- <noscript></noscript> -->\n|   <body>\n"
-       }, {
-               name: "tests16.dat #183"
-               html: "<noscript><!--</noscript>X<noscript>--></noscript>"
-               scripting: true
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <noscript>\n|       \"<!--\"\n|   <body>\n|     \"X\"\n|     <noscript>\n|       \"-->\"\n"
-       }, {
-               name: "tests16.dat #184"
-               html: "<noscript><!--</noscript>X<noscript>--></noscript>"
-               scripting: false
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <noscript>\n|       <!-- </noscript>X<noscript> -->\n|   <body>\n"
-       }, {
-               name: "tests16.dat #185"
-               html: "<noscript><iframe></noscript>X"
-               scripting: true
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <noscript>\n|       \"<iframe>\"\n|   <body>\n|     \"X\"\n"
-       }, {
-               name: "tests16.dat #186"
-               html: "<noscript><iframe></noscript>X"
-               scripting: false
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <noscript>\n|   <body>\n|     <iframe>\n|       \"</noscript>X\"\n"
-       }, {
-               name: "tests16.dat #187"
-               html: "<noframes><!--<noframes></noframes>--></noframes>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <noframes>\n|       \"<!--<noframes>\"\n|   <body>\n|     \"-->\"\n"
-       }, {
-               name: "tests16.dat #188"
-               html: "<noframes><body><script><!--...</script></body></noframes></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <noframes>\n|       \"<body><script><!--...</script></body>\"\n|   <body>\n"
-       }, {
-               name: "tests16.dat #189"
-               html: "<textarea><!--<textarea></textarea>--></textarea>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"<!--<textarea>\"\n|     \"-->\"\n"
-       }, {
-               name: "tests16.dat #190"
-               html: "<textarea>&lt;/textarea></textarea>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"</textarea>\"\n"
-       }, {
-               name: "tests16.dat #191"
-               html: "<iframe><!--<iframe></iframe>--></iframe>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <iframe>\n|       \"<!--<iframe>\"\n|     \"-->\"\n"
-       }, {
-               name: "tests16.dat #192"
-               html: "<iframe>...<!--X->...<!--/X->...</iframe>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <iframe>\n|       \"...<!--X->...<!--/X->...\"\n"
-       }, {
-               name: "tests16.dat #193"
-               html: "<xmp><!--<xmp></xmp>--></xmp>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <xmp>\n|       \"<!--<xmp>\"\n|     \"-->\"\n"
-       }, {
-               name: "tests16.dat #194"
-               html: "<noembed><!--<noembed></noembed>--></noembed>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <noembed>\n|       \"<!--<noembed>\"\n|     \"-->\"\n"
-       }, {
-               name: "tests16.dat #195"
-               html: "<!doctype html><table>\n"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       \"\n\"\n"
-       }, {
-               name: "tests16.dat #196"
-               html: "<!doctype html><table><td><span><font></span><span>"
-               errors: 3
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <span>\n|               <font>\n|             <font>\n|               <span>\n"
-       }, {
-               name: "tests16.dat #197"
-               html: "<!doctype html><form><table></form><form></table></form>"
-               errors: 5
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <form>\n|       <table>\n|         <form>\n"
-       }, {
-               name: "tests17.dat #1"
-               html: "<!doctype html><table><tbody><select><tr>"
-               errors: 3
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|     <table>\n|       <tbody>\n|         <tr>\n"
-       }, {
-               name: "tests17.dat #2"
-               html: "<!doctype html><table><tr><select><td>"
-               errors: 3
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n"
-       }, {
-               name: "tests17.dat #3"
-               html: "<!doctype html><table><tr><td><select><td>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <select>\n|           <td>\n"
-       }, {
-               name: "tests17.dat #4"
-               html: "<!doctype html><table><tr><th><select><td>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <th>\n|             <select>\n|           <td>\n"
-       }, {
-               name: "tests17.dat #5"
-               html: "<!doctype html><table><caption><select><tr>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <select>\n|       <tbody>\n|         <tr>\n"
-       }, {
-               name: "tests17.dat #6"
-               html: "<!doctype html><select><tr>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n"
-       }, {
-               name: "tests17.dat #7"
-               html: "<!doctype html><select><td>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n"
-       }, {
-               name: "tests17.dat #8"
-               html: "<!doctype html><select><th>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n"
-       }, {
-               name: "tests17.dat #9"
-               html: "<!doctype html><select><tbody>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n"
-       }, {
-               name: "tests17.dat #10"
-               html: "<!doctype html><select><thead>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n"
-       }, {
-               name: "tests17.dat #11"
-               html: "<!doctype html><select><tfoot>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n"
-       }, {
-               name: "tests17.dat #12"
-               html: "<!doctype html><select><caption>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n"
-       }, {
-               name: "tests17.dat #13"
-               html: "<!doctype html><table><tr></table>a"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|     \"a\"\n"
-       }, {
-               name: "tests18.dat #1"
-               html: "<!doctype html><plaintext></plaintext>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <plaintext>\n|       \"</plaintext>\"\n"
-       }, {
-               name: "tests18.dat #2"
-               html: "<!doctype html><table><plaintext></plaintext>"
-               errors: 14
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <plaintext>\n|       \"</plaintext>\"\n|     <table>\n"
-       }, {
-               name: "tests18.dat #3"
-               html: "<!doctype html><table><tbody><plaintext></plaintext>"
-               errors: 14
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <plaintext>\n|       \"</plaintext>\"\n|     <table>\n|       <tbody>\n"
-       }, {
-               name: "tests18.dat #4"
-               html: "<!doctype html><table><tbody><tr><plaintext></plaintext>"
-               errors: 14
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <plaintext>\n|       \"</plaintext>\"\n|     <table>\n|       <tbody>\n|         <tr>\n"
-       }, {
-               name: "tests18.dat #5"
-               html: "<!doctype html><table><td><plaintext></plaintext>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <plaintext>\n|               \"</plaintext>\"\n"
-       }, {
-               name: "tests18.dat #6"
-               html: "<!doctype html><table><caption><plaintext></plaintext>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <plaintext>\n|           \"</plaintext>\"\n"
-       }, {
-               name: "tests18.dat #7"
-               html: "<!doctype html><table><tr><style></script></style>abc"
-               errors: 4
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"abc\"\n|     <table>\n|       <tbody>\n|         <tr>\n|           <style>\n|             \"</script>\"\n"
-       }, {
-               name: "tests18.dat #8"
-               html: "<!doctype html><table><tr><script></style></script>abc"
-               errors: 4
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"abc\"\n|     <table>\n|       <tbody>\n|         <tr>\n|           <script>\n|             \"</style>\"\n"
-       }, {
-               name: "tests18.dat #9"
-               html: "<!doctype html><table><caption><style></script></style>abc"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <style>\n|           \"</script>\"\n|         \"abc\"\n"
-       }, {
-               name: "tests18.dat #10"
-               html: "<!doctype html><table><td><style></script></style>abc"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <style>\n|               \"</script>\"\n|             \"abc\"\n"
-       }, {
-               name: "tests18.dat #11"
-               html: "<!doctype html><select><script></style></script>abc"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <script>\n|         \"</style>\"\n|       \"abc\"\n"
-       }, {
-               name: "tests18.dat #12"
-               html: "<!doctype html><table><select><script></style></script>abc"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <script>\n|         \"</style>\"\n|       \"abc\"\n|     <table>\n"
-       }, {
-               name: "tests18.dat #13"
-               html: "<!doctype html><table><tr><select><script></style></script>abc"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <script>\n|         \"</style>\"\n|       \"abc\"\n|     <table>\n|       <tbody>\n|         <tr>\n"
-       }, {
-               name: "tests18.dat #14"
-               html: "<!doctype html><frameset></frameset><noframes>abc"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|   <noframes>\n|     \"abc\"\n"
-       }, {
-               name: "tests18.dat #15"
-               html: "<!doctype html><frameset></frameset><noframes>abc</noframes><!--abc-->"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|   <noframes>\n|     \"abc\"\n|   <!-- abc -->\n"
-       }, {
-               name: "tests18.dat #16"
-               html: "<!doctype html><frameset></frameset></html><noframes>abc"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|   <noframes>\n|     \"abc\"\n"
-       }, {
-               name: "tests18.dat #17"
-               html: "<!doctype html><frameset></frameset></html><noframes>abc</noframes><!--abc-->"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|   <noframes>\n|     \"abc\"\n| <!-- abc -->\n"
-       }, {
-               name: "tests18.dat #18"
-               html: "<!doctype html><table><tr></tbody><tfoot>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|       <tfoot>\n"
-       }, {
-               name: "tests18.dat #19"
-               html: "<!doctype html><table><td><svg></svg>abc<td>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <svg svg>\n|             \"abc\"\n|           <td>\n"
-       }, {
-               name: "tests19.dat #1"
-               html: "<!doctype html><math><mn DefinitionUrl=\"foo\">"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mn>\n|         definitionURL=\"foo\"\n"
-       }, {
-               name: "tests19.dat #2"
-               html: "<!doctype html><html></p><!--foo-->"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <!-- foo -->\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests19.dat #3"
-               html: "<!doctype html><head></head></p><!--foo-->"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <!-- foo -->\n|   <body>\n"
-       }, {
-               name: "tests19.dat #4"
-               html: "<!doctype html><body><p><pre>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <pre>\n"
-       }, {
-               name: "tests19.dat #5"
-               html: "<!doctype html><body><p><listing>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <listing>\n"
-       }, {
-               name: "tests19.dat #6"
-               html: "<!doctype html><p><plaintext>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <plaintext>\n"
-       }, {
-               name: "tests19.dat #7"
-               html: "<!doctype html><p><h1>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <h1>\n"
-       }, {
-               name: "tests19.dat #8"
-               html: "<!doctype html><form><isindex>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <form>\n"
-       }, {
-               name: "tests19.dat #9"
-               html: "<!doctype html><isindex action=\"POST\">"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <form>\n|       action=\"POST\"\n|       <hr>\n|       <label>\n|         \"This is a searchable index. Enter search keywords: \"\n|         <input>\n|           name=\"isindex\"\n|       <hr>\n"
-       }, {
-               name: "tests19.dat #10"
-               html: "<!doctype html><isindex prompt=\"this is isindex\">"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <form>\n|       <hr>\n|       <label>\n|         \"this is isindex\"\n|         <input>\n|           name=\"isindex\"\n|       <hr>\n"
-       }, {
-               name: "tests19.dat #11"
-               html: "<!doctype html><isindex type=\"hidden\">"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <form>\n|       <hr>\n|       <label>\n|         \"This is a searchable index. Enter search keywords: \"\n|         <input>\n|           name=\"isindex\"\n|           type=\"hidden\"\n|       <hr>\n"
-       }, {
-               name: "tests19.dat #12"
-               html: "<!doctype html><isindex name=\"foo\">"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <form>\n|       <hr>\n|       <label>\n|         \"This is a searchable index. Enter search keywords: \"\n|         <input>\n|           name=\"isindex\"\n|       <hr>\n"
-       }, {
-               name: "tests19.dat #13"
-               html: "<!doctype html><ruby><p><rp>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       <p>\n|       <rp>\n"
-       }, {
-               name: "tests19.dat #14"
-               html: "<!doctype html><ruby><div><span><rp>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       <div>\n|         <span>\n|           <rp>\n"
-       }, {
-               name: "tests19.dat #15"
-               html: "<!doctype html><ruby><div><p><rp>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       <div>\n|         <p>\n|         <rp>\n"
-       }, {
-               name: "tests19.dat #16"
-               html: "<!doctype html><ruby><p><rt>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       <p>\n|       <rt>\n"
-       }, {
-               name: "tests19.dat #17"
-               html: "<!doctype html><ruby><div><span><rt>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       <div>\n|         <span>\n|           <rt>\n"
-       }, {
-               name: "tests19.dat #18"
-               html: "<!doctype html><ruby><div><p><rt>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       <div>\n|         <p>\n|         <rt>\n"
-       }, {
-               name: "tests19.dat #19"
-               html: "<html><ruby>a<rb>b<rt></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rb>\n|         \"b\"\n|       <rt>\n"
-       }, {
-               name: "tests19.dat #20"
-               html: "<html><ruby>a<rp>b<rt></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rp>\n|         \"b\"\n|       <rt>\n"
-       }, {
-               name: "tests19.dat #21"
-               html: "<html><ruby>a<rt>b<rt></ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rt>\n|         \"b\"\n|       <rt>\n"
-       }, {
-               name: "tests19.dat #22"
-               html: "<html><ruby>a<rtc>b<rt>c<rb>d</ruby></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       \"a\"\n|       <rtc>\n|         \"b\"\n|         <rt>\n|           \"c\"\n|       <rb>\n|         \"d\"\n"
-       }, {
-               name: "tests19.dat #23"
-               html: "<!doctype html><math/><foo>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|     <foo>\n"
-       }, {
-               name: "tests19.dat #24"
-               html: "<!doctype html><svg/><foo>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|     <foo>\n"
-       }, {
-               name: "tests19.dat #25"
-               html: "<!doctype html><div></body><!--foo-->"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <div>\n|   <!-- foo -->\n"
-       }, {
-               name: "tests19.dat #26"
-               html: "<!doctype html><h1><div><h3><span></h1>foo"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <h1>\n|       <div>\n|         <h3>\n|           <span>\n|         \"foo\"\n"
-       }, {
-               name: "tests19.dat #27"
-               html: "<!doctype html><p></h3>foo"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       \"foo\"\n"
-       }, {
-               name: "tests19.dat #28"
-               html: "<!doctype html><h3><li>abc</h2>foo"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <h3>\n|       <li>\n|         \"abc\"\n|     \"foo\"\n"
-       }, {
-               name: "tests19.dat #29"
-               html: "<!doctype html><table>abc<!--foo-->"
-               errors: 4
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"abc\"\n|     <table>\n|       <!-- foo -->\n"
-       }, {
-               name: "tests19.dat #30"
-               html: "<!doctype html><table>  <!--foo-->"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       \"  \"\n|       <!-- foo -->\n"
-       }, {
-               name: "tests19.dat #31"
-               html: "<!doctype html><table> b <!--foo-->"
-               errors: 4
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \" b \"\n|     <table>\n|       <!-- foo -->\n"
-       }, {
-               name: "tests19.dat #32"
-               html: "<!doctype html><select><option><option>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n|       <option>\n"
-       }, {
-               name: "tests19.dat #33"
-               html: "<!doctype html><select><option></optgroup>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n"
-       }, {
-               name: "tests19.dat #34"
-               html: "<!doctype html><select><option></optgroup>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n"
-       }, {
-               name: "tests19.dat #35"
-               html: "<!doctype html><dd><optgroup><dd>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <dd>\n|       <optgroup>\n|     <dd>\n"
-       }, {
-               name: "tests19.dat #36"
-               html: "<!doctype html><p><math><mi><p><h1>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <math math>\n|         <math mi>\n|           <p>\n|           <h1>\n"
-       }, {
-               name: "tests19.dat #37"
-               html: "<!doctype html><p><math><mo><p><h1>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <math math>\n|         <math mo>\n|           <p>\n|           <h1>\n"
-       }, {
-               name: "tests19.dat #38"
-               html: "<!doctype html><p><math><mn><p><h1>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <math math>\n|         <math mn>\n|           <p>\n|           <h1>\n"
-       }, {
-               name: "tests19.dat #39"
-               html: "<!doctype html><p><math><ms><p><h1>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <math math>\n|         <math ms>\n|           <p>\n|           <h1>\n"
-       }, {
-               name: "tests19.dat #40"
-               html: "<!doctype html><p><math><mtext><p><h1>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <math math>\n|         <math mtext>\n|           <p>\n|           <h1>\n"
-       }, {
-               name: "tests19.dat #41"
-               html: "<!doctype html><frameset></noframes>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "tests19.dat #42"
-               html: "<!doctype html><html c=d><body></html><html a=b>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   a=\"b\"\n|   c=\"d\"\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests19.dat #43"
-               html: "<!doctype html><html c=d><frameset></frameset></html><html a=b>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   a=\"b\"\n|   c=\"d\"\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "tests19.dat #44"
-               html: "<!doctype html><html><frameset></frameset></html><!--foo-->"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n| <!-- foo -->\n"
-       }, {
-               name: "tests19.dat #45"
-               html: "<!doctype html><html><frameset></frameset></html>  "
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|   \"  \"\n"
-       }, {
-               name: "tests19.dat #46"
-               html: "<!doctype html><html><frameset></frameset></html>abc"
-               errors: 3
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "tests19.dat #47"
-               html: "<!doctype html><html><frameset></frameset></html><p>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "tests19.dat #48"
-               html: "<!doctype html><html><frameset></frameset></html></p>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "tests19.dat #49"
-               html: "<html><frameset></frameset></html><!doctype html>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "tests19.dat #50"
-               html: "<!doctype html><body><frameset>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests19.dat #51"
-               html: "<!doctype html><p><frameset><frame>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|     <frame>\n"
-       }, {
-               name: "tests19.dat #52"
-               html: "<!doctype html><p>a<frameset>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       \"a\"\n"
-       }, {
-               name: "tests19.dat #53"
-               html: "<!doctype html><p> <frameset><frame>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|     <frame>\n"
-       }, {
-               name: "tests19.dat #54"
-               html: "<!doctype html><pre><frameset>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n"
-       }, {
-               name: "tests19.dat #55"
-               html: "<!doctype html><listing><frameset>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <listing>\n"
-       }, {
-               name: "tests19.dat #56"
-               html: "<!doctype html><li><frameset>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <li>\n"
-       }, {
-               name: "tests19.dat #57"
-               html: "<!doctype html><dd><frameset>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <dd>\n"
-       }, {
-               name: "tests19.dat #58"
-               html: "<!doctype html><dt><frameset>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <dt>\n"
-       }, {
-               name: "tests19.dat #59"
-               html: "<!doctype html><button><frameset>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <button>\n"
-       }, {
-               name: "tests19.dat #60"
-               html: "<!doctype html><applet><frameset>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <applet>\n"
-       }, {
-               name: "tests19.dat #61"
-               html: "<!doctype html><marquee><frameset>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <marquee>\n"
-       }, {
-               name: "tests19.dat #62"
-               html: "<!doctype html><object><frameset>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <object>\n"
-       }, {
-               name: "tests19.dat #63"
-               html: "<!doctype html><table><frameset>"
-               errors: 3
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n"
-       }, {
-               name: "tests19.dat #64"
-               html: "<!doctype html><area><frameset>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <area>\n"
-       }, {
-               name: "tests19.dat #65"
-               html: "<!doctype html><basefont><frameset>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <basefont>\n|   <frameset>\n"
-       }, {
-               name: "tests19.dat #66"
-               html: "<!doctype html><bgsound><frameset>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <bgsound>\n|   <frameset>\n"
-       }, {
-               name: "tests19.dat #67"
-               html: "<!doctype html><br><frameset>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <br>\n"
-       }, {
-               name: "tests19.dat #68"
-               html: "<!doctype html><embed><frameset>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <embed>\n"
-       }, {
-               name: "tests19.dat #69"
-               html: "<!doctype html><img><frameset>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <img>\n"
-       }, {
-               name: "tests19.dat #70"
-               html: "<!doctype html><input><frameset>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <input>\n"
-       }, {
-               name: "tests19.dat #71"
-               html: "<!doctype html><keygen><frameset>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <keygen>\n"
-       }, {
-               name: "tests19.dat #72"
-               html: "<!doctype html><wbr><frameset>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <wbr>\n"
-       }, {
-               name: "tests19.dat #73"
-               html: "<!doctype html><hr><frameset>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <hr>\n"
-       }, {
-               name: "tests19.dat #74"
-               html: "<!doctype html><textarea></textarea><frameset>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <textarea>\n"
-       }, {
-               name: "tests19.dat #75"
-               html: "<!doctype html><xmp></xmp><frameset>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <xmp>\n"
-       }, {
-               name: "tests19.dat #76"
-               html: "<!doctype html><iframe></iframe><frameset>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <iframe>\n"
-       }, {
-               name: "tests19.dat #77"
-               html: "<!doctype html><select></select><frameset>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n"
-       }, {
-               name: "tests19.dat #78"
-               html: "<!doctype html><svg></svg><frameset><frame>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|     <frame>\n"
-       }, {
-               name: "tests19.dat #79"
-               html: "<!doctype html><math></math><frameset><frame>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|     <frame>\n"
-       }, {
-               name: "tests19.dat #80"
-               html: "<!doctype html><svg><foreignObject><div> <frameset><frame>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|     <frame>\n"
-       }, {
-               name: "tests19.dat #81"
-               html: "<!doctype html><svg>a</svg><frameset><frame>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"a\"\n"
-       }, {
-               name: "tests19.dat #82"
-               html: "<!doctype html><svg> </svg><frameset><frame>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|     <frame>\n"
-       }, {
-               name: "tests19.dat #83"
-               html: "<html>aaa<frameset></frameset>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"aaa\"\n"
-       }, {
-               name: "tests19.dat #84"
-               html: "<html> a <frameset></frameset>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"a \"\n"
-       }, {
-               name: "tests19.dat #85"
-               html: "<!doctype html><div><frameset>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "tests19.dat #86"
-               html: "<!doctype html><div><body><frameset>"
-               errors: 3
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <div>\n"
-       }, {
-               name: "tests19.dat #87"
-               html: "<!doctype html><p><math></p>a"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <math math>\n|     \"a\"\n"
-       }, {
-               name: "tests19.dat #88"
-               html: "<!doctype html><p><math><mn><span></p>a"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <math math>\n|         <math mn>\n|           <span>\n|             <p>\n|             \"a\"\n"
-       }, {
-               name: "tests19.dat #89"
-               html: "<!doctype html><math></html>"
-               errors: 3
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n"
-       }, {
-               name: "tests19.dat #90"
-               html: "<!doctype html><meta charset=\"ascii\">"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <meta>\n|       charset=\"ascii\"\n|   <body>\n"
-       }, {
-               name: "tests19.dat #91"
-               html: "<!doctype html><meta http-equiv=\"content-type\" content=\"text/html;charset=ascii\">"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <meta>\n|       content=\"text/html;charset=ascii\"\n|       http-equiv=\"content-type\"\n|   <body>\n"
-       }, {
-               name: "tests19.dat #92"
-               html: "<!doctype html><head><!--aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa--><meta charset=\"utf8\">"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <!-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -->\n|     <meta>\n|       charset=\"utf8\"\n|   <body>\n"
-       }, {
-               name: "tests19.dat #93"
-               html: "<!doctype html><html a=b><head></head><html c=d>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   a=\"b\"\n|   c=\"d\"\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests19.dat #94"
-               html: "<!doctype html><image/>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <img>\n"
-       }, {
-               name: "tests19.dat #95"
-               html: "<!doctype html>a<i>b<table>c<b>d</i>e</b>f"
-               errors: 9
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"a\"\n|     <i>\n|       \"bc\"\n|       <b>\n|         \"de\"\n|       \"f\"\n|       <table>\n"
-       }, {
-               name: "tests19.dat #96"
-               html: "<!doctype html><table><i>a<b>b<div>c<a>d</i>e</b>f"
-               errors: 17
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <i>\n|       \"a\"\n|       <b>\n|         \"b\"\n|     <b>\n|     <div>\n|       <b>\n|         <i>\n|           \"c\"\n|           <a>\n|             \"d\"\n|         <a>\n|           \"e\"\n|       <a>\n|         \"f\"\n|     <table>\n"
-       }, {
-               name: "tests19.dat #97"
-               html: "<!doctype html><i>a<b>b<div>c<a>d</i>e</b>f"
-               errors: 5
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <i>\n|       \"a\"\n|       <b>\n|         \"b\"\n|     <b>\n|     <div>\n|       <b>\n|         <i>\n|           \"c\"\n|           <a>\n|             \"d\"\n|         <a>\n|           \"e\"\n|       <a>\n|         \"f\"\n"
-       }, {
-               name: "tests19.dat #98"
-               html: "<!doctype html><table><i>a<b>b<div>c</i>"
-               errors: 9
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <i>\n|       \"a\"\n|       <b>\n|         \"b\"\n|     <b>\n|       <div>\n|         <i>\n|           \"c\"\n|     <table>\n"
-       }, {
-               name: "tests19.dat #99"
-               html: "<!doctype html><table><i>a<b>b<div>c<a>d</i>e</b>f"
-               errors: 17
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <i>\n|       \"a\"\n|       <b>\n|         \"b\"\n|     <b>\n|     <div>\n|       <b>\n|         <i>\n|           \"c\"\n|           <a>\n|             \"d\"\n|         <a>\n|           \"e\"\n|       <a>\n|         \"f\"\n|     <table>\n"
-       }, {
-               name: "tests19.dat #100"
-               html: "<!doctype html><table><i>a<div>b<tr>c<b>d</i>e"
-               errors: 11
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <i>\n|       \"a\"\n|       <div>\n|         \"b\"\n|     <i>\n|       \"c\"\n|       <b>\n|         \"d\"\n|     <b>\n|       \"e\"\n|     <table>\n|       <tbody>\n|         <tr>\n"
-       }, {
-               name: "tests19.dat #101"
-               html: "<!doctype html><table><td><table><i>a<div>b<b>c</i>d"
-               errors: 12
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <i>\n|               \"a\"\n|             <div>\n|               <i>\n|                 \"b\"\n|                 <b>\n|                   \"c\"\n|               <b>\n|                 \"d\"\n|             <table>\n"
-       }, {
-               name: "tests19.dat #102"
-               html: "<!doctype html><body><bgsound>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <bgsound>\n"
-       }, {
-               name: "tests19.dat #103"
-               html: "<!doctype html><body><basefont>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <basefont>\n"
-       }, {
-               name: "tests19.dat #104"
-               html: "<!doctype html><a><b></a><basefont>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <b>\n|     <basefont>\n"
-       }, {
-               name: "tests19.dat #105"
-               html: "<!doctype html><a><b></a><bgsound>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <b>\n|     <bgsound>\n"
-       }, {
-               name: "tests19.dat #106"
-               html: "<!doctype html><figcaption><article></figcaption>a"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <figcaption>\n|       <article>\n|     \"a\"\n"
-       }, {
-               name: "tests19.dat #107"
-               html: "<!doctype html><summary><article></summary>a"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <summary>\n|       <article>\n|     \"a\"\n"
-       }, {
-               name: "tests19.dat #108"
-               html: "<!doctype html><p><a><plaintext>b"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <a>\n|     <plaintext>\n|       <a>\n|         \"b\"\n"
-       }, {
-               name: "tests19.dat #109"
-               html: "<!DOCTYPE html><div>a<a></div>b<p>c</p>d"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"a\"\n|       <a>\n|     <a>\n|       \"b\"\n|       <p>\n|         \"c\"\n|       \"d\"\n"
-       }, {
-               name: "tests1.dat #1"
-               html: "Test"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"Test\"\n"
-       }, {
-               name: "tests1.dat #2"
-               html: "<p>One<p>Two"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       \"One\"\n|     <p>\n|       \"Two\"\n"
-       }, {
-               name: "tests1.dat #3"
-               html: "Line1<br>Line2<br>Line3<br>Line4"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"Line1\"\n|     <br>\n|     \"Line2\"\n|     <br>\n|     \"Line3\"\n|     <br>\n|     \"Line4\"\n"
-       }, {
-               name: "tests1.dat #4"
-               html: "<html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #5"
-               html: "<head>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #6"
-               html: "<body>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #7"
-               html: "<html><head>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #8"
-               html: "<html><head></head>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #9"
-               html: "<html><head></head><body>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #10"
-               html: "<html><head></head><body></body>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #11"
-               html: "<html><head><body></body></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #12"
-               html: "<html><head></body></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #13"
-               html: "<html><head><body></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #14"
-               html: "<html><body></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #15"
-               html: "<body></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #16"
-               html: "<head></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #17"
-               html: "</head>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #18"
-               html: "</body>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #19"
-               html: "</html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #20"
-               html: "<b><table><td><i></table>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <table>\n|         <tbody>\n|           <tr>\n|             <td>\n|               <i>\n"
-       }, {
-               name: "tests1.dat #21"
-               html: "<b><table><td></b><i></table>X"
-               errors: 5
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <table>\n|         <tbody>\n|           <tr>\n|             <td>\n|               <i>\n|       \"X\"\n"
-       }, {
-               name: "tests1.dat #22"
-               html: "<h1>Hello<h2>World"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <h1>\n|       \"Hello\"\n|     <h2>\n|       \"World\"\n"
-       }, {
-               name: "tests1.dat #23"
-               html: "<a><p>X<a>Y</a>Z</p></a>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|     <p>\n|       <a>\n|         \"X\"\n|       <a>\n|         \"Y\"\n|       \"Z\"\n"
-       }, {
-               name: "tests1.dat #24"
-               html: "<b><button>foo</b>bar"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|     <button>\n|       <b>\n|         \"foo\"\n|       \"bar\"\n"
-       }, {
-               name: "tests1.dat #25"
-               html: "<!DOCTYPE html><span><button>foo</span>bar"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <span>\n|       <button>\n|         \"foobar\"\n"
-       }, {
-               name: "tests1.dat #26"
-               html: "<p><b><div><marquee></p></b></div>X"
-               errors: 6
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <b>\n|     <div>\n|       <b>\n|         <marquee>\n|           <p>\n|           \"X\"\n"
-       }, {
-               name: "tests1.dat #27"
-               html: "<script><div></script></div><title><p></title><p><p>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"<div>\"\n|     <title>\n|       \"<p>\"\n|   <body>\n|     <p>\n|     <p>\n"
-       }, {
-               name: "tests1.dat #28"
-               html: "<!--><div>--<!-->"
-               errors: 4
-               expected: "| <!--  -->\n| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"--\"\n|       <!--  -->\n"
-       }, {
-               name: "tests1.dat #29"
-               html: "<p><hr></p>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <hr>\n|     <p>\n"
-       }, {
-               name: "tests1.dat #30"
-               html: "<select><b><option><select><option></b></select>X"
-               errors: 6
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n|     <option>\n|       \"X\"\n"
-       }, {
-               name: "tests1.dat #31"
-               html: "<a><table><td><a><table></table><a></tr><a></table><b>X</b>C<a>Y"
-               errors: 9
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <a>\n|       <table>\n|         <tbody>\n|           <tr>\n|             <td>\n|               <a>\n|                 <table>\n|               <a>\n|     <a>\n|       <b>\n|         \"X\"\n|       \"C\"\n|     <a>\n|       \"Y\"\n"
-       }, {
-               name: "tests1.dat #32"
-               html: "<a X>0<b>1<a Y>2"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       x=\"\"\n|       \"0\"\n|       <b>\n|         \"1\"\n|     <b>\n|       <a>\n|         y=\"\"\n|         \"2\"\n"
-       }, {
-               name: "tests1.dat #33"
-               html: "<!-----><font><div>hello<table>excite!<b>me!<th><i>please!</tr><!--X-->"
-               errors: 16
-               expected: "| <!-- - -->\n| <html>\n|   <head>\n|   <body>\n|     <font>\n|       <div>\n|         \"helloexcite!\"\n|         <b>\n|           \"me!\"\n|         <table>\n|           <tbody>\n|             <tr>\n|               <th>\n|                 <i>\n|                   \"please!\"\n|             <!-- X -->\n"
-       }, {
-               name: "tests1.dat #34"
-               html: "<!DOCTYPE html><li>hello<li>world<ul>how<li>do</ul>you</body><!--do-->"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <li>\n|       \"hello\"\n|     <li>\n|       \"world\"\n|       <ul>\n|         \"how\"\n|         <li>\n|           \"do\"\n|       \"you\"\n|   <!-- do -->\n"
-       }, {
-               name: "tests1.dat #35"
-               html: "<!DOCTYPE html>A<option>B<optgroup>C<select>D</option>E"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"A\"\n|     <option>\n|       \"B\"\n|     <optgroup>\n|       \"C\"\n|       <select>\n|         \"DE\"\n"
-       }, {
-               name: "tests1.dat #36"
-               html: "<"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"<\"\n"
-       }, {
-               name: "tests1.dat #37"
-               html: "<#"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"<#\"\n"
-       }, {
-               name: "tests1.dat #38"
-               html: "</"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"</\"\n"
-       }, {
-               name: "tests1.dat #39"
-               html: "</#"
-               errors: 2
-               expected: "| <!-- # -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #40"
-               html: "<?"
-               errors: 2
-               expected: "| <!-- ? -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #41"
-               html: "<?#"
-               errors: 2
-               expected: "| <!-- ?# -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #42"
-               html: "<!"
-               errors: 2
-               expected: "| <!--  -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #43"
-               html: "<!#"
-               errors: 2
-               expected: "| <!-- # -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #44"
-               html: "<?COMMENT?>"
-               errors: 2
-               expected: "| <!-- ?COMMENT? -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #45"
-               html: "<!COMMENT>"
-               errors: 2
-               expected: "| <!-- COMMENT -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #46"
-               html: "</ COMMENT >"
-               errors: 2
-               expected: "| <!--  COMMENT  -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #47"
-               html: "<?COM--MENT?>"
-               errors: 2
-               expected: "| <!-- ?COM--MENT? -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #48"
-               html: "<!COM--MENT>"
-               errors: 2
-               expected: "| <!-- COM--MENT -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #49"
-               html: "</ COM--MENT >"
-               errors: 2
-               expected: "| <!--  COM--MENT  -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #50"
-               html: "<!DOCTYPE html><style> EOF"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <style>\n|       \" EOF\"\n|   <body>\n"
-       }, {
-               name: "tests1.dat #51"
-               html: "<!DOCTYPE html><script> <!-- </script> --> </script> EOF"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \" <!-- \"\n|     \" \"\n|   <body>\n|     \"-->  EOF\"\n"
-       }, {
-               name: "tests1.dat #52"
-               html: "<b><p></b>TEST"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|     <p>\n|       <b>\n|       \"TEST\"\n"
-       }, {
-               name: "tests1.dat #53"
-               html: "<p id=a><b><p id=b></b>TEST"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       id=\"a\"\n|       <b>\n|     <p>\n|       id=\"b\"\n|       \"TEST\"\n"
-       }, {
-               name: "tests1.dat #54"
-               html: "<b id=a><p><b id=b></p></b>TEST"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       id=\"a\"\n|       <p>\n|         <b>\n|           id=\"b\"\n|       \"TEST\"\n"
-       }, {
-               name: "tests1.dat #55"
-               html: "<!DOCTYPE html><title>U-test</title><body><div><p>Test<u></p></div></body>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <title>\n|       \"U-test\"\n|   <body>\n|     <div>\n|       <p>\n|         \"Test\"\n|         <u>\n"
-       }, {
-               name: "tests1.dat #56"
-               html: "<!DOCTYPE html><font><table></font></table></font>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <font>\n|       <table>\n"
-       }, {
-               name: "tests1.dat #57"
-               html: "<font><p>hello<b>cruel</font>world"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <font>\n|     <p>\n|       <font>\n|         \"hello\"\n|         <b>\n|           \"cruel\"\n|       <b>\n|         \"world\"\n"
-       }, {
-               name: "tests1.dat #58"
-               html: "<b>Test</i>Test"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       \"TestTest\"\n"
-       }, {
-               name: "tests1.dat #59"
-               html: "<b>A<cite>B<div>C"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       \"A\"\n|       <cite>\n|         \"B\"\n|         <div>\n|           \"C\"\n"
-       }, {
-               name: "tests1.dat #60"
-               html: "<b>A<cite>B<div>C</cite>D"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       \"A\"\n|       <cite>\n|         \"B\"\n|         <div>\n|           \"CD\"\n"
-       }, {
-               name: "tests1.dat #61"
-               html: "<b>A<cite>B<div>C</b>D"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       \"A\"\n|       <cite>\n|         \"B\"\n|     <div>\n|       <b>\n|         \"C\"\n|       \"D\"\n"
-       }, {
-               name: "tests1.dat #62"
-               html: ""
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #63"
-               html: "<DIV>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n"
-       }, {
-               name: "tests1.dat #64"
-               html: "<DIV> abc"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc\"\n"
-       }, {
-               name: "tests1.dat #65"
-               html: "<DIV> abc <B>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n"
-       }, {
-               name: "tests1.dat #66"
-               html: "<DIV> abc <B> def"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def\"\n"
-       }, {
-               name: "tests1.dat #67"
-               html: "<DIV> abc <B> def <I>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def \"\n|         <i>\n"
-       }, {
-               name: "tests1.dat #68"
-               html: "<DIV> abc <B> def <I> ghi"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def \"\n|         <i>\n|           \" ghi\"\n"
-       }, {
-               name: "tests1.dat #69"
-               html: "<DIV> abc <B> def <I> ghi <P>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def \"\n|         <i>\n|           \" ghi \"\n|           <p>\n"
-       }, {
-               name: "tests1.dat #70"
-               html: "<DIV> abc <B> def <I> ghi <P> jkl"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def \"\n|         <i>\n|           \" ghi \"\n|           <p>\n|             \" jkl\"\n"
-       }, {
-               name: "tests1.dat #71"
-               html: "<DIV> abc <B> def <I> ghi <P> jkl </B>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def \"\n|         <i>\n|           \" ghi \"\n|       <i>\n|         <p>\n|           <b>\n|             \" jkl \"\n"
-       }, {
-               name: "tests1.dat #72"
-               html: "<DIV> abc <B> def <I> ghi <P> jkl </B> mno"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def \"\n|         <i>\n|           \" ghi \"\n|       <i>\n|         <p>\n|           <b>\n|             \" jkl \"\n|           \" mno\"\n"
-       }, {
-               name: "tests1.dat #73"
-               html: "<DIV> abc <B> def <I> ghi <P> jkl </B> mno </I>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def \"\n|         <i>\n|           \" ghi \"\n|       <i>\n|       <p>\n|         <i>\n|           <b>\n|             \" jkl \"\n|           \" mno \"\n"
-       }, {
-               name: "tests1.dat #74"
-               html: "<DIV> abc <B> def <I> ghi <P> jkl </B> mno </I> pqr"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def \"\n|         <i>\n|           \" ghi \"\n|       <i>\n|       <p>\n|         <i>\n|           <b>\n|             \" jkl \"\n|           \" mno \"\n|         \" pqr\"\n"
-       }, {
-               name: "tests1.dat #75"
-               html: "<DIV> abc <B> def <I> ghi <P> jkl </B> mno </I> pqr </P>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def \"\n|         <i>\n|           \" ghi \"\n|       <i>\n|       <p>\n|         <i>\n|           <b>\n|             \" jkl \"\n|           \" mno \"\n|         \" pqr \"\n"
-       }, {
-               name: "tests1.dat #76"
-               html: "<DIV> abc <B> def <I> ghi <P> jkl </B> mno </I> pqr </P> stu"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \" abc \"\n|       <b>\n|         \" def \"\n|         <i>\n|           \" ghi \"\n|       <i>\n|       <p>\n|         <i>\n|           <b>\n|             \" jkl \"\n|           \" mno \"\n|         \" pqr \"\n|       \" stu\"\n"
-       }, {
-               name: "tests1.dat #77"
-               html: "<test attribute---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <test>\n|       attribute----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------=\"\"\n"
-       }, {
-               name: "tests1.dat #78"
-               html: "<a href=\"blah\">aba<table><a href=\"foo\">br<tr><td></td></tr>x</table>aoe"
-               errors: 8
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       href=\"blah\"\n|       \"aba\"\n|       <a>\n|         href=\"foo\"\n|         \"br\"\n|       <a>\n|         href=\"foo\"\n|         \"x\"\n|       <table>\n|         <tbody>\n|           <tr>\n|             <td>\n|     <a>\n|       href=\"foo\"\n|       \"aoe\"\n"
-       }, {
-               name: "tests1.dat #79"
-               html: "<a href=\"blah\">aba<table><tr><td><a href=\"foo\">br</td></tr>x</table>aoe"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       href=\"blah\"\n|       \"abax\"\n|       <table>\n|         <tbody>\n|           <tr>\n|             <td>\n|               <a>\n|                 href=\"foo\"\n|                 \"br\"\n|       \"aoe\"\n"
-       }, {
-               name: "tests1.dat #80"
-               html: "<table><a href=\"blah\">aba<tr><td><a href=\"foo\">br</td></tr>x</table>aoe"
-               errors: 8
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       href=\"blah\"\n|       \"aba\"\n|     <a>\n|       href=\"blah\"\n|       \"x\"\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <a>\n|               href=\"foo\"\n|               \"br\"\n|     <a>\n|       href=\"blah\"\n|       \"aoe\"\n"
-       }, {
-               name: "tests1.dat #81"
-               html: "<a href=a>aa<marquee>aa<a href=b>bb</marquee>aa"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       href=\"a\"\n|       \"aa\"\n|       <marquee>\n|         \"aa\"\n|         <a>\n|           href=\"b\"\n|           \"bb\"\n|       \"aa\"\n"
-       }, {
-               name: "tests1.dat #82"
-               html: "<wbr><strike><code></strike><code><strike></code>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <wbr>\n|     <strike>\n|       <code>\n|     <code>\n|       <code>\n|         <strike>\n"
-       }, {
-               name: "tests1.dat #83"
-               html: "<!DOCTYPE html><spacer>foo"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <spacer>\n|       \"foo\"\n"
-       }, {
-               name: "tests1.dat #84"
-               html: "<title><meta></title><link><title><meta></title>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <title>\n|       \"<meta>\"\n|     <link>\n|     <title>\n|       \"<meta>\"\n|   <body>\n"
-       }, {
-               name: "tests1.dat #85"
-               html: "<style><!--</style><meta><script>--><link></script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <style>\n|       \"<!--\"\n|     <meta>\n|     <script>\n|       \"--><link>\"\n|   <body>\n"
-       }, {
-               name: "tests1.dat #86"
-               html: "<head><meta></head><link>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <meta>\n|     <link>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #87"
-               html: "<table><tr><tr><td><td><span><th><span>X</table>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|         <tr>\n|           <td>\n|           <td>\n|             <span>\n|           <th>\n|             <span>\n|               \"X\"\n"
-       }, {
-               name: "tests1.dat #88"
-               html: "<body><body><base><link><meta><title><p></title><body><p></body>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <base>\n|     <link>\n|     <meta>\n|     <title>\n|       \"<p>\"\n|     <p>\n"
-       }, {
-               name: "tests1.dat #89"
-               html: "<textarea><p></textarea>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"<p>\"\n"
-       }, {
-               name: "tests1.dat #90"
-               html: "<p><image></p>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <img>\n"
-       }, {
-               name: "tests1.dat #91"
-               html: "<a><table><a></table><p><a><div><a>"
-               errors: 10
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <a>\n|       <table>\n|     <p>\n|       <a>\n|     <div>\n|       <a>\n"
-       }, {
-               name: "tests1.dat #92"
-               html: "<head></p><meta><p>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <meta>\n|   <body>\n|     <p>\n"
-       }, {
-               name: "tests1.dat #93"
-               html: "<head></html><meta><p>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <meta>\n|     <p>\n"
-       }, {
-               name: "tests1.dat #94"
-               html: "<b><table><td><i></table>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <table>\n|         <tbody>\n|           <tr>\n|             <td>\n|               <i>\n"
-       }, {
-               name: "tests1.dat #95"
-               html: "<b><table><td></b><i></table>"
-               errors: 5
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <table>\n|         <tbody>\n|           <tr>\n|             <td>\n|               <i>\n"
-       }, {
-               name: "tests1.dat #96"
-               html: "<h1><h2>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <h1>\n|     <h2>\n"
-       }, {
-               name: "tests1.dat #97"
-               html: "<a><p><a></a></p></a>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|     <p>\n|       <a>\n|       <a>\n"
-       }, {
-               name: "tests1.dat #98"
-               html: "<b><button></b></button></b>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|     <button>\n|       <b>\n"
-       }, {
-               name: "tests1.dat #99"
-               html: "<p><b><div><marquee></p></b></div>"
-               errors: 6
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <b>\n|     <div>\n|       <b>\n|         <marquee>\n|           <p>\n"
-       }, {
-               name: "tests1.dat #100"
-               html: "<script></script></div><title></title><p><p>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|     <title>\n|   <body>\n|     <p>\n|     <p>\n"
-       }, {
-               name: "tests1.dat #101"
-               html: "<p><hr></p>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <hr>\n|     <p>\n"
-       }, {
-               name: "tests1.dat #102"
-               html: "<select><b><option><select><option></b></select>"
-               errors: 6
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n|     <option>\n"
-       }, {
-               name: "tests1.dat #103"
-               html: "<html><head><title></title><body></body></html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <title>\n|   <body>\n"
-       }, {
-               name: "tests1.dat #104"
-               html: "<a><table><td><a><table></table><a></tr><a></table><a>"
-               errors: 10
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <a>\n|       <table>\n|         <tbody>\n|           <tr>\n|             <td>\n|               <a>\n|                 <table>\n|               <a>\n|     <a>\n"
-       }, {
-               name: "tests1.dat #105"
-               html: "<ul><li></li><div><li></div><li><li><div><li><address><li><b><em></b><li></ul>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ul>\n|       <li>\n|       <div>\n|         <li>\n|       <li>\n|       <li>\n|         <div>\n|       <li>\n|         <address>\n|       <li>\n|         <b>\n|           <em>\n|       <li>\n"
-       }, {
-               name: "tests1.dat #106"
-               html: "<ul><li><ul></li><li>a</li></ul></li></ul>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ul>\n|       <li>\n|         <ul>\n|           <li>\n|             \"a\"\n"
-       }, {
-               name: "tests1.dat #107"
-               html: "<frameset><frame><frameset><frame></frameset><noframes></noframes></frameset>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <frameset>\n|     <frame>\n|     <frameset>\n|       <frame>\n|     <noframes>\n"
-       }, {
-               name: "tests1.dat #108"
-               html: "<h1><table><td><h3></table><h3></h1>"
-               errors: 5
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <h1>\n|       <table>\n|         <tbody>\n|           <tr>\n|             <td>\n|               <h3>\n|     <h3>\n"
-       }, {
-               name: "tests1.dat #109"
-               html: "<table><colgroup><col><colgroup><col><col><col><colgroup><col><col><thead><tr><td></table>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <colgroup>\n|         <col>\n|       <colgroup>\n|         <col>\n|         <col>\n|         <col>\n|       <colgroup>\n|         <col>\n|         <col>\n|       <thead>\n|         <tr>\n|           <td>\n"
-       }, {
-               name: "tests1.dat #110"
-               html: "<table><col><tbody><col><tr><col><td><col></table><col>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <colgroup>\n|         <col>\n|       <tbody>\n|       <colgroup>\n|         <col>\n|       <tbody>\n|         <tr>\n|       <colgroup>\n|         <col>\n|       <tbody>\n|         <tr>\n|           <td>\n|       <colgroup>\n|         <col>\n"
-       }, {
-               name: "tests1.dat #111"
-               html: "<table><colgroup><tbody><colgroup><tr><colgroup><td><colgroup></table><colgroup>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <colgroup>\n|       <tbody>\n|       <colgroup>\n|       <tbody>\n|         <tr>\n|       <colgroup>\n|       <tbody>\n|         <tr>\n|           <td>\n|       <colgroup>\n"
-       }, {
-               name: "tests1.dat #112"
-               html: "</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: 85
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <br>\n|     <p>\n"
-       }, {
-               name: "tests1.dat #113"
-               html: "<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: 111
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <br>\n|     <table>\n|       <tbody>\n|         <tr>\n|     <p>\n"
-       }, {
-               name: "tests1.dat #114"
-               html: "<frameset>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "tests20.dat #1"
-               html: "<!doctype html><p><button><button>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|       <button>\n"
-       }, {
-               name: "tests20.dat #2"
-               html: "<!doctype html><p><button><address>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <address>\n"
-       }, {
-               name: "tests20.dat #3"
-               html: "<!doctype html><p><button><blockquote>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <blockquote>\n"
-       }, {
-               name: "tests20.dat #4"
-               html: "<!doctype html><p><button><menu>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <menu>\n"
-       }, {
-               name: "tests20.dat #5"
-               html: "<!doctype html><p><button><p>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <p>\n"
-       }, {
-               name: "tests20.dat #6"
-               html: "<!doctype html><p><button><ul>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <ul>\n"
-       }, {
-               name: "tests20.dat #7"
-               html: "<!doctype html><p><button><h1>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <h1>\n"
-       }, {
-               name: "tests20.dat #8"
-               html: "<!doctype html><p><button><h6>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <h6>\n"
-       }, {
-               name: "tests20.dat #9"
-               html: "<!doctype html><p><button><listing>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <listing>\n"
-       }, {
-               name: "tests20.dat #10"
-               html: "<!doctype html><p><button><pre>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <pre>\n"
-       }, {
-               name: "tests20.dat #11"
-               html: "<!doctype html><p><button><form>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <form>\n"
-       }, {
-               name: "tests20.dat #12"
-               html: "<!doctype html><p><button><li>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <li>\n"
-       }, {
-               name: "tests20.dat #13"
-               html: "<!doctype html><p><button><dd>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <dd>\n"
-       }, {
-               name: "tests20.dat #14"
-               html: "<!doctype html><p><button><dt>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <dt>\n"
-       }, {
-               name: "tests20.dat #15"
-               html: "<!doctype html><p><button><plaintext>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <plaintext>\n"
-       }, {
-               name: "tests20.dat #16"
-               html: "<!doctype html><p><button><table>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <table>\n"
-       }, {
-               name: "tests20.dat #17"
-               html: "<!doctype html><p><button><hr>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <hr>\n"
-       }, {
-               name: "tests20.dat #18"
-               html: "<!doctype html><p><button><xmp>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <xmp>\n"
-       }, {
-               name: "tests20.dat #19"
-               html: "<!doctype html><p><button></p>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <button>\n|         <p>\n"
-       }, {
-               name: "tests20.dat #20"
-               html: "<!doctype html><address><button></address>a"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <address>\n|       <button>\n|     \"a\"\n"
-       }, {
-               name: "tests20.dat #21"
-               html: "<!doctype html><address><button></address>a"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <address>\n|       <button>\n|     \"a\"\n"
-       }, {
-               name: "tests20.dat #22"
-               html: "<p><table></p>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <p>\n|       <table>\n"
-       }, {
-               name: "tests20.dat #23"
-               html: "<!doctype html><svg>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n"
-       }, {
-               name: "tests20.dat #24"
-               html: "<!doctype html><p><figcaption>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <figcaption>\n"
-       }, {
-               name: "tests20.dat #25"
-               html: "<!doctype html><p><summary>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <summary>\n"
-       }, {
-               name: "tests20.dat #26"
-               html: "<!doctype html><form><table><form>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <form>\n|       <table>\n"
-       }, {
-               name: "tests20.dat #27"
-               html: "<!doctype html><table><form><form>"
-               errors: 3
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <form>\n"
-       }, {
-               name: "tests20.dat #28"
-               html: "<!doctype html><table><form></table><form>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <form>\n"
-       }, {
-               name: "tests20.dat #29"
-               html: "<!doctype html><svg><foreignObject><p>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg foreignObject>\n|         <p>\n"
-       }, {
-               name: "tests20.dat #30"
-               html: "<!doctype html><svg><title>abc"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg title>\n|         \"abc\"\n"
-       }, {
-               name: "tests20.dat #31"
-               html: "<option><span><option>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <option>\n|       <span>\n|         <option>\n"
-       }, {
-               name: "tests20.dat #32"
-               html: "<option><option>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <option>\n|     <option>\n"
-       }, {
-               name: "tests20.dat #33"
-               html: "<math><annotation-xml><div>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|     <div>\n"
-       }, {
-               name: "tests20.dat #34"
-               html: "<math><annotation-xml encoding=\"application/svg+xml\"><div>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|         encoding=\"application/svg+xml\"\n|     <div>\n"
-       }, {
-               name: "tests20.dat #35"
-               html: "<math><annotation-xml encoding=\"application/xhtml+xml\"><div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|         encoding=\"application/xhtml+xml\"\n|         <div>\n"
-       }, {
-               name: "tests20.dat #36"
-               html: "<math><annotation-xml encoding=\"aPPlication/xhtmL+xMl\"><div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|         encoding=\"aPPlication/xhtmL+xMl\"\n|         <div>\n"
-       }, {
-               name: "tests20.dat #37"
-               html: "<math><annotation-xml encoding=\"text/html\"><div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|         encoding=\"text/html\"\n|         <div>\n"
-       }, {
-               name: "tests20.dat #38"
-               html: "<math><annotation-xml encoding=\"Text/htmL\"><div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|         encoding=\"Text/htmL\"\n|         <div>\n"
-       }, {
-               name: "tests20.dat #39"
-               html: "<math><annotation-xml encoding=\" text/html \"><div>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|         encoding=\" text/html \"\n|     <div>\n"
-       }, {
-               name: "tests21.dat #1"
-               html: "<svg><![CDATA[foo]]>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"foo\"\n"
-       }, {
-               name: "tests21.dat #2"
-               html: "<math><![CDATA[foo]]>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       \"foo\"\n"
-       }, {
-               name: "tests21.dat #3"
-               html: "<div><![CDATA[foo]]>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <!-- [CDATA[foo]] -->\n"
-       }, {
-               name: "tests21.dat #4"
-               html: "<svg><![CDATA[foo"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"foo\"\n"
-       }, {
-               name: "tests21.dat #5"
-               html: "<svg><![CDATA[foo"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"foo\"\n"
-       }, {
-               name: "tests21.dat #6"
-               html: "<svg><![CDATA["
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n"
-       }, {
-               name: "tests21.dat #7"
-               html: "<svg><![CDATA[]]>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n"
-       }, {
-               name: "tests21.dat #8"
-               html: "<svg><![CDATA[]] >]]>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"]] >\"\n"
-       }, {
-               name: "tests21.dat #9"
-               html: "<svg><![CDATA[]] >]]>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"]] >\"\n"
-       }, {
-               name: "tests21.dat #10"
-               html: "<svg><![CDATA[]]"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"]]\"\n"
-       }, {
-               name: "tests21.dat #11"
-               html: "<svg><![CDATA[]"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"]\"\n"
-       }, {
-               name: "tests21.dat #12"
-               html: "<svg><![CDATA[]>a"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"]>a\"\n"
-       }, {
-               name: "tests21.dat #13"
-               html: "<!DOCTYPE html><svg><![CDATA[foo]]]>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"foo]\"\n"
-       }, {
-               name: "tests21.dat #14"
-               html: "<!DOCTYPE html><svg><![CDATA[foo]]]]>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"foo]]\"\n"
-       }, {
-               name: "tests21.dat #15"
-               html: "<!DOCTYPE html><svg><![CDATA[foo]]]]]>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"foo]]]\"\n"
-       }, {
-               name: "tests21.dat #16"
-               html: "<svg><foreignObject><div><![CDATA[foo]]>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg foreignObject>\n|         <div>\n|           <!-- [CDATA[foo]] -->\n"
-       }, {
-               name: "tests21.dat #17"
-               html: "<svg><![CDATA[<svg>]]>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"<svg>\"\n"
-       }, {
-               name: "tests21.dat #18"
-               html: "<svg><![CDATA[</svg>a]]>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"</svg>a\"\n"
-       }, {
-               name: "tests21.dat #19"
-               html: "<svg><![CDATA[<svg>a"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"<svg>a\"\n"
-       }, {
-               name: "tests21.dat #20"
-               html: "<svg><![CDATA[</svg>a"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"</svg>a\"\n"
-       }, {
-               name: "tests21.dat #21"
-               html: "<svg><![CDATA[<svg>]]><path>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"<svg>\"\n|       <svg path>\n"
-       }, {
-               name: "tests21.dat #22"
-               html: "<svg><![CDATA[<svg>]]></path>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"<svg>\"\n"
-       }, {
-               name: "tests21.dat #23"
-               html: "<svg><![CDATA[<svg>]]><!--path-->"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"<svg>\"\n|       <!-- path -->\n"
-       }, {
-               name: "tests21.dat #24"
-               html: "<svg><![CDATA[<svg>]]>path"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"<svg>path\"\n"
-       }, {
-               name: "tests21.dat #25"
-               html: "<svg><![CDATA[<!--svg-->]]>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       \"<!--svg-->\"\n"
-       }, {
-               name: "tests22.dat #1"
-               html: "<a><b><big><em><strong><div>X</a>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <b>\n|         <big>\n|           <em>\n|             <strong>\n|     <big>\n|       <em>\n|         <strong>\n|           <div>\n|             <a>\n|               \"X\"\n"
-       }, {
-               name: "tests22.dat #2"
-               html: "<a><b><div id=1><div id=2><div id=3><div id=4><div id=5><div id=6><div id=7><div id=8>A</a>"
-               errors: 10
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <b>\n|     <b>\n|       <div>\n|         id=\"1\"\n|         <a>\n|         <div>\n|           id=\"2\"\n|           <a>\n|           <div>\n|             id=\"3\"\n|             <a>\n|             <div>\n|               id=\"4\"\n|               <a>\n|               <div>\n|                 id=\"5\"\n|                 <a>\n|                 <div>\n|                   id=\"6\"\n|                   <a>\n|                   <div>\n|                     id=\"7\"\n|                     <a>\n|                     <div>\n|                       id=\"8\"\n|                       <a>\n|                         \"A\"\n"
-       }, {
-               name: "tests22.dat #3"
-               html: "<a><b><div id=1><div id=2><div id=3><div id=4><div id=5><div id=6><div id=7><div id=8><div id=9>A</a>"
-               errors: 10
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <b>\n|     <b>\n|       <div>\n|         id=\"1\"\n|         <a>\n|         <div>\n|           id=\"2\"\n|           <a>\n|           <div>\n|             id=\"3\"\n|             <a>\n|             <div>\n|               id=\"4\"\n|               <a>\n|               <div>\n|                 id=\"5\"\n|                 <a>\n|                 <div>\n|                   id=\"6\"\n|                   <a>\n|                   <div>\n|                     id=\"7\"\n|                     <a>\n|                     <div>\n|                       id=\"8\"\n|                       <a>\n|                         <div>\n|                           id=\"9\"\n|                           \"A\"\n"
-       }, {
-               name: "tests22.dat #4"
-               html: "<a><b><div id=1><div id=2><div id=3><div id=4><div id=5><div id=6><div id=7><div id=8><div id=9><div id=10>A</a>"
-               errors: 10
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       <b>\n|     <b>\n|       <div>\n|         id=\"1\"\n|         <a>\n|         <div>\n|           id=\"2\"\n|           <a>\n|           <div>\n|             id=\"3\"\n|             <a>\n|             <div>\n|               id=\"4\"\n|               <a>\n|               <div>\n|                 id=\"5\"\n|                 <a>\n|                 <div>\n|                   id=\"6\"\n|                   <a>\n|                   <div>\n|                     id=\"7\"\n|                     <a>\n|                     <div>\n|                       id=\"8\"\n|                       <a>\n|                         <div>\n|                           id=\"9\"\n|                           <div>\n|                             id=\"10\"\n|                             \"A\"\n"
-       }, {
-               name: "tests22.dat #5"
-               html: "<cite><b><cite><i><cite><i><cite><i><div>X</b>TEST"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <cite>\n|       <b>\n|         <cite>\n|           <i>\n|             <cite>\n|               <i>\n|                 <cite>\n|                   <i>\n|       <i>\n|         <i>\n|           <div>\n|             <b>\n|               \"X\"\n|             \"TEST\"\n"
-       }, {
-               name: "tests23.dat #1"
-               html: "<p><font size=4><font color=red><font size=4><font size=4><font size=4><font size=4><font size=4><font color=red><p>X"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <font>\n|         size=\"4\"\n|         <font>\n|           color=\"red\"\n|           <font>\n|             size=\"4\"\n|             <font>\n|               size=\"4\"\n|               <font>\n|                 size=\"4\"\n|                 <font>\n|                   size=\"4\"\n|                   <font>\n|                     size=\"4\"\n|                     <font>\n|                       color=\"red\"\n|     <p>\n|       <font>\n|         color=\"red\"\n|         <font>\n|           size=\"4\"\n|           <font>\n|             size=\"4\"\n|             <font>\n|               size=\"4\"\n|               <font>\n|                 color=\"red\"\n|                 \"X\"\n"
-       }, {
-               name: "tests23.dat #2"
-               html: "<p><font size=4><font size=4><font size=4><font size=4><p>X"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <font>\n|         size=\"4\"\n|         <font>\n|           size=\"4\"\n|           <font>\n|             size=\"4\"\n|             <font>\n|               size=\"4\"\n|     <p>\n|       <font>\n|         size=\"4\"\n|         <font>\n|           size=\"4\"\n|           <font>\n|             size=\"4\"\n|             \"X\"\n"
-       }, {
-               name: "tests23.dat #3"
-               html: "<p><font size=4><font size=4><font size=4><font size=\"5\"><font size=4><p>X"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <font>\n|         size=\"4\"\n|         <font>\n|           size=\"4\"\n|           <font>\n|             size=\"4\"\n|             <font>\n|               size=\"5\"\n|               <font>\n|                 size=\"4\"\n|     <p>\n|       <font>\n|         size=\"4\"\n|         <font>\n|           size=\"4\"\n|           <font>\n|             size=\"5\"\n|             <font>\n|               size=\"4\"\n|               \"X\"\n"
-       }, {
-               name: "tests23.dat #4"
-               html: "<p><font size=4 id=a><font size=4 id=b><font size=4><font size=4><p>X"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <font>\n|         id=\"a\"\n|         size=\"4\"\n|         <font>\n|           id=\"b\"\n|           size=\"4\"\n|           <font>\n|             size=\"4\"\n|             <font>\n|               size=\"4\"\n|     <p>\n|       <font>\n|         id=\"a\"\n|         size=\"4\"\n|         <font>\n|           id=\"b\"\n|           size=\"4\"\n|           <font>\n|             size=\"4\"\n|             <font>\n|               size=\"4\"\n|               \"X\"\n"
-       }, {
-               name: "tests23.dat #5"
-               html: "<p><b id=a><b id=a><b id=a><b><object><b id=a><b id=a>X</object><p>Y"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <b>\n|         id=\"a\"\n|         <b>\n|           id=\"a\"\n|           <b>\n|             id=\"a\"\n|             <b>\n|               <object>\n|                 <b>\n|                   id=\"a\"\n|                   <b>\n|                     id=\"a\"\n|                     \"X\"\n|     <p>\n|       <b>\n|         id=\"a\"\n|         <b>\n|           id=\"a\"\n|           <b>\n|             id=\"a\"\n|             <b>\n|               \"Y\"\n"
-       }, {
-               name: "tests24.dat #1"
-               html: "<!DOCTYPE html>&NotEqualTilde;"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"≂̸\"\n"
-       }, {
-               name: "tests24.dat #2"
-               html: "<!DOCTYPE html>&NotEqualTilde;A"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"≂̸A\"\n"
-       }, {
-               name: "tests24.dat #3"
-               html: "<!DOCTYPE html>&ThickSpace;"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"  \"\n"
-       }, {
-               name: "tests24.dat #4"
-               html: "<!DOCTYPE html>&ThickSpace;A"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"  A\"\n"
-       }, {
-               name: "tests24.dat #5"
-               html: "<!DOCTYPE html>&NotSubset;"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"⊂⃒\"\n"
-       }, {
-               name: "tests24.dat #6"
-               html: "<!DOCTYPE html>&NotSubset;A"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"⊂⃒A\"\n"
-       }, {
-               name: "tests24.dat #7"
-               html: "<!DOCTYPE html>&Gopf;"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"𝔾\"\n"
-       }, {
-               name: "tests24.dat #8"
-               html: "<!DOCTYPE html>&Gopf;A"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"𝔾A\"\n"
-       }, {
-               name: "tests25.dat #1"
-               html: "<!DOCTYPE html><body><foo>A"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <foo>\n|       \"A\"\n"
-       }, {
-               name: "tests25.dat #2"
-               html: "<!DOCTYPE html><body><area>A"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <area>\n|     \"A\"\n"
-       }, {
-               name: "tests25.dat #3"
-               html: "<!DOCTYPE html><body><base>A"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <base>\n|     \"A\"\n"
-       }, {
-               name: "tests25.dat #4"
-               html: "<!DOCTYPE html><body><basefont>A"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <basefont>\n|     \"A\"\n"
-       }, {
-               name: "tests25.dat #5"
-               html: "<!DOCTYPE html><body><bgsound>A"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <bgsound>\n|     \"A\"\n"
-       }, {
-               name: "tests25.dat #6"
-               html: "<!DOCTYPE html><body><br>A"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <br>\n|     \"A\"\n"
-       }, {
-               name: "tests25.dat #7"
-               html: "<!DOCTYPE html><body><col>A"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"A\"\n"
-       }, {
-               name: "tests25.dat #8"
-               html: "<!DOCTYPE html><body><command>A"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <command>\n|       \"A\"\n"
-       }, {
-               name: "tests25.dat #9"
-               html: "<!DOCTYPE html><body><menuitem>A"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <menuitem>\n|     \"A\"\n"
-       }, {
-               name: "tests25.dat #10"
-               html: "<!DOCTYPE html><body><embed>A"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <embed>\n|     \"A\"\n"
-       }, {
-               name: "tests25.dat #11"
-               html: "<!DOCTYPE html><body><frame>A"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"A\"\n"
-       }, {
-               name: "tests25.dat #12"
-               html: "<!DOCTYPE html><body><hr>A"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <hr>\n|     \"A\"\n"
-       }, {
-               name: "tests25.dat #13"
-               html: "<!DOCTYPE html><body><img>A"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <img>\n|     \"A\"\n"
-       }, {
-               name: "tests25.dat #14"
-               html: "<!DOCTYPE html><body><input>A"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <input>\n|     \"A\"\n"
-       }, {
-               name: "tests25.dat #15"
-               html: "<!DOCTYPE html><body><keygen>A"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <keygen>\n|     \"A\"\n"
-       }, {
-               name: "tests25.dat #16"
-               html: "<!DOCTYPE html><body><link>A"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <link>\n|     \"A\"\n"
-       }, {
-               name: "tests25.dat #17"
-               html: "<!DOCTYPE html><body><meta>A"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <meta>\n|     \"A\"\n"
-       }, {
-               name: "tests25.dat #18"
-               html: "<!DOCTYPE html><body><param>A"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <param>\n|     \"A\"\n"
-       }, {
-               name: "tests25.dat #19"
-               html: "<!DOCTYPE html><body><source>A"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <source>\n|     \"A\"\n"
-       }, {
-               name: "tests25.dat #20"
-               html: "<!DOCTYPE html><body><track>A"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <track>\n|     \"A\"\n"
-       }, {
-               name: "tests25.dat #21"
-               html: "<!DOCTYPE html><body><wbr>A"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <wbr>\n|     \"A\"\n"
-       }, {
-               name: "tests26.dat #1"
-               html: "<!DOCTYPE html><body><a href='#1'><nobr>1<nobr></a><br><a href='#2'><nobr>2<nobr></a><br><a href='#3'><nobr>3<nobr></a>"
-               errors: 10
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <a>\n|       href=\"#1\"\n|       <nobr>\n|         \"1\"\n|       <nobr>\n|     <nobr>\n|       <br>\n|       <a>\n|         href=\"#2\"\n|     <a>\n|       href=\"#2\"\n|       <nobr>\n|         \"2\"\n|       <nobr>\n|     <nobr>\n|       <br>\n|       <a>\n|         href=\"#3\"\n|     <a>\n|       href=\"#3\"\n|       <nobr>\n|         \"3\"\n|       <nobr>\n"
-       }, {
-               name: "tests26.dat #2"
-               html: "<!DOCTYPE html><body><b><nobr>1<nobr></b><i><nobr>2<nobr></i>3"
-               errors: 7
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <nobr>\n|         \"1\"\n|       <nobr>\n|     <nobr>\n|       <i>\n|     <i>\n|       <nobr>\n|         \"2\"\n|       <nobr>\n|     <nobr>\n|       \"3\"\n"
-       }, {
-               name: "tests26.dat #3"
-               html: "<!DOCTYPE html><body><b><nobr>1<table><nobr></b><i><nobr>2<nobr></i>3"
-               errors: 14
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <nobr>\n|         \"1\"\n|         <nobr>\n|           <i>\n|         <i>\n|           <nobr>\n|             \"2\"\n|           <nobr>\n|         <nobr>\n|           \"3\"\n|         <table>\n"
-       }, {
-               name: "tests26.dat #4"
-               html: "<!DOCTYPE html><body><b><nobr>1<table><tr><td><nobr></b><i><nobr>2<nobr></i>3"
-               errors: 6
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <nobr>\n|         \"1\"\n|         <table>\n|           <tbody>\n|             <tr>\n|               <td>\n|                 <nobr>\n|                   <i>\n|                 <i>\n|                   <nobr>\n|                     \"2\"\n|                   <nobr>\n|                 <nobr>\n|                   \"3\"\n"
-       }, {
-               name: "tests26.dat #5"
-               html: "<!DOCTYPE html><body><b><nobr>1<div><nobr></b><i><nobr>2<nobr></i>3"
-               errors: 9
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <nobr>\n|         \"1\"\n|     <div>\n|       <b>\n|         <nobr>\n|         <nobr>\n|       <nobr>\n|         <i>\n|       <i>\n|         <nobr>\n|           \"2\"\n|         <nobr>\n|       <nobr>\n|         \"3\"\n"
-       }, {
-               name: "tests26.dat #6"
-               html: "<!DOCTYPE html><body><b><nobr>1<nobr></b><div><i><nobr>2<nobr></i>3"
-               errors: 7
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <nobr>\n|         \"1\"\n|       <nobr>\n|     <div>\n|       <nobr>\n|         <i>\n|       <i>\n|         <nobr>\n|           \"2\"\n|         <nobr>\n|       <nobr>\n|         \"3\"\n"
-       }, {
-               name: "tests26.dat #7"
-               html: "<!DOCTYPE html><body><b><nobr>1<nobr><ins></b><i><nobr>"
-               errors: 5
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <nobr>\n|         \"1\"\n|       <nobr>\n|         <ins>\n|     <nobr>\n|       <i>\n|     <i>\n|       <nobr>\n"
-       }, {
-               name: "tests26.dat #8"
-               html: "<!DOCTYPE html><body><b><nobr>1<ins><nobr></b><i>2"
-               errors: 4
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <nobr>\n|         \"1\"\n|         <ins>\n|       <nobr>\n|     <nobr>\n|       <i>\n|         \"2\"\n"
-       }, {
-               name: "tests26.dat #9"
-               html: "<!DOCTYPE html><body><b>1<nobr></b><i><nobr>2</i>"
-               errors: 4
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <b>\n|       \"1\"\n|       <nobr>\n|     <nobr>\n|       <i>\n|     <i>\n|       <nobr>\n|         \"2\"\n"
-       }, {
-               name: "tests26.dat #10"
-               html: "<p><code x</code></p>\n"
-               errors: 5
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <code>\n|         code=\"\"\n|         x<=\"\"\n|     <code>\n|       code=\"\"\n|       x<=\"\"\n|       \"\n\"\n"
-       }, {
-               name: "tests26.dat #11"
-               html: "<!DOCTYPE html><svg><foreignObject><p><i></p>a"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg foreignObject>\n|         <p>\n|           <i>\n|         <i>\n|           \"a\"\n"
-       }, {
-               name: "tests26.dat #12"
-               html: "<!DOCTYPE html><table><tr><td><svg><foreignObject><p><i></p>a"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <svg svg>\n|               <svg foreignObject>\n|                 <p>\n|                   <i>\n|                 <i>\n|                   \"a\"\n"
-       }, {
-               name: "tests26.dat #13"
-               html: "<!DOCTYPE html><math><mtext><p><i></p>a"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mtext>\n|         <p>\n|           <i>\n|         <i>\n|           \"a\"\n"
-       }, {
-               name: "tests26.dat #14"
-               html: "<!DOCTYPE html><table><tr><td><math><mtext><p><i></p>a"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <math math>\n|               <math mtext>\n|                 <p>\n|                   <i>\n|                 <i>\n|                   \"a\"\n"
-       }, {
-               name: "tests26.dat #15"
-               html: "<!DOCTYPE html><body><div><!/div>a"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <!-- /div -->\n|       \"a\"\n"
-       }, {
-               name: "tests26.dat #16"
-               html: "<button><p><button>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <button>\n|       <p>\n|     <button>\n"
-       }, {
-               name: "tests2.dat #1"
-               html: "<!DOCTYPE html>Test"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"Test\"\n"
-       }, {
-               name: "tests2.dat #2"
-               html: "<textarea>test</div>test"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"test</div>test\"\n"
-       }, {
-               name: "tests2.dat #3"
-               html: "<table><td>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n"
-       }, {
-               name: "tests2.dat #4"
-               html: "<table><td>test</tbody></table>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"test\"\n"
-       }, {
-               name: "tests2.dat #5"
-               html: "<frame>test"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"test\"\n"
-       }, {
-               name: "tests2.dat #6"
-               html: "<!DOCTYPE html><frameset>test"
-               errors: 5
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "tests2.dat #7"
-               html: "<!DOCTYPE html><frameset> te st"
-               errors: 5
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|     \"  \"\n"
-       }, {
-               name: "tests2.dat #8"
-               html: "<!DOCTYPE html><frameset></frameset> te st"
-               errors: 4
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n|   \"  \"\n"
-       }, {
-               name: "tests2.dat #9"
-               html: "<!DOCTYPE html><frameset><!DOCTYPE html>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "tests2.dat #10"
-               html: "<!DOCTYPE html><font><p><b>test</font>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <font>\n|     <p>\n|       <font>\n|         <b>\n|           \"test\"\n"
-       }, {
-               name: "tests2.dat #11"
-               html: "<!DOCTYPE html><dt><div><dd>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <dt>\n|       <div>\n|     <dd>\n"
-       }, {
-               name: "tests2.dat #12"
-               html: "<script></x"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \"</x\"\n|   <body>\n"
-       }, {
-               name: "tests2.dat #13"
-               html: "<table><plaintext><td>"
-               errors: 7
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <plaintext>\n|       \"<td>\"\n|     <table>\n"
-       }, {
-               name: "tests2.dat #14"
-               html: "<plaintext></plaintext>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <plaintext>\n|       \"</plaintext>\"\n"
-       }, {
-               name: "tests2.dat #15"
-               html: "<!DOCTYPE html><table><tr>TEST"
-               errors: 5
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"TEST\"\n|     <table>\n|       <tbody>\n|         <tr>\n"
-       }, {
-               name: "tests2.dat #16"
-               html: "<!DOCTYPE html><body t1=1><body t2=2><body t3=3 t4=4>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     t1=\"1\"\n|     t2=\"2\"\n|     t3=\"3\"\n|     t4=\"4\"\n"
-       }, {
-               name: "tests2.dat #17"
-               html: "</b test"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests2.dat #18"
-               html: "<!DOCTYPE html></b test<b &=&amp>X"
-               errors: 4
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"X\"\n"
-       }, {
-               name: "tests2.dat #19"
-               html: "<!doctypehtml><scrIPt type=text/x-foobar;baz>X</SCRipt"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       type=\"text/x-foobar;baz\"\n|       \"X</SCRipt\"\n|   <body>\n"
-       }, {
-               name: "tests2.dat #20"
-               html: "&"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"&\"\n"
-       }, {
-               name: "tests2.dat #21"
-               html: "&#"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"&#\"\n"
-       }, {
-               name: "tests2.dat #22"
-               html: "&#X"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"&#X\"\n"
-       }, {
-               name: "tests2.dat #23"
-               html: "&#x"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"&#x\"\n"
-       }, {
-               name: "tests2.dat #24"
-               html: "&#45"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"-\"\n"
-       }, {
-               name: "tests2.dat #25"
-               html: "&x-test"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"&x-test\"\n"
-       }, {
-               name: "tests2.dat #26"
-               html: "<!doctypehtml><p><li>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <li>\n"
-       }, {
-               name: "tests2.dat #27"
-               html: "<!doctypehtml><p><dt>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <dt>\n"
-       }, {
-               name: "tests2.dat #28"
-               html: "<!doctypehtml><p><dd>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <dd>\n"
-       }, {
-               name: "tests2.dat #29"
-               html: "<!doctypehtml><p><form>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <form>\n"
-       }, {
-               name: "tests2.dat #30"
-               html: "<!DOCTYPE html><p></P>X"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     \"X\"\n"
-       }, {
-               name: "tests2.dat #31"
-               html: "&AMP"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"&\"\n"
-       }, {
-               name: "tests2.dat #32"
-               html: "&AMp;"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"&AMp;\"\n"
-       }, {
-               name: "tests2.dat #33"
-               html: "<!DOCTYPE html><html><head></head><body><thisISasillyTESTelementNameToMakeSureCrazyTagNamesArePARSEDcorrectLY>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <thisisasillytestelementnametomakesurecrazytagnamesareparsedcorrectly>\n"
-       }, {
-               name: "tests2.dat #34"
-               html: "<!DOCTYPE html>X</body>X"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"XX\"\n"
-       }, {
-               name: "tests2.dat #35"
-               html: "<!DOCTYPE html><!-- X"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <!--  X -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests2.dat #36"
-               html: "<!DOCTYPE html><table><caption>test TEST</caption><td>test"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         \"test TEST\"\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"test\"\n"
-       }, {
-               name: "tests2.dat #37"
-               html: "<!DOCTYPE html><select><option><optgroup>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n|       <optgroup>\n"
-       }, {
-               name: "tests2.dat #38"
-               html: "<!DOCTYPE html><select><optgroup><option></optgroup><option><select><option>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <optgroup>\n|         <option>\n|       <option>\n|     <option>\n"
-       }, {
-               name: "tests2.dat #39"
-               html: "<!DOCTYPE html><select><optgroup><option><optgroup>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <optgroup>\n|         <option>\n|       <optgroup>\n"
-       }, {
-               name: "tests2.dat #40"
-               html: "<!DOCTYPE html><datalist><option>foo</datalist>bar"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <datalist>\n|       <option>\n|         \"foo\"\n|     \"bar\"\n"
-       }, {
-               name: "tests2.dat #41"
-               html: "<!DOCTYPE html><font><input><input></font>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <font>\n|       <input>\n|       <input>\n"
-       }, {
-               name: "tests2.dat #42"
-               html: "<!DOCTYPE html><!-- XXX - XXX -->"
-               expected: "| <!DOCTYPE html>\n| <!--  XXX - XXX  -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests2.dat #43"
-               html: "<!DOCTYPE html><!-- XXX - XXX"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <!--  XXX - XXX -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests2.dat #44"
-               html: "<!DOCTYPE html><!-- XXX - XXX - XXX -->"
-               expected: "| <!DOCTYPE html>\n| <!--  XXX - XXX - XXX  -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests2.dat #45"
-               html: "<isindex test=x name=x>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <form>\n|       <hr>\n|       <label>\n|         \"This is a searchable index. Enter search keywords: \"\n|         <input>\n|           name=\"isindex\"\n|           test=\"x\"\n|       <hr>\n"
-       }, {
-               name: "tests2.dat #46"
-               html: "test\ntest"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"test\ntest\"\n"
-       }, {
-               name: "tests2.dat #47"
-               html: "<!DOCTYPE html><body><title>test</body></title>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <title>\n|       \"test</body>\"\n"
-       }, {
-               name: "tests2.dat #48"
-               html: "<!DOCTYPE html><body><title>X</title><meta name=z><link rel=foo><style>\nx { content:\"</style\" } </style>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <title>\n|       \"X\"\n|     <meta>\n|       name=\"z\"\n|     <link>\n|       rel=\"foo\"\n|     <style>\n|       \"\nx { content:\"</style\" } \"\n"
-       }, {
-               name: "tests2.dat #49"
-               html: "<!DOCTYPE html><select><optgroup></optgroup></select>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <optgroup>\n"
-       }, {
-               name: "tests2.dat #50"
-               html: " \n "
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests2.dat #51"
-               html: "<!DOCTYPE html>  <html>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests2.dat #52"
-               html: "<!DOCTYPE html><script>\n</script>  <title>x</title>  </head>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <script>\n|       \"\n\"\n|     \"  \"\n|     <title>\n|       \"x\"\n|     \"  \"\n|   <body>\n"
-       }, {
-               name: "tests2.dat #53"
-               html: "<!DOCTYPE html><html><body><html id=x>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   id=\"x\"\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests2.dat #54"
-               html: "<!DOCTYPE html>X</body><html id=\"x\">"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   id=\"x\"\n|   <head>\n|   <body>\n|     \"X\"\n"
-       }, {
-               name: "tests2.dat #55"
-               html: "<!DOCTYPE html><head><html id=x>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   id=\"x\"\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests2.dat #56"
-               html: "<!DOCTYPE html>X</html>X"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"XX\"\n"
-       }, {
-               name: "tests2.dat #57"
-               html: "<!DOCTYPE html>X</html> "
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"X \"\n"
-       }, {
-               name: "tests2.dat #58"
-               html: "<!DOCTYPE html>X</html><p>X"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"X\"\n|     <p>\n|       \"X\"\n"
-       }, {
-               name: "tests2.dat #59"
-               html: "<!DOCTYPE html>X<p/x/y/z>"
-               errors: 3
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"X\"\n|     <p>\n|       x=\"\"\n|       y=\"\"\n|       z=\"\"\n"
-       }, {
-               name: "tests2.dat #60"
-               html: "<!DOCTYPE html><!--x--"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <!-- x -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests2.dat #61"
-               html: "<!DOCTYPE html><table><tr><td></p></table>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <p>\n"
-       }, {
-               name: "tests2.dat #62"
-               html: "<!DOCTYPE <!DOCTYPE HTML>><!--<!--x-->-->"
-               errors: 3
-               expected: "| <!DOCTYPE <!doctype>\n| <html>\n|   <head>\n|   <body>\n|     \">\"\n|     <!-- <!--x -->\n|     \"-->\"\n"
-       }, {
-               name: "tests2.dat #63"
-               html: "<!doctype html><div><form></form><div></div></div>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <form>\n|       <div>\n"
-       }, {
-               name: "tests3.dat #1"
-               html: "<head></head><style></style>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <style>\n|   <body>\n"
-       }, {
-               name: "tests3.dat #2"
-               html: "<head></head><script></script>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|   <body>\n"
-       }, {
-               name: "tests3.dat #3"
-               html: "<head></head><!-- --><style></style><!-- --><script></script>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|     <style>\n|     <script>\n|   <!--   -->\n|   <!--   -->\n|   <body>\n"
-       }, {
-               name: "tests3.dat #4"
-               html: "<head></head><!-- -->x<style></style><!-- --><script></script>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <!--   -->\n|   <body>\n|     \"x\"\n|     <style>\n|     <!--   -->\n|     <script>\n"
-       }, {
-               name: "tests3.dat #5"
-               html: "<!DOCTYPE html><html><head></head><body><pre>\n</pre></body></html>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n"
-       }, {
-               name: "tests3.dat #6"
-               html: "<!DOCTYPE html><html><head></head><body><pre>\nfoo</pre></body></html>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n|       \"foo\"\n"
-       }, {
-               name: "tests3.dat #7"
-               html: "<!DOCTYPE html><html><head></head><body><pre>\n\nfoo</pre></body></html>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n|       \"\nfoo\"\n"
-       }, {
-               name: "tests3.dat #8"
-               html: "<!DOCTYPE html><html><head></head><body><pre>\nfoo\n</pre></body></html>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n|       \"foo\n\"\n"
-       }, {
-               name: "tests3.dat #9"
-               html: "<!DOCTYPE html><html><head></head><body><pre>x</pre><span>\n</span></body></html>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n|       \"x\"\n|     <span>\n|       \"\n\"\n"
-       }, {
-               name: "tests3.dat #10"
-               html: "<!DOCTYPE html><html><head></head><body><pre>x\ny</pre></body></html>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n|       \"x\ny\"\n"
-       }, {
-               name: "tests3.dat #11"
-               html: "<!DOCTYPE html><html><head></head><body><pre>x<div>\ny</pre></body></html>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n|       \"x\"\n|       <div>\n|         \"\ny\"\n"
-       }, {
-               name: "tests3.dat #12"
-               html: "<!DOCTYPE html><pre>&#x0a;&#x0a;A</pre>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <pre>\n|       \"\nA\"\n"
-       }, {
-               name: "tests3.dat #13"
-               html: "<!DOCTYPE html><HTML><META><HEAD></HEAD></HTML>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <meta>\n|   <body>\n"
-       }, {
-               name: "tests3.dat #14"
-               html: "<!DOCTYPE html><HTML><HEAD><head></HEAD></HTML>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests3.dat #15"
-               html: "<textarea>foo<span>bar</span><i>baz"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"foo<span>bar</span><i>baz\"\n"
-       }, {
-               name: "tests3.dat #16"
-               html: "<title>foo<span>bar</em><i>baz"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <title>\n|       \"foo<span>bar</em><i>baz\"\n|   <body>\n"
-       }, {
-               name: "tests3.dat #17"
-               html: "<!DOCTYPE html><textarea>\n</textarea>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <textarea>\n"
-       }, {
-               name: "tests3.dat #18"
-               html: "<!DOCTYPE html><textarea>\nfoo</textarea>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"foo\"\n"
-       }, {
-               name: "tests3.dat #19"
-               html: "<!DOCTYPE html><textarea>\n\nfoo</textarea>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \"\nfoo\"\n"
-       }, {
-               name: "tests3.dat #20"
-               html: "<!DOCTYPE html><html><head></head><body><ul><li><div><p><li></ul></body></html>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <ul>\n|       <li>\n|         <div>\n|           <p>\n|       <li>\n"
-       }, {
-               name: "tests3.dat #21"
-               html: "<!doctype html><nobr><nobr><nobr>"
-               errors: 3
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <nobr>\n|     <nobr>\n|     <nobr>\n"
-       }, {
-               name: "tests3.dat #22"
-               html: "<!doctype html><nobr><nobr></nobr><nobr>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <nobr>\n|     <nobr>\n|     <nobr>\n"
-       }, {
-               name: "tests3.dat #23"
-               html: "<!doctype html><html><body><p><table></table></body></html>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <table>\n"
-       }, {
-               name: "tests3.dat #24"
-               html: "<p><table></table>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <table>\n"
-       }, {
-               name: "tests4.dat #1"
-               html: "direct div content"
-               fragment: "div"
-               expected: "| \"direct div content\"\n"
-       }, {
-               name: "tests4.dat #2"
-               html: "direct textarea content"
-               fragment: "textarea"
-               expected: "| \"direct textarea content\"\n"
-       }, {
-               name: "tests4.dat #3"
-               html: "textarea content with <em>pseudo</em> <foo>markup"
-               fragment: "textarea"
-               expected: "| \"textarea content with <em>pseudo</em> <foo>markup\"\n"
-       }, {
-               name: "tests4.dat #4"
-               html: "this is &#x0043;DATA inside a <style> element"
-               fragment: "style"
-               expected: "| \"this is &#x0043;DATA inside a <style> element\"\n"
-       }, {
-               name: "tests4.dat #5"
-               html: "</plaintext>"
-               fragment: "plaintext"
-               expected: "| \"</plaintext>\"\n"
-       }, {
-               name: "tests4.dat #6"
-               html: "setting html's innerHTML"
-               fragment: "html"
-               expected: "| <head>\n| <body>\n|   \"setting html's innerHTML\"\n"
-       }, {
-               name: "tests4.dat #7"
-               html: "<title>setting head's innerHTML</title>"
-               fragment: "head"
-               expected: "| <title>\n|   \"setting head's innerHTML\"\n"
-       }, {
-               name: "tests5.dat #1"
-               html: "<style> <!-- </style>x"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <style>\n|       \" <!-- \"\n|   <body>\n|     \"x\"\n"
-       }, {
-               name: "tests5.dat #2"
-               html: "<style> <!-- </style> --> </style>x"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <style>\n|       \" <!-- \"\n|     \" \"\n|   <body>\n|     \"--> x\"\n"
-       }, {
-               name: "tests5.dat #3"
-               html: "<style> <!--> </style>x"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <style>\n|       \" <!--> \"\n|   <body>\n|     \"x\"\n"
-       }, {
-               name: "tests5.dat #4"
-               html: "<style> <!---> </style>x"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <style>\n|       \" <!---> \"\n|   <body>\n|     \"x\"\n"
-       }, {
-               name: "tests5.dat #5"
-               html: "<iframe> <!---> </iframe>x"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <iframe>\n|       \" <!---> \"\n|     \"x\"\n"
-       }, {
-               name: "tests5.dat #6"
-               html: "<iframe> <!--- </iframe>->x</iframe> --> </iframe>x"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <iframe>\n|       \" <!--- \"\n|     \"->x --> x\"\n"
-       }, {
-               name: "tests5.dat #7"
-               html: "<script> <!-- </script> --> </script>x"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <script>\n|       \" <!-- \"\n|     \" \"\n|   <body>\n|     \"--> x\"\n"
-       }, {
-               name: "tests5.dat #8"
-               html: "<title> <!-- </title> --> </title>x"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <title>\n|       \" <!-- \"\n|     \" \"\n|   <body>\n|     \"--> x\"\n"
-       }, {
-               name: "tests5.dat #9"
-               html: "<textarea> <!--- </textarea>->x</textarea> --> </textarea>x"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <textarea>\n|       \" <!--- \"\n|     \"->x --> x\"\n"
-       }, {
-               name: "tests5.dat #10"
-               html: "<style> <!</-- </style>x"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <style>\n|       \" <!</-- \"\n|   <body>\n|     \"x\"\n"
-       }, {
-               name: "tests5.dat #11"
-               html: "<p><xmp></xmp>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|     <xmp>\n"
-       }, {
-               name: "tests5.dat #12"
-               html: "<xmp> <!-- > --> </xmp>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <xmp>\n|       \" <!-- > --> \"\n"
-       }, {
-               name: "tests5.dat #13"
-               html: "<title>&amp;</title>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <title>\n|       \"&\"\n|   <body>\n"
-       }, {
-               name: "tests5.dat #14"
-               html: "<title><!--&amp;--></title>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <title>\n|       \"<!--&-->\"\n|   <body>\n"
-       }, {
-               name: "tests5.dat #15"
-               html: "<title><!--</title>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <title>\n|       \"<!--\"\n|   <body>\n"
-       }, {
-               name: "tests5.dat #16"
-               html: "<noscript><!--</noscript>--></noscript>"
-               scripting: true
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <noscript>\n|       \"<!--\"\n|   <body>\n|     \"-->\"\n"
-       }, {
-               name: "tests5.dat #17"
-               html: "<noscript><!--</noscript>--></noscript>"
-               scripting: false
-               errors: 1
-               expected: "| <html>\n|   <head>\n|     <noscript>\n|       <!-- </noscript> -->\n|   <body>\n"
-       }, {
-               name: "tests6.dat #1"
-               html: "<!doctype html></head> <head>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   \" \"\n|   <body>\n"
-       }, {
-               name: "tests6.dat #2"
-               html: "<!doctype html><form><div></form><div>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <form>\n|       <div>\n|         <div>\n"
-       }, {
-               name: "tests6.dat #3"
-               html: "<!doctype html><title>&amp;</title>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <title>\n|       \"&\"\n|   <body>\n"
-       }, {
-               name: "tests6.dat #4"
-               html: "<!doctype html><title><!--&amp;--></title>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <title>\n|       \"<!--&-->\"\n|   <body>\n"
-       }, {
-               name: "tests6.dat #5"
-               html: "<!doctype>"
-               errors: 3
-               expected: "| <!DOCTYPE >\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests6.dat #6"
-               html: "<!---x"
-               errors: 2
-               expected: "| <!-- -x -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests6.dat #7"
-               html: "<body>\n<div>"
-               errors: 2
-               fragment: "div"
-               expected: "| \"\n\"\n| <div>\n"
-       }, {
-               name: "tests6.dat #8"
-               html: "<frameset></frameset>\nfoo"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <frameset>\n|   \"\n\"\n"
-       }, {
-               name: "tests6.dat #9"
-               html: "<frameset></frameset>\n<noframes>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <frameset>\n|   \"\n\"\n|   <noframes>\n"
-       }, {
-               name: "tests6.dat #10"
-               html: "<frameset></frameset>\n<div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <frameset>\n|   \"\n\"\n"
-       }, {
-               name: "tests6.dat #11"
-               html: "<frameset></frameset>\n</html>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <frameset>\n|   \"\n\"\n"
-       }, {
-               name: "tests6.dat #12"
-               html: "<frameset></frameset>\n</div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <frameset>\n|   \"\n\"\n"
-       }, {
-               name: "tests6.dat #13"
-               html: "<form><form>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <form>\n"
-       }, {
-               name: "tests6.dat #14"
-               html: "<button><button>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <button>\n|     <button>\n"
-       }, {
-               name: "tests6.dat #15"
-               html: "<table><tr><td></th>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n"
-       }, {
-               name: "tests6.dat #16"
-               html: "<table><caption><td>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|       <tbody>\n|         <tr>\n|           <td>\n"
-       }, {
-               name: "tests6.dat #17"
-               html: "<table><caption><div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <div>\n"
-       }, {
-               name: "tests6.dat #18"
-               html: "</caption><div>"
-               errors: 2
-               fragment: "caption"
-               expected: "| <div>\n"
-       }, {
-               name: "tests6.dat #19"
-               html: "<table><caption><div></caption>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <div>\n"
-       }, {
-               name: "tests6.dat #20"
-               html: "<table><caption></table>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n"
-       }, {
-               name: "tests6.dat #21"
-               html: "</table><div>"
-               errors: 2
-               fragment: "caption"
-               expected: "| <div>\n"
-       }, {
-               name: "tests6.dat #22"
-               html: "<table><caption></body></col></colgroup></html></tbody></td></tfoot></th></thead></tr>"
-               errors: 12
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n"
-       }, {
-               name: "tests6.dat #23"
-               html: "<table><caption><div></div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <div>\n"
-       }, {
-               name: "tests6.dat #24"
-               html: "<table><tr><td></body></caption></col></colgroup></html>"
-               errors: 7
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n"
-       }, {
-               name: "tests6.dat #25"
-               html: "</table></tbody></tfoot></thead></tr><div>"
-               errors: 6
-               fragment: "td"
-               expected: "| <div>\n"
-       }, {
-               name: "tests6.dat #26"
-               html: "<table><colgroup>foo"
-               errors: 5
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"foo\"\n|     <table>\n|       <colgroup>\n"
-       }, {
-               name: "tests6.dat #27"
-               html: "foo<col>"
-               errors: 3
-               fragment: "colgroup"
-               expected: "| <col>\n"
-       }, {
-               name: "tests6.dat #28"
-               html: "<table><colgroup></col>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <colgroup>\n"
-       }, {
-               name: "tests6.dat #29"
-               html: "<frameset><div>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "tests6.dat #30"
-               html: "</frameset><frame>"
-               errors: 1
-               fragment: "frameset"
-               expected: "| <frame>\n"
-       }, {
-               name: "tests6.dat #31"
-               html: "<frameset></div>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "tests6.dat #32"
-               html: "</body><div>"
-               errors: 2
-               fragment: "body"
-               expected: "| <div>\n"
-       }, {
-               name: "tests6.dat #33"
-               html: "<table><tr><div>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|     <table>\n|       <tbody>\n|         <tr>\n"
-       }, {
-               name: "tests6.dat #34"
-               html: "</tr><td>"
-               errors: 1
-               fragment: "tr"
-               expected: "| <td>\n"
-       }, {
-               name: "tests6.dat #35"
-               html: "</tbody></tfoot></thead><td>"
-               errors: 3
-               fragment: "tr"
-               expected: "| <td>\n"
-       }, {
-               name: "tests6.dat #36"
-               html: "<table><tr><div><td>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n"
-       }, {
-               name: "tests6.dat #37"
-               html: "<caption><col><colgroup><tbody><tfoot><thead><tr>"
-               errors: 6
-               fragment: "tbody"
-               expected: "| <tr>\n"
-       }, {
-               name: "tests6.dat #38"
-               html: "<table><tbody></thead>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n"
-       }, {
-               name: "tests6.dat #39"
-               html: "</table><tr>"
-               errors: 1
-               fragment: "tbody"
-               expected: "| <tr>\n"
-       }, {
-               name: "tests6.dat #40"
-               html: "<table><tbody></body></caption></col></colgroup></html></td></th></tr>"
-               errors: 10
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n"
-       }, {
-               name: "tests6.dat #41"
-               html: "<table><tbody></div>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n"
-       }, {
-               name: "tests6.dat #42"
-               html: "<table><table>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|     <table>\n"
-       }, {
-               name: "tests6.dat #43"
-               html: "<table></body></caption></col></colgroup></html></tbody></td></tfoot></th></thead></tr>"
-               errors: 13
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n"
-       }, {
-               name: "tests6.dat #44"
-               html: "</table><tr>"
-               errors: 1
-               fragment: "table"
-               expected: "| <tbody>\n|   <tr>\n"
-       }, {
-               name: "tests6.dat #45"
-               html: "<body></body></html>"
-               errors: 1
-               fragment: "html"
-               expected: "| <head>\n| <body>\n"
-       }, {
-               name: "tests6.dat #46"
-               html: "<html><frameset></frameset></html> "
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <frameset>\n|   \" \"\n"
-       }, {
-               name: "tests6.dat #47"
-               html: "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\"><html></html>"
-               expected: "| <!DOCTYPE html \"-//W3C//DTD HTML 4.01//EN\" \"\">\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests6.dat #48"
-               html: "<param><frameset></frameset>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "tests6.dat #49"
-               html: "<source><frameset></frameset>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "tests6.dat #50"
-               html: "<track><frameset></frameset>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "tests6.dat #51"
-               html: "</html><frameset></frameset>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "tests6.dat #52"
-               html: "</body><frameset></frameset>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "tests7.dat #1"
-               html: "<!doctype html><body><title>X</title>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <title>\n|       \"X\"\n"
-       }, {
-               name: "tests7.dat #2"
-               html: "<!doctype html><table><title>X</title></table>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <title>\n|       \"X\"\n|     <table>\n"
-       }, {
-               name: "tests7.dat #3"
-               html: "<!doctype html><head></head><title>X</title>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <title>\n|       \"X\"\n|   <body>\n"
-       }, {
-               name: "tests7.dat #4"
-               html: "<!doctype html></head><title>X</title>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|     <title>\n|       \"X\"\n|   <body>\n"
-       }, {
-               name: "tests7.dat #5"
-               html: "<!doctype html><table><meta></table>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <meta>\n|     <table>\n"
-       }, {
-               name: "tests7.dat #6"
-               html: "<!doctype html><table>X<tr><td><table> <meta></table></table>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"X\"\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <meta>\n|             <table>\n|               \" \"\n"
-       }, {
-               name: "tests7.dat #7"
-               html: "<!doctype html><html> <head>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests7.dat #8"
-               html: "<!doctype html> <head>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests7.dat #9"
-               html: "<!doctype html><table><style> <tr>x </style> </table>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <style>\n|         \" <tr>x \"\n|       \" \"\n"
-       }, {
-               name: "tests7.dat #10"
-               html: "<!doctype html><table><TBODY><script> <tr>x </script> </table>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <script>\n|           \" <tr>x \"\n|         \" \"\n"
-       }, {
-               name: "tests7.dat #11"
-               html: "<!doctype html><p><applet><p>X</p></applet>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <applet>\n|         <p>\n|           \"X\"\n"
-       }, {
-               name: "tests7.dat #12"
-               html: "<!doctype html><p><object type=\"application/x-non-existant-plugin\"><p>X</p></object>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <object>\n|         type=\"application/x-non-existant-plugin\"\n|         <p>\n|           \"X\"\n"
-       }, {
-               name: "tests7.dat #13"
-               html: "<!doctype html><listing>\nX</listing>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <listing>\n|       \"X\"\n"
-       }, {
-               name: "tests7.dat #14"
-               html: "<!doctype html><select><input>X"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|     <input>\n|     \"X\"\n"
-       }, {
-               name: "tests7.dat #15"
-               html: "<!doctype html><select><select>X"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|     \"X\"\n"
-       }, {
-               name: "tests7.dat #16"
-               html: "<!doctype html><table><input type=hidDEN></table>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <input>\n|         type=\"hidDEN\"\n"
-       }, {
-               name: "tests7.dat #17"
-               html: "<!doctype html><table>X<input type=hidDEN></table>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     \"X\"\n|     <table>\n|       <input>\n|         type=\"hidDEN\"\n"
-       }, {
-               name: "tests7.dat #18"
-               html: "<!doctype html><table>  <input type=hidDEN></table>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       \"  \"\n|       <input>\n|         type=\"hidDEN\"\n"
-       }, {
-               name: "tests7.dat #19"
-               html: "<!doctype html><table>  <input type='hidDEN'></table>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       \"  \"\n|       <input>\n|         type=\"hidDEN\"\n"
-       }, {
-               name: "tests7.dat #20"
-               html: "<!doctype html><table><input type=\" hidden\"><input type=hidDEN></table>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <input>\n|       type=\" hidden\"\n|     <table>\n|       <input>\n|         type=\"hidDEN\"\n"
-       }, {
-               name: "tests7.dat #21"
-               html: "<!doctype html><table><select>X<tr>"
-               errors: 3
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       \"X\"\n|     <table>\n|       <tbody>\n|         <tr>\n"
-       }, {
-               name: "tests7.dat #22"
-               html: "<!doctype html><select>X</select>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       \"X\"\n"
-       }, {
-               name: "tests7.dat #23"
-               html: "<!DOCTYPE hTmL><html></html>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests7.dat #24"
-               html: "<!DOCTYPE HTML><html></html>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "tests7.dat #25"
-               html: "<body>X</body></body>"
-               errors: 1
-               fragment: "html"
-               expected: "| <head>\n| <body>\n|   \"X\"\n"
-       }, {
-               name: "tests7.dat #26"
-               html: "<div><p>a</x> b"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <p>\n|         \"a b\"\n"
-       }, {
-               name: "tests7.dat #27"
-               html: "<table><tr><td><code></code> </table>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <code>\n|             \" \"\n"
-       }, {
-               name: "tests7.dat #28"
-               html: "<table><b><tr><td>aaa</td></tr>bbb</table>ccc"
-               errors: 6
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|     <b>\n|       \"bbb\"\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"aaa\"\n|     <b>\n|       \"ccc\"\n"
-       }, {
-               name: "tests7.dat #29"
-               html: "A<table><tr> B</tr> B</table>"
-               errors: 5
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"A B B\"\n|     <table>\n|       <tbody>\n|         <tr>\n"
-       }, {
-               name: "tests7.dat #30"
-               html: "A<table><tr> B</tr> </em>C</table>"
-               errors: 6
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"A BC\"\n|     <table>\n|       <tbody>\n|         <tr>\n|         \" \"\n"
-       }, {
-               name: "tests7.dat #31"
-               html: "<select><keygen>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|     <keygen>\n"
-       }, {
-               name: "tests8.dat #1"
-               html: "<div>\n<div></div>\n</span>x"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"\n\"\n|       <div>\n|       \"\nx\"\n"
-       }, {
-               name: "tests8.dat #2"
-               html: "<div>x<div></div>\n</span>x"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"x\"\n|       <div>\n|       \"\nx\"\n"
-       }, {
-               name: "tests8.dat #3"
-               html: "<div>x<div></div>x</span>x"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"x\"\n|       <div>\n|       \"xx\"\n"
-       }, {
-               name: "tests8.dat #4"
-               html: "<div>x<div></div>y</span>z"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"x\"\n|       <div>\n|       \"yz\"\n"
-       }, {
-               name: "tests8.dat #5"
-               html: "<table><div>x<div></div>x</span>x"
-               errors: 10
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"x\"\n|       <div>\n|       \"xx\"\n|     <table>\n"
-       }, {
-               name: "tests8.dat #6"
-               html: "x<table>x"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"xx\"\n|     <table>\n"
-       }, {
-               name: "tests8.dat #7"
-               html: "x<table><table>x"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"x\"\n|     <table>\n|     \"x\"\n|     <table>\n"
-       }, {
-               name: "tests8.dat #8"
-               html: "<b>a<div></div><div></b>y"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       \"a\"\n|       <div>\n|     <div>\n|       <b>\n|       \"y\"\n"
-       }, {
-               name: "tests8.dat #9"
-               html: "<a><div><p></a>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|     <div>\n|       <a>\n|       <p>\n|         <a>\n"
-       }, {
-               name: "tests9.dat #1"
-               html: "<!DOCTYPE html><math></math>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n"
-       }, {
-               name: "tests9.dat #2"
-               html: "<!DOCTYPE html><body><math></math>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n"
-       }, {
-               name: "tests9.dat #3"
-               html: "<!DOCTYPE html><math><mi>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n"
-       }, {
-               name: "tests9.dat #4"
-               html: "<!DOCTYPE html><math><annotation-xml><svg><u>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math annotation-xml>\n|         <svg svg>\n|     <u>\n"
-       }, {
-               name: "tests9.dat #5"
-               html: "<!DOCTYPE html><body><select><math></math></select>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n"
-       }, {
-               name: "tests9.dat #6"
-               html: "<!DOCTYPE html><body><select><option><math></math></option></select>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n"
-       }, {
-               name: "tests9.dat #7"
-               html: "<!DOCTYPE html><body><table><math></math></table>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|     <table>\n"
-       }, {
-               name: "tests9.dat #8"
-               html: "<!DOCTYPE html><body><table><math><mi>foo</mi></math></table>"
-               errors: 4
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         \"foo\"\n|     <table>\n"
-       }, {
-               name: "tests9.dat #9"
-               html: "<!DOCTYPE html><body><table><math><mi>foo</mi><mi>bar</mi></math></table>"
-               errors: 7
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         \"foo\"\n|       <math mi>\n|         \"bar\"\n|     <table>\n"
-       }, {
-               name: "tests9.dat #10"
-               html: "<!DOCTYPE html><body><table><tbody><math><mi>foo</mi><mi>bar</mi></math></tbody></table>"
-               errors: 7
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         \"foo\"\n|       <math mi>\n|         \"bar\"\n|     <table>\n|       <tbody>\n"
-       }, {
-               name: "tests9.dat #11"
-               html: "<!DOCTYPE html><body><table><tbody><tr><math><mi>foo</mi><mi>bar</mi></math></tr></tbody></table>"
-               errors: 7
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         \"foo\"\n|       <math mi>\n|         \"bar\"\n|     <table>\n|       <tbody>\n|         <tr>\n"
-       }, {
-               name: "tests9.dat #12"
-               html: "<!DOCTYPE html><body><table><tbody><tr><td><math><mi>foo</mi><mi>bar</mi></math></td></tr></tbody></table>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <math math>\n|               <math mi>\n|                 \"foo\"\n|               <math mi>\n|                 \"bar\"\n"
-       }, {
-               name: "tests9.dat #13"
-               html: "<!DOCTYPE html><body><table><tbody><tr><td><math><mi>foo</mi><mi>bar</mi></math><p>baz</td></tr></tbody></table>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <math math>\n|               <math mi>\n|                 \"foo\"\n|               <math mi>\n|                 \"bar\"\n|             <p>\n|               \"baz\"\n"
-       }, {
-               name: "tests9.dat #14"
-               html: "<!DOCTYPE html><body><table><caption><math><mi>foo</mi><mi>bar</mi></math><p>baz</caption></table>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <math math>\n|           <math mi>\n|             \"foo\"\n|           <math mi>\n|             \"bar\"\n|         <p>\n|           \"baz\"\n"
-       }, {
-               name: "tests9.dat #15"
-               html: "<!DOCTYPE html><body><table><caption><math><mi>foo</mi><mi>bar</mi><p>baz</table><p>quux"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <math math>\n|           <math mi>\n|             \"foo\"\n|           <math mi>\n|             \"bar\"\n|         <p>\n|           \"baz\"\n|     <p>\n|       \"quux\"\n"
-       }, {
-               name: "tests9.dat #16"
-               html: "<!DOCTYPE html><body><table><caption><math><mi>foo</mi><mi>bar</mi>baz</table><p>quux"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <caption>\n|         <math math>\n|           <math mi>\n|             \"foo\"\n|           <math mi>\n|             \"bar\"\n|           \"baz\"\n|     <p>\n|       \"quux\"\n"
-       }, {
-               name: "tests9.dat #17"
-               html: "<!DOCTYPE html><body><table><colgroup><math><mi>foo</mi><mi>bar</mi><p>baz</table><p>quux"
-               errors: 12
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         \"foo\"\n|       <math mi>\n|         \"bar\"\n|     <p>\n|       \"baz\"\n|     <table>\n|       <colgroup>\n|     <p>\n|       \"quux\"\n"
-       }, {
-               name: "tests9.dat #18"
-               html: "<!DOCTYPE html><body><table><tr><td><select><math><mi>foo</mi><mi>bar</mi><p>baz</table><p>quux"
-               errors: 7
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <select>\n|               \"foobarbaz\"\n|     <p>\n|       \"quux\"\n"
-       }, {
-               name: "tests9.dat #19"
-               html: "<!DOCTYPE html><body><table><select><math><mi>foo</mi><mi>bar</mi><p>baz</table><p>quux"
-               errors: 8
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <select>\n|       \"foobarbaz\"\n|     <table>\n|     <p>\n|       \"quux\"\n"
-       }, {
-               name: "tests9.dat #20"
-               html: "<!DOCTYPE html><body></body></html><math><mi>foo</mi><mi>bar</mi><p>baz"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         \"foo\"\n|       <math mi>\n|         \"bar\"\n|     <p>\n|       \"baz\"\n"
-       }, {
-               name: "tests9.dat #21"
-               html: "<!DOCTYPE html><body></body><math><mi>foo</mi><mi>bar</mi><p>baz"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mi>\n|         \"foo\"\n|       <math mi>\n|         \"bar\"\n|     <p>\n|       \"baz\"\n"
-       }, {
-               name: "tests9.dat #22"
-               html: "<!DOCTYPE html><frameset><math><mi></mi><mi></mi><p><span>"
-               errors: 8
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "tests9.dat #23"
-               html: "<!DOCTYPE html><frameset></frameset><math><mi></mi><mi></mi><p><span>"
-               errors: 7
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "tests9.dat #24"
-               html: "<!DOCTYPE html><body xlink:href=foo><math xlink:href=foo></math>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     xlink:href=\"foo\"\n|     <math math>\n|       xlink href=\"foo\"\n"
-       }, {
-               name: "tests9.dat #25"
-               html: "<!DOCTYPE html><body xlink:href=foo xml:lang=en><math><mi xml:lang=en xlink:href=foo></mi></math>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     xlink:href=\"foo\"\n|     xml:lang=\"en\"\n|     <math math>\n|       <math mi>\n|         xlink href=\"foo\"\n|         xml lang=\"en\"\n"
-       }, {
-               name: "tests9.dat #26"
-               html: "<!DOCTYPE html><body xlink:href=foo xml:lang=en><math><mi xml:lang=en xlink:href=foo /></math>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     xlink:href=\"foo\"\n|     xml:lang=\"en\"\n|     <math math>\n|       <math mi>\n|         xlink href=\"foo\"\n|         xml lang=\"en\"\n"
-       }, {
-               name: "tests9.dat #27"
-               html: "<!DOCTYPE html><body xlink:href=foo xml:lang=en><math><mi xml:lang=en xlink:href=foo />bar</math>"
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     xlink:href=\"foo\"\n|     xml:lang=\"en\"\n|     <math math>\n|       <math mi>\n|         xlink href=\"foo\"\n|         xml lang=\"en\"\n|       \"bar\"\n"
-       }, {
-               name: "tests_innerHTML_1.dat #1"
-               html: "<body><span>"
-               errors: 2
-               fragment: "body"
-               expected: "| <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #2"
-               html: "<span><body>"
-               errors: 2
-               fragment: "body"
-               expected: "| <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #3"
-               html: "<span><body>"
-               errors: 2
-               fragment: "div"
-               expected: "| <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #4"
-               html: "<body><span>"
-               errors: 1
-               fragment: "html"
-               expected: "| <head>\n| <body>\n|   <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #5"
-               html: "<frameset><span>"
-               errors: 2
-               fragment: "body"
-               expected: "| <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #6"
-               html: "<span><frameset>"
-               errors: 2
-               fragment: "body"
-               expected: "| <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #7"
-               html: "<span><frameset>"
-               errors: 2
-               fragment: "div"
-               expected: "| <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #8"
-               html: "<frameset><span>"
-               errors: 2
-               fragment: "html"
-               expected: "| <head>\n| <frameset>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #9"
-               html: "<table><tr>"
-               errors: 1
-               fragment: "table"
-               expected: "| <tbody>\n|   <tr>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #10"
-               html: "</table><tr>"
-               errors: 1
-               fragment: "table"
-               expected: "| <tbody>\n|   <tr>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #11"
-               html: "<a>"
-               errors: 2
-               fragment: "table"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #12"
-               html: "<a>"
-               errors: 2
-               fragment: "table"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #13"
-               html: "<a><caption>a"
-               errors: 2
-               fragment: "table"
-               expected: "| <a>\n| <caption>\n|   \"a\"\n"
-       }, {
-               name: "tests_innerHTML_1.dat #14"
-               html: "<a><colgroup><col>"
-               errors: 2
-               fragment: "table"
-               expected: "| <a>\n| <colgroup>\n|   <col>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #15"
-               html: "<a><tbody><tr>"
-               errors: 1
-               fragment: "table"
-               expected: "| <a>\n| <tbody>\n|   <tr>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #16"
-               html: "<a><tfoot><tr>"
-               errors: 1
-               fragment: "table"
-               expected: "| <a>\n| <tfoot>\n|   <tr>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #17"
-               html: "<a><thead><tr>"
-               errors: 1
-               fragment: "table"
-               expected: "| <a>\n| <thead>\n|   <tr>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #18"
-               html: "<a><tr>"
-               errors: 1
-               fragment: "table"
-               expected: "| <a>\n| <tbody>\n|   <tr>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #19"
-               html: "<a><th>"
-               errors: 2
-               fragment: "table"
-               expected: "| <a>\n| <tbody>\n|   <tr>\n|     <th>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #20"
-               html: "<a><td>"
-               errors: 2
-               fragment: "table"
-               expected: "| <a>\n| <tbody>\n|   <tr>\n|     <td>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #21"
-               html: "<table></table><tbody>"
-               errors: 1
-               fragment: "caption"
-               expected: "| <table>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #22"
-               html: "</table><span>"
-               errors: 2
-               fragment: "caption"
-               expected: "| <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #23"
-               html: "<span></table>"
-               errors: 2
-               fragment: "caption"
-               expected: "| <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #24"
-               html: "</caption><span>"
-               errors: 2
-               fragment: "caption"
-               expected: "| <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #25"
-               html: "<span></caption><span>"
-               errors: 2
-               fragment: "caption"
-               expected: "| <span>\n|   <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #26"
-               html: "<span><caption><span>"
-               errors: 2
-               fragment: "caption"
-               expected: "| <span>\n|   <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #27"
-               html: "<span><col><span>"
-               errors: 2
-               fragment: "caption"
-               expected: "| <span>\n|   <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #28"
-               html: "<span><colgroup><span>"
-               errors: 2
-               fragment: "caption"
-               expected: "| <span>\n|   <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #29"
-               html: "<span><html><span>"
-               errors: 2
-               fragment: "caption"
-               expected: "| <span>\n|   <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #30"
-               html: "<span><tbody><span>"
-               errors: 2
-               fragment: "caption"
-               expected: "| <span>\n|   <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #31"
-               html: "<span><td><span>"
-               errors: 2
-               fragment: "caption"
-               expected: "| <span>\n|   <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #32"
-               html: "<span><tfoot><span>"
-               errors: 2
-               fragment: "caption"
-               expected: "| <span>\n|   <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #33"
-               html: "<span><thead><span>"
-               errors: 2
-               fragment: "caption"
-               expected: "| <span>\n|   <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #34"
-               html: "<span><th><span>"
-               errors: 2
-               fragment: "caption"
-               expected: "| <span>\n|   <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #35"
-               html: "<span><tr><span>"
-               errors: 2
-               fragment: "caption"
-               expected: "| <span>\n|   <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #36"
-               html: "<span></table><span>"
-               errors: 2
-               fragment: "caption"
-               expected: "| <span>\n|   <span>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #37"
-               html: "</colgroup><col>"
-               errors: 1
-               fragment: "colgroup"
-               expected: "| <col>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #38"
-               html: "<a><col>"
-               errors: 1
-               fragment: "colgroup"
-               expected: "| <col>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #39"
-               html: "<caption><a>"
-               errors: 3
-               fragment: "tbody"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #40"
-               html: "<col><a>"
-               errors: 3
-               fragment: "tbody"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #41"
-               html: "<colgroup><a>"
-               errors: 3
-               fragment: "tbody"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #42"
-               html: "<tbody><a>"
-               errors: 3
-               fragment: "tbody"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #43"
-               html: "<tfoot><a>"
-               errors: 3
-               fragment: "tbody"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #44"
-               html: "<thead><a>"
-               errors: 3
-               fragment: "tbody"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #45"
-               html: "</table><a>"
-               errors: 3
-               fragment: "tbody"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #46"
-               html: "<a><tr>"
-               errors: 1
-               fragment: "tbody"
-               expected: "| <a>\n| <tr>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #47"
-               html: "<a><td>"
-               errors: 2
-               fragment: "tbody"
-               expected: "| <a>\n| <tr>\n|   <td>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #48"
-               html: "<a><td>"
-               errors: 2
-               fragment: "tbody"
-               expected: "| <a>\n| <tr>\n|   <td>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #49"
-               html: "<a><td>"
-               errors: 2
-               fragment: "tbody"
-               expected: "| <a>\n| <tr>\n|   <td>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #50"
-               html: "<td><table><tbody><a><tr>"
-               errors: 3
-               fragment: "tbody"
-               expected: "| <tr>\n|   <td>\n|     <a>\n|     <table>\n|       <tbody>\n|         <tr>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #51"
-               html: "</tr><td>"
-               errors: 1
-               fragment: "tr"
-               expected: "| <td>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #52"
-               html: "<td><table><a><tr></tr><tr>"
-               errors: 2
-               fragment: "tr"
-               expected: "| <td>\n|   <a>\n|   <table>\n|     <tbody>\n|       <tr>\n|       <tr>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #53"
-               html: "<caption><td>"
-               errors: 1
-               fragment: "tr"
-               expected: "| <td>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #54"
-               html: "<col><td>"
-               errors: 1
-               fragment: "tr"
-               expected: "| <td>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #55"
-               html: "<colgroup><td>"
-               errors: 1
-               fragment: "tr"
-               expected: "| <td>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #56"
-               html: "<tbody><td>"
-               errors: 1
-               fragment: "tr"
-               expected: "| <td>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #57"
-               html: "<tfoot><td>"
-               errors: 1
-               fragment: "tr"
-               expected: "| <td>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #58"
-               html: "<thead><td>"
-               errors: 1
-               fragment: "tr"
-               expected: "| <td>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #59"
-               html: "<tr><td>"
-               errors: 1
-               fragment: "tr"
-               expected: "| <td>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #60"
-               html: "</table><td>"
-               errors: 1
-               fragment: "tr"
-               expected: "| <td>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #61"
-               html: "<td><table></table><td>"
-               fragment: "tr"
-               expected: "| <td>\n|   <table>\n| <td>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #62"
-               html: "<td><table></table><td>"
-               fragment: "tr"
-               expected: "| <td>\n|   <table>\n| <td>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #63"
-               html: "<caption><a>"
-               errors: 2
-               fragment: "td"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #64"
-               html: "<col><a>"
-               errors: 2
-               fragment: "td"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #65"
-               html: "<colgroup><a>"
-               errors: 2
-               fragment: "td"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #66"
-               html: "<tbody><a>"
-               errors: 2
-               fragment: "td"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #67"
-               html: "<tfoot><a>"
-               errors: 2
-               fragment: "td"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #68"
-               html: "<th><a>"
-               errors: 2
-               fragment: "td"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #69"
-               html: "<thead><a>"
-               errors: 2
-               fragment: "td"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #70"
-               html: "<tr><a>"
-               errors: 2
-               fragment: "td"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #71"
-               html: "</table><a>"
-               errors: 2
-               fragment: "td"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #72"
-               html: "</tbody><a>"
-               errors: 2
-               fragment: "td"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #73"
-               html: "</td><a>"
-               errors: 2
-               fragment: "td"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #74"
-               html: "</tfoot><a>"
-               errors: 2
-               fragment: "td"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #75"
-               html: "</thead><a>"
-               errors: 2
-               fragment: "td"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #76"
-               html: "</th><a>"
-               errors: 2
-               fragment: "td"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #77"
-               html: "</tr><a>"
-               errors: 2
-               fragment: "td"
-               expected: "| <a>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #78"
-               html: "<table><td><td>"
-               errors: 2
-               fragment: "td"
-               expected: "| <table>\n|   <tbody>\n|     <tr>\n|       <td>\n|       <td>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #79"
-               html: "</select><option>"
-               errors: 2
-               fragment: "select"
-               expected: "| <option>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #80"
-               html: "<input><option>"
-               errors: 2
-               fragment: "select"
-               expected: "| <option>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #81"
-               html: "<keygen><option>"
-               errors: 2
-               fragment: "select"
-               expected: "| <option>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #82"
-               html: "<textarea><option>"
-               errors: 2
-               fragment: "select"
-               expected: "| <option>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #83"
-               html: "</html><!--abc-->"
-               errors: 1
-               fragment: "html"
-               expected: "| <head>\n| <body>\n| <!-- abc -->\n"
-       }, {
-               name: "tests_innerHTML_1.dat #84"
-               html: "</frameset><frame>"
-               errors: 1
-               fragment: "frameset"
-               expected: "| <frame>\n"
-       }, {
-               name: "tests_innerHTML_1.dat #85"
-               html: ""
-               fragment: "html"
-               expected: "| <head>\n| <body>\n"
-       }, {
-               name: "tricky01.dat #1"
-               html: "<b><p>Bold </b> Not bold</p>\nAlso not bold."
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|     <p>\n|       <b>\n|         \"Bold \"\n|       \" Not bold\"\n|     \"\nAlso not bold.\"\n"
-       }, {
-               name: "tricky01.dat #2"
-               html: "<html>\n<font color=red><i>Italic and Red<p>Italic and Red </font> Just italic.</p> Italic only.</i> Plain\n<p>I should not be red. <font color=red>Red. <i>Italic and red.</p>\n<p>Italic and red. </i> Red.</font> I should not be red.</p>\n<b>Bold <i>Bold and italic</b> Only Italic </i> Plain"
-               errors: 6
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <font>\n|       color=\"red\"\n|       <i>\n|         \"Italic and Red\"\n|     <i>\n|       <p>\n|         <font>\n|           color=\"red\"\n|           \"Italic and Red \"\n|         \" Just italic.\"\n|       \" Italic only.\"\n|     \" Plain\n\"\n|     <p>\n|       \"I should not be red. \"\n|       <font>\n|         color=\"red\"\n|         \"Red. \"\n|         <i>\n|           \"Italic and red.\"\n|     <font>\n|       color=\"red\"\n|       <i>\n|         \"\n\"\n|     <p>\n|       <font>\n|         color=\"red\"\n|         <i>\n|           \"Italic and red. \"\n|         \" Red.\"\n|       \" I should not be red.\"\n|     \"\n\"\n|     <b>\n|       \"Bold \"\n|       <i>\n|         \"Bold and italic\"\n|     <i>\n|       \" Only Italic \"\n|     \" Plain\"\n"
-       }, {
-               name: "tricky01.dat #3"
-               html: "<html><body>\n<p><font size=\"7\">First paragraph.</p>\n<p>Second paragraph.</p></font>\n<b><p><i>Bold and Italic</b> Italic</p>"
-               errors: 5
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"\n\"\n|     <p>\n|       <font>\n|         size=\"7\"\n|         \"First paragraph.\"\n|     <font>\n|       size=\"7\"\n|       \"\n\"\n|       <p>\n|         \"Second paragraph.\"\n|     \"\n\"\n|     <b>\n|     <p>\n|       <b>\n|         <i>\n|           \"Bold and Italic\"\n|       <i>\n|         \" Italic\"\n"
-       }, {
-               name: "tricky01.dat #4"
-               html: "<html>\n<dl>\n<dt><b>Boo\n<dd>Goo?\n</dl>\n</html>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <dl>\n|       \"\n\"\n|       <dt>\n|         <b>\n|           \"Boo\n\"\n|       <dd>\n|         <b>\n|           \"Goo?\n\"\n|     <b>\n|       \"\n\"\n"
-       }, {
-               name: "tricky01.dat #5"
-               html: "<html><body>\n<label><a><div>Hello<div>World</div></a></label>  \n</body></html>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"\n\"\n|     <label>\n|       <a>\n|       <div>\n|         <a>\n|           \"Hello\"\n|           <div>\n|             \"World\"\n|         \"  \n\"\n"
-       }, {
-               name: "tricky01.dat #6"
-               html: "<table><center> <font>a</center> <img> <tr><td> </td> </tr> </table>"
-               errors: 9
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <center>\n|       \" \"\n|       <font>\n|         \"a\"\n|     <font>\n|       <img>\n|       \" \"\n|     <table>\n|       \" \"\n|       <tbody>\n|         <tr>\n|           <td>\n|             \" \"\n|           \" \"\n|         \" \"\n"
-       }, {
-               name: "tricky01.dat #7"
-               html: "<table><tr><p><a><p>You should see this text."
-               errors: 31
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       <a>\n|     <p>\n|       <a>\n|         \"You should see this text.\"\n|     <table>\n|       <tbody>\n|         <tr>\n"
-       }, {
-               name: "tricky01.dat #8"
-               html: "<TABLE>\n<TR>\n<CENTER><CENTER><TD></TD></TR><TR>\n<FONT>\n<TABLE><tr></tr></TABLE>\n</P>\n<a></font><font></a>\nThis page contains an insanely badly-nested tag sequence."
-               errors: 10
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <center>\n|       <center>\n|     <font>\n|       \"\n\"\n|     <table>\n|       \"\n\"\n|       <tbody>\n|         <tr>\n|           \"\n\"\n|           <td>\n|         <tr>\n|           \"\n\"\n|     <table>\n|       <tbody>\n|         <tr>\n|     <font>\n|       \"\n\"\n|       <p>\n|       \"\n\"\n|       <a>\n|     <a>\n|       <font>\n|     <font>\n|       \"\nThis page contains an insanely badly-nested tag sequence.\"\n"
-       }, {
-               name: "tricky01.dat #9"
-               html: "<html>\n<body>\n<b><nobr><div>This text is in a div inside a nobr</nobr>More text that should not be in the nobr, i.e., the\nnobr should have closed the div inside it implicitly. </b><pre>A pre tag outside everything else.</pre>\n</body>\n</html>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"\n\"\n|     <b>\n|       <nobr>\n|     <div>\n|       <b>\n|         <nobr>\n|           \"This text is in a div inside a nobr\"\n|         \"More text that should not be in the nobr, i.e., the\nnobr should have closed the div inside it implicitly. \"\n|       <pre>\n|         \"A pre tag outside everything else.\"\n|       \"\n\n\"\n"
-       }, {
-               name: "webkit01.dat #1"
-               html: "Test"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"Test\"\n"
-       }, {
-               name: "webkit01.dat #2"
-               html: "<div></div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n"
-       }, {
-               name: "webkit01.dat #3"
-               html: "<div>Test</div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"Test\"\n"
-       }, {
-               name: "webkit01.dat #4"
-               html: "<di"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "webkit01.dat #5"
-               html: "<div>Hello</div>\n<script>\nconsole.log(\"PASS\");\n</script>\n<div>Bye</div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"Hello\"\n|     \"\n\"\n|     <script>\n|       \"\nconsole.log(\"PASS\");\n\"\n|     \"\n\"\n|     <div>\n|       \"Bye\"\n"
-       }, {
-               name: "webkit01.dat #6"
-               html: "<div foo=\"bar\">Hello</div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       foo=\"bar\"\n|       \"Hello\"\n"
-       }, {
-               name: "webkit01.dat #7"
-               html: "<div>Hello</div>\n<script>\nconsole.log(\"FOO<span>BAR</span>BAZ\");\n</script>\n<div>Bye</div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       \"Hello\"\n|     \"\n\"\n|     <script>\n|       \"\nconsole.log(\"FOO<span>BAR</span>BAZ\");\n\"\n|     \"\n\"\n|     <div>\n|       \"Bye\"\n"
-       }, {
-               name: "webkit01.dat #8"
-               html: "<foo bar=\"baz\"></foo><potato quack=\"duck\"></potato>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <foo>\n|       bar=\"baz\"\n|     <potato>\n|       quack=\"duck\"\n"
-       }, {
-               name: "webkit01.dat #9"
-               html: "<foo bar=\"baz\"><potato quack=\"duck\"></potato></foo>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <foo>\n|       bar=\"baz\"\n|       <potato>\n|         quack=\"duck\"\n"
-       }, {
-               name: "webkit01.dat #10"
-               html: "<foo></foo bar=\"baz\"><potato></potato quack=\"duck\">"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <foo>\n|     <potato>\n"
-       }, {
-               name: "webkit01.dat #11"
-               html: "</ tttt>"
-               errors: 2
-               expected: "| <!--  tttt -->\n| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "webkit01.dat #12"
-               html: "<div FOO ><img><img></div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       foo=\"\"\n|       <img>\n|       <img>\n"
-       }, {
-               name: "webkit01.dat #13"
-               html: "<p>Test</p<p>Test2</p>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       \"TestTest2\"\n"
-       }, {
-               name: "webkit01.dat #14"
-               html: "<rdar://problem/6869687>"
-               errors: 5
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <rdar:>\n|       6869687=\"\"\n|       problem=\"\"\n"
-       }, {
-               name: "webkit01.dat #15"
-               html: "<A>test< /A>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|       \"test< /A>\"\n"
-       }, {
-               name: "webkit01.dat #16"
-               html: "&lt;"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"<\"\n"
-       }, {
-               name: "webkit01.dat #17"
-               html: "<body foo='bar'><body foo='baz' yo='mama'>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     foo=\"bar\"\n|     yo=\"mama\"\n"
-       }, {
-               name: "webkit01.dat #18"
-               html: "<body></br foo=\"bar\"></body>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <br>\n"
-       }, {
-               name: "webkit01.dat #19"
-               html: "<bdy><br foo=\"bar\"></body>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <bdy>\n|       <br>\n|         foo=\"bar\"\n"
-       }, {
-               name: "webkit01.dat #20"
-               html: "<body></body></br foo=\"bar\">"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <br>\n"
-       }, {
-               name: "webkit01.dat #21"
-               html: "<bdy></body><br foo=\"bar\">"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <bdy>\n|       <br>\n|         foo=\"bar\"\n"
-       }, {
-               name: "webkit01.dat #22"
-               html: "<html><body></body></html><!-- Hi there -->"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n| <!--  Hi there  -->\n"
-       }, {
-               name: "webkit01.dat #23"
-               html: "<html><body></body></html>x<!-- Hi there -->"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"x\"\n|     <!--  Hi there  -->\n"
-       }, {
-               name: "webkit01.dat #24"
-               html: "<html><body></body></html>x<!-- Hi there --></html><!-- Again -->"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"x\"\n|     <!--  Hi there  -->\n| <!--  Again  -->\n"
-       }, {
-               name: "webkit01.dat #25"
-               html: "<html><body></body></html>x<!-- Hi there --></body></html><!-- Again -->"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"x\"\n|     <!--  Hi there  -->\n| <!--  Again  -->\n"
-       }, {
-               name: "webkit01.dat #26"
-               html: "<html><body><ruby><div><rp>xx</rp></div></ruby></body></html>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       <div>\n|         <rp>\n|           \"xx\"\n"
-       }, {
-               name: "webkit01.dat #27"
-               html: "<html><body><ruby><div><rt>xx</rt></div></ruby></body></html>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ruby>\n|       <div>\n|         <rt>\n|           \"xx\"\n"
-       }, {
-               name: "webkit01.dat #28"
-               html: "<html><frameset><!--1--><noframes>A</noframes><!--2--></frameset><!--3--><noframes>B</noframes><!--4--></html><!--5--><noframes>C</noframes><!--6-->"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <frameset>\n|     <!-- 1 -->\n|     <noframes>\n|       \"A\"\n|     <!-- 2 -->\n|   <!-- 3 -->\n|   <noframes>\n|     \"B\"\n|   <!-- 4 -->\n|   <noframes>\n|     \"C\"\n| <!-- 5 -->\n| <!-- 6 -->\n"
-       }, {
-               name: "webkit01.dat #29"
-               html: "<select><option>A<select><option>B<select><option>C<select><option>D<select><option>E<select><option>F<select><option>G<select>"
-               errors: 6
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <select>\n|       <option>\n|         \"A\"\n|     <option>\n|       \"B\"\n|       <select>\n|         <option>\n|           \"C\"\n|     <option>\n|       \"D\"\n|       <select>\n|         <option>\n|           \"E\"\n|     <option>\n|       \"F\"\n|       <select>\n|         <option>\n|           \"G\"\n"
-       }, {
-               name: "webkit01.dat #30"
-               html: "<dd><dd><dt><dt><dd><li><li>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <dd>\n|     <dd>\n|     <dt>\n|     <dt>\n|     <dd>\n|       <li>\n|       <li>\n"
-       }, {
-               name: "webkit01.dat #31"
-               html: "<div><b></div><div><nobr>a<nobr>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <b>\n|     <div>\n|       <b>\n|         <nobr>\n|           \"a\"\n|         <nobr>\n"
-       }, {
-               name: "webkit01.dat #32"
-               html: "<head></head>\n<body></body>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   \"\n\"\n|   <body>\n"
-       }, {
-               name: "webkit01.dat #33"
-               html: "<head></head> <style></style>ddd"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|     <style>\n|   \" \"\n|   <body>\n|     \"ddd\"\n"
-       }, {
-               name: "webkit01.dat #34"
-               html: "<kbd><table></kbd><col><select><tr>"
-               errors: 6
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <kbd>\n|       <select>\n|       <table>\n|         <colgroup>\n|           <col>\n|         <tbody>\n|           <tr>\n"
-       }, {
-               name: "webkit01.dat #35"
-               html: "<kbd><table></kbd><col><select><tr></table><div>"
-               errors: 6
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <kbd>\n|       <select>\n|       <table>\n|         <colgroup>\n|           <col>\n|         <tbody>\n|           <tr>\n|       <div>\n"
-       }, {
-               name: "webkit01.dat #36"
-               html: "<a><li><style></style><title></title></a>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|     <li>\n|       <a>\n|         <style>\n|         <title>\n"
-       }, {
-               name: "webkit01.dat #37"
-               html: "<font></p><p><meta><title></title></font>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <font>\n|       <p>\n|     <p>\n|       <font>\n|         <meta>\n|         <title>\n"
-       }, {
-               name: "webkit01.dat #38"
-               html: "<a><center><title></title><a>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <a>\n|     <center>\n|       <a>\n|         <title>\n|       <a>\n"
-       }, {
-               name: "webkit01.dat #39"
-               html: "<svg><title><div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg title>\n|         <div>\n"
-       }, {
-               name: "webkit01.dat #40"
-               html: "<svg><title><rect><div>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg title>\n|         <rect>\n|           <div>\n"
-       }, {
-               name: "webkit01.dat #41"
-               html: "<svg><title><svg><div>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg title>\n|         <svg svg>\n|         <div>\n"
-       }, {
-               name: "webkit01.dat #42"
-               html: "<img <=\"\" FAIL>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <img>\n|       <=\"\"\n|       fail=\"\"\n"
-       }, {
-               name: "webkit01.dat #43"
-               html: "<ul><li><div id='foo'/>A</li><li>B<div>C</div></li></ul>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <ul>\n|       <li>\n|         <div>\n|           id=\"foo\"\n|           \"A\"\n|       <li>\n|         \"B\"\n|         <div>\n|           \"C\"\n"
-       }, {
-               name: "webkit01.dat #44"
-               html: "<svg><em><desc></em>"
-               errors: 3
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|     <em>\n|       <desc>\n"
-       }, {
-               name: "webkit01.dat #45"
-               html: "<table><tr><td><svg><desc><td></desc><circle>"
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             <svg svg>\n|               <svg desc>\n|           <td>\n|             <circle>\n"
-       }, {
-               name: "webkit01.dat #46"
-               html: "<svg><tfoot></mi><td>"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg tfoot>\n|         <svg td>\n"
-       }, {
-               name: "webkit01.dat #47"
-               html: "<math><mrow><mrow><mn>1</mn></mrow><mi>a</mi></mrow></math>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <math math>\n|       <math mrow>\n|         <math mrow>\n|           <math mn>\n|             \"1\"\n|         <math mi>\n|           \"a\"\n"
-       }, {
-               name: "webkit01.dat #48"
-               html: "<!doctype html><input type=\"hidden\"><frameset>"
-               errors: 2
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <frameset>\n"
-       }, {
-               name: "webkit01.dat #49"
-               html: "<!doctype html><input type=\"button\"><frameset>"
-               errors: 1
-               expected: "| <!DOCTYPE html>\n| <html>\n|   <head>\n|   <body>\n|     <input>\n|       type=\"button\"\n"
-       }, {
-               name: "webkit02.dat #1"
-               html: "<foo bar=qux/>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <foo>\n|       bar=\"qux/\"\n"
-       }, {
-               name: "webkit02.dat #2"
-               html: "<p id=\"status\"><noscript><strong>A</strong></noscript><span>B</span></p>"
-               scripting: true
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       id=\"status\"\n|       <noscript>\n|         \"<strong>A</strong>\"\n|       <span>\n|         \"B\"\n"
-       }, {
-               name: "webkit02.dat #3"
-               html: "<p id=\"status\"><noscript><strong>A</strong></noscript><span>B</span></p>"
-               scripting: false
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <p>\n|       id=\"status\"\n|       <noscript>\n|         <strong>\n|           \"A\"\n|       <span>\n|         \"B\"\n"
-       }, {
-               name: "webkit02.dat #4"
-               html: "<div><sarcasm><div></div></sarcasm></div>"
-               errors: 1
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <div>\n|       <sarcasm>\n|         <div>\n"
-       }, {
-               name: "webkit02.dat #5"
-               html: "<html><body><img src=\"\" border=\"0\" alt=\"><div>A</div></body></html>"
-               errors: 2
-               expected: "| <html>\n|   <head>\n|   <body>\n"
-       }, {
-               name: "webkit02.dat #6"
-               html: "<table><td></tbody>A"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     \"A\"\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n"
-       }, {
-               name: "webkit02.dat #7"
-               html: "<table><td></thead>A"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"A\"\n"
-       }, {
-               name: "webkit02.dat #8"
-               html: "<table><td></tfoot>A"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <tbody>\n|         <tr>\n|           <td>\n|             \"A\"\n"
-       }, {
-               name: "webkit02.dat #9"
-               html: "<table><thead><td></tbody>A"
-               errors: 4
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <table>\n|       <thead>\n|         <tr>\n|           <td>\n|             \"A\"\n"
-       }, {
-               name: "webkit02.dat #10"
-               html: "<legend>test</legend>"
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <legend>\n|       \"test\"\n"
-       }, {
-               name: "webkit02.dat #11"
-               html: "<table><input>"
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <input>\n|     <table>\n"
-       }, {
-               name: "webkit02.dat #12"
-               html: "<b><em><foo><foo><aside></b>"
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <em>\n|         <foo>\n|           <foo>\n|     <em>\n|       <aside>\n|         <b>\n"
-       }, {
-               name: "webkit02.dat #13"
-               html: "<b><em><foo><foo><aside></b></em>"
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <em>\n|         <foo>\n|           <foo>\n|     <em>\n|     <aside>\n|       <em>\n|         <b>\n"
-       }, {
-               name: "webkit02.dat #14"
-               html: "<b><em><foo><foo><foo><aside></b>"
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <em>\n|         <foo>\n|           <foo>\n|             <foo>\n|     <aside>\n|       <b>\n"
-       }, {
-               name: "webkit02.dat #15"
-               html: "<b><em><foo><foo><foo><aside></b></em>"
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <b>\n|       <em>\n|         <foo>\n|           <foo>\n|             <foo>\n|     <aside>\n|       <b>\n"
-       }, {
-               name: "webkit02.dat #16"
-               html: "<b><em><foo><foo><foo><foo><foo><foo><foo><foo><foo><foo><aside></b></em>"
-               fragment: "div"
-               expected: "| <b>\n|   <em>\n|     <foo>\n|       <foo>\n|         <foo>\n|           <foo>\n|             <foo>\n|               <foo>\n|                 <foo>\n|                   <foo>\n|                     <foo>\n|                       <foo>\n| <aside>\n|   <b>\n"
-       }, {
-               name: "webkit02.dat #17"
-               html: "<b><em><foo><foob><foob><foob><foob><fooc><fooc><fooc><fooc><food><aside></b></em>"
-               fragment: "div"
-               expected: "| <b>\n|   <em>\n|     <foo>\n|       <foob>\n|         <foob>\n|           <foob>\n|             <foob>\n|               <fooc>\n|                 <fooc>\n|                   <fooc>\n|                     <fooc>\n|                       <food>\n| <aside>\n|   <b>\n"
-       }, {
-               name: "webkit02.dat #18"
-               html: "<isindex action=\"x\">"
-               fragment: "table"
-               expected: "| <form>\n|   action=\"x\"\n|   <hr>\n|   <label>\n|     \"This is a searchable index. Enter search keywords: \"\n|     <input>\n|       name=\"isindex\"\n|   <hr>\n"
-       }, {
-               name: "webkit02.dat #19"
-               html: "<option><XH<optgroup></optgroup>"
-               fragment: "select"
-               expected: "| <option>\n"
-       }, {
-               name: "webkit02.dat #20"
-               html: "<svg><foreignObject><div>foo</div><plaintext></foreignObject></svg><div>bar</div>"
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg foreignObject>\n|         <div>\n|           \"foo\"\n|         <plaintext>\n|           \"</foreignObject></svg><div>bar</div>\"\n"
-       }, {
-               name: "webkit02.dat #21"
-               html: "<svg><foreignObject></foreignObject><title></svg>foo"
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <svg svg>\n|       <svg foreignObject>\n|       <svg title>\n|     \"foo\"\n"
-       }, {
-               name: "webkit02.dat #22"
-               html: "</foreignObject><plaintext><div>foo</div>"
-               expected: "| <html>\n|   <head>\n|   <body>\n|     <plaintext>\n|       \"<div>foo</div>\"\n"
-       }
-]
-
-if typeof module isnt 'undefined' and module.exports?
-       wheic = require './parse-html.coffee'
-else
-       wheic = window.wheic
-
-serialize_els = (els, prefix = '| ') ->
-       ret = ''
-       for el in els
-               switch el.type
-                       when wheic.TYPE_TAG
-                               ret += "#{prefix}<"
-                               if el.namespace is wheic.NS_MATHML
-                                       ret += "math "
-                               if el.namespace is wheic.NS_SVG
-                                       ret += "svg "
-                               ret += "#{el.name}>\n"
-                               attr_keys = []
-                               for k of el.attrs
-                                       attr_keys.push k
-                               attr_keys.sort() # TODO this should be "lexicographically by UTF-16 code unit"
-                               for k in attr_keys
-                                       ret += "#{prefix}  #{k}=\"#{el.attrs[k]}\"\n"
-                               if el.name is 'template' and el.namespace is wheic.NS_HTML
-                                       ret += "#{prefix}  content\n"
-                                       ret += serialize_els el.children, "#{prefix}    "
-                               else
-                                       ret += serialize_els el.children, "#{prefix}  "
-                       when wheic.TYPE_TEXT
-                               ret += "#{prefix}\"#{el.text}\"\n"
-                       when wheic.TYPE_COMMENT
-                               ret += "#{prefix}<!-- #{el.text} -->\n"
-                       when wheic.TYPE_DOCTYPE
-                               ret += "#{prefix}<!DOCTYPE #{el.name}"
-                               if (el.public_identifier? and el.public_identifier.length > 0) or (el.system_identifier? and el.system_identifier.length > 0)
-                                       ret += " \"#{el.public_identifier ? ''}\""
-                                       ret += " \"#{el.system_identifier ? ''}\""
-                               ret += ">\n"
-                       else
-                               ret += "#{prefix}UNKNOWN TAG TYPE #{el.type}"
-       return ret
-
-test_results = passed: 0, failed: 0
-test_parser = (args) ->
-       wheic.debug_log_reset()
-       parse_errors = []
-       args.error_cb = (i) ->
-               parse_errors.push i
-       prev_node_id = 0 # reset counter
-       parsed = wheic.parse_html args.html, args
-       serialized = serialize_els parsed
-       if serialized isnt args.expected
-               test_results.failed += 1
-               if test_results.failed is 1
-                       wheic.debug_log_each (str) ->
-                               console.log str
-                       console.log "FAILED: \"#{args.name}\""
-                       console.log "      Input: #{args.html}"
-                       if args.fragment?
-                               console.log "   Fragment: #{args.fragment}"
-                       console.log "    Correct: #{args.expected}"
-                       console.log "     Output: #{serialized}"
-                       if parse_errors.length > 0
-                               console.log " parse errs: #{JSON.stringify parse_errors}"
-                       else
-                               console.log "   No parse errors"
-       else
-               test_results.passed += 1
-               # console.log "passed \"#{args.name}\""
-test_summary = ->
-       console.log "Tests passed: #{test_results.passed}, Failed: #{test_results.failed}"
-
-
-next_test = 0
-run_tests_and_breathe = ->
-       start_time = new Date()
-       loop
-               if next_test >= tests.length
-                       test_summary()
-                       return
-               test_parser tests[next_test]
-               next_test += 1
-               now = new Date()
-               if now - start_time > 100 # miliseconds
-                       break
-       setTimeout run_tests_and_breathe, 1
-run_tests_and_breathe()