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

Re: [css3-selectors] Grouping

From: Brad Kemper <brad.kemper@gmail.com>
Date: Fri, 8 Jan 2010 10:31:25 -0800
Cc: Nikita Popov <privat@ni-po.com>, news <news@terrainformatica.com>, www-style list <www-style@w3.org>
Message-Id: <FB890BED-6128-410B-9262-B59637E02EB6@gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>

On Jan 8, 2010, at 10:15 AM, Tab Atkins Jr. wrote:

> On Fri, Jan 8, 2010 at 12:05 PM, Brad Kemper <brad.kemper@gmail.com> wrote:
>> I really like the idea in general, but I'm not sure about it being a pseudo-class. I'm not against that at this point, mind you, but it is not obvious to me if the following two rules are equivalent:
>> div :any(span,div)
>> div:any(span,div)
>> or would that second version be nonsense, and simple selectors as arguments could only be used with a universal selector (or naked, implying a universal selector there).
> Basic rules of CSS grammar say that they're not equivalent - putting
> spaces between simple selectors like in the first example *always*
> indicates the descendant combinator.  Authors should be able to pull
> this lesson in from the entire rest of CSS, where there is a clear
> difference between "input :checked" and "input:checked" (even if they
> do make that sort of mistake, it's a very simple and consistent rule
> to explain).

Well that's the way I thought of it, but it seems unusual to have a pseudo-class that only works with the universal selector (in the simple case, anyway, your attribute selector variation aside). With ':checked' and with others, authors are accustomed to attaching pseudo-classes to simple selectors. I suspect that attaching them to emptiness or the universal selector is much less intuitive to many. Which is why I somewhat preferred Nikita's solution of just indicating a grouping in the grammar. 

Although, I do also like what you did with grouping the attribute selector there too...

> The second example isn't nonsense, the :any() just isn't adding
> anything to the existing element selector.  The selector will only
> match <div>s.

That seems even less obvious. 
Received on Friday, 8 January 2010 18:32:01 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:13:42 UTC