Commit 4ccc9dd4 authored by xiyuan@chromium.org's avatar xiyuan@chromium.org

Remeber active tab in tab bar instead of 'this'.

OptionsPage.showTab could be called with wrong 'this' so remember activeNavTab in parent tab bar instead.

BUG=chromium-os:18662
TEST=Verify fix for chromium-os:18662.

Review URL: http://codereview.chromium.org/7572047

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95689 0039d316-1c4b-4281-b951-d872f2087c98
parent e5ffa33e
...@@ -338,15 +338,23 @@ cr.define('options', function() { ...@@ -338,15 +338,23 @@ cr.define('options', function() {
if (!tab || !tab.classList.contains('tab')) if (!tab || !tab.classList.contains('tab'))
return; return;
if (this.activeNavTab != null) { // Find tab bar of the tab.
this.activeNavTab.classList.remove('active-tab'); var tabBar = tab;
$(this.activeNavTab.getAttribute('tab-contents')).classList. while (tabBar && !tabBar.classList.contains('subpages-nav-tabs')) {
tabBar = tabBar.parentNode;
}
if (!tabBar)
return;
if (tabBar.activeNavTab != null) {
tabBar.activeNavTab.classList.remove('active-tab');
$(tabBar.activeNavTab.getAttribute('tab-contents')).classList.
remove('active-tab-contents'); remove('active-tab-contents');
} }
tab.classList.add('active-tab'); tab.classList.add('active-tab');
$(tab.getAttribute('tab-contents')).classList.add('active-tab-contents'); $(tab.getAttribute('tab-contents')).classList.add('active-tab-contents');
this.activeNavTab = tab; tabBar.activeNavTab = tab;
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment