diff --git a/src/event/dispatchEvent.ts b/src/event/dispatchEvent.ts index 4627296d..1a630714 100644 --- a/src/event/dispatchEvent.ts +++ b/src/event/dispatchEvent.ts @@ -63,11 +63,15 @@ export function dispatchEvent( return wrapEvent(() => target.dispatchEvent(event), target) } +/** + * Dispatch a DOM event without wrapping it with the configured wrapper. + * This is used internally to trigger events that are not triggered natively by JSDOM. + * These should not be wrapped explicitly as they are already executed in the triggering wrapped scope. + */ export function dispatchDOMEvent( target: Element, type: K, init?: EventTypeInit, -) { - const event = createEvent(type, target, init) - wrapEvent(() => target.dispatchEvent(event), target) +): boolean { + return target.dispatchEvent(createEvent(type, target, init)) }