Skip to content

Commit

Permalink
Bubble svelte dev events (sveltejs#5994)
Browse files Browse the repository at this point in the history
  • Loading branch information
RedHatter authored Jun 26, 2021
1 parent 7bf3f20 commit 46fac82
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/runtime/internal/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { custom_event, append, insert, detach, listen, attr } from './dom';
import { SvelteComponent } from './Component';

export function dispatch_dev<T=any>(type: string, detail?: T) {
document.dispatchEvent(custom_event(type, { version: '__VERSION__', ...detail }));
document.dispatchEvent(custom_event(type, { version: '__VERSION__', ...detail }, true));
}

export function append_dev(target: Node, node: Node) {
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/internal/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -521,9 +521,9 @@ export function toggle_class(element, name, toggle) {
element.classList[toggle ? 'add' : 'remove'](name);
}

export function custom_event<T=any>(type: string, detail?: T) {
export function custom_event<T=any>(type: string, detail?: T, bubbles: boolean = false) {
const e: CustomEvent<T> = document.createEvent('CustomEvent');
e.initCustomEvent(type, false, false, detail);
e.initCustomEvent(type, bubbles, false, detail);
return e;
}

Expand Down

0 comments on commit 46fac82

Please sign in to comment.