r3304 committed - Buttons: syntax cleanup.
Revision: 3304
Author: scott.gonzalez
Date: Sat Sep 26 07:01:23 2009
Log: Buttons: syntax cleanup.
http://code.google.com/p/jquery-ui/source/detail?r=3304
Modified:
/branches/dev/ui/jquery.ui.button.js
=======================================
--- /branches/dev/ui/jquery.ui.button.js Sat Sep 26 04:18:00 2009
+++ /branches/dev/ui/jquery.ui.button.js Sat Sep 26 07:01:23 2009
@@ -15,31 +15,33 @@
$.widget("ui.button", {
_init: function() {
var self = this;
- this.element.addClass("ui-button ui-widget ui-state-default
ui-corner-all").bind("mouseenter.button", function() {
- if (self.options.disabled)
- return;
- $(this).addClass("ui-state-hover");
- }).bind("mouseleave.button", function(){
- if (self.options.disabled)
- return;
- $(this).removeClass("ui-state-hover ui-state-active");
- }).bind("mousedown.button mouseup.button", function() {
- if (self.options.disabled)
- return;
- $(this).toggleClass("ui-state-active");
- }).bind("click", function(event) {
- if (self.options.disabled) {
- // this works only when .button() is called before .click(), not that
useful
- // also, should we instead offer a click option, and leave the native
click alone?
- event.stopImmediatePropagation();
- }
- });
+ this.element
+ .addClass("ui-button ui-widget ui-state-default ui-corner-all")
+ .bind("mouseenter.button", function() {
+ if (self.options.disabled) { return; }
+ $(this).addClass("ui-state-hover");
+ })
+ .bind("mouseleave.button", function() {
+ if (self.options.disabled) { return; }
+ $(this).removeClass("ui-state-hover ui-state-active");
+ })
+ .bind("mousedown.button mouseup.button", function() {
+ if (self.options.disabled) { return; }
+ $(this).toggleClass("ui-state-active");
+ })
+ .bind("click", function(event) {
+ if (self.options.disabled) {
+ // this works only when .button() is called before .click(), not that
useful
+ // also, should we instead offer a click option, and leave the native
click alone?
+ event.stopImmediatePropagation();
+ }
+ });
},
destroy: function() {
this.element
- .removeClass("ui-button ui-widget ui-state-default ui-corner-all
ui-state-hover ui-state-focus")
- .unbind(".button");
+ .removeClass("ui-button ui-widget ui-state-default ui-corner-all
ui-state-hover ui-state-focus")
+ .unbind(".button");
$.widget.prototype.destroy.apply(this, arguments);
}
});