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

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

== [css-selectors] has-child selector ==
Proposal: add a selector that matches an element if a direct child matches the selector in the function.

"all a elements that contain an img" -> `a:has-child(img)`

Motivation: [#2 missing-features request](https://2019.stateofcss.com/opinions/#missing-features) in the state-of-CSS 2019 survey.

Since it only matches direct children, it may be no more expensive than sibling selectors.

A related selector that was considered and removed as too expensive and slow (AIUI) is [:has](
https://drafts.csswg.org/selectors-4/#relational). See also resolution regarding it [here](https://github.com/w3c/csswg-drafts/issues/3925#issuecomment-492724267).

@tabatkins @lilles 

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

Received on Friday, 27 March 2020 02:58:37 UTC