Skip to content

Commit

Permalink
Fixes check for root node
Browse files Browse the repository at this point in the history
  • Loading branch information
jspangler committed Sep 22, 2020
1 parent 264e2f3 commit 7a2eef7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/dom-utils/contains.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// @flow
export default function contains(parent: Element, child: Element) {
// $FlowFixMe: hasOwnProperty doesn't seem to work in tests
const isShadow = Boolean(child.getRootNode && child.getRootNode().host);
const rootNode = child.getRootNode && child.getRootNode();
isShadow = Boolean(rootNode && rootNode.host);

// First, attempt with faster native method
if (parent.contains(child)) {
Expand Down

0 comments on commit 7a2eef7

Please sign in to comment.