-
Notifications
You must be signed in to change notification settings - Fork 27.5k
Fix for event.stopPropagation() and $emit method #3639
Conversation
Changing $document.find to angular.element permits more complex selectors when using jQuery. Otherwise you're limited to selecting only by ID's and element tags which is very restricting in the real life testing scenarios.
Hidden fields are still used in hybrid solutions such as MVC.net/etc. and it is valuable to be able to set value of this type of field through ng-model.
Extend function of Angular blindly overwrites destination values even if source value is undefined. This fix allows "default" values to remain intact if new value is undefined.
- re-applied the fix to the $emit method - improved the the unit test - fixed spacing issue
Thanks for the PR!
If you need to make changes to your pull request, you can update the commit with Thanks again for your help! |
CLA signed, I tried to clean-up my pull request history but not sure if it worked :/. Github blows when it comes to cherry-picking what you want to PULL. So for clarification sake, my pull should only be for c0c5d8e. |
This PR is a mess, but the final diff looks ok. |
Agreed (re:mess) this was due to some old PR's that were done w/o following formal commit instructions (sorry for that), so I had to revert them. It also took me a while to get into the PR procedure flow. I promise it will not happen again. |
It's ok. Just rebase and squash them (see |
When now? :) or you talking about the future PR's? |
For this one, as well as in the future. :) |
whoops, wrong thread. ignore me :) |
I'm going to close this for now due to inactivity. If you can rebase against master and clean up the commit history, I'd be happy to re-open this. |
Brian I had to start from the very beginning. Please refer to the new pull request I created: #4204 Thank You |
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)
b) Somewhere else on the same scope, perhaps inside other directive or controller
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.