| 1 |
{"tests": [ |
| 2 |
|
| 3 |
{"description":"< in attribute name", |
| 4 |
"input":"<z/0 <", |
| 5 |
"output":["ParseError", "ParseError", ["StartTag", "z", {"0": "", "<": ""}]]}, |
| 6 |
|
| 7 |
{"description":"< in attribute value", |
| 8 |
"input":"<z x=<", |
| 9 |
"output":["ParseError", ["StartTag", "z", {"x": "<"}]]}, |
| 10 |
|
| 11 |
{"description":"= in unquoted attribute value", |
| 12 |
"input":"<z z=z=z>", |
| 13 |
"output":["ParseError", ["StartTag", "z", {"z": "z=z"}]]}, |
| 14 |
|
| 15 |
{"description":"= attribute", |
| 16 |
"input":"<z =>", |
| 17 |
"output":["ParseError", ["StartTag", "z", {"=": ""}]]}, |
| 18 |
|
| 19 |
{"description":"== attribute", |
| 20 |
"input":"<z ==>", |
| 21 |
"output":["ParseError", ["StartTag", "z", {"=": ""}]]}, |
| 22 |
|
| 23 |
{"description":"=== attribute", |
| 24 |
"input":"<z ===>", |
| 25 |
"output":["ParseError", "ParseError", ["StartTag", "z", {"=": "="}]]}, |
| 26 |
|
| 27 |
{"description":"==== attribute", |
| 28 |
"input":"<z ====>", |
| 29 |
"output":["ParseError", "ParseError", "ParseError", ["StartTag", "z", {"=": "=="}]]}, |
| 30 |
|
| 31 |
{"description":"Allowed \" after ampersand in attribute value", |
| 32 |
"input":"<z z=\"&\">", |
| 33 |
"output":[["StartTag", "z", {"z": "&"}]]}, |
| 34 |
|
| 35 |
{"description":"Non-allowed ' after ampersand in attribute value", |
| 36 |
"input":"<z z=\"&'\">", |
| 37 |
"output":["ParseError", ["StartTag", "z", {"z": "&'"}]]}, |
| 38 |
|
| 39 |
{"description":"Allowed ' after ampersand in attribute value", |
| 40 |
"input":"<z z='&'>", |
| 41 |
"output":[["StartTag", "z", {"z": "&"}]]}, |
| 42 |
|
| 43 |
{"description":"Non-allowed \" after ampersand in attribute value", |
| 44 |
"input":"<z z='&\"'>", |
| 45 |
"output":["ParseError", ["StartTag", "z", {"z": "&\""}]]}, |
| 46 |
|
| 47 |
{"description":"Attribute name starting with \"", |
| 48 |
"input":"<foo \"='bar'>", |
| 49 |
"output":["ParseError", ["StartTag", "foo", {"\"": "bar"}]]}, |
| 50 |
|
| 51 |
{"description":"Attribute name starting with '", |
| 52 |
"input":"<foo '='bar'>", |
| 53 |
"output":["ParseError", ["StartTag", "foo", {"'": "bar"}]]}, |
| 54 |
|
| 55 |
{"description":"Attribute name containing \"", |
| 56 |
"input":"<foo a\"b='bar'>", |
| 57 |
"output":["ParseError", ["StartTag", "foo", {"a\"b": "bar"}]]}, |
| 58 |
|
| 59 |
{"description":"Attribute name containing '", |
| 60 |
"input":"<foo a'b='bar'>", |
| 61 |
"output":["ParseError", ["StartTag", "foo", {"a'b": "bar"}]]}, |
| 62 |
|
| 63 |
{"description":"Unquoted attribute value containing '", |
| 64 |
"input":"<foo a=b'c>", |
| 65 |
"output":["ParseError", ["StartTag", "foo", {"a": "b'c"}]]}, |
| 66 |
|
| 67 |
{"description":"Unquoted attribute value containing \"", |
| 68 |
"input":"<foo a=b\"c>", |
| 69 |
"output":["ParseError", ["StartTag", "foo", {"a": "b\"c"}]]}, |
| 70 |
|
| 71 |
{"description":"Double-quoted attribute value not followed by whitespace", |
| 72 |
"input":"<foo a=\"b\"c>", |
| 73 |
"output":["ParseError", ["StartTag", "foo", {"a": "b", "c": ""}]]}, |
| 74 |
|
| 75 |
{"description":"Single-quoted attribute value not followed by whitespace", |
| 76 |
"input":"<foo a='b'c>", |
| 77 |
"output":["ParseError", ["StartTag", "foo", {"a": "b", "c": ""}]]}, |
| 78 |
|
| 79 |
{"description":"Quoted attribute followed by permitted /", |
| 80 |
"input":"<br a='b'/>", |
| 81 |
"output":[["StartTag", "br", {"a": "b"}]]}, |
| 82 |
|
| 83 |
{"description":"Quoted attribute followed by non-permitted /", |
| 84 |
"input":"<bar a='b'/>", |
| 85 |
"output":["ParseError", ["StartTag", "bar", {"a": "b"}]]}, |
| 86 |
|
| 87 |
{"description":"CR EOF after doctype name", |
| 88 |
"input":"<!doctype html \r", |
| 89 |
"output":["ParseError", ["DOCTYPE", "html", null, null, false]]}, |
| 90 |
|
| 91 |
{"description":"CR EOF in tag name", |
| 92 |
"input":"<z\r", |
| 93 |
"output":["ParseError", ["StartTag", "z", {}]]}, |
| 94 |
|
| 95 |
{"description":"Zero hex numeric entity", |
| 96 |
"input":"�", |
| 97 |
"output":["ParseError", "ParseError", ["Character", "\uFFFD"]]}, |
| 98 |
|
| 99 |
{"description":"Zero decimal numeric entity", |
| 100 |
"input":"�", |
| 101 |
"output":["ParseError", "ParseError", ["Character", "\uFFFD"]]}, |
| 102 |
|
| 103 |
{"description":"Zero-prefixed hex numeric entity", |
| 104 |
"input":"A", |
| 105 |
"output":[["Character", "A"]]}, |
| 106 |
|
| 107 |
{"description":"Zero-prefixed decimal numeric entity", |
| 108 |
"input":"A", |
| 109 |
"output":[["Character", "A"]]}, |
| 110 |
|
| 111 |
{"description":"Empty hex numeric entities", |
| 112 |
"input":"&#x &#X ", |
| 113 |
"output":["ParseError", ["Character", "&#x "], "ParseError", ["Character", "&#X "]]}, |
| 114 |
|
| 115 |
{"description":"Empty decimal numeric entities", |
| 116 |
"input":"&# &#; ", |
| 117 |
"output":["ParseError", ["Character", "&# "], "ParseError", ["Character", "&#; "]]}, |
| 118 |
|
| 119 |
{"description":"Non-BMP numeric entity", |
| 120 |
"input":"𐀀", |
| 121 |
"output":[["Character", "\uD800\uDC00"]]}, |
| 122 |
|
| 123 |
{"description":"Maximum non-BMP numeric entity", |
| 124 |
"input":"", |
| 125 |
"output":[["Character", "\uDBFF\uDFFF"]]}, |
| 126 |
|
| 127 |
{"description":"Above maximum numeric entity", |
| 128 |
"input":"�", |
| 129 |
"output":["ParseError", ["Character", "\uFFFD"]]}, |
| 130 |
|
| 131 |
{"description":"32-bit hex numeric entity", |
| 132 |
"input":"�", |
| 133 |
"output":["ParseError", ["Character", "\uFFFD"]]}, |
| 134 |
|
| 135 |
{"description":"33-bit hex numeric entity", |
| 136 |
"input":"�", |
| 137 |
"output":["ParseError", ["Character", "\uFFFD"]]}, |
| 138 |
|
| 139 |
{"description":"33-bit decimal numeric entity", |
| 140 |
"input":"�", |
| 141 |
"output":["ParseError", ["Character", "\uFFFD"]]}, |
| 142 |
|
| 143 |
{"description":"65-bit hex numeric entity", |
| 144 |
"input":"�", |
| 145 |
"output":["ParseError", ["Character", "\uFFFD"]]}, |
| 146 |
|
| 147 |
{"description":"65-bit decimal numeric entity", |
| 148 |
"input":"�", |
| 149 |
"output":["ParseError", ["Character", "\uFFFD"]]}, |
| 150 |
|
| 151 |
{"description":"Surrogate code point edge cases", |
| 152 |
"input":"퟿����", |
| 153 |
"output":[["Character", "\uD7FF"], "ParseError", ["Character", "\uFFFD"], "ParseError", ["Character", "\uFFFD"], "ParseError", ["Character", "\uFFFD"], "ParseError", ["Character", "\uFFFD\uE000"]]}, |
| 154 |
|
| 155 |
{"description":"Uppercase start tag name", |
| 156 |
"input":"<X>", |
| 157 |
"output":[["StartTag", "x", {}]]}, |
| 158 |
|
| 159 |
{"description":"Uppercase end tag name", |
| 160 |
"input":"</X>", |
| 161 |
"output":[["EndTag", "x"]]}, |
| 162 |
|
| 163 |
{"description":"Uppercase attribute name", |
| 164 |
"input":"<x X>", |
| 165 |
"output":[["StartTag", "x", { "x":"" }]]}, |
| 166 |
|
| 167 |
{"description":"Tag/attribute name case edge values", |
| 168 |
"input":"<x@AZ[`az{ @AZ[`az{>", |
| 169 |
"output":[["StartTag", "x@az[`az{", { "@az[`az{":"" }]]}, |
| 170 |
|
| 171 |
{"description":"Duplicate different-case attributes", |
| 172 |
"input":"<x x=1 x=2 X=3>", |
| 173 |
"output":["ParseError", "ParseError", ["StartTag", "x", { "x":"1" }]]}, |
| 174 |
|
| 175 |
{"description":"Uppercase close tag attributes", |
| 176 |
"input":"</x X>", |
| 177 |
"output":["ParseError", ["EndTag", "x"]]}, |
| 178 |
|
| 179 |
{"description":"Duplicate close tag attributes", |
| 180 |
"input":"</x x x>", |
| 181 |
"output":["ParseError", "ParseError", ["EndTag", "x"]]}, |
| 182 |
|
| 183 |
{"description":"Permitted slash", |
| 184 |
"input":"<br/>", |
| 185 |
"output":[["StartTag", "br", {}]]}, |
| 186 |
|
| 187 |
{"description":"Non-permitted slash", |
| 188 |
"input":"<xr/>", |
| 189 |
"output":["ParseError", ["StartTag", "xr", {}]]}, |
| 190 |
|
| 191 |
{"description":"Permitted slash but in close tag", |
| 192 |
"input":"</br/>", |
| 193 |
"output":["ParseError", ["EndTag", "br"]]}, |
| 194 |
|
| 195 |
{"description":"Doctype public case-sensitivity (1)", |
| 196 |
"input":"<!DoCtYpE HtMl PuBlIc \"AbC\" \"XyZ\">", |
| 197 |
"output":[["DOCTYPE", "HtMl", "AbC", "XyZ", true]]}, |
| 198 |
|
| 199 |
{"description":"Doctype public case-sensitivity (2)", |
| 200 |
"input":"<!dOcTyPe hTmL pUbLiC \"aBc\" \"xYz\">", |
| 201 |
"output":[["DOCTYPE", "hTmL", "aBc", "xYz", true]]}, |
| 202 |
|
| 203 |
{"description":"Doctype system case-sensitivity (1)", |
| 204 |
"input":"<!DoCtYpE HtMl SyStEm \"XyZ\">", |
| 205 |
"output":[["DOCTYPE", "HtMl", null, "XyZ", true]]}, |
| 206 |
|
| 207 |
{"description":"Doctype system case-sensitivity (2)", |
| 208 |
"input":"<!dOcTyPe hTmL sYsTeM \"xYz\">", |
| 209 |
"output":[["DOCTYPE", "hTmL", null, "xYz", true]]}, |
| 210 |
|
| 211 |
{"description":"U+0000 in lookahead region after non-matching character", |
| 212 |
"input":"<!doc>\u0000", |
| 213 |
"output":["ParseError", ["Comment", "doc"], "ParseError", ["Character", "\uFFFD"]], |
| 214 |
"ignoreErrorOrder":true}, |
| 215 |
|
| 216 |
{"description":"U+0000 in lookahead region", |
| 217 |
"input":"<!doc\u0000", |
| 218 |
"output":["ParseError", "ParseError", ["Comment", "doc\uFFFD"]], |
| 219 |
"ignoreErrorOrder":true}, |
| 220 |
|
| 221 |
{"description":"CR followed by U+0000", |
| 222 |
"input":"\r\u0000", |
| 223 |
"output":["ParseError", ["Character", "\n\uFFFD"]], |
| 224 |
"ignoreErrorOrder":true}, |
| 225 |
|
| 226 |
{"description":"CR followed by non-LF", |
| 227 |
"input":"\r?", |
| 228 |
"output":[["Character", "\n?"]]}, |
| 229 |
|
| 230 |
{"description":"CR at EOF", |
| 231 |
"input":"\r", |
| 232 |
"output":[["Character", "\n"]]}, |
| 233 |
|
| 234 |
{"description":"LF at EOF", |
| 235 |
"input":"\n", |
| 236 |
"output":[["Character", "\n"]]}, |
| 237 |
|
| 238 |
{"description":"CR LF", |
| 239 |
"input":"\r\n", |
| 240 |
"output":[["Character", "\n"]]}, |
| 241 |
|
| 242 |
{"description":"CR CR", |
| 243 |
"input":"\r\r", |
| 244 |
"output":[["Character", "\n\n"]]}, |
| 245 |
|
| 246 |
{"description":"LF LF", |
| 247 |
"input":"\n\n", |
| 248 |
"output":[["Character", "\n\n"]]}, |
| 249 |
|
| 250 |
{"description":"LF CR", |
| 251 |
"input":"\n\r", |
| 252 |
"output":[["Character", "\n\n"]]}, |
| 253 |
|
| 254 |
{"description":"text CR CR CR text", |
| 255 |
"input":"text\r\r\rtext", |
| 256 |
"output":[["Character", "text\n\n\ntext"]]}, |
| 257 |
|
| 258 |
{"description":"Doctype publik", |
| 259 |
"input":"<!DOCTYPE html PUBLIK \"AbC\" \"XyZ\">", |
| 260 |
"output":["ParseError", ["DOCTYPE", "html", null, null, false]]}, |
| 261 |
|
| 262 |
{"description":"Doctype publi", |
| 263 |
"input":"<!DOCTYPE html PUBLI", |
| 264 |
"output":["ParseError", "ParseError", ["DOCTYPE", "html", null, null, false]]}, |
| 265 |
|
| 266 |
{"description":"Doctype sistem", |
| 267 |
"input":"<!DOCTYPE html SISTEM \"AbC\">", |
| 268 |
"output":["ParseError", ["DOCTYPE", "html", null, null, false]]}, |
| 269 |
|
| 270 |
{"description":"Doctype sys", |
| 271 |
"input":"<!DOCTYPE html SYS", |
| 272 |
"output":["ParseError", "ParseError", ["DOCTYPE", "html", null, null, false]]} |
| 273 |
|
| 274 |
]} |