I\'m trying to come up with a reusable JS or jQuery function that would allow me to test if one object is a DOM descendant of another.
I\'ve seen a model of testing
a.contains(b)
This is a pure JavaScript solution using Node.contains. The function is inclusive, a.contains(a) evaluates to true.
a.contains(a)
There's an edge case in IE9: if b is a text node, contains will always return false.
b
contains