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

Re: Enhancing grouping of selectors

From: Boris Zbarsky <bzbarsky@MIT.EDU>
Date: Sun, 19 Sep 2010 13:28:52 -0400
Message-ID: <4C964854.5020102@mit.edu>
To: Anne van Kesteren <annevk@opera.com>
CC: www-style@w3.org
On 9/19/10 8:49 AM, Anne van Kesteren wrote:
>> :not(a.foo)
...

> Really? I would expect :not(a):not(.foo) personally. Seems more in line
> with how a.foo works (without :not()).

Thank you _very_ much for illustrating the confusion that can arise!

"a.foo" means "tag name is 'a' AND class is 'foo'".

So :not(a.foo) ought to be the negation of that statement.  Applying De 
Morgan's law, that would be "tag name is not 'a' OR class is not 'foo'", 
which is the same as:

   :not(a), :not(.foo).

Whereas ":not(a):not(.foo)" means "tag name is not 'a' AND class is not 
'foo'" and is the same as the negation of the selector "a, .foo".

So how is :not(a.foo) meaning :not(a):not(.foo) "more in line" with how 
a.foo works?  And if the two of us can't agree on what this simple case 
should do, how do we expect authors to ever use this reasonably?

-Boris

P.S.  Note that with :any taking sequences of simple selectors and :not 
taking simple selectors it's now pretty simple to do things like:

   :any(:not(a), :not(.b))

to mean the same thing as a logical :not(a.b) would mean.  Granted, it's 
a lot more syntax.  And it doesn't work to reproduce the effects of :not 
applied to selectors (that is, things containing combinators), which is 
where :not applying to more stuff would _really_ be useful.
Received on Sunday, 19 September 2010 17:29:28 GMT

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