From 48f060ac25a805f8070a3ec5daf8be8e56d2b60b Mon Sep 17 00:00:00 2001 From: jzaefferer Date: Sat, 26 Feb 2011 12:10:52 +0100 Subject: [PATCH] Spinner: Ignore delta of 0 from triggered mousewheel event. Verified that mousewheel scrolling actually works fine in IE6. --- tests/unit/spinner/spinner_core.js | 5 +++-- ui/jquery.ui.spinner.js | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/unit/spinner/spinner_core.js b/tests/unit/spinner/spinner_core.js index df2243adc..19bdb3495 100644 --- a/tests/unit/spinner/spinner_core.js +++ b/tests/unit/spinner/spinner_core.js @@ -120,14 +120,15 @@ test("mouse click on buttons", function() { }); test("mouse wheel on input", function() { - expect(3); + expect(4); + stop(); var el = $("#spin").spinner(); + equal(el.val(), 0); el.trigger("mousewheel", 1); equal(el.val(), 1); // mousewheel handler uses a timeout, need to accomodate that - stop(); setTimeout(function() { el.trigger("mousewheel", -1); equal(el.val(), 0); diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js index 9dd0afe9b..ae7583eec 100644 --- a/ui/jquery.ui.spinner.js +++ b/ui/jquery.ui.spinner.js @@ -181,12 +181,13 @@ $.widget('ui.spinner', { } var self = this; this.element.bind("mousewheel.spinner", function(event, delta) { - if (self.options.disabled) { + if (self.options.disabled || !delta) { return; } if (!self.spinning && !self._start(event)) { return false; } + $("
").text("delta: " + delta).appendTo(document.body) self._spin((delta > 0 ? 1 : -1) * self.options.step, event); clearTimeout(self.timeout); self.timeout = setTimeout(function() { -- 2.39.5