Re: [css3-selectors] Grouping

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)

Should be in english as "Any (input that's a child of a form) or
(select that's a descendant of a label), in a form, in an element with
class=page.  (Parens added for disambiguation - English doesn't handle
arbitrary nesting well.)

> 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.

> I think this pseudo-class stuff isn't as easy as it looks with complex
> selectors.

Complex selectors are never easy, and it just gets worse when you
break from the simple descent of a standard selector and start
allowing more arbitrary nesting.  ^_^

~TJ

Received on Friday, 8 January 2010 19:34:47 UTC