From 80457624cc756cc042c076dc4e508201d99ced2d Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Mon, 6 Jan 2014 16:02:35 -0800 Subject: [PATCH] Make sure a valid ShadowRoot or Document is returned from target.owner Fixes #115 --- src/boot.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/boot.js b/src/boot.js index 54d4f949..5b2fbecf 100644 --- a/src/boot.js +++ b/src/boot.js @@ -68,6 +68,10 @@ while (s.parentNode) { s = s.parentNode; } + // the owner element is expected to be a Document or ShadowRoot + if (s.nodeType != Node.DOCUMENT_NODE && s.nodeType != Node.DOCUMENT_FRAGMENT_NODE) { + s = document; + } return s; }, findTarget: function(inEvent) {