From dce26f80fbcf60cf62580d2c5a658b1fdbf14e57 Mon Sep 17 00:00:00 2001 From: piro Date: Wed, 30 Jul 2008 18:03:44 +0000 Subject: [PATCH] =?UTF-8?q?=E5=BC=95=E6=95=B0=E3=82=92=E5=8F=96=E3=82=89?= =?UTF-8?q?=E3=81=9A=E3=81=AB=E5=95=8F=E9=A1=8C=E3=82=92=E8=A7=A3=E6=B1=BA?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@2884 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/treestyletabbrowser.js | 23 +++++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 77ae09e8..6d8f2b3b 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -2535,14 +2535,12 @@ TreeStyleTabBrowser.prototype = { /* collapse/expand */ - collapseExpandSubtree : function(aTab, aCollapse, aRoot) + collapseExpandSubtree : function(aTab, aCollapse) { if (!aTab) return; if ((aTab.getAttribute(this.kSUBTREE_COLLAPSED) == 'true') == aCollapse) return; - if (!aRoot) aRoot = aTab; - var b = this.mTabBrowser; this.doingCollapseExpand = true; @@ -2551,7 +2549,7 @@ TreeStyleTabBrowser.prototype = { var tabs = this.getChildTabs(aTab); for (var i = 0, maxi = tabs.length; i < maxi; i++) { - this.collapseExpandTab(tabs[i], aCollapse, aRoot); + this.collapseExpandTab(tabs[i], aCollapse); } if (!aCollapse) @@ -2560,16 +2558,23 @@ TreeStyleTabBrowser.prototype = { this.doingCollapseExpand = false; }, - collapseExpandTab : function(aTab, aCollapse, aRoot) + collapseExpandTab : function(aTab, aCollapse) { if (!aTab || !this.getParentTab(aTab)) return; this.setTabValue(aTab, this.kCOLLAPSED, aCollapse); var b = this.mTabBrowser; - var p = aRoot || this.getParentTab(aTab); - if (aCollapse && aTab == b.selectedTab) { - b.selectedTab = p; + var parent; + if (aCollapse && aTab == b.selectedTab && (parent = this.getParentTab(aTab))) { + var newSelection = parent; + while (parent.getAttribute(this.kCOLLAPSED) == 'true') + { + parent = this.getParentTab(parent); + if (!parent) break; + newSelection = parent; + } + b.selectedTab = newSelection; } var isSubTreeCollapsed = (aTab.getAttribute(this.kSUBTREE_COLLAPSED) == 'true'); @@ -2577,7 +2582,7 @@ TreeStyleTabBrowser.prototype = { for (var i = 0, maxi = tabs.length; i < maxi; i++) { if (!isSubTreeCollapsed) - this.collapseExpandTab(tabs[i], aCollapse, aRoot); + this.collapseExpandTab(tabs[i], aCollapse); } },