{
    "tests": [
        {
            "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"
                ]
            ]
        },
        {
            "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"
                ]
            ]
        },
        {
            "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"
                ]
            ]
        },
        {
            "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"
                ]
            ]
        },
        {
            "description": "<!doctype html><table><meta></table>",
            "input": "<!doctype html><table><meta></table>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "table",
                    {}
                ],
                [
                    "StartTag",
                    "meta",
                    {}
                ],
                [
                    "EndTag",
                    "table"
                ]
            ]
        },
        {
            "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"
                ]
            ]
        },
        {
            "description": "<!doctype html><html> <head>",
            "input": "<!doctype html><html> <head>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "html",
                    {}
                ],
                [
                    "Character",
                    " "
                ],
                [
                    "StartTag",
                    "head",
                    {}
                ]
            ]
        },
        {
            "description": "<!doctype html> <head>",
            "input": "<!doctype html> <head>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "Character",
                    " "
                ],
                [
                    "StartTag",
                    "head",
                    {}
                ]
            ]
        },
        {
            "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"
                ]
            ]
        },
        {
            "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"
                ]
            ]
        },
        {
            "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"
                ]
            ]
        },
        {
            "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"
                ]
            ]
        },
        {
            "description": "<!doctype html><listing>\\r\\nX</listing>",
            "input": "<!doctype html><listing>\r\nX</listing>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "listing",
                    {}
                ],
                [
                    "Character",
                    "X"
                ],
                [
                    "EndTag",
                    "listing"
                ]
            ]
        },
        {
            "description": "<!doctype html><select><input>X",
            "input": "<!doctype html><select><input>X",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "select",
                    {}
                ],
                [
                    "StartTag",
                    "input",
                    {}
                ],
                [
                    "Character",
                    "X"
                ]
            ]
        },
        {
            "description": "<!doctype html><select><select>X",
            "input": "<!doctype html><select><select>X",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "select",
                    {}
                ],
                [
                    "StartTag",
                    "select",
                    {}
                ],
                [
                    "Character",
                    "X"
                ]
            ]
        },
        {
            "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"
                ]
            ]
        },
        {
            "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"
                ]
            ]
        },
        {
            "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"
                ]
            ]
        },
        {
            "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"
                ]
            ]
        },
        {
            "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"
                ]
            ]
        },
        {
            "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",
                    {}
                ]
            ]
        },
        {
            "description": "<!doctype html><select>X</select>",
            "input": "<!doctype html><select>X</select>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "select",
                    {}
                ],
                [
                    "Character",
                    "X"
                ],
                [
                    "EndTag",
                    "select"
                ]
            ]
        },
        {
            "description": "<!DOCTYPE hTmL><html></html>",
            "input": "<!DOCTYPE hTmL><html></html>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "html",
                    {}
                ],
                [
                    "EndTag",
                    "html"
                ]
            ]
        },
        {
            "description": "<!DOCTYPE HTML><html></html>",
            "input": "<!DOCTYPE HTML><html></html>",
            "output": [
                [
                    "DOCTYPE",
                    "html",
                    null,
                    null,
                    true
                ],
                [
                    "StartTag",
                    "html",
                    {}
                ],
                [
                    "EndTag",
                    "html"
                ]
            ]
        },
        {
            "description": "<div><p>a</x> b",
            "input": "<div><p>a</x> b",
            "output": [
                [
                    "StartTag",
                    "div",
                    {}
                ],
                [
                    "StartTag",
                    "p",
                    {}
                ],
                [
                    "Character",
                    "a"
                ],
                [
                    "EndTag",
                    "x"
                ],
                [
                    "Character",
                    " b"
                ]
            ]
        },
        {
            "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"
                ]
            ]
        },
        {
            "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"
                ]
            ]
        },
        {
            "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"
                ]
            ]
        },
        {
            "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"
                ]
            ]
        },
        {
            "description": "<select><keygen>",
            "input": "<select><keygen>",
            "output": [
                [
                    "StartTag",
                    "select",
                    {}
                ],
                [
                    "StartTag",
                    "keygen",
                    {}
                ]
            ]
        }
    ]
}