aboutsummaryrefslogtreecommitdiffstats
path: root/ui/ui.tabs.js
diff options
context:
space:
mode:
authorKlaus Hartl <klaus.hartl@googlemail.com>2008-09-09 09:28:03 +0000
committerKlaus Hartl <klaus.hartl@googlemail.com>2008-09-09 09:28:03 +0000
commit32f4412c2bbba3376a0c61a816d3b28b7635f240 (patch)
treeab705c049970448b4ac8906dc34d53c15af5bfc1 /ui/ui.tabs.js
parentaccc76bc64e8844153954868258b9dd59b9ba294 (diff)
downloadjquery-ui-32f4412c2bbba3376a0c61a816d3b28b7635f240.tar.gz
jquery-ui-32f4412c2bbba3376a0c61a816d3b28b7635f240.zip
UI Tabs: fixed cookie name generation which wasn't based on DOM element any longer after change in this.element, update cookie after init/add/destroy (fixes #3015)
Diffstat (limited to 'ui/ui.tabs.js')
-rw-r--r--ui/ui.tabs.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/ui/ui.tabs.js b/ui/ui.tabs.js
index 9837778ad..109ead137 100644
--- a/ui/ui.tabs.js
+++ b/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();