diff options
| author | Vojta Jina | 2012-04-27 13:14:46 +0200 |
|---|---|---|
| committer | Vojta Jina | 2012-05-17 15:47:52 -0700 |
| commit | 91db99208e197a73584a88a8d835eeb55c466335 (patch) | |
| tree | e844e6cffe701626be49e3c3345a3af721b945a3 /src/ng/rootScope.js | |
| parent | acf095d1783e30e750d046ef24e81b5a0a31fbd4 (diff) | |
| download | angular.js-91db99208e197a73584a88a8d835eeb55c466335.tar.bz2 | |
refactor(scope.$emit): rename event.cancel() to event.stopPropagation()
Breaks event.cancel() is event.stopPropagation()
Diffstat (limited to 'src/ng/rootScope.js')
| -rw-r--r-- | src/ng/rootScope.js | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/ng/rootScope.js b/src/ng/rootScope.js index a37eda5a..5bd65214 100644 --- a/src/ng/rootScope.js +++ b/src/ng/rootScope.js @@ -616,9 +616,8 @@ function $RootScopeProvider(){ * - `targetScope` - {Scope}: the scope on which the event was `$emit`-ed or `$broadcast`-ed. * - `currentScope` - {Scope}: the current scope which is handling the event. * - `name` - {string}: Name of the event. - * - `cancel` - {function=}: calling `cancel` function will cancel further event propagation + * - `stopPropagation` - {function=}: calling `stopPropagation` function will cancel further event propagation * (available only for events that were `$emit`-ed). - * - `cancelled` - {boolean}: Whether the event was cancelled. */ $on: function(name, listener) { var namedListeners = this.$$listeners[name]; @@ -659,11 +658,11 @@ function $RootScopeProvider(){ var empty = [], namedListeners, scope = this, + stopPropagation = false, event = { name: name, targetScope: scope, - cancel: function() {event.cancelled = true;}, - cancelled: false + stopPropagation: function() {stopPropagation = true;} }, listenerArgs = concat([event], arguments, 1), i, length; @@ -674,7 +673,7 @@ function $RootScopeProvider(){ for (i=0, length=namedListeners.length; i<length; i++) { try { namedListeners[i].apply(null, listenerArgs); - if (event.cancelled) return event; + if (stopPropagation) return event; } catch (e) { $exceptionHandler(e); } |
