From ed2a46b22e9c2a03392127bb9a85f67b88d790cc Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Mon, 7 Sep 2015 00:53:36 +0100 Subject: Traverse shadow DOMs when looking for scrollable elements --- lib/dom_utils.coffee | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib') 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 element, the 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 -- cgit v1.2.3