Re: [css3-selectors] Grouping

Tab Atkins Jr. <jackalmage@gmail.com> wrote:
 > I've asked for this before, under the :any() pseudoclass.  It works
 > just as you have it - that last rule would be written as ".add
 > :any(#authors,#publications) :any(input,select,textarea)".  It's
 > really a necessity for many cases where you end up with a
 > combinatorial explosion of selectors - this one selector replaces six
 > nearly identical ones.
 >
 > Implementors have agreed that it's basically just syntax sugar, and
 > wouldn't require any special mechanics or cause performance
 > regressions.  It's just not in a draft yet, is all.

At least in Gecko's case, what you wrote above would indeed be more or 
less just syntax sugar.  But this:

   :any(#authors, #publications) div

would probably be faster to match than:

   #authors div, #publications div

In fact, we're looking into implementing this right now (as :-moz-any()) 
to more efficiently deal with the numerous rules of this form that 
appear in our UA stylesheet.

-Boris

Received on Thursday, 25 February 2010 22:58:55 UTC