diff options
author | Cory Gackenheimer <cory.gack@gmail.com> | 2012-01-01 11:44:22 -0500 |
---|---|---|
committer | Mike Sherov <mike.sherov@gmail.com> | 2012-11-11 21:17:05 -0500 |
commit | 8e1ceba717b85e42a13cc1660e7c8e9e9c26c384 (patch) | |
tree | a91874c66241536b40410a4ada76d573fddf2045 /ui/jquery.ui.button.js | |
parent | 11687e44dc311746f3776f86dff6a6f68c573c8c (diff) | |
download | jquery-ui-8e1ceba717b85e42a13cc1660e7c8e9e9c26c384.tar.gz jquery-ui-8e1ceba717b85e42a13cc1660e7c8e9e9c26c384.zip |
Button: use _hoverable for hover state management. Fixes #5295 - button doesn't remove hover state if they are disabled
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 6d7b94a38..db04b63b8 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 ) { |