As of r81742, WebKit supports the :-webkit-any pseudoclass. Our current implementation matches Mozilla's AFAIK. There's a couple changes I'd like to make though.<div><br></div><div>1. Allow a group of selectors as the argument to :-webkit-any instead of a sequence of simple selectors. See <a href="http://lists.w3.org/Archives/Public/www-style/2011Mar/0486.html">http://lists.w3.org/Archives/Public/www-style/2011Mar/0486.html</a>. I don't see any objections to this, so I plan to just move forward with this unless someone here objects.</div>

<div><br></div><div>2. Resolve the specificity question below. The ideal behavior would be transparent to authors, so the specificity would depend on which argument of the any pseudoclass matched. In order to make this work, I think we'd need to add an out-param to checkSelector and then store a wrapper around RuleData in CSSStyleSelector::m_matchedRules. Then we could get the right data to sort the rules appropriately when needed.</div>

<div><br></div><div>That seems like a lot of complexity and it likely has memory implications. Is there a better way? Should we just punt and keep the current specificity (option 1 below)? Or should we pick the highest (option 5 below)?</div>

<div><br></div><div>My intuition is to keep it as is.</div><div><br></div><div>Ojan<br><br><div class="gmail_quote">---------- Forwarded message ----------<br>From: <b class="gmail_sendername">Tab Atkins Jr.</b> <span dir="ltr"><<a href="mailto:jackalmage@gmail.com">jackalmage@gmail.com</a>></span><br>

Date: Fri, Feb 26, 2010 at 10:25 AM<br>Subject: Re: Specificity of :any (was Re: [css3-selectors] Grouping)<br>To: "L. David Baron" <<a href="mailto:dbaron@dbaron.org">dbaron@dbaron.org</a>><br>Cc: <a href="mailto:www-style@w3.org">www-style@w3.org</a><br>

<br><div><div></div><div class="h5">On Thu, Feb 25, 2010 at 5:16 PM, L. David Baron <<a href="mailto:dbaron@dbaron.org">dbaron@dbaron.org</a>> wrote:<br>
> On Thursday 2010-02-25 17:58 -0500, Boris Zbarsky wrote:<br>
>> At least in Gecko's case, what you wrote above would indeed be more<br>
>> or less just syntax sugar.  But this:<br>
>><br>
>>   :any(#authors, #publications) div<br>
>><br>
>> would probably be faster to match than:<br>
>><br>
>>   #authors div, #publications div<br>
>><br>
>> In fact, we're looking into implementing this right now (as<br>
>> :-moz-any()) to more efficiently deal with the numerous rules of<br>
>> this form that appear in our UA stylesheet.<br>
><br>
> So the one thing that I just realized I'm not sure how to implement<br>
> is specificity.  (What I actually have implemented is treating :any<br>
> as a pseudo-class and ignoring its arguments, which probably isn't<br>
> what we want.)<br>
><br>
> So given a selector like:<br>
><br>
> p:any(:hover,#mypara)<br>
><br>
> Should this selector have:<br>
><br>
>  specificity 11 (p + :any)<br>
>  specificity 111 (p + :hover + #mypara)<br>
>  specificity 121 (p + :any + :hover + #mypara)<br>
>  specificity 11 (p + :hover) or 101 (p + #mypara) depending on how it<br>
>   matches (with 101 if it matches both ways)?<br>
>  one of 11 or 101, not depending on how it matches (just always the<br>
>   lowest or highest)<br>
><br>
> I'd note that the next-to-last seems like it might be best, but I<br>
> can't think of an obvious way to implement it in our code.<br>
<br>
</div></div>Yes, ideally the :any() is transparent wrt specificity, which is your<br>
second-to-last option.  I'm not opposed to the first or last(with<br>
highest) options, though, if either of them end up being sufficiently<br>
simpler.<br>
<font color="#888888"><br>
~TJ<br>
<br>
</font></div><br></div>