Testcase for jQuery Ticket 3976
.not() vs :not()
by jitter
HTML
<div>
<div>
<div>
<p>paragraph surrounded by three divs</p>
</div>
</div>
</div>
<fieldset>
<div>
div surrounded by fieldset
</div>
</fieldset>
CSS
div, fieldset, p {
border: 1px solid silver;
padding: 20px;
margin: 20px;
}
.wrappedElement {
border: 2px solid #FF0000;
}
JavaScript
$('body :not(div:has(div))').addClass('wrappedElement');
//$('body *:not(div:has(div))').addClass('wrappedElement');
//$('body *').filter(':not(div:has(div))').addClass('wrappedElement');
//$('body *').not('div:has(div)').addClass('wrappedElement');