From 570cf6727c6818fb64ebc48bc684a24d3302f42e Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Sat, 30 Sep 2023 10:03:39 +0200 Subject: [PATCH] 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 `` 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 --- tree-construction/xmlns-errors.dat | 162 +++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 tree-construction/xmlns-errors.dat diff --git a/tree-construction/xmlns-errors.dat b/tree-construction/xmlns-errors.dat new file mode 100644 index 0000000..a57fc08 --- /dev/null +++ b/tree-construction/xmlns-errors.dat @@ -0,0 +1,162 @@ +#data + +#errors +#document +| +| +| +| +| +| xmlns="http://www.w3.org/2000/svg" + +#data + +#errors +#document +| +| +| +| +| +| xmlns="http://www.w3.org/1998/Math/MathML" + +#data + +#errors +#document +| +| +| +| +| +| xmlns:xlink="http://www.w3.org/1999/xlink" + +#data + +#errors +#document +| +| +| xmlns="totally not html" +| +| + +#data + +#errors +#document +| +| +| xmlns:xlink="totally not xlink" +| +| + +#data + +#errors +xmlns mismatch +#document +| +| +| +| +| +| xmlns="totally not svg" + +#data + +#errors +xmlns mismatch +#document +| +| +| +| +| +| xmlns="totally not mathml" + +#data + +#errors +xmlns:xlink mismatch +#document +| +| +| +| +| +| xmlns:xlink="totally not xlink" + +#data + +#errors +xmlns:xlink mismatch +#document +| +| +| +| +| +| xmlns:xlink="totally not xlink" + +#data + +#errors +xmlns mismatch +xmlns:xlink mismatch +#document +| +| +| +| +| +| xmlns="totally not svg" +| xmlns:xlink="totally not xlink" + +#data + +#errors +xmlns mismatch +#document +| +| +| +| +| +| xmlns="Http://www.w3.org/2000/svg" + +#data + +#errors +xmlns:xlink mismatch +#document +| +| +| +| +| +| xmlns:xlink="Http://www.w3.org/2000/svg" + +#data + +#errors +xmlns mismatch +#document +| +| +| +| +| +| xmlns="" + +#data + +#errors +xmlns:xlink mismatch +#document +| +| +| +| +| +| xmlns:xlink=""