jsbook
jsbook copied to clipboard
第4页,Prototype.js $A 方法源码在1.7版本已经更新
代码更新:
function $A(iterable) {
if (!iterable) return [];
// Safari <2.0.4 crashes when accessing property of a node list with property accessor.
// It nevertheless works fine with `in` operator, which is why we use it here
if ('toArray' in Object(iterable)) return iterable.toArray();
var length = iterable.length || 0, results = new Array(length);
while (length--) results[length] = iterable[length];
return results;
}