aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2018-09-29 06:20:20 +0100
committerGitHub2018-09-29 06:20:20 +0100
commite49d9b47e6c4978a0f034acfc529111fbf387b1b (patch)
tree9065e2ce177ffc41fba179006bfe5987e7367671
parentf2ab8bee6e1fa8d9b34837c934e6b8ec0cb7abc9 (diff)
parent117dd20cc60030d79bc79d793ff3de4ea5514ad1 (diff)
downloadvimium-e49d9b47e6c4978a0f034acfc529111fbf387b1b.tar.bz2
Merge pull request #3111 from gdh1995/use-scroll-by
use Element::scrollBy if it exists
-rw-r--r--content_scripts/scroller.coffee7
1 files changed, 6 insertions, 1 deletions
diff --git a/content_scripts/scroller.coffee b/content_scripts/scroller.coffee
index 94a0d4f1..36bbb671 100644
--- a/content_scripts/scroller.coffee
+++ b/content_scripts/scroller.coffee
@@ -56,7 +56,12 @@ getDimension = (el, direction, amount) ->
performScroll = (element, direction, amount) ->
axisName = scrollProperties[direction].axisName
before = element[axisName]
- element[axisName] += amount
+ if typeof element.scrollBy is "function"
+ scrollArg = behavior: "instant"
+ scrollArg[if axisName is "x" then "left" else "top"] = amount
+ element.scrollBy scrollArg
+ else
+ element[axisName] += amount
element[axisName] != before
# Test whether `element` should be scrolled. E.g. hidden elements should not be scrolled.