r3355 committed - Button: Tweaked for variable munging.
Revision: 3355
Author: scott.gonzalez
Date: Thu Oct 1 18:04:49 2009
Log: Button: Tweaked for variable munging.
http://code.google.com/p/jquery-ui/source/detail?r=3355
Modified:
/branches/dev/ui/jquery.ui.button.js
=======================================
--- /branches/dev/ui/jquery.ui.button.js Thu Oct 1 17:10:51 2009
+++ /branches/dev/ui/jquery.ui.button.js Thu Oct 1 18:04:49 2009
@@ -12,31 +12,34 @@
*/
(function($) {
-var lastActive;
+var lastActive,
+ baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
+ otherClasses = "ui-state-hover ui-state-focus " +
+ "ui-button-icons-only ui-button-icon-only ui-button-text-icons
ui-button-text-icon";
$.widget("ui.button", {
_init: function() {
- var self = this;
-
- if (this.options.label === null) {
- this.options.label = this.element.html();
+ var options = this.options;
+
+ if (options.label === null) {
+ options.label = this.element.html();
}
this.element
- .addClass("ui-button ui-widget ui-state-default ui-corner-all")
+ .addClass(baseClasses)
.bind("mouseenter.button", function() {
- if (self.options.disabled) { return; }
+ if (options.disabled) { return; }
$(this).addClass("ui-state-hover");
if (this == lastActive) {
$(this).addClass("ui-state-active");
}
})
.bind("mouseleave.button", function() {
- if (self.options.disabled) { return; }
+ if (options.disabled) { return; }
$(this).removeClass("ui-state-hover ui-state-active");
})
.bind("mousedown.button", function() {
- if (self.options.disabled) { return; }
+ if (options.disabled) { return; }
$(this).addClass("ui-state-active");
lastActive = this;
$(document).one('mouseup', function() {
@@ -44,7 +47,7 @@
});
})
.bind("mouseup.button", function() {
- if (self.options.disabled) { return; }
+ if (options.disabled) { return; }
$(this).removeClass("ui-state-active");
});
@@ -54,7 +57,7 @@
destroy: function() {
this.element.html(this.element.find(".ui-button-text").html());
this.element
- .removeClass("ui-button ui-widget ui-state-default ui-corner-all
ui-state-hover ui-state-focus ui-button-icons-only ui-button-icon-only
ui-button-text-icons ui-button-text-icon")
+ .removeClass(baseClasses + " " + otherClasses)
.unbind(".button");
$.widget.prototype.destroy.call(this);
},