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

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>  

<foo xmlns:bar="">
<baz id="baz" />
<xhtml:script xmlns:xhtml="">
var newElement = document.createElement("bar:bar", " 

Your algorithm says "" but the correct answer is  
"". 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.


Received on Thursday, 1 October 2009 21:04:55 UTC