Re: [csswg-drafts] [css-selectors] has-child selector (#4903)

I am an infrequent user of css. However, today, I came across the need to select all ancestors of an element.

It would have been nice to have had a css selector to identify all ancestors of a given element to use in conjunction with javascript's querySelectorAll()

It is easy to find all the descendants of an element using *. It feels like it should be as easy to find all parents.

As is, I had to use something like this

https://gomakethings.com/how-to-get-all-parent-elements-with-vanilla-javascript/

or like this

https://stackoverflow.com/questions/8729193/how-to-get-all-parent-nodes-of-given-element-in-pure-javascript

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 21 December 2020 17:49:28 UTC