Re: comments on Selectors

Brant Langer Gurganus wrote:

> Boris Zbarsky wrote:
>
>>>      From my understanding, explicitly including the *
>>>      under current implementations takes longer for matching to the
>>>      correct element
>>>   
>>
>>
>> Which implementations is that the case for, out of curiousity?
>>
>> Boris
>>  
>>
> I think I found where I saw that before 
> (http://www.mozilla.org/xpfe/goodcss.html).  It looks like it includes 
> implied style rules as well.  Probably a misunderstanding on my part.  
> Its been a while since I read it and who knows how up-to-date the 
> document is.
>
This is a misunderstanding on your part wrt Mozilla. I haven't looked at 
the code in a long time but I am the original implementor of the Mozilla 
style matching code. The document you refer to matches my recollection 
of the original implementation so it doesn't seem to have changed in any 
way that effects this discussion.

The warning about performance hits for the universal selector refers 
only to rules that have no other specificity in the "key selector" (to 
use the document's terminology).

So:
* { color: red; }
is slower than
h1 { color: red; }

but,
*.foo { color: red; }

is just as fast as:
.foo { color: red; }

In fact, the implementation does not differentiate between the two (or 
at least it didn't once upon a time).

Received on Monday, 17 February 2003 21:31:15 UTC