Re: Highlighting issue of XML support in DOM 4

* Anne van Kesteren wrote:
>On Tue, Jan 22, 2013 at 4:32 PM, Norman Walsh <ndw@nwalsh.com> wrote:
>> As Henri observes in another message, the version is moot, the code
>> performing serialization can decide if it's generating a standalone
>> document or not, and the encoding will be UTF-8 if the serializer
>> has any sense.
>
>Note that there is an XML serialization API:
>http://domparsing.spec.whatwg.org/#the-xmlserializer-interface

It http://shadowregistry.org/js/misc/#t8f43b148e7ac0d83ae2407516933c0e5
seems to behave as one would expect: the following code returns false,

  var doc1 = new DOMParser().parseFromString("<?xml version='1.0' "
    + "standalone='no'?><y/>", "text/xml");
  var doc2 = new DOMParser().parseFromString("<?xml version='1.0' "
    + "standalone='yes'?><y/>", "text/xml");
  var str1 = new XMLSerializer().serializeToString(doc1);
  var str2 = new XMLSerializer().serializeToString(doc2);
  return str1 == str2;

in Opera, Firefox, and Webkit as they retain the standalone declaration.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

Received on Wednesday, 23 January 2013 01:27:15 UTC