From f2e3d407d56dddc51993c1330c2ea79384011628 Mon Sep 17 00:00:00 2001 From: piro Date: Wed, 14 Nov 2007 11:00:18 +0000 Subject: [PATCH] =?UTF-8?q?=E3=82=BF=E3=83=96=E3=81=8C=E5=88=9D=E6=9C=9F?= =?UTF-8?q?=E5=8C=96=E3=81=95=E3=82=8C=E3=82=8B=E5=89=8D=E3=81=AB=E7=A7=BB?= =?UTF-8?q?=E5=8B=95=E3=81=95=E3=82=8C=E3=82=8B=E3=81=A8=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=81=8C=E3=81=8A=E3=81=8B=E3=81=97=E3=81=8F=E3=81=AA=E3=82=8B?= =?UTF-8?q?=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= 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@1578 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/treestyletab.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index 885c0865..8af7f458 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -1847,8 +1847,10 @@ catch(e) { getParentTab : function(aTab) { if (!aTab) return null; + var id = aTab.getAttribute(this.kID); + if (!id) return null; // not initialized yet return this.evaluateXPath( - 'parent::*/child::xul:tab[contains(@'+this.kCHILDREN+', "'+aTab.getAttribute(this.kID)+'")]', + 'parent::*/child::xul:tab[contains(@'+this.kCHILDREN+', "'+id+'")]', aTab, XPathResult.FIRST_ORDERED_NODE_TYPE ).singleNodeValue; @@ -1869,7 +1871,6 @@ catch(e) { { if (!aTab) return null; - var id = aTab.getAttribute(this.kID); var parentTab = this.getParentTab(aTab); if (!parentTab) { @@ -1884,7 +1885,7 @@ catch(e) { var b = this.getTabBrowserFromChildren(aTab); var children = parentTab.getAttribute(this.kCHILDREN); if (children) { - var list = ('|'+children).split('|'+id)[1].split('|'); + var list = ('|'+children).split('|'+aTab.getAttribute(this.kID))[1].split('|'); for (var i = 0, maxi = list.length; i < maxi; i++) { var firstChild = this.getTabById(list[i], b); @@ -1898,7 +1899,6 @@ catch(e) { { if (!aTab) return null; - var id = aTab.getAttribute(this.kID); var parentTab = this.getParentTab(aTab); if (!parentTab) { @@ -1913,7 +1913,7 @@ catch(e) { var b = this.getTabBrowserFromChildren(aTab); var children = parentTab.getAttribute(this.kCHILDREN); if (children) { - var list = ('|'+children).split('|'+id)[0].split('|'); + var list = ('|'+children).split('|'+aTab.getAttribute(this.kID))[0].split('|'); for (var i = list.length-1; i > -1; i--) { var lastChild = this.getTabById(list[i], b) @@ -2303,10 +2303,12 @@ catch(e) { if (!aInfo) aInfo = {}; var id = aChild.getAttribute(this.kID); - var b = this.getTabBrowserFromChildren(aParent); + if (!id || !aParent.getAttribute(this.kID)) + return; // if the tab is not initialized yet, do nothing. this.partTab(aChild, true); + var b = this.getTabBrowserFromChildren(aParent); var children = aParent.getAttribute(this.kCHILDREN); var newIndex; @@ -2625,7 +2627,7 @@ catch(e) { expandedParentTabs = expandedParentTabs.join('|'); var xpathResult = this.evaluateXPath( - 'child::xul:tab[@'+this.kCHILDREN+' and not(@'+this.kCOLLAPSED+'="true") and not(@'+this.kSUBTREE_COLLAPSED+'="true") and not(contains("'+expandedParentTabs+'", @'+this.kID+'))]', + 'child::xul:tab[@'+this.kCHILDREN+' and not(@'+this.kCOLLAPSED+'="true") and not(@'+this.kSUBTREE_COLLAPSED+'="true") and @'+this.kID+' and not(contains("'+expandedParentTabs+'", @'+this.kID+'))]', b.mTabContainer ); var collapseTab;