最後のツリーが選択され、且つ子孫が折り畳まれている状態で、

そのタブを閉じた時に、何もタブが選択されていない状態に
なってしまっていたのを修正

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@1642 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2007-11-29 16:49:18 +00:00
parent 3df1477812
commit 859dc17619

View File

@ -100,6 +100,23 @@ TreeStyleTabBrowser.prototype = {
var selectNewTab = '_selectNewTab' in b.mTabContainer ? '_selectNewTab' : 'selectNewTab' ; // Fx3 / Fx2
/* Closing collapsed last tree breaks selected tab.
To solve this problem, I override the setter to
force to set a tab and forbid it becomes null. */
var getter = b.__lookupGetter__('selectedTab');
var setter = b.__lookupSetter__('selectedTab');
eval('setter = '+setter.toSource().replace(
'{',
'{ if (!val) val = this.mTabContainer.lastChild;'
));
/* We have to use both __defineSetter__ and __defineGetter__
just in same time!! If we update only setter,
getter will be vanished. */
b.__defineGetter__('selectedTab', getter);
b.__defineSetter__('selectedTab', setter);
eval('b.mTabContainer.'+selectNewTab+' = '+
b.mTabContainer[selectNewTab].toSource().replace(
'{',