diff options
author | Mark Otto <markdotto@gmail.com> | 2018-12-16 02:13:22 +0300 |
---|---|---|
committer | XhmikosR <xhmikosr@gmail.com> | 2018-12-16 02:33:05 +0300 |
commit | ee72e7838df71e28825480e44b278453e092a64c (patch) | |
tree | 9fb6ff638b1c86df8ef7125c0cb76215fdf9736e /js/dist/util.js | |
parent | ffd3402a923b19754b4735803f9f9580bc1c38a5 (diff) |
dist
Diffstat (limited to 'js/dist/util.js')
-rw-r--r-- | js/dist/util.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/js/dist/util.js b/js/dist/util.js index d7c717ee51..baac0ff817 100644 --- a/js/dist/util.js +++ b/js/dist/util.js @@ -136,6 +136,28 @@ } } } + }, + findShadowRoot: function findShadowRoot(element) { + if (!document.documentElement.attachShadow) { + return null; + } // Can find the shadow root otherwise it'll return the document + + + if (typeof element.getRootNode === 'function') { + var root = element.getRootNode(); + return root instanceof ShadowRoot ? root : null; + } + + if (element instanceof ShadowRoot) { + return element; + } // when we don't find a shadow root + + + if (!element.parentNode) { + return null; + } + + return Util.findShadowRoot(element.parentNode); } }; setTransitionEndSupport(); |