Re: Enhancing grouping of selectors

----- Original Message -----
> Anne van Kesteren wrote:
> > On Sun, 19 Sep 2010 14:40:33 +0200, Boris Zbarsky <bzbarsky@mit.edu>
> > wrote:
> >> This has been discussed before on the list, as I recall, but one
> >> issue
> >> was that something like:
> >>
> >>    :not(a.foo)
> >>
> >> is, at least to some people, ambiguous. Does it mean
> >>
> >>    :not(a):not(.foo)
> >>
> >> or does it mean
> >>
> >>    :not(a), :not(.foo)
> >>
> >> or something else?
> >>
> >> It seems to me that the ":not(a), :not(.foo)" meaning is what's
> >> meant,
> >> though....
> >
> > Really? I would expect :not(a):not(.foo) personally. Seems more in
> > line
> > with how a.foo works (without :not()).
> 
> 
> I would expect likewise. You would want negation of style applied to
> <a> with the class of "foo". <a class="foo" />
> 

According to the discussion about :nth-of-type() a simple selector defines a set that contains those elements that match those selector. A sequence of simple selectors defines the intersection of the sets defined by a simple selector.

"a" - set containing all elements with local name "a".
".foo" - set containing all elements with class name "foo".

"a.foo" - set containing all elements that have both the local name "a" and the class name "foo".

":not(a.foo)" - set that contains every element not in the set "a.foo".

So, given the following elements:
1 - <a class="foo">
2 - <a class="bar">
3 - <b class="foo">
4 - <b class="bar">

Then:
"a" = {#1, #2}
".foo" = {#1, #3}
"a.foo" = {#1}
":not(a.foo)" = {#2, #3, #4}

":not(a)" = {#3, #4}
":not(.foo)" = {#2, #4}

":not(a):not(.foo)" = {#4}
":not(a), :not(.foo)" = {#2, #3, #4}

Assuming my original assumption that ":not(S)" is the set that contains every element not in the set "S" then:
    ":not(a.foo)" = ":not(a), :not(.foo)"

Received on Sunday, 19 September 2010 16:37:35 UTC