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