Using Node.contains() To Determine If One DOM Node Is Inside Another

This node is outside the red node.

This node is inside the red node.

As is this one!

This node is outside the red node.