Skip to main content

Search and Top Navigation

Ticket #3065: ui.tabs.js.patch
File ui.tabs.js.patch, 1.0 KB (added by wolfpakz, July 04, 2008 04:04AM UTC)
--- ui.tabs.js	2008-07-03 16:25:19.073740196 -0400
+++ ui.tabs.js.fix	2008-07-03 16:25:13.993743612 -0400
@@ -361,16 +361,16 @@
 		var o = this.options, $li = this.$lis.eq(index).remove(),
 			$panel = this.$panels.eq(index).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 ($li.hasClass(o.selectedClass) && this.$tabs.length > 1)
-			this.select(index + (index + 1 < this.$tabs.length ? 1 : -1));
-
 		o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }),
 			function(n, i) { return n >= index ? --n : n });
 
 		this.tabify();
 
+    // If selected tab was removed focus tab to the right or
+    // in case the last tab was removed the tab to the left.
+    if ($li.hasClass(o.selectedClass) && this.$tabs.length)
+      this.select(index + (index + 1 <= this.$tabs.length ? 0 : -1));
+
 		// callback
 		this.element.triggerHandler('tabsremove',
 			[null, this.ui($li.find('a')[0], $panel[0])], o.remove

Download in other formats:

Original Format