aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dom_utils.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-09-07 06:43:04 +0100
committerStephen Blott2015-09-07 06:43:04 +0100
commit6f0b85dfe4b06c74cb980de9911149b4d0122585 (patch)
treecfdf5614a9ca929b76d98f1afc26c2abeac1f1e8 /lib/dom_utils.coffee
parentd425d5c542c0883c078c0818fb4b567c8f57e7ff (diff)
parented2a46b22e9c2a03392127bb9a85f67b88d790cc (diff)
downloadvimium-6f0b85dfe4b06c74cb980de9911149b4d0122585.tar.bz2
Merge pull request #1803 from mrmr1993/scroll-in-shadow-dom
Fix scrolling for webpages using web components
Diffstat (limited to 'lib/dom_utils.coffee')
-rw-r--r--lib/dom_utils.coffee6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee
index ad88deae..ee7d415f 100644
--- a/lib/dom_utils.coffee
+++ b/lib/dom_utils.coffee
@@ -370,5 +370,11 @@ DomUtils =
text
texts.join " "
+ # Get the element in the DOM hierachy that contains `element`.
+ # If the element is rendered in a shadow DOM via a <content> element, the <content> element will be
+ # returned, so the shadow DOM is traversed rather than passed over.
+ getContainingElement: (element) ->
+ element.getDestinationInsertionPoints()[0] or element.parentElement
+
root = exports ? window
root.DomUtils = DomUtils