diff options
author | Cory Gackenheimer <cory.gack@gmail.com> | 2012-01-01 11:44:22 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-11-13 11:06:55 -0500 |
commit | 85b5c5b5586af541291d52e5c52b9774e4ec2a22 (patch) | |
tree | 466904b00530938bd9534285068d621ffc2477e2 /ui/jquery.ui.button.js | |
parent | e27195ba443fd18e9a791fc926f226e5fc29f321 (diff) | |
download | jquery-ui-85b5c5b5586af541291d52e5c52b9774e4ec2a22.tar.gz jquery-ui-85b5c5b5586af541291d52e5c52b9774e4ec2a22.zip |
Button: use _hoverable for hover state management. Fixes #5295 - button doesn't remove hover state if they are disabled
(cherry picked from commit 8e1ceba717b85e42a13cc1660e7c8e9e9c26c384)
Diffstat (limited to 'ui/jquery.ui.button.js')
-rw-r--r-- | ui/jquery.ui.button.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index f253464df..6363bcdcb 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -70,13 +70,15 @@ $.widget( "ui.button", { var that = this, options = this.options, toggleButton = this.type === "checkbox" || this.type === "radio", - hoverClass = "ui-state-hover" + ( !toggleButton ? " ui-state-active" : "" ), + activeClass = !toggleButton ? "ui-state-active" : "", focusClass = "ui-state-focus"; if ( options.label === null ) { options.label = (this.type === "input" ? this.buttonElement.val() : this.buttonElement.html()); } + this._hoverable( this.buttonElement ); + this.buttonElement .addClass( baseClasses ) .attr( "role", "button" ) @@ -84,7 +86,6 @@ $.widget( "ui.button", { if ( options.disabled ) { return; } - $( this ).addClass( "ui-state-hover" ); if ( this === lastActive ) { $( this ).addClass( "ui-state-active" ); } @@ -93,7 +94,7 @@ $.widget( "ui.button", { if ( options.disabled ) { return; } - $( this ).removeClass( hoverClass ); + $( this ).removeClass( activeClass ); }) .bind( "click" + this.eventNamespace, function( event ) { if ( options.disabled ) { |