Re: Selectors: section 6.5: Error

David Woolley wrote:
> Whilst I would prefer a world in which specifications could use 
> "don't care" rules, my vote, amongst the two options here, would be to
> only honour the first one

What's "first"?  Keep in mind that for CSS matching one usually has an element 
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?

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

> 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).

> Honouring just the first ought to be easy to enforce

I see no decent way to enforce it that's performant.

> even if the matching mechanism naturally finds all matches

One usually matches rules to an element, not elements to a rule.

> 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.

-Boris

Received on Wednesday, 4 January 2006 02:32:31 UTC