You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by zh...@apache.org on 2010/06/10 23:12:27 UTC

svn commit: r953463 - /shindig/trunk/features/src/main/javascript/features/tabs/tabs.js

Author: zhoresh
Date: Thu Jun 10 21:12:27 2010
New Revision: 953463

URL: http://svn.apache.org/viewvc?rev=953463&view=rev
Log:
Fix tabs feature to support selectedTab correctly
http://codereview.appspot.com/1639042

Modified:
    shindig/trunk/features/src/main/javascript/features/tabs/tabs.js

Modified: shindig/trunk/features/src/main/javascript/features/tabs/tabs.js
URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/tabs/tabs.js?rev=953463&r1=953462&r2=953463&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/tabs/tabs.js (original)
+++ shindig/trunk/features/src/main/javascript/features/tabs/tabs.js Thu Jun 10 21:12:27 2010
@@ -230,8 +230,13 @@ gadgets.TabSet.prototype.addTab = functi
     this.saveSelectedTabIndex_();
   }
 
-  if (tabName == this.defaultTabName_ || (!this.defaultTabName_ && tabIndex === 0)) {
-    this.selectTab_(tab);
+  var selectedIndex = parseInt(this.selectedTabIndex_, 10);
+  if (isNaN(selectedIndex)) {
+    if (tabName == this.defaultTabName_ || (!this.defaultTabName_ && tabIndex === 0)) {
+      this.selectTab_(tab);
+    }
+  } else if (selectedIndex == tabIndex) {
+    this.selectTab_(tab, true);
   }
 
   this.tabsAdded_++;