== Overview == When serializing a document where attributes have been added using .setAttributeNs(), the serialization is invalid XML. == Steps to Reproduce == Execute the following code: var doc = (new DOMParser()).parseFromString("<test xmlns='http://www.example.com'/>","text/xml"); doc.documentElement.setAttributeNS("http://www.w3.org/XML/1998/namespace","id","abc"); doc.documentElement.setAttributeNS("http://www.example.com/dummy/namespace","foo","bar"); console.log((new XMLSerializer()).serializeToString(doc)); (can be found at http://jsfiddle.net/c4jBw/) == Actual Results == <test xmlns="http://www.example.com" id="abc" xmlns="http://www.w3.org/XML/1998/namespace" foo="bar" xmlns="http://www.example.com/dummy/namespace"/> == Expected Results == <test xmlns="http://www.example.com" xml:id="abc" a0:foo="bar" xmlns:a0="http://www.example.com/dummy/namespace"/> == Software Version == First encountered with Safari 5.1.7 (7534.57.2) on Windows 7 == Additional Comments == The main problem are three xmlns attributes. The second problem is that the added attributes are in the null namespace. The correct example output is taken from Firefox 21.
This seems rather like other serializing bugs, like bug 19121? I am quite sure that fixing that one fixes this one too.
Mass moving XML DOM bugs to the "DOM" Component.
*** Safari Technical Preview 151 **** > In JSFiddle: "<test xmlns=\"http://www.example.com\" xml:id=\"abc\" NS1:foo=\"bar\" xmlns:NS1=\"http://www.example.com/dummy/namespace\"/>" > In Browser Console: <test xmlns="http://www.example.com" xml:id="abc" NS1:foo="bar" xmlns:NS1="http://www.example.com/dummy/namespace"/> ** Chrome Canary 106 *** > In JSFiddle: "<test xmlns=\"http://www.example.com\" xml:id=\"abc\" xmlns:ns1=\"http://www.example.com/dummy/namespace\" ns1:foo=\"bar\"/>" > In Browser Console: <test xmlns="http://www.example.com" xml:id="abc" xmlns:ns1="http://www.example.com/dummy/namespace" ns1:foo="bar"/> *** Firefox Nightly 105 *** > In JSFiddle: "<test xmlns=\"http://www.example.com\" xml:id=\"abc\" a0:foo=\"bar\" xmlns:a0=\"http://www.example.com/dummy/namespace\"/>" > In Browser Console: <test xmlns="http://www.example.com" xml:id="abc" NS1:foo="bar" xmlns:NS1="http://www.example.com/dummy/namespace"/> ___________ I am not sure now web-spec so I am going to just post updated results. Thanks!
This appears to be working now.