From 3ed5da882fca774cf2fb25dfc4ea96ff10f2d442 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Wed, 20 May 2015 12:33:44 +0200 Subject: [PATCH] Element: 'fix' mousewheel event before modifying it In strict mode (in recent browsers), modifying deltaX on a WheelEvent throws an exception: Uncaught TypeError: Cannot set property deltaX of # which has only a getter In non-strict mode or older browsers, assigning to deltaX is just a no-op. https://github.com/jquery/jquery-mousewheel/blob/master/jquery.mousewheel.js is cited in this function; it uses $.event.fix() to make a mutable jQuery.Event-flavoured copy of the native event before modifying its properties. Let's do the same. Fixes #2751 --- source/UI/js/Core/Element.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/UI/js/Core/Element.js b/source/UI/js/Core/Element.js index f10b8d1f..0c6d089c 100644 --- a/source/UI/js/Core/Element.js +++ b/source/UI/js/Core/Element.js @@ -304,7 +304,7 @@ if (!self._deltaFactor || self._deltaFactor > absDelta) { self._deltaFactor = absDelta; } - that.triggerEvent('mousewheel', Ox.extend(e, { + that.triggerEvent('mousewheel', Ox.extend($.event.fix(e), { deltaFactor: self._deltaFactor, deltaX: Ox.trunc(deltaX / self._deltaFactor), deltaY: Ox.trunc(deltaY / self._deltaFactor)