From 9060bf3d09a547563e94815f9e0a1c4908ebd904 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Wed, 18 Aug 2010 10:13:57 -0400 Subject: [PATCH] Buttonset: Ignore hidden buttons. Fixes #5946 - buttonset should ignore buttons that are not :visible. --- tests/unit/button/button_tickets.js | 7 ++++++- ui/jquery.ui.button.js | 12 +++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/tests/unit/button/button_tickets.js b/tests/unit/button/button_tickets.js index 7f972513d..46002bdea 100644 --- a/tests/unit/button/button_tickets.js +++ b/tests/unit/button/button_tickets.js @@ -5,6 +5,11 @@ module("button: tickets"); - +test("#5946 - buttonset should ignore buttons that are not :visible", function() { + $( "#radio01" ).next().wrap( "
" ).parent().hide(); + var set = $( "#radio0" ).buttonset(); + ok( set.find( "label:eq(0)" ).is( ".ui-button:not(.ui-corner-left)" ) ); + ok( set.find( "label:eq(1)" ).is( ".ui-button.ui-corner-left" ) ); +}); })(jQuery); diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js index b2fab4d24..7d21fa495 100644 --- a/ui/jquery.ui.button.js +++ b/ui/jquery.ui.button.js @@ -339,11 +339,13 @@ $.widget( "ui.buttonset", { 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" ) + .filter( ":visible" ) + .filter( ":first" ) + .addClass( "ui-corner-left" ) + .end() + .filter( ":last" ) + .addClass( "ui-corner-right" ) + .end() .end() .end(); }, -- 2.39.5