function containsDeep(parent, child) {
  var node = child;
  while (node) {
    if (node == parent) return true;

    node = getParentNode(node);
  }
  return false;
}
Checks to see if a parent element contains a child elemnt (including inside
shadow DOM).
@param {Node} parent The parent element.
@param {Node} child The child element.
@return {boolean} True if the parent node contains the child node.