aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/unit/button/button_tickets.js11
-rw-r--r--ui/jquery.ui.button.js7
2 files changed, 15 insertions, 3 deletions
diff --git a/tests/unit/button/button_tickets.js b/tests/unit/button/button_tickets.js
index eb70181ec..1e901f9d1 100644
--- a/tests/unit/button/button_tickets.js
+++ b/tests/unit/button/button_tickets.js
@@ -5,6 +5,17 @@
module( "button: tickets" );
+test( "#5295 - button does not remove hoverstate if disabled" , function() {
+ expect( 1 );
+ var btn = $("#button").button();
+ btn.hover( function() {
+ btn.button( "disable" );
+ });
+ btn.trigger( "mouseenter" );
+ btn.trigger( "mouseleave" );
+ ok( !btn.is( ".ui-state-hover") );
+});
+
test( "#5946 - buttonset should ignore buttons that are not :visible", function() {
expect( 2 );
$( "#radio01" ).next().andSelf().hide();
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 ) {