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

Re: [css3] "Selectors that People Actually Use"

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Mon, 18 Feb 2008 19:48:06 -0600
Message-ID: <47BA3556.6090907@mit.edu>
To: Alan Gresley <alan1@azzurum.com>
CC: www-style@w3.org

Alan Gresley wrote:
>>> p[class*=""], p:not([class*=""]) {}
>> That's equivalent to the selector "p".
> 
> Correct but which is of greater specificity?
> 
> div {width: 100px;height:100px;background:red}
> div[id*=""], div:not([id*=""]) {background:blue}

I should note that in this case you could just rewrite the latter as "div" and 
get the same effect.  Or use !important.

I'm not saying Gecko's behavior here is obviously correct (though again the spec 
is unclear, and I've requested a clarification before making code changes).  I'm 
just saying there are no really good use cases for this particular use of this 
particular selector.  Heck, you could get an identical specificity effect with:

  div[id], div:not([id])

or with

  div:not([never-set-attribute])

or with any of a slew of other selectors.

-Boris
Received on Tuesday, 19 February 2008 01:47:46 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:01 GMT