New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ivy): ensure eventListeners added outside angular context are not called #34514
Conversation
if (listener.name === getIdentifiableWrappedEventHandlerName()) { | ||
const unwrappedListener = listener(Function); | ||
return invokedListeners.indexOf(unwrappedListener) === -1 && | ||
unwrappedListener.call(node, eventObj); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we use call(node,...)
here, should we also use callback.call(node)
in
angular/packages/core/src/debug/debug_node.ts
Line 430 in cb94a07
callback(eventObj); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I can see, the listeners here are retrieved from the LView
and those would have been registered in the components/component templates. I think the this
context in those functions would be the component class. I made the change because I think it's more correct but I don't think it ends up having downstream effects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I will try to verify it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me as a solution to the problem we worked on.
I'll defer to Misko, et al. for runtime approval though.
f9f197e
to
587a94c
Compare
58d04a3
to
5f5b8aa
Compare
5f5b8aa
to
74e8348
Compare
74e8348
to
874f86e
Compare
c0a9d77
to
d0e14b8
Compare
@atscott FYI, it looks like size checks are failing in |
d0e14b8
to
dc9400b
Compare
… called... by DebugElement.triggerEventHandler. ZoneJS tracks the eventListeners on a node but we need to be able to differentiate between those added by Angular and those that were added outside the Angular context. This fix aligns with the behavior that was present in View Engine (not calling those listeners). If we decide later that we want to call those listeners, we still need a way to differentiate between those that we have wrapped in dom_renderer and those that were not (because they were added outside the Angular context).
dc9400b
to
9cdad74
Compare
… called... (#34514) by DebugElement.triggerEventHandler. ZoneJS tracks the eventListeners on a node but we need to be able to differentiate between those added by Angular and those that were added outside the Angular context. This fix aligns with the behavior that was present in View Engine (not calling those listeners). If we decide later that we want to call those listeners, we still need a way to differentiate between those that we have wrapped in dom_renderer and those that were not (because they were added outside the Angular context). PR Close #34514
… called... (angular#34514) by DebugElement.triggerEventHandler. ZoneJS tracks the eventListeners on a node but we need to be able to differentiate between those added by Angular and those that were added outside the Angular context. This fix aligns with the behavior that was present in View Engine (not calling those listeners). If we decide later that we want to call those listeners, we still need a way to differentiate between those that we have wrapped in dom_renderer and those that were not (because they were added outside the Angular context). PR Close angular#34514
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
View Engine debug node does not call event listeners added outside the Angular context. This PR updates Ivy to mimic that behavior (not calling those listeners either when using
debugElement.triggerEventHandler
)