mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Button: Added refresh method to buttonset, futher fixes #5278 - ui.buttons doesn't visually reset on form "reset" event or input "change" event
This commit is contained in:
parent
124f84635f
commit
2a8271c701
39
ui/jquery.ui.button.js
vendored
39
ui/jquery.ui.button.js
vendored
@ -312,19 +312,11 @@ $.widget( "ui.button", {
|
||||
$.widget( "ui.buttonset", {
|
||||
_create: function() {
|
||||
this.element.addClass( "ui-button-set" );
|
||||
this.buttons = this.element.find( ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" )
|
||||
.button()
|
||||
.map(function() {
|
||||
return $( this ).button( "widget" )[ 0 ];
|
||||
})
|
||||
.removeClass( "ui-corner-all" )
|
||||
.filter( ":first" )
|
||||
.addClass( "ui-corner-left" )
|
||||
.end()
|
||||
.filter( ":last" )
|
||||
.addClass( "ui-corner-right" )
|
||||
.end()
|
||||
.end();
|
||||
this._init();
|
||||
},
|
||||
|
||||
_init: function() {
|
||||
this.refresh();
|
||||
},
|
||||
|
||||
_setOption: function( key, value ) {
|
||||
@ -334,6 +326,27 @@ $.widget( "ui.buttonset", {
|
||||
|
||||
$.Widget.prototype._setOption.apply( this, arguments );
|
||||
},
|
||||
|
||||
refresh: function() {
|
||||
this.buttons = this.element.find( ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" )
|
||||
.filter( ":ui-button" )
|
||||
.button( "refresh" )
|
||||
.end()
|
||||
.not( ":ui-button" )
|
||||
.button()
|
||||
.end()
|
||||
.map(function() {
|
||||
return $( this ).button( "widget" )[ 0 ];
|
||||
})
|
||||
.removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
|
||||
.filter( ":first" )
|
||||
.addClass( "ui-corner-left" )
|
||||
.end()
|
||||
.filter( ":last" )
|
||||
.addClass( "ui-corner-right" )
|
||||
.end()
|
||||
.end();
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
this.element.removeClass( "ui-button-set" );
|
||||
|
Loading…
Reference in New Issue
Block a user