From 8dede92faf05b6d364cad2ca28eab492a9e37e5a Mon Sep 17 00:00:00 2001 From: richardcpeterson Date: Thu, 1 Dec 2011 12:51:44 -0500 Subject: [PATCH] Fix double click bug Before, when the user would click an item twice before the item finished animating, two click events would be fired, causing extra elements to be added to the other list. To reproduce this bug, set animation to "slow", and double click an item. Now, we use the jQuery "one" function to register the click handlers, ensuring that events only fire once per element. Since the elements are discarded and not reused, this doesn't present any problems, and fixes the bug. --- js/ui.multiselect.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/ui.multiselect.js b/js/ui.multiselect.js index 1234fa7..da1622d 100755 --- a/js/ui.multiselect.js +++ b/js/ui.multiselect.js @@ -272,7 +272,7 @@ $.widget("ui.multiselect", { }, _registerAddEvents: function(elements) { var that = this; - elements.click(function() { + elements.one("click",function() { var item = that._setSelected($(this).parent(), true); that.count += 1; that._updateCount(); @@ -298,7 +298,7 @@ $.widget("ui.multiselect", { }, _registerRemoveEvents: function(elements) { var that = this; - elements.click(function() { + elements.one("click",function() { that._setSelected($(this).parent(), false); that.count -= 1; that._updateCount();