Skip to content

Commit 1298f93

Browse files
committed
Tabs: Simplify logic for showing/hiding tabs.
1 parent b70256c commit 1298f93

File tree

1 file changed

+10
-36
lines changed

1 file changed

+10
-36
lines changed

ui/jquery.ui.tabs.js

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -401,52 +401,26 @@ $.widget( "ui.tabs", {
401401
that.xhr.abort();
402402
}
403403

404-
// if tab may be closed
405-
if ( options.collapsible ) {
406-
if ( collapsing ) {
407-
options.active = false;
408-
409-
that.element.queue( "tabs", function() {
410-
that._hideTab( event, eventData );
411-
}).dequeue( "tabs" );
412-
413-
clicked[ 0 ].blur();
414-
return;
415-
} else if ( !toHide.length ) {
416-
that.element.queue( "tabs", function() {
417-
that._showTab( event, eventData );
418-
});
419-
420-
// TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171
421-
that.load( that.anchors.index( clicked ), event );
422-
423-
clicked[ 0 ].blur();
424-
return;
425-
}
404+
if ( !toHide.length && !toShow.length ) {
405+
throw "jQuery UI Tabs: Mismatching fragment identifier.";
426406
}
427407

428-
// show new tab
408+
if ( toHide.length ) {
409+
that.element.queue( "tabs", function() {
410+
that._hideTab( event, eventData );
411+
});
412+
}
429413
if ( toShow.length ) {
430-
if ( toHide.length ) {
431-
that.element.queue( "tabs", function() {
432-
that._hideTab( event, eventData );
433-
});
434-
}
435414
that.element.queue( "tabs", function() {
436415
that._showTab( event, eventData );
437416
});
438417

418+
// TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171
439419
that.load( that.anchors.index( clicked ), event );
440-
} else {
441-
throw "jQuery UI Tabs: Mismatching fragment identifier.";
442-
}
443420

444-
// Prevent IE from keeping other link focussed when using the back button
445-
// and remove dotted border from clicked link. This is controlled via CSS
446-
// in modern browsers; blur() removes focus from address bar in Firefox
447-
// which can become a usability
448-
if ( $.browser.msie ) {
449421
clicked[ 0 ].blur();
422+
} else {
423+
that.element.dequeue( "tabs" );
450424
}
451425
},
452426

0 commit comments

Comments
 (0)