Having this html:
<div><h1>1</h1></div>
<div>2</div>
<div><h1>3</h1></div>
This is returning 0:
$("div").filter(":not(:not(:has(h1)))").length
I’ve made some testing here and the first two selectors are ok (without any filtering, and then just with one not).
This is a simpler model than my code. I really can’t avoid both not’s because one is added by a plugin and the other is being received in its options.
Don’t know why this is happening but it got fixed on version 1.8. Here is the same code with jQuery 1.8 working.
If you can’t change your version for some reason one workaround is changing the
.filterfor.not. Here it is working.