From 3218bf9584ad4e2f5552cd0c51dd47c719a19f2a Mon Sep 17 00:00:00 2001 From: Wojciech Maj Date: Wed, 8 Jan 2025 23:30:06 +0100 Subject: [PATCH] chore: [#0] Improve type accuracy, strict mode compatibility and JSDoc documentation (#1677) --- .../async-task-manager/AsyncTaskManager.ts | 2 +- .../detached-browser/DetachedBrowser.ts | 2 +- .../utilities/BrowserExceptionObserver.ts | 13 ++-- .../utilities/BrowserFrameNavigator.ts | 14 ++-- .../happy-dom/src/console/VirtualConsole.ts | 45 +++++++----- .../cookie/urilities/CookieExpireUtility.ts | 2 +- .../CSSStyleDeclarationComputedStyle.ts | 4 +- .../CSSStyleDeclarationPropertyGetParser.ts | 38 +++++------ packages/happy-dom/src/fetch/Fetch.ts | 4 +- .../happy-dom/src/nodes/element/Element.ts | 68 +++++++++---------- .../html-body-element/HTMLBodyElement.ts | 36 +++++----- .../html-canvas-element/HTMLCanvasElement.ts | 10 +-- .../HTMLDetailsElement.ts | 2 +- .../html-dialog-element/HTMLDialogElement.ts | 4 +- .../src/nodes/html-element/HTMLElement.ts | 50 +++++++------- .../html-form-element/HTMLFormElement.ts | 6 +- .../html-iframe-element/HTMLIFrameElement.ts | 4 +- .../html-input-element/HTMLInputElement.ts | 6 +- .../html-media-element/HTMLMediaElement.ts | 46 ++++++------- .../nodes/html-media-element/MediaStream.ts | 4 +- .../html-media-element/MediaStreamTrack.ts | 6 +- .../html-select-element/HTMLSelectElement.ts | 4 +- .../html-slot-element/HTMLSlotElement.ts | 2 +- .../HTMLTextAreaElement.ts | 4 +- .../src/nodes/shadow-root/ShadowRoot.ts | 2 +- .../SVGAnimationElement.ts | 6 +- .../src/nodes/svg-element/SVGElement.ts | 12 ++-- .../SVGGraphicsElement.ts | 6 +- .../nodes/svg-svg-element/SVGSVGElement.ts | 36 +++++----- packages/happy-dom/src/svg/SVGAngle.ts | 4 +- .../happy-dom/src/svg/SVGAnimatedBoolean.ts | 4 +- .../happy-dom/src/svg/SVGAnimatedInteger.ts | 4 +- .../happy-dom/src/svg/SVGAnimatedNumber.ts | 4 +- .../happy-dom/src/svg/SVGAnimatedString.ts | 4 +- packages/happy-dom/src/svg/SVGLength.ts | 4 +- packages/happy-dom/src/svg/SVGLengthList.ts | 4 +- packages/happy-dom/src/svg/SVGMatrix.ts | 4 +- packages/happy-dom/src/svg/SVGNumber.ts | 4 +- packages/happy-dom/src/svg/SVGNumberList.ts | 4 +- packages/happy-dom/src/svg/SVGPoint.ts | 4 +- packages/happy-dom/src/svg/SVGPointList.ts | 4 +- .../src/svg/SVGPreserveAspectRatio.ts | 4 +- packages/happy-dom/src/svg/SVGRect.ts | 4 +- packages/happy-dom/src/svg/SVGStringList.ts | 4 +- .../happy-dom/src/svg/SVGTransformList.ts | 4 +- .../XMLHttpRequestEventTarget.ts | 2 +- 46 files changed, 258 insertions(+), 246 deletions(-) diff --git a/packages/happy-dom/src/async-task-manager/AsyncTaskManager.ts b/packages/happy-dom/src/async-task-manager/AsyncTaskManager.ts index c5cf4ba0d..76918c7e9 100644 --- a/packages/happy-dom/src/async-task-manager/AsyncTaskManager.ts +++ b/packages/happy-dom/src/async-task-manager/AsyncTaskManager.ts @@ -16,7 +16,7 @@ export default class AsyncTaskManager { private runningTaskCount = 0; private runningTimers: NodeJS.Timeout[] = []; private runningImmediates: NodeJS.Immediate[] = []; - private waitUntilCompleteTimer: NodeJS.Immediate | null = null; + private waitUntilCompleteTimer: NodeJS.Timeout | null = null; private waitUntilCompleteResolvers: Array<() => void> = []; private aborted = false; private destroyed = false; diff --git a/packages/happy-dom/src/browser/detached-browser/DetachedBrowser.ts b/packages/happy-dom/src/browser/detached-browser/DetachedBrowser.ts index 679c47097..a9a97132a 100644 --- a/packages/happy-dom/src/browser/detached-browser/DetachedBrowser.ts +++ b/packages/happy-dom/src/browser/detached-browser/DetachedBrowser.ts @@ -69,7 +69,7 @@ export default class DetachedBrowser implements IBrowser { await Promise.all(this.contexts.slice().map((context) => context.close())); (this.contexts) = []; (this.console) = null; - ( BrowserWindow | null>this.windowClass) = null; + (<(new (browserFrame: IBrowserFrame) => BrowserWindow) | null>this.windowClass) = null; } /** diff --git a/packages/happy-dom/src/browser/utilities/BrowserExceptionObserver.ts b/packages/happy-dom/src/browser/utilities/BrowserExceptionObserver.ts index fbc68bb03..0c3072d4b 100644 --- a/packages/happy-dom/src/browser/utilities/BrowserExceptionObserver.ts +++ b/packages/happy-dom/src/browser/utilities/BrowserExceptionObserver.ts @@ -6,11 +6,10 @@ import BrowserWindow from '../../window/BrowserWindow.js'; export default class BrowserExceptionObserver { private static listenerCount = 0; private observedWindows: BrowserWindow[] = []; - private uncaughtExceptionListener: ( - error: Error, - origin: 'uncaughtException' | 'unhandledRejection' - ) => void | null; - private uncaughtRejectionListener: (error: Error) => void | null; + private uncaughtExceptionListener: + | ((error: Error, origin: 'uncaughtException' | 'unhandledRejection') => void) + | null = null; + private uncaughtRejectionListener: ((error: Error) => void) | null = null; /** * Observes the Node process for uncaught exceptions. @@ -117,7 +116,9 @@ export default class BrowserExceptionObserver { if (this.observedWindows.length === 0 && this.uncaughtExceptionListener) { (this.constructor).listenerCount--; process.off('uncaughtException', this.uncaughtExceptionListener); - process.off('unhandledRejection', this.uncaughtRejectionListener); + if (this.uncaughtRejectionListener) { + process.off('unhandledRejection', this.uncaughtRejectionListener); + } this.uncaughtExceptionListener = null; this.uncaughtRejectionListener = null; } diff --git a/packages/happy-dom/src/browser/utilities/BrowserFrameNavigator.ts b/packages/happy-dom/src/browser/utilities/BrowserFrameNavigator.ts index 9b076610b..97e20272a 100644 --- a/packages/happy-dom/src/browser/utilities/BrowserFrameNavigator.ts +++ b/packages/happy-dom/src/browser/utilities/BrowserFrameNavigator.ts @@ -34,12 +34,12 @@ export default class BrowserFrameNavigator { windowClass: new ( browserFrame: IBrowserFrame, options?: { url?: string; width?: number; height?: number } - ) => BrowserWindow; + ) => BrowserWindow | null; frame: IBrowserFrame; url: string; goToOptions?: IGoToOptions; method?: string; - formData?: FormData; + formData?: FormData | null; disableHistory?: boolean; }): Promise { const { windowClass, frame, url, formData, method, goToOptions, disableHistory } = options; @@ -235,7 +235,7 @@ export default class BrowserFrameNavigator { // The frame may be destroyed during teardown. if (!frame.window) { - return; + return null; } // Fixes issue where evaluating the response can throw an error. @@ -265,7 +265,7 @@ export default class BrowserFrameNavigator { windowClass: new ( browserFrame: IBrowserFrame, options?: { url?: string; width?: number; height?: number } - ) => BrowserWindow; + ) => BrowserWindow | null; frame: IBrowserFrame; goToOptions?: IGoToOptions; }): Promise { @@ -324,7 +324,7 @@ export default class BrowserFrameNavigator { windowClass: new ( browserFrame: IBrowserFrame, options?: { url?: string; width?: number; height?: number } - ) => BrowserWindow; + ) => BrowserWindow | null; frame: IBrowserFrame; goToOptions?: IGoToOptions; }): Promise { @@ -384,7 +384,7 @@ export default class BrowserFrameNavigator { windowClass: new ( browserFrame: IBrowserFrame, options?: { url?: string; width?: number; height?: number } - ) => BrowserWindow; + ) => BrowserWindow | null; frame: IBrowserFrame; goToOptions?: IGoToOptions; steps?: number; @@ -448,7 +448,7 @@ export default class BrowserFrameNavigator { windowClass: new ( browserFrame: IBrowserFrame, options?: { url?: string; width?: number; height?: number } - ) => BrowserWindow; + ) => BrowserWindow | null; frame: IBrowserFrame; goToOptions?: IGoToOptions; }): Promise { diff --git a/packages/happy-dom/src/console/VirtualConsole.ts b/packages/happy-dom/src/console/VirtualConsole.ts index e5d031cbd..b2e44f5de 100644 --- a/packages/happy-dom/src/console/VirtualConsole.ts +++ b/packages/happy-dom/src/console/VirtualConsole.ts @@ -33,14 +33,15 @@ export default class VirtualConsole implements Console { * Writes an error message to the console if the assertion is false. If the assertion is true, nothing happens. * * @param assertion Assertion. + * @param message Message. * @param args Arguments. */ - public assert(assertion: boolean, ...args: Array): void { + public assert(assertion: boolean, message?: any, ...args: Array): void { if (!assertion) { this.#printer.print({ type: VirtualConsoleLogTypeEnum.assert, level: VirtualConsoleLogLevelEnum.error, - message: ['Assertion failed:', ...args], + message: ['Assertion failed:', ...(message ? [message, ...args] : args)], group: this.#groups[this.#groups.length - 1] || null }); } @@ -92,13 +93,14 @@ export default class VirtualConsole implements Console { /** * Outputs a message to the web console at the "debug" log level. * + * @param message Message. * @param args Arguments. */ - public debug(...args: Array): void { + public debug(message?: any, ...args: Array): void { this.#printer.print({ type: VirtualConsoleLogTypeEnum.debug, level: VirtualConsoleLogLevelEnum.log, - message: args, + message: message ? [message, ...args] : args, group: this.#groups[this.#groups.length - 1] || null }); } @@ -108,7 +110,7 @@ export default class VirtualConsole implements Console { * * @param data Data. */ - public dir(data: object): void { + public dir(data: any): void { this.#printer.print({ type: VirtualConsoleLogTypeEnum.dir, level: VirtualConsoleLogLevelEnum.log, @@ -122,7 +124,7 @@ export default class VirtualConsole implements Console { * * @param data Data. */ - public dirxml(data: object): void { + public dirxml(data: any[]): void { this.#printer.print({ type: VirtualConsoleLogTypeEnum.dirxml, level: VirtualConsoleLogLevelEnum.log, @@ -134,13 +136,14 @@ export default class VirtualConsole implements Console { /** * Outputs an error message to the console. * + * @param message Message. * @param args Arguments. */ - public error(...args: Array): void { + public error(message?: any, ...args: Array): void { this.#printer.print({ type: VirtualConsoleLogTypeEnum.error, level: VirtualConsoleLogLevelEnum.error, - message: args, + message: message ? [message, ...args] : args, group: this.#groups[this.#groups.length - 1] || null }); } @@ -211,14 +214,16 @@ export default class VirtualConsole implements Console { } /** + * Outputs an informational message to the console. * - * @param args + * @param message Message. + * @param args Arguments. */ - public info(...args: Array): void { + public info(message?: any, ...args: Array): void { this.#printer.print({ type: VirtualConsoleLogTypeEnum.info, level: VirtualConsoleLogLevelEnum.info, - message: args, + message: message ? [message, ...args] : args, group: this.#groups[this.#groups.length - 1] || null }); } @@ -226,13 +231,14 @@ export default class VirtualConsole implements Console { /** * Outputs a message to the console. * + * @param message Message. * @param args Arguments. */ - public log(...args: Array): void { + public log(message?: any, ...args: Array): void { this.#printer.print({ type: VirtualConsoleLogTypeEnum.log, level: VirtualConsoleLogLevelEnum.log, - message: args, + message: message ? [message, ...args] : args, group: this.#groups[this.#groups.length - 1] || null }); } @@ -329,13 +335,17 @@ export default class VirtualConsole implements Console { /** * Outputs a stack trace to the console. * + * @param message Message. * @param args Arguments. */ - public trace(...args: Array): void { + public trace(message?: any, ...args: Array): void { this.#printer.print({ type: VirtualConsoleLogTypeEnum.trace, level: VirtualConsoleLogLevelEnum.log, - message: [...args, new Error('stack').stack.replace('Error: stack', '')], + message: [ + ...(message ? [message, ...args] : args), + new Error('stack').stack!.replace('Error: stack', '') + ], group: this.#groups[this.#groups.length - 1] || null }); } @@ -343,13 +353,14 @@ export default class VirtualConsole implements Console { /** * Outputs a warning message to the console. * + * @param message Message. * @param args Arguments. */ - public warn(...args: Array): void { + public warn(message?: any, ...args: Array): void { this.#printer.print({ type: VirtualConsoleLogTypeEnum.warn, level: VirtualConsoleLogLevelEnum.warn, - message: args, + message: message ? [message, ...args] : args, group: this.#groups[this.#groups.length - 1] || null }); } diff --git a/packages/happy-dom/src/cookie/urilities/CookieExpireUtility.ts b/packages/happy-dom/src/cookie/urilities/CookieExpireUtility.ts index 818f81abf..89d65e461 100644 --- a/packages/happy-dom/src/cookie/urilities/CookieExpireUtility.ts +++ b/packages/happy-dom/src/cookie/urilities/CookieExpireUtility.ts @@ -10,7 +10,7 @@ export default class CookieExpireUtility { * @param cookie Cookie. * @returns "true" if cookie has expired. */ - public static hasExpired(cookie: ICookie): boolean { + public static hasExpired(cookie: ICookie): boolean | null { return cookie.expires && cookie.expires.getTime() < Date.now(); } } diff --git a/packages/happy-dom/src/css/declaration/computed-style/CSSStyleDeclarationComputedStyle.ts b/packages/happy-dom/src/css/declaration/computed-style/CSSStyleDeclarationComputedStyle.ts index 31159d4a9..1cbb04576 100644 --- a/packages/happy-dom/src/css/declaration/computed-style/CSSStyleDeclarationComputedStyle.ts +++ b/packages/happy-dom/src/css/declaration/computed-style/CSSStyleDeclarationComputedStyle.ts @@ -287,8 +287,8 @@ export default class CSSStyleDeclarationComputedStyle { private parseCSSRules(options: { cssRules: CSSRule[]; elements: IStyleAndElement[]; - rootElement?: IStyleAndElement; - hostElement?: IStyleAndElement; + rootElement?: IStyleAndElement | null; + hostElement?: IStyleAndElement | null; }): void { if (!options.elements.length) { return; diff --git a/packages/happy-dom/src/css/declaration/property-manager/CSSStyleDeclarationPropertyGetParser.ts b/packages/happy-dom/src/css/declaration/property-manager/CSSStyleDeclarationPropertyGetParser.ts index 7146b3462..65b44de2d 100644 --- a/packages/happy-dom/src/css/declaration/property-manager/CSSStyleDeclarationPropertyGetParser.ts +++ b/packages/happy-dom/src/css/declaration/property-manager/CSSStyleDeclarationPropertyGetParser.ts @@ -13,7 +13,7 @@ export default class CSSStyleDeclarationPropertyGetParser { */ public static getMargin(properties: { [k: string]: ICSSStyleDeclarationPropertyValue; - }): ICSSStyleDeclarationPropertyValue { + }): ICSSStyleDeclarationPropertyValue | null { return this.getPaddingLikeProperty( ['margin-top', 'margin-right', 'margin-bottom', 'margin-left'], properties @@ -28,7 +28,7 @@ export default class CSSStyleDeclarationPropertyGetParser { */ public static getPadding(properties: { [k: string]: ICSSStyleDeclarationPropertyValue; - }): ICSSStyleDeclarationPropertyValue { + }): ICSSStyleDeclarationPropertyValue | null { return this.getPaddingLikeProperty( ['padding-top', 'padding-right', 'padding-bottom', 'padding-left'], properties @@ -43,7 +43,7 @@ export default class CSSStyleDeclarationPropertyGetParser { */ public static getOutline(properties: { [k: string]: ICSSStyleDeclarationPropertyValue; - }): ICSSStyleDeclarationPropertyValue { + }): ICSSStyleDeclarationPropertyValue | null { if ( !properties['outline-color']?.value || !properties['outline-style']?.value || @@ -94,7 +94,7 @@ export default class CSSStyleDeclarationPropertyGetParser { */ public static getBorder(properties: { [k: string]: ICSSStyleDeclarationPropertyValue; - }): ICSSStyleDeclarationPropertyValue { + }): ICSSStyleDeclarationPropertyValue | null { if ( !properties['border-top-width']?.value || properties['border-top-width']?.value !== properties['border-right-width']?.value || @@ -200,7 +200,7 @@ export default class CSSStyleDeclarationPropertyGetParser { */ public static getBorderTop(properties: { [k: string]: ICSSStyleDeclarationPropertyValue; - }): ICSSStyleDeclarationPropertyValue { + }): ICSSStyleDeclarationPropertyValue | null { return this.getBorderTopRightBottomLeft('top', properties); } @@ -212,7 +212,7 @@ export default class CSSStyleDeclarationPropertyGetParser { */ public static getBorderRight(properties: { [k: string]: ICSSStyleDeclarationPropertyValue; - }): ICSSStyleDeclarationPropertyValue { + }): ICSSStyleDeclarationPropertyValue | null { return this.getBorderTopRightBottomLeft('right', properties); } @@ -224,7 +224,7 @@ export default class CSSStyleDeclarationPropertyGetParser { */ public static getBorderBottom(properties: { [k: string]: ICSSStyleDeclarationPropertyValue; - }): ICSSStyleDeclarationPropertyValue { + }): ICSSStyleDeclarationPropertyValue | null { return this.getBorderTopRightBottomLeft('bottom', properties); } @@ -236,7 +236,7 @@ export default class CSSStyleDeclarationPropertyGetParser { */ public static getBorderLeft(properties: { [k: string]: ICSSStyleDeclarationPropertyValue; - }): ICSSStyleDeclarationPropertyValue { + }): ICSSStyleDeclarationPropertyValue | null { return this.getBorderTopRightBottomLeft('left', properties); } @@ -248,7 +248,7 @@ export default class CSSStyleDeclarationPropertyGetParser { */ public static getBorderColor(properties: { [k: string]: ICSSStyleDeclarationPropertyValue; - }): ICSSStyleDeclarationPropertyValue { + }): ICSSStyleDeclarationPropertyValue | null { return this.getPaddingLikeProperty( ['border-top-color', 'border-right-color', 'border-bottom-color', 'border-left-color'], properties @@ -263,7 +263,7 @@ export default class CSSStyleDeclarationPropertyGetParser { */ public static getBorderWidth(properties: { [k: string]: ICSSStyleDeclarationPropertyValue; - }): ICSSStyleDeclarationPropertyValue { + }): ICSSStyleDeclarationPropertyValue | null { return this.getPaddingLikeProperty( ['border-top-width', 'border-right-width', 'border-bottom-width', 'border-left-width'], properties @@ -278,7 +278,7 @@ export default class CSSStyleDeclarationPropertyGetParser { */ public static getBorderStyle(properties: { [k: string]: ICSSStyleDeclarationPropertyValue; - }): ICSSStyleDeclarationPropertyValue { + }): ICSSStyleDeclarationPropertyValue | null { return this.getPaddingLikeProperty( ['border-top-style', 'border-right-style', 'border-bottom-style', 'border-left-style'], properties @@ -293,7 +293,7 @@ export default class CSSStyleDeclarationPropertyGetParser { */ public static getBorderRadius(properties: { [k: string]: ICSSStyleDeclarationPropertyValue; - }): ICSSStyleDeclarationPropertyValue { + }): ICSSStyleDeclarationPropertyValue | null { return this.getPaddingLikeProperty( [ 'border-top-left-radius', @@ -313,7 +313,7 @@ export default class CSSStyleDeclarationPropertyGetParser { */ public static getBorderImage(properties: { [k: string]: ICSSStyleDeclarationPropertyValue; - }): ICSSStyleDeclarationPropertyValue { + }): ICSSStyleDeclarationPropertyValue | null { if ( !properties['border-image-source']?.value || !properties['border-image-slice']?.value || @@ -366,7 +366,7 @@ export default class CSSStyleDeclarationPropertyGetParser { */ public static getBackground(properties: { [k: string]: ICSSStyleDeclarationPropertyValue; - }): ICSSStyleDeclarationPropertyValue { + }): ICSSStyleDeclarationPropertyValue | null { if ( !properties['background-image']?.value || !properties['background-repeat']?.value || @@ -489,7 +489,7 @@ export default class CSSStyleDeclarationPropertyGetParser { */ public static getBackgroundPosition(properties: { [k: string]: ICSSStyleDeclarationPropertyValue; - }): ICSSStyleDeclarationPropertyValue { + }): ICSSStyleDeclarationPropertyValue | null { if ( !properties['background-position-x']?.value || !properties['background-position-y']?.value @@ -536,7 +536,7 @@ export default class CSSStyleDeclarationPropertyGetParser { */ public static getFlex(properties: { [k: string]: ICSSStyleDeclarationPropertyValue; - }): ICSSStyleDeclarationPropertyValue { + }): ICSSStyleDeclarationPropertyValue | null { if ( !properties['flex-grow']?.value || !properties['flex-shrink']?.value || @@ -582,7 +582,7 @@ export default class CSSStyleDeclarationPropertyGetParser { */ public static getFont(properties: { [k: string]: ICSSStyleDeclarationPropertyValue; - }): ICSSStyleDeclarationPropertyValue { + }): ICSSStyleDeclarationPropertyValue | null { if ( !properties['font-size']?.value || !properties['font-family']?.value || @@ -671,7 +671,7 @@ export default class CSSStyleDeclarationPropertyGetParser { properties: { [k: string]: ICSSStyleDeclarationPropertyValue; } - ): ICSSStyleDeclarationPropertyValue { + ): ICSSStyleDeclarationPropertyValue | null { if ( !properties[`border-${position}-width`]?.value || !properties[`border-${position}-style`]?.value || @@ -730,7 +730,7 @@ export default class CSSStyleDeclarationPropertyGetParser { properties: { [k: string]: ICSSStyleDeclarationPropertyValue; } - ): ICSSStyleDeclarationPropertyValue { + ): ICSSStyleDeclarationPropertyValue | null { if ( !properties[propertyNames[0]]?.value || !properties[propertyNames[1]]?.value || diff --git a/packages/happy-dom/src/fetch/Fetch.ts b/packages/happy-dom/src/fetch/Fetch.ts index 2b79b4a01..ba2b91707 100644 --- a/packages/happy-dom/src/fetch/Fetch.ts +++ b/packages/happy-dom/src/fetch/Fetch.ts @@ -39,8 +39,8 @@ const LAST_CHUNK = Buffer.from('0\r\n\r\n'); * @see https://fetch.spec.whatwg.org/#http-network-fetch */ export default class Fetch { - private reject: (reason: Error) => void | null = null; - private resolve: (value: Response | Promise) => Promise = null; + private reject: ((reason: Error) => void) | null = null; + private resolve: ((value: Response | Promise) => Promise) | null = null; private listeners = { onSignalAbort: this.onSignalAbort.bind(this) }; diff --git a/packages/happy-dom/src/nodes/element/Element.ts b/packages/happy-dom/src/nodes/element/Element.ts index cf44ffee6..1c8990bbb 100644 --- a/packages/happy-dom/src/nodes/element/Element.ts +++ b/packages/happy-dom/src/nodes/element/Element.ts @@ -49,40 +49,40 @@ export default class Element public declare cloneNode: (deep?: boolean) => Element; // Events - public oncancel: (event: Event) => void | null = null; - public onerror: (event: Event) => void | null = null; - public onscroll: (event: Event) => void | null = null; - public onselect: (event: Event) => void | null = null; - public onwheel: (event: Event) => void | null = null; - public oncopy: (event: Event) => void | null = null; - public oncut: (event: Event) => void | null = null; - public onpaste: (event: Event) => void | null = null; - public oncompositionend: (event: Event) => void | null = null; - public oncompositionstart: (event: Event) => void | null = null; - public oncompositionupdate: (event: Event) => void | null = null; - public onblur: (event: Event) => void | null = null; - public onfocus: (event: Event) => void | null = null; - public onfocusin: (event: Event) => void | null = null; - public onfocusout: (event: Event) => void | null = null; - public onfullscreenchange: (event: Event) => void | null = null; - public onfullscreenerror: (event: Event) => void | null = null; - public onkeydown: (event: Event) => void | null = null; - public onkeyup: (event: Event) => void | null = null; - public onauxclick: (event: Event) => void | null = null; - public onclick: (event: Event) => void | null = null; - public oncontextmenu: (event: Event) => void | null = null; - public ondblclick: (event: Event) => void | null = null; - public onmousedown: (event: Event) => void | null = null; - public onmouseenter: (event: Event) => void | null = null; - public onmouseleave: (event: Event) => void | null = null; - public onmousemove: (event: Event) => void | null = null; - public onmouseout: (event: Event) => void | null = null; - public onmouseover: (event: Event) => void | null = null; - public onmouseup: (event: Event) => void | null = null; - public ontouchcancel: (event: Event) => void | null = null; - public ontouchend: (event: Event) => void | null = null; - public ontouchmove: (event: Event) => void | null = null; - public ontouchstart: (event: Event) => void | null = null; + public oncancel: ((event: Event) => void) | null = null; + public onerror: ((event: Event) => void) | null = null; + public onscroll: ((event: Event) => void) | null = null; + public onselect: ((event: Event) => void) | null = null; + public onwheel: ((event: Event) => void) | null = null; + public oncopy: ((event: Event) => void) | null = null; + public oncut: ((event: Event) => void) | null = null; + public onpaste: ((event: Event) => void) | null = null; + public oncompositionend: ((event: Event) => void) | null = null; + public oncompositionstart: ((event: Event) => void) | null = null; + public oncompositionupdate: ((event: Event) => void) | null = null; + public onblur: ((event: Event) => void) | null = null; + public onfocus: ((event: Event) => void) | null = null; + public onfocusin: ((event: Event) => void) | null = null; + public onfocusout: ((event: Event) => void) | null = null; + public onfullscreenchange: ((event: Event) => void) | null = null; + public onfullscreenerror: ((event: Event) => void) | null = null; + public onkeydown: ((event: Event) => void) | null = null; + public onkeyup: ((event: Event) => void) | null = null; + public onauxclick: ((event: Event) => void) | null = null; + public onclick: ((event: Event) => void) | null = null; + public oncontextmenu: ((event: Event) => void) | null = null; + public ondblclick: ((event: Event) => void) | null = null; + public onmousedown: ((event: Event) => void) | null = null; + public onmouseenter: ((event: Event) => void) | null = null; + public onmouseleave: ((event: Event) => void) | null = null; + public onmousemove: ((event: Event) => void) | null = null; + public onmouseout: ((event: Event) => void) | null = null; + public onmouseover: ((event: Event) => void) | null = null; + public onmouseup: ((event: Event) => void) | null = null; + public ontouchcancel: ((event: Event) => void) | null = null; + public ontouchend: ((event: Event) => void) | null = null; + public ontouchmove: ((event: Event) => void) | null = null; + public ontouchstart: ((event: Event) => void) | null = null; // Internal properties public [PropertySymbol.classList]: DOMTokenList | null = null; diff --git a/packages/happy-dom/src/nodes/html-body-element/HTMLBodyElement.ts b/packages/happy-dom/src/nodes/html-body-element/HTMLBodyElement.ts index d083489d6..2273c6dd6 100644 --- a/packages/happy-dom/src/nodes/html-body-element/HTMLBodyElement.ts +++ b/packages/happy-dom/src/nodes/html-body-element/HTMLBodyElement.ts @@ -7,22 +7,22 @@ import HTMLElement from '../html-element/HTMLElement.js'; */ export default class HTMLBodyElement extends HTMLElement { // Events - public onafterprint: (event: Event) => void | null = null; - public onbeforeprint: (event: Event) => void | null = null; - public onbeforeunload: (event: Event) => void | null = null; - public ongamepadconnected: (event: Event) => void | null = null; - public ongamepaddisconnected: (event: Event) => void | null = null; - public onhashchange: (event: Event) => void | null = null; - public onlanguagechange: (event: Event) => void | null = null; - public onmessage: (event: Event) => void | null = null; - public onmessageerror: (event: Event) => void | null = null; - public onoffline: (event: Event) => void | null = null; - public ononline: (event: Event) => void | null = null; - public onpagehide: (event: Event) => void | null = null; - public onpageshow: (event: Event) => void | null = null; - public onpopstate: (event: Event) => void | null = null; - public onrejectionhandled: (event: Event) => void | null = null; - public onstorage: (event: Event) => void | null = null; - public onunhandledrejection: (event: Event) => void | null = null; - public onunload: (event: Event) => void | null = null; + public onafterprint: ((event: Event) => void) | null = null; + public onbeforeprint: ((event: Event) => void) | null = null; + public onbeforeunload: ((event: Event) => void) | null = null; + public ongamepadconnected: ((event: Event) => void) | null = null; + public ongamepaddisconnected: ((event: Event) => void) | null = null; + public onhashchange: ((event: Event) => void) | null = null; + public onlanguagechange: ((event: Event) => void) | null = null; + public onmessage: ((event: Event) => void) | null = null; + public onmessageerror: ((event: Event) => void) | null = null; + public onoffline: ((event: Event) => void) | null = null; + public ononline: ((event: Event) => void) | null = null; + public onpagehide: ((event: Event) => void) | null = null; + public onpageshow: ((event: Event) => void) | null = null; + public onpopstate: ((event: Event) => void) | null = null; + public onrejectionhandled: ((event: Event) => void) | null = null; + public onstorage: ((event: Event) => void) | null = null; + public onunhandledrejection: ((event: Event) => void) | null = null; + public onunload: ((event: Event) => void) | null = null; } diff --git a/packages/happy-dom/src/nodes/html-canvas-element/HTMLCanvasElement.ts b/packages/happy-dom/src/nodes/html-canvas-element/HTMLCanvasElement.ts index 3a23abd9b..11f45eee0 100644 --- a/packages/happy-dom/src/nodes/html-canvas-element/HTMLCanvasElement.ts +++ b/packages/happy-dom/src/nodes/html-canvas-element/HTMLCanvasElement.ts @@ -14,11 +14,11 @@ const DEVICE_ID = 'S3F/aBCdEfGHIjKlMnOpQRStUvWxYz1234567890+1AbC2DEf2GHi3jK34le+ */ export default class HTMLCanvasElement extends HTMLElement { // Events - public oncontextlost: (event: Event) => void | null = null; - public oncontextrestored: (event: Event) => void | null = null; - public onwebglcontextcreationerror: (event: Event) => void | null = null; - public onwebglcontextlost: (event: Event) => void | null = null; - public onwebglcontextrestored: (event: Event) => void | null = null; + public oncontextlost: ((event: Event) => void) | null = null; + public oncontextrestored: ((event: Event) => void) | null = null; + public onwebglcontextcreationerror: ((event: Event) => void) | null = null; + public onwebglcontextlost: ((event: Event) => void) | null = null; + public onwebglcontextrestored: ((event: Event) => void) | null = null; /** * Returns width. diff --git a/packages/happy-dom/src/nodes/html-details-element/HTMLDetailsElement.ts b/packages/happy-dom/src/nodes/html-details-element/HTMLDetailsElement.ts index 815c768df..69c43aabe 100644 --- a/packages/happy-dom/src/nodes/html-details-element/HTMLDetailsElement.ts +++ b/packages/happy-dom/src/nodes/html-details-element/HTMLDetailsElement.ts @@ -12,7 +12,7 @@ import MouseEvent from '../../event/events/MouseEvent.js'; */ export default class HTMLDetailsElement extends HTMLElement { // Events - public ontoggle: (event: Event) => void | null = null; + public ontoggle: ((event: Event) => void) | null = null; /** * Returns the open attribute. diff --git a/packages/happy-dom/src/nodes/html-dialog-element/HTMLDialogElement.ts b/packages/happy-dom/src/nodes/html-dialog-element/HTMLDialogElement.ts index d5008ed85..035bd7646 100644 --- a/packages/happy-dom/src/nodes/html-dialog-element/HTMLDialogElement.ts +++ b/packages/happy-dom/src/nodes/html-dialog-element/HTMLDialogElement.ts @@ -12,8 +12,8 @@ export default class HTMLDialogElement extends HTMLElement { public [PropertySymbol.returnValue] = ''; // Events - public oncancel: (event: Event) => void | null = null; - public onclose: (event: Event) => void | null = null; + public oncancel: ((event: Event) => void) | null = null; + public onclose: ((event: Event) => void) | null = null; /** * Returns return value. diff --git a/packages/happy-dom/src/nodes/html-element/HTMLElement.ts b/packages/happy-dom/src/nodes/html-element/HTMLElement.ts index 629eeb082..15134e854 100644 --- a/packages/happy-dom/src/nodes/html-element/HTMLElement.ts +++ b/packages/happy-dom/src/nodes/html-element/HTMLElement.ts @@ -20,31 +20,31 @@ export default class HTMLElement extends Element { public static observedAttributes?: string[]; // Events - public oncopy: (event: Event) => void | null = null; - public oncut: (event: Event) => void | null = null; - public onpaste: (event: Event) => void | null = null; - public oninvalid: (event: Event) => void | null = null; - public onanimationcancel: (event: Event) => void | null = null; - public onanimationend: (event: Event) => void | null = null; - public onanimationiteration: (event: Event) => void | null = null; - public onanimationstart: (event: Event) => void | null = null; - public onbeforeinput: (event: Event) => void | null = null; - public oninput: (event: Event) => void | null = null; - public onchange: (event: Event) => void | null = null; - public ongotpointercapture: (event: Event) => void | null = null; - public onlostpointercapture: (event: Event) => void | null = null; - public onpointercancel: (event: Event) => void | null = null; - public onpointerdown: (event: Event) => void | null = null; - public onpointerenter: (event: Event) => void | null = null; - public onpointerleave: (event: Event) => void | null = null; - public onpointermove: (event: Event) => void | null = null; - public onpointerout: (event: Event) => void | null = null; - public onpointerover: (event: Event) => void | null = null; - public onpointerup: (event: Event) => void | null = null; - public ontransitioncancel: (event: Event) => void | null = null; - public ontransitionend: (event: Event) => void | null = null; - public ontransitionrun: (event: Event) => void | null = null; - public ontransitionstart: (event: Event) => void | null = null; + public oncopy: ((event: Event) => void) | null = null; + public oncut: ((event: Event) => void) | null = null; + public onpaste: ((event: Event) => void) | null = null; + public oninvalid: ((event: Event) => void) | null = null; + public onanimationcancel: ((event: Event) => void) | null = null; + public onanimationend: ((event: Event) => void) | null = null; + public onanimationiteration: ((event: Event) => void) | null = null; + public onanimationstart: ((event: Event) => void) | null = null; + public onbeforeinput: ((event: Event) => void) | null = null; + public oninput: ((event: Event) => void) | null = null; + public onchange: ((event: Event) => void) | null = null; + public ongotpointercapture: ((event: Event) => void) | null = null; + public onlostpointercapture: ((event: Event) => void) | null = null; + public onpointercancel: ((event: Event) => void) | null = null; + public onpointerdown: ((event: Event) => void) | null = null; + public onpointerenter: ((event: Event) => void) | null = null; + public onpointerleave: ((event: Event) => void) | null = null; + public onpointermove: ((event: Event) => void) | null = null; + public onpointerout: ((event: Event) => void) | null = null; + public onpointerover: ((event: Event) => void) | null = null; + public onpointerup: ((event: Event) => void) | null = null; + public ontransitioncancel: ((event: Event) => void) | null = null; + public ontransitionend: ((event: Event) => void) | null = null; + public ontransitionrun: ((event: Event) => void) | null = null; + public ontransitionstart: ((event: Event) => void) | null = null; // Internal properties public [PropertySymbol.accessKey] = ''; diff --git a/packages/happy-dom/src/nodes/html-form-element/HTMLFormElement.ts b/packages/happy-dom/src/nodes/html-form-element/HTMLFormElement.ts index b13757dc2..ddc73125a 100644 --- a/packages/happy-dom/src/nodes/html-form-element/HTMLFormElement.ts +++ b/packages/happy-dom/src/nodes/html-form-element/HTMLFormElement.ts @@ -33,9 +33,9 @@ export default class HTMLFormElement extends HTMLElement { public [PropertySymbol.proxy]: HTMLFormElement; // Events - public onformdata: (event: Event) => void | null = null; - public onreset: (event: Event) => void | null = null; - public onsubmit: (event: Event) => void | null = null; + public onformdata: ((event: Event) => void) | null = null; + public onreset: ((event: Event) => void) | null = null; + public onsubmit: ((event: Event) => void) | null = null; /** * Constructor. diff --git a/packages/happy-dom/src/nodes/html-iframe-element/HTMLIFrameElement.ts b/packages/happy-dom/src/nodes/html-iframe-element/HTMLIFrameElement.ts index e07113262..034876391 100644 --- a/packages/happy-dom/src/nodes/html-iframe-element/HTMLIFrameElement.ts +++ b/packages/happy-dom/src/nodes/html-iframe-element/HTMLIFrameElement.ts @@ -41,8 +41,8 @@ export default class HTMLIFrameElement extends HTMLElement { public declare cloneNode: (deep?: boolean) => HTMLIFrameElement; // Events - public onload: (event: Event) => void | null = null; - public onerror: (event: Event) => void | null = null; + public onload: ((event: Event) => void) | null = null; + public onerror: ((event: Event) => void) | null = null; // Internal properties public [PropertySymbol.sandbox]: DOMTokenList | null = null; diff --git a/packages/happy-dom/src/nodes/html-input-element/HTMLInputElement.ts b/packages/happy-dom/src/nodes/html-input-element/HTMLInputElement.ts index dcfe60346..3c572ba65 100644 --- a/packages/happy-dom/src/nodes/html-input-element/HTMLInputElement.ts +++ b/packages/happy-dom/src/nodes/html-input-element/HTMLInputElement.ts @@ -34,9 +34,9 @@ export default class HTMLInputElement extends HTMLElement { public declare cloneNode: (deep?: boolean) => HTMLInputElement; // Events - public oninput: (event: Event) => void | null = null; - public oninvalid: (event: Event) => void | null = null; - public onselectionchange: (event: Event) => void | null = null; + public oninput: ((event: Event) => void) | null = null; + public oninvalid: ((event: Event) => void) | null = null; + public onselectionchange: ((event: Event) => void) | null = null; public [PropertySymbol.value] = null; public [PropertySymbol.height] = 0; diff --git a/packages/happy-dom/src/nodes/html-media-element/HTMLMediaElement.ts b/packages/happy-dom/src/nodes/html-media-element/HTMLMediaElement.ts index b552e2c28..d15b108a5 100644 --- a/packages/happy-dom/src/nodes/html-media-element/HTMLMediaElement.ts +++ b/packages/happy-dom/src/nodes/html-media-element/HTMLMediaElement.ts @@ -28,29 +28,29 @@ export default class HTMLMediaElement extends HTMLElement { public declare cloneNode: (deep?: boolean) => HTMLMediaElement; // Events - public onabort: (event: Event) => void | null = null; - public oncanplay: (event: Event) => void | null = null; - public oncanplaythrough: (event: Event) => void | null = null; - public ondurationchange: (event: Event) => void | null = null; - public onemptied: (event: Event) => void | null = null; - public onended: (event: Event) => void | null = null; - public onerror: (event: ErrorEvent) => void | null = null; - public onloadeddata: (event: Event) => void | null = null; - public onloadedmetadata: (event: Event) => void | null = null; - public onloadstart: (event: Event) => void | null = null; - public onpause: (event: Event) => void | null = null; - public onplay: (event: Event) => void | null = null; - public onplaying: (event: Event) => void | null = null; - public onprogress: (event: Event) => void | null = null; - public onratechange: (event: Event) => void | null = null; - public onresize: (event: Event) => void | null = null; - public onseeked: (event: Event) => void | null = null; - public onseeking: (event: Event) => void | null = null; - public onstalled: (event: Event) => void | null = null; - public onsuspend: (event: Event) => void | null = null; - public ontimeupdate: (event: Event) => void | null = null; - public onvolumechange: (event: Event) => void | null = null; - public onwaiting: (event: Event) => void | null = null; + public onabort: ((event: Event) => void) | null = null; + public oncanplay: ((event: Event) => void) | null = null; + public oncanplaythrough: ((event: Event) => void) | null = null; + public ondurationchange: ((event: Event) => void) | null = null; + public onemptied: ((event: Event) => void) | null = null; + public onended: ((event: Event) => void) | null = null; + public onerror: ((event: ErrorEvent) => void) | null = null; + public onloadeddata: ((event: Event) => void) | null = null; + public onloadedmetadata: ((event: Event) => void) | null = null; + public onloadstart: ((event: Event) => void) | null = null; + public onpause: ((event: Event) => void) | null = null; + public onplay: ((event: Event) => void) | null = null; + public onplaying: ((event: Event) => void) | null = null; + public onprogress: ((event: Event) => void) | null = null; + public onratechange: ((event: Event) => void) | null = null; + public onresize: ((event: Event) => void) | null = null; + public onseeked: ((event: Event) => void) | null = null; + public onseeking: ((event: Event) => void) | null = null; + public onstalled: ((event: Event) => void) | null = null; + public onsuspend: ((event: Event) => void) | null = null; + public ontimeupdate: ((event: Event) => void) | null = null; + public onvolumechange: ((event: Event) => void) | null = null; + public onwaiting: ((event: Event) => void) | null = null; // Internal Properties public [PropertySymbol.volume] = 1; diff --git a/packages/happy-dom/src/nodes/html-media-element/MediaStream.ts b/packages/happy-dom/src/nodes/html-media-element/MediaStream.ts index b9d972dca..84e4c982a 100644 --- a/packages/happy-dom/src/nodes/html-media-element/MediaStream.ts +++ b/packages/happy-dom/src/nodes/html-media-element/MediaStream.ts @@ -15,8 +15,8 @@ export default class MediaStream extends EventTarget { public id: string = Crypto.randomUUID(); // Events - public onaddtrack: (event: MediaStreamTrackEvent) => void | null = null; - public onremovetrack: (event: MediaStreamTrackEvent) => void | null = null; + public onaddtrack: ((event: MediaStreamTrackEvent) => void) | null = null; + public onremovetrack: ((event: MediaStreamTrackEvent) => void) | null = null; // Internal properties public [PropertySymbol.tracks]: MediaStreamTrack[] = []; diff --git a/packages/happy-dom/src/nodes/html-media-element/MediaStreamTrack.ts b/packages/happy-dom/src/nodes/html-media-element/MediaStreamTrack.ts index 68f62dedc..c984b3129 100644 --- a/packages/happy-dom/src/nodes/html-media-element/MediaStreamTrack.ts +++ b/packages/happy-dom/src/nodes/html-media-element/MediaStreamTrack.ts @@ -59,9 +59,9 @@ export default class MediaStreamTrack extends EventTarget { public [PropertySymbol.settings]: IMediaTrackSettings = JSON.parse(JSON.stringify(SETTINGS)); // Events - public onended: (event: Event) => void | null = null; - public onmute: (event: Event) => void | null = null; - public onunmute: (event: Event) => void | null = null; + public onended: ((event: Event) => void) | null = null; + public onmute: ((event: Event) => void) | null = null; + public onunmute: ((event: Event) => void) | null = null; /** * Constructor. diff --git a/packages/happy-dom/src/nodes/html-select-element/HTMLSelectElement.ts b/packages/happy-dom/src/nodes/html-select-element/HTMLSelectElement.ts index c2048e272..b4544040d 100644 --- a/packages/happy-dom/src/nodes/html-select-element/HTMLSelectElement.ts +++ b/packages/happy-dom/src/nodes/html-select-element/HTMLSelectElement.ts @@ -32,8 +32,8 @@ export default class HTMLSelectElement extends HTMLElement { public [PropertySymbol.proxy]: HTMLSelectElement; // Events - public onchange: (event: Event) => void | null = null; - public oninput: (event: Event) => void | null = null; + public onchange: ((event: Event) => void) | null = null; + public oninput: ((event: Event) => void) | null = null; /** * Constructor. diff --git a/packages/happy-dom/src/nodes/html-slot-element/HTMLSlotElement.ts b/packages/happy-dom/src/nodes/html-slot-element/HTMLSlotElement.ts index eec655ef1..4559fa18e 100644 --- a/packages/happy-dom/src/nodes/html-slot-element/HTMLSlotElement.ts +++ b/packages/happy-dom/src/nodes/html-slot-element/HTMLSlotElement.ts @@ -22,7 +22,7 @@ export default class HTMLSlotElement extends HTMLElement { public [PropertySymbol.assignedNodes]: Node[] = []; // Events - public onslotchange: (event: Event) => void | null = null; + public onslotchange: ((event: Event) => void) | null = null; /** * Returns name. diff --git a/packages/happy-dom/src/nodes/html-text-area-element/HTMLTextAreaElement.ts b/packages/happy-dom/src/nodes/html-text-area-element/HTMLTextAreaElement.ts index 583d8746a..5657eb82e 100644 --- a/packages/happy-dom/src/nodes/html-text-area-element/HTMLTextAreaElement.ts +++ b/packages/happy-dom/src/nodes/html-text-area-element/HTMLTextAreaElement.ts @@ -22,8 +22,8 @@ export default class HTMLTextAreaElement extends HTMLElement { public readonly type = 'textarea'; // Events - public oninput: (event: Event) => void | null = null; - public onselectionchange: (event: Event) => void | null = null; + public oninput: ((event: Event) => void) | null = null; + public onselectionchange: ((event: Event) => void) | null = null; // Internal properties public [PropertySymbol.validationMessage] = ''; diff --git a/packages/happy-dom/src/nodes/shadow-root/ShadowRoot.ts b/packages/happy-dom/src/nodes/shadow-root/ShadowRoot.ts index 8dd91b180..07d2d67a3 100644 --- a/packages/happy-dom/src/nodes/shadow-root/ShadowRoot.ts +++ b/packages/happy-dom/src/nodes/shadow-root/ShadowRoot.ts @@ -17,7 +17,7 @@ export default class ShadowRoot extends DocumentFragment { public declare cloneNode: (deep?: boolean) => ShadowRoot; // Events - public onslotchange: (event: Event) => void | null = null; + public onslotchange: ((event: Event) => void) | null = null; // Internal properties public [PropertySymbol.adoptedStyleSheets]: CSSStyleSheet[] = []; diff --git a/packages/happy-dom/src/nodes/svg-animation-element/SVGAnimationElement.ts b/packages/happy-dom/src/nodes/svg-animation-element/SVGAnimationElement.ts index 8b6ebffb4..11adcd1a0 100644 --- a/packages/happy-dom/src/nodes/svg-animation-element/SVGAnimationElement.ts +++ b/packages/happy-dom/src/nodes/svg-animation-element/SVGAnimationElement.ts @@ -14,9 +14,9 @@ export default class SVGAnimationElement extends SVGElement { public [PropertySymbol.systemLanguage]: SVGStringList | null = null; // Events - public onbegin: (event: Event) => void | null = null; - public onend: (event: Event) => void | null = null; - public onrepeat: (event: Event) => void | null = null; + public onbegin: ((event: Event) => void) | null = null; + public onend: ((event: Event) => void) | null = null; + public onrepeat: ((event: Event) => void) | null = null; /** * Returns required extensions. diff --git a/packages/happy-dom/src/nodes/svg-element/SVGElement.ts b/packages/happy-dom/src/nodes/svg-element/SVGElement.ts index 8af6b0129..ed5ced5b0 100644 --- a/packages/happy-dom/src/nodes/svg-element/SVGElement.ts +++ b/packages/happy-dom/src/nodes/svg-element/SVGElement.ts @@ -14,12 +14,12 @@ import DOMStringMap from '../../dom/DOMStringMap.js'; */ export default class SVGElement extends Element { // Events - public onabort: (event: Event) => void | null = null; - public onerror: (event: Event) => void | null = null; - public onload: (event: Event) => void | null = null; - public onresize: (event: Event) => void | null = null; - public onscroll: (event: Event) => void | null = null; - public onunload: (event: Event) => void | null = null; + public onabort: ((event: Event) => void) | null = null; + public onerror: ((event: Event) => void) | null = null; + public onload: ((event: Event) => void) | null = null; + public onresize: ((event: Event) => void) | null = null; + public onscroll: ((event: Event) => void) | null = null; + public onunload: ((event: Event) => void) | null = null; // Internal properties public [PropertySymbol.style]: CSSStyleDeclaration | null = null; diff --git a/packages/happy-dom/src/nodes/svg-graphics-element/SVGGraphicsElement.ts b/packages/happy-dom/src/nodes/svg-graphics-element/SVGGraphicsElement.ts index cc3de25c1..ce9492c60 100644 --- a/packages/happy-dom/src/nodes/svg-graphics-element/SVGGraphicsElement.ts +++ b/packages/happy-dom/src/nodes/svg-graphics-element/SVGGraphicsElement.ts @@ -18,9 +18,9 @@ export default class SVGGraphicsElement extends SVGElement { public [PropertySymbol.transform]: SVGAnimatedTransformList | null = null; // Events - public oncopy: (event: Event) => void | null = null; - public oncut: (event: Event) => void | null = null; - public onpaste: (event: Event) => void | null = null; + public oncopy: ((event: Event) => void) | null = null; + public oncut: ((event: Event) => void) | null = null; + public onpaste: ((event: Event) => void) | null = null; /** * Returns required extensions. diff --git a/packages/happy-dom/src/nodes/svg-svg-element/SVGSVGElement.ts b/packages/happy-dom/src/nodes/svg-svg-element/SVGSVGElement.ts index a74c7ff66..7f5fa403d 100644 --- a/packages/happy-dom/src/nodes/svg-svg-element/SVGSVGElement.ts +++ b/packages/happy-dom/src/nodes/svg-svg-element/SVGSVGElement.ts @@ -38,24 +38,24 @@ export default class SVGSVGElement extends SVGGraphicsElement { public declare cloneNode: (deep?: boolean) => SVGSVGElement; // Events - public onafterprint: (event: Event) => void | null = null; - public onbeforeprint: (event: Event) => void | null = null; - public onbeforeunload: (event: Event) => void | null = null; - public ongamepadconnected: (event: Event) => void | null = null; - public ongamepaddisconnected: (event: Event) => void | null = null; - public onhashchange: (event: Event) => void | null = null; - public onlanguagechange: (event: Event) => void | null = null; - public onmessage: (event: Event) => void | null = null; - public onmessageerror: (event: Event) => void | null = null; - public onoffline: (event: Event) => void | null = null; - public ononline: (event: Event) => void | null = null; - public onpagehide: (event: Event) => void | null = null; - public onpageshow: (event: Event) => void | null = null; - public onpopstate: (event: Event) => void | null = null; - public onrejectionhandled: (event: Event) => void | null = null; - public onstorage: (event: Event) => void | null = null; - public onunhandledrejection: (event: Event) => void | null = null; - public onunload: (event: Event) => void | null = null; + public onafterprint: ((event: Event) => void) | null = null; + public onbeforeprint: ((event: Event) => void) | null = null; + public onbeforeunload: ((event: Event) => void) | null = null; + public ongamepadconnected: ((event: Event) => void) | null = null; + public ongamepaddisconnected: ((event: Event) => void) | null = null; + public onhashchange: ((event: Event) => void) | null = null; + public onlanguagechange: ((event: Event) => void) | null = null; + public onmessage: ((event: Event) => void) | null = null; + public onmessageerror: ((event: Event) => void) | null = null; + public onoffline: ((event: Event) => void) | null = null; + public ononline: ((event: Event) => void) | null = null; + public onpagehide: ((event: Event) => void) | null = null; + public onpageshow: ((event: Event) => void) | null = null; + public onpopstate: ((event: Event) => void) | null = null; + public onrejectionhandled: ((event: Event) => void) | null = null; + public onstorage: ((event: Event) => void) | null = null; + public onunhandledrejection: ((event: Event) => void) | null = null; + public onunload: ((event: Event) => void) | null = null; /** * Returns preserve aspect ratio. diff --git a/packages/happy-dom/src/svg/SVGAngle.ts b/packages/happy-dom/src/svg/SVGAngle.ts index 143884153..1aec1014f 100644 --- a/packages/happy-dom/src/svg/SVGAngle.ts +++ b/packages/happy-dom/src/svg/SVGAngle.ts @@ -19,8 +19,8 @@ export default class SVGAngle { // Internal properties public [PropertySymbol.window]: BrowserWindow; - public [PropertySymbol.getAttribute]: () => string | null = null; - public [PropertySymbol.setAttribute]: (value: string) => void | null = null; + public [PropertySymbol.getAttribute]: (() => string | null) | null = null; + public [PropertySymbol.setAttribute]: ((value: string) => void) | null = null; public [PropertySymbol.attributeValue]: string = ''; public [PropertySymbol.readOnly]: boolean = false; diff --git a/packages/happy-dom/src/svg/SVGAnimatedBoolean.ts b/packages/happy-dom/src/svg/SVGAnimatedBoolean.ts index ffa046d9e..8bc3e0b7a 100644 --- a/packages/happy-dom/src/svg/SVGAnimatedBoolean.ts +++ b/packages/happy-dom/src/svg/SVGAnimatedBoolean.ts @@ -9,8 +9,8 @@ import BrowserWindow from '../window/BrowserWindow.js'; export default class SVGAnimatedBoolean { // Internal properties public [PropertySymbol.window]: BrowserWindow; - public [PropertySymbol.getAttribute]: () => string | null = null; - public [PropertySymbol.setAttribute]: (value: string) => void | null = null; + public [PropertySymbol.getAttribute]: (() => string | null) | null = null; + public [PropertySymbol.setAttribute]: ((value: string) => void) | null = null; /** * Constructor. diff --git a/packages/happy-dom/src/svg/SVGAnimatedInteger.ts b/packages/happy-dom/src/svg/SVGAnimatedInteger.ts index f73c1408b..454bf4467 100644 --- a/packages/happy-dom/src/svg/SVGAnimatedInteger.ts +++ b/packages/happy-dom/src/svg/SVGAnimatedInteger.ts @@ -9,8 +9,8 @@ import BrowserWindow from '../window/BrowserWindow.js'; export default class SVGAnimatedInteger { // Internal properties public [PropertySymbol.window]: BrowserWindow; - public [PropertySymbol.getAttribute]: () => string | null = null; - public [PropertySymbol.setAttribute]: (value: string) => void | null = null; + public [PropertySymbol.getAttribute]: (() => string | null) | null = null; + public [PropertySymbol.setAttribute]: ((value: string) => void) | null = null; /** * Constructor. diff --git a/packages/happy-dom/src/svg/SVGAnimatedNumber.ts b/packages/happy-dom/src/svg/SVGAnimatedNumber.ts index 1cd86182f..0690411fa 100644 --- a/packages/happy-dom/src/svg/SVGAnimatedNumber.ts +++ b/packages/happy-dom/src/svg/SVGAnimatedNumber.ts @@ -9,8 +9,8 @@ import BrowserWindow from '../window/BrowserWindow.js'; export default class SVGAnimatedNumber { // Internal properties public [PropertySymbol.window]: BrowserWindow; - public [PropertySymbol.getAttribute]: () => string | null = null; - public [PropertySymbol.setAttribute]: (value: string) => void | null = null; + public [PropertySymbol.getAttribute]: (() => string | null) | null = null; + public [PropertySymbol.setAttribute]: ((value: string) => void) | null = null; public [PropertySymbol.defaultValue]: number = 0; /** diff --git a/packages/happy-dom/src/svg/SVGAnimatedString.ts b/packages/happy-dom/src/svg/SVGAnimatedString.ts index 600505c4b..889f1c24b 100644 --- a/packages/happy-dom/src/svg/SVGAnimatedString.ts +++ b/packages/happy-dom/src/svg/SVGAnimatedString.ts @@ -9,8 +9,8 @@ import BrowserWindow from '../window/BrowserWindow.js'; export default class SVGAnimatedString { // Internal properties public [PropertySymbol.window]: BrowserWindow; - public [PropertySymbol.getAttribute]: () => string | null = null; - public [PropertySymbol.setAttribute]: (value: string) => void | null = null; + public [PropertySymbol.getAttribute]: (() => string | null) | null = null; + public [PropertySymbol.setAttribute]: ((value: string) => void) | null = null; /** * Constructor. diff --git a/packages/happy-dom/src/svg/SVGLength.ts b/packages/happy-dom/src/svg/SVGLength.ts index aa7a97f64..938571659 100644 --- a/packages/happy-dom/src/svg/SVGLength.ts +++ b/packages/happy-dom/src/svg/SVGLength.ts @@ -25,8 +25,8 @@ export default class SVGLength { // Internal properties public [PropertySymbol.window]: BrowserWindow; - public [PropertySymbol.getAttribute]: () => string | null = null; - public [PropertySymbol.setAttribute]: (value: string) => void | null = null; + public [PropertySymbol.getAttribute]: (() => string | null) | null = null; + public [PropertySymbol.setAttribute]: ((value: string) => void) | null = null; public [PropertySymbol.attributeValue]: string | null = null; public [PropertySymbol.readOnly]: boolean = false; diff --git a/packages/happy-dom/src/svg/SVGLengthList.ts b/packages/happy-dom/src/svg/SVGLengthList.ts index c27d9a325..251dec270 100644 --- a/packages/happy-dom/src/svg/SVGLengthList.ts +++ b/packages/happy-dom/src/svg/SVGLengthList.ts @@ -15,8 +15,8 @@ export default class SVGLengthList { [index: number]: SVGLength; public [PropertySymbol.window]: BrowserWindow; - public [PropertySymbol.getAttribute]: () => string | null = null; - public [PropertySymbol.setAttribute]: (value: string) => void | null = null; + public [PropertySymbol.getAttribute]: (() => string | null) | null = null; + public [PropertySymbol.setAttribute]: ((value: string) => void) | null = null; public [PropertySymbol.readOnly]: boolean = false; private [PropertySymbol.cache]: { items: SVGLength[]; attributeValue: string } = { items: [], diff --git a/packages/happy-dom/src/svg/SVGMatrix.ts b/packages/happy-dom/src/svg/SVGMatrix.ts index c0056761b..1e98df0db 100644 --- a/packages/happy-dom/src/svg/SVGMatrix.ts +++ b/packages/happy-dom/src/svg/SVGMatrix.ts @@ -13,8 +13,8 @@ const TRANSFORM_PARAMETER_SPLIT_REGEXP = /[\s,]+/; export default class SVGMatrix { // Internal properties public [PropertySymbol.window]: BrowserWindow; - public [PropertySymbol.getAttribute]: () => string | null = null; - public [PropertySymbol.setAttribute]: (value: string) => void | null = null; + public [PropertySymbol.getAttribute]: (() => string | null) | null = null; + public [PropertySymbol.setAttribute]: ((value: string) => void) | null = null; public [PropertySymbol.attributeValue]: string | null = null; public [PropertySymbol.readOnly]: boolean = false; diff --git a/packages/happy-dom/src/svg/SVGNumber.ts b/packages/happy-dom/src/svg/SVGNumber.ts index 9a8e06f5b..76d34f484 100644 --- a/packages/happy-dom/src/svg/SVGNumber.ts +++ b/packages/happy-dom/src/svg/SVGNumber.ts @@ -9,8 +9,8 @@ import BrowserWindow from '../window/BrowserWindow.js'; export default class SVGNumber { // Internal properties public [PropertySymbol.window]: BrowserWindow; - public [PropertySymbol.getAttribute]: () => string | null = null; - public [PropertySymbol.setAttribute]: (value: string) => void | null = null; + public [PropertySymbol.getAttribute]: (() => string | null) | null = null; + public [PropertySymbol.setAttribute]: ((value: string) => void) | null = null; public [PropertySymbol.attributeValue]: string | null = null; public [PropertySymbol.readOnly]: boolean = false; diff --git a/packages/happy-dom/src/svg/SVGNumberList.ts b/packages/happy-dom/src/svg/SVGNumberList.ts index 270262459..9ded1de69 100644 --- a/packages/happy-dom/src/svg/SVGNumberList.ts +++ b/packages/happy-dom/src/svg/SVGNumberList.ts @@ -15,8 +15,8 @@ export default class SVGNumberList { [index: number]: SVGNumber; public [PropertySymbol.window]: BrowserWindow; - public [PropertySymbol.getAttribute]: () => string | null = null; - public [PropertySymbol.setAttribute]: (value: string) => void | null = null; + public [PropertySymbol.getAttribute]: (() => string | null) | null = null; + public [PropertySymbol.setAttribute]: ((value: string) => void) | null = null; public [PropertySymbol.readOnly]: boolean = false; private [PropertySymbol.cache]: { items: SVGNumber[]; attributeValue: string } = { items: [], diff --git a/packages/happy-dom/src/svg/SVGPoint.ts b/packages/happy-dom/src/svg/SVGPoint.ts index afe396a6b..408c01dd6 100644 --- a/packages/happy-dom/src/svg/SVGPoint.ts +++ b/packages/happy-dom/src/svg/SVGPoint.ts @@ -11,8 +11,8 @@ const ATTRIBUTE_SEPARATOR_REGEXP = /[\t\f\n\r, ]+/; export default class SVGPoint { // Internal properties public [PropertySymbol.window]: BrowserWindow; - public [PropertySymbol.getAttribute]: () => string | null = null; - public [PropertySymbol.setAttribute]: (value: string) => void | null = null; + public [PropertySymbol.getAttribute]: (() => string | null) | null = null; + public [PropertySymbol.setAttribute]: ((value: string) => void) | null = null; public [PropertySymbol.attributeValue]: string | null = null; public [PropertySymbol.readOnly]: boolean = false; diff --git a/packages/happy-dom/src/svg/SVGPointList.ts b/packages/happy-dom/src/svg/SVGPointList.ts index c5d005ae4..893e931c4 100644 --- a/packages/happy-dom/src/svg/SVGPointList.ts +++ b/packages/happy-dom/src/svg/SVGPointList.ts @@ -15,8 +15,8 @@ export default class SVGPointList { [index: number]: SVGPoint; public [PropertySymbol.window]: BrowserWindow; - public [PropertySymbol.getAttribute]: () => string | null = null; - public [PropertySymbol.setAttribute]: (value: string) => void | null = null; + public [PropertySymbol.getAttribute]: (() => string | null) | null = null; + public [PropertySymbol.setAttribute]: ((value: string) => void) | null = null; public [PropertySymbol.readOnly]: boolean = false; private [PropertySymbol.cache]: { items: SVGPoint[]; attributeValue: string } = { items: [], diff --git a/packages/happy-dom/src/svg/SVGPreserveAspectRatio.ts b/packages/happy-dom/src/svg/SVGPreserveAspectRatio.ts index 1759fdb89..2ab29da37 100644 --- a/packages/happy-dom/src/svg/SVGPreserveAspectRatio.ts +++ b/packages/happy-dom/src/svg/SVGPreserveAspectRatio.ts @@ -33,8 +33,8 @@ export default class SVGPreserveAspectRatio { // Internal properties public [PropertySymbol.window]: BrowserWindow; - public [PropertySymbol.getAttribute]: () => string | null = null; - public [PropertySymbol.setAttribute]: (value: string) => void | null = null; + public [PropertySymbol.getAttribute]: (() => string | null) | null = null; + public [PropertySymbol.setAttribute]: ((value: string) => void) | null = null; public [PropertySymbol.attributeValue]: string | null = null; public [PropertySymbol.readOnly]: boolean = false; diff --git a/packages/happy-dom/src/svg/SVGRect.ts b/packages/happy-dom/src/svg/SVGRect.ts index 697755bef..355131f7b 100644 --- a/packages/happy-dom/src/svg/SVGRect.ts +++ b/packages/happy-dom/src/svg/SVGRect.ts @@ -9,8 +9,8 @@ import BrowserWindow from '../window/BrowserWindow.js'; export default class SVGRect { // Internal properties public [PropertySymbol.window]: BrowserWindow; - public [PropertySymbol.getAttribute]: () => string | null = null; - public [PropertySymbol.setAttribute]: (value: string) => void | null = null; + public [PropertySymbol.getAttribute]: (() => string | null) | null = null; + public [PropertySymbol.setAttribute]: ((value: string) => void) | null = null; public [PropertySymbol.attributeValue]: string | null = null; public [PropertySymbol.readOnly]: boolean = false; diff --git a/packages/happy-dom/src/svg/SVGStringList.ts b/packages/happy-dom/src/svg/SVGStringList.ts index 8c31193bc..8ee294d8a 100644 --- a/packages/happy-dom/src/svg/SVGStringList.ts +++ b/packages/happy-dom/src/svg/SVGStringList.ts @@ -14,8 +14,8 @@ export default class SVGStringList { [index: number]: string; public [PropertySymbol.window]: BrowserWindow; - public [PropertySymbol.getAttribute]: () => string | null = null; - public [PropertySymbol.setAttribute]: (value: string) => void | null = null; + public [PropertySymbol.getAttribute]: (() => string | null) | null = null; + public [PropertySymbol.setAttribute]: ((value: string) => void) | null = null; public [PropertySymbol.readOnly]: boolean = false; private [PropertySymbol.cache]: { items: string[]; attributeValue: string } = { items: [], diff --git a/packages/happy-dom/src/svg/SVGTransformList.ts b/packages/happy-dom/src/svg/SVGTransformList.ts index 25adb95b1..81d0e568c 100644 --- a/packages/happy-dom/src/svg/SVGTransformList.ts +++ b/packages/happy-dom/src/svg/SVGTransformList.ts @@ -16,8 +16,8 @@ export default class SVGTransformList { [index: number]: SVGTransform; public [PropertySymbol.window]: BrowserWindow; - public [PropertySymbol.getAttribute]: () => string | null = null; - public [PropertySymbol.setAttribute]: (value: string) => void | null = null; + public [PropertySymbol.getAttribute]: (() => string | null) | null = null; + public [PropertySymbol.setAttribute]: ((value: string) => void) | null = null; public [PropertySymbol.readOnly]: boolean = false; private [PropertySymbol.cache]: { items: SVGTransform[]; attributeValue: string } = { items: [], diff --git a/packages/happy-dom/src/xml-http-request/XMLHttpRequestEventTarget.ts b/packages/happy-dom/src/xml-http-request/XMLHttpRequestEventTarget.ts index 93f1af039..69756d3cd 100644 --- a/packages/happy-dom/src/xml-http-request/XMLHttpRequestEventTarget.ts +++ b/packages/happy-dom/src/xml-http-request/XMLHttpRequestEventTarget.ts @@ -9,7 +9,7 @@ export type ProgressEventListener = (event: ProgressEvent) => void; export default class XMLHttpRequestEventTarget extends EventTarget { public onloadstart: ProgressEventListener | null = null; public onprogress: ProgressEventListener | null = null; - public onabort: (event: ProgressEvent) => void | null = null; + public onabort: ((event: ProgressEvent) => void) | null = null; public onerror: ProgressEventListener | null = null; public onload: ProgressEventListener | null = null; public ontimeout: ProgressEventListener | null = null;