use custom event constructor

pull/8474/head
Austin John Mayer (井上 オースティン) 3 years ago
parent a3d8b01ea5
commit baf48f7e77

@ -742,9 +742,7 @@ export function toggle_class(element, name, toggle) {
}
export function custom_event<T = any>(type: string, detail?: T, { bubbles = false, cancelable = false } = {}): CustomEvent<T> {
const e: CustomEvent<T> = document.createEvent('CustomEvent');
e.initCustomEvent(type, bubbles, cancelable, detail);
return e;
return new CustomEvent(type, { detail, bubbles, cancelable });
}
export function query_selector_all(selector: string, parent: HTMLElement = document.body) {

Loading…
Cancel
Save