From f5d8a093f2cc25b5094327b80407bf9f8725e634 Mon Sep 17 00:00:00 2001 From: Tobie Langel Date: Sun, 28 Sep 2008 19:14:17 +0200 Subject: [PATCH] More clean-up to array.js. --- src/array.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/array.js b/src/array.js index 9b3ef3e..0976ea9 100644 --- a/src/array.js +++ b/src/array.js @@ -31,13 +31,15 @@ Array.from = $A; (function() { var arrayProto = Array.prototype, - slice = arrayProto.slice; + slice = arrayProto.slice, + _each = arrayProto.forEach; // use native browser JS 1.6 implementation if available function each(iterator) { for (var i = 0, length = this.length; i < length; i++) iterator(this[i]); } - + if (!_each) _each = each; + function clear() { this.length = 0; return this; @@ -150,7 +152,6 @@ Array.from = $A; if (!arrayProto._reverse) arrayProto._reverse = arrayProto.reverse; - var _each = 'forEach' in arrayProto ? arrayProto.forEach : each; Object.extend(arrayProto, { _each: _each, clear: clear,