[w3c/DOM-Parsing] It's possible for 'generate a prefix' algorithm to generate a prefix conflicting with an existing one (#44)

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.

```
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](https://w3c.github.io/DOM-Parsing/#dfn-found).


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/DOM-Parsing/issues/44

Received on Friday, 15 February 2019 06:38:10 UTC