diff --git a/packages/happy-dom/src/event/events/SubmitEvent.ts b/packages/happy-dom/src/event/events/SubmitEvent.ts index 773ace36e..882460e6e 100644 --- a/packages/happy-dom/src/event/events/SubmitEvent.ts +++ b/packages/happy-dom/src/event/events/SubmitEvent.ts @@ -6,7 +6,7 @@ import IHTMLElement from '../../nodes/html-element/IHTMLElement.js'; * An event triggered by form submit buttons. */ export default class SubmitEvent extends Event { - public readonly submitter: IHTMLElement; + public readonly submitter: IHTMLElement | null; /** * Constructor. @@ -14,9 +14,9 @@ export default class SubmitEvent extends Event { * @param type Event type. * @param [eventInit] Event init. */ - constructor(type: string, eventInit: ISubmitEventInit = null) { + constructor(type: string, eventInit: ISubmitEventInit = {}) { super(type, eventInit); - this.submitter = eventInit?.submitter || null; + this.submitter = eventInit.submitter ?? null; } }