r3310 committed - button: reactive when mouseout and back in; workaround not optimal (bi...
Revision: 3310
Author: joern.zaefferer
Date: Mon Sep 28 09:47:28 2009
Log: button: reactive when mouseout and back in; workaround not optimal
(bind to document event)
http://code.google.com/p/jquery-ui/source/detail?r=3310
Modified:
/branches/dev/ui/jquery.ui.button.js
=======================================
--- /branches/dev/ui/jquery.ui.button.js Sat Sep 26 18:53:49 2009
+++ /branches/dev/ui/jquery.ui.button.js Mon Sep 28 09:47:28 2009
@@ -20,9 +20,12 @@
.bind("mouseenter.button", function() {
if (self.options.disabled) { return; }
$(this).addClass("ui-state-hover");
+ if (self.wasactive)
+ $(this).addClass("ui-state-active");
})
.bind("mouseleave.button", function() {
if (self.options.disabled) { return; }
+ self.wasactive = $(this).hasClass("ui-state-active");
$(this).removeClass("ui-state-hover ui-state-active");
})
.bind("mousedown.button mouseup.button", function() {
@@ -36,6 +39,11 @@
event.stopImmediatePropagation();
}
});
+ // need to capture mouseup event outside a button, in case of
mousedown-mouseleave-mouseup
+ // would be nice to replace this with something less obtrusive
+ $().bind("mouseup.button", function() {
+ self.wasactive = false;
+ })
},
destroy: function() {