{
    "tests": [
        {
            "fragmentContext": null,
            "description": "<!doctype html><body><title>X</title>",
            "input": "<!doctype html><body><title>X</title>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "body",
                    {}
                ],
                [
                    "StartTag",
                    "title",
                    {}
                ],
                [
                    "Character",
                    "X"
                ],
                [
                    "EndTag",
                    "title"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><table><title>X</title></table>",
            "input": "<!doctype html><table><title>X</title></table>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "title",
                    {}
                ],
                [
                    "Character",
                    "X"
                ],
                [
                    "EndTag",
                    "title"
                ],
                [
                    "EndTag",
                    "table"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><head></head><title>X</title>",
            "input": "<!doctype html><head></head><title>X</title>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "head",
                    {}
                ],
                [
                    "EndTag",
                    "head"
                ],
                [
                    "StartTag",
                    "title",
                    {}
                ],
                [
                    "Character",
                    "X"
                ],
                [
                    "EndTag",
                    "title"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html></head><title>X</title>",
            "input": "<!doctype html></head><title>X</title>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "EndTag",
                    "head"
                ],
                [
                    "StartTag",
                    "title",
                    {}
                ],
                [
                    "Character",
                    "X"
                ],
                [
                    "EndTag",
                    "title"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><table><meta></table>",
            "input": "<!doctype html><table><meta></table>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "meta",
                    {}
                ],
                [
                    "EndTag",
                    "table"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><table>X<tr><td><table> <meta></table></table>",
            "input": "<!doctype html><table>X<tr><td><table> <meta></table></table>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "Character",
                    "X"
                ],
                [
                    "StartTag",
                    "tr",
                    {}
                ],
                [
                    "StartTag",
                    "td",
                    {}
                ],
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "Character",
                    " "
                ],
                [
                    "StartTag",
                    "meta",
                    {}
                ],
                [
                    "EndTag",
                    "table"
                ],
                [
                    "EndTag",
                    "table"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><html> <head>",
            "input": "<!doctype html><html> <head>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "html",
                    {}
                ],
                [
                    "Character",
                    " "
                ],
                [
                    "StartTag",
                    "head",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html> <head>",
            "input": "<!doctype html> <head>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "Character",
                    " "
                ],
                [
                    "StartTag",
                    "head",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><table><style> <tr>x </style> </table>",
            "input": "<!doctype html><table><style> <tr>x </style> </table>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "style",
                    {}
                ],
                [
                    "Character",
                    " <tr>x "
                ],
                [
                    "EndTag",
                    "style"
                ],
                [
                    "Character",
                    " "
                ],
                [
                    "EndTag",
                    "table"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><table><TBODY><script> <tr>x </script> </table>",
            "input": "<!doctype html><table><TBODY><script> <tr>x </script> </table>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "tbody",
                    {}
                ],
                [
                    "StartTag",
                    "script",
                    {}
                ],
                [
                    "Character",
                    " <tr>x "
                ],
                [
                    "EndTag",
                    "script"
                ],
                [
                    "Character",
                    " "
                ],
                [
                    "EndTag",
                    "table"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><p><applet><p>X</p></applet>",
            "input": "<!doctype html><p><applet><p>X</p></applet>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "p",
                    {}
                ],
                [
                    "StartTag",
                    "applet",
                    {}
                ],
                [
                    "StartTag",
                    "p",
                    {}
                ],
                [
                    "Character",
                    "X"
                ],
                [
                    "EndTag",
                    "p"
                ],
                [
                    "EndTag",
                    "applet"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><p><object type=\"application/x-non-existant-plugin\"><p>X</p></object>",
            "input": "<!doctype html><p><object type=\"application/x-non-existant-plugin\"><p>X</p></object>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "p",
                    {}
                ],
                [
                    "StartTag",
                    "object",
                    {
                        "type": "application/x-non-existant-plugin"
                    }
                ],
                [
                    "StartTag",
                    "p",
                    {}
                ],
                [
                    "Character",
                    "X"
                ],
                [
                    "EndTag",
                    "p"
                ],
                [
                    "EndTag",
                    "object"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><listing>\\nX</listing>",
            "input": "<!doctype html><listing>\nX</listing>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "listing",
                    {}
                ],
                [
                    "Character",
                    "X"
                ],
                [
                    "EndTag",
                    "listing"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><select><input>X",
            "input": "<!doctype html><select><input>X",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "select",
                    {}
                ],
                [
                    "StartTag",
                    "input",
                    {}
                ],
                [
                    "Character",
                    "X"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><select><select>X",
            "input": "<!doctype html><select><select>X",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "select",
                    {}
                ],
                [
                    "StartTag",
                    "select",
                    {}
                ],
                [
                    "Character",
                    "X"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><table><input type=hidDEN></table>",
            "input": "<!doctype html><table><input type=hidDEN></table>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "input",
                    {
                        "type": "hidDEN"
                    }
                ],
                [
                    "EndTag",
                    "table"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><table>X<input type=hidDEN></table>",
            "input": "<!doctype html><table>X<input type=hidDEN></table>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "Character",
                    "X"
                ],
                [
                    "StartTag",
                    "input",
                    {
                        "type": "hidDEN"
                    }
                ],
                [
                    "EndTag",
                    "table"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><table>  <input type=hidDEN></table>",
            "input": "<!doctype html><table>  <input type=hidDEN></table>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "Character",
                    "  "
                ],
                [
                    "StartTag",
                    "input",
                    {
                        "type": "hidDEN"
                    }
                ],
                [
                    "EndTag",
                    "table"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><table>  <input type='hidDEN'></table>",
            "input": "<!doctype html><table>  <input type='hidDEN'></table>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "Character",
                    "  "
                ],
                [
                    "StartTag",
                    "input",
                    {
                        "type": "hidDEN"
                    }
                ],
                [
                    "EndTag",
                    "table"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><table><input type=\" hidden\"><input type=hidDEN></table>",
            "input": "<!doctype html><table><input type=\" hidden\"><input type=hidDEN></table>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "input",
                    {
                        "type": " hidden"
                    }
                ],
                [
                    "StartTag",
                    "input",
                    {
                        "type": "hidDEN"
                    }
                ],
                [
                    "EndTag",
                    "table"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><table><select>X<tr>",
            "input": "<!doctype html><table><select>X<tr>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "select",
                    {}
                ],
                [
                    "Character",
                    "X"
                ],
                [
                    "StartTag",
                    "tr",
                    {}
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!doctype html><select>X</select>",
            "input": "<!doctype html><select>X</select>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "select",
                    {}
                ],
                [
                    "Character",
                    "X"
                ],
                [
                    "EndTag",
                    "select"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!DOCTYPE hTmL><html></html>",
            "input": "<!DOCTYPE hTmL><html></html>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "html",
                    {}
                ],
                [
                    "EndTag",
                    "html"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<!DOCTYPE HTML><html></html>",
            "input": "<!DOCTYPE HTML><html></html>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "html",
                    {}
                ],
                [
                    "EndTag",
                    "html"
                ]
            ]
        },
        {
            "fragmentContext": "html",
            "description": "<body>X</body></body>",
            "input": "<body>X</body></body>",
            "output": [
                [
                    "StartTag",
                    "body",
                    {}
                ],
                [
                    "Character",
                    "X"
                ],
                [
                    "EndTag",
                    "body"
                ],
                [
                    "EndTag",
                    "body"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<div><p>a</x> b",
            "input": "<div><p>a</x> b",
            "output": [
                [
                    "StartTag",
                    "div",
                    {}
                ],
                [
                    "StartTag",
                    "p",
                    {}
                ],
                [
                    "Character",
                    "a"
                ],
                [
                    "EndTag",
                    "x"
                ],
                [
                    "Character",
                    " b"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<table><tr><td><code></code> </table>",
            "input": "<table><tr><td><code></code> </table>",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "tr",
                    {}
                ],
                [
                    "StartTag",
                    "td",
                    {}
                ],
                [
                    "StartTag",
                    "code",
                    {}
                ],
                [
                    "EndTag",
                    "code"
                ],
                [
                    "Character",
                    " "
                ],
                [
                    "EndTag",
                    "table"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<table><b><tr><td>aaa</td></tr>bbb</table>ccc",
            "input": "<table><b><tr><td>aaa</td></tr>bbb</table>ccc",
            "output": [
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "b",
                    {}
                ],
                [
                    "StartTag",
                    "tr",
                    {}
                ],
                [
                    "StartTag",
                    "td",
                    {}
                ],
                [
                    "Character",
                    "aaa"
                ],
                [
                    "EndTag",
                    "td"
                ],
                [
                    "EndTag",
                    "tr"
                ],
                [
                    "Character",
                    "bbb"
                ],
                [
                    "EndTag",
                    "table"
                ],
                [
                    "Character",
                    "ccc"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "A<table><tr> B</tr> B</table>",
            "input": "A<table><tr> B</tr> B</table>",
            "output": [
                [
                    "Character",
                    "A"
                ],
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "tr",
                    {}
                ],
                [
                    "Character",
                    " B"
                ],
                [
                    "EndTag",
                    "tr"
                ],
                [
                    "Character",
                    " B"
                ],
                [
                    "EndTag",
                    "table"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "A<table><tr> B</tr> </em>C</table>",
            "input": "A<table><tr> B</tr> </em>C</table>",
            "output": [
                [
                    "Character",
                    "A"
                ],
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "tr",
                    {}
                ],
                [
                    "Character",
                    " B"
                ],
                [
                    "EndTag",
                    "tr"
                ],
                [
                    "Character",
                    " "
                ],
                [
                    "EndTag",
                    "em"
                ],
                [
                    "Character",
                    "C"
                ],
                [
                    "EndTag",
                    "table"
                ]
            ]
        },
        {
            "fragmentContext": null,
            "description": "<select><keygen>",
            "input": "<select><keygen>",
            "output": [
                [
                    "StartTag",
                    "select",
                    {}
                ],
                [
                    "StartTag",
                    "keygen",
                    {}
                ]
            ]
        }
    ]
}