Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  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", "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":"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='&#x0020; foo'>bar<z>",
  53. "output":[["StartTag","z",{"z":"  foo"}],["Character","bar"],["StartTag","z",{}]]},
  54.  
  55. {"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. "output":[["StartTag","br",{"a":"b"},true]]},
  90.  
  91. {"description":"Quoted attribute followed by non-permitted /",
  92. "input":"<bar a='b'/>",
  93. "output":[["StartTag","bar",{"a":"b"},true]]},
  94.  
  95. {"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":"Slash EOF in tag name",
  104. "input":"<z/",
  105. "output":["ParseError", ["StartTag", "z", {}]]},
  106.  
  107. {"description":"Zero hex numeric entity",
  108. "input":"&#x0",
  109. "output":["ParseError", "ParseError", ["Character", "\uFFFD"]]},
  110.  
  111. {"description":"Zero decimal numeric entity",
  112. "input":"&#0",
  113. "output":["ParseError", "ParseError", ["Character", "\uFFFD"]]},
  114.  
  115. {"description":"Zero-prefixed hex numeric entity",
  116. "input":"&#x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041;",
  117. "output":[["Character", "A"]]},
  118.  
  119. {"description":"Zero-prefixed decimal numeric entity",
  120. "input":"&#000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000065;",
  121. "output":[["Character", "A"]]},
  122.  
  123. {"description":"Empty hex numeric entities",
  124. "input":"&#x &#X ",
  125. "output":["ParseError", ["Character", "&#x "], "ParseError", ["Character", "&#X "]]},
  126.  
  127. {"description":"Empty decimal numeric entities",
  128. "input":"&# &#; ",
  129. "output":["ParseError", ["Character", "&# "], "ParseError", ["Character", "&#; "]]},
  130.  
  131. {"description":"Non-BMP numeric entity",
  132. "input":"&#x10000;",
  133. "output":[["Character", "\uD800\uDC00"]]},
  134.  
  135. {"description":"Maximum non-BMP numeric entity",
  136. "input":"&#X10FFFF;",
  137. "output":["ParseError", ["Character", "\uFFFD"]]},
  138.  
  139. {"description":"Above maximum numeric entity",
  140. "input":"&#x110000;",
  141. "output":["ParseError", ["Character", "\uFFFD"]]},
  142.  
  143. {"description":"32-bit hex numeric entity",
  144. "input":"&#x80000041;",
  145. "output":["ParseError", ["Character", "\uFFFD"]]},
  146.  
  147. {"description":"33-bit hex numeric entity",
  148. "input":"&#x100000041;",
  149. "output":["ParseError", ["Character", "\uFFFD"]]},
  150.  
  151. {"description":"33-bit decimal numeric entity",
  152. "input":"&#4294967361;",
  153. "output":["ParseError", ["Character", "\uFFFD"]]},
  154.  
  155. {"description":"65-bit hex numeric entity",
  156. "input":"&#x10000000000000041;",
  157. "output":["ParseError", ["Character", "\uFFFD"]]},
  158.  
  159. {"description":"65-bit decimal numeric entity",
  160. "input":"&#18446744073709551681;",
  161. "output":["ParseError", ["Character", "\uFFFD"]]},
  162.  
  163. {"description":"Surrogate code point edge cases",
  164. "input":"&#xD7FF;&#xD800;&#xD801;&#xDFFE;&#xDFFF;&#xE000;",
  165. "output":[["Character", "\uD7FF"], "ParseError", ["Character", "\uFFFD"], "ParseError", ["Character", "\uFFFD"], "ParseError", ["Character", "\uFFFD"], "ParseError", ["Character", "\uFFFD\uE000"]]},
  166.  
  167. {"description":"Uppercase start tag name",
  168. "input":"<X>",
  169. "output":[["StartTag", "x", {}]]},
  170.  
  171. {"description":"Uppercase end tag name",
  172. "input":"</X>",
  173. "output":[["EndTag", "x"]]},
  174.  
  175. {"description":"Uppercase attribute name",
  176. "input":"<x X>",
  177. "output":[["StartTag", "x", { "x":"" }]]},
  178.  
  179. {"description":"Tag/attribute name case edge values",
  180. "input":"<x@AZ[`az{ @AZ[`az{>",
  181. "output":[["StartTag", "x@az[`az{", { "@az[`az{":"" }]]},
  182.  
  183. {"description":"Duplicate different-case attributes",
  184. "input":"<x x=1 x=2 X=3>",
  185. "output":["ParseError", "ParseError", ["StartTag", "x", { "x":"1" }]]},
  186.  
  187. {"description":"Uppercase close tag attributes",
  188. "input":"</x X>",
  189. "output":["ParseError", ["EndTag", "x"]]},
  190.  
  191. {"description":"Duplicate close tag attributes",
  192. "input":"</x x x>",
  193. "output":["ParseError", "ParseError", ["EndTag", "x"]]},
  194.  
  195. {"description":"Permitted slash",
  196. "input":"<br/>",
  197. "output":[["StartTag","br",{},true]]},
  198.  
  199. {"description":"Non-permitted slash",
  200. "input":"<xr/>",
  201. "output":[["StartTag","xr",{},true]]},
  202.  
  203. {"description":"Permitted slash but in close tag",
  204. "input":"</br/>",
  205. "output":["ParseError", ["EndTag", "br"]]},
  206.  
  207. {"description":"Doctype public case-sensitivity (1)",
  208. "input":"<!DoCtYpE HtMl PuBlIc \"AbC\" \"XyZ\">",
  209. "output":[["DOCTYPE", "html", "AbC", "XyZ", true]]},
  210.  
  211. {"description":"Doctype public case-sensitivity (2)",
  212. "input":"<!dOcTyPe hTmL pUbLiC \"aBc\" \"xYz\">",
  213. "output":[["DOCTYPE", "html", "aBc", "xYz", true]]},
  214.  
  215. {"description":"Doctype system case-sensitivity (1)",
  216. "input":"<!DoCtYpE HtMl SyStEm \"XyZ\">",
  217. "output":[["DOCTYPE", "html", null, "XyZ", true]]},
  218.  
  219. {"description":"Doctype system case-sensitivity (2)",
  220. "input":"<!dOcTyPe hTmL sYsTeM \"xYz\">",
  221. "output":[["DOCTYPE", "html", null, "xYz", true]]},
  222.  
  223. {"description":"U+0000 in lookahead region after non-matching character",
  224. "input":"<!doc>\u0000",
  225. "output":["ParseError", ["Comment", "doc"], "ParseError", ["Character", "\uFFFD"]],
  226. "ignoreErrorOrder":true},
  227.  
  228. {"description":"U+0000 in lookahead region",
  229. "input":"<!doc\u0000",
  230. "output":["ParseError", "ParseError", ["Comment", "doc\uFFFD"]],
  231. "ignoreErrorOrder":true},
  232.  
  233. {"description":"U+0080 in lookahead region",
  234. "input":"<!doc\u0080",
  235. "output":["ParseError", "ParseError", ["Comment", "doc\u0080"]],
  236. "ignoreErrorOrder":true},
  237.  
  238. {"description":"U+FDD1 in lookahead region",
  239. "input":"<!doc\uFDD1",
  240. "output":["ParseError", "ParseError", ["Comment", "doc\uFDD1"]],
  241. "ignoreErrorOrder":true},
  242.  
  243. {"description":"U+1FFFF in lookahead region",
  244. "input":"<!doc\uD83F\uDFFF",
  245. "output":["ParseError", "ParseError", ["Comment", "doc\uD83F\uDFFF"]],
  246. "ignoreErrorOrder":true},
  247.  
  248. {"description":"CR followed by U+0000",
  249. "input":"\r\u0000",
  250. "output":["ParseError", ["Character", "\n\uFFFD"]],
  251. "ignoreErrorOrder":true},
  252.  
  253. {"description":"CR followed by non-LF",
  254. "input":"\r?",
  255. "output":[["Character", "\n?"]]},
  256.  
  257. {"description":"CR at EOF",
  258. "input":"\r",
  259. "output":[["Character", "\n"]]},
  260.  
  261. {"description":"LF at EOF",
  262. "input":"\n",
  263. "output":[["Character", "\n"]]},
  264.  
  265. {"description":"CR LF",
  266. "input":"\r\n",
  267. "output":[["Character", "\n"]]},
  268.  
  269. {"description":"CR CR",
  270. "input":"\r\r",
  271. "output":[["Character", "\n\n"]]},
  272.  
  273. {"description":"LF LF",
  274. "input":"\n\n",
  275. "output":[["Character", "\n\n"]]},
  276.  
  277. {"description":"LF CR",
  278. "input":"\n\r",
  279. "output":[["Character", "\n\n"]]},
  280.  
  281. {"description":"text CR CR CR text",
  282. "input":"text\r\r\rtext",
  283. "output":[["Character", "text\n\n\ntext"]]},
  284.  
  285. {"description":"Doctype publik",
  286. "input":"<!DOCTYPE html PUBLIK \"AbC\" \"XyZ\">",
  287. "output":["ParseError", ["DOCTYPE", "html", null, null, false]]},
  288.  
  289. {"description":"Doctype publi",
  290. "input":"<!DOCTYPE html PUBLI",
  291. "output":["ParseError", ["DOCTYPE", "html", null, null, false]]},
  292.  
  293. {"description":"Doctype sistem",
  294. "input":"<!DOCTYPE html SISTEM \"AbC\">",
  295. "output":["ParseError", ["DOCTYPE", "html", null, null, false]]},
  296.  
  297. {"description":"Doctype sys",
  298. "input":"<!DOCTYPE html SYS",
  299. "output":["ParseError", ["DOCTYPE", "html", null, null, false]]},
  300.  
  301. {"description":"Doctype html x>text",
  302. "input":"<!DOCTYPE html x>text",
  303. "output":["ParseError", ["DOCTYPE", "html", null, null, false], ["Character", "text"]]}
  304.  
  305. ]}
  306.