CSS4 comes with :has. E.g. h1:has(b) would select all <h1> tags that contain a <b> tag.
:has
h1:has(b)
<h1>
<b>
This is implemented in no browser but the jQuery query engine already supports it as a custom extension.