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

Re: Enhancing grouping of selectors

From: Paul Duffin <pduffin@volantis.com>
Date: Sun, 19 Sep 2010 10:36:58 -0600 (MDT)
To: Alan Gresley <alan@css-class.com>
Cc: Boris Zbarsky <bzbarsky@mit.edu>, www-style@w3.org, Anne van Kesteren <annevk@opera.com>
Message-ID: <410314180.20216.1284914218083.JavaMail.root@zimbra.volantis.com>
----- 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 GMT

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