Re: Specificity of :any (was Re: [css3-selectors] Grouping)

On Feb 26, 2010, at 7:46 AM, fantasai wrote:

>> So given a selector like:
>> 
>> p:any(:hover,#mypara)
>> 
>> Should this selector have:
>> 
>>  specificity 11 (p + :any)
>>  specificity 111 (p + :hover + #mypara)
>>  specificity 121 (p + :any + :hover + #mypara)
>>  specificity 11 (p + :hover) or 101 (p + #mypara) depending on how it
>>    matches (with 101 if it matches both ways)?
>>  one of 11 or 101, not depending on how it matches (just always the
>>    lowest or highest)
>> 
>> I'd note that the next-to-last seems like it might be best,
> 
> I agree. I think anything other than that would have surprising
> cascade effects, and it would limit :any()'s usefulness for
> shortening unweildy selectors.

I agree also.

On Feb 26, 2010, at 6:58 AM, Boris Zbarsky wrote:

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

So you're not worried about people using this as a UA-selecting hack?

body { rules for most UAs' body tag }
:any(html) body { rules for this version of firefox or higher's body tag }

Received on Thursday, 25 February 2010 23:58:40 UTC