Will :has() make it to your reference?
It’s still behind a flag in Firefox, but the other modern browser are ready for using it:
See: https://caniuse.com/?search=has
Definitely adding it soon!