Skip to content
Permalink
Browse files

UI Tabs: fixed cookie name generation which wasn't based on DOM eleme…

…nt any longer after change in this.element, update cookie after init/add/destroy (fixes #3015)
  • Loading branch information...
Klaus Hartl
Klaus Hartl committed Sep 9, 2008
1 parent accc76b commit 32f4412c2bbba3376a0c61a816d3b28b7635f240
Showing with 6 additions and 2 deletions.
  1. +6 −2 ui/ui.tabs.js
@@ -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;
}
@@ -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);
@@ -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();

0 comments on commit 32f4412

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