This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Test with this problem: Serialization-xhtml-2 Serialization-xhtml-21 Serialization-xhtml-22 Serialization-xhtml-38 Serialization-xhtml-40 In the tests from the above list, the expected ouput match for the first element <html> is <html> but I think it should also allow to match a namespace declaration for XHTML namespace like this: <html xmlns="http://www.w3.org/1999/xhtml"> This to allow implementations to create quirk-compatible documents. This because the spec says: ... If the value of the html-version serialization parameter is 5.0, the serializer SHOULD output namespace declarations in a way that is consistent with the requirements of [POLYGLOT]. ... From POLYGLOT[https://www.w3.org/TR/html-polyglot/] : 4.4.1 Element-level namespaces [HTML5] introduces undeclared (native) default namespaces for the root HTML element, html, the root SVG element, svg, and the root MathML element, math. Polyglot markup declares the following default namespaces, when the markup languages are included in the document, to maintain XML compatibility [XML10]: <html xmlns="http://www.w3.org/1999/xhtml"> <math xmlns="http://www.w3.org/1998/Math/MathML"> <svg xmlns="http://www.w3.org/2000/svg"> Polyglot markup declares the default namespaces on the root HTML element, html, the root SVG element, svg, and the root MathML element math, and on any HTML elements used as children of SVG or MathML elements. Polyglot markup does not declare any other default or prefixed element namespace, because [HTML5] does not natively support the declaring of any other default or prefixed element namespace.
I disagree. The spec says The serializer MUST output namespace declarations that are consistent with the namespace nodes present in the result tree, I don't think the serializer is entitled to move elements into a different namespace. The prefix normalization process defined for XHTML changes the prefix assigned to an element, and removes unused namespaces, but it never moves an element from one namespace into another.