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

Re: Enhancing grouping of selectors

From: Paul Duffin <pduffin@volantis.com>
Date: Sat, 18 Sep 2010 11:23:29 -0600 (MDT)
To: "L. David Baron" <dbaron@dbaron.org>
Cc: "Tab Atkins Jr." <jackalmage@gmail.com>, Matthew Millar <mattmill30@hotmail.com>, www-style@w3.org
Message-ID: <751199499.19319.1284830609832.JavaMail.root@zimbra.volantis.com>

----- Original Message -----
> On Sat, Sep 18, 2010 at 1:26 AM, Paul Duffin <pduffin@volantis.com>
> wrote:
> > ----- Original Message -----
> >> (Note, though, that you wrote the selector wrong. :any()'s
> >> arguments
> >> are comma-separated, because you can have arbitrary selectors as
> >> arguments. So it needs to be:
> >>
> >> :any(e, #id, .class) :any(e, #id, .class) :any(e, #id, .class)
> >> {...}
> >>
> >
> > Ok, I couldn't find :any defined anywhere, ,only
> > http://dbaron.org/log/20100424-any
> Yeah, it's not in any draft yet. It's just been discussed on the
> mailing list, and then experimentally implemented by dbaron.
> > which only allows a simple selector in the :any(). Is that just an
> > implementation limitation?
> Are you sure? The particular example he gives uses only simple
> selectors as arguments, but I don't think that's a general restriction
> in his implementation. Right, dbaron?

My mistake, the page says:

":-moz-any() is allowed to contain selectors with multiple simple selectors (using the css3-selectors definition of simple selectors, not the CSS 2.1 definition), but it is not allowed to contain combinators or pseudo-elements."

I missed the "selectors with multiple simple selectors" part, I just read "contain simple selectors", probably because I hadn't realised that there was that big a difference between the CSS 3 definition of simple selector and the CSS 2.1 definition and went off to read them.

CSS 2.1 says "A simple selector is either a type selector or universal selector followed immediately by zero or more attribute selectors, ID selectors, or pseudo-classes, in any order. The simple selector matches if all of its components match."

CSS 3 says "A simple selector is either a type selector, universal selector, attribute selector, class selector, ID selector, or pseudo-class."

So according to that it looks as though :-moz-any(a.id, p.class) would be valid.

> > On a related note I just looked at :not(),
> > http://www.w3.org/TR/css3-selectors/#negation, which is a similar
> > 'logical pseudo class' and it is limited to a simple selector, and
> > cannot contain itself. What are the reasons for this limitation,
> > e.g. why can't I write any of the following?
> > * :not(a.special)
> > * :not(li > a)
> > * :not(ol > li, ul > li)
> >
> > The latter could be written as:
> > * :not(:any(ol, ul) > li)
> Not sure; I wasn't in the group at the time.

Just checked again and it says:

"The negation pseudo-class, :not(X), is a functional notation taking a simple selector (excluding the negation pseudo-class itself) as an argument. It represents an element that is not represented by its argument."

Does "simple selector" in this case use the CSS 3 definition (which it should given it is in the CSS 3 specification), or does it mistakenly use the CSS 2.1 definition, which would allow things like :not(a.special) but not :not(li > a).
Received on Saturday, 18 September 2010 17:24:03 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:49:47 UTC