84f1b7c05ee5a22028c699346232ff7d617f0333729e01247e573e6156e3d183.json raw

   1  {"ast":null,"code":"import { isShadowRoot } from \"./instanceOf.js\";\nexport default function contains(parent, child) {\n  var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method\n\n  if (parent.contains(child)) {\n    return true;\n  } // then fallback to custom implementation with Shadow DOM support\n  else if (rootNode && isShadowRoot(rootNode)) {\n    var next = child;\n    do {\n      if (next && parent.isSameNode(next)) {\n        return true;\n      } // $FlowFixMe[prop-missing]: need a better way to handle this...\n\n      next = next.parentNode || next.host;\n    } while (next);\n  } // Give up, the result is false\n\n  return false;\n}","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}