{
    "tests": [
        {
            "fragmentContext": null,
            "description": "<!doctype html></head> <head>",
            "input": "<!doctype html></head> <head>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "EndTag",
                    "head"
                ],
                [
                    "Character",
                    " "
                ],
                [
                    "StartTag",
                    "head",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><form><div></form><div>",
            "input": "<!doctype html><form><div></form><div>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "form",
                    {}
                ],
                [
                    "StartTag",
                    "div",
                    {}
                ],
                [
                    "EndTag",
                    "form"
                ],
                [
                    "StartTag",
                    "div",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><title>&amp;</title>",
            "input": "<!doctype html><title>&amp;</title>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "title",
                    {}
                ],
                [
                    "Character",
                    "&"
                ],
                [
                    "EndTag",
                    "title"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><title><!--&amp;--></title>",
            "input": "<!doctype html><title><!--&amp;--></title>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "title",
                    {}
                ],
                [
                    "Character",
                    "<!--&-->"
                ],
                [
                    "EndTag",
                    "title"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype>",
            "input": "<!doctype>",
            "output": [
                [
                    "DOCTYPE",
                    null,
                    null,
                    null,
                    false
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!---x",
            "input": "<!---x",
            "output": [
                [
                    "Comment",
                    "-x"
                ]
            ]
        },
        {
            "fragmentContext": "div",
            "description": "<body>\\n<div>",
            "input": "<body>\n<div>",
            "output": [
                [
                    "StartTag",
                    "body",
                    {}
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "StartTag",
                    "div",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<frameset></frameset>\\nfoo",
            "input": "<frameset></frameset>\nfoo",
            "output": [
                [
                    "StartTag",
                    "frameset",
                    {}
                ],
                [
                    "EndTag",
                    "frameset"
                ],
                [
                    "Character",
                    "\nfoo"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<frameset></frameset>\\n<noframes>",
            "input": "<frameset></frameset>\n<noframes>",
            "output": [
                [
                    "StartTag",
                    "frameset",
                    {}
                ],
                [
                    "EndTag",
                    "frameset"
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "StartTag",
                    "noframes",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<frameset></frameset>\\n<div>",
            "input": "<frameset></frameset>\n<div>",
            "output": [
                [
                    "StartTag",
                    "frameset",
                    {}
                ],
                [
                    "EndTag",
                    "frameset"
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "StartTag",
                    "div",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<frameset></frameset>\\n</html>",
            "input": "<frameset></frameset>\n</html>",
            "output": [
                [
                    "StartTag",
                    "frameset",
                    {}
                ],
                [
                    "EndTag",
                    "frameset"
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "EndTag",
                    "html"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<frameset></frameset>\\n</div>",
            "input": "<frameset></frameset>\n</div>",
            "output": [
                [
                    "StartTag",
                    "frameset",
                    {}
                ],
                [
                    "EndTag",
                    "frameset"
                ],
                [
                    "Character",
                    "\n"
                ],
                [
                    "EndTag",
                    "div"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<form><form>",
            "input": "<form><form>",
            "output": [
                [
                    "StartTag",
                    "form",
                    {}
                ],
                [
                    "StartTag",
                    "form",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<button><button>",
            "input": "<button><button>",
            "output": [
                [
                    "StartTag",
                    "button",
                    {}
                ],
                [
                    "StartTag",
                    "button",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<table><tr><td></th>",
            "input": "<table><tr><td></th>",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "tr",
                    {}
                ],
                [
                    "StartTag",
                    "td",
                    {}
                ],
                [
                    "EndTag",
                    "th"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<table><caption><td>",
            "input": "<table><caption><td>",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "caption",
                    {}
                ],
                [
                    "StartTag",
                    "td",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<table><caption><div>",
            "input": "<table><caption><div>",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "caption",
                    {}
                ],
                [
                    "StartTag",
                    "div",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": "caption",
            "description": "</caption><div>",
            "input": "</caption><div>",
            "output": [
                [
                    "EndTag",
                    "caption"
                ],
                [
                    "StartTag",
                    "div",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<table><caption><div></caption>",
            "input": "<table><caption><div></caption>",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "caption",
                    {}
                ],
                [
                    "StartTag",
                    "div",
                    {}
                ],
                [
                    "EndTag",
                    "caption"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<table><caption></table>",
            "input": "<table><caption></table>",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "caption",
                    {}
                ],
                [
                    "EndTag",
                    "table"
                ]
            ]
        },
        {
            "fragmentContext": "caption",
            "description": "</table><div>",
            "input": "</table><div>",
            "output": [
                [
                    "EndTag",
                    "table"
                ],
                [
                    "StartTag",
                    "div",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<table><caption></body></col></colgroup></html></tbody></td></tfoot></th></thead></tr>",
            "input": "<table><caption></body></col></colgroup></html></tbody></td></tfoot></th></thead></tr>",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "caption",
                    {}
                ],
                [
                    "EndTag",
                    "body"
                ],
                [
                    "EndTag",
                    "col"
                ],
                [
                    "EndTag",
                    "colgroup"
                ],
                [
                    "EndTag",
                    "html"
                ],
                [
                    "EndTag",
                    "tbody"
                ],
                [
                    "EndTag",
                    "td"
                ],
                [
                    "EndTag",
                    "tfoot"
                ],
                [
                    "EndTag",
                    "th"
                ],
                [
                    "EndTag",
                    "thead"
                ],
                [
                    "EndTag",
                    "tr"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<table><caption><div></div>",
            "input": "<table><caption><div></div>",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "caption",
                    {}
                ],
                [
                    "StartTag",
                    "div",
                    {}
                ],
                [
                    "EndTag",
                    "div"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<table><tr><td></body></caption></col></colgroup></html>",
            "input": "<table><tr><td></body></caption></col></colgroup></html>",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "tr",
                    {}
                ],
                [
                    "StartTag",
                    "td",
                    {}
                ],
                [
                    "EndTag",
                    "body"
                ],
                [
                    "EndTag",
                    "caption"
                ],
                [
                    "EndTag",
                    "col"
                ],
                [
                    "EndTag",
                    "colgroup"
                ],
                [
                    "EndTag",
                    "html"
                ]
            ]
        },
        {
            "fragmentContext": "td",
            "description": "</table></tbody></tfoot></thead></tr><div>",
            "input": "</table></tbody></tfoot></thead></tr><div>",
            "output": [
                [
                    "EndTag",
                    "table"
                ],
                [
                    "EndTag",
                    "tbody"
                ],
                [
                    "EndTag",
                    "tfoot"
                ],
                [
                    "EndTag",
                    "thead"
                ],
                [
                    "EndTag",
                    "tr"
                ],
                [
                    "StartTag",
                    "div",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<table><colgroup>foo",
            "input": "<table><colgroup>foo",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "colgroup",
                    {}
                ],
                [
                    "Character",
                    "foo"
                ]
            ]
        },
        {
            "fragmentContext": "colgroup",
            "description": "foo<col>",
            "input": "foo<col>",
            "output": [
                [
                    "Character",
                    "foo"
                ],
                [
                    "StartTag",
                    "col",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<table><colgroup></col>",
            "input": "<table><colgroup></col>",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "colgroup",
                    {}
                ],
                [
                    "EndTag",
                    "col"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<frameset><div>",
            "input": "<frameset><div>",
            "output": [
                [
                    "StartTag",
                    "frameset",
                    {}
                ],
                [
                    "StartTag",
                    "div",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": "frameset",
            "description": "</frameset><frame>",
            "input": "</frameset><frame>",
            "output": [
                [
                    "EndTag",
                    "frameset"
                ],
                [
                    "StartTag",
                    "frame",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<frameset></div>",
            "input": "<frameset></div>",
            "output": [
                [
                    "StartTag",
                    "frameset",
                    {}
                ],
                [
                    "EndTag",
                    "div"
                ]
            ]
        },
        {
            "fragmentContext": "body",
            "description": "</body><div>",
            "input": "</body><div>",
            "output": [
                [
                    "EndTag",
                    "body"
                ],
                [
                    "StartTag",
                    "div",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<table><tr><div>",
            "input": "<table><tr><div>",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "tr",
                    {}
                ],
                [
                    "StartTag",
                    "div",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": "tr",
            "description": "</tr><td>",
            "input": "</tr><td>",
            "output": [
                [
                    "EndTag",
                    "tr"
                ],
                [
                    "StartTag",
                    "td",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": "tr",
            "description": "</tbody></tfoot></thead><td>",
            "input": "</tbody></tfoot></thead><td>",
            "output": [
                [
                    "EndTag",
                    "tbody"
                ],
                [
                    "EndTag",
                    "tfoot"
                ],
                [
                    "EndTag",
                    "thead"
                ],
                [
                    "StartTag",
                    "td",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<table><tr><div><td>",
            "input": "<table><tr><div><td>",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "tr",
                    {}
                ],
                [
                    "StartTag",
                    "div",
                    {}
                ],
                [
                    "StartTag",
                    "td",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": "tbody",
            "description": "<caption><col><colgroup><tbody><tfoot><thead><tr>",
            "input": "<caption><col><colgroup><tbody><tfoot><thead><tr>",
            "output": [
                [
                    "StartTag",
                    "caption",
                    {}
                ],
                [
                    "StartTag",
                    "col",
                    {}
                ],
                [
                    "StartTag",
                    "colgroup",
                    {}
                ],
                [
                    "StartTag",
                    "tbody",
                    {}
                ],
                [
                    "StartTag",
                    "tfoot",
                    {}
                ],
                [
                    "StartTag",
                    "thead",
                    {}
                ],
                [
                    "StartTag",
                    "tr",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<table><tbody></thead>",
            "input": "<table><tbody></thead>",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "tbody",
                    {}
                ],
                [
                    "EndTag",
                    "thead"
                ]
            ]
        },
        {
            "fragmentContext": "tbody",
            "description": "</table><tr>",
            "input": "</table><tr>",
            "output": [
                [
                    "EndTag",
                    "table"
                ],
                [
                    "StartTag",
                    "tr",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<table><tbody></body></caption></col></colgroup></html></td></th></tr>",
            "input": "<table><tbody></body></caption></col></colgroup></html></td></th></tr>",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "tbody",
                    {}
                ],
                [
                    "EndTag",
                    "body"
                ],
                [
                    "EndTag",
                    "caption"
                ],
                [
                    "EndTag",
                    "col"
                ],
                [
                    "EndTag",
                    "colgroup"
                ],
                [
                    "EndTag",
                    "html"
                ],
                [
                    "EndTag",
                    "td"
                ],
                [
                    "EndTag",
                    "th"
                ],
                [
                    "EndTag",
                    "tr"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<table><tbody></div>",
            "input": "<table><tbody></div>",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "tbody",
                    {}
                ],
                [
                    "EndTag",
                    "div"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<table><table>",
            "input": "<table><table>",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "table",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<table></body></caption></col></colgroup></html></tbody></td></tfoot></th></thead></tr>",
            "input": "<table></body></caption></col></colgroup></html></tbody></td></tfoot></th></thead></tr>",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "EndTag",
                    "body"
                ],
                [
                    "EndTag",
                    "caption"
                ],
                [
                    "EndTag",
                    "col"
                ],
                [
                    "EndTag",
                    "colgroup"
                ],
                [
                    "EndTag",
                    "html"
                ],
                [
                    "EndTag",
                    "tbody"
                ],
                [
                    "EndTag",
                    "td"
                ],
                [
                    "EndTag",
                    "tfoot"
                ],
                [
                    "EndTag",
                    "th"
                ],
                [
                    "EndTag",
                    "thead"
                ],
                [
                    "EndTag",
                    "tr"
                ]
            ]
        },
        {
            "fragmentContext": "table",
            "description": "</table><tr>",
            "input": "</table><tr>",
            "output": [
                [
                    "EndTag",
                    "table"
                ],
                [
                    "StartTag",
                    "tr",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": "html",
            "description": "<body></body></html>",
            "input": "<body></body></html>",
            "output": [
                [
                    "StartTag",
                    "body",
                    {}
                ],
                [
                    "EndTag",
                    "body"
                ],
                [
                    "EndTag",
                    "html"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<html><frameset></frameset></html> ",
            "input": "<html><frameset></frameset></html> ",
            "output": [
                [
                    "StartTag",
                    "html",
                    {}
                ],
                [
                    "StartTag",
                    "frameset",
                    {}
                ],
                [
                    "EndTag",
                    "frameset"
                ],
                [
                    "EndTag",
                    "html"
                ],
                [
                    "Character",
                    " "
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\"><html></html>",
            "input": "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\"><html></html>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    "-//W3C//DTD HTML 4.01//EN",
                    null,
                    true
                ],
                [
                    "StartTag",
                    "html",
                    {}
                ],
                [
                    "EndTag",
                    "html"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<param><frameset></frameset>",
            "input": "<param><frameset></frameset>",
            "output": [
                [
                    "StartTag",
                    "param",
                    {}
                ],
                [
                    "StartTag",
                    "frameset",
                    {}
                ],
                [
                    "EndTag",
                    "frameset"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<source><frameset></frameset>",
            "input": "<source><frameset></frameset>",
            "output": [
                [
                    "StartTag",
                    "source",
                    {}
                ],
                [
                    "StartTag",
                    "frameset",
                    {}
                ],
                [
                    "EndTag",
                    "frameset"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<track><frameset></frameset>",
            "input": "<track><frameset></frameset>",
            "output": [
                [
                    "StartTag",
                    "track",
                    {}
                ],
                [
                    "StartTag",
                    "frameset",
                    {}
                ],
                [
                    "EndTag",
                    "frameset"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "</html><frameset></frameset>",
            "input": "</html><frameset></frameset>",
            "output": [
                [
                    "EndTag",
                    "html"
                ],
                [
                    "StartTag",
                    "frameset",
                    {}
                ],
                [
                    "EndTag",
                    "frameset"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "</body><frameset></frameset>",
            "input": "</body><frameset></frameset>",
            "output": [
                [
                    "EndTag",
                    "body"
                ],
                [
                    "StartTag",
                    "frameset",
                    {}
                ],
                [
                    "EndTag",
                    "frameset"
                ]
            ]
        }
    ]
}