Re: Selectors: section 6.5: Error

> and then wants all the rules that apply to it, typically.  So you're saying that 
> whether an id selector applies should require examining all elements preceding 
> this one in a depth-first preorder traversal of the DOM?

Conceptually, although it would probably be better to say that selects
the same one as the DOM 1 get element by ID method, and then place any
error recovery requiremnts on that.

Physically, the determination could be done when the ID attribute is
encountered in the initial parse or as the result of the deletion or
insertion of an ID attribute (and possibly its containing element).

> Sounds slow to me.  :(  Especially on dynamic changes.

That depends on the physical implementation and is one of the penalties of
a policy that there is no invalid code (or as some would prefer to to
describe it, that all possible error recovery is uniquely specified), in 
that it puts constraints on the physical implementation that would not be
needed for valid input.

> 
> > as honouring all occurences makes ID selectors 
> > indistinguishable from class selectors, except for the namespace
> 
> And except that in valid documents they will have different meaning in a 
> stylesheet.... (semantically speaking).

I would have thought it was fairly well known that many authors don't
understand the difference anyway.

> > even if the matching mechanism naturally finds all matches
> 
> One usually matches rules to an element, not elements to a rule.

That's an example of a matching mechanism that finds all matches.

> 
> > as the ID can be modified in the DOM, so as not to match for this purpose.
> 
> Not sure what this means.  The CSS matching algorithm had better not modify the DOM.

I didn't mean the abstraction of the DOM used to define the scripting API,
but rather the physical realisation, e.g. there could be a hidden flag
that suppressed the recognition  of the ID attribute in search contexts,
whether DOM or CSS, or there could be two versions of the value, one used
to support search functions and the other to support explicit reads of
the attribute value.

Received on Friday, 6 January 2006 07:53:02 UTC