W3C home > Mailing lists > Public > public-html@w3.org > October 2009

Re: ISSUE-41/ACTION-97 decentralized-extensibility

From: Maciej Stachowiak <mjs@apple.com>
Date: Thu, 01 Oct 2009 14:04:19 -0700
Cc: Anne van Kesteren <annevk@opera.com>, Jonas Sicking <jonas@sicking.cc>, Adrian Bateman <adrianba@microsoft.com>, HTML WG <public-html@w3.org>, Tony Ross <tross@microsoft.com>, Sam Ruby <rubys@intertwingly.net>
Message-id: <B7EC85C5-EB62-4378-8832-833E85E812C4@apple.com>
To: Julian Reschke <julian.reschke@gmx.de>

On Oct 1, 2009, at 1:00 PM, Julian Reschke wrote:

> Maciej Stachowiak wrote:
>> ...
>> You said it's well-defined how to find out what meaning an element  
>> has using DOM Level 1 (presumably determining the namespaceURI  
>> somehow). Can you state or point to the definition?
>> ...
>
> I'm referring to the algorithm that ways mentioned multiple times in  
> RDFa threads: visit all parents, and check for all attributes where  
> the local name is "xmlns", or starts with "xmlns:". Figure out  
> namespace declarations from those.

That algorithm is incorrect. Prefix bindings apply at parse time, not  
lookup time.

Here's a test case, using XML. What's the namespace of the <bar>  
element?

<foo xmlns:bar="http://example.com/bar">
<baz id="baz" />
<xhtml:script xmlns:xhtml="http://www.w3.org/1999/xhtml/">
var newElement = document.createElement("bar:bar", "http://barbar.com/barbar/ 
");
document.getElemebtById("baz").appendChild(newElement);
</xhtml:script>
</foo>

Your algorithm says "http://example.com/bar" but the correct answer is  
"http://barbar.com/barbar/". This is not just "an edge case" - it will  
apply any time the DOM has been mutated after parsing. It affects not  
just element or attribute creation, but also moving chunks of the DOM  
from one place to another with different namespace declarations in  
scope (the namespace URIs shouldn't change for the moved content!) or  
to adding or removing namespace declaration attributes.

Thus, your algorithm for finding the namespace URI of an element using  
DOM Level 1 APIs may be well-defined but it is incorrect.

Regards,
Maciej
Received on Thursday, 1 October 2009 21:04:55 GMT

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