W3C home > Mailing lists > Public > www-style@w3.org > September 2016

Re: [css3-selectors]: Proposal: Reverse Descendant selector

From: Joshua Baker <jtbaker@jtbaker.name>
Date: Mon, 19 Sep 2016 11:11:02 -0700
Message-ID: <CAMrnN-jVjnQacPe9qRG+H7VemyOzWyZgGbpnEQOGNkzX_kZ1OQ@mail.gmail.com>
To: Axel Dahmen <brille1@hotmail.com>
Cc: www-style@w3.org
This functionality is in development in Selectors Level 4, under the ":has"
pseudo-class <https://drafts.csswg.org/selectors-4/#relational>.

On Mon, Sep 19, 2016 at 10:38 AM, Axel Dahmen <brille1@hotmail.com> wrote:

> AFAIK, there is no way to create a selector matching an element whose
> descendant properties match certain criteria. E.g. you cannot apply CSS
> rules to a <div> element provided it's containing an <a> element having
> focus.
>
> I suggest to use the "<" (less than) token for such reverse descendant
> selector:
>
> --------------------
>
> body > div < a:focus
> {
>   border: 1px solid red;
>   background-color: yellow;
> }
>
> --------------------
>
> <body>
>   <div comment="this is where above rules get applied if <a> has focus">
>     <span></span>
>     <a></a>
>     <span></span>
>   </div>
> </body>
>
> --------------------
>
> Your thoughts?
>
> Axel Dahmen
>
>
>
Received on Monday, 19 September 2016 18:12:13 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:09:04 UTC