aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.tabs.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/jquery.ui.tabs.js')
-rw-r--r--ui/jquery.ui.tabs.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/ui/jquery.ui.tabs.js b/ui/jquery.ui.tabs.js
index b6f178ed9..a1bf72cb1 100644
--- a/ui/jquery.ui.tabs.js
+++ b/ui/jquery.ui.tabs.js
@@ -25,7 +25,7 @@ var isLocal = (function() {
return function( anchor ) {
// clone the node to work around IE 6 not normalizing the href property
// if it's manually set, i.e., a.href = "#foo" kills the normalization
- anchor = anchor.cloneNode();
+ anchor = anchor.cloneNode( false );
return anchor.hash.length > 1 &&
anchor.href.replace( rhash, "" ) === currentPage;
};
@@ -792,11 +792,14 @@ if ( $.uiBackCompat !== false ) {
index = this._getIndex( index );
var options = this.options,
tab = this.lis.eq( index ).remove(),
- panel = this.panels.eq( index ).remove();
+ panel = this._getPanelForTab( tab.find( "a[aria-controls]" ) ).remove();
// If selected tab was removed focus tab to the right or
// in case the last tab was removed the tab to the left.
- if ( tab.hasClass( "ui-tabs-active" ) && this.anchors.length > 1) {
+ // We check for more than 2 tabs, because if there are only 2,
+ // then when we remove this tab, there will only be one tab left
+ // so we don't need to detect which tab to activate.
+ if ( tab.hasClass( "ui-tabs-active" ) && this.anchors.length > 2 ) {
this._activate( index + ( index + 1 < this.anchors.length ? 1 : -1 ) );
}