happy-dom 2.54.0 → 3.1.0

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.

Files changed (299) hide show
  1. package/README.md +26 -6
  2. package/lib/async-task-manager/AsyncTaskManager.js +34 -78
  3. package/lib/async-task-manager/AsyncTaskManager.js.map +1 -1
  4. package/lib/attribute/Attr.js +19 -28
  5. package/lib/attribute/Attr.js.map +1 -1
  6. package/lib/config/ElementTag.d.ts +2 -1
  7. package/lib/config/ElementTag.js +16 -15
  8. package/lib/config/ElementTag.js.map +1 -1
  9. package/lib/config/NonImplemenetedElementClasses.js +0 -1
  10. package/lib/config/NonImplemenetedElementClasses.js.map +1 -1
  11. package/lib/cookie/CookieUtility.js +21 -26
  12. package/lib/cookie/CookieUtility.js.map +1 -1
  13. package/lib/css/CSS.js +12 -18
  14. package/lib/css/CSS.js.map +1 -1
  15. package/lib/css/CSSParser.js +29 -33
  16. package/lib/css/CSSParser.js.map +1 -1
  17. package/lib/css/CSSRule.js +24 -29
  18. package/lib/css/CSSRule.js.map +1 -1
  19. package/lib/css/CSSStyleDeclaration.js +4516 -6005
  20. package/lib/css/CSSStyleDeclaration.js.map +1 -1
  21. package/lib/css/CSSStyleSheet.js +17 -59
  22. package/lib/css/CSSStyleSheet.js.map +1 -1
  23. package/lib/css/CSSUnitValue.js +4 -5
  24. package/lib/css/CSSUnitValue.js.map +1 -1
  25. package/lib/css/MediaList.js +23 -28
  26. package/lib/css/MediaList.js.map +1 -1
  27. package/lib/css/rules/CSSFontFaceRule.js +6 -24
  28. package/lib/css/rules/CSSFontFaceRule.js.map +1 -1
  29. package/lib/css/rules/CSSKeyframeRule.js +14 -36
  30. package/lib/css/rules/CSSKeyframeRule.js.map +1 -1
  31. package/lib/css/rules/CSSKeyframesRule.js +31 -54
  32. package/lib/css/rules/CSSKeyframesRule.js.map +1 -1
  33. package/lib/css/rules/CSSMediaRule.js +29 -56
  34. package/lib/css/rules/CSSMediaRule.js.map +1 -1
  35. package/lib/css/rules/CSSStyleRule.js +16 -38
  36. package/lib/css/rules/CSSStyleRule.js.map +1 -1
  37. package/lib/custom-element/CustomElementRegistry.js +21 -24
  38. package/lib/custom-element/CustomElementRegistry.js.map +1 -1
  39. package/lib/dom-implementation/DOMImplementation.js +12 -13
  40. package/lib/dom-implementation/DOMImplementation.js.map +1 -1
  41. package/lib/dom-parser/DOMParser.js +29 -35
  42. package/lib/dom-parser/DOMParser.js.map +1 -1
  43. package/lib/dom-token-list/DOMTokenList.js +64 -79
  44. package/lib/dom-token-list/DOMTokenList.js.map +1 -1
  45. package/lib/event/DataTransfer.js +4 -5
  46. package/lib/event/DataTransfer.js.map +1 -1
  47. package/lib/event/DataTransferItem.js +7 -8
  48. package/lib/event/DataTransferItem.js.map +1 -1
  49. package/lib/event/DataTransferItemList.js +10 -11
  50. package/lib/event/DataTransferItemList.js.map +1 -1
  51. package/lib/event/Event.js +11 -15
  52. package/lib/event/Event.js.map +1 -1
  53. package/lib/event/EventTarget.js +14 -16
  54. package/lib/event/EventTarget.js.map +1 -1
  55. package/lib/event/IUIEventInit.d.ts +2 -2
  56. package/lib/event/UIEvent.d.ts +2 -2
  57. package/lib/event/UIEvent.js +25 -46
  58. package/lib/event/UIEvent.js.map +1 -1
  59. package/lib/event/events/AnimationEvent.js +11 -29
  60. package/lib/event/events/AnimationEvent.js.map +1 -1
  61. package/lib/event/events/CustomEvent.js +9 -31
  62. package/lib/event/events/CustomEvent.js.map +1 -1
  63. package/lib/event/events/ErrorEvent.js +15 -34
  64. package/lib/event/events/ErrorEvent.js.map +1 -1
  65. package/lib/event/events/FocusEvent.js +7 -26
  66. package/lib/event/events/FocusEvent.js.map +1 -1
  67. package/lib/event/events/InputEvent.js +13 -32
  68. package/lib/event/events/InputEvent.js.map +1 -1
  69. package/lib/event/events/KeyboardEvent.js +27 -46
  70. package/lib/event/events/KeyboardEvent.js.map +1 -1
  71. package/lib/event/events/MouseEvent.js +33 -52
  72. package/lib/event/events/MouseEvent.js.map +1 -1
  73. package/lib/event/events/PointerEvent.js +25 -44
  74. package/lib/event/events/PointerEvent.js.map +1 -1
  75. package/lib/event/events/ProgressEvent.js +11 -30
  76. package/lib/event/events/ProgressEvent.js.map +1 -1
  77. package/lib/event/events/StorageEvent.js +13 -32
  78. package/lib/event/events/StorageEvent.js.map +1 -1
  79. package/lib/event/events/WheelEvent.js +16 -35
  80. package/lib/event/events/WheelEvent.js.map +1 -1
  81. package/lib/exception/DOMException.js +5 -24
  82. package/lib/exception/DOMException.js.map +1 -1
  83. package/lib/fetch/FetchHandler.js +18 -22
  84. package/lib/fetch/FetchHandler.js.map +1 -1
  85. package/lib/fetch/Headers.js +3 -23
  86. package/lib/fetch/Headers.js.map +1 -1
  87. package/lib/fetch/Request.js +61 -81
  88. package/lib/fetch/Request.js.map +1 -1
  89. package/lib/fetch/ResourceFetchHandler.js +18 -67
  90. package/lib/fetch/ResourceFetchHandler.js.map +1 -1
  91. package/lib/fetch/Response.js +61 -81
  92. package/lib/fetch/Response.js.map +1 -1
  93. package/lib/file/Blob.js +29 -78
  94. package/lib/file/Blob.js.map +1 -1
  95. package/lib/file/File.js +9 -27
  96. package/lib/file/File.js.map +1 -1
  97. package/lib/file/FileReader.js +57 -78
  98. package/lib/file/FileReader.js.map +1 -1
  99. package/lib/history/History.js +32 -37
  100. package/lib/history/History.js.map +1 -1
  101. package/lib/index.d.ts +5 -3
  102. package/lib/index.js +71 -69
  103. package/lib/index.js.map +1 -1
  104. package/lib/location/Location.js +11 -28
  105. package/lib/location/Location.js.map +1 -1
  106. package/lib/location/RelativeURL.js +5 -8
  107. package/lib/location/RelativeURL.js.map +1 -1
  108. package/lib/location/URL.js +46 -59
  109. package/lib/location/URL.js.map +1 -1
  110. package/lib/match-media/MediaQueryList.js +28 -54
  111. package/lib/match-media/MediaQueryList.js.map +1 -1
  112. package/lib/mutation-observer/MutationListener.js +3 -4
  113. package/lib/mutation-observer/MutationListener.js.map +1 -1
  114. package/lib/mutation-observer/MutationObserver.js +12 -13
  115. package/lib/mutation-observer/MutationObserver.js.map +1 -1
  116. package/lib/mutation-observer/MutationRecord.js +3 -4
  117. package/lib/mutation-observer/MutationRecord.js.map +1 -1
  118. package/lib/navigator/MimeType.js +5 -6
  119. package/lib/navigator/MimeType.js.map +1 -1
  120. package/lib/navigator/MimeTypeArray.js +10 -11
  121. package/lib/navigator/MimeTypeArray.js.map +1 -1
  122. package/lib/navigator/Navigator.js +7 -8
  123. package/lib/navigator/Navigator.js.map +1 -1
  124. package/lib/navigator/Plugin.js +10 -11
  125. package/lib/navigator/Plugin.js.map +1 -1
  126. package/lib/navigator/PluginArray.js +12 -13
  127. package/lib/navigator/PluginArray.js.map +1 -1
  128. package/lib/nodes/character-data/CharacterData.js +119 -184
  129. package/lib/nodes/character-data/CharacterData.js.map +1 -1
  130. package/lib/nodes/character-data/CharacterDataUtility.js +12 -15
  131. package/lib/nodes/character-data/CharacterDataUtility.js.map +1 -1
  132. package/lib/nodes/child-node/ChildNodeUtility.js +24 -45
  133. package/lib/nodes/child-node/ChildNodeUtility.js.map +1 -1
  134. package/lib/nodes/child-node/NonDocumentChildNodeUtility.js +9 -12
  135. package/lib/nodes/child-node/NonDocumentChildNodeUtility.js.map +1 -1
  136. package/lib/nodes/comment/Comment.js +20 -43
  137. package/lib/nodes/comment/Comment.js.map +1 -1
  138. package/lib/nodes/document/Document.d.ts +3 -3
  139. package/lib/nodes/document/Document.js +334 -461
  140. package/lib/nodes/document/Document.js.map +1 -1
  141. package/lib/nodes/document/DocumentReadyStateManager.js +16 -19
  142. package/lib/nodes/document/DocumentReadyStateManager.js.map +1 -1
  143. package/lib/nodes/document/IDocument.d.ts +2 -2
  144. package/lib/nodes/document-fragment/DocumentFragment.js +93 -153
  145. package/lib/nodes/document-fragment/DocumentFragment.js.map +1 -1
  146. package/lib/nodes/document-type/DocumentType.js +22 -45
  147. package/lib/nodes/document-type/DocumentType.js.map +1 -1
  148. package/lib/nodes/element/DOMRect.js +3 -4
  149. package/lib/nodes/element/DOMRect.js.map +1 -1
  150. package/lib/nodes/element/Element.js +367 -496
  151. package/lib/nodes/element/Element.js.map +1 -1
  152. package/lib/nodes/element/HTMLCollection.js +4 -24
  153. package/lib/nodes/element/HTMLCollection.js.map +1 -1
  154. package/lib/nodes/element/HTMLCollectionFactory.js +6 -9
  155. package/lib/nodes/element/HTMLCollectionFactory.js.map +1 -1
  156. package/lib/nodes/element/Range.js +89 -114
  157. package/lib/nodes/element/Range.js.map +1 -1
  158. package/lib/nodes/html-base-element/HTMLBaseElement.d.ts +42 -0
  159. package/lib/nodes/html-base-element/HTMLBaseElement.js +62 -0
  160. package/lib/nodes/html-base-element/HTMLBaseElement.js.map +1 -0
  161. package/lib/nodes/html-base-element/IHTMLBaseElement.d.ts +19 -0
  162. package/lib/nodes/html-base-element/IHTMLBaseElement.js +3 -0
  163. package/lib/nodes/html-base-element/IHTMLBaseElement.js.map +1 -0
  164. package/lib/nodes/html-document/HTMLDocument.js +3 -23
  165. package/lib/nodes/html-document/HTMLDocument.js.map +1 -1
  166. package/lib/nodes/html-element/DatasetUtility.js +9 -12
  167. package/lib/nodes/html-element/DatasetUtility.js.map +1 -1
  168. package/lib/nodes/html-element/HTMLElement.js +232 -290
  169. package/lib/nodes/html-element/HTMLElement.js.map +1 -1
  170. package/lib/nodes/html-form-element/HTMLFormElement.js +170 -235
  171. package/lib/nodes/html-form-element/HTMLFormElement.js.map +1 -1
  172. package/lib/nodes/html-image-element/HTMLImageElement.js +178 -237
  173. package/lib/nodes/html-image-element/HTMLImageElement.js.map +1 -1
  174. package/lib/nodes/html-image-element/Image.js +7 -27
  175. package/lib/nodes/html-image-element/Image.js.map +1 -1
  176. package/lib/nodes/html-input-element/HTMLInputElement.js +705 -872
  177. package/lib/nodes/html-input-element/HTMLInputElement.js.map +1 -1
  178. package/lib/nodes/html-input-element/HTMLInputElementValueSanitizer.js +9 -12
  179. package/lib/nodes/html-input-element/HTMLInputElementValueSanitizer.js.map +1 -1
  180. package/lib/nodes/html-input-element/HTMLInputElementValueStepping.js +5 -8
  181. package/lib/nodes/html-input-element/HTMLInputElementValueStepping.js.map +1 -1
  182. package/lib/nodes/html-input-element/ValidityState.js +47 -69
  183. package/lib/nodes/html-input-element/ValidityState.js.map +1 -1
  184. package/lib/nodes/html-label-element/HTMLLabelElement.js +53 -87
  185. package/lib/nodes/html-label-element/HTMLLabelElement.js.map +1 -1
  186. package/lib/nodes/html-link-element/HTMLLinkElement.js +197 -252
  187. package/lib/nodes/html-link-element/HTMLLinkElement.js.map +1 -1
  188. package/lib/nodes/html-meta-element/HTMLMetaElement.js +66 -102
  189. package/lib/nodes/html-meta-element/HTMLMetaElement.js.map +1 -1
  190. package/lib/nodes/html-script-element/HTMLScriptElement.js +145 -193
  191. package/lib/nodes/html-script-element/HTMLScriptElement.js.map +1 -1
  192. package/lib/nodes/html-script-element/ScriptUtility.js +58 -112
  193. package/lib/nodes/html-script-element/ScriptUtility.js.map +1 -1
  194. package/lib/nodes/html-slot-element/HTMLSlotElement.js +33 -65
  195. package/lib/nodes/html-slot-element/HTMLSlotElement.js.map +1 -1
  196. package/lib/nodes/html-style-element/HTMLStyleElement.js +75 -109
  197. package/lib/nodes/html-style-element/HTMLStyleElement.js.map +1 -1
  198. package/lib/nodes/html-template-element/HTMLTemplateElement.js +60 -99
  199. package/lib/nodes/html-template-element/HTMLTemplateElement.js.map +1 -1
  200. package/lib/nodes/html-text-area-element/HTMLTextAreaElement.js +349 -444
  201. package/lib/nodes/html-text-area-element/HTMLTextAreaElement.js.map +1 -1
  202. package/lib/nodes/html-unknown-element/HTMLUnknownElement.js +17 -37
  203. package/lib/nodes/html-unknown-element/HTMLUnknownElement.js.map +1 -1
  204. package/lib/nodes/node/INode.d.ts +1 -0
  205. package/lib/nodes/node/Node.d.ts +6 -0
  206. package/lib/nodes/node/Node.js +193 -244
  207. package/lib/nodes/node/Node.js.map +1 -1
  208. package/lib/nodes/node/NodeList.js +4 -24
  209. package/lib/nodes/node/NodeList.js.map +1 -1
  210. package/lib/nodes/node/NodeListFactory.js +6 -9
  211. package/lib/nodes/node/NodeListFactory.js.map +1 -1
  212. package/lib/nodes/parent-node/ParentNodeUtility.js +43 -78
  213. package/lib/nodes/parent-node/ParentNodeUtility.js.map +1 -1
  214. package/lib/nodes/shadow-root/ShadowRoot.js +53 -83
  215. package/lib/nodes/shadow-root/ShadowRoot.js.map +1 -1
  216. package/lib/nodes/svg-document/SVGDocument.js +3 -23
  217. package/lib/nodes/svg-document/SVGDocument.js.map +1 -1
  218. package/lib/nodes/svg-element/DOMMatrix.js +3 -4
  219. package/lib/nodes/svg-element/DOMMatrix.js.map +1 -1
  220. package/lib/nodes/svg-element/SVGAngle.js +10 -11
  221. package/lib/nodes/svg-element/SVGAngle.js.map +1 -1
  222. package/lib/nodes/svg-element/SVGAnimatedRect.js +4 -5
  223. package/lib/nodes/svg-element/SVGAnimatedRect.js.map +1 -1
  224. package/lib/nodes/svg-element/SVGElement.js +58 -93
  225. package/lib/nodes/svg-element/SVGElement.js.map +1 -1
  226. package/lib/nodes/svg-element/SVGGraphicsElement.js +14 -32
  227. package/lib/nodes/svg-element/SVGGraphicsElement.js.map +1 -1
  228. package/lib/nodes/svg-element/SVGLength.js +16 -17
  229. package/lib/nodes/svg-element/SVGLength.js.map +1 -1
  230. package/lib/nodes/svg-element/SVGNumber.js +3 -4
  231. package/lib/nodes/svg-element/SVGNumber.js.map +1 -1
  232. package/lib/nodes/svg-element/SVGPoint.js +3 -4
  233. package/lib/nodes/svg-element/SVGPoint.js.map +1 -1
  234. package/lib/nodes/svg-element/SVGRect.js +3 -4
  235. package/lib/nodes/svg-element/SVGRect.js.map +1 -1
  236. package/lib/nodes/svg-element/SVGSVGElement.js +187 -248
  237. package/lib/nodes/svg-element/SVGSVGElement.js.map +1 -1
  238. package/lib/nodes/svg-element/SVGTransform.js +16 -17
  239. package/lib/nodes/svg-element/SVGTransform.js.map +1 -1
  240. package/lib/nodes/text/Text.js +20 -43
  241. package/lib/nodes/text/Text.js.map +1 -1
  242. package/lib/nodes/xml-document/XMLDocument.js +3 -23
  243. package/lib/nodes/xml-document/XMLDocument.js.map +1 -1
  244. package/lib/query-selector/QuerySelector.js +36 -44
  245. package/lib/query-selector/QuerySelector.js.map +1 -1
  246. package/lib/query-selector/SelectorItem.js +62 -66
  247. package/lib/query-selector/SelectorItem.js.map +1 -1
  248. package/lib/resize-observer/ResizeObserver.js +8 -11
  249. package/lib/resize-observer/ResizeObserver.js.map +1 -1
  250. package/lib/screen/Screen.js +3 -4
  251. package/lib/screen/Screen.js.map +1 -1
  252. package/lib/selection/Selection.js +29 -30
  253. package/lib/selection/Selection.js.map +1 -1
  254. package/lib/storage/Storage.js +22 -27
  255. package/lib/storage/Storage.js.map +1 -1
  256. package/lib/tree-walker/NodeFilterMask.js +1 -1
  257. package/lib/tree-walker/NodeFilterMask.js.map +1 -1
  258. package/lib/tree-walker/TreeWalker.js +30 -33
  259. package/lib/tree-walker/TreeWalker.js.map +1 -1
  260. package/lib/window/GlobalWindow.d.ts +84 -0
  261. package/lib/window/GlobalWindow.js +90 -0
  262. package/lib/window/GlobalWindow.js.map +1 -0
  263. package/lib/window/IWindow.d.ts +37 -18
  264. package/lib/window/VMGlobalPropertyScript.d.ts +2 -0
  265. package/lib/window/VMGlobalPropertyScript.js +65 -0
  266. package/lib/window/VMGlobalPropertyScript.js.map +1 -0
  267. package/lib/window/Window.d.ts +78 -105
  268. package/lib/window/Window.js +277 -489
  269. package/lib/window/Window.js.map +1 -1
  270. package/lib/xml-parser/XMLParser.js +65 -71
  271. package/lib/xml-parser/XMLParser.js.map +1 -1
  272. package/lib/xml-serializer/XMLSerializer.js +30 -37
  273. package/lib/xml-serializer/XMLSerializer.js.map +1 -1
  274. package/package.json +6 -7
  275. package/src/config/ElementTag.ts +2 -1
  276. package/src/config/NonImplemenetedElementClasses.ts +0 -1
  277. package/src/dom-parser/DOMParser.ts +4 -5
  278. package/src/event/IUIEventInit.ts +2 -2
  279. package/src/event/UIEvent.ts +2 -2
  280. package/src/fetch/FetchHandler.ts +3 -3
  281. package/src/fetch/ResourceFetchHandler.ts +3 -3
  282. package/src/index.ts +7 -3
  283. package/src/nodes/document/Document.ts +4 -4
  284. package/src/nodes/document/IDocument.ts +2 -2
  285. package/src/nodes/html-base-element/HTMLBaseElement.ts +61 -0
  286. package/src/nodes/html-base-element/IHTMLBaseElement.ts +21 -0
  287. package/src/nodes/html-link-element/HTMLLinkElement.ts +8 -2
  288. package/src/nodes/html-script-element/ScriptUtility.ts +4 -4
  289. package/src/nodes/node/INode.ts +1 -0
  290. package/src/nodes/node/Node.ts +14 -0
  291. package/src/window/GlobalWindow.ts +82 -0
  292. package/src/window/IWindow.ts +33 -12
  293. package/src/window/VMGlobalPropertyScript.ts +62 -0
  294. package/src/window/Window.ts +115 -173
  295. package/tsconfig.json +1 -1
  296. package/lib/window/AsyncWindow.d.ts +0 -10
  297. package/lib/window/AsyncWindow.js +0 -38
  298. package/lib/window/AsyncWindow.js.map +0 -1
  299. package/src/window/AsyncWindow.ts +0 -17
