Re: [css3-selectors] Grouping

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