diff --git a/packages/happy-dom/src/event/events/InputEvent.ts b/packages/happy-dom/src/event/events/InputEvent.ts index a906d4243..d003ea2c6 100644 --- a/packages/happy-dom/src/event/events/InputEvent.ts +++ b/packages/happy-dom/src/event/events/InputEvent.ts @@ -6,10 +6,10 @@ import IInputEventInit from './IInputEventInit.js'; * */ export default class InputEvent extends UIEvent { - public readonly data: string = ''; - public readonly dataTransfer: DataTransfer = null; - public readonly inputType: string = ''; - public readonly isComposing: boolean = false; + public readonly data: string; + public readonly dataTransfer: DataTransfer; + public readonly inputType: string; + public readonly isComposing: boolean; /** * Constructor. @@ -17,14 +17,12 @@ export default class InputEvent extends UIEvent { * @param type Event type. * @param [eventInit] Event init. */ - constructor(type: string, eventInit: IInputEventInit = null) { + constructor(type: string, eventInit: IInputEventInit = {}) { super(type, eventInit); - if (eventInit) { - this.data = eventInit.data || ''; - this.dataTransfer = eventInit.dataTransfer || null; - this.inputType = eventInit.inputType || ''; - this.isComposing = eventInit.isComposing || false; - } + this.data = eventInit.data ?? ''; + this.dataTransfer = eventInit.dataTransfer ?? null; + this.inputType = eventInit.inputType ?? ''; + this.isComposing = eventInit.isComposing ?? false; } }