happy-dom 12.7.0 → 12.8.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.

Files changed (183) hide show
  1. package/cjs/clipboard/Clipboard.cjs +103 -0
  2. package/cjs/clipboard/Clipboard.cjs.map +1 -0
  3. package/cjs/clipboard/Clipboard.d.ts +42 -0
  4. package/cjs/clipboard/Clipboard.d.ts.map +1 -0
  5. package/cjs/clipboard/ClipboardItem.cjs +69 -0
  6. package/cjs/clipboard/ClipboardItem.cjs.map +1 -0
  7. package/cjs/clipboard/ClipboardItem.d.ts +37 -0
  8. package/cjs/clipboard/ClipboardItem.d.ts.map +1 -0
  9. package/cjs/event/DataTransfer.cjs +71 -2
  10. package/cjs/event/DataTransfer.cjs.map +1 -1
  11. package/cjs/event/DataTransfer.d.ts +41 -4
  12. package/cjs/event/DataTransfer.d.ts.map +1 -1
  13. package/cjs/event/DataTransferItem.cjs +27 -9
  14. package/cjs/event/DataTransferItem.cjs.map +1 -1
  15. package/cjs/event/DataTransferItem.d.ts +10 -4
  16. package/cjs/event/DataTransferItem.d.ts.map +1 -1
  17. package/cjs/event/DataTransferItemList.cjs +16 -8
  18. package/cjs/event/DataTransferItemList.cjs.map +1 -1
  19. package/cjs/event/DataTransferItemList.d.ts +3 -3
  20. package/cjs/event/DataTransferItemList.d.ts.map +1 -1
  21. package/cjs/event/events/ClipboardEvent.cjs +23 -0
  22. package/cjs/event/events/ClipboardEvent.cjs.map +1 -0
  23. package/cjs/event/events/ClipboardEvent.d.ts +17 -0
  24. package/cjs/event/events/ClipboardEvent.d.ts.map +1 -0
  25. package/cjs/event/events/IClipboardEventInit.cjs +3 -0
  26. package/cjs/event/events/IClipboardEventInit.cjs.map +1 -0
  27. package/cjs/event/events/IClipboardEventInit.d.ts +6 -0
  28. package/cjs/event/events/IClipboardEventInit.d.ts.map +1 -0
  29. package/cjs/index.cjs +15 -2
  30. package/cjs/index.cjs.map +1 -1
  31. package/cjs/index.d.ts +8 -1
  32. package/cjs/index.d.ts.map +1 -1
  33. package/cjs/mutation-observer/MutationListener.cjs +1 -0
  34. package/cjs/mutation-observer/MutationListener.cjs.map +1 -1
  35. package/cjs/mutation-observer/MutationListener.d.ts +3 -1
  36. package/cjs/mutation-observer/MutationListener.d.ts.map +1 -1
  37. package/cjs/mutation-observer/MutationObserver.cjs +1 -0
  38. package/cjs/mutation-observer/MutationObserver.cjs.map +1 -1
  39. package/cjs/mutation-observer/MutationObserver.d.ts +1 -1
  40. package/cjs/mutation-observer/MutationObserver.d.ts.map +1 -1
  41. package/cjs/navigator/Navigator.cjs +38 -5
  42. package/cjs/navigator/Navigator.cjs.map +1 -1
  43. package/cjs/navigator/Navigator.d.ts +17 -4
  44. package/cjs/navigator/Navigator.d.ts.map +1 -1
  45. package/cjs/nodes/character-data/CharacterData.cjs +1 -1
  46. package/cjs/nodes/character-data/CharacterData.cjs.map +1 -1
  47. package/cjs/nodes/element/ElementNamedNodeMap.cjs +2 -2
  48. package/cjs/nodes/element/ElementNamedNodeMap.cjs.map +1 -1
  49. package/cjs/nodes/html-input-element/HTMLInputElement.cjs +48 -25
  50. package/cjs/nodes/html-input-element/HTMLInputElement.cjs.map +1 -1
  51. package/cjs/nodes/html-input-element/HTMLInputElement.d.ts.map +1 -1
  52. package/cjs/nodes/node/NodeUtility.cjs +3 -3
  53. package/cjs/nodes/node/NodeUtility.cjs.map +1 -1
  54. package/cjs/permissions/PermissionNameEnum.cjs +35 -0
  55. package/cjs/permissions/PermissionNameEnum.cjs.map +1 -0
  56. package/cjs/permissions/PermissionNameEnum.d.ts +32 -0
  57. package/cjs/permissions/PermissionNameEnum.d.ts.map +1 -0
  58. package/cjs/permissions/PermissionStatus.cjs +26 -0
  59. package/cjs/permissions/PermissionStatus.cjs.map +1 -0
  60. package/cjs/permissions/PermissionStatus.d.ts +19 -0
  61. package/cjs/permissions/PermissionStatus.d.ts.map +1 -0
  62. package/cjs/permissions/Permissions.cjs +46 -0
  63. package/cjs/permissions/Permissions.cjs.map +1 -0
  64. package/cjs/permissions/Permissions.d.ts +25 -0
  65. package/cjs/permissions/Permissions.d.ts.map +1 -0
  66. package/cjs/version.cjs +1 -1
  67. package/cjs/window/IWindow.d.ts +128 -21
  68. package/cjs/window/IWindow.d.ts.map +1 -1
  69. package/cjs/window/Window.cjs +127 -35
  70. package/cjs/window/Window.cjs.map +1 -1
  71. package/cjs/window/Window.d.ts +131 -30
  72. package/cjs/window/Window.d.ts.map +1 -1
  73. package/lib/clipboard/Clipboard.d.ts +42 -0
  74. package/lib/clipboard/Clipboard.d.ts.map +1 -0
  75. package/lib/clipboard/Clipboard.js +98 -0
  76. package/lib/clipboard/Clipboard.js.map +1 -0
  77. package/lib/clipboard/ClipboardItem.d.ts +37 -0
  78. package/lib/clipboard/ClipboardItem.d.ts.map +1 -0
  79. package/lib/clipboard/ClipboardItem.js +64 -0
  80. package/lib/clipboard/ClipboardItem.js.map +1 -0
  81. package/lib/event/DataTransfer.d.ts +41 -4
  82. package/lib/event/DataTransfer.d.ts.map +1 -1
  83. package/lib/event/DataTransfer.js +71 -2
  84. package/lib/event/DataTransfer.js.map +1 -1
  85. package/lib/event/DataTransferItem.d.ts +10 -4
  86. package/lib/event/DataTransferItem.d.ts.map +1 -1
  87. package/lib/event/DataTransferItem.js +29 -10
  88. package/lib/event/DataTransferItem.js.map +1 -1
  89. package/lib/event/DataTransferItemList.d.ts +3 -3
  90. package/lib/event/DataTransferItemList.d.ts.map +1 -1
  91. package/lib/event/DataTransferItemList.js +16 -8
  92. package/lib/event/DataTransferItemList.js.map +1 -1
  93. package/lib/event/events/ClipboardEvent.d.ts +17 -0
  94. package/lib/event/events/ClipboardEvent.d.ts.map +1 -0
  95. package/lib/event/events/ClipboardEvent.js +17 -0
  96. package/lib/event/events/ClipboardEvent.js.map +1 -0
  97. package/lib/event/events/IClipboardEventInit.d.ts +6 -0
  98. package/lib/event/events/IClipboardEventInit.d.ts.map +1 -0
  99. package/lib/event/events/IClipboardEventInit.js +2 -0
  100. package/lib/event/events/IClipboardEventInit.js.map +1 -0
  101. package/lib/index.d.ts +8 -1
  102. package/lib/index.d.ts.map +1 -1
  103. package/lib/index.js +7 -1
  104. package/lib/index.js.map +1 -1
  105. package/lib/mutation-observer/MutationListener.d.ts +3 -1
  106. package/lib/mutation-observer/MutationListener.d.ts.map +1 -1
  107. package/lib/mutation-observer/MutationListener.js +1 -0
  108. package/lib/mutation-observer/MutationListener.js.map +1 -1
  109. package/lib/mutation-observer/MutationObserver.d.ts +1 -1
  110. package/lib/mutation-observer/MutationObserver.d.ts.map +1 -1
  111. package/lib/mutation-observer/MutationObserver.js +1 -0
  112. package/lib/mutation-observer/MutationObserver.js.map +1 -1
  113. package/lib/navigator/Navigator.d.ts +17 -4
  114. package/lib/navigator/Navigator.d.ts.map +1 -1
  115. package/lib/navigator/Navigator.js +40 -6
  116. package/lib/navigator/Navigator.js.map +1 -1
  117. package/lib/nodes/character-data/CharacterData.js +1 -1
  118. package/lib/nodes/character-data/CharacterData.js.map +1 -1
  119. package/lib/nodes/element/ElementNamedNodeMap.js +2 -2
  120. package/lib/nodes/element/ElementNamedNodeMap.js.map +1 -1
  121. package/lib/nodes/html-input-element/HTMLInputElement.d.ts.map +1 -1
  122. package/lib/nodes/html-input-element/HTMLInputElement.js +48 -25
  123. package/lib/nodes/html-input-element/HTMLInputElement.js.map +1 -1
  124. package/lib/nodes/node/NodeUtility.js +3 -3
  125. package/lib/nodes/node/NodeUtility.js.map +1 -1
  126. package/lib/permissions/PermissionNameEnum.d.ts +32 -0
  127. package/lib/permissions/PermissionNameEnum.d.ts.map +1 -0
  128. package/lib/permissions/PermissionNameEnum.js +33 -0
  129. package/lib/permissions/PermissionNameEnum.js.map +1 -0
  130. package/lib/permissions/PermissionStatus.d.ts +19 -0
  131. package/lib/permissions/PermissionStatus.d.ts.map +1 -0
  132. package/lib/permissions/PermissionStatus.js +20 -0
  133. package/lib/permissions/PermissionStatus.js.map +1 -0
  134. package/lib/permissions/Permissions.d.ts +25 -0
  135. package/lib/permissions/Permissions.d.ts.map +1 -0
  136. package/lib/permissions/Permissions.js +41 -0
  137. package/lib/permissions/Permissions.js.map +1 -0
  138. package/lib/version.js +1 -1
  139. package/lib/window/IWindow.d.ts +128 -21
  140. package/lib/window/IWindow.d.ts.map +1 -1
  141. package/lib/window/Window.d.ts +131 -30
  142. package/lib/window/Window.d.ts.map +1 -1
  143. package/lib/window/Window.js +127 -35
  144. package/lib/window/Window.js.map +1 -1
  145. package/package.json +1 -1
  146. package/src/clipboard/Clipboard.ts +96 -0
  147. package/src/clipboard/ClipboardItem.ts +59 -0
  148. package/src/event/DataTransfer.ts +88 -4
  149. package/src/event/DataTransferItem.ts +16 -9
  150. package/src/event/DataTransferItemList.ts +17 -7
  151. package/src/event/events/ClipboardEvent.ts +22 -0
  152. package/src/event/events/IClipboardEventInit.ts +6 -0
  153. package/src/index.ts +15 -1
  154. package/src/mutation-observer/MutationListener.ts +3 -1
  155. package/src/mutation-observer/MutationObserver.ts +3 -2
  156. package/src/navigator/Navigator.ts +27 -7
  157. package/src/nodes/character-data/CharacterData.ts +1 -1
  158. package/src/nodes/element/ElementNamedNodeMap.ts +2 -2
  159. package/src/nodes/html-input-element/HTMLInputElement.ts +49 -22
  160. package/src/nodes/node/NodeUtility.ts +3 -3
  161. package/src/permissions/PermissionNameEnum.ts +32 -0
  162. package/src/permissions/PermissionStatus.ts +23 -0
  163. package/src/permissions/Permissions.ts +45 -0
  164. package/src/window/IWindow.ts +139 -23
  165. package/src/window/Window.ts +133 -38
  166. package/cjs/config/NonImplemenetedElementClasses.cjs +0 -55
  167. package/cjs/config/NonImplemenetedElementClasses.cjs.map +0 -1
  168. package/cjs/config/NonImplemenetedElementClasses.d.ts +0 -3
  169. package/cjs/config/NonImplemenetedElementClasses.d.ts.map +0 -1
  170. package/cjs/event/NonImplementedEventTypes.cjs +0 -48
  171. package/cjs/event/NonImplementedEventTypes.cjs.map +0 -1
  172. package/cjs/event/NonImplementedEventTypes.d.ts +0 -3
  173. package/cjs/event/NonImplementedEventTypes.d.ts.map +0 -1
  174. package/lib/config/NonImplemenetedElementClasses.d.ts +0 -3
  175. package/lib/config/NonImplemenetedElementClasses.d.ts.map +0 -1
  176. package/lib/config/NonImplemenetedElementClasses.js +0 -53
  177. package/lib/config/NonImplemenetedElementClasses.js.map +0 -1
  178. package/lib/event/NonImplementedEventTypes.d.ts +0 -3
  179. package/lib/event/NonImplementedEventTypes.d.ts.map +0 -1
  180. package/lib/event/NonImplementedEventTypes.js +0 -46
  181. package/lib/event/NonImplementedEventTypes.js.map +0 -1
  182. package/src/config/NonImplemenetedElementClasses.ts +0 -52
  183. package/src/event/NonImplementedEventTypes.ts +0 -45
