function containsNode(parent, child) {
  while (parent != child && child.parentNode) {
    child = child.parentNode;
  }
  return parent == child;
}
Determines whether one node is recursively contained in another.
@param parent The parent node.
@param child The node to look for in parent.
@return parent recursively contains child