Sometimes we want to select elements with known child, we can use :has() selector, but no browser support now. (just check can i use :has() - https://caniuse.com/?search=%3Ahas())
However, we can use jQuery to select these elements by :has() like $("div:has(span.red)").
There is an example to show how it works:
$("div:has(span.red)").append("<p>this paragraph was added by jquery</p>");
jQuery is support the :has() pseudo-class just a draft on W3C:
After the draft turning into specification we can use :has(), maybe css 4.