It's possible for 'generate a prefix' algorithm to generate a prefix conflicting with an existing one
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 28
- Forks
- 14
- Avg merge
- 3h 10m
- Merged PRs (30d)
- 1
Description
https://w3c.github.io/DOM-Parsing/#generating-namespace-prefixes
The algorithm just generates 'ns1', 'ns2', ... without checking existence of generated prefixes.
So, the following example serializes two xmlns:ns1 on child element if we follow the current specification. WPT domparsing/XMLSerializer-serializeToString.html already has a test case ("Check if "ns1" is generated even if the element already has xmlns:ns1.").
const root = (new DOMParser()).parseFromString('<root xmlns:ns2="uri2"><child xmlns:ns1="uri1" xmlns:a0="uri1" xmlns:NS1="uri1"/></root>', 'text/xml').documentElement;
root.firstChild.setAttributeNS('uri3', 'attr1', 'value1');
console.log((new XMLSerializer()).serializeToString(root));
The algorithm should have a loop until a generated prefix is not found.
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
Start with the generating namespace prefixes algorithm in the linked DOM-Parsing specification and review WPT domparsing/XMLSerializer-serializeToString.html, including the existing ns1 test. Done means generated prefixes are checked with the specification’s “found” condition so serialization does not create a conflicting duplicate prefix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100