karl <karl+pythonb...@la-grange.net> added the comment:

The current specification as of today documents
https://dom.spec.whatwg.org/#dom-document-createelementns


If you run this in the browser console, 

var nsdoc = 'http://foo.bar/zoo';
var xmldoc = document.implementation.createDocument(nsdoc, 'Zoo', null);
var cpd = document.createElementNS(nsdoc, 'Compound');
var chimp = document.createElementNS(nsdoc, 'Chimp');
cpd.appendChild(chimp)
xmldoc.documentElement.appendChild(cpd);

/* serializing */
var docserializer = new XMLSerializer();
var flatxml = docserializer.serializeToString(xmldoc);
flatxml


you get:

<Zoo xmlns="http://foo.bar/zoo";>
  <Compound>
    <Chimp/>
  </Compound>
</Zoo>


but if you run this in the browser console,

var nsdoc = 'http://foo.bar/zoo';
var xmldoc = document.implementation.createDocument(nsdoc, 'Zoo', null);
var cpd = document.createElement('Compound');
var chimp = document.createElement('Chimp');
cpd.appendChild(chimp)
xmldoc.documentElement.appendChild(cpd);

/* serializing */
var docserializer = new XMLSerializer();
var flatxml = docserializer.serializeToString(xmldoc);
flatxml


you get:


<Zoo xmlns="http://foo.bar/zoo";>
  <compound xmlns="http://www.w3.org/1999/xhtml";>
    <chimp></chimp>
  </compound>
</Zoo>


which is a complete different beast.


I don't think there is an issue here. And we can close this bug safely.

----------
nosy: +karlcow

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue18182>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to