Skip to content

Commit 929d634

Browse files
committed
captured the correct value for next instead of using key
1 parent d1f5d5d commit 929d634

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/svelte/src/internal/client/dom/elements/attributes.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,9 @@ export function set_attributes(element, prev, next, lowercase_attributes, css_ha
192192
events.push([
193193
key,
194194
value,
195-
() => (next[key] = create_event(event_name, element, value, opts))
195+
// since key is a var, when calling this in a later point, it will point the last value it had
196+
// hence we can't do that and we have to do this instead
197+
() => (next[`on${event_name}`] = create_event(event_name, element, value, opts))
196198
]);
197199
} else {
198200
next[key] = create_event(event_name, element, value, opts);

0 commit comments

Comments
 (0)