Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XMLSerializer: Should prefer the default namespace to a prefix declared in an ancestor #52

Open
tkent-google opened this issue May 9, 2019 · 0 comments

Comments

@tkent-google
Copy link

Suppose that we have the following XML document, parse it, and serialize it.

<root xmlns:x="uri1">
 <table xmlns="uri1"/>
</root>

If we follow the current specification, the serialization result is:

<root xmlns:x="uri1">
 <x:table xmlns="uri1"/>
</root>

It's incompatible with Edge, Firefox, Safari, and Chrome 73-.
(Chrome 74 produces the above result, and we're fixing it.)

I think 12.1 in https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node should be changed as following:

Original: Let candidate prefix be the result of retrieving a preferred prefix string prefix from map given namespace ns.

Proposed: Let candidate prefix be null if prefix is null and ns equals to local default namespace. Otherwise let candidate prefix be the result of retrieving a preferred prefix string prefix from map given namespace ns.

WPT domparsing/XMLSerializer-serializeToString.html contains a testcase for this behavior.
"Check if start tag serialization does NOT apply the default namespace if its namespace is declared in an ancestor."

wmfgerrit pushed a commit to wikimedia/mediawiki-libs-Dodo that referenced this issue Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants