Home | History | Annotate | Download | only in tokenization
      1 {"tests": [
      2 
      3 {"description":"DOCTYPE without name",
      4 "input":"<!DOCTYPE>",
      5 "output":["ParseError", "ParseError", ["DOCTYPE", "", null, null, false]]},
      6 
      7 {"description":"DOCTYPE without space before name",
      8 "input":"<!DOCTYPEhtml>",
      9 "output":["ParseError", ["DOCTYPE", "html", null, null, true]]},
     10 
     11 {"description":"Incorrect DOCTYPE without a space before name",
     12 "input":"<!DOCTYPEfoo>",
     13 "output":["ParseError", ["DOCTYPE", "foo", null, null, true]]},
     14 
     15 {"description":"DOCTYPE with publicId",
     16 "input":"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML Transitional 4.01//EN\">",
     17 "output":[["DOCTYPE", "html", "-//W3C//DTD HTML Transitional 4.01//EN", null, true]]},
     18 
     19 {"description":"DOCTYPE with EOF after PUBLIC",
     20 "input":"<!DOCTYPE html PUBLIC",
     21 "output":["ParseError", ["DOCTYPE", "html", null, null, false]]},
     22 
     23 {"description":"DOCTYPE with EOF after PUBLIC '",
     24 "input":"<!DOCTYPE html PUBLIC '",
     25 "output":["ParseError", ["DOCTYPE", "html", "", null, false]]},
     26 
     27 {"description":"DOCTYPE with EOF after PUBLIC 'x",
     28 "input":"<!DOCTYPE html PUBLIC 'x",
     29 "output":["ParseError", ["DOCTYPE", "html", "x", null, false]]},
     30 
     31 {"description":"DOCTYPE with systemId",
     32 "input":"<!DOCTYPE html SYSTEM \"-//W3C//DTD HTML Transitional 4.01//EN\">",
     33 "output":[["DOCTYPE", "html", null, "-//W3C//DTD HTML Transitional 4.01//EN", true]]},
     34 
     35 {"description":"DOCTYPE with publicId and systemId",
     36 "input":"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML Transitional 4.01//EN\" \"-//W3C//DTD HTML Transitional 4.01//EN\">",
     37 "output":[["DOCTYPE", "html", "-//W3C//DTD HTML Transitional 4.01//EN", "-//W3C//DTD HTML Transitional 4.01//EN", true]]},
     38 
     39 {"description":"DOCTYPE with > in double-quoted publicId",
     40 "input":"<!DOCTYPE html PUBLIC \">x",
     41 "output":["ParseError", ["DOCTYPE", "html", "", null, false], ["Character", "x"]]},
     42 
     43 {"description":"DOCTYPE with > in single-quoted publicId",
     44 "input":"<!DOCTYPE html PUBLIC '>x",
     45 "output":["ParseError", ["DOCTYPE", "html", "", null, false], ["Character", "x"]]},
     46 
     47 {"description":"DOCTYPE with > in double-quoted systemId",
     48 "input":"<!DOCTYPE html PUBLIC \"foo\" \">x",
     49 "output":["ParseError", ["DOCTYPE", "html", "foo", "", false], ["Character", "x"]]},
     50 
     51 {"description":"DOCTYPE with > in single-quoted systemId",
     52 "input":"<!DOCTYPE html PUBLIC 'foo' '>x",
     53 "output":["ParseError", ["DOCTYPE", "html", "foo", "", false], ["Character", "x"]]},
     54 
     55 {"description":"Incomplete doctype",
     56 "input":"<!DOCTYPE html ",
     57 "output":["ParseError", ["DOCTYPE", "html", null, null, false]]},
     58 
     59 {"description":"Numeric entity representing the NUL character",
     60 "input":"&#0000;",
     61 "output":["ParseError", ["Character", "\uFFFD"]]},
     62 
     63 {"description":"Hexadecimal entity representing the NUL character",
     64 "input":"&#x0000;",
     65 "output":["ParseError", ["Character", "\uFFFD"]]},
     66 
     67 {"description":"Numeric entity representing a codepoint after 1114111 (U+10FFFF)",
     68 "input":"&#2225222;",
     69 "output":["ParseError", ["Character", "\uFFFD"]]},
     70 
     71 {"description":"Hexadecimal entity representing a codepoint after 1114111 (U+10FFFF)",
     72 "input":"&#x1010FFFF;",
     73 "output":["ParseError", ["Character", "\uFFFD"]]},
     74 
     75 {"description":"Hexadecimal entity pair representing a surrogate pair",
     76 "input":"&#xD869;&#xDED6;",
     77 "output":["ParseError", ["Character", "\uFFFD"], "ParseError", ["Character", "\uFFFD"]]},
     78 
     79 {"description":"Hexadecimal entity with mixed uppercase and lowercase",
     80 "input":"&#xaBcD;",
     81 "output":[["Character", "\uABCD"]]},
     82 
     83 {"description":"Entity without a name",
     84 "input":"&;",
     85 "output":["ParseError", ["Character", "&;"]]},
     86 
     87 {"description":"Unescaped ampersand in attribute value",
     88 "input":"<h a='&'>",
     89 "output":[["StartTag", "h", { "a":"&" }]]},
     90 
     91 {"description":"StartTag containing <",
     92 "input":"<a<b>",
     93 "output":[["StartTag", "a<b", { }]]},
     94 
     95 {"description":"Non-void element containing trailing /",
     96 "input":"<h/>",
     97 "output":[["StartTag","h",{},true]]},
     98 
     99 {"description":"Void element with permitted slash",
    100 "input":"<br/>",
    101 "output":[["StartTag","br",{},true]]},
    102 
    103 {"description":"Void element with permitted slash (with attribute)",
    104 "input":"<br foo='bar'/>",
    105 "output":[["StartTag","br",{"foo":"bar"},true]]},
    106 
    107 {"description":"StartTag containing /",
    108 "input":"<h/a='b'>",
    109 "output":["ParseError", ["StartTag", "h", { "a":"b" }]]},
    110 
    111 {"description":"Double-quoted attribute value",
    112 "input":"<h a=\"b\">",
    113 "output":[["StartTag", "h", { "a":"b" }]]},
    114 
    115 {"description":"Unescaped </",
    116 "input":"</",
    117 "output":["ParseError", ["Character", "</"]]},
    118 
    119 {"description":"Illegal end tag name",
    120 "input":"</1>",
    121 "output":["ParseError", ["Comment", "1"]]},
    122 
    123 {"description":"Simili processing instruction",
    124 "input":"<?namespace>",
    125 "output":["ParseError", ["Comment", "?namespace"]]},
    126 
    127 {"description":"A bogus comment stops at >, even if preceeded by two dashes",
    128 "input":"<?foo-->",
    129 "output":["ParseError", ["Comment", "?foo--"]]},
    130 
    131 {"description":"Unescaped <",
    132 "input":"foo < bar",
    133 "output":[["Character", "foo "], "ParseError", ["Character", "< bar"]]},
    134 
    135 {"description":"Null Byte Replacement",
    136 "input":"\u0000",
    137 "output":["ParseError", ["Character", "\u0000"]]},
    138 
    139 {"description":"Comment with dash",
    140 "input":"<!---x",
    141 "output":["ParseError", ["Comment", "-x"]]},
    142 
    143 {"description":"Entity + newline",
    144 "input":"\nx\n&gt;\n",
    145 "output":[["Character","\nx\n>\n"]]},
    146 
    147 {"description":"Start tag with no attributes but space before the greater-than sign",
    148 "input":"<h >",
    149 "output":[["StartTag", "h", {}]]},
    150 
    151 {"description":"Empty attribute followed by uppercase attribute",
    152 "input":"<h a B=''>",
    153 "output":[["StartTag", "h", {"a":"", "b":""}]]},
    154 
    155 {"description":"Double-quote after attribute name",
    156 "input":"<h a \">",
    157 "output":["ParseError", ["StartTag", "h", {"a":"", "\"":""}]]},
    158 
    159 {"description":"Single-quote after attribute name",
    160 "input":"<h a '>",
    161 "output":["ParseError", ["StartTag", "h", {"a":"", "'":""}]]},
    162 
    163 {"description":"Empty end tag with following characters",
    164 "input":"a</>bc",
    165 "output":[["Character", "a"], "ParseError", ["Character", "bc"]]},
    166 
    167 {"description":"Empty end tag with following tag",
    168 "input":"a</><b>c",
    169 "output":[["Character", "a"], "ParseError", ["StartTag", "b", {}], ["Character", "c"]]},
    170 
    171 {"description":"Empty end tag with following comment",
    172 "input":"a</><!--b-->c",
    173 "output":[["Character", "a"], "ParseError", ["Comment", "b"], ["Character", "c"]]},
    174 
    175 {"description":"Empty end tag with following end tag",
    176 "input":"a</></b>c",
    177 "output":[["Character", "a"], "ParseError", ["EndTag", "b"], ["Character", "c"]]}
    178 
    179 ]}
    180