XMLSerializer: Should prefer the default namespace to a prefix declared in an ancestor
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 28
- Forks
- 14
- Avg merge
- 3h 10m
- Merged PRs (30d)
- 1
Description
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."
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read section 12.1 of the DOM Parsing XML serialization specification and compare it with the proposed wording in this issue. Review the WPT case in domparsing/XMLSerializer-serializeToString.html, then update the specification behavior so the existing test passes and the cross-browser serialization result is covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- xml
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100