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

On 2/25/10 6:58 PM, Brad Kemper wrote:
> So you're not worried about people using this as a UA-selecting hack?

Any selector that one UA implements and another does not can be used as 
a UA-selecting hack, no?  The only way to deal with worrying about it is 
to never ever add any new selectors.

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

Someone who really wants to today can do:

body { rules for most UAs' body tag }
body,
#x:not(#x):-moz-handler-disabled { rules for gecko 1.9.1 or
                                    1.9.2 or 1.9.3 (or maybe later) }
body, #x:not(#x):-moz-lwtheme { rules for gecko 1.9.2 or 1.9.3 (or
                                 maybe later) }
body, #x:not(#x):-moz-handler-crashed { rules for gecko 1.9.3 (or
                                         maybe later) }

Or they can do:

body { rules for older UAs' body tag }
body, #x:not(#x):nth-child(1) { rules for UAs that support nth-child }

or various similar things.  As long as there are _any_ selector 
differences between browsers, including any vendor extensions, they can 
be used this way.

Now the caveat for authors is this can be fragile with the nonstandard 
properties (hence the "or maybe later"s above).  We obviously reserve 
the right to drop any -moz-whatever selector any time.  In practice, I 
haven't seen many authors doing this sort of thing.

-Boris

Received on Friday, 26 February 2010 04:42:28 UTC