{
"tests": [
{
"fragmentContext": null,
"description": "Test",
"input": "Test",
"output": [
[
"Character",
"Test"
]
]
},
{
"fragmentContext": null,
"description": "<div></div>",
"input": "<div></div>",
"output": [
[
"StartTag",
"div",
{}
],
[
"EndTag",
"div"
]
]
},
{
"fragmentContext": null,
"description": "<div>Test</div>",
"input": "<div>Test</div>",
"output": [
[
"StartTag",
"div",
{}
],
[
"Character",
"Test"
],
[
"EndTag",
"div"
]
]
},
{
"fragmentContext": null,
"description": "<di",
"input": "<di",
"output": []
},
{
"fragmentContext": null,
"description": "<div>Hello</div>\\n<script>\\nconsole.log(\"PASS\");\\n</script>\\n<div>Bye</div>",
"input": "<div>Hello</div>\n<script>\nconsole.log(\"PASS\");\n</script>\n<div>Bye</div>",
"output": [
[
"StartTag",
"div",
{}
],
[
"Character",
"Hello"
],
[
"EndTag",
"div"
],
[
"Character",
"\n"
],
[
"StartTag",
"script",
{}
],
[
"Character",
"\nconsole.log(\"PASS\");\n"
],
[
"EndTag",
"script"
],
[
"Character",
"\n"
],
[
"StartTag",
"div",
{}
],
[
"Character",
"Bye"
],
[
"EndTag",
"div"
]
]
},
{
"fragmentContext": null,
"description": "<div foo=\"bar\">Hello</div>",
"input": "<div foo=\"bar\">Hello</div>",
"output": [
[
"StartTag",
"div",
{
"foo": "bar"
}
],
[
"Character",
"Hello"
],
[
"EndTag",
"div"
]
]
},
{
"fragmentContext": null,
"description": "<div>Hello</div>\\n<script>\\nconsole.log(\"FOO<span>BAR</span>BAZ\");\\n</script>\\n<div>Bye</div>",
"input": "<div>Hello</div>\n<script>\nconsole.log(\"FOO<span>BAR</span>BAZ\");\n</script>\n<div>Bye</div>",
"output": [
[
"StartTag",
"div",
{}
],
[
"Character",
"Hello"
],
[
"EndTag",
"div"
],
[
"Character",
"\n"
],
[
"StartTag",
"script",
{}
],
[
"Character",
"\nconsole.log(\"FOO<span>BAR</span>BAZ\");\n"
],
[
"EndTag",
"script"
],
[
"Character",
"\n"
],
[
"StartTag",
"div",
{}
],
[
"Character",
"Bye"
],
[
"EndTag",
"div"
]
]
},
{
"fragmentContext": null,
"description": "<foo bar=\"baz\"></foo><potato quack=\"duck\"></potato>",
"input": "<foo bar=\"baz\"></foo><potato quack=\"duck\"></potato>",
"output": [
[
"StartTag",
"foo",
{
"bar": "baz"
}
],
[
"EndTag",
"foo"
],
[
"StartTag",
"potato",
{
"quack": "duck"
}
],
[
"EndTag",
"potato"
]
]
},
{
"fragmentContext": null,
"description": "<foo bar=\"baz\"><potato quack=\"duck\"></potato></foo>",
"input": "<foo bar=\"baz\"><potato quack=\"duck\"></potato></foo>",
"output": [
[
"StartTag",
"foo",
{
"bar": "baz"
}
],
[
"StartTag",
"potato",
{
"quack": "duck"
}
],
[
"EndTag",
"potato"
],
[
"EndTag",
"foo"
]
]
},
{
"fragmentContext": null,
"description": "<foo></foo bar=\"baz\"><potato></potato quack=\"duck\">",
"input": "<foo></foo bar=\"baz\"><potato></potato quack=\"duck\">",
"output": [
[
"StartTag",
"foo",
{}
],
[
"EndTag",
"foo"
],
[
"StartTag",
"potato",
{}
],
[
"EndTag",
"potato"
]
]
},
{
"fragmentContext": null,
"description": "</ tttt>",
"input": "</ tttt>",
"output": [
[
"Comment",
" tttt"
]
]
},
{
"fragmentContext": null,
"description": "<div FOO ><img><img></div>",
"input": "<div FOO ><img><img></div>",
"output": [
[
"StartTag",
"div",
{
"foo": ""
}
],
[
"StartTag",
"img",
{}
],
[
"StartTag",
"img",
{}
],
[
"EndTag",
"div"
]
]
},
{
"fragmentContext": null,
"description": "<p>Test</p<p>Test2</p>",
"input": "<p>Test</p<p>Test2</p>",
"output": [
[
"StartTag",
"p",
{}
],
[
"Character",
"Test"
],
[
"EndTag",
"p<p"
],
[
"Character",
"Test2"
],
[
"EndTag",
"p"
]
]
},
{
"fragmentContext": null,
"description": "<rdar://problem/6869687>",
"input": "<rdar://problem/6869687>",
"output": [
[
"StartTag",
"rdar:",
{
"6869687": "",
"problem": ""
}
]
]
},
{
"fragmentContext": null,
"description": "<A>test< /A>",
"input": "<A>test< /A>",
"output": [
[
"StartTag",
"a",
{}
],
[
"Character",
"test< /A>"
]
]
},
{
"fragmentContext": null,
"description": "<",
"input": "<",
"output": [
[
"Character",
"<"
]
]
},
{
"fragmentContext": null,
"description": "<body foo='bar'><body foo='baz' yo='mama'>",
"input": "<body foo='bar'><body foo='baz' yo='mama'>",
"output": [
[
"StartTag",
"body",
{
"foo": "bar"
}
],
[
"StartTag",
"body",
{
"foo": "baz",
"yo": "mama"
}
]
]
},
{
"fragmentContext": null,
"description": "<body></br foo=\"bar\"></body>",
"input": "<body></br foo=\"bar\"></body>",
"output": [
[
"StartTag",
"body",
{}
],
[
"EndTag",
"br"
],
[
"EndTag",
"body"
]
]
},
{
"fragmentContext": null,
"description": "<bdy><br foo=\"bar\"></body>",
"input": "<bdy><br foo=\"bar\"></body>",
"output": [
[
"StartTag",
"bdy",
{}
],
[
"StartTag",
"br",
{
"foo": "bar"
}
],
[
"EndTag",
"body"
]
]
},
{
"fragmentContext": null,
"description": "<body></body></br foo=\"bar\">",
"input": "<body></body></br foo=\"bar\">",
"output": [
[
"StartTag",
"body",
{}
],
[
"EndTag",
"body"
],
[
"EndTag",
"br"
]
]
},
{
"fragmentContext": null,
"description": "<bdy></body><br foo=\"bar\">",
"input": "<bdy></body><br foo=\"bar\">",
"output": [
[
"StartTag",
"bdy",
{}
],
[
"EndTag",
"body"
],
[
"StartTag",
"br",
{
"foo": "bar"
}
]
]
},
{
"fragmentContext": null,
"description": "<html><body></body></html><!-- Hi there -->",
"input": "<html><body></body></html><!-- Hi there -->",
"output": [
[
"StartTag",
"html",
{}
],
[
"StartTag",
"body",
{}
],
[
"EndTag",
"body"
],
[
"EndTag",
"html"
],
[
"Comment",
" Hi there "
]
]
},
{
"fragmentContext": null,
"description": "<html><body></body></html><!-- Comment A --><!-- Comment B --><!-- Comment C --><!-- Comment D --><!-- Comment E -->",
"input": "<html><body></body></html><!-- Comment A --><!-- Comment B --><!-- Comment C --><!-- Comment D --><!-- Comment E -->",
"output": [
[
"StartTag",
"html",
{}
],
[
"StartTag",
"body",
{}
],
[
"EndTag",
"body"
],
[
"EndTag",
"html"
],
[
"Comment",
" Comment A "
],
[
"Comment",
" Comment B "
],
[
"Comment",
" Comment C "
],
[
"Comment",
" Comment D "
],
[
"Comment",
" Comment E "
]
]
},
{
"fragmentContext": null,
"description": "<html><body></body></html>x<!-- Hi there -->",
"input": "<html><body></body></html>x<!-- Hi there -->",
"output": [
[
"StartTag",
"html",
{}
],
[
"StartTag",
"body",
{}
],
[
"EndTag",
"body"
],
[
"EndTag",
"html"
],
[
"Character",
"x"
],
[
"Comment",
" Hi there "
]
]
},
{
"fragmentContext": null,
"description": "<html><body></body></html>x<!-- Hi there --></html><!-- Again -->",
"input": "<html><body></body></html>x<!-- Hi there --></html><!-- Again -->",
"output": [
[
"StartTag",
"html",
{}
],
[
"StartTag",
"body",
{}
],
[
"EndTag",
"body"
],
[
"EndTag",
"html"
],
[
"Character",
"x"
],
[
"Comment",
" Hi there "
],
[
"EndTag",
"html"
],
[
"Comment",
" Again "
]
]
},
{
"fragmentContext": null,
"description": "<html><body></body></html>x<!-- Hi there --></body></html><!-- Again -->",
"input": "<html><body></body></html>x<!-- Hi there --></body></html><!-- Again -->",
"output": [
[
"StartTag",
"html",
{}
],
[
"StartTag",
"body",
{}
],
[
"EndTag",
"body"
],
[
"EndTag",
"html"
],
[
"Character",
"x"
],
[
"Comment",
" Hi there "
],
[
"EndTag",
"body"
],
[
"EndTag",
"html"
],
[
"Comment",
" Again "
]
]
},
{
"fragmentContext": null,
"description": "<html><body><ruby><div><rp>xx</rp></div></ruby></body></html>",
"input": "<html><body><ruby><div><rp>xx</rp></div></ruby></body></html>",
"output": [
[
"StartTag",
"html",
{}
],
[
"StartTag",
"body",
{}
],
[
"StartTag",
"ruby",
{}
],
[
"StartTag",
"div",
{}
],
[
"StartTag",
"rp",
{}
],
[
"Character",
"xx"
],
[
"EndTag",
"rp"
],
[
"EndTag",
"div"
],
[
"EndTag",
"ruby"
],
[
"EndTag",
"body"
],
[
"EndTag",
"html"
]
]
},
{
"fragmentContext": null,
"description": "<html><body><ruby><div><rt>xx</rt></div></ruby></body></html>",
"input": "<html><body><ruby><div><rt>xx</rt></div></ruby></body></html>",
"output": [
[
"StartTag",
"html",
{}
],
[
"StartTag",
"body",
{}
],
[
"StartTag",
"ruby",
{}
],
[
"StartTag",
"div",
{}
],
[
"StartTag",
"rt",
{}
],
[
"Character",
"xx"
],
[
"EndTag",
"rt"
],
[
"EndTag",
"div"
],
[
"EndTag",
"ruby"
],
[
"EndTag",
"body"
],
[
"EndTag",
"html"
]
]
},
{
"fragmentContext": null,
"description": "<html><frameset><!--1--><noframes>A</noframes><!--2--></frameset><!--3--><noframes>B</noframes><!--4--></html><!--5--><noframes>C</noframes><!--6-->",
"input": "<html><frameset><!--1--><noframes>A</noframes><!--2--></frameset><!--3--><noframes>B</noframes><!--4--></html><!--5--><noframes>C</noframes><!--6-->",
"output": [
[
"StartTag",
"html",
{}
],
[
"StartTag",
"frameset",
{}
],
[
"Comment",
"1"
],
[
"StartTag",
"noframes",
{}
],
[
"Character",
"A"
],
[
"EndTag",
"noframes"
],
[
"Comment",
"2"
],
[
"EndTag",
"frameset"
],
[
"Comment",
"3"
],
[
"StartTag",
"noframes",
{}
],
[
"Character",
"B"
],
[
"EndTag",
"noframes"
],
[
"Comment",
"4"
],
[
"EndTag",
"html"
],
[
"Comment",
"5"
],
[
"StartTag",
"noframes",
{}
],
[
"Character",
"C"
],
[
"EndTag",
"noframes"
],
[
"Comment",
"6"
]
]
},
{
"fragmentContext": null,
"description": "<select><option>A<select><option>B<select><option>C<select><option>D<select><option>E<select><option>F<select><option>G<select>",
"input": "<select><option>A<select><option>B<select><option>C<select><option>D<select><option>E<select><option>F<select><option>G<select>",
"output": [
[
"StartTag",
"select",
{}
],
[
"StartTag",
"option",
{}
],
[
"Character",
"A"
],
[
"StartTag",
"select",
{}
],
[
"StartTag",
"option",
{}
],
[
"Character",
"B"
],
[
"StartTag",
"select",
{}
],
[
"StartTag",
"option",
{}
],
[
"Character",
"C"
],
[
"StartTag",
"select",
{}
],
[
"StartTag",
"option",
{}
],
[
"Character",
"D"
],
[
"StartTag",
"select",
{}
],
[
"StartTag",
"option",
{}
],
[
"Character",
"E"
],
[
"StartTag",
"select",
{}
],
[
"StartTag",
"option",
{}
],
[
"Character",
"F"
],
[
"StartTag",
"select",
{}
],
[
"StartTag",
"option",
{}
],
[
"Character",
"G"
],
[
"StartTag",
"select",
{}
]
]
},
{
"fragmentContext": null,
"description": "<dd><dd><dt><dt><dd><li><li>",
"input": "<dd><dd><dt><dt><dd><li><li>",
"output": [
[
"StartTag",
"dd",
{}
],
[
"StartTag",
"dd",
{}
],
[
"StartTag",
"dt",
{}
],
[
"StartTag",
"dt",
{}
],
[
"StartTag",
"dd",
{}
],
[
"StartTag",
"li",
{}
],
[
"StartTag",
"li",
{}
]
]
},
{
"fragmentContext": null,
"description": "<div><b></div><div><nobr>a<nobr>",
"input": "<div><b></div><div><nobr>a<nobr>",
"output": [
[
"StartTag",
"div",
{}
],
[
"StartTag",
"b",
{}
],
[
"EndTag",
"div"
],
[
"StartTag",
"div",
{}
],
[
"StartTag",
"nobr",
{}
],
[
"Character",
"a"
],
[
"StartTag",
"nobr",
{}
]
]
},
{
"fragmentContext": null,
"description": "<head></head>\\n<body></body>",
"input": "<head></head>\n<body></body>",
"output": [
[
"StartTag",
"head",
{}
],
[
"EndTag",
"head"
],
[
"Character",
"\n"
],
[
"StartTag",
"body",
{}
],
[
"EndTag",
"body"
]
]
},
{
"fragmentContext": null,
"description": "<head></head> <style></style>ddd",
"input": "<head></head> <style></style>ddd",
"output": [
[
"StartTag",
"head",
{}
],
[
"EndTag",
"head"
],
[
"Character",
" "
],
[
"StartTag",
"style",
{}
],
[
"EndTag",
"style"
],
[
"Character",
"ddd"
]
]
},
{
"fragmentContext": null,
"description": "<kbd><table></kbd><col><select><tr>",
"input": "<kbd><table></kbd><col><select><tr>",
"output": [
[
"StartTag",
"kbd",
{}
],
[
"StartTag",
"table",
{}
],
[
"EndTag",
"kbd"
],
[
"StartTag",
"col",
{}
],
[
"StartTag",
"select",
{}
],
[
"StartTag",
"tr",
{}
]
]
},
{
"fragmentContext": null,
"description": "<kbd><table></kbd><col><select><tr></table><div>",
"input": "<kbd><table></kbd><col><select><tr></table><div>",
"output": [
[
"StartTag",
"kbd",
{}
],
[
"StartTag",
"table",
{}
],
[
"EndTag",
"kbd"
],
[
"StartTag",
"col",
{}
],
[
"StartTag",
"select",
{}
],
[
"StartTag",
"tr",
{}
],
[
"EndTag",
"table"
],
[
"StartTag",
"div",
{}
]
]
},
{
"fragmentContext": null,
"description": "<a><li><style></style><title></title></a>",
"input": "<a><li><style></style><title></title></a>",
"output": [
[
"StartTag",
"a",
{}
],
[
"StartTag",
"li",
{}
],
[
"StartTag",
"style",
{}
],
[
"EndTag",
"style"
],
[
"StartTag",
"title",
{}
],
[
"EndTag",
"title"
],
[
"EndTag",
"a"
]
]
},
{
"fragmentContext": null,
"description": "<font></p><p><meta><title></title></font>",
"input": "<font></p><p><meta><title></title></font>",
"output": [
[
"StartTag",
"font",
{}
],
[
"EndTag",
"p"
],
[
"StartTag",
"p",
{}
],
[
"StartTag",
"meta",
{}
],
[
"StartTag",
"title",
{}
],
[
"EndTag",
"title"
],
[
"EndTag",
"font"
]
]
},
{
"fragmentContext": null,
"description": "<a><center><title></title><a>",
"input": "<a><center><title></title><a>",
"output": [
[
"StartTag",
"a",
{}
],
[
"StartTag",
"center",
{}
],
[
"StartTag",
"title",
{}
],
[
"EndTag",
"title"
],
[
"StartTag",
"a",
{}
]
]
},
{
"fragmentContext": null,
"description": "<svg><title><div>",
"input": "<svg><title><div>",
"output": [
[
"StartTag",
"svg",
{}
],
[
"StartTag",
"title",
{}
],
[
"StartTag",
"div",
{}
]
]
},
{
"fragmentContext": null,
"description": "<svg><title><rect><div>",
"input": "<svg><title><rect><div>",
"output": [
[
"StartTag",
"svg",
{}
],
[
"StartTag",
"title",
{}
],
[
"StartTag",
"rect",
{}
],
[
"StartTag",
"div",
{}
]
]
},
{
"fragmentContext": null,
"description": "<svg><title><svg><div>",
"input": "<svg><title><svg><div>",
"output": [
[
"StartTag",
"svg",
{}
],
[
"StartTag",
"title",
{}
],
[
"StartTag",
"svg",
{}
],
[
"StartTag",
"div",
{}
]
]
},
{
"fragmentContext": null,
"description": "<img <=\"\" FAIL>",
"input": "<img <=\"\" FAIL>",
"output": [
[
"StartTag",
"img",
{
"<": "",
"fail": ""
}
]
]
},
{
"fragmentContext": null,
"description": "<ul><li><div id='foo'/>A</li><li>B<div>C</div></li></ul>",
"input": "<ul><li><div id='foo'/>A</li><li>B<div>C</div></li></ul>",
"output": [
[
"StartTag",
"ul",
{}
],
[
"StartTag",
"li",
{}
],
[
"StartTag",
"div",
{
"id": "foo"
},
true
],
[
"Character",
"A"
],
[
"EndTag",
"li"
],
[
"StartTag",
"li",
{}
],
[
"Character",
"B"
],
[
"StartTag",
"div",
{}
],
[
"Character",
"C"
],
[
"EndTag",
"div"
],
[
"EndTag",
"li"
],
[
"EndTag",
"ul"
]
]
},
{
"fragmentContext": null,
"description": "<svg><em><desc></em>",
"input": "<svg><em><desc></em>",
"output": [
[
"StartTag",
"svg",
{}
],
[
"StartTag",
"em",
{}
],
[
"StartTag",
"desc",
{}
],
[
"EndTag",
"em"
]
]
},
{
"fragmentContext": null,
"description": "<table><tr><td><svg><desc><td></desc><circle>",
"input": "<table><tr><td><svg><desc><td></desc><circle>",
"output": [
[
"StartTag",
"table",
{}
],
[
"StartTag",
"tr",
{}
],
[
"StartTag",
"td",
{}
],
[
"StartTag",
"svg",
{}
],
[
"StartTag",
"desc",
{}
],
[
"StartTag",
"td",
{}
],
[
"EndTag",
"desc"
],
[
"StartTag",
"circle",
{}
]
]
},
{
"fragmentContext": null,
"description": "<svg><tfoot></mi><td>",
"input": "<svg><tfoot></mi><td>",
"output": [
[
"StartTag",
"svg",
{}
],
[
"StartTag",
"tfoot",
{}
],
[
"EndTag",
"mi"
],
[
"StartTag",
"td",
{}
]
]
},
{
"fragmentContext": null,
"description": "<math><mrow><mrow><mn>1</mn></mrow><mi>a</mi></mrow></math>",
"input": "<math><mrow><mrow><mn>1</mn></mrow><mi>a</mi></mrow></math>",
"output": [
[
"StartTag",
"math",
{}
],
[
"StartTag",
"mrow",
{}
],
[
"StartTag",
"mrow",
{}
],
[
"StartTag",
"mn",
{}
],
[
"Character",
"1"
],
[
"EndTag",
"mn"
],
[
"EndTag",
"mrow"
],
[
"StartTag",
"mi",
{}
],
[
"Character",
"a"
],
[
"EndTag",
"mi"
],
[
"EndTag",
"mrow"
],
[
"EndTag",
"math"
]
]
},
{
"fragmentContext": null,
"description": "<!doctype html><input type=\"hidden\"><frameset>",
"input": "<!doctype html><input type=\"hidden\"><frameset>",
"output": [
[
"DOCTYPE",
"html",
null,
null,
true
],
[
"StartTag",
"input",
{
"type": "hidden"
}
],
[
"StartTag",
"frameset",
{}
]
]
},
{
"fragmentContext": null,
"description": "<!doctype html><input type=\"button\"><frameset>",
"input": "<!doctype html><input type=\"button\"><frameset>",
"output": [
[
"DOCTYPE",
"html",
null,
null,
true
],
[
"StartTag",
"input",
{
"type": "button"
}
],
[
"StartTag",
"frameset",
{}
]
]
}
]
}