Re: [css4-selectors] Focused descendant pseudo class

OK. But this makes it really hard to read!
It would be easier to have something like ":any(ancestor1
ancestor2,ancestor2 ancestor1) elem{}" or ":and(ancestor1, ancestor2)
elem{}"
Both solutions would avoid having on the same line 2 different ways of
writting equivalent contents, allowing anyone to understand it quickly!

Brice

Le 27/01/2012 00:53, Tab Atkins Jr. a écrit :
> On Thu, Jan 26, 2012 at 3:47 PM, Brice PARENT <brice@websailors.fr> wrote:
>> Even if we're talking about it, i was still taking the "!" for something
>> it shouldn't be...
>>
>> So, what's does the "!" adds? Shouldn't we have the simple
>> "form:matches(> input:focus) input[submit]{...}"?
>> We have "form input[submit]" which declares css properties, but only if
>> "form" (the element which has the :matches) also validates "form >
>> input:focus". It just requires to put the :matches on a common node,
>> which could be "body" for html, in the worst case.
>> Do anyone have a use case where it is needed to have the "!" later in
>> the parentheses?
> Yes.  Say you wanted to match an element based on the presence of two
> ancestors, but the two can occur in any order in the ancestor chain
> (they may be nestable widgets, for example).  You can do this with:
>
> "ancestor1 elem:matches(ancestor2 !)"
>
> This can be expressed without :matches, but it requires duplication:
> "ancestor1 ancestor2 elem, ancestor2 ancestor1 elem".
>
> ~TJ

Received on Friday, 27 January 2012 00:16:55 UTC