happy-dom 2.55.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of happy-dom might be problematic. Click here for more details.
- package/README.md +26 -6
- package/lib/async-task-manager/AsyncTaskManager.js +34 -78
- package/lib/async-task-manager/AsyncTaskManager.js.map +1 -1
- package/lib/attribute/Attr.js +19 -28
- package/lib/attribute/Attr.js.map +1 -1
- package/lib/config/ElementTag.js +15 -15
- package/lib/config/ElementTag.js.map +1 -1
- package/lib/cookie/CookieUtility.js +21 -26
- package/lib/cookie/CookieUtility.js.map +1 -1
- package/lib/css/CSS.js +12 -18
- package/lib/css/CSS.js.map +1 -1
- package/lib/css/CSSParser.js +29 -33
- package/lib/css/CSSParser.js.map +1 -1
- package/lib/css/CSSRule.js +24 -29
- package/lib/css/CSSRule.js.map +1 -1
- package/lib/css/CSSStyleDeclaration.js +4516 -6005
- package/lib/css/CSSStyleDeclaration.js.map +1 -1
- package/lib/css/CSSStyleSheet.js +17 -59
- package/lib/css/CSSStyleSheet.js.map +1 -1
- package/lib/css/CSSUnitValue.js +4 -5
- package/lib/css/CSSUnitValue.js.map +1 -1
- package/lib/css/MediaList.js +23 -28
- package/lib/css/MediaList.js.map +1 -1
- package/lib/css/rules/CSSFontFaceRule.js +6 -24
- package/lib/css/rules/CSSFontFaceRule.js.map +1 -1
- package/lib/css/rules/CSSKeyframeRule.js +14 -36
- package/lib/css/rules/CSSKeyframeRule.js.map +1 -1
- package/lib/css/rules/CSSKeyframesRule.js +31 -54
- package/lib/css/rules/CSSKeyframesRule.js.map +1 -1
- package/lib/css/rules/CSSMediaRule.js +29 -56
- package/lib/css/rules/CSSMediaRule.js.map +1 -1
- package/lib/css/rules/CSSStyleRule.js +16 -38
- package/lib/css/rules/CSSStyleRule.js.map +1 -1
- package/lib/custom-element/CustomElementRegistry.js +21 -24
- package/lib/custom-element/CustomElementRegistry.js.map +1 -1
- package/lib/dom-implementation/DOMImplementation.js +12 -13
- package/lib/dom-implementation/DOMImplementation.js.map +1 -1
- package/lib/dom-parser/DOMParser.js +29 -35
- package/lib/dom-parser/DOMParser.js.map +1 -1
- package/lib/dom-token-list/DOMTokenList.js +64 -79
- package/lib/dom-token-list/DOMTokenList.js.map +1 -1
- package/lib/event/DataTransfer.js +4 -5
- package/lib/event/DataTransfer.js.map +1 -1
- package/lib/event/DataTransferItem.js +7 -8
- package/lib/event/DataTransferItem.js.map +1 -1
- package/lib/event/DataTransferItemList.js +10 -11
- package/lib/event/DataTransferItemList.js.map +1 -1
- package/lib/event/Event.js +11 -15
- package/lib/event/Event.js.map +1 -1
- package/lib/event/EventTarget.js +14 -16
- package/lib/event/EventTarget.js.map +1 -1
- package/lib/event/IUIEventInit.d.ts +2 -2
- package/lib/event/UIEvent.d.ts +2 -2
- package/lib/event/UIEvent.js +25 -46
- package/lib/event/UIEvent.js.map +1 -1
- package/lib/event/events/AnimationEvent.js +11 -29
- package/lib/event/events/AnimationEvent.js.map +1 -1
- package/lib/event/events/CustomEvent.js +9 -31
- package/lib/event/events/CustomEvent.js.map +1 -1
- package/lib/event/events/ErrorEvent.js +15 -34
- package/lib/event/events/ErrorEvent.js.map +1 -1
- package/lib/event/events/FocusEvent.js +7 -26
- package/lib/event/events/FocusEvent.js.map +1 -1
- package/lib/event/events/InputEvent.js +13 -32
- package/lib/event/events/InputEvent.js.map +1 -1
- package/lib/event/events/KeyboardEvent.js +27 -46
- package/lib/event/events/KeyboardEvent.js.map +1 -1
- package/lib/event/events/MouseEvent.js +33 -52
- package/lib/event/events/MouseEvent.js.map +1 -1
- package/lib/event/events/PointerEvent.js +25 -44
- package/lib/event/events/PointerEvent.js.map +1 -1
- package/lib/event/events/ProgressEvent.js +11 -30
- package/lib/event/events/ProgressEvent.js.map +1 -1
- package/lib/event/events/StorageEvent.js +13 -32
- package/lib/event/events/StorageEvent.js.map +1 -1
- package/lib/event/events/WheelEvent.js +16 -35
- package/lib/event/events/WheelEvent.js.map +1 -1
- package/lib/exception/DOMException.js +5 -24
- package/lib/exception/DOMException.js.map +1 -1
- package/lib/fetch/FetchHandler.js +18 -22
- package/lib/fetch/FetchHandler.js.map +1 -1
- package/lib/fetch/Headers.js +3 -23
- package/lib/fetch/Headers.js.map +1 -1
- package/lib/fetch/Request.js +61 -81
- package/lib/fetch/Request.js.map +1 -1
- package/lib/fetch/ResourceFetchHandler.js +18 -67
- package/lib/fetch/ResourceFetchHandler.js.map +1 -1
- package/lib/fetch/Response.js +61 -81
- package/lib/fetch/Response.js.map +1 -1
- package/lib/file/Blob.js +29 -78
- package/lib/file/Blob.js.map +1 -1
- package/lib/file/File.js +9 -27
- package/lib/file/File.js.map +1 -1
- package/lib/file/FileReader.js +57 -78
- package/lib/file/FileReader.js.map +1 -1
- package/lib/history/History.js +32 -37
- package/lib/history/History.js.map +1 -1
- package/lib/index.d.ts +3 -3
- package/lib/index.js +69 -69
- package/lib/index.js.map +1 -1
- package/lib/location/Location.js +11 -28
- package/lib/location/Location.js.map +1 -1
- package/lib/location/RelativeURL.js +5 -8
- package/lib/location/RelativeURL.js.map +1 -1
- package/lib/location/URL.js +46 -59
- package/lib/location/URL.js.map +1 -1
- package/lib/match-media/MediaQueryList.js +28 -54
- package/lib/match-media/MediaQueryList.js.map +1 -1
- package/lib/mutation-observer/MutationListener.js +3 -4
- package/lib/mutation-observer/MutationListener.js.map +1 -1
- package/lib/mutation-observer/MutationObserver.js +12 -13
- package/lib/mutation-observer/MutationObserver.js.map +1 -1
- package/lib/mutation-observer/MutationRecord.js +3 -4
- package/lib/mutation-observer/MutationRecord.js.map +1 -1
- package/lib/navigator/MimeType.js +5 -6
- package/lib/navigator/MimeType.js.map +1 -1
- package/lib/navigator/MimeTypeArray.js +10 -11
- package/lib/navigator/MimeTypeArray.js.map +1 -1
- package/lib/navigator/Navigator.js +7 -8
- package/lib/navigator/Navigator.js.map +1 -1
- package/lib/navigator/Plugin.js +10 -11
- package/lib/navigator/Plugin.js.map +1 -1
- package/lib/navigator/PluginArray.js +12 -13
- package/lib/navigator/PluginArray.js.map +1 -1
- package/lib/nodes/character-data/CharacterData.js +119 -184
- package/lib/nodes/character-data/CharacterData.js.map +1 -1
- package/lib/nodes/character-data/CharacterDataUtility.js +12 -15
- package/lib/nodes/character-data/CharacterDataUtility.js.map +1 -1
- package/lib/nodes/child-node/ChildNodeUtility.js +24 -45
- package/lib/nodes/child-node/ChildNodeUtility.js.map +1 -1
- package/lib/nodes/child-node/NonDocumentChildNodeUtility.js +9 -12
- package/lib/nodes/child-node/NonDocumentChildNodeUtility.js.map +1 -1
- package/lib/nodes/comment/Comment.js +20 -43
- package/lib/nodes/comment/Comment.js.map +1 -1
- package/lib/nodes/document/Document.d.ts +3 -3
- package/lib/nodes/document/Document.js +334 -461
- package/lib/nodes/document/Document.js.map +1 -1
- package/lib/nodes/document/DocumentReadyStateManager.js +16 -19
- package/lib/nodes/document/DocumentReadyStateManager.js.map +1 -1
- package/lib/nodes/document/IDocument.d.ts +2 -2
- package/lib/nodes/document-fragment/DocumentFragment.js +93 -153
- package/lib/nodes/document-fragment/DocumentFragment.js.map +1 -1
- package/lib/nodes/document-type/DocumentType.js +22 -45
- package/lib/nodes/document-type/DocumentType.js.map +1 -1
- package/lib/nodes/element/DOMRect.js +3 -4
- package/lib/nodes/element/DOMRect.js.map +1 -1
- package/lib/nodes/element/Element.js +367 -496
- package/lib/nodes/element/Element.js.map +1 -1
- package/lib/nodes/element/HTMLCollection.js +4 -24
- package/lib/nodes/element/HTMLCollection.js.map +1 -1
- package/lib/nodes/element/HTMLCollectionFactory.js +6 -9
- package/lib/nodes/element/HTMLCollectionFactory.js.map +1 -1
- package/lib/nodes/element/Range.js +89 -114
- package/lib/nodes/element/Range.js.map +1 -1
- package/lib/nodes/html-base-element/HTMLBaseElement.js +41 -70
- package/lib/nodes/html-base-element/HTMLBaseElement.js.map +1 -1
- package/lib/nodes/html-document/HTMLDocument.js +3 -23
- package/lib/nodes/html-document/HTMLDocument.js.map +1 -1
- package/lib/nodes/html-element/DatasetUtility.js +9 -12
- package/lib/nodes/html-element/DatasetUtility.js.map +1 -1
- package/lib/nodes/html-element/HTMLElement.js +232 -290
- package/lib/nodes/html-element/HTMLElement.js.map +1 -1
- package/lib/nodes/html-form-element/HTMLFormElement.js +170 -235
- package/lib/nodes/html-form-element/HTMLFormElement.js.map +1 -1
- package/lib/nodes/html-image-element/HTMLImageElement.js +178 -237
- package/lib/nodes/html-image-element/HTMLImageElement.js.map +1 -1
- package/lib/nodes/html-image-element/Image.js +7 -27
- package/lib/nodes/html-image-element/Image.js.map +1 -1
- package/lib/nodes/html-input-element/HTMLInputElement.js +705 -872
- package/lib/nodes/html-input-element/HTMLInputElement.js.map +1 -1
- package/lib/nodes/html-input-element/HTMLInputElementValueSanitizer.js +9 -12
- package/lib/nodes/html-input-element/HTMLInputElementValueSanitizer.js.map +1 -1
- package/lib/nodes/html-input-element/HTMLInputElementValueStepping.js +5 -8
- package/lib/nodes/html-input-element/HTMLInputElementValueStepping.js.map +1 -1
- package/lib/nodes/html-input-element/ValidityState.js +47 -69
- package/lib/nodes/html-input-element/ValidityState.js.map +1 -1
- package/lib/nodes/html-label-element/HTMLLabelElement.js +53 -87
- package/lib/nodes/html-label-element/HTMLLabelElement.js.map +1 -1
- package/lib/nodes/html-link-element/HTMLLinkElement.js +197 -252
- package/lib/nodes/html-link-element/HTMLLinkElement.js.map +1 -1
- package/lib/nodes/html-meta-element/HTMLMetaElement.js +66 -102
- package/lib/nodes/html-meta-element/HTMLMetaElement.js.map +1 -1
- package/lib/nodes/html-script-element/HTMLScriptElement.js +145 -193
- package/lib/nodes/html-script-element/HTMLScriptElement.js.map +1 -1
- package/lib/nodes/html-script-element/ScriptUtility.js +58 -112
- package/lib/nodes/html-script-element/ScriptUtility.js.map +1 -1
- package/lib/nodes/html-slot-element/HTMLSlotElement.js +33 -65
- package/lib/nodes/html-slot-element/HTMLSlotElement.js.map +1 -1
- package/lib/nodes/html-style-element/HTMLStyleElement.js +75 -109
- package/lib/nodes/html-style-element/HTMLStyleElement.js.map +1 -1
- package/lib/nodes/html-template-element/HTMLTemplateElement.js +60 -99
- package/lib/nodes/html-template-element/HTMLTemplateElement.js.map +1 -1
- package/lib/nodes/html-text-area-element/HTMLTextAreaElement.js +349 -444
- package/lib/nodes/html-text-area-element/HTMLTextAreaElement.js.map +1 -1
- package/lib/nodes/html-unknown-element/HTMLUnknownElement.js +17 -37
- package/lib/nodes/html-unknown-element/HTMLUnknownElement.js.map +1 -1
- package/lib/nodes/node/Node.js +193 -260
- package/lib/nodes/node/Node.js.map +1 -1
- package/lib/nodes/node/NodeList.js +4 -24
- package/lib/nodes/node/NodeList.js.map +1 -1
- package/lib/nodes/node/NodeListFactory.js +6 -9
- package/lib/nodes/node/NodeListFactory.js.map +1 -1
- package/lib/nodes/parent-node/ParentNodeUtility.js +43 -78
- package/lib/nodes/parent-node/ParentNodeUtility.js.map +1 -1
- package/lib/nodes/shadow-root/ShadowRoot.js +53 -83
- package/lib/nodes/shadow-root/ShadowRoot.js.map +1 -1
- package/lib/nodes/svg-document/SVGDocument.js +3 -23
- package/lib/nodes/svg-document/SVGDocument.js.map +1 -1
- package/lib/nodes/svg-element/DOMMatrix.js +3 -4
- package/lib/nodes/svg-element/DOMMatrix.js.map +1 -1
- package/lib/nodes/svg-element/SVGAngle.js +10 -11
- package/lib/nodes/svg-element/SVGAngle.js.map +1 -1
- package/lib/nodes/svg-element/SVGAnimatedRect.js +4 -5
- package/lib/nodes/svg-element/SVGAnimatedRect.js.map +1 -1
- package/lib/nodes/svg-element/SVGElement.js +58 -93
- package/lib/nodes/svg-element/SVGElement.js.map +1 -1
- package/lib/nodes/svg-element/SVGGraphicsElement.js +14 -32
- package/lib/nodes/svg-element/SVGGraphicsElement.js.map +1 -1
- package/lib/nodes/svg-element/SVGLength.js +16 -17
- package/lib/nodes/svg-element/SVGLength.js.map +1 -1
- package/lib/nodes/svg-element/SVGNumber.js +3 -4
- package/lib/nodes/svg-element/SVGNumber.js.map +1 -1
- package/lib/nodes/svg-element/SVGPoint.js +3 -4
- package/lib/nodes/svg-element/SVGPoint.js.map +1 -1
- package/lib/nodes/svg-element/SVGRect.js +3 -4
- package/lib/nodes/svg-element/SVGRect.js.map +1 -1
- package/lib/nodes/svg-element/SVGSVGElement.js +187 -248
- package/lib/nodes/svg-element/SVGSVGElement.js.map +1 -1
- package/lib/nodes/svg-element/SVGTransform.js +16 -17
- package/lib/nodes/svg-element/SVGTransform.js.map +1 -1
- package/lib/nodes/text/Text.js +20 -43
- package/lib/nodes/text/Text.js.map +1 -1
- package/lib/nodes/xml-document/XMLDocument.js +3 -23
- package/lib/nodes/xml-document/XMLDocument.js.map +1 -1
- package/lib/query-selector/QuerySelector.js +36 -44
- package/lib/query-selector/QuerySelector.js.map +1 -1
- package/lib/query-selector/SelectorItem.js +62 -66
- package/lib/query-selector/SelectorItem.js.map +1 -1
- package/lib/resize-observer/ResizeObserver.js +8 -11
- package/lib/resize-observer/ResizeObserver.js.map +1 -1
- package/lib/screen/Screen.js +3 -4
- package/lib/screen/Screen.js.map +1 -1
- package/lib/selection/Selection.js +29 -30
- package/lib/selection/Selection.js.map +1 -1
- package/lib/storage/Storage.js +22 -27
- package/lib/storage/Storage.js.map +1 -1
- package/lib/tree-walker/NodeFilterMask.js +1 -1
- package/lib/tree-walker/NodeFilterMask.js.map +1 -1
- package/lib/tree-walker/TreeWalker.js +30 -33
- package/lib/tree-walker/TreeWalker.js.map +1 -1
- package/lib/window/GlobalWindow.d.ts +90 -0
- package/lib/window/GlobalWindow.js +98 -0
- package/lib/window/GlobalWindow.js.map +1 -0
- package/lib/window/IWindow.d.ts +35 -18
- package/lib/window/VMGlobalPropertyScript.d.ts +2 -0
- package/lib/window/VMGlobalPropertyScript.js +65 -0
- package/lib/window/VMGlobalPropertyScript.js.map +1 -0
- package/lib/window/Window.d.ts +84 -105
- package/lib/window/Window.js +286 -490
- package/lib/window/Window.js.map +1 -1
- package/lib/xml-parser/XMLParser.js +65 -71
- package/lib/xml-parser/XMLParser.js.map +1 -1
- package/lib/xml-serializer/XMLSerializer.js +30 -37
- package/lib/xml-serializer/XMLSerializer.js.map +1 -1
- package/package.json +6 -7
- package/src/dom-parser/DOMParser.ts +4 -5
- package/src/event/IUIEventInit.ts +2 -2
- package/src/event/UIEvent.ts +2 -2
- package/src/fetch/FetchHandler.ts +3 -3
- package/src/fetch/ResourceFetchHandler.ts +2 -2
- package/src/index.ts +3 -3
- package/src/nodes/document/Document.ts +4 -4
- package/src/nodes/document/IDocument.ts +2 -2
- package/src/nodes/html-link-element/HTMLLinkElement.ts +8 -2
- package/src/nodes/html-script-element/ScriptUtility.ts +4 -4
- package/src/window/GlobalWindow.ts +91 -0
- package/src/window/IWindow.ts +31 -12
- package/src/window/VMGlobalPropertyScript.ts +62 -0
- package/src/window/Window.ts +125 -173
- package/tsconfig.json +1 -1
- package/lib/window/AsyncWindow.d.ts +0 -10
- package/lib/window/AsyncWindow.js +0 -38
- package/lib/window/AsyncWindow.js.map +0 -1
- package/src/window/AsyncWindow.ts +0 -17
@@ -0,0 +1,90 @@
|
|
1
|
+
/// <reference types="node" />
|
2
|
+
import Window from './Window';
|
3
|
+
/**
|
4
|
+
* Browser window.
|
5
|
+
*
|
6
|
+
* Reference:
|
7
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Window.
|
8
|
+
*/
|
9
|
+
export default class GlobalWindow extends Window {
|
10
|
+
ArrayBuffer: ArrayBufferConstructor;
|
11
|
+
Boolean: BooleanConstructor;
|
12
|
+
Buffer: typeof Buffer;
|
13
|
+
DataView: DataViewConstructor;
|
14
|
+
Date: DateConstructor;
|
15
|
+
Error: ErrorConstructor;
|
16
|
+
EvalError: EvalErrorConstructor;
|
17
|
+
Float32Array: Float32ArrayConstructor;
|
18
|
+
Float64Array: Float64ArrayConstructor;
|
19
|
+
GLOBAL: any;
|
20
|
+
Infinity: number;
|
21
|
+
Int16Array: Int16ArrayConstructor;
|
22
|
+
Int32Array: Int32ArrayConstructor;
|
23
|
+
Int8Array: Int8ArrayConstructor;
|
24
|
+
Intl: typeof Intl;
|
25
|
+
JSON: JSON;
|
26
|
+
Map: MapConstructor;
|
27
|
+
Math: Math;
|
28
|
+
NaN: number;
|
29
|
+
Number: NumberConstructor;
|
30
|
+
Promise: PromiseConstructor;
|
31
|
+
RangeError: RangeErrorConstructor;
|
32
|
+
ReferenceError: ReferenceErrorConstructor;
|
33
|
+
RegExp: RegExpConstructor;
|
34
|
+
Reflect: ArrayBufferConstructor;
|
35
|
+
Set: SetConstructor;
|
36
|
+
Symbol: SymbolConstructor;
|
37
|
+
SyntaxError: SyntaxErrorConstructor;
|
38
|
+
String: StringConstructor;
|
39
|
+
TypeError: TypeErrorConstructor;
|
40
|
+
URIError: URIErrorConstructor;
|
41
|
+
Uint16Array: Uint16ArrayConstructor;
|
42
|
+
Uint32Array: Uint32ArrayConstructor;
|
43
|
+
Uint8Array: Uint8ArrayConstructor;
|
44
|
+
Uint8ClampedArray: Uint8ClampedArrayConstructor;
|
45
|
+
WeakMap: WeakMapConstructor;
|
46
|
+
WeakSet: WeakSetConstructor;
|
47
|
+
clearImmediate: typeof clearImmediate;
|
48
|
+
decodeURI: typeof decodeURI;
|
49
|
+
decodeURIComponent: typeof decodeURIComponent;
|
50
|
+
encodeURI: typeof encodeURI;
|
51
|
+
encodeURIComponent: typeof encodeURIComponent;
|
52
|
+
escape: typeof escape;
|
53
|
+
global: NodeJS.Global & typeof globalThis;
|
54
|
+
isFinite: typeof isFinite;
|
55
|
+
isNaN: typeof isNaN;
|
56
|
+
parseFloat: typeof parseFloat;
|
57
|
+
parseInt: typeof parseInt;
|
58
|
+
process: NodeJS.Process;
|
59
|
+
root: ArrayBufferConstructor;
|
60
|
+
setImmediate: typeof setImmediate;
|
61
|
+
queueMicrotask: typeof queueMicrotask;
|
62
|
+
undefined: ArrayBufferConstructor;
|
63
|
+
unescape: typeof unescape;
|
64
|
+
gc: any;
|
65
|
+
v8debug: any;
|
66
|
+
AbortController: {
|
67
|
+
new (): AbortController;
|
68
|
+
prototype: AbortController;
|
69
|
+
};
|
70
|
+
AbortSignal: {
|
71
|
+
new (): AbortSignal;
|
72
|
+
prototype: AbortSignal;
|
73
|
+
};
|
74
|
+
Array: ArrayConstructor;
|
75
|
+
Object: ObjectConstructor;
|
76
|
+
Function: FunctionConstructor;
|
77
|
+
/**
|
78
|
+
* Evaluates code.
|
79
|
+
*
|
80
|
+
* @param code Code.
|
81
|
+
* @returns Result.
|
82
|
+
*/
|
83
|
+
eval(code: string): unknown;
|
84
|
+
/**
|
85
|
+
* Setup of VM context.
|
86
|
+
*
|
87
|
+
* @override
|
88
|
+
*/
|
89
|
+
protected _setupVMContext(): void;
|
90
|
+
}
|
@@ -0,0 +1,98 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const Window_1 = __importDefault(require("./Window"));
|
7
|
+
/**
|
8
|
+
* Browser window.
|
9
|
+
*
|
10
|
+
* Reference:
|
11
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Window.
|
12
|
+
*/
|
13
|
+
class GlobalWindow extends Window_1.default {
|
14
|
+
constructor() {
|
15
|
+
super(...arguments);
|
16
|
+
// Node.js Globals
|
17
|
+
this.ArrayBuffer = globalThis.ArrayBuffer;
|
18
|
+
this.Boolean = globalThis.Boolean;
|
19
|
+
this.Buffer = globalThis.global ? globalThis.global.Buffer : Buffer;
|
20
|
+
this.DataView = globalThis.DataView;
|
21
|
+
this.Date = globalThis.Date;
|
22
|
+
this.Error = globalThis.Error;
|
23
|
+
this.EvalError = globalThis.EvalError;
|
24
|
+
this.Float32Array = globalThis.Float32Array;
|
25
|
+
this.Float64Array = globalThis.Float64Array;
|
26
|
+
this.GLOBAL = globalThis.GLOBAL;
|
27
|
+
this.Infinity = globalThis.Infinity;
|
28
|
+
this.Int16Array = globalThis.Int16Array;
|
29
|
+
this.Int32Array = globalThis.Int32Array;
|
30
|
+
this.Int8Array = globalThis.Int8Array;
|
31
|
+
this.Intl = globalThis.Intl;
|
32
|
+
this.JSON = globalThis.JSON;
|
33
|
+
this.Map = globalThis.Map;
|
34
|
+
this.Math = globalThis.Math;
|
35
|
+
this.NaN = globalThis.NaN;
|
36
|
+
this.Number = globalThis.Number;
|
37
|
+
this.Promise = globalThis.Promise;
|
38
|
+
this.RangeError = globalThis.RangeError;
|
39
|
+
this.ReferenceError = globalThis.ReferenceError;
|
40
|
+
this.RegExp = globalThis.RegExp;
|
41
|
+
this.Reflect = globalThis.ArrayBuffer;
|
42
|
+
this.Set = globalThis.Set;
|
43
|
+
this.Symbol = globalThis.Symbol;
|
44
|
+
this.SyntaxError = globalThis.SyntaxError;
|
45
|
+
this.String = globalThis.String;
|
46
|
+
this.TypeError = globalThis.TypeError;
|
47
|
+
this.URIError = globalThis.URIError;
|
48
|
+
this.Uint16Array = globalThis.Uint16Array;
|
49
|
+
this.Uint32Array = globalThis.Uint32Array;
|
50
|
+
this.Uint8Array = globalThis.Uint8Array;
|
51
|
+
this.Uint8ClampedArray = globalThis.Uint8ClampedArray;
|
52
|
+
this.WeakMap = globalThis.WeakMap;
|
53
|
+
this.WeakSet = globalThis.WeakSet;
|
54
|
+
this.clearImmediate = globalThis.clearImmediate;
|
55
|
+
this.decodeURI = globalThis.decodeURI;
|
56
|
+
this.decodeURIComponent = globalThis.decodeURIComponent;
|
57
|
+
this.encodeURI = globalThis.encodeURI;
|
58
|
+
this.encodeURIComponent = globalThis.encodeURIComponent;
|
59
|
+
this.escape = globalThis.escape;
|
60
|
+
this.global = globalThis.global;
|
61
|
+
this.isFinite = globalThis.isFinite;
|
62
|
+
this.isNaN = globalThis.isNaN;
|
63
|
+
this.parseFloat = globalThis.parseFloat;
|
64
|
+
this.parseInt = globalThis.parseInt;
|
65
|
+
this.process = globalThis.process;
|
66
|
+
this.root = globalThis.ArrayBuffer;
|
67
|
+
this.setImmediate = globalThis.setImmediate;
|
68
|
+
this.queueMicrotask = globalThis.queueMicrotask;
|
69
|
+
this.undefined = globalThis.ArrayBuffer;
|
70
|
+
this.unescape = globalThis.unescape;
|
71
|
+
this.gc = globalThis.gc;
|
72
|
+
this.v8debug = globalThis.v8debug;
|
73
|
+
this.AbortController = globalThis.AbortController;
|
74
|
+
this.AbortSignal = globalThis.AbortSignal;
|
75
|
+
this.Array = globalThis.Array;
|
76
|
+
this.Object = globalThis.Object;
|
77
|
+
this.Function = globalThis.Function;
|
78
|
+
}
|
79
|
+
/**
|
80
|
+
* Evaluates code.
|
81
|
+
*
|
82
|
+
* @param code Code.
|
83
|
+
* @returns Result.
|
84
|
+
*/
|
85
|
+
eval(code) {
|
86
|
+
return eval(code);
|
87
|
+
}
|
88
|
+
/**
|
89
|
+
* Setup of VM context.
|
90
|
+
*
|
91
|
+
* @override
|
92
|
+
*/
|
93
|
+
_setupVMContext() {
|
94
|
+
// Do nothing
|
95
|
+
}
|
96
|
+
}
|
97
|
+
exports.default = GlobalWindow;
|
98
|
+
//# sourceMappingURL=GlobalWindow.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"GlobalWindow.js","sourceRoot":"","sources":["../../src/window/GlobalWindow.ts"],"names":[],"mappings":";;;;;AAAA,sDAA8B;AAE9B;;;;;GAKG;AACH,MAAqB,YAAa,SAAQ,gBAAM;IAAhD;;QACC,kBAAkB;QACX,gBAAW,GAAG,UAAU,CAAC,WAAW,CAAC;QACrC,YAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAC7B,WAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;QAC/D,aAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QAC/B,SAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QACvB,UAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QACzB,cAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACjC,iBAAY,GAAG,UAAU,CAAC,YAAY,CAAC;QACvC,iBAAY,GAAG,UAAU,CAAC,YAAY,CAAC;QACvC,WAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAC3B,aAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QAC/B,eAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACnC,eAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACnC,cAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACjC,SAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QACvB,SAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QACvB,QAAG,GAAG,UAAU,CAAC,GAAG,CAAC;QACrB,SAAI,GAAG,UAAU,CAAC,IAAI,CAAC;QACvB,QAAG,GAAG,UAAU,CAAC,GAAG,CAAC;QACrB,WAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAC3B,YAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAC7B,eAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACnC,mBAAc,GAAG,UAAU,CAAC,cAAc,CAAC;QAC3C,WAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAC3B,YAAO,GAAG,UAAU,CAAC,WAAW,CAAC;QACjC,QAAG,GAAG,UAAU,CAAC,GAAG,CAAC;QACrB,WAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAC3B,gBAAW,GAAG,UAAU,CAAC,WAAW,CAAC;QACrC,WAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAC3B,cAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACjC,aAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QAC/B,gBAAW,GAAG,UAAU,CAAC,WAAW,CAAC;QACrC,gBAAW,GAAG,UAAU,CAAC,WAAW,CAAC;QACrC,eAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACnC,sBAAiB,GAAG,UAAU,CAAC,iBAAiB,CAAC;QACjD,YAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAC7B,YAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAC7B,mBAAc,GAAG,UAAU,CAAC,cAAc,CAAC;QAC3C,cAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACjC,uBAAkB,GAAG,UAAU,CAAC,kBAAkB,CAAC;QACnD,cAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACjC,uBAAkB,GAAG,UAAU,CAAC,kBAAkB,CAAC;QACnD,WAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAC3B,WAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAC3B,aAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QAC/B,UAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QACzB,eAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACnC,aAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QAC/B,YAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAC7B,SAAI,GAAG,UAAU,CAAC,WAAW,CAAC;QAC9B,iBAAY,GAAG,UAAU,CAAC,YAAY,CAAC;QACvC,mBAAc,GAAG,UAAU,CAAC,cAAc,CAAC;QAC3C,cAAS,GAAG,UAAU,CAAC,WAAW,CAAC;QACnC,aAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QAC/B,OAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACnB,YAAO,GAAG,UAAU,CAAC,OAAO,CAAC;QAC7B,oBAAe,GAAG,UAAU,CAAC,eAAe,CAAC;QAC7C,gBAAW,GAAG,UAAU,CAAC,WAAW,CAAC;QACrC,UAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QACzB,WAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAC3B,aAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;IAoBvC,CAAC;IAlBA;;;;;OAKG;IACI,IAAI,CAAC,IAAY;QACvB,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACO,eAAe;QACxB,aAAa;IACd,CAAC;CACD;AAlFD,+BAkFC"}
|
package/lib/window/IWindow.d.ts
CHANGED
@@ -12,6 +12,7 @@ import Element from '../nodes/element/Element';
|
|
12
12
|
import HTMLTemplateElement from '../nodes/html-template-element/HTMLTemplateElement';
|
13
13
|
import HTMLFormElement from '../nodes/html-form-element/HTMLFormElement';
|
14
14
|
import HTMLElement from '../nodes/html-element/HTMLElement';
|
15
|
+
import IHTMLElement from '../nodes/html-element/IHTMLElement';
|
15
16
|
import HTMLUnknownElement from '../nodes/html-unknown-element/HTMLUnknownElement';
|
16
17
|
import HTMLInputElement from '../nodes/html-input-element/HTMLInputElement';
|
17
18
|
import HTMLTextAreaElement from '../nodes/html-text-area-element/HTMLTextAreaElement';
|
@@ -63,14 +64,8 @@ import ErrorEvent from '../event/events/ErrorEvent';
|
|
63
64
|
import StorageEvent from '../event/events/StorageEvent';
|
64
65
|
import Screen from '../screen/Screen';
|
65
66
|
import AsyncTaskManager from '../async-task-manager/AsyncTaskManager';
|
66
|
-
import IResponse from '../fetch/IResponse';
|
67
|
-
import IResponseInit from '../fetch/IResponseInit';
|
68
|
-
import IRequest from '../fetch/IRequest';
|
69
|
-
import IRequestInit from '../fetch/IRequestInit';
|
70
|
-
import IHeaders from '../fetch/IHeaders';
|
71
67
|
import Storage from '../storage/Storage';
|
72
68
|
import NodeFilter from '../tree-walker/NodeFilter';
|
73
|
-
import Window from './Window';
|
74
69
|
import HTMLCollection from '../nodes/element/HTMLCollection';
|
75
70
|
import NodeList from '../nodes/node/NodeList';
|
76
71
|
import Selection from '../selection/Selection';
|
@@ -80,11 +75,19 @@ import MimeType from '../navigator/MimeType';
|
|
80
75
|
import MimeTypeArray from '../navigator/MimeTypeArray';
|
81
76
|
import Plugin from '../navigator/Plugin';
|
82
77
|
import PluginArray from '../navigator/PluginArray';
|
78
|
+
import IResponseInit from '../fetch/IResponseInit';
|
79
|
+
import IRequest from '../fetch/IRequest';
|
80
|
+
import IHeaders from '../fetch/IHeaders';
|
81
|
+
import IRequestInit from '../fetch/IRequestInit';
|
82
|
+
import IResponse from '../fetch/IResponse';
|
83
|
+
import MediaQueryList from '../match-media/MediaQueryList';
|
84
|
+
import Window from './Window';
|
83
85
|
import { URLSearchParams } from 'url';
|
86
|
+
import { Performance } from 'perf_hooks';
|
84
87
|
/**
|
85
|
-
* Window.
|
88
|
+
* Window without dependencies to server side specific packages.
|
86
89
|
*/
|
87
|
-
export default interface IWindow extends IEventTarget {
|
90
|
+
export default interface IWindow extends IEventTarget, NodeJS.Global {
|
88
91
|
readonly happyDOM: {
|
89
92
|
whenAsyncComplete: () => Promise<void>;
|
90
93
|
cancelAsync: () => void;
|
@@ -143,15 +146,6 @@ export default interface IWindow extends IEventTarget {
|
|
143
146
|
readonly Location: typeof Location;
|
144
147
|
readonly CustomElementRegistry: typeof CustomElementRegistry;
|
145
148
|
readonly Window: typeof Window;
|
146
|
-
readonly Headers: {
|
147
|
-
new (init?: string[][] | Record<string, string> | IHeaders): IHeaders;
|
148
|
-
};
|
149
|
-
readonly Request: {
|
150
|
-
new (input: string | IRequest, init?: IRequestInit): IRequest;
|
151
|
-
};
|
152
|
-
readonly Response: {
|
153
|
-
new (body?: unknown | null, init?: IResponseInit): IResponse;
|
154
|
-
};
|
155
149
|
readonly XMLSerializer: typeof XMLSerializer;
|
156
150
|
readonly ResizeObserver: typeof ResizeObserver;
|
157
151
|
readonly CSSStyleSheet: typeof CSSStyleSheet;
|
@@ -173,6 +167,15 @@ export default interface IWindow extends IEventTarget {
|
|
173
167
|
readonly MimeTypeArray: typeof MimeTypeArray;
|
174
168
|
readonly Plugin: typeof Plugin;
|
175
169
|
readonly PluginArray: typeof PluginArray;
|
170
|
+
readonly Headers: {
|
171
|
+
new (init?: string[][] | Record<string, string> | IHeaders): IHeaders;
|
172
|
+
};
|
173
|
+
readonly Request: {
|
174
|
+
new (input: string | IRequest, init?: IRequestInit): IRequest;
|
175
|
+
};
|
176
|
+
readonly Response: {
|
177
|
+
new (body?: unknown | null, init?: IResponseInit): IResponse;
|
178
|
+
};
|
176
179
|
onload: (event: Event) => void;
|
177
180
|
onerror: (event: ErrorEvent) => void;
|
178
181
|
readonly document: Document;
|
@@ -191,6 +194,7 @@ export default interface IWindow extends IEventTarget {
|
|
191
194
|
readonly innerHeight: number;
|
192
195
|
readonly sessionStorage: Storage;
|
193
196
|
readonly localStorage: Storage;
|
197
|
+
readonly performance: Performance;
|
194
198
|
/**
|
195
199
|
* Evaluates code.
|
196
200
|
*
|
@@ -204,7 +208,13 @@ export default interface IWindow extends IEventTarget {
|
|
204
208
|
* @param element Element.
|
205
209
|
* @returns CSS style declaration.
|
206
210
|
*/
|
207
|
-
getComputedStyle(element:
|
211
|
+
getComputedStyle(element: IHTMLElement): CSSStyleDeclaration;
|
212
|
+
/**
|
213
|
+
* Returns selection.
|
214
|
+
*
|
215
|
+
* @returns Selection.
|
216
|
+
*/
|
217
|
+
getSelection(): Selection;
|
208
218
|
/**
|
209
219
|
* Scrolls to a particular set of coordinates.
|
210
220
|
*
|
@@ -227,6 +237,13 @@ export default interface IWindow extends IEventTarget {
|
|
227
237
|
left?: number;
|
228
238
|
behavior?: string;
|
229
239
|
} | number, y?: number): void;
|
240
|
+
/**
|
241
|
+
* Returns a new MediaQueryList object that can then be used to determine if the document matches the media query string.
|
242
|
+
*
|
243
|
+
* @param mediaQueryString A string specifying the media query to parse into a MediaQueryList.
|
244
|
+
* @returns A new MediaQueryList.
|
245
|
+
*/
|
246
|
+
matchMedia(mediaQueryString: string): MediaQueryList;
|
230
247
|
/**
|
231
248
|
* Sets a timer which executes a function once the timer expires.
|
232
249
|
*
|
@@ -0,0 +1,2 @@
|
|
1
|
+
declare const _default: "\nthis.ArrayBuffer = globalThis.ArrayBuffer;\nthis.Boolean = globalThis.Boolean;\nthis.DataView = globalThis.DataView;\nthis.Date = globalThis.Date;\nthis.Error = globalThis.Error;\nthis.EvalError = globalThis.EvalError;\nthis.Float32Array = globalThis.Float32Array;\nthis.Float64Array = globalThis.Float64Array;\nthis.GLOBAL = globalThis.GLOBAL;\nthis.Infinity = globalThis.Infinity;\nthis.Int16Array = globalThis.Int16Array;\nthis.Int32Array = globalThis.Int32Array;\nthis.Int8Array = globalThis.Int8Array;\nthis.Intl = globalThis.Intl;\nthis.JSON = globalThis.JSON;\nthis.Map = globalThis.Map;\nthis.Math = globalThis.Math;\nthis.NaN = globalThis.NaN;\nthis.Number = globalThis.Number;\nthis.Promise = globalThis.Promise;\nthis.RangeError = globalThis.RangeError;\nthis.ReferenceError = globalThis.ReferenceError;\nthis.RegExp = globalThis.RegExp;\nthis.Reflect = globalThis.Reflect;\nthis.Set = globalThis.Set;\nthis.Symbol = globalThis.Symbol;\nthis.SyntaxError = globalThis.SyntaxError;\nthis.String = globalThis.String;\nthis.TypeError = globalThis.TypeError;\nthis.URIError = globalThis.URIError;\nthis.Uint16Array = globalThis.Uint16Array;\nthis.Uint32Array = globalThis.Uint32Array;\nthis.Uint8Array = globalThis.Uint8Array;\nthis.Uint8ClampedArray = globalThis.Uint8ClampedArray;\nthis.WeakMap = globalThis.WeakMap;\nthis.WeakSet = globalThis.WeakSet;\nthis.clearImmediate = globalThis.clearImmediate;\nthis.decodeURI = globalThis.decodeURI;\nthis.decodeURIComponent = globalThis.decodeURIComponent;\nthis.encodeURI = globalThis.encodeURI;\nthis.encodeURIComponent = globalThis.encodeURIComponent;\nthis.escape = globalThis.escape;\nthis.global = globalThis.global;\nthis.isFinite = globalThis.isFinite;\nthis.isNaN = globalThis.isNaN;\nthis.parseFloat = globalThis.parseFloat;\nthis.parseInt = globalThis.parseInt;\nthis.process = globalThis.process;\nthis.root = globalThis.root;\nthis.setImmediate = globalThis.setImmediate;\nthis.queueMicrotask = globalThis.queueMicrotask;\nthis.undefined = globalThis.undefined;\nthis.unescape = globalThis.unescape;\nthis.gc = globalThis.gc;\nthis.v8debug = globalThis.v8debug;\nthis.AbortController = globalThis.AbortController;\nthis.AbortSignal = globalThis.AbortSignal;\nthis.Array = globalThis.Array;\nthis.Object = globalThis.Object;\nthis.Function = globalThis.Function;\n";
|
2
|
+
export default _default;
|
@@ -0,0 +1,65 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.default = `
|
4
|
+
this.ArrayBuffer = globalThis.ArrayBuffer;
|
5
|
+
this.Boolean = globalThis.Boolean;
|
6
|
+
this.DataView = globalThis.DataView;
|
7
|
+
this.Date = globalThis.Date;
|
8
|
+
this.Error = globalThis.Error;
|
9
|
+
this.EvalError = globalThis.EvalError;
|
10
|
+
this.Float32Array = globalThis.Float32Array;
|
11
|
+
this.Float64Array = globalThis.Float64Array;
|
12
|
+
this.GLOBAL = globalThis.GLOBAL;
|
13
|
+
this.Infinity = globalThis.Infinity;
|
14
|
+
this.Int16Array = globalThis.Int16Array;
|
15
|
+
this.Int32Array = globalThis.Int32Array;
|
16
|
+
this.Int8Array = globalThis.Int8Array;
|
17
|
+
this.Intl = globalThis.Intl;
|
18
|
+
this.JSON = globalThis.JSON;
|
19
|
+
this.Map = globalThis.Map;
|
20
|
+
this.Math = globalThis.Math;
|
21
|
+
this.NaN = globalThis.NaN;
|
22
|
+
this.Number = globalThis.Number;
|
23
|
+
this.Promise = globalThis.Promise;
|
24
|
+
this.RangeError = globalThis.RangeError;
|
25
|
+
this.ReferenceError = globalThis.ReferenceError;
|
26
|
+
this.RegExp = globalThis.RegExp;
|
27
|
+
this.Reflect = globalThis.Reflect;
|
28
|
+
this.Set = globalThis.Set;
|
29
|
+
this.Symbol = globalThis.Symbol;
|
30
|
+
this.SyntaxError = globalThis.SyntaxError;
|
31
|
+
this.String = globalThis.String;
|
32
|
+
this.TypeError = globalThis.TypeError;
|
33
|
+
this.URIError = globalThis.URIError;
|
34
|
+
this.Uint16Array = globalThis.Uint16Array;
|
35
|
+
this.Uint32Array = globalThis.Uint32Array;
|
36
|
+
this.Uint8Array = globalThis.Uint8Array;
|
37
|
+
this.Uint8ClampedArray = globalThis.Uint8ClampedArray;
|
38
|
+
this.WeakMap = globalThis.WeakMap;
|
39
|
+
this.WeakSet = globalThis.WeakSet;
|
40
|
+
this.clearImmediate = globalThis.clearImmediate;
|
41
|
+
this.decodeURI = globalThis.decodeURI;
|
42
|
+
this.decodeURIComponent = globalThis.decodeURIComponent;
|
43
|
+
this.encodeURI = globalThis.encodeURI;
|
44
|
+
this.encodeURIComponent = globalThis.encodeURIComponent;
|
45
|
+
this.escape = globalThis.escape;
|
46
|
+
this.global = globalThis.global;
|
47
|
+
this.isFinite = globalThis.isFinite;
|
48
|
+
this.isNaN = globalThis.isNaN;
|
49
|
+
this.parseFloat = globalThis.parseFloat;
|
50
|
+
this.parseInt = globalThis.parseInt;
|
51
|
+
this.process = globalThis.process;
|
52
|
+
this.root = globalThis.root;
|
53
|
+
this.setImmediate = globalThis.setImmediate;
|
54
|
+
this.queueMicrotask = globalThis.queueMicrotask;
|
55
|
+
this.undefined = globalThis.undefined;
|
56
|
+
this.unescape = globalThis.unescape;
|
57
|
+
this.gc = globalThis.gc;
|
58
|
+
this.v8debug = globalThis.v8debug;
|
59
|
+
this.AbortController = globalThis.AbortController;
|
60
|
+
this.AbortSignal = globalThis.AbortSignal;
|
61
|
+
this.Array = globalThis.Array;
|
62
|
+
this.Object = globalThis.Object;
|
63
|
+
this.Function = globalThis.Function;
|
64
|
+
`;
|
65
|
+
//# sourceMappingURL=VMGlobalPropertyScript.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"VMGlobalPropertyScript.js","sourceRoot":"","sources":["../../src/window/VMGlobalPropertyScript.ts"],"names":[],"mappings":";;AAAA,kBAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Dd,CAAC"}
|
package/lib/window/Window.d.ts
CHANGED
@@ -75,17 +75,20 @@ import HTMLCollection from '../nodes/element/HTMLCollection';
|
|
75
75
|
import NodeList from '../nodes/node/NodeList';
|
76
76
|
import MediaQueryList from '../match-media/MediaQueryList';
|
77
77
|
import Selection from '../selection/Selection';
|
78
|
-
import * as PerfHooks from 'perf_hooks';
|
79
78
|
import Navigator from '../navigator/Navigator';
|
80
79
|
import MimeType from '../navigator/MimeType';
|
81
80
|
import MimeTypeArray from '../navigator/MimeTypeArray';
|
82
81
|
import Plugin from '../navigator/Plugin';
|
83
82
|
import PluginArray from '../navigator/PluginArray';
|
84
83
|
import { URLSearchParams } from 'url';
|
84
|
+
import * as PerfHooks from 'perf_hooks';
|
85
85
|
/**
|
86
|
-
*
|
86
|
+
* Browser window.
|
87
|
+
*
|
88
|
+
* Reference:
|
89
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Window.
|
87
90
|
*/
|
88
|
-
export default class Window extends EventTarget implements IWindow
|
91
|
+
export default class Window extends EventTarget implements IWindow {
|
89
92
|
readonly happyDOM: {
|
90
93
|
whenAsyncComplete: () => Promise<void>;
|
91
94
|
cancelAsync: () => void;
|
@@ -182,6 +185,17 @@ export default class Window extends EventTarget implements IWindow, NodeJS.Globa
|
|
182
185
|
readonly MimeTypeArray: typeof MimeTypeArray;
|
183
186
|
readonly Plugin: typeof Plugin;
|
184
187
|
readonly PluginArray: typeof PluginArray;
|
188
|
+
readonly Headers: {
|
189
|
+
new (init?: IHeadersInit): IHeaders;
|
190
|
+
};
|
191
|
+
readonly Request: {
|
192
|
+
new (input: string | {
|
193
|
+
href: string;
|
194
|
+
} | IRequest, init?: IRequestInit): IRequest;
|
195
|
+
};
|
196
|
+
readonly Response: {
|
197
|
+
new (body?: NodeJS.ReadableStream | null, init?: IResponseInit): IResponse;
|
198
|
+
};
|
185
199
|
onload: (event: Event) => void;
|
186
200
|
onerror: (event: ErrorEvent) => void;
|
187
201
|
readonly document: Document;
|
@@ -202,130 +216,85 @@ export default class Window extends EventTarget implements IWindow, NodeJS.Globa
|
|
202
216
|
readonly sessionStorage: Storage;
|
203
217
|
readonly localStorage: Storage;
|
204
218
|
readonly performance: PerfHooks.Performance;
|
205
|
-
ArrayBuffer:
|
206
|
-
Boolean:
|
207
|
-
Buffer:
|
208
|
-
DataView:
|
209
|
-
Date:
|
210
|
-
Error:
|
211
|
-
EvalError:
|
212
|
-
Float32Array:
|
213
|
-
Float64Array:
|
219
|
+
ArrayBuffer: any;
|
220
|
+
Boolean: any;
|
221
|
+
Buffer: typeof globalThis.Buffer;
|
222
|
+
DataView: any;
|
223
|
+
Date: any;
|
224
|
+
Error: any;
|
225
|
+
EvalError: any;
|
226
|
+
Float32Array: any;
|
227
|
+
Float64Array: any;
|
214
228
|
GLOBAL: any;
|
215
|
-
Infinity:
|
216
|
-
Int16Array:
|
217
|
-
Int32Array:
|
218
|
-
Int8Array:
|
219
|
-
Intl:
|
220
|
-
JSON:
|
221
|
-
Map:
|
222
|
-
Math:
|
223
|
-
NaN:
|
224
|
-
Number:
|
225
|
-
Promise:
|
226
|
-
RangeError:
|
227
|
-
ReferenceError:
|
228
|
-
RegExp:
|
229
|
-
Reflect:
|
230
|
-
Set:
|
231
|
-
Symbol:
|
232
|
-
SyntaxError:
|
233
|
-
String:
|
234
|
-
TypeError:
|
235
|
-
URIError:
|
236
|
-
Uint16Array:
|
237
|
-
Uint32Array:
|
238
|
-
Uint8Array:
|
239
|
-
Uint8ClampedArray:
|
240
|
-
WeakMap:
|
241
|
-
WeakSet:
|
229
|
+
Infinity: any;
|
230
|
+
Int16Array: any;
|
231
|
+
Int32Array: any;
|
232
|
+
Int8Array: any;
|
233
|
+
Intl: any;
|
234
|
+
JSON: any;
|
235
|
+
Map: any;
|
236
|
+
Math: any;
|
237
|
+
NaN: any;
|
238
|
+
Number: any;
|
239
|
+
Promise: any;
|
240
|
+
RangeError: any;
|
241
|
+
ReferenceError: any;
|
242
|
+
RegExp: any;
|
243
|
+
Reflect: any;
|
244
|
+
Set: any;
|
245
|
+
Symbol: any;
|
246
|
+
SyntaxError: any;
|
247
|
+
String: any;
|
248
|
+
TypeError: any;
|
249
|
+
URIError: any;
|
250
|
+
Uint16Array: any;
|
251
|
+
Uint32Array: any;
|
252
|
+
Uint8Array: any;
|
253
|
+
Uint8ClampedArray: any;
|
254
|
+
WeakMap: any;
|
255
|
+
WeakSet: any;
|
242
256
|
clearImmediate: any;
|
243
|
-
decodeURI:
|
244
|
-
decodeURIComponent:
|
245
|
-
encodeURI:
|
246
|
-
encodeURIComponent:
|
247
|
-
escape:
|
257
|
+
decodeURI: any;
|
258
|
+
decodeURIComponent: any;
|
259
|
+
encodeURI: any;
|
260
|
+
encodeURIComponent: any;
|
261
|
+
escape: any;
|
248
262
|
global: any;
|
249
|
-
isFinite:
|
250
|
-
isNaN:
|
251
|
-
parseFloat:
|
252
|
-
parseInt:
|
263
|
+
isFinite: any;
|
264
|
+
isNaN: any;
|
265
|
+
parseFloat: any;
|
266
|
+
parseInt: any;
|
253
267
|
process: any;
|
254
268
|
root: any;
|
255
269
|
setImmediate: any;
|
256
|
-
queueMicrotask:
|
270
|
+
queueMicrotask: any;
|
257
271
|
undefined: any;
|
258
|
-
unescape:
|
272
|
+
unescape: any;
|
259
273
|
gc: any;
|
260
274
|
v8debug: any;
|
261
|
-
AbortController:
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
private
|
270
|
-
private _arrayClass;
|
271
|
-
private _functionClass;
|
275
|
+
AbortController: any;
|
276
|
+
AbortSignal: any;
|
277
|
+
Array: any;
|
278
|
+
Object: any;
|
279
|
+
Function: any;
|
280
|
+
private _setTimeout;
|
281
|
+
private _clearTimeout;
|
282
|
+
private _setInterval;
|
283
|
+
private _clearInterval;
|
272
284
|
/**
|
273
285
|
* Constructor.
|
274
286
|
*/
|
275
287
|
constructor();
|
276
|
-
/**
|
277
|
-
* Returns Object class.
|
278
|
-
*
|
279
|
-
* @returns Object class.
|
280
|
-
*/
|
281
|
-
get Object(): typeof globalThis.Object;
|
282
|
-
/**
|
283
|
-
* Returns Array class.
|
284
|
-
*
|
285
|
-
* @returns Array class.
|
286
|
-
*/
|
287
|
-
get Array(): typeof globalThis.Array;
|
288
|
-
/**
|
289
|
-
* Returns Function class.
|
290
|
-
*
|
291
|
-
* @returns Function class.
|
292
|
-
*/
|
293
|
-
get Function(): typeof globalThis.Function;
|
294
288
|
/**
|
295
289
|
* The CSS interface holds useful CSS-related methods.
|
296
290
|
*
|
297
291
|
* @returns CSS interface.
|
298
292
|
*/
|
299
293
|
get CSS(): CSS;
|
300
|
-
/**
|
301
|
-
* Returns Headers class.
|
302
|
-
*
|
303
|
-
* @returns Headers.
|
304
|
-
*/
|
305
|
-
get Headers(): {
|
306
|
-
new (init?: IHeadersInit): IHeaders;
|
307
|
-
};
|
308
|
-
/**
|
309
|
-
* Returns Request class.
|
310
|
-
*
|
311
|
-
* @returns Request.
|
312
|
-
*/
|
313
|
-
get Request(): {
|
314
|
-
new (input: string | {
|
315
|
-
href: string;
|
316
|
-
} | IRequest, init?: IRequestInit): IRequest;
|
317
|
-
};
|
318
|
-
/**
|
319
|
-
* Returns Response class.
|
320
|
-
*
|
321
|
-
* @returns Response.
|
322
|
-
*/
|
323
|
-
get Response(): {
|
324
|
-
new (body?: NodeJS.ReadableStream | null, init?: IResponseInit): IResponse;
|
325
|
-
};
|
326
294
|
/**
|
327
295
|
* Evaluates code.
|
328
296
|
*
|
297
|
+
* @override
|
329
298
|
* @param code Code.
|
330
299
|
* @returns Result.
|
331
300
|
*/
|
@@ -337,6 +306,12 @@ export default class Window extends EventTarget implements IWindow, NodeJS.Globa
|
|
337
306
|
* @returns CSS style declaration.
|
338
307
|
*/
|
339
308
|
getComputedStyle(element: HTMLElement): CSSStyleDeclaration;
|
309
|
+
/**
|
310
|
+
* Returns selection.
|
311
|
+
*
|
312
|
+
* @returns Selection.
|
313
|
+
*/
|
314
|
+
getSelection(): Selection;
|
340
315
|
/**
|
341
316
|
* Scrolls to a particular set of coordinates.
|
342
317
|
*
|
@@ -422,4 +397,8 @@ export default class Window extends EventTarget implements IWindow, NodeJS.Globa
|
|
422
397
|
* @returns Promise.
|
423
398
|
*/
|
424
399
|
fetch(url: string, init?: IRequestInit): Promise<IResponse>;
|
400
|
+
/**
|
401
|
+
* Setup of VM context.
|
402
|
+
*/
|
403
|
+
protected _setupVMContext(): void;
|
425
404
|
}
|