Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
dummdidumm authored Nov 21, 2024
1 parent d50c994 commit 33b5434
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions packages/svelte/src/internal/client/dom/elements/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,6 @@ export function set_attributes(

// @ts-expect-error
var attributes = /** @type {Record<string, unknown>} **/ (element.__attributes ??= {});
/** @type {Array<[string, any, () => void]>} */
var events = [];

// since key is captured we use const
for (const key in next) {
Expand Down Expand Up @@ -277,15 +275,7 @@ export function set_attributes(
current[key].call(this, evt);
}

if (!prev) {
events.push([
key,
value,
() => (current[event_handle_key] = create_event(event_name, element, handle, opts))
]);
} else {
current[event_handle_key] = create_event(event_name, element, handle, opts);
}
current[event_handle_key] = create_event(event_name, element, handle, opts);
} else {
// @ts-ignore
element[`__${event_name}`] = value;
Expand Down Expand Up @@ -325,12 +315,6 @@ export function set_attributes(
}
}

for (const [key, value, evt] of events) {
if (current[key] === value) {
evt();
}
}

return current;
}

Expand Down

0 comments on commit 33b5434

Please sign in to comment.