Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/forty-comics-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: handle undefined bubble events
2 changes: 1 addition & 1 deletion packages/svelte/src/internal/client/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,7 @@ export function bubble_event($$props, event) {
const events = /** @type {Record<string, Function[] | Function>} */ (unwrap($$props).$$events)?.[
event.type
];
const callbacks = is_array(events) ? events.slice() : [events];
const callbacks = is_array(events) ? events.slice() : events == null ? [] : [events];
let fn;
for (fn of callbacks) {
// Preserve "this" context
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { flushSync } from 'svelte';
import { test } from '../../test';

export default test({
async test({ assert, target }) {
const input = target.querySelector('input');

flushSync(() => {
input?.click();
});

assert.htmlEqual(target.innerHTML, `<input>`);
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<input on:click />