src/util/dom.js
// Check whether a DOM node is an ancestor of another DOM node.
Check whether a DOM node is an ancestor of another DOM node.
Check whether a DOM node is an ancestor of another DOM node .
function contains(parent, child) {
  if (child.nodeType != 1)
    child = child.parentNode
  return child && parent.contains(child)
}
function contains ( parent , child ) { if ( child . nodeType != 1 ) child = child . parentNode return child && parent . contains ( child ) }
Check whether a DOM node is an ancestor of another DOM node.
Check whether a DOM node is an ancestor of another DOM node .
// Android browser and IE will return false if child is a text node.