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 =  
document.createElementNS('http://www.w3.org/1999/xhtml','foo:div');
    e.innerHTML = '<foo:img/>';
    e.innerHTML = '<img/>';
    e.setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:foo','bar:');
    e.innerHTML = '<foo:img/>';
    e.setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:xml','bar:');
    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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:18 GMT