W3C home > Mailing lists > Public > public-html@w3.org > June 2008

Prefixes and setting innerHTML in XML

From: Simon Pieters <simonp@opera.com>
Date: Wed, 04 Jun 2008 18:01:47 +0200
To: "public-html@w3.org" <public-html@w3.org>
Message-ID: <op.ub8es91qidj3kv@zcorpandell.linkoping.osa>

Step 2 in setting innerHTML in XML says:

    If the innerHTML attribute is being set on an element, the user agent
    must feed the parser just created the string corresponding to the start
    tag of that element, declaring all the namespace prefixes that are in
    scope on that element in the DOM, as well as declaring the default
    namespace (if any) that is in scope on that element in the DOM.

But what does "all the namespace prefixes that are in scope on that  
element in the DOM" actually mean? Does it mean xmlns:foo attributes (in  
the XMLNS namespace)? Does it mean elements that have non-empty .prefix?  
Both? What if the DOM contains namespace declarations and/or prefixes that  
are conflicting or illegal?

Consider e.g.:

    var e =  
    e.innerHTML = '<foo:img/>';
    e.innerHTML = '<img/>';
    e.innerHTML = '<foo:img/>';
    e.innerHTML = '';

(It seems that Firefox only inserts explicit namespace declarations.  
Safari inserts a default namespace declaration for the XHTML namespace,  
catches well-formedness errors but not namespace-well-formedness errors.  
Opera still uses the HTML parser for setting innerHTML in XML.)

Simon Pieters
Opera Software
Received on Wednesday, 4 June 2008 16:02:28 UTC

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