aboutsummaryrefslogtreecommitdiff
path: root/tests/html5lib-tests/serializer/core.test
blob: c0b4222d2d9a57008f6f6f58a07add8cd7599d69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
{"tests": [

{"description": "proper attribute value escaping",
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "test \"with\" ""}]]],
 "expected": ["<span title='test \"with\" &amp;quot;'>"]
},

{"description": "proper attribute value non-quoting",
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo"}]]],
 "expected": ["<span title=foo>"],
 "xhtml":    ["<span title=\"foo\">"]
},

{"description": "proper attribute value non-quoting (with <)",
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo<bar"}]]],
 "expected": ["<span title=foo<bar>"],
 "xhtml":    ["<span title=\"foo&lt;bar\">"]
},

{"description": "proper attribute value quoting (with =)",
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo=bar"}]]],
 "expected": ["<span title=\"foo=bar\">"]
},

{"description": "proper attribute value quoting (with >)",
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo>bar"}]]],
 "expected": ["<span title=\"foo>bar\">"]
},

{"description": "proper attribute value quoting (with \")",
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo\"bar"}]]],
 "expected": ["<span title='foo\"bar'>"]
},

{"description": "proper attribute value quoting (with ')",
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo'bar"}]]],
 "expected": ["<span title=\"foo'bar\">"]
},

{"description": "proper attribute value quoting (with both \" and ')",
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo'bar\"baz"}]]],
 "expected": ["<span title=\"foo'bar&quot;baz\">"]
},

{"description": "proper attribute value quoting (with space)",
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo bar"}]]],
 "expected": ["<span title=\"foo bar\">"]
},

{"description": "proper attribute value quoting (with tab)",
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo\tbar"}]]],
 "expected": ["<span title=\"foo\tbar\">"]
},

{"description": "proper attribute value quoting (with LF)",
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo\nbar"}]]],
 "expected": ["<span title=\"foo\nbar\">"]
},

{"description": "proper attribute value quoting (with CR)",
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo\rbar"}]]],
 "expected": ["<span title=\"foo\rbar\">"]
},

{"description": "proper attribute value non-quoting (with linetab)",
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo\u000Bbar"}]]],
 "expected": ["<span title=foo\u000Bbar>"],
 "xhtml": ["<span title=\"foo\u000Bbar\">"]
},

{"description": "proper attribute value quoting (with form feed)",
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "span", [{"namespace": null, "name": "title", "value": "foo\u000Cbar"}]]],
 "expected": ["<span title=\"foo\u000Cbar\">"]
},

{"description": "void element (as EmptyTag token)",
 "input": [["EmptyTag", "img", {}]],
 "expected": ["<img>"],
 "xhtml":    ["<img />"]
},

{"description": "void element (as StartTag token)",
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "img", {}]],
 "expected": ["<img>"],
 "xhtml":    ["<img />"]
},

{"description": "doctype in error",
 "input": [["Doctype", "foo"]],
 "expected": ["<!DOCTYPE foo>"]
},

{"description": "character data",
 "options": {"encoding":"utf-8"},
 "input": [["Characters", "a<b>c&d"]],
 "expected": ["a&lt;b&gt;c&amp;d"]
},

{"description": "rcdata",
 "input": [["StartTag", "http://www.w3.org/1999/xhtml", "script", {}], ["Characters", "a<b>c&d"]],
 "expected": ["<script>a<b>c&d"],
 "xhtml": ["<script>a&lt;b&gt;c&amp;d"]
},

{"description": "doctype",
 "input": [["Doctype", "HTML"]],
 "expected": ["<!DOCTYPE HTML>"]
},

{"description": "HTML 4.01 DOCTYPE",
 "input": [["Doctype", "HTML",  "-//W3C//DTD HTML 4.01//EN", "http://www.w3.org/TR/html4/strict.dtd"]],
 "expected": ["<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">"]
},

{"description": "HTML 4.01 DOCTYPE without system identifer",
 "input": [["Doctype", "HTML",  "-//W3C//DTD HTML 4.01//EN"]],
 "expected": ["<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\">"]
},

{"description": "IBM DOCTYPE without public identifer",
 "input": [["Doctype", "html",  "", "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"]],
 "expected": ["<!DOCTYPE html SYSTEM \"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd\">"]
}

]}