aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/vdom.ffi.mjs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/vdom.ffi.mjs b/src/vdom.ffi.mjs
index 8d5c287..2e1e46c 100644
--- a/src/vdom.ffi.mjs
+++ b/src/vdom.ffi.mjs
@@ -429,15 +429,17 @@ function createElementNode({ prev, next, dispatch, stack }) {
const registeredHandlers = new WeakMap();
function lustreGenericEventHandler(event) {
- if (!registeredHandlers.has(event.target)) {
- event.target.removeEventListener(event.type, lustreGenericEventHandler);
+ const target = event.currentTarget;
+
+ if (!registeredHandlers.has(target)) {
+ target.removeEventListener(event.type, lustreGenericEventHandler);
return;
}
- const handlersForEventTarget = registeredHandlers.get(event.target);
+ const handlersForEventTarget = registeredHandlers.get(target);
if (!handlersForEventTarget.has(event.type)) {
- event.target.removeEventListener(event.type, lustreGenericEventHandler);
+ target.removeEventListener(event.type, lustreGenericEventHandler);
return;
}