Skip to content
Permalink
Browse files

UI Tabs: fixed adding Ajax tab to empty list (#2839 jQuery bug tracker)

  • Loading branch information
Klaus Hartl
Klaus Hartl committed Jan 16, 2009
1 parent f3e60ed commit 26cdc6d22be8778383bb1e45d44bb70ac2a2d8af
Showing with 6 additions and 3 deletions.
  1. +6 −3 ui/ui.tabs.js
@@ -343,7 +343,7 @@ $.widget("ui.tabs", {
if (index == undefined)
index = this.$tabs.length; // append by default

var o = this.options;
var self = this, o = this.options;
var $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label));
$li.addClass(o.tabClass).data('destroy.tabs', true);

@@ -371,11 +371,14 @@ $.widget("ui.tabs", {

this._tabify();

if (this.$tabs.length == 1) {
if (this.$tabs.length == 1) { // after tabify
$li.addClass(o.selectedClass);
$panel.removeClass(o.hideClass);
var href = $.data(this.$tabs[0], 'load.tabs');
if (href) this.load(index, href);
if (href) this.load(0, function() {
self._trigger('show', null,
self.ui(self.$tabs[0], self.$panels[0]));
});
}

// callback

0 comments on commit 26cdc6d

Please sign in to comment.
You can’t perform that action at this time.