Skip to content

Commit

Permalink
UI Tabs: fixed cookie name generation which wasn't based on DOM eleme…
Browse files Browse the repository at this point in the history
…nt any longer after change in this.element, update cookie after init/add/destroy (fixes #3015)
  • Loading branch information
Klaus Hartl committed Sep 9, 2008
1 parent accc76b commit 32f4412
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ui/ui.tabs.js
Expand Up @@ -107,7 +107,7 @@ $.widget("ui.tabs", {
});
}
else if (o.cookie) {
var index = parseInt($.cookie('ui-tabs' + $.data(self.element)),10);
var index = parseInt($.cookie('ui-tabs-' + $.data(self.element[0])), 10);
if (index && self.$tabs[index])
o.selected = index;
}
Expand Down Expand Up @@ -158,6 +158,10 @@ $.widget("ui.tabs", {
else
o.selected = this.$lis.index( this.$lis.filter('.' + o.selectedClass)[0] );

// set or update cookie after init and add/remove respectively
if (o.cookie)
$.cookie('ui-tabs-' + $.data(self.element[0]), o.selected, o.cookie);

// disable tabs
for (var i = 0, li; li = this.$lis[i]; i++)
$(li)[$.inArray(i, o.disabled) != -1 && !$(li).hasClass(o.selectedClass) ? 'addClass' : 'removeClass'](o.disabledClass);
Expand Down Expand Up @@ -260,7 +264,7 @@ $.widget("ui.tabs", {
}

if (o.cookie)
$.cookie('ui-tabs' + $.data(self.element), self.options.selected, o.cookie);
$.cookie('ui-tabs-' + $.data(self.element[0]), self.options.selected, o.cookie);

// stop possibly running animations
self.$panels.stop();
Expand Down

0 comments on commit 32f4412

Please sign in to comment.