如何制作一个 jQuery 选择器来选择类名为“foo”的所有元素,除了那些只有类名为“bar”的子元素的元素。
<!-- Don't select this -->
<div class="foo">
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
</div>
<!-- Don't select this -->
<div class="foo">
<div class="bar"><p>Some text</p></div>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"><p>Some text</p></div>
<div class="bar"></div>
</div>
<!-- Select this -->
<div class="foo">
<p>Some text</p>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
<div class="bar"></div>
</div>
<!-- Select this -->
<div class="foo">
<p>Some text</p>
</div>