3 {"description": "proper attribute value escaping",
4 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "test \"with\" ""}]]],
5 "expected": ["<span title='test \"with\" &quot;'>"]
8 {"description": "proper attribute value non-quoting",
9 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo"}]]],
10 "expected": ["<span title=foo>"],
11 "xhtml": ["<span title=\"foo\">"]
14 {"description": "proper attribute value non-quoting (with <)",
15 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo<bar"}]]],
16 "expected": ["<span title=foo<bar>"],
17 "xhtml": ["<span title=\"foo<bar\">"]
20 {"description": "proper attribute value quoting (with =)",
21 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo=bar"}]]],
22 "expected": ["<span title=\"foo=bar\">"]
25 {"description": "proper attribute value quoting (with >)",
26 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo>bar"}]]],
27 "expected": ["<span title=\"foo>bar\">"]
30 {"description": "proper attribute value quoting (with \")",
31 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo\"bar"}]]],
32 "expected": ["<span title='foo\"bar'>"]
35 {"description": "proper attribute value quoting (with ')",
36 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo'bar"}]]],
37 "expected": ["<span title=\"foo'bar\">"]
40 {"description": "proper attribute value quoting (with both \" and ')",
41 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo'bar\"baz"}]]],
42 "expected": ["<span title=\"foo'bar"baz\">"]
45 {"description": "proper attribute value quoting (with space)",
46 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo bar"}]]],
47 "expected": ["<span title=\"foo bar\">"]
50 {"description": "proper attribute value quoting (with tab)",
51 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo\tbar"}]]],
52 "expected": ["<span title=\"foo\tbar\">"]
55 {"description": "proper attribute value quoting (with LF)",
56 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo\nbar"}]]],
57 "expected": ["<span title=\"foo\nbar\">"]
60 {"description": "proper attribute value quoting (with CR)",
61 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo\rbar"}]]],
62 "expected": ["<span title=\"foo\rbar\">"]
65 {"description": "proper attribute value non-quoting (with linetab)",
66 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo\u000Bbar"}]]],
67 "expected": ["<span title=foo\u000Bbar>"],
68 "xhtml": ["<span title=\"foo\u000Bbar\">"]
71 {"description": "proper attribute value quoting (with form feed)",
72 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo\u000Cbar"}]]],
73 "expected": ["<span title=\"foo\u000Cbar\">"]
76 {"description": "void element (as EmptyTag token)",
77 "input": [["EmptyTag", "img", {}]],
78 "expected": ["<img>"],
82 {"description": "void element (as StartTag token)",
83 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "img", {}]],
84 "expected": ["<img>"],
88 {"description": "doctype in error",
89 "input": [["Doctype", "foo"]],
90 "expected": ["<!DOCTYPE foo>"]
93 {"description": "character data",
94 "options": {"encoding":"utf-8"},
95 "input": [["Characters", "a<b>c&d"]],
96 "expected": ["a<b>c&d"]
99 {"description": "rcdata",
100 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "script", {}], ["Characters", "a<b>c&d"]],
101 "expected": ["<script>a<b>c&d"],
102 "xhtml": ["<script>a<b>c&d"]
105 {"description": "doctype",
106 "input": [["Doctype", "HTML"]],
107 "expected": ["<!DOCTYPE HTML>"]
110 {"description": "HTML 4.01 DOCTYPE",
111 "input": [["Doctype", "HTML", "-//W3C//DTD HTML 4.01//EN", "http://www.w3.org/TR/html4/strict.dtd"]],
112 "expected": ["<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">"]
115 {"description": "HTML 4.01 DOCTYPE without system identifer",
116 "input": [["Doctype", "HTML", "-//W3C//DTD HTML 4.01//EN"]],
117 "expected": ["<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\">"]
120 {"description": "IBM DOCTYPE without public identifer",
121 "input": [["Doctype", "html", "", "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"]],
122 "expected": ["<!DOCTYPE html SYSTEM \"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd\">"]