W3C home > Mailing lists > Public > www-style@w3.org > February 2010

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

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Thu, 25 Feb 2010 23:41:53 -0500
Message-ID: <4B875111.3010909@mit.edu>
To: Brad Kemper <brad.kemper@gmail.com>
CC: www-style@w3.org
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:24 GMT