diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-07 21:21:39 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-07 21:21:39 +0000 |
commit | a4fa35fdf7511ac78ae5e27ccba432ea03fec27a (patch) | |
tree | 41a1edf6a83a45d128710ec9cc605dbd48098eab | |
parent | 65b8c327eb2d077e3c61693d96447619bee0f137 (diff) | |
download | chromium_src-a4fa35fdf7511ac78ae5e27ccba432ea03fec27a.zip chromium_src-a4fa35fdf7511ac78ae5e27ccba432ea03fec27a.tar.gz chromium_src-a4fa35fdf7511ac78ae5e27ccba432ea03fec27a.tar.bz2 |
Merge 95689 - 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
TBR=zelidrag@chromium.org
Review URL: http://codereview.chromium.org/7585031
git-svn-id: svn://svn.chromium.org/chrome/branches/835/src@95772 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/resources/options/options_page.js | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/chrome/browser/resources/options/options_page.js b/chrome/browser/resources/options/options_page.js index f9903c6..8252af3 100644 --- a/chrome/browser/resources/options/options_page.js +++ b/chrome/browser/resources/options/options_page.js @@ -338,15 +338,23 @@ cr.define('options', function() { if (!tab || !tab.classList.contains('tab')) return; - if (this.activeNavTab != null) { - this.activeNavTab.classList.remove('active-tab'); - $(this.activeNavTab.getAttribute('tab-contents')).classList. + // Find tab bar of the tab. + var tabBar = tab; + 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'); } tab.classList.add('active-tab'); $(tab.getAttribute('tab-contents')).classList.add('active-tab-contents'); - this.activeNavTab = tab; + tabBar.activeNavTab = tab; }; /** |