// check for a tab marked active via a class
if ( active === null ) {
- active = this.lis.filter( ".ui-tabs-active" ).index();
+ active = this.tabs.filter( ".ui-tabs-active" ).index();
}
// no active tab, set to false
if ( active === null || active === -1 ) {
- active = this.lis.length ? 0 : false;
+ active = this.tabs.length ? 0 : false;
}
}
// handle numbers: negative, out of range
if ( active !== false ) {
- active = this.lis.eq( active ).index();
+ active = this.tabs.eq( active ).index();
if ( active === -1 ) {
active = options.collapsible ? false : 0;
}
// into account and update option properly.
if ( $.isArray( options.disabled ) ) {
options.disabled = $.unique( options.disabled.concat(
- $.map( this.lis.filter( ".ui-state-disabled" ), function( li ) {
- return that.lis.index( li );
+ $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) {
+ return that.tabs.index( li );
})
) ).sort();
}
_tabKeydown: function( event ) {
var focusedTab = $( this.document[0].activeElement ).closest( "li" ),
- selectedIndex = this.lis.index( focusedTab ),
+ selectedIndex = this.tabs.index( focusedTab ),
goingForward = true;
if ( this._handlePageNav( event ) ) {
// Otherwise AT may confuse the user by stating that they need to activate the tab,
// but the tab will already be activated by the time the announcement finishes.
focusedTab.attr( "aria-selected", "false" );
- this.lis.eq( selectedIndex ).attr( "aria-selected", "true" );
+ this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" );
this.activating = this._delay(function() {
this.option( "active", selectedIndex );
},
_focusNextTab: function( index, goingForward ) {
- var lastTabIndex = this.lis.length - 1;
+ var lastTabIndex = this.tabs.length - 1;
function constrain() {
if ( index > lastTabIndex ) {
index = goingForward ? index + 1 : index - 1;
}
- this.lis.eq( index ).focus();
+ this.tabs.eq( index ).focus();
return index;
},
refresh: function() {
var next,
options = this.options,
- lis = this.list.children( ":has(a[href])" );
+ lis = this.tablist.children( ":has(a[href])" );
// get disabled tabs from class attribute from HTML
// this will get converted to a boolean if needed in _refresh()
options.active = false;
this.active = $();
// was active, but active tab is gone
- } else if ( this.active.length && !$.contains( this.list[ 0 ], this.active[ 0 ] ) ) {
+ } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) {
// activate previous tab
next = options.active - 1;
this._activate( next >= 0 ? next : 0 );
// was active, active tab still exists
} else {
// make sure active index is correct
- options.active = this.lis.index( this.active );
+ options.active = this.tabs.index( this.active );
}
this._refresh();
this._setupEvents( this.options.event );
this._setupHeightStyle( this.options.heightStyle );
- this.lis.not( this.active ).attr({
+ this.tabs.not( this.active ).attr({
"aria-selected": "false",
tabIndex: -1
});
// Make sure one tab is in the tab order
if ( !this.active.length ) {
- this.lis.eq( 0 ).attr( "tabIndex", 0 );
+ this.tabs.eq( 0 ).attr( "tabIndex", 0 );
} else {
this.active
.addClass( "ui-tabs-active ui-state-active" )
_processTabs: function() {
var that = this;
- this.list = this._getList()
+ this.tablist = this._getList()
.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
.attr( "role", "tablist" );
- this.lis = this.list.find( "> li:has(a[href])" )
+ this.tabs = this.tablist.find( "> li:has(a[href])" )
.addClass( "ui-state-default ui-corner-top" )
.attr({
role: "tab",
tabIndex: -1
});
- this.anchors = this.lis.map(function() {
+ this.anchors = this.tabs.map(function() {
return $( "a", this )[ 0 ];
})
.addClass( "ui-tabs-anchor" )
panel = that.element.find( selector );
if ( !panel.length ) {
panel = that._createPanel( panelId );
- panel.insertAfter( that.panels[ i - 1 ] || that.list );
+ panel.insertAfter( that.panels[ i - 1 ] || that.tablist );
}
panel.attr( "aria-live", "polite" );
}
}
// disable tabs
- for ( var i = 0, li; ( li = this.lis[ i ] ); i++ ) {
+ for ( var i = 0, li; ( li = this.tabs[ i ] ); i++ ) {
if ( disabled === true || $.inArray( i, disabled ) !== -1 ) {
$( li )
.addClass( "ui-state-disabled" )
});
}
- this.anchors.add( this.lis ).add( this.panels ).unbind( ".tabs" );
+ this.anchors.add( this.tabs ).add( this.panels ).unbind( ".tabs" );
this._bind( this.anchors, events );
- this._bind( this.lis, { keydown: "_tabKeydown" } );
+ this._bind( this.tabs, { keydown: "_tabKeydown" } );
this._bind( this.panels, { keydown: "_panelKeydown" } );
- this._focusable( this.lis );
- this._hoverable( this.lis );
+ this._focusable( this.tabs );
+ this._hoverable( this.tabs );
},
_setupHeightStyle: function( heightStyle ) {
return;
}
- options.active = collapsing ? false : this.lis.index( tab );
+ options.active = collapsing ? false : this.tabs.index( tab );
this.active = clickedIsActive ? $() : tab;
if ( this.xhr ) {
if ( toShow.length ) {
// TODO make passing in node possible
- this.load( this.lis.index( tab ), event );
+ this.load( this.tabs.index( tab ), event );
}
this._toggle( event, eventData );
},
if ( toShow.length && toHide.length ) {
eventData.oldTab.attr( "tabIndex", -1 );
} else if ( toShow.length ) {
- this.lis.filter(function() {
+ this.tabs.filter(function() {
return $( this ).attr( "tabIndex" ) === 0;
})
.attr( "tabIndex", -1 );
},
_findActive: function( index ) {
- return index === false ? $() : this.lis.eq( index );
+ return index === false ? $() : this.tabs.eq( index );
},
_getIndex: function( index ) {
this.element.removeClass( "ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible" );
- this.list
+ this.tablist
.removeClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
.removeAttr( "role" );
.removeData( "load.tabs" )
.removeUniqueId();
- this.lis.unbind( ".tabs" ).add( this.panels ).each(function() {
+ this.tabs.unbind( ".tabs" ).add( this.panels ).each(function() {
if ( $.data( this, "ui-tabs-destroy" ) ) {
$( this ).remove();
} else {
}
});
- this.lis.each(function() {
+ this.tabs.each(function() {
var li = $( this ),
prev = li.data( "ui-tabs-aria-controls" );
if ( prev ) {
return num !== index ? num : null;
});
} else {
- disabled = $.map( this.lis, function( li, num ) {
+ disabled = $.map( this.tabs, function( li, num ) {
return num !== index ? num : null;
});
}
load: function( index, event ) {
index = this._getIndex( index );
var that = this,
- tab = this.lis.eq( index ),
+ tab = this.tabs.eq( index ),
anchor = tab.find( ".ui-tabs-anchor" ),
panel = this._getPanelForTab( tab ),
eventData = {
li.addClass( "ui-state-default ui-corner-top" ).data( "ui-tabs-destroy", true );
li.attr( "aria-controls", id );
- doInsertAfter = index >= this.lis.length;
+ doInsertAfter = index >= this.tabs.length;
// try to find an existing element before creating a new one
panel = this.element.find( "#" + id );
panel.addClass( "ui-tabs-panel ui-widget-content ui-corner-bottom" ).hide();
if ( doInsertAfter ) {
- li.appendTo( this.list );
+ li.appendTo( this.tablist );
} else {
- li.insertBefore( this.lis[ index ] );
+ li.insertBefore( this.tabs[ index ] );
}
options.disabled = $.map( options.disabled, function( n ) {
});
this.refresh();
- if ( this.lis.length === 1 && options.active === false ) {
+ if ( this.tabs.length === 1 && options.active === false ) {
this.option( "active", 0 );
}
remove: function( index ) {
index = this._getIndex( index );
var options = this.options,
- tab = this.lis.eq( index ).remove(),
+ tab = this.tabs.eq( index ).remove(),
panel = this._getPanelForTab( tab ).remove();
// If selected tab was removed focus tab to the right or