mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Tabs: Simplify logic for showing/hiding tabs.
This commit is contained in:
parent
b70256c368
commit
1298f939b9
42
ui/jquery.ui.tabs.js
vendored
42
ui/jquery.ui.tabs.js
vendored
@ -401,18 +401,16 @@ $.widget( "ui.tabs", {
|
|||||||
that.xhr.abort();
|
that.xhr.abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if tab may be closed
|
if ( !toHide.length && !toShow.length ) {
|
||||||
if ( options.collapsible ) {
|
throw "jQuery UI Tabs: Mismatching fragment identifier.";
|
||||||
if ( collapsing ) {
|
}
|
||||||
options.active = false;
|
|
||||||
|
|
||||||
|
if ( toHide.length ) {
|
||||||
that.element.queue( "tabs", function() {
|
that.element.queue( "tabs", function() {
|
||||||
that._hideTab( event, eventData );
|
that._hideTab( event, eventData );
|
||||||
}).dequeue( "tabs" );
|
});
|
||||||
|
}
|
||||||
clicked[ 0 ].blur();
|
if ( toShow.length ) {
|
||||||
return;
|
|
||||||
} else if ( !toHide.length ) {
|
|
||||||
that.element.queue( "tabs", function() {
|
that.element.queue( "tabs", function() {
|
||||||
that._showTab( event, eventData );
|
that._showTab( event, eventData );
|
||||||
});
|
});
|
||||||
@ -421,32 +419,8 @@ $.widget( "ui.tabs", {
|
|||||||
that.load( that.anchors.index( clicked ), event );
|
that.load( that.anchors.index( clicked ), event );
|
||||||
|
|
||||||
clicked[ 0 ].blur();
|
clicked[ 0 ].blur();
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// show new tab
|
|
||||||
if ( toShow.length ) {
|
|
||||||
if ( toHide.length ) {
|
|
||||||
that.element.queue( "tabs", function() {
|
|
||||||
that._hideTab( event, eventData );
|
|
||||||
});
|
|
||||||
}
|
|
||||||
that.element.queue( "tabs", function() {
|
|
||||||
that._showTab( event, eventData );
|
|
||||||
});
|
|
||||||
|
|
||||||
that.load( that.anchors.index( clicked ), event );
|
|
||||||
} else {
|
} else {
|
||||||
throw "jQuery UI Tabs: Mismatching fragment identifier.";
|
that.element.dequeue( "tabs" );
|
||||||
}
|
|
||||||
|
|
||||||
// Prevent IE from keeping other link focussed when using the back button
|
|
||||||
// and remove dotted border from clicked link. This is controlled via CSS
|
|
||||||
// in modern browsers; blur() removes focus from address bar in Firefox
|
|
||||||
// which can become a usability
|
|
||||||
if ( $.browser.msie ) {
|
|
||||||
clicked[ 0 ].blur();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user