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

Re: [css3-selectors] Grouping

From: Nikita Popov <privat@ni-po.com>
Date: Fri, 08 Jan 2010 22:14:26 +0100
Message-ID: <4B47A032.8090606@ni-po.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
CC: www-style list <www-style@w3.org>
Am 08.01.2010 20:34, schrieb Tab Atkins Jr.:
> On Fri, Jan 8, 2010 at 12:54 PM, Nikita Popov<privat@ni-po.com>  wrote:
>    
>> Am 08.01.2010 19:25, schrieb Tab Atkins Jr.:
>>      
>>>   You could avoid that with:
>>>
>>> .page form :any(form>    input, label select) {}
>>>
>>>        
>> Could I?
>>
>> I think your selector would be resolved in
>> .page form form>  input,
>> .page form label select
>> which is different from what I meant with the ">  input":
>> .page form>  input,
>> .page form label select
>>      
> Nope, the :any (or :matches) pseudoclass matches any element that
> matches one of the selectors passed in.  So this:
>
> .page form :matches(form>  input, label select)
>
>    
Ah... using a different name makes it much clearer. I thought of :any 
really as a form of grouping, not subrules.
>> Actually, the missing space was not a typo, but I thought that
>> .page form :any(>input, ...)
>> would be
>> .page form *:any(>input, ...)
>> would be
>> .page form *>  input
>> which wasn't my original intention ( .page form>  input)
>>      
> That's why we shouldn't allow bare combinators at the beginning, if we
> allow complex selectors.  It's rather confusing to resolve properly.
>    
Yeah, if using :matches() for subrules instead of grouping this gets 
obvious. ">div" isn't a valid selector (is it?)

But if using the element really for matching subrules, not grouping, the 
resolution to simple rules gets impossible. Consider:
.aclass (form > input, ...)
This cannot be resolved in
.aclass form > input
because" aclass" could be assigned to a form and we would therefore end 
up with
form form > input
instead of
form > input

With grouping resolution is unambiguous.
Received on Friday, 8 January 2010 21:14:51 GMT

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