Re: [selectors] css4 focus-within

> 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