Re: [css3-selectors] Grouping

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

> On Fri, Jan 8, 2010 at 12:19 PM, Nikita Popov <privat@ni-po.com> wrote:
>> I have yet another question about the exact syntax of the pseudo-class:
>> Could I for example use this rule
>> .page form:any(> input, label select)
>> to match all input elements, that are direct descendants of forms or selects
>> what are contained in a label?
>> (At least it would make sense, if allowing the attribute selectors in
>> :any())
> 
> Hmm, that's interesting.  You want a space between the form and :any,
> since this isn't a pseudoclass for the form. (That is, you're not
> trying to match the form.)

See?It's not just me.

> It's still just syntax sugar for ".page form > input, .page form label
> select",

Wouldn't making it a pseudo-class mean that the specificity of the rule might be different (in general; I didn't calculate for this particular example)? If so, that is more than just syntax sugar.

> so I don't see any technical problems with it.  I don't know
> if we want to allow a naked combinator at the front like that, though.
> You could avoid that with:
> 
> .page form :any(form > input, label select) {}

Yeah, unless the "form" part was important (due to an id, for instance):

.page form :any(form#myform > input, form#myform label select) {}

That's back to repeating, so you'd want to be able to do it the other way:

.page form#myform :any(> input, label select)

Received on Friday, 8 January 2010 18:41:05 UTC