CSS: How to style parent when parent contains specific child?
===

I have some html that looks like this:

    <div id="parent">
      <div id="child"></div>
    </div>

I want to apply a default background color to `#parent` except for when it contains a `#child`.

So the CSS should end up looking something like this:

    #parent {
      background: red
    }
    #parent:contains(#child) {
      background: none
    }

However, I can't get the `:contains` pseudo selector to work that way. Is there a way to achieve this?