Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 570cf67

Browse files
committedSep 30, 2023
Add tests for xmlns & xmlns:xlink parse errors
This commit adds 14 tests for the two tree construction errors mentioned in the 12th step of "create an element for a token"[1], which currently says: > If element has an xmlns attribute in the XMLNS namespace whose value > is not exactly the same as the element's namespace, that is a parse > error. Similarly, if element has an xmlns:xlink attribute in the XMLNS > namespace whose value is not the XLink Namespace, that is a parse error. Previously these errors weren't tested at all. It's worth noting why `<html xmlns="totally not html">` isn't a parse error according to the spec: "adjust foreign attributes"[2] is only called on foreign elements (i.e. not on elements in the HTML namespace). (I would have liked to add a comment about this to the respective test cases but unfortunately the test case format doesn't support comments.) [1]: https://html.spec.whatwg.org/multipage/parsing.html#create-an-element-for-the-token [2]: https://html.spec.whatwg.org/multipage/parsing.html#adjust-foreign-attributes
1 parent a9f4496 commit 570cf67

File tree

1 file changed

+162
-0
lines changed

1 file changed

+162
-0
lines changed
 

‎tree-construction/xmlns-errors.dat

+162
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
#data
2+
<!doctype html><svg xmlns="http://www.w3.org/2000/svg"></svg>
3+
#errors
4+
#document
5+
| <!DOCTYPE html>
6+
| <html>
7+
| <head>
8+
| <body>
9+
| <svg svg>
10+
| xmlns="http://www.w3.org/2000/svg"
11+
12+
#data
13+
<!doctype html><math xmlns="http://www.w3.org/1998/Math/MathML"></math>
14+
#errors
15+
#document
16+
| <!DOCTYPE html>
17+
| <html>
18+
| <head>
19+
| <body>
20+
| <math math>
21+
| xmlns="http://www.w3.org/1998/Math/MathML"
22+
23+
#data
24+
<!doctype html><svg xmlns:xlink="http://www.w3.org/1999/xlink"></svg>
25+
#errors
26+
#document
27+
| <!DOCTYPE html>
28+
| <html>
29+
| <head>
30+
| <body>
31+
| <svg svg>
32+
| xmlns:xlink="http://www.w3.org/1999/xlink"
33+
34+
#data
35+
<!doctype html><html xmlns="totally not html"></html>
36+
#errors
37+
#document
38+
| <!DOCTYPE html>
39+
| <html>
40+
| xmlns="totally not html"
41+
| <head>
42+
| <body>
43+
44+
#data
45+
<!doctype html><html xmlns:xlink="totally not xlink"></html>
46+
#errors
47+
#document
48+
| <!DOCTYPE html>
49+
| <html>
50+
| xmlns:xlink="totally not xlink"
51+
| <head>
52+
| <body>
53+
54+
#data
55+
<!doctype html><svg xmlns="totally not svg"></svg>
56+
#errors
57+
xmlns mismatch
58+
#document
59+
| <!DOCTYPE html>
60+
| <html>
61+
| <head>
62+
| <body>
63+
| <svg svg>
64+
| xmlns="totally not svg"
65+
66+
#data
67+
<!doctype html><math xmlns="totally not mathml"></math>
68+
#errors
69+
xmlns mismatch
70+
#document
71+
| <!DOCTYPE html>
72+
| <html>
73+
| <head>
74+
| <body>
75+
| <math math>
76+
| xmlns="totally not mathml"
77+
78+
#data
79+
<!doctype html><svg xmlns:xlink="totally not xlink"></svg>
80+
#errors
81+
xmlns:xlink mismatch
82+
#document
83+
| <!DOCTYPE html>
84+
| <html>
85+
| <head>
86+
| <body>
87+
| <svg svg>
88+
| xmlns:xlink="totally not xlink"
89+
90+
#data
91+
<!doctype html><math xmlns:xlink="totally not xlink"></math>
92+
#errors
93+
xmlns:xlink mismatch
94+
#document
95+
| <!DOCTYPE html>
96+
| <html>
97+
| <head>
98+
| <body>
99+
| <math math>
100+
| xmlns:xlink="totally not xlink"
101+
102+
#data
103+
<!doctype html><svg xmlns="totally not svg" xmlns:xlink="totally not xlink"></svg>
104+
#errors
105+
xmlns mismatch
106+
xmlns:xlink mismatch
107+
#document
108+
| <!DOCTYPE html>
109+
| <html>
110+
| <head>
111+
| <body>
112+
| <svg svg>
113+
| xmlns="totally not svg"
114+
| xmlns:xlink="totally not xlink"
115+
116+
#data
117+
<!doctype html><svg xmlns="Http://www.w3.org/2000/svg"></svg>
118+
#errors
119+
xmlns mismatch
120+
#document
121+
| <!DOCTYPE html>
122+
| <html>
123+
| <head>
124+
| <body>
125+
| <svg svg>
126+
| xmlns="Http://www.w3.org/2000/svg"
127+
128+
#data
129+
<!doctype html><svg xmlns:xlink="Http://www.w3.org/2000/svg"></svg>
130+
#errors
131+
xmlns:xlink mismatch
132+
#document
133+
| <!DOCTYPE html>
134+
| <html>
135+
| <head>
136+
| <body>
137+
| <svg svg>
138+
| xmlns:xlink="Http://www.w3.org/2000/svg"
139+
140+
#data
141+
<!doctype html><svg xmlns></svg>
142+
#errors
143+
xmlns mismatch
144+
#document
145+
| <!DOCTYPE html>
146+
| <html>
147+
| <head>
148+
| <body>
149+
| <svg svg>
150+
| xmlns=""
151+
152+
#data
153+
<!doctype html><svg xmlns:xlink></svg>
154+
#errors
155+
xmlns:xlink mismatch
156+
#document
157+
| <!DOCTYPE html>
158+
| <html>
159+
| <head>
160+
| <body>
161+
| <svg svg>
162+
| xmlns:xlink=""

0 commit comments

Comments
 (0)
Please sign in to comment.