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

Re: [css4-selectors] Focused descendant pseudo class

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 26 Jan 2012 15:53:17 -0800
Message-ID: <CAAWBYDDS1_YQhh5ukrjPsz0eW5GDKqJtZxHriovqniAdzS4X9Q@mail.gmail.com>
To: brice.parent@websailors.fr
Cc: www-style@w3.org
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 Thursday, 26 January 2012 23:54:06 GMT

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