I am trying to use css3's :not()
selector to select certain elements that do not have a parent element with a certain class anywhere as its ancestor.
The mark up is simple:
<div><strong><em>Please select me!</em></strong></div>
<div><strong><p><em>Please don't select me!</em></p></strong></div>
<div><p><em>Please don't select me!</em></p></div>
And this is the selector I am using: div *:not(p) em
.
And a fiddle: http://jsfiddle.net/cwxzH/
Why is the second div
being selected if I am filtering out all children of the div
that are paragraphs
? Is there anyway to prevent this?
I have only tested in IE9 and FF13 so far.