Does anyone know a good way to test if one element, stored in a var, is the descendant of another, also stored in a var?
I don't need element1.isChildOf('selector')
, that's easy.
I need element1.isChildOf(element2)
element2.find(element1).size() > 0
Does not seem to work.
I don't want to have to write a plugin the uses .each
to test each child if I can avoid it.