@@ -0,0 +1,84 @@
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
+ }
@@ -0,0 +1,90 @@
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
+ exports.default = GlobalWindow;
90
+ //# sourceMappingURL=GlobalWindow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GlobalWindow.js","sourceRoot":"","sources":["../../src/window/GlobalWindow.ts"],"names":[],"mappings":"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"}
@@ -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';
@@ -20,6 +21,7 @@ import HTMLStyleElement from '../nodes/html-style-element/HTMLStyleElement';
20
21
  import HTMLSlotElement from '../nodes/html-slot-element/HTMLSlotElement';
21
22
  import HTMLLabelElement from '../nodes/html-label-element/HTMLLabelElement';
22
23
  import HTMLMetaElement from '../nodes/html-meta-element/HTMLMetaElement';
24
+ import HTMLBaseElement from '../nodes/html-base-element/HTMLBaseElement';
23
25
  import SVGSVGElement from '../nodes/svg-element/SVGSVGElement';
24
26
  import SVGElement from '../nodes/svg-element/SVGElement';
25
27
  import HTMLScriptElement from '../nodes/html-script-element/HTMLScriptElement';
@@ -62,14 +64,8 @@ import ErrorEvent from '../event/events/ErrorEvent';
62
64
  import StorageEvent from '../event/events/StorageEvent';
