Re: [css3-selectors] Grouping

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 UTC