From ba24a8170534f75ed99a2ef80b0f585c7e9f1747 Mon Sep 17 00:00:00 2001 From: Thomas Heymann Date: Thu, 24 Apr 2014 09:39:25 +0100 Subject: [PATCH] optimized removing views from layouts --- assembler.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/assembler.js b/assembler.js index e6b6f97..e69a06d 100644 --- a/assembler.js +++ b/assembler.js @@ -268,7 +268,7 @@ removeView: function(destination, index) { var viewToRemove = (typeof destination === 'string') ? this.getView(destination, index) : destination; if (viewToRemove) { - var done; + var keepIterating; _.each(this._byDestination, function(byMethod, selector) { _.each(byMethod, function(views, method) { _.each(views, function(view, index) { @@ -277,10 +277,13 @@ this._byDestination[selector][method].splice(index, 1); this.views = _.without(this.views, viewToRemove); - return false; + + return keepIterating = false; } }, this); + return keepIterating; }, this); + return keepIterating; }, this); } },