63
65
  import Screen from '../screen/Screen';
64
66
  import AsyncTaskManager from '../async-task-manager/AsyncTaskManager';
65
- import IResponse from '../fetch/IResponse';
66
- import IResponseInit from '../fetch/IResponseInit';
67
- import IRequest from '../fetch/IRequest';
68
- import IRequestInit from '../fetch/IRequestInit';
69
- import IHeaders from '../fetch/IHeaders';
70
67
  import Storage from '../storage/Storage';
71
68
  import NodeFilter from '../tree-walker/NodeFilter';
72
- import Window from './Window';
73
69
  import HTMLCollection from '../nodes/element/HTMLCollection';
74
70
  import NodeList from '../nodes/node/NodeList';
75
71
  import Selection from '../selection/Selection';
@@ -79,11 +75,19 @@ import MimeType from '../navigator/MimeType';
79
75
  import MimeTypeArray from '../navigator/MimeTypeArray';
80
76
  import Plugin from '../navigator/Plugin';
81
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';
82
85
  import { URLSearchParams } from 'url';
86
+ import { Performance } from 'perf_hooks';
83
87
  /**
84
- * Window.
88
+ * Window without dependencies to server side specific packages.
85
89
  */
86
- export default interface IWindow extends IEventTarget {
90
+ export default interface IWindow extends IEventTarget, NodeJS.Global {
87
91
  readonly happyDOM: {
88
92
  whenAsyncComplete: () => Promise<void>;
89
93
  cancelAsync: () => void;
@@ -103,6 +107,7 @@ export default interface IWindow extends IEventTarget {
103
107
  readonly HTMLSlotElement: typeof HTMLSlotElement;
104
108
  readonly HTMLLabelElement: typeof HTMLLabelElement;
105
109
  readonly HTMLMetaElement: typeof HTMLMetaElement;
110
+ readonly HTMLBaseElement: typeof HTMLBaseElement;
106
111
  readonly SVGSVGElement: typeof SVGSVGElement;
107
112
  readonly SVGElement: typeof SVGElement;
108
113
  readonly Image: typeof Image;
@@ -141,15 +146,6 @@ export default interface IWindow extends IEventTarget {
141
146
  readonly Location: typeof Location;
142
147
  readonly CustomElementRegistry: typeof CustomElementRegistry;
143
148
  readonly Window: typeof Window;
144
- readonly Headers: {
145
- new (init?: string[][] | Record<string, string> | IHeaders): IHeaders;
146
- };
147
- readonly Request: {
148
- new (input: string | IRequest, init?: IRequestInit): IRequest;
149
- };
150
- readonly Response: {
151
- new (body?: unknown | null, init?: IResponseInit): IResponse;
152
- };
153
149
  readonly XMLSerializer: typeof XMLSerializer;
154
150
  readonly ResizeObserver: typeof ResizeObserver;
155
151
  readonly CSSStyleSheet: typeof CSSStyleSheet;
@@ -171,6 +167,15 @@ export default interface IWindow extends IEventTarget {
171
167
  readonly MimeTypeArray: typeof MimeTypeArray;
172
168
  readonly Plugin: typeof Plugin;
173
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
+ };
174
179
  onload: (event: Event) => void;
175
180
  onerror: (event: ErrorEvent) => void;
176
181
  readonly document: Document;
@@ -189,6 +194,7 @@ export default interface IWindow extends IEventTarget {
189
194
  readonly innerHeight: number;
190
195
  readonly sessionStorage: Storage;
191
196
  readonly localStorage: Storage;
197
+ readonly performance: Performance;
192
198
  /**
193
199
  * Evaluates code.
194
200
  *
@@ -202,7 +208,13 @@ export default interface IWindow extends IEventTarget {
202
208
  * @param element Element.
203
209
  * @returns CSS style declaration.
204
210
  */
205
- getComputedStyle(element: HTMLElement): CSSStyleDeclaration;
211
+ getComputedStyle(element: IHTMLElement): CSSStyleDeclaration;
212
+ /**
213
+ * Returns selection.
214
+ *
215
+ * @returns Selection.
216
+ */
217
+ getSelection(): Selection;
206
218
  /**
207
219
  * Scrolls to a particular set of coordinates.
208
220
  *
@@ -225,6 +237,13 @@ export default interface IWindow extends IEventTarget {
225
237
  left?: number;
226
238
  behavior?: string;
227
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;
228
247
  /**
229
248
  * Sets a timer which executes a function once the timer expires.
230
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"}
@@ -20,6 +20,7 @@ import HTMLStyleElement from '../nodes/html-style-element/HTMLStyleElement';
20
20
  import HTMLSlotElement from '../nodes/html-slot-element/HTMLSlotElement';
21
21
  import HTMLLabelElement from '../nodes/html-label-element/HTMLLabelElement';
22
22
  import HTMLMetaElement from '../nodes/html-meta-element/HTMLMetaElement';
23
+ import HTMLBaseElement from '../nodes/html-base-element/HTMLBaseElement';
23
24
  import SVGSVGElement from '../nodes/svg-element/SVGSVGElement';
24
25
  import SVGElement from '../nodes/svg-element/SVGElement';
25
26
  import HTMLScriptElement from '../nodes/html-script-element/HTMLScriptElement';
@@ -74,17 +75,20 @@ import HTMLCollection from '../nodes/element/HTMLCollection';
74
75
  import NodeList from '../nodes/node/NodeList';
75
76
  import MediaQueryList from '../match-media/MediaQueryList';
76
77
  import Selection from '../selection/Selection';
77
- import * as PerfHooks from 'perf_hooks';
78
78
  import Navigator from '../navigator/Navigator';
79
79
  import MimeType from '../navigator/MimeType';
80
80
  import MimeTypeArray from '../navigator/MimeTypeArray';
81
81
  import Plugin from '../navigator/Plugin';
82
82
  import PluginArray from '../navigator/PluginArray';
83
83
  import { URLSearchParams } from 'url';
84
+ import * as PerfHooks from 'perf_hooks';
84
85
  /**
85
- * Handles the Window.
86
+ * Browser window.
87
+ *
88
+ * Reference:
89
+ * https://developer.mozilla.org/en-US/docs/Web/API/Window.
86
90
  */
87
- export default class Window extends EventTarget implements IWindow, NodeJS.Global {
91
+ export default class Window extends EventTarget implements IWindow {
88
92
  readonly happyDOM: {
89
93
  whenAsyncComplete: () => Promise<void>;
90
94
  cancelAsync: () => void;
@@ -105,6 +109,7 @@ export default class Window extends EventTarget implements IWindow, NodeJS.Globa
105
109
  readonly HTMLLabelElement: typeof HTMLLabelElement;
106
110
  readonly HTMLSlotElement: typeof HTMLSlotElement;
107
111
  readonly HTMLMetaElement: typeof HTMLMetaElement;
112
+ readonly HTMLBaseElement: typeof HTMLBaseElement;
108
113
  readonly SVGSVGElement: typeof SVGSVGElement;
109
114
  readonly SVGElement: typeof SVGElement;
110
115
  readonly Text: typeof Text;
@@ -180,6 +185,17 @@ export default class Window extends EventTarget implements IWindow, NodeJS.Globa
180
185
  readonly MimeTypeArray: typeof MimeTypeArray;
181
186
  readonly Plugin: typeof Plugin;
182
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
+ };
183
199
  onload: (event: Event) => void;
184
200
  onerror: (event: ErrorEvent) => void;
185
201
  readonly document: Document;
@@ -200,130 +216,81 @@ export default class Window extends EventTarget implements IWindow, NodeJS.Globa
200
216
  readonly sessionStorage: Storage;
201
217
  readonly localStorage: Storage;
202
218
  readonly performance: PerfHooks.Performance;
203
- ArrayBuffer: ArrayBufferConstructor;
204
- Boolean: BooleanConstructor;
205
- Buffer: any;
206
- DataView: DataViewConstructor;
207
- Date: DateConstructor;
208
- Error: ErrorConstructor;
209
- EvalError: EvalErrorConstructor;
210
- Float32Array: Float32ArrayConstructor;
211
- Float64Array: Float64ArrayConstructor;
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;
212
228
  GLOBAL: any;
213
- Infinity: number;
214
- Int16Array: Int16ArrayConstructor;
215
- Int32Array: Int32ArrayConstructor;
216
- Int8Array: Int8ArrayConstructor;
217
- Intl: typeof Intl;
218
- JSON: JSON;
219
- Map: MapConstructor;
220
- Math: Math;
221
- NaN: number;
222
- Number: NumberConstructor;
223
- Promise: PromiseConstructor;
224
- RangeError: RangeErrorConstructor;
225
- ReferenceError: ReferenceErrorConstructor;
226
- RegExp: RegExpConstructor;
227
- Reflect: typeof Reflect;
228
- Set: SetConstructor;
229
- Symbol: Function & SymbolConstructor;
230
- SyntaxError: SyntaxErrorConstructor;
231
- String: StringConstructor;
232
- TypeError: TypeErrorConstructor;
233
- URIError: URIErrorConstructor;
234
- Uint16Array: Uint16ArrayConstructor;
235
- Uint32Array: Uint32ArrayConstructor;
236
- Uint8Array: Uint8ArrayConstructor;
237
- Uint8ClampedArray: Uint8ClampedArrayConstructor;
238
- WeakMap: WeakMapConstructor;
239
- WeakSet: WeakSetConstructor;
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;
240
256
  clearImmediate: any;
241
- decodeURI: typeof decodeURI;
242
- decodeURIComponent: typeof decodeURIComponent;
243
- encodeURI: typeof encodeURI;
244
- encodeURIComponent: typeof encodeURIComponent;
245
- escape: ((str: string) => string) & typeof escape;
257
+ decodeURI: any;
258
+ decodeURIComponent: any;
259
+ encodeURI: any;
260
+ encodeURIComponent: any;
261
+ escape: any;
246
262
  global: any;
247
- isFinite: typeof isFinite;
248
- isNaN: typeof isNaN;
249
- parseFloat: typeof parseFloat;
250
- parseInt: typeof parseInt;
263
+ isFinite: any;
264
+ isNaN: any;
265
+ parseFloat: any;
266
+ parseInt: any;
251
267
  process: any;
252
268
  root: any;
253
269
  setImmediate: any;
254
- queueMicrotask: typeof queueMicrotask;
270
+ queueMicrotask: any;
255
271
  undefined: any;
256
- unescape: ((str: string) => string) & typeof unescape;
272
+ unescape: any;
257
273
  gc: any;
258
274
  v8debug: any;
259
- AbortController: {
260
- new (): AbortController;
261
- prototype: AbortController;
262
- };
263
- AbortSignal: {
264
- new (): AbortSignal;
265
- prototype: AbortSignal;
266
- };
267
- private _objectClass;
268
- private _arrayClass;
269
- private _functionClass;
275
+ AbortController: any;
276
+ AbortSignal: any;
277
+ Array: any;
278
+ Object: any;
279
+ Function: any;
270
280
  /**
271
281
  * Constructor.
272
282
  */
273
283
  constructor();
274
- /**
275
- * Returns Object class.
276
- *
277
- * @returns Object class.
278
- */
279
- get Object(): typeof globalThis.Object;
280
- /**
281
- * Returns Array class.
282
- *
283
- * @returns Array class.
284
- */
285
- get Array(): typeof globalThis.Array;
286
- /**
287
- * Returns Function class.
288
- *
289
- * @returns Function class.
290
- */
291
- get Function(): typeof globalThis.Function;
292
284
  /**
293
285
  * The CSS interface holds useful CSS-related methods.
294
286
  *
295
287
  * @returns CSS interface.
296
288
  */
297
289
  get CSS(): CSS;
298
- /**
299
- * Returns Headers class.
300
- *
301
- * @returns Headers.
302
- */
303
- get Headers(): {
304
- new (init?: IHeadersInit): IHeaders;
305
- };
306
- /**
307
- * Returns Request class.
308
- *
309
- * @returns Request.
310
- */
311
- get Request(): {
312
- new (input: string | {
313
- href: string;
314
- } | IRequest, init?: IRequestInit): IRequest;
315
- };
316
- /**
317
- * Returns Response class.
318
- *
319
- * @returns Response.
320
- */
321
- get Response(): {
322
- new (body?: NodeJS.ReadableStream | null, init?: IResponseInit): IResponse;
323
- };
324
290
  /**
325
291
  * Evaluates code.
326
292
  *
293
+ * @override
327
294
  * @param code Code.
328
295
  * @returns Result.
329
296
  */
@@ -335,6 +302,12 @@ export default class Window extends EventTarget implements IWindow, NodeJS.Globa
335
302
  * @returns CSS style declaration.
336
303
  */
337
304
  getComputedStyle(element: HTMLElement): CSSStyleDeclaration;
305
+ /**
306
+ * Returns selection.
307
+ *
308
+ * @returns Selection.
309
+ */
310
+ getSelection(): Selection;
338
311
  /**
339
312
  * Scrolls to a particular set of coordinates.
340
313
  *