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

Re: [selectors] css4 focus-within

From: Florian Rivoal <florian@rivoal.net>
Date: Wed, 7 Jan 2015 11:01:02 +0100
Cc: James Craig <jcraig@apple.com>, Fred Esch <fesch@us.ibm.com>, W3C WAI Protocols & Formats <public-pfwg@w3.org>, www-style list <www-style@w3.org>
Message-Id: <BC633519-3E6E-4CA9-A242-7311ED1F4626@rivoal.net>
To: Bruno Racineux <bruno@hexanet.net>

> On 07 Jan 2015, at 10:48, Bruno Racineux <bruno@hexanet.net> wrote:
> 
>> On 1/6/15 2:09 PM, "Florian Rivoal" <florian@rivoal.net> wrote:
>> 
>>> 
>>> So you'd write *:has( *:focus ) {}
>>> 
>>> 1) :has() is not part of the "fast profile" [2], meaning :has is not
>>> available for CSS selection, only for things like query() method, so it
>>> cannot be used here
>> 
> 
> Are you saying we can't do: parent:has( child:focus ) {}?

Correct, you can't do that in CSS, which is (one of the reasons) why we introduced "parent:focus-within {...}"

> Could you elaborate with a few examples on what can be done and what can't?
> [...]
> Not sure what you mean entirely by "not available for CSS selection".

Selectors are primarily used in CSS, but not only. For example they are also used in http://www.w3.org/TR/dom/ for the querySelector() and querySelectorAll() javascript methods. In that context, :has is defined to do what you expect. However, for performance reasons, the WG has decided that :has cannot be supported in selectors used in CSS.

 - Florian
Received on Wednesday, 7 January 2015 10:01:27 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:50 UTC