Re: Enhancing grouping of selectors

On Fri, Sep 17, 2010 at 3:09 PM, Paul Duffin <pduffin@volantis.com> wrote:
> What about the specificity issue?
>
> If it is supposed to behave as the exploded version then that will make it harder to implement efficiently but doing it any other way will mean that it is not exactly equivalent to the exploded version.
>
> e.g.
> :any (e #id .class) :any (e #id .class) :any (e #id .class) {...}
>
> Would explode to 27 rules with specificities ranging from 003 to 300.
>
> So I guess the question is, is this intended as a shorthand for authors or an optimization?

Shorthand for authors, though it can also function as an optimization.
 dbaron just punted on the specificity issue and treated it as an
ordinary pseudoclass, so those 3 rules would generate a selector with
specificity 030.

(Note, though, that you wrote the selector wrong.  :any()'s arguments
are comma-separated, because you can have arbitrary selectors as
arguments.  So it needs to be:

:any(e, #id, .class) :any(e, #id, .class) :any(e, #id, .class) {...}

)

I think the sanest solution is to use the min or max specifity of the
contained argument, so either 003 or 300.  Probably the latter.

~TJ

Received on Friday, 17 September 2010 22:19:52 UTC