- From: TAMURA, Kent <notifications@github.com>
- Date: Thu, 14 Feb 2019 22:53:25 -0800
- To: w3c/DOM-Parsing <DOM-Parsing@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Friday, 15 February 2019 06:53:47 UTC
https://w3c.github.io/DOM-Parsing/#dfn-retrieving-a-preferred-prefix-string WPT domparsing/XMLSerializer-serializeToString.html has a test case for this behavior.```"Check if an attribute with namespace and no prefix is serialized with the nearest-declared prefix even if the prefix is assigned to another namespace."``` ``` const root = (new DOMParser()).parseFromString('<el1 xmlns:p="u1" xmlns:q="u1"><el2 xmlns:q="u2"/></el1>', 'text/xml').documentElement; root.firstChild.setAttributeNS('u1', 'name', 'v'); console.log((new XMLSerializer()).serializeToString(root)); ``` If we follow the current specification, 'retrieve a preferred prefix string' for ```name``` attribute choses ```q``` prefix because ```q``` is in the list for ```u1``` namespace. However, namespace for ```q``` is ```u2``` on the element. The serialization result would be ```<el1 ...><el2 xmlns:q="u2" q:name="v"/></el1>``` Before we [add](https://w3c.github.io/DOM-Parsing/#dfn-add) prefix and namespace to a map, we need to remove the prefix associated to another namespace from the map. -- 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/45
Received on Friday, 15 February 2019 06:53:47 UTC