W3C home > Mailing lists > Public > www-style@w3.org > February 2003

Re: comments on Selectors

From: Peter S. Linss <peter@linss.com>
Date: Mon, 17 Feb 2003 22:00:15 -0800
Message-ID: <3E51CBEF.3030303@linss.com>
To: Boris Zbarsky <bzbarsky@MIT.EDU>
CC: Brant Langer Gurganus <brantgurganus2001@cherokeescouting.org>, W3C Style List <www-style@w3.org>

Boris Zbarsky wrote:

>>Its been a while since I read it and who knows how up-to-date the 
>>document is.
>It's up to date.  All it says is that a rule like:
>*:empty { color: red }
>will take longer to process than a rule like
>.empty-stuff { color: red }
>because the former will be compared to all elements.

Again, note the difference in the selectors.

is functionally (and performance) equivalent to

is functionally (and performance) equivalent to

There is no performance difference (in Mozilla) for having an implied or 
explicit * portion of a selector.

>The perf difference is hard (if possible) to notice on a typical web page; that
>document's primary audience are people writing Mozilla themes and XBL (the
>amount of CSS in a typical Mozilla theme plus the default CSS that's always
>applied to the chrome is easily 10 times larger than the amount of CSS I've
>seen in any web page...)
Agreed, also note that the performance hit really comes from having a 
large number of rules where the final selector has no type, class or ID 
component (because each of those rules is then be tested against every 
node in the DOM tree).
Received on Tuesday, 18 February 2003 01:01:19 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:06 UTC