From e6966e05f508d1d2633b9ff327fea912b12555ac Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Tue, 25 Sep 2012 01:09:26 -0700 Subject: [PATCH] fix(Scope): allow removing a listener during event --- src/ng/rootScope.js | 28 ++++++++++++++--- test/ng/rootScopeSpec.js | 68 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+), 5 deletions(-) diff --git a/src/ng/rootScope.js b/src/ng/rootScope.js index 5754ad32c3f7..de4b7407be12 100644 --- a/src/ng/rootScope.js +++ b/src/ng/rootScope.js @@ -638,7 +638,7 @@ function $RootScopeProvider(){ namedListeners.push(listener); return function() { - arrayRemove(namedListeners, listener); + namedListeners[indexOf(namedListeners, listener)] = null; }; }, @@ -686,6 +686,14 @@ function $RootScopeProvider(){ namedListeners = scope.$$listeners[name] || empty; event.currentScope = scope; for (i=0, length=namedListeners.length; i