From 0059722b6b43c4985dbbd5f1494524442c12ddb0 Mon Sep 17 00:00:00 2001 From: Scott González Date: Tue, 1 Apr 2014 14:42:38 -0400 Subject: Button: Properly refresh button sets with new radio buttons Fixes #8975 Ref gh-888 --- ui/button.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'ui') 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 ]; }) -- cgit v1.2.3