Performance enhancements to . Closes #9464
This commit is contained in:
parent
7dda50a7c9
commit
941359b2f7
@ -1,5 +1,7 @@
|
||||
*SVN*
|
||||
|
||||
* Performance enhancements to $A. Closes #9464. [Samuel Lebeau]
|
||||
|
||||
* Make Function#argumentNames work with named functions. Closes #9826. [Samuel Lebeau]
|
||||
|
||||
* Add Object.isHash. [Tobie Langel]
|
||||
|
23
src/array.js
23
src/array.js
@ -1,26 +1,19 @@
|
||||
function $A(iterable) {
|
||||
if (!iterable) return [];
|
||||
if (iterable.toArray) return iterable.toArray();
|
||||
else {
|
||||
var results = [];
|
||||
for (var i = 0, length = iterable.length; i < length; i++)
|
||||
results.push(iterable[i]);
|
||||
return results;
|
||||
}
|
||||
var length = iterable.length, results = new Array(length);
|
||||
while (length--) results[length] = iterable[length];
|
||||
return results;
|
||||
}
|
||||
|
||||
if (Prototype.Browser.WebKit) {
|
||||
function $A(iterable) {
|
||||
if (!iterable) return [];
|
||||
if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') &&
|
||||
iterable.toArray) {
|
||||
return iterable.toArray();
|
||||
} else {
|
||||
var results = [];
|
||||
for (var i = 0, length = iterable.length; i < length; i++)
|
||||
results.push(iterable[i]);
|
||||
return results;
|
||||
}
|
||||
if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') &&
|
||||
iterable.toArray) return iterable.toArray();
|
||||
var length = iterable.length, results = new Array(length);
|
||||
while (length--) results[length] = iterable[length];
|
||||
return results;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user