OLD | NEW |
(Empty) | |
| 1 {"tests": [ |
| 2 |
| 3 {"description":"Correct Doctype lowercase", |
| 4 "input":"<!DOCTYPE html>", |
| 5 "output":[["DOCTYPE", "html", null, null, true]]}, |
| 6 |
| 7 {"description":"Correct Doctype uppercase", |
| 8 "input":"<!DOCTYPE HTML>", |
| 9 "output":[["DOCTYPE", "html", null, null, true]]}, |
| 10 |
| 11 {"description":"Correct Doctype mixed case", |
| 12 "input":"<!DOCTYPE HtMl>", |
| 13 "output":[["DOCTYPE", "html", null, null, true]]}, |
| 14 |
| 15 {"description":"Correct Doctype case with EOF", |
| 16 "input":"<!DOCTYPE HtMl", |
| 17 "output":["ParseError", ["DOCTYPE", "html", null, null, false]]}, |
| 18 |
| 19 {"description":"Truncated doctype start", |
| 20 "input":"<!DOC>", |
| 21 "output":["ParseError", ["Comment", "DOC"]]}, |
| 22 |
| 23 {"description":"Doctype in error", |
| 24 "input":"<!DOCTYPE foo>", |
| 25 "output":[["DOCTYPE", "foo", null, null, true]]}, |
| 26 |
| 27 {"description":"Single Start Tag", |
| 28 "input":"<h>", |
| 29 "output":[["StartTag", "h", {}]]}, |
| 30 |
| 31 {"description":"Empty end tag", |
| 32 "input":"</>", |
| 33 "output":["ParseError"]}, |
| 34 |
| 35 {"description":"Empty start tag", |
| 36 "input":"<>", |
| 37 "output":["ParseError", ["Character", "<>"]]}, |
| 38 |
| 39 {"description":"Start Tag w/attribute", |
| 40 "input":"<h a='b'>", |
| 41 "output":[["StartTag", "h", {"a":"b"}]]}, |
| 42 |
| 43 {"description":"Start Tag w/attribute no quotes", |
| 44 "input":"<h a=b>", |
| 45 "output":[["StartTag", "h", {"a":"b"}]]}, |
| 46 |
| 47 {"description":"Start/End Tag", |
| 48 "input":"<h></h>", |
| 49 "output":[["StartTag", "h", {}], ["EndTag", "h"]]}, |
| 50 |
| 51 {"description":"Two unclosed start tags", |
| 52 "input":"<p>One<p>Two", |
| 53 "output":[["StartTag", "p", {}], ["Character", "One"], ["StartTag", "p", {}], ["
Character", "Two"]]}, |
| 54 |
| 55 {"description":"End Tag w/attribute", |
| 56 "input":"<h></h a='b'>", |
| 57 "output":[["StartTag", "h", {}], "ParseError", ["EndTag", "h"]]}, |
| 58 |
| 59 {"description":"Multiple atts", |
| 60 "input":"<h a='b' c='d'>", |
| 61 "output":[["StartTag", "h", {"a":"b", "c":"d"}]]}, |
| 62 |
| 63 {"description":"Multiple atts no space", |
| 64 "input":"<h a='b'c='d'>", |
| 65 "output":["ParseError", ["StartTag", "h", {"a":"b", "c":"d"}]]}, |
| 66 |
| 67 {"description":"Repeated attr", |
| 68 "input":"<h a='b' a='d'>", |
| 69 "output":["ParseError", ["StartTag", "h", {"a":"b"}]]}, |
| 70 |
| 71 {"description":"Simple comment", |
| 72 "input":"<!--comment-->", |
| 73 "output":[["Comment", "comment"]]}, |
| 74 |
| 75 {"description":"Comment, Central dash no space", |
| 76 "input":"<!----->", |
| 77 "output":["ParseError", ["Comment", "-"]]}, |
| 78 |
| 79 {"description":"Comment, two central dashes", |
| 80 "input":"<!-- --comment -->", |
| 81 "output":["ParseError", ["Comment", " --comment "]]}, |
| 82 |
| 83 {"description":"Unfinished comment", |
| 84 "input":"<!--comment", |
| 85 "output":["ParseError", ["Comment", "comment"]]}, |
| 86 |
| 87 {"description":"Start of a comment", |
| 88 "input":"<!-", |
| 89 "output":["ParseError", ["Comment", "-"]]}, |
| 90 |
| 91 {"description":"Short comment", |
| 92 "input":"<!-->", |
| 93 "output":["ParseError", ["Comment", ""]]}, |
| 94 |
| 95 {"description":"Short comment two", |
| 96 "input":"<!--->", |
| 97 "output":["ParseError", ["Comment", ""]]}, |
| 98 |
| 99 {"description":"Short comment three", |
| 100 "input":"<!---->", |
| 101 "output":[["Comment", ""]]}, |
| 102 |
| 103 |
| 104 {"description":"Ampersand EOF", |
| 105 "input":"&", |
| 106 "output":[["Character", "&"]]}, |
| 107 |
| 108 {"description":"Ampersand ampersand EOF", |
| 109 "input":"&&", |
| 110 "output":[["Character", "&&"]]}, |
| 111 |
| 112 {"description":"Ampersand space EOF", |
| 113 "input":"& ", |
| 114 "output":[["Character", "& "]]}, |
| 115 |
| 116 {"description":"Unfinished entity", |
| 117 "input":"&f", |
| 118 "output":["ParseError", ["Character", "&f"]]}, |
| 119 |
| 120 {"description":"Ampersand, number sign", |
| 121 "input":"&#", |
| 122 "output":["ParseError", ["Character", "&#"]]}, |
| 123 |
| 124 {"description":"Unfinished numeric entity", |
| 125 "input":"&#x", |
| 126 "output":["ParseError", ["Character", "&#x"]]}, |
| 127 |
| 128 {"description":"Entity with trailing semicolon (1)", |
| 129 "input":"I'm ¬it", |
| 130 "output":[["Character","I'm \u00ACit"]]}, |
| 131 |
| 132 {"description":"Entity with trailing semicolon (2)", |
| 133 "input":"I'm ∉", |
| 134 "output":[["Character","I'm \u2209"]]}, |
| 135 |
| 136 {"description":"Entity without trailing semicolon (1)", |
| 137 "input":"I'm ¬it", |
| 138 "output":[["Character","I'm "], "ParseError", ["Character", "\u00ACit"]]}, |
| 139 |
| 140 {"description":"Entity without trailing semicolon (2)", |
| 141 "input":"I'm ¬in", |
| 142 "output":[["Character","I'm "], "ParseError", ["Character", "\u00ACin"]]}, |
| 143 |
| 144 {"description":"Partial entity match at end of file", |
| 145 "input":"I'm &no", |
| 146 "output":[["Character","I'm "], "ParseError", ["Character", "&no"]]}, |
| 147 |
| 148 {"description":"Non-ASCII character reference name", |
| 149 "input":"&\u00AC;", |
| 150 "output":["ParseError", ["Character", "&\u00AC;"]]}, |
| 151 |
| 152 {"description":"ASCII decimal entity", |
| 153 "input":"$", |
| 154 "output":[["Character","$"]]}, |
| 155 |
| 156 {"description":"ASCII hexadecimal entity", |
| 157 "input":"?", |
| 158 "output":[["Character","?"]]}, |
| 159 |
| 160 {"description":"Hexadecimal entity in attribute", |
| 161 "input":"<h a='?'></h>", |
| 162 "output":[["StartTag", "h", {"a":"?"}], ["EndTag", "h"]]}, |
| 163 |
| 164 {"description":"Entity in attribute without semicolon ending in x", |
| 165 "input":"<h a='¬x'>", |
| 166 "output":["ParseError", ["StartTag", "h", {"a":"¬x"}]]}, |
| 167 |
| 168 {"description":"Entity in attribute without semicolon ending in 1", |
| 169 "input":"<h a='¬1'>", |
| 170 "output":["ParseError", ["StartTag", "h", {"a":"¬1"}]]}, |
| 171 |
| 172 {"description":"Entity in attribute without semicolon ending in i", |
| 173 "input":"<h a='¬i'>", |
| 174 "output":["ParseError", ["StartTag", "h", {"a":"¬i"}]]}, |
| 175 |
| 176 {"description":"Entity in attribute without semicolon", |
| 177 "input":"<h a='©'>", |
| 178 "output":["ParseError", ["StartTag", "h", {"a":"\u00A9"}]]}, |
| 179 |
| 180 {"description":"Unquoted attribute ending in ampersand", |
| 181 "input":"<s o=& t>", |
| 182 "output":[["StartTag","s",{"o":"&","t":""}]]}, |
| 183 |
| 184 {"description":"Unquoted attribute at end of tag with final character of &, with
tag followed by characters", |
| 185 "input":"<a a=a&>foo", |
| 186 "output":[["StartTag", "a", {"a":"a&"}], ["Character", "foo"]]}, |
| 187 |
| 188 {"description":"plaintext element", |
| 189 "input":"<plaintext>foobar", |
| 190 "output":[["StartTag","plaintext",{}], ["Character","foobar"]]}, |
| 191 |
| 192 {"description":"Open angled bracket in unquoted attribute value state", |
| 193 "input":"<a a=f<>", |
| 194 "output":["ParseError", ["StartTag", "a", {"a":"f<"}]]} |
| 195 |
| 196 ]} |
OLD | NEW |