Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

stsvilik
Copy link

@stsvilik stsvilik commented Oct 1, 2013

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.

…event handlers residing on the same scope to execute.
@mary-poppins
Copy link

Thanks for the PR!

  • Contributor signed CLA now or in the past
    • If you just signed, leave a comment here with your real name
  • PR's commit messages follow the commit message format

If you need to make changes to your pull request, you can update the commit with git commit --amend.
Then, update the pull request with git push -f.

Thanks again for your help!

@stsvilik
Copy link
Author

stsvilik commented Oct 1, 2013

CLA Signed, real name: Simon Tsvilik

@petebacondarwin
Copy link
Contributor

Thanks @stsvilik

jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
All sibling event handlers residing on the same scope to were stopped
if one of them called stopPropagation.

Closes angular#4204
jamesdaily pushed a commit to jamesdaily/angular.js that referenced this pull request Jan 27, 2014
All sibling event handlers residing on the same scope to were stopped
if one of them called stopPropagation.

Closes angular#4204
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants