// so we need to add the disabled class to the headers and panels
if ( key == "disabled" ) {
this.headers.add(this.headers.next())
- [ value ? "addClass" : "removeClass" ](
- "ui-accordion-disabled ui-state-disabled" );
+ .toggleClass( "ui-accordion-disabled ui-state-disabled", !!value );
}
},
if ( key === "disabled" ) {
this.options[ key ] = value;
- this.widget()
- [ value ? "addClass" : "removeClass"]( "ui-sortable-disabled" );
+ this.widget().toggleClass( "ui-sortable-disabled", !!value );
} else {
// Don't call widget base _setOption for disable as it adds ui-state-disabled class
$.Widget.prototype._setOption.apply(this, arguments);
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 ) {
// 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
if ( key === "disabled" ) {
this.widget()
- [ value ? "addClass" : "removeClass"](
- this.widgetBaseClass + "-disabled" + " " +
- "ui-state-disabled" )
+ .toggleClass( this.widgetBaseClass + "-disabled ui-state-disabled", !!value )
.attr( "aria-disabled", value );
}