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

> I donʼt fully understand the use case. It sounds like at least one of the following selectors should satisfy the constraints. Perhaps, a further `:not(…)` would be needed.
> 
> * `.wrapper > * > .child`
> * `.wrapper * > .child`
> * `.wrapper > * .child`
> * `.wrapper * .child`
> * `.wrapper > * > .child:first-child`
> * `.wrapper * > .child:first-child`
> * `.wrapper > * .child:first-child`
> * `.wrapper * .child:first-child`
> * `.wrapper > :first-child > .child`
> * `.wrapper :first-child > .child`
> * `.wrapper > :first-child .child`
> * `.wrapper :first-child .child`

It's not about specifying a strict structure like **.wrapper > * > .child** or the position between siblings (**:first-child**). Nearest descendant means if a **.wrapper** has a **.child** descendant on level 3 and level 4, we select the nearest level (3). I need it to freely nest any component inside any component without conflicts. Between the following 2 cases,

```
.wrapper div div .child
.wrapper div div div .child
```
I need the first one to be selected. Thanks.


-- 
GitHub Notification of comment by radogado
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/4940#issuecomment-612022086 using your GitHub account

Received on Friday, 10 April 2020 13:11:51 UTC