Button: Check for ui-state-disabled during refresh. Fixes #8237 - Button: Anchor tags cannot be disabled within buttonset.

This commit is contained in:
TJ VanToll 2012-10-16 13:20:55 -04:00 committed by Scott González
parent 8ce35198da
commit 5e24a1ce4b
2 changed files with 9 additions and 1 deletions

View File

@ -61,4 +61,12 @@ test( "#7534 - Button label selector works for ids with \":\"", function() {
ok( group.find( "label" ).is( ".ui-button" ), "Found an id with a :" ); ok( group.find( "label" ).is( ".ui-button" ), "Found an id with a :" );
}); });
test( "#8237 - Anchor tags lose disabled state when refreshed", function() {
expect( 1 );
var element = $( "<a id='a8237'></a>" ).appendTo( "#qunit-fixture" );
element.button({ disabled: true }).button( "refresh" );
ok( element.button( "option", "disabled" ), "Anchor button should remain disabled after refresh" );
});
})( jQuery ); })( jQuery );

View File

@ -282,7 +282,7 @@ $.widget( "ui.button", {
}, },
refresh: function() { refresh: function() {
var isDisabled = this.element.is( ":disabled" ); var isDisabled = this.element.is( ":disabled" ) || this.element.hasClass( "ui-button-disabled" );
if ( isDisabled !== this.options.disabled ) { if ( isDisabled !== this.options.disabled ) {
this._setOption( "disabled", isDisabled ); this._setOption( "disabled", isDisabled );
} }