[csswg-drafts] [css-selectors] Nearest descendant selector (#4940)

radogado has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-selectors] Nearest descendant selector ==
Hello, I would like to have a selector for the closest child only, which isn't a direct descendant of the container. It is useful for a carousel with a child (e.g. holding controls) and nested carousels, which shouldn't inherit the styles of the topmost one, while allowing for extra wrappers or supporting cases where we don't fully control the HTML structure.

**.wrapper ^ .child** to select only the first **.child**:

```
<div class="wrapper">
    <div>
        <div class="child"> </div>
    </div>
    <div>
        <div>
            <div class="child"> </div>
        </div>
    </div>
</div>
```

This has been requested by others before on SO. Thanks.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4940 using your GitHub account

Received on Friday, 10 April 2020 06:12:48 UTC