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

Re: [css3-selectors] Grouping

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Fri, 8 Jan 2010 13:34:19 -0600
Message-ID: <dd0fbad1001081134g7310b42cj3b6b5e63a35e6be6@mail.gmail.com>
To: Nikita Popov <privat@ni-po.com>
Cc: www-style list <www-style@w3.org>
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 GMT

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