From 956697bfca1b386ae20eb27ccfd8c1df3234f1f2 Mon Sep 17 00:00:00 2001 From: Xavi Date: Sun, 19 Dec 2010 16:52:22 -0500 Subject: All: Use .toggleClass() instead of conditionally using .addClass() and .removeClass(). Fixes #6764 - Use toggleClass instead of [ bool ? 'addClass' : 'removeClass' ]. --- ui/jquery.ui.tabs.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'ui/jquery.ui.tabs.js') diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js index 7d73bf10b..13e1c25c8 100644 --- a/ui/jquery.ui.tabs.js +++ b/ui/jquery.ui.tabs.js @@ -233,9 +233,7 @@ $.widget( "ui.tabs", { o.selected = this.lis.index( this.lis.filter( ".ui-tabs-selected" ) ); } - // update collapsible - // TODO: use .toggleClass() - this.element[ o.collapsible ? "addClass" : "removeClass" ]( "ui-tabs-collapsible" ); + this.element.toggleClass( "ui-tabs-collapsible", o.collapsible ); // set or update cookie after init and add/remove respectively if ( o.cookie ) { @@ -244,9 +242,8 @@ $.widget( "ui.tabs", { // disable tabs for ( var i = 0, li; ( li = this.lis[ i ] ); i++ ) { - $( li )[ $.inArray( i, o.disabled ) != -1 && - // TODO: use .toggleClass() - !$( li ).hasClass( "ui-tabs-selected" ) ? "addClass" : "removeClass" ]( "ui-state-disabled" ); + $( li ).toggleClass( "ui-state-disabled", + $.inArray( i, o.disabled ) != -1 && !$( li ).hasClass( "ui-tabs-selected" ) ); } // reset cache if switching from cached to not cached -- cgit v1.2.3