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)
|
||||
{
|
||||
var b = this.getTabBrowserFromChild(aTabs[0]);
|
||||
|
||||
aTabs = aTabs.map(function(aTab) {
|
||||
return aTab.getAttribute(this.kID);
|
||||
}, this);
|
||||
aTabs.sort();
|
||||
aTabs = aTabs.join('|').replace(/([^\|]+)(\|\1)+/g, '$1').split('|');
|
||||
|
||||
for (var i = 0, maxi = aTabs.length; i < maxi; i++)
|
||||
{
|
||||
aTabs[i] = b.treeStyleTab.getTabById(aTabs[i]);
|
||||
}
|
||||
return aTabs;
|
||||
var newTabs = [];
|
||||
aTabs.forEach(function(aTab) {
|
||||
if (newTabs.indexOf(aTab) < 0) newTabs.push(aTab);
|
||||
});
|
||||
newTabs.sort(function(aA, aB) {
|
||||
return aA._tPos - aB._tPos;
|
||||
});
|
||||
return newTabs;
|
||||
},
|
||||
|
||||
bookmarkTabSubTree : function(aTabOrTabs)
|
||||
|
@ -226,12 +226,17 @@ function test_setAndGetTabValue()
|
||||
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.registerTabFocusAllowance(func)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user