Re: Enhancing grouping of selectors

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 UTC