[whatwg] XHTML5 DOM building and IDness

Henri Sivonen hsivonen at iki.fi
Wed Nov 1 15:11:10 PST 2006


The spec says:
> The rules for parsing XML documents (and thus XHTML documents) into  
> DOM trees are covered by the XML and Namespaces in XML  
> specifications, and are out of scope of this specification.

However, the spec says the following about the id attribute:
> If the value is not the empty string, user agents must associate  
> the element with the given value (exactly) for the purposes of ID  
> matching (e.g. for selectors in CSS or for the getElementById()   
> method in the DOM).

The second quote implies that the first quote is not the full story  
and building a DOM tree from an XHTML document byte stream is not  
entirely covered by the XML and Namespaces in XML specifications but  
there is a piece of code somewhere between the XML processor and the  
resulting DOM tree that is analogous to an xml:id processor and that  
assigns IDness to attributes that are not in a namespace, have the  
local name "id" and belong to elements in the XHTML namespace.

(When I started looking for spec justification for adding a filter  
that assigns IDness on the SAX level, I didn't find explicit  
justification--just the implicit justification from the second quote  
that seems to contradict a strict reading of the first quote.)

-- 
Henri Sivonen
hsivonen at iki.fi
http://hsivonen.iki.fi/





More information about the whatwg mailing list