diff options
author | Richard Worth <rdworth@gmail.com> | 2010-03-17 13:07:46 +0000 |
---|---|---|
committer | Richard Worth <rdworth@gmail.com> | 2010-03-17 13:07:46 +0000 |
commit | 2a8271c7016be902aed15cd2ccadc23164159a8d (patch) | |
tree | d05aff7e21b7de307ededad19c66ab2a3f6adab9 /ui/jquery.ui.button.js | |
parent | 124f84635f8f17a0af5085f64466050d1b0e263b (diff) | |
download | jquery-ui-2a8271c7016be902aed15cd2ccadc23164159a8d.tar.gz jquery-ui-2a8271c7016be902aed15cd2ccadc23164159a8d.zip |
Button: Added refresh method to buttonset, futher fixes #5278 - ui.buttons doesn't visually reset on form "reset" event or input "change" event
Diffstat (limited to 'ui/jquery.ui.button.js')
-rw-r--r-- | ui/jquery.ui.button.js | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index bb9aa4802..be0af7ecd 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -312,12 +312,33 @@ $.widget( "ui.button", { $.widget( "ui.buttonset", { _create: function() { this.element.addClass( "ui-button-set" ); + this._init(); + }, + + _init: function() { + this.refresh(); + }, + + _setOption: function( key, value ) { + if ( key === "disabled" ) { + this.buttons.button( "option", key, value ); + } + + $.Widget.prototype._setOption.apply( this, arguments ); + }, + + refresh: function() { this.buttons = this.element.find( ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" ) - .button() + .filter( ":ui-button" ) + .button( "refresh" ) + .end() + .not( ":ui-button" ) + .button() + .end() .map(function() { return $( this ).button( "widget" )[ 0 ]; }) - .removeClass( "ui-corner-all" ) + .removeClass( "ui-corner-all ui-corner-left ui-corner-right" ) .filter( ":first" ) .addClass( "ui-corner-left" ) .end() @@ -327,14 +348,6 @@ $.widget( "ui.buttonset", { .end(); }, - _setOption: function( key, value ) { - if ( key === "disabled" ) { - this.buttons.button( "option", key, value ); - } - - $.Widget.prototype._setOption.apply( this, arguments ); - }, - destroy: function() { this.element.removeClass( "ui-button-set" ); this.buttons |