@@ -103,7 +103,7 @@ export default class ElementNamedNodeMap extends NamedNodeMap {
103
103
  record.type = MutationTypeEnum.attributes;
104
104
  record.attributeName = item.name;
105
105
  record.oldValue = observer.options.attributeOldValue ? oldValue : null;
106
- observer.callback([record]);
106
+ observer.callback([record], observer.observer);
107
107
  }
108
108
  }
109
109
  }
@@ -164,7 +164,7 @@ export default class ElementNamedNodeMap extends NamedNodeMap {
164
164
  record.type = MutationTypeEnum.attributes;
165
165
  record.attributeName = removedItem.name;
166
166
  record.oldValue = observer.options.attributeOldValue ? removedItem.value : null;
167
- observer.callback([record]);
167
+ observer.callback([record], observer.observer);
168
168
  }
169
169
  }
170
170
  }
@@ -1167,43 +1167,69 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
1167
1167
  * @override
1168
1168
  */
1169
1169
  public override dispatchEvent(event: Event): boolean {
1170
+ // Do nothing if the input element is disabled and the event is a click event.
1170
1171
  if (event.type === 'click' && event.eventPhase === EventPhaseEnum.none && this.disabled) {
1171
1172
  return false;
1172
1173
  }
1173
1174
 
1175
+ let previousCheckedValue: boolean | null = null;
1176
+
1177
+ // The checkbox or radio button has to be checked before the click event is dispatched, so that event listeners can check the checked value.
1178
+ // However, the value has to be restored if preventDefault() is called on the click event.
1174
1179
  if (
1175
- event.type === 'click' &&
1176
1180
  (event.eventPhase === EventPhaseEnum.atTarget ||
1177
1181
  event.eventPhase === EventPhaseEnum.bubbling) &&
1178
- (this.type === 'checkbox' || this.type === 'radio')
1182
+ event.type === 'click'
1179
1183
  ) {
1180
- this._setChecked(this.type === 'checkbox' ? !this.checked : true);
1184
+ const inputType = this.type;
1185
+ if (inputType === 'checkbox' || inputType === 'radio') {
1186
+ previousCheckedValue = this.checked;
1187
+ this._setChecked(inputType === 'checkbox' ? !previousCheckedValue : true);
1188
+ }
1181
1189
  }
1182
1190
 
1183
1191
  const returnValue = super.dispatchEvent(event);
1184
1192
 
1185
1193
  if (
1186
- event.type === 'click' &&
1194
+ !event.defaultPrevented &&
1187
1195
  (event.eventPhase === EventPhaseEnum.atTarget ||
1188
1196
  event.eventPhase === EventPhaseEnum.bubbling) &&
1189
- (!this.readOnly || this.type === 'checkbox' || this.type === 'radio')
1197
+ event.type === 'click' &&
1198
+ this.isConnected
1190
1199
  ) {
1191
- if (this.type === 'checkbox' || this.type === 'radio') {
1192
- this.dispatchEvent(new Event('input', { bubbles: true, cancelable: true }));
1193
- this.dispatchEvent(new Event('change', { bubbles: true, cancelable: true }));
1194
- } else if (this.type === 'submit') {
1195
- const form = <IHTMLFormElement>this._formNode;
1196
- if (form) {
1197
- form.requestSubmit();
1198
- }
1199
- } else if (this.type === 'reset' && this.isConnected) {
1200
- const form = <IHTMLFormElement>this._formNode;
1201
- if (form) {
1202
- form.reset();
1200
+ const inputType = this.type;
1201
+ if (!this.readOnly || inputType === 'checkbox' || inputType === 'radio') {
1202
+ if (inputType === 'checkbox' || inputType === 'radio') {
1203
+ this.dispatchEvent(new Event('input', { bubbles: true, cancelable: true }));
1204
+ this.dispatchEvent(new Event('change', { bubbles: true, cancelable: true }));
1205
+ } else if (inputType === 'submit') {
1206
+ const form = <IHTMLFormElement>this._formNode;
1207
+ if (form) {
1208
+ form.requestSubmit();
1209
+ }
1210
+ } else if (inputType === 'reset' && this.isConnected) {
1211
+ const form = <IHTMLFormElement>this._formNode;
1212
+ if (form) {
1213
+ form.reset();
1214
+ }
1203
1215
  }
1204
1216
  }
1205
1217
  }
1206
1218
 
1219
+ // Restore checked state if preventDefault() is triggered on the click event.
1220
+ if (
1221
+ event.defaultPrevented &&
1222
+ (event.eventPhase === EventPhaseEnum.atTarget ||
1223
+ event.eventPhase === EventPhaseEnum.bubbling) &&
1224
+ event.type === 'click' &&
1225
+ previousCheckedValue !== null
1226
+ ) {
1227
+ const inputType = this.type;
1228
+ if (inputType === 'checkbox' || inputType === 'radio') {
1229
+ this._setChecked(previousCheckedValue);
1230
+ }
1231
+ }
1232
+
1207
1233
  return returnValue;
1208
1234
  }
1209
1235
 
@@ -1233,12 +1259,13 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
1233
1259
  * @returns "true" if selection is supported.
1234
1260
  */
1235
1261
  private _isSelectionSupported(): boolean {
1262
+ const inputType = this.type;
1236
1263
  return (
1237
- this.type === 'text' ||
1238
- this.type === 'search' ||
1239
- this.type === 'url' ||
1240
- this.type === 'tel' ||
1241
- this.type === 'password'
1264
+ inputType === 'text' ||
1265
+ inputType === 'search' ||
1266
+ inputType === 'url' ||
1267
+ inputType === 'tel' ||
1268
+ inputType === 'password'
1242
1269
  );
1243
1270
  }
1244
1271
 
@@ -81,7 +81,7 @@ export default class NodeUtility {
81
81
  (<Node>node)._observe(observer);
82
82
  }
83
83
  if (observer.options.childList) {
84
- observer.callback([record]);
84
+ observer.callback([record], observer.observer);
85
85
  }
86
86
  }
87
87
  }
