This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
fix(event.stopPropagation()): sibling event handlers should not be cancelled by event.stopPropagation() #4204
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fix addresses an issue where event.stopPropagation() prematurely ends execution of event listeners assigned to the same scope from which they are $emit-ted.
For example you assign 2 listeners to the same scope:
a)
scope.on('myEvent', function(evt) {
evt.stopPropagation();
//Do something
});
b) Somewhere else on the same scope, perhaps inside other directive or controller
scope.on('myEvent', function(evt) {
//Do something else
});
Currently handler in 'a' will prevent handler 'b' from executing even though they are on the same exact scope, but this is not the intention of the stopPropagation() function. Intention is to prevent 'myEvent' from bubbling into $parent scope.
If we take jQuery or just plain DOM eventing model, we'll see that stopPropagation does NOT prevent multiple handlers that are attached to the same node from firing.