cleanUpTabsArrayの実装を改善
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@3814 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
b9c6aa5e34
commit
fe1fdbf014
@ -1778,19 +1778,14 @@ catch(e) {
|
|||||||
|
|
||||||
cleanUpTabsArray : function(aTabs)
|
cleanUpTabsArray : function(aTabs)
|
||||||
{
|
{
|
||||||
var b = this.getTabBrowserFromChild(aTabs[0]);
|
var newTabs = [];
|
||||||
|
aTabs.forEach(function(aTab) {
|
||||||
aTabs = aTabs.map(function(aTab) {
|
if (newTabs.indexOf(aTab) < 0) newTabs.push(aTab);
|
||||||
return aTab.getAttribute(this.kID);
|
});
|
||||||
}, this);
|
newTabs.sort(function(aA, aB) {
|
||||||
aTabs.sort();
|
return aA._tPos - aB._tPos;
|
||||||
aTabs = aTabs.join('|').replace(/([^\|]+)(\|\1)+/g, '$1').split('|');
|
});
|
||||||
|
return newTabs;
|
||||||
for (var i = 0, maxi = aTabs.length; i < maxi; i++)
|
|
||||||
{
|
|
||||||
aTabs[i] = b.treeStyleTab.getTabById(aTabs[i]);
|
|
||||||
}
|
|
||||||
return aTabs;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
bookmarkTabSubTree : function(aTabOrTabs)
|
bookmarkTabSubTree : function(aTabOrTabs)
|
||||||
|
@ -226,12 +226,17 @@ function test_setAndGetTabValue()
|
|||||||
assertSetAndGetTabValue(tabs[2], 'tab2');
|
assertSetAndGetTabValue(tabs[2], 'tab2');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function test_cleanUpTabsArray()
|
||||||
|
{
|
||||||
|
var array = [0, 1, 2, 1, 3, 0]
|
||||||
|
.map(function(aIndex) {
|
||||||
|
return tabs[aIndex]
|
||||||
|
});
|
||||||
|
assert.equals(tabs, Array.slice(sv.cleanUpTabsArray(array)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
sv.cleanUpTabsArray(tabs)
|
|
||||||
|
|
||||||
|
|
||||||
sv.registerAttachTabPostProcess(func)
|
sv.registerAttachTabPostProcess(func)
|
||||||
sv.registerTabFocusAllowance(func)
|
sv.registerTabFocusAllowance(func)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user