@@ -121,7 +121,7 @@ export default class NodeUtility {
121
121
  for (const observer of (<Node>ancestorNode)._observers) {
122
122
  (<Node>node)._unobserve(observer);
123
123
  if (observer.options.childList) {
124
- observer.callback([record]);
124
+ observer.callback([record], observer.observer);
125
125
  }
126
126
  }
127
127
  }
@@ -208,7 +208,7 @@ export default class NodeUtility {
208
208
  (<Node>newNode)._observe(observer);
209
209
  }
210
210
  if (observer.options.childList) {
211
- observer.callback([record]);
211
+ observer.callback([record], observer.observer);
212
212
  }
213
213
  }
214
214
  }
@@ -0,0 +1,32 @@
1
+ enum PermissionNameEnum {
2
+ geolocation = 'geolocation',
3
+ notifications = 'notifications',
4
+ push = 'push',
5
+ midi = 'midi',
6
+ camera = 'camera',
7
+ microphone = 'microphone',
8
+ backgroundFetch = 'background-fetch',
9
+ backgroundSync = 'background-sync',
10
+ persistentStorage = 'persistent-storage',
11
+ ambientLightSensor = 'ambient-light-sensor',
12
+ accelerometer = 'accelerometer',
13
+ gyroscope = 'gyroscope',
14
+ magnetometer = 'magnetometer',
15
+ screenWakeLock = 'screen-wake-lock',
16
+ nfc = 'nfc',
17
+ displayCapture = 'display-capture',
18
+ accessibilityEvents = 'accessibility-events',
19
+ clipboardRead = 'clipboard-read',
20
+ clipboardWrite = 'clipboard-write',
21
+ paymentHandler = 'payment-handler',
22
+ idleDetection = 'idle-detection',
23
+ periodicBackgroundSync = 'periodic-background-sync',
24
+ systemWakeLock = 'system-wake-lock',
25
+ storageAccess = 'storage-access',
26
+ windowManagement = 'window-management',
27
+ windowPlacement = 'window-placement',
28
+ localFonts = 'local-fonts',
29
+ topLevelStorageAccess = 'top-level-storage-access'
30
+ }
31
+
32
+ export default PermissionNameEnum;
@@ -0,0 +1,23 @@
1
+ import EventTarget from '../event/EventTarget.js';
2
+ import Event from '../event/Event.js';
3
+
4
+ /**
5
+ * Permission status.
6
+ *
7
+ * Reference:
8
+ * https://developer.mozilla.org/en-US/docs/Web/API/PermissionStatus
9
+ */
10
+ export default class PermissionStatus extends EventTarget {
11
+ public state: 'granted' | 'denied' | 'prompt';
12
+ public onchange: ((event: Event) => void) | null = null;
13
+
14
+ /**
15
+ * Constructor.
16
+ *
17
+ * @param [state] State.
18
+ */
19
+ constructor(state: 'granted' | 'denied' | 'prompt' = 'granted') {
20
+ super();
21
+ this.state = state;
22
+ }
23
+ }
@@ -0,0 +1,45 @@
1
+ import PermissionStatus from './PermissionStatus.js';
2
+ import PermissionNameEnum from './PermissionNameEnum.js';
3
+
4
+ /**
5
+ * Permissions API.
6
+ *
7
+ * Reference:
8
+ * https://developer.mozilla.org/en-US/docs/Web/API/Permissions.
9
+ */
10
+ export default class Permissions {
11
+ #permissionStatus: {
12
+ [name in PermissionNameEnum]?: PermissionStatus;
13
+ } = {};
14
+
15
+ /**
16
+ * Returns scroll restoration.
17
+ *
18
+ * @param permissionDescriptor Permission descriptor.
19
+ * @param permissionDescriptor.name Permission name.
20
+ * @param [permissionDescriptor.userVisibleOnly] User visible only.
21
+ * @param [permissionDescriptor.sysex] Sysex.
22
+ * @returns Permission status.
23
+ */
24
+ public async query(permissionDescriptor: {
25
+ name: string;
26
+ userVisibleOnly?: boolean;
27
+ sysex?: boolean;
28
+ }): Promise<PermissionStatus> {
29
+ if (this.#permissionStatus[permissionDescriptor.name]) {
30
+ return this.#permissionStatus[permissionDescriptor.name];
31
+ }
32
+
33
+ if (
34
+ !Object.values(PermissionNameEnum).includes(<PermissionNameEnum>permissionDescriptor.name)
35
+ ) {
36
+ throw new Error(
37
+ `Failed to execute 'query' on 'Permissions': Failed to read the 'name' property from 'PermissionDescriptor': The provided value '${permissionDescriptor.name}' is not a valid enum value of type PermissionName.`
38
+ );
39
+ }
40
+
41
+ this.#permissionStatus[permissionDescriptor.name] = new PermissionStatus('granted');
42
+
43
+ return this.#permissionStatus[permissionDescriptor.name];
44
+ }
45
+ }
@@ -46,6 +46,7 @@ import { URLSearchParams } from 'url';
46
46
  import URL from '../url/URL.js';
