From 38caf47592f37cfec6fbb8c2f6220df8ccc1025c Mon Sep 17 00:00:00 2001 From: Steven Hoffman Date: Thu, 10 Dec 2020 14:30:52 -0800 Subject: [PATCH] fix: getOwnerDocument(elementFromTemplate) (#871) Signed-off-by: Steven Hoffman --- src/dom-utils.ts | 4 +++- test/unit/dom-utils.test.js | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/dom-utils.ts b/src/dom-utils.ts index 480d80a5d..59457d0f9 100644 --- a/src/dom-utils.ts +++ b/src/dom-utils.ts @@ -64,7 +64,9 @@ export function getOwnerDocument( elementOrElements: Element | Element[] ): Document { const [element] = normalizeToArray(elementOrElements); - return element ? element.ownerDocument || document : document; + + // Elements created via a