-
Notifications
You must be signed in to change notification settings - Fork 400
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(engine): never use a dot notation of patched objects #410
Conversation
@@ -36,7 +36,9 @@ const eventShadowDescriptors: PropertyDescriptorMap = { | |||
return currentTarget; | |||
} | |||
return patchShadowDomTraversalMethods(currentTarget); | |||
} | |||
}, | |||
enumerable: true, |
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.
@ravijayaramappa this fixes the issue that you mentioned for target and current target.
@@ -182,7 +185,7 @@ function getWrappedRootListener(vm: VM, listener: EventListener): WrappedListene | |||
// it is coming from an slotted element | |||
isChildNode(getRootNode.call(target, event), currentTarget as Node) || | |||
// it is not composed and its is coming from from shadow | |||
(composed === false && getRootNode.call(event.target) === currentTarget)) { | |||
(composed === false && getRootNode.call(target) === currentTarget)) { |
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 were using the event.target
that was returning an already retargeted target.
@@ -318,7 +321,8 @@ function detachDOMListener(vm: VM, type: string, wrappedListener: WrappedListene | |||
|
|||
const NON_COMPOSED = { composed: false }; | |||
export function isValidEventForCustomElement(event: Event): boolean { | |||
const { target, currentTarget } = event; | |||
const target = eventTargetGetter.call(event); |
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.
never use the . notation at the low level, use the cached getter to avoid getting a patched value.
Benchmark resultsBase commit: lwc-engine-benchmark
|
Details
Does this PR introduce a breaking change?