aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts
diff options
context:
space:
mode:
authormrmr19932017-11-14 11:31:11 +0000
committermrmr19932017-11-14 11:45:55 +0000
commitde0c06e180690a0101b4dda92e3164fa198485fd (patch)
treef3ee54fe016090f66bbfb9cc9e7313f8c976c853 /content_scripts
parent1880062f68e6f4280b7257f3cd437c0aee7c9696 (diff)
downloadvimium-de0c06e180690a0101b4dda92e3164fa198485fd.tar.bz2
Start searching for scrollable elements from <body> whenever possible
Diffstat (limited to 'content_scripts')
-rw-r--r--content_scripts/scroller.coffee9
1 files changed, 8 insertions, 1 deletions
diff --git a/content_scripts/scroller.coffee b/content_scripts/scroller.coffee
index 4a6c7edf..e2e05722 100644
--- a/content_scripts/scroller.coffee
+++ b/content_scripts/scroller.coffee
@@ -95,7 +95,14 @@ findScrollableElement = (element, direction, amount, factor) ->
# On some pages, the scrolling element is not actually scrollable. Here, we search the document for the
# largest visible element which does scroll vertically. This is used to initialize activatedElement. See
# #1358.
-firstScrollableElement = (element=getScrollingElement()) ->
+firstScrollableElement = (element) ->
+ unless element
+ scrollingElement = getScrollingElement()
+ if doesScroll(scrollingElement, "y", 1, 1) or doesScroll(scrollingElement, "y", -1, 1)
+ return scrollingElement
+ else
+ element = document.body ? getScrollingElement()
+
if doesScroll(element, "y", 1, 1) or doesScroll(element, "y", -1, 1)
element
else