I can’t figure this one out, and I may be making it harder than it is.
I need to select all DOMS with class ‘B’, whose parent, ‘A’, does not contain class ‘C’ in any generation, and ‘C’ is NOT a sibling of ‘B’
Example:
We would not select B if
A => ({B}, {D => ({C})})
Because B’s parent, A, also contains D, and D contains C.
However, we would select B if
A => ({B}, {D => ({})})
Because B’s parent, A, does contain D, but C is nowhere in this particular tree under A.
I’ve tried:
$('.B').not($(this).parent('.A').find('.C'))
But the not statement here actually selects the ‘C’, and excludes C itself from the array of B. I also tried has instead of find, but that not only selects the parent A for exclusion, but I believe has only scans through one generation.
Any help or guidance would be appreciated.
You’re on the right track with what you have there, when you’re calling
not,thisis not.Bthough. You need to passnota function.