Skip to content

Commit

Permalink
UI Tabs: fixed adding Ajax tab to empty list (#2839 jQuery bug tracker)
Browse files Browse the repository at this point in the history
  • Loading branch information
Klaus Hartl committed Jan 16, 2009
1 parent f3e60ed commit 26cdc6d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ui/ui.tabs.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ $.widget("ui.tabs", {
if (index == undefined) if (index == undefined)
index = this.$tabs.length; // append by default 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)); var $li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label));
$li.addClass(o.tabClass).data('destroy.tabs', true); $li.addClass(o.tabClass).data('destroy.tabs', true);


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


this._tabify(); this._tabify();


if (this.$tabs.length == 1) { if (this.$tabs.length == 1) { // after tabify
$li.addClass(o.selectedClass); $li.addClass(o.selectedClass);
$panel.removeClass(o.hideClass); $panel.removeClass(o.hideClass);
var href = $.data(this.$tabs[0], 'load.tabs'); 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 // callback
Expand Down

0 comments on commit 26cdc6d

Please sign in to comment.