diff options
Diffstat (limited to 'ui/button.js')
-rw-r--r-- | ui/button.js | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/ui/button.js b/ui/button.js index d9b027541..247aba6e5 100644 --- a/ui/button.js +++ b/ui/button.js @@ -366,15 +366,17 @@ $.widget( "ui.buttonset", { }, refresh: function() { - var rtl = this.element.css( "direction" ) === "rtl"; + var rtl = this.element.css( "direction" ) === "rtl", + allButtons = this.element.find( this.options.items ), + existingButtons = allButtons.filter( ":ui-button" ); - this.buttons = this.element.find( this.options.items ) - .filter( ":ui-button" ) - .button( "refresh" ) - .end() - .not( ":ui-button" ) - .button() - .end() + // Initialize new buttons + allButtons.not( ":ui-button" ).button(); + + // Refresh existing buttons + existingButtons.button( "refresh" ); + + this.buttons = allButtons .map(function() { return $( this ).button( "widget" )[ 0 ]; }) |