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", {
|
$.widget( "ui.buttonset", {
|
||||||
_create: function() {
|
_create: function() {
|
||||||
this.element.addClass( "ui-button-set" );
|
this.element.addClass( "ui-button-set" );
|
||||||
this.buttons = this.element.find( ":button, :submit, :reset, :checkbox, :radio, a, :data(button)" )
|
this._init();
|
||||||
.button()
|
},
|
||||||
.map(function() {
|
|
||||||
return $( this ).button( "widget" )[ 0 ];
|
_init: function() {
|
||||||
})
|
this.refresh();
|
||||||
.removeClass( "ui-corner-all" )
|
|
||||||
.filter( ":first" )
|
|
||||||
.addClass( "ui-corner-left" )
|
|
||||||
.end()
|
|
||||||
.filter( ":last" )
|
|
||||||
.addClass( "ui-corner-right" )
|
|
||||||
.end()
|
|
||||||
.end();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_setOption: function( key, value ) {
|
_setOption: function( key, value ) {
|
||||||
@ -335,6 +327,27 @@ $.widget( "ui.buttonset", {
|
|||||||
$.Widget.prototype._setOption.apply( this, arguments );
|
$.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() {
|
destroy: function() {
|
||||||
this.element.removeClass( "ui-button-set" );
|
this.element.removeClass( "ui-button-set" );
|
||||||
this.buttons
|
this.buttons
|
||||||
|
Loading…
Reference in New Issue
Block a user