From acdc438f13bba91fac079f95054b390d1ccc1d13 Mon Sep 17 00:00:00 2001 From: cpojer Date: Thu, 19 Apr 2012 22:00:43 +0200 Subject: [PATCH] Only add Array.prototype.forEach in !ES5 --- Source/Core/Core.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core.js b/Source/Core/Core.js index 1a80937e..bd3c9dfb 100644 --- a/Source/Core/Core.js +++ b/Source/Core/Core.js @@ -256,7 +256,7 @@ var force = function(name, object, methods){ if (!methodsEnumerable) for (var i = 0, l = methods.length; i < l; i++){ fn.call(prototype, prototype[methods[i]], methods[i]); } - for (var key in prototype) fn.call(prototype, prototype[key], key) + for (var key in prototype) fn.call(prototype, prototype[key], key); }; } @@ -314,11 +314,13 @@ Object.each = Object.forEach; Array.implement({ + /**/ forEach: function(fn, bind){ for (var i = 0, l = this.length; i < l; i++){ if (i in this) fn.call(bind, this[i], i, this); } }, + /**/ each: function(fn, bind){ Array.forEach(this, fn, bind); -- 2.11.4.GIT