From 34d3f29a95c1dede3ed68ea7984ac5c751e6127b Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 28 Feb 2012 16:55:41 +0100 Subject: [PATCH] BUGFIX Fixed TabSet.js initialisation with cookies, default to first tab rather than allowing tab deselects through an index of -1 --- javascript/TabSet.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/javascript/TabSet.js b/javascript/TabSet.js index 504684fc2..c553a2847 100644 --- a/javascript/TabSet.js +++ b/javascript/TabSet.js @@ -17,11 +17,12 @@ redrawTabs: function() { this.rewriteHashlinks(); - // Initialize jQuery UI tabs - var id = this.attr('id'); - this.tabs({ - cookie: ($.cookie && id) ? { expires: 30, path: '/', name: 'ui-tabs-' + id } : false - }); + var id = this.attr('id'), cookieId = 'ui-tabs-' + id; + + // Fix for wrong cookie storage of deselected tabs + if($.cookie && id && $.cookie(cookieId) == -1) $.cookie(cookieId, 0); + + this.tabs({cookie: ($.cookie && id) ? { expires: 30, path: '/', name: cookieId } : false}); }, /**