47
47
  import Location from '../location/Location.js';
48
48
  import MutationObserver from '../mutation-observer/MutationObserver.js';
49
+ import MutationRecord from '../mutation-observer/MutationRecord.js';
49
50
  import DOMParser from '../dom-parser/DOMParser.js';
50
51
  import XMLSerializer from '../xml-serializer/XMLSerializer.js';
51
52
  import ResizeObserver from '../resize-observer/ResizeObserver.js';
@@ -126,12 +127,17 @@ import RadioNodeList from '../nodes/html-form-element/RadioNodeList.js';
126
127
  import ValidityState from '../validity-state/ValidityState.js';
127
128
  import INodeJSGlobal from './INodeJSGlobal.js';
128
129
  import VirtualConsolePrinter from '../console/VirtualConsolePrinter.js';
130
+ import Permissions from '../permissions/Permissions.js';
131
+ import PermissionStatus from '../permissions/PermissionStatus.js';
132
+ import Clipboard from '../clipboard/Clipboard.js';
133
+ import ClipboardItem from '../clipboard/ClipboardItem.js';
134
+ import ClipboardEvent from '../event/events/ClipboardEvent.js';
129
135
 
130
136
  /**
131
137
  * Window without dependencies to server side specific packages.
132
138
  */
133
139
  export default interface IWindow extends IEventTarget, INodeJSGlobal {
134
- // Public Properties
140
+ // Happy DOM property.
135
141
  readonly happyDOM: {
136
142
  whenAsyncComplete: () => Promise<void>;
137
143
  cancelAsync: () => void;
@@ -152,8 +158,24 @@ export default interface IWindow extends IEventTarget, INodeJSGlobal {
152
158
  setInnerHeight: (height: number) => void;
153
159
  };
154
160
 
155
- // Global classes
161
+ // Nodes
156
162
  readonly Node: typeof Node;
163
+ readonly Attr: typeof Attr;
164
+ readonly SVGSVGElement: typeof SVGSVGElement;
165
+ readonly SVGElement: typeof SVGElement;
166
+ readonly Text: typeof Text;
167
+ readonly Comment: typeof Comment;
168
+ readonly ShadowRoot: typeof ShadowRoot;
169
+ readonly Element: typeof Element;
170
+ readonly DocumentFragment: typeof DocumentFragment;
171
+ readonly CharacterData: typeof CharacterData;
172
+ readonly ProcessingInstruction: typeof ProcessingInstruction;
173
+ readonly Document: typeof Document;
174
+ readonly HTMLDocument: typeof HTMLDocument;
175
+ readonly XMLDocument: typeof XMLDocument;
176
+ readonly SVGDocument: typeof SVGDocument;
177
+
178
+ // Element classes
157
179
  readonly HTMLElement: typeof HTMLElement;
158
180
  readonly HTMLUnknownElement: typeof HTMLUnknownElement;
159
181
  readonly HTMLTemplateElement: typeof HTMLTemplateElement;
@@ -174,27 +196,61 @@ export default interface IWindow extends IEventTarget, INodeJSGlobal {
174
196
  readonly HTMLBaseElement: typeof HTMLBaseElement;
175
197
  readonly HTMLIFrameElement: typeof HTMLIFrameElement;
176
198
  readonly HTMLDialogElement: typeof HTMLDialogElement;
177
- readonly Attr: typeof Attr;
178
- readonly NamedNodeMap: typeof NamedNodeMap;
179
- readonly SVGSVGElement: typeof SVGSVGElement;
180
- readonly SVGElement: typeof SVGElement;
181
- readonly Image: typeof Image;
182
- readonly Text: typeof Text;
183
- readonly Comment: typeof Comment;
184
- readonly ShadowRoot: typeof ShadowRoot;
185
- readonly Element: typeof Element;
186
- readonly DocumentFragment: typeof DocumentFragment;
187
- readonly CharacterData: typeof CharacterData;
188
- readonly ProcessingInstruction: typeof ProcessingInstruction;
189
- readonly NodeFilter: typeof NodeFilter;
190
- readonly NodeIterator: typeof NodeIterator;
191
- readonly TreeWalker: typeof TreeWalker;
192
- readonly DOMParser: typeof DOMParser;
193
- readonly MutationObserver: typeof MutationObserver;
194
- readonly Document: typeof Document;
195
- readonly HTMLDocument: typeof HTMLDocument;
196
- readonly XMLDocument: typeof XMLDocument;
197
- readonly SVGDocument: typeof SVGDocument;
199
+
200
+ /**
201
+ * Non-implemented element classes
202
+ */
203
+ readonly HTMLHeadElement: typeof HTMLElement;
204
+ readonly HTMLTitleElement: typeof HTMLElement;
205
+ readonly HTMLBodyElement: typeof HTMLElement;
206
+ readonly HTMLHeadingElement: typeof HTMLElement;
207
+ readonly HTMLParagraphElement: typeof HTMLElement;
208
+ readonly HTMLHRElement: typeof HTMLElement;
209
+ readonly HTMLPreElement: typeof HTMLElement;
210
+ readonly HTMLUListElement: typeof HTMLElement;
211
+ readonly HTMLOListElement: typeof HTMLElement;
212
+ readonly HTMLLIElement: typeof HTMLElement;
213
+ readonly HTMLMenuElement: typeof HTMLElement;
214
+ readonly HTMLDListElement: typeof HTMLElement;
215
+ readonly HTMLDivElement: typeof HTMLElement;
216
+ readonly HTMLAnchorElement: typeof HTMLElement;
217
+ readonly HTMLAreaElement: typeof HTMLElement;
218
+ readonly HTMLBRElement: typeof HTMLElement;
219
+ readonly HTMLButtonElement: typeof HTMLElement;
220
+ readonly HTMLCanvasElement: typeof HTMLElement;
221
+ readonly HTMLDataElement: typeof HTMLElement;
222
+ readonly HTMLDataListElement: typeof HTMLElement;
223
+ readonly HTMLDetailsElement: typeof HTMLElement;
224
+ readonly HTMLDirectoryElement: typeof HTMLElement;
225
+ readonly HTMLFieldSetElement: typeof HTMLElement;
226
+ readonly HTMLFontElement: typeof HTMLElement;
227
+ readonly HTMLHtmlElement: typeof HTMLElement;
228
+ readonly HTMLLegendElement: typeof HTMLElement;
229
+ readonly HTMLMapElement: typeof HTMLElement;
230
+ readonly HTMLMarqueeElement: typeof HTMLElement;
231
+ readonly HTMLMeterElement: typeof HTMLElement;
232
+ readonly HTMLModElement: typeof HTMLElement;
233
+ readonly HTMLOutputElement: typeof HTMLElement;
234
+ readonly HTMLPictureElement: typeof HTMLElement;
235
+ readonly HTMLProgressElement: typeof HTMLElement;
236
+ readonly HTMLQuoteElement: typeof HTMLElement;
237
+ readonly HTMLSourceElement: typeof HTMLElement;
238
+ readonly HTMLSpanElement: typeof HTMLElement;
239
+ readonly HTMLTableCaptionElement: typeof HTMLElement;
240
+ readonly HTMLTableCellElement: typeof HTMLElement;
241
+ readonly HTMLTableColElement: typeof HTMLElement;
242
+ readonly HTMLTableElement: typeof HTMLElement;
243
+ readonly HTMLTimeElement: typeof HTMLElement;
244
+ readonly HTMLTableRowElement: typeof HTMLElement;
245
+ readonly HTMLTableSectionElement: typeof HTMLElement;
246
+ readonly HTMLFrameElement: typeof HTMLElement;
247
+ readonly HTMLFrameSetElement: typeof HTMLElement;
248
+ readonly HTMLEmbedElement: typeof HTMLElement;
249
+ readonly HTMLObjectElement: typeof HTMLElement;
250
+ readonly HTMLParamElement: typeof HTMLElement;
251
+ readonly HTMLTrackElement: typeof HTMLElement;
252
+
253
+ // Event classes
198
254
  readonly Event: typeof Event;
199
255
  readonly UIEvent: typeof UIEvent;
200
256
  readonly CustomEvent: typeof CustomEvent;
@@ -212,6 +268,55 @@ export default interface IWindow extends IEventTarget, INodeJSGlobal {
212
268
  readonly MessagePort: typeof MessagePort;
213
269
  readonly ProgressEvent: typeof ProgressEvent;
214
270
  readonly MediaQueryListEvent: typeof MediaQueryListEvent;
271
+ readonly ClipboardEvent: typeof ClipboardEvent;
272
+
273
+ /**
274
+ * Non-implemented event classes
275
+ */
276
+ readonly AudioProcessingEvent: typeof Event;
277
+ readonly BeforeInputEvent: typeof Event;
278
+ readonly BeforeUnloadEvent: typeof Event;
279
+ readonly BlobEvent: typeof Event;
280
+ readonly CloseEvent: typeof Event;
281
+ readonly CompositionEvent: typeof Event;
282
+ readonly CSSFontFaceLoadEvent: typeof Event;
283
+ readonly DeviceLightEvent: typeof Event;
284
+ readonly DeviceMotionEvent: typeof Event;
285
+ readonly DeviceOrientationEvent: typeof Event;
286
+ readonly DeviceProximityEvent: typeof Event;
287
+ readonly DOMTransactionEvent: typeof Event;
288
+ readonly DragEvent: typeof Event;
289
+ readonly EditingBeforeInputEvent: typeof Event;
290
+ readonly FetchEvent: typeof Event;
291
+ readonly GamepadEvent: typeof Event;
292
+ readonly HashChangeEvent: typeof Event;
293
+ readonly IDBVersionChangeEvent: typeof Event;
294
+ readonly MediaStreamEvent: typeof Event;
295
+ readonly MutationEvent: typeof Event;
296
+ readonly OfflineAudioCompletionEvent: typeof Event;
297
+ readonly OverconstrainedError: typeof Event;
298
+ readonly PageTransitionEvent: typeof Event;
299
+ readonly PaymentRequestUpdateEvent: typeof Event;
300
+ readonly PopStateEvent: typeof Event;
301
+ readonly RelatedEvent: typeof Event;
302
+ readonly RTCDataChannelEvent: typeof Event;
303
+ readonly RTCIdentityErrorEvent: typeof Event;
304
+ readonly RTCIdentityEvent: typeof Event;
305
+ readonly RTCPeerConnectionIceEvent: typeof Event;
306
+ readonly SensorEvent: typeof Event;
307
+ readonly SVGEvent: typeof Event;
308
+ readonly SVGZoomEvent: typeof Event;
309
+ readonly TimeEvent: typeof Event;
310
+ readonly TouchEvent: typeof Event;
311
+ readonly TrackEvent: typeof Event;
312
+ readonly TransitionEvent: typeof Event;
313
+ readonly UserProximityEvent: typeof Event;
314
+ readonly WebGLContextEvent: typeof Event;
315
+ readonly TextEvent: typeof Event;
316
+
317
+ // Other classes
318
+ readonly Image: typeof Image;
319
+ readonly NamedNodeMap: typeof NamedNodeMap;
215
320
  readonly EventTarget: typeof EventTarget;
216
321
  readonly DataTransfer: typeof DataTransfer;
217
322
  readonly DataTransferItem: typeof DataTransferItem;
@@ -268,6 +373,17 @@ export default interface IWindow extends IEventTarget, INodeJSGlobal {
268
373
  readonly AbortSignal: typeof AbortSignal;
269
374
  readonly RadioNodeList: typeof RadioNodeList;
270
375
  readonly ValidityState: typeof ValidityState;
376
+ readonly Permissions: typeof Permissions;
377
+ readonly PermissionStatus: typeof PermissionStatus;
378
+ readonly Clipboard: typeof Clipboard;
379
+ readonly ClipboardItem: typeof ClipboardItem;
380
+
381
+ readonly NodeFilter: typeof NodeFilter;
382
+ readonly NodeIterator: typeof NodeIterator;
383
+ readonly TreeWalker: typeof TreeWalker;
384
+ readonly DOMParser: typeof DOMParser;
385
+ readonly MutationObserver: typeof MutationObserver;
386
+ readonly MutationRecord: typeof MutationRecord;
271
387
 
272
388
  // Events
273
389
  onload: (event: Event) => void;