W3C home > Mailing lists > Public > public-html@w3.org > September 2007

Serializing XML with innerHTML (detailed review of the DOM)

From: Simon Pieters <simonp@opera.com>
Date: Tue, 11 Sep 2007 13:47:51 +0200
To: public-html <public-html@w3.org>
Message-ID: <op.tyhm11yridj3kv@hp-a0a83fcd39d2.palace.opera.no>

(This is part of my detailed review of the Document Object Model section.)

Consider the following document:

    <h:p xmlns:h="http://www.w3.org/1999/xhtml"><x/></h:p>

When getting innerHTML on the root element, should the serialization  
declare the no namespace explicitly as in <x xmlns=""/>? (I think it  
should because setting innerHTML will imply namespace declarations so it  
might change meaning if you insert it somewhere else with innerHTML.)

Also, the spec says:

    In an XML context, the innerHTML DOM attribute on HTMLElements and
    HTMLDocuments, on getting, must return a string in the form of an
    internal general parsed entity [...]

...and then goes on to say that some DocumentType nodes must raise an  
exception, however internal general parsed entities can't have doctypes in  
the first place. Are doctypes to be removed from the serialization? If so,  
why should some of them raise an exception? Or should the attribute on the  
HTMLDocument interface return a string in the form of a document? If the  
latter, should an exception be raised if there is no root element?

Finally, the spec lists the following as something that throws:

    A Text node whose data contains characters that are not matched by the
    XML Char production. [XML]

But Text data is not the only case that might not match the Char  
production in XML. Comment data, CDATASection data, ProcessingInstruction  
target, and, I think, Attr value.

Simon Pieters
Opera Software
Received on Tuesday, 11 September 2007 11:48:05 UTC

This archive was generated by hypermail 2.4.0 : Saturday, 9 October 2021 18:44:21 UTC