From 7a2eef7bfd5cf13c8ce8f54403e3394a45674b3e Mon Sep 17 00:00:00 2001 From: Jason Spangler Date: Tue, 22 Sep 2020 14:31:16 -0400 Subject: [PATCH] Fixes check for root node --- src/dom-utils/contains.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/dom-utils/contains.js b/src/dom-utils/contains.js index 0076404a24..39687833a8 100644 --- a/src/dom-utils/contains.js +++ b/src/dom-utils/contains.js @@ -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)) {