From 91026a0c775466c6057207f059458300298f2515 Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 30 May 2012 19:25:18 +0200 Subject: [PATCH] throw warning, not error, when returning false from Ox.forEach or Ox.loop --- source/Ox/js/Collection.js | 6 ++++-- source/Ox/js/Core.js | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/source/Ox/js/Collection.js b/source/Ox/js/Collection.js index c079adb3..ffad45c9 100644 --- a/source/Ox/js/Collection.js +++ b/source/Ox/js/Collection.js @@ -158,7 +158,8 @@ Ox.forEach = function(collection, iterator, that) { if (Ox.hasOwn(collection, key)) { // iterator.call(that, collection[key], key, collection); if (iterator.call(that, collection[key], key, collection) === false) { - throw new Error('Returning false in Ox.forEach is deprecated.'); + console.warn('Returning false in Ox.forEach is deprecated.'); + break; } } } @@ -167,7 +168,8 @@ Ox.forEach = function(collection, iterator, that) { if (i in collection) { // iterator.call(that, collection[i], i, collection); if (iterator.call(that, collection[i], i, collection) === false) { - throw new Error('Returning false in Ox.forEach is deprecated.'); + console.warn('Returning false in Ox.forEach is deprecated.'); + break; } } } diff --git a/source/Ox/js/Core.js b/source/Ox/js/Core.js index 1e40d05e..58207c6a 100644 --- a/source/Ox/js/Core.js +++ b/source/Ox/js/Core.js @@ -275,7 +275,8 @@ Ox.loop = function() { for (i = start; step > 0 ? i < stop : i > stop; i += step) { // iterator(i); if (iterator(i) === false) { - throw new Error('Returning false in Ox.loop is deprecated.'); + console.warn('Returning false in Ox.loop is deprecated.'); + break; } } } catch (error) {