happy-dom 8.8.0 → 9.0.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 (364) hide show
  1. package/README.md +2 -2
  2. package/lib/cookie/CookieJar.js +1 -1
  3. package/lib/cookie/CookieJar.js.map +1 -1
  4. package/lib/dom-token-list/DOMTokenList.js +24 -20
  5. package/lib/dom-token-list/DOMTokenList.js.map +1 -1
  6. package/lib/event/EventTarget.js +6 -3
  7. package/lib/event/EventTarget.js.map +1 -1
  8. package/lib/exception/DOMExceptionNameEnum.d.ts +5 -1
  9. package/lib/exception/DOMExceptionNameEnum.js +4 -0
  10. package/lib/exception/DOMExceptionNameEnum.js.map +1 -1
  11. package/lib/fetch/AbortController.d.ts +19 -0
  12. package/lib/fetch/AbortController.js +30 -0
  13. package/lib/fetch/AbortController.js.map +1 -0
  14. package/lib/fetch/AbortSignal.d.ts +25 -0
  15. package/lib/fetch/AbortSignal.js +51 -0
  16. package/lib/fetch/AbortSignal.js.map +1 -0
  17. package/lib/fetch/Fetch.d.ts +117 -0
  18. package/lib/fetch/Fetch.js +530 -0
  19. package/lib/fetch/Fetch.js.map +1 -0
  20. package/lib/fetch/Headers.d.ts +81 -3
  21. package/lib/fetch/Headers.js +139 -24
  22. package/lib/fetch/Headers.js.map +1 -1
  23. package/lib/fetch/Request.d.ts +56 -32
  24. package/lib/fetch/Request.js +165 -110
  25. package/lib/fetch/Request.js.map +1 -1
  26. package/lib/fetch/{ResourceFetchHandler.d.ts → ResourceFetch.d.ts} +1 -1
  27. package/lib/fetch/{ResourceFetchHandler.js → ResourceFetch.js} +5 -5
  28. package/lib/fetch/ResourceFetch.js.map +1 -0
  29. package/lib/fetch/Response.d.ts +60 -26
  30. package/lib/fetch/Response.js +196 -104
  31. package/lib/fetch/Response.js.map +1 -1
  32. package/lib/fetch/data-uri/DataURIParser.d.ts +20 -0
  33. package/lib/fetch/data-uri/DataURIParser.js +60 -0
  34. package/lib/fetch/data-uri/DataURIParser.js.map +1 -0
  35. package/lib/fetch/multipart/MultipartFormDataParser.d.ts +40 -0
  36. package/lib/fetch/multipart/MultipartFormDataParser.js +81 -0
  37. package/lib/fetch/multipart/MultipartFormDataParser.js.map +1 -0
  38. package/lib/fetch/multipart/MultipartReader.d.ts +49 -0
  39. package/lib/fetch/multipart/MultipartReader.js +178 -0
  40. package/lib/fetch/multipart/MultipartReader.js.map +1 -0
  41. package/lib/fetch/types/IHeaders.d.ts +71 -0
  42. package/lib/fetch/{IHeaders.js.map → types/IHeaders.js.map} +1 -1
  43. package/lib/fetch/types/IHeadersInit.js.map +1 -0
  44. package/lib/fetch/types/IRequest.d.ts +60 -0
  45. package/lib/fetch/{IRequest.js.map → types/IRequest.js.map} +1 -1
  46. package/lib/fetch/types/IRequestBody.d.ts +7 -0
  47. package/lib/fetch/{IBody.js → types/IRequestBody.js} +1 -1
  48. package/lib/fetch/types/IRequestBody.js.map +1 -0
  49. package/lib/fetch/types/IRequestCredentials.d.ts +2 -0
  50. package/lib/fetch/types/IRequestCredentials.js +3 -0
  51. package/lib/fetch/types/IRequestCredentials.js.map +1 -0
  52. package/lib/fetch/{RequestInfo.d.ts → types/IRequestInfo.d.ts} +2 -2
  53. package/lib/fetch/types/IRequestInfo.js +3 -0
  54. package/lib/fetch/types/IRequestInfo.js.map +1 -0
  55. package/lib/fetch/types/IRequestInit.d.ts +21 -0
  56. package/lib/fetch/types/IRequestInit.js.map +1 -0
  57. package/lib/fetch/types/IRequestRedirect.d.ts +2 -0
  58. package/lib/fetch/types/IRequestRedirect.js +3 -0
  59. package/lib/fetch/types/IRequestRedirect.js.map +1 -0
  60. package/lib/fetch/types/IRequestReferrerPolicy.d.ts +2 -0
  61. package/lib/fetch/types/IRequestReferrerPolicy.js +3 -0
  62. package/lib/fetch/types/IRequestReferrerPolicy.js.map +1 -0
  63. package/lib/fetch/types/IResponse.d.ts +27 -0
  64. package/lib/fetch/{IResponse.js.map → types/IResponse.js.map} +1 -1
  65. package/lib/fetch/types/IResponseBody.d.ts +7 -0
  66. package/lib/fetch/types/IResponseBody.js +3 -0
  67. package/lib/fetch/types/IResponseBody.js.map +1 -0
  68. package/lib/fetch/types/IResponseInit.d.ts +9 -0
  69. package/lib/fetch/types/IResponseInit.js.map +1 -0
  70. package/lib/fetch/utilities/FetchBodyUtility.d.ts +44 -0
  71. package/lib/fetch/utilities/FetchBodyUtility.js +156 -0
  72. package/lib/fetch/utilities/FetchBodyUtility.js.map +1 -0
  73. package/lib/fetch/utilities/FetchCORSUtility.d.ts +12 -0
  74. package/lib/fetch/utilities/FetchCORSUtility.js +20 -0
  75. package/lib/fetch/utilities/FetchCORSUtility.js.map +1 -0
  76. package/lib/fetch/utilities/FetchRequestHeaderUtility.d.ts +12 -0
  77. package/lib/fetch/utilities/FetchRequestHeaderUtility.js +45 -0
  78. package/lib/fetch/utilities/FetchRequestHeaderUtility.js.map +1 -0
  79. package/lib/fetch/utilities/FetchRequestReferrerUtility.d.ts +55 -0
  80. package/lib/fetch/utilities/FetchRequestReferrerUtility.js +194 -0
  81. package/lib/fetch/utilities/FetchRequestReferrerUtility.js.map +1 -0
  82. package/lib/fetch/utilities/FetchRequestValidationUtility.d.ts +38 -0
  83. package/lib/fetch/utilities/FetchRequestValidationUtility.js +70 -0
  84. package/lib/fetch/utilities/FetchRequestValidationUtility.js.map +1 -0
  85. package/lib/file/Blob.d.ts +2 -2
  86. package/lib/file/Blob.js +1 -1
  87. package/lib/file/Blob.js.map +1 -1
  88. package/lib/file/File.d.ts +2 -1
  89. package/lib/file/File.js.map +1 -1
  90. package/lib/form-data/FormData.d.ts +98 -0
  91. package/lib/form-data/FormData.js +212 -0
  92. package/lib/form-data/FormData.js.map +1 -0
  93. package/lib/index.d.ts +14 -1
  94. package/lib/index.js +20 -2
  95. package/lib/index.js.map +1 -1
  96. package/lib/nodes/document/Document.d.ts +5 -17
  97. package/lib/nodes/document/Document.js +11 -54
  98. package/lib/nodes/document/Document.js.map +1 -1
  99. package/lib/nodes/document/IDocument.d.ts +1 -1
  100. package/lib/nodes/document-fragment/DocumentFragment.d.ts +3 -14
  101. package/lib/nodes/document-fragment/DocumentFragment.js +7 -51
  102. package/lib/nodes/document-fragment/DocumentFragment.js.map +1 -1
  103. package/lib/nodes/document-fragment/IDocumentFragment.d.ts +2 -1
  104. package/lib/nodes/element/Element.d.ts +8 -8
  105. package/lib/nodes/element/Element.js +28 -45
  106. package/lib/nodes/element/Element.js.map +1 -1
  107. package/lib/nodes/element/ElementUtility.d.ts +32 -0
  108. package/lib/nodes/element/ElementUtility.js +105 -0
  109. package/lib/nodes/element/ElementUtility.js.map +1 -0
  110. package/lib/nodes/element/HTMLCollection.d.ts +26 -3
  111. package/lib/nodes/element/HTMLCollection.js +51 -0
  112. package/lib/nodes/element/HTMLCollection.js.map +1 -1
  113. package/lib/nodes/element/IHTMLCollection.d.ts +9 -2
  114. package/lib/nodes/html-anchor-element/HTMLAnchorElement.js +24 -24
  115. package/lib/nodes/html-anchor-element/HTMLAnchorElement.js.map +1 -1
  116. package/lib/nodes/html-audio-element/Audio.d.ts +15 -0
  117. package/lib/nodes/html-audio-element/Audio.js +27 -0
  118. package/lib/nodes/html-audio-element/Audio.js.map +1 -0
  119. package/lib/nodes/html-base-element/HTMLBaseElement.js +4 -4
  120. package/lib/nodes/html-base-element/HTMLBaseElement.js.map +1 -1
  121. package/lib/nodes/html-button-element/HTMLButtonElement.d.ts +79 -3
  122. package/lib/nodes/html-button-element/HTMLButtonElement.js +158 -10
  123. package/lib/nodes/html-button-element/HTMLButtonElement.js.map +1 -1
  124. package/lib/nodes/html-button-element/IHTMLButtonElement.d.ts +28 -2
  125. package/lib/nodes/html-dialog-element/HTMLDialogElement.js +3 -3
  126. package/lib/nodes/html-dialog-element/HTMLDialogElement.js.map +1 -1
  127. package/lib/nodes/html-element/HTMLElement.js +12 -12
  128. package/lib/nodes/html-element/HTMLElement.js.map +1 -1
  129. package/lib/nodes/html-form-element/HTMLFormControlsCollection.d.ts +32 -0
  130. package/lib/nodes/html-form-element/HTMLFormControlsCollection.js +58 -0
  131. package/lib/nodes/html-form-element/HTMLFormControlsCollection.js.map +1 -0
  132. package/lib/nodes/html-form-element/HTMLFormElement.d.ts +37 -17
  133. package/lib/nodes/html-form-element/HTMLFormElement.js +128 -37
  134. package/lib/nodes/html-form-element/HTMLFormElement.js.map +1 -1
  135. package/lib/nodes/html-form-element/IHTMLFormControlsCollection.d.ts +25 -0
  136. package/lib/nodes/html-form-element/IHTMLFormControlsCollection.js +3 -0
  137. package/lib/nodes/html-form-element/IHTMLFormControlsCollection.js.map +1 -0
  138. package/lib/nodes/html-form-element/IHTMLFormElement.d.ts +16 -6
  139. package/lib/nodes/html-form-element/IRadioNodeList.d.ts +15 -0
  140. package/lib/nodes/html-form-element/IRadioNodeList.js +3 -0
  141. package/lib/nodes/html-form-element/IRadioNodeList.js.map +1 -0
  142. package/lib/nodes/html-form-element/RadioNodeList.d.ts +16 -0
  143. package/lib/nodes/html-form-element/RadioNodeList.js +28 -0
  144. package/lib/nodes/html-form-element/RadioNodeList.js.map +1 -0
  145. package/lib/nodes/html-image-element/HTMLImageElement.js +19 -19
  146. package/lib/nodes/html-image-element/HTMLImageElement.js.map +1 -1
  147. package/lib/nodes/html-input-element/HTMLInputElement.d.ts +43 -19
  148. package/lib/nodes/html-input-element/HTMLInputElement.js +206 -111
  149. package/lib/nodes/html-input-element/HTMLInputElement.js.map +1 -1
  150. package/lib/nodes/html-input-element/IHTMLInputElement.d.ts +14 -1
  151. package/lib/nodes/html-label-element/HTMLLabelElement.js +3 -7
  152. package/lib/nodes/html-label-element/HTMLLabelElement.js.map +1 -1
  153. package/lib/nodes/html-link-element/HTMLLinkElement.js +21 -21
  154. package/lib/nodes/html-link-element/HTMLLinkElement.js.map +1 -1
  155. package/lib/nodes/html-media-element/HTMLMediaElement.js +21 -21
  156. package/lib/nodes/html-media-element/HTMLMediaElement.js.map +1 -1
  157. package/lib/nodes/html-meta-element/HTMLMetaElement.js +8 -8
  158. package/lib/nodes/html-meta-element/HTMLMetaElement.js.map +1 -1
  159. package/lib/nodes/html-opt-group-element/HTMLOptGroupElement.js +6 -6
  160. package/lib/nodes/html-opt-group-element/HTMLOptGroupElement.js.map +1 -1
  161. package/lib/nodes/html-option-element/HTMLOptionElement.d.ts +3 -4
  162. package/lib/nodes/html-option-element/HTMLOptionElement.js +26 -29
  163. package/lib/nodes/html-option-element/HTMLOptionElement.js.map +1 -1
  164. package/lib/nodes/html-script-element/HTMLScriptElement.js +16 -16
  165. package/lib/nodes/html-script-element/HTMLScriptElement.js.map +1 -1
  166. package/lib/nodes/html-script-element/ScriptUtility.js +5 -5
  167. package/lib/nodes/html-script-element/ScriptUtility.js.map +1 -1
  168. package/lib/nodes/{html-option-element → html-select-element}/HTMLOptionsCollection.d.ts +5 -6
  169. package/lib/nodes/{html-option-element → html-select-element}/HTMLOptionsCollection.js.map +1 -1
  170. package/lib/nodes/html-select-element/HTMLSelectElement.d.ts +42 -41
  171. package/lib/nodes/html-select-element/HTMLSelectElement.js +134 -138
  172. package/lib/nodes/html-select-element/HTMLSelectElement.js.map +1 -1
  173. package/lib/nodes/{html-option-element → html-select-element}/IHTMLOptionsCollection.d.ts +4 -5
  174. package/lib/nodes/html-select-element/IHTMLOptionsCollection.js.map +1 -0
  175. package/lib/nodes/html-select-element/IHTMLSelectElement.d.ts +22 -2
  176. package/lib/nodes/html-slot-element/HTMLSlotElement.js +2 -2
  177. package/lib/nodes/html-slot-element/HTMLSlotElement.js.map +1 -1
  178. package/lib/nodes/html-style-element/HTMLStyleElement.js +7 -7
  179. package/lib/nodes/html-style-element/HTMLStyleElement.js.map +1 -1
  180. package/lib/nodes/html-text-area-element/HTMLTextAreaElement.d.ts +55 -2
  181. package/lib/nodes/html-text-area-element/HTMLTextAreaElement.js +150 -40
  182. package/lib/nodes/html-text-area-element/HTMLTextAreaElement.js.map +1 -1
  183. package/lib/nodes/html-text-area-element/IHTMLTextAreaElement.d.ts +16 -0
  184. package/lib/nodes/node/Node.d.ts +12 -1
  185. package/lib/nodes/node/Node.js +50 -4
  186. package/lib/nodes/node/Node.js.map +1 -1
  187. package/lib/nodes/node/NodeList.d.ts +2 -3
  188. package/lib/nodes/node/NodeList.js.map +1 -1
  189. package/lib/nodes/parent-node/IParentNode.d.ts +4 -4
  190. package/lib/nodes/parent-node/ParentNodeUtility.d.ts +3 -3
  191. package/lib/nodes/parent-node/ParentNodeUtility.js +13 -11
  192. package/lib/nodes/parent-node/ParentNodeUtility.js.map +1 -1
  193. package/lib/nodes/text/Text.d.ts +13 -0
  194. package/lib/nodes/text/Text.js +30 -0
  195. package/lib/nodes/text/Text.js.map +1 -1
  196. package/lib/query-selector/QuerySelector.js +2 -2
  197. package/lib/query-selector/QuerySelector.js.map +1 -1
  198. package/lib/query-selector/SelectorItem.js +2 -0
  199. package/lib/query-selector/SelectorItem.js.map +1 -1
  200. package/lib/validity-state/ValidityState.d.ts +87 -0
  201. package/lib/validity-state/ValidityState.js +171 -0
  202. package/lib/validity-state/ValidityState.js.map +1 -0
  203. package/lib/window/GlobalWindow.d.ts +0 -8
  204. package/lib/window/GlobalWindow.js +0 -2
  205. package/lib/window/GlobalWindow.js.map +1 -1
  206. package/lib/window/INodeJSGlobal.d.ts +71 -0
  207. package/lib/window/INodeJSGlobal.js +2 -0
  208. package/lib/window/INodeJSGlobal.js.map +1 -0
  209. package/lib/window/IWindow.d.ts +30 -10
  210. package/lib/window/Window.d.ts +37 -20
  211. package/lib/window/Window.js +22 -10
  212. package/lib/window/Window.js.map +1 -1
  213. package/lib/xml-http-request/XMLHttpRequest.js +20 -12
  214. package/lib/xml-http-request/XMLHttpRequest.js.map +1 -1
  215. package/lib/xml-parser/XMLParser.js +1 -1
  216. package/lib/xml-parser/XMLParser.js.map +1 -1
  217. package/package.json +2 -3
  218. package/src/cookie/CookieJar.ts +1 -1
  219. package/src/dom-token-list/DOMTokenList.ts +24 -20
  220. package/src/event/EventTarget.ts +7 -3
  221. package/src/exception/DOMExceptionNameEnum.ts +5 -1
  222. package/src/fetch/AbortController.ts +26 -0
  223. package/src/fetch/AbortSignal.ts +44 -0
  224. package/src/fetch/Fetch.ts +666 -0
  225. package/src/fetch/Headers.ts +151 -3
  226. package/src/fetch/Request.ts +226 -94
  227. package/src/fetch/{ResourceFetchHandler.ts → ResourceFetch.ts} +3 -3
  228. package/src/fetch/Response.ts +252 -89
  229. package/src/fetch/data-uri/DataURIParser.ts +66 -0
  230. package/src/fetch/multipart/MultipartFormDataParser.ts +113 -0
  231. package/src/fetch/multipart/MultipartReader.ts +217 -0
  232. package/src/fetch/types/IHeaders.ts +80 -0
  233. package/src/fetch/types/IRequest.ts +65 -0
  234. package/src/fetch/types/IRequestBody.ts +15 -0
  235. package/src/fetch/types/IRequestCredentials.ts +2 -0
  236. package/src/fetch/types/IRequestInfo.ts +6 -0
  237. package/src/fetch/types/IRequestInit.ts +21 -0
  238. package/src/fetch/types/IRequestRedirect.ts +3 -0
  239. package/src/fetch/types/IRequestReferrerPolicy.ts +11 -0
  240. package/src/fetch/types/IResponse.ts +27 -0
  241. package/src/fetch/types/IResponseBody.ts +15 -0
  242. package/src/fetch/types/IResponseInit.ts +10 -0
  243. package/src/fetch/utilities/FetchBodyUtility.ts +175 -0
  244. package/src/fetch/utilities/FetchCORSUtility.ts +18 -0
  245. package/src/fetch/utilities/FetchRequestHeaderUtility.ts +47 -0
  246. package/src/fetch/utilities/FetchRequestReferrerUtility.ts +241 -0
  247. package/src/fetch/utilities/FetchRequestValidationUtility.ts +82 -0
  248. package/src/file/Blob.ts +2 -2
  249. package/src/file/File.ts +5 -1
  250. package/src/form-data/FormData.ts +237 -0
  251. package/src/index.ts +27 -1
  252. package/src/nodes/document/Document.ts +23 -64
  253. package/src/nodes/document/IDocument.ts +1 -1
  254. package/src/nodes/document-fragment/DocumentFragment.ts +9 -59
  255. package/src/nodes/document-fragment/IDocumentFragment.ts +2 -1
  256. package/src/nodes/element/Element.ts +43 -56
  257. package/src/nodes/element/ElementUtility.ts +137 -0
  258. package/src/nodes/element/HTMLCollection.ts +60 -3
  259. package/src/nodes/element/IHTMLCollection.ts +10 -2
  260. package/src/nodes/html-anchor-element/HTMLAnchorElement.ts +24 -24
  261. package/src/nodes/html-audio-element/Audio.ts +22 -0
  262. package/src/nodes/html-base-element/HTMLBaseElement.ts +4 -4
  263. package/src/nodes/html-button-element/HTMLButtonElement.ts +184 -10
  264. package/src/nodes/html-button-element/IHTMLButtonElement.ts +31 -2
  265. package/src/nodes/html-dialog-element/HTMLDialogElement.ts +3 -3
  266. package/src/nodes/html-element/HTMLElement.ts +12 -12
  267. package/src/nodes/html-form-element/HTMLFormControlsCollection.ts +76 -0
  268. package/src/nodes/html-form-element/HTMLFormElement.ts +147 -41
  269. package/src/nodes/html-form-element/IHTMLFormControlsCollection.ts +45 -0
  270. package/src/nodes/html-form-element/IHTMLFormElement.ts +17 -6
  271. package/src/nodes/html-form-element/IRadioNodeList.ts +16 -0
  272. package/src/nodes/html-form-element/RadioNodeList.ts +24 -0
  273. package/src/nodes/html-image-element/HTMLImageElement.ts +19 -19
  274. package/src/nodes/html-input-element/HTMLInputElement.ts +232 -113
  275. package/src/nodes/html-input-element/IHTMLInputElement.ts +20 -1
  276. package/src/nodes/html-label-element/HTMLLabelElement.ts +3 -7
  277. package/src/nodes/html-link-element/HTMLLinkElement.ts +21 -21
  278. package/src/nodes/html-media-element/HTMLMediaElement.ts +21 -21
  279. package/src/nodes/html-meta-element/HTMLMetaElement.ts +8 -8
  280. package/src/nodes/html-opt-group-element/HTMLOptGroupElement.ts +6 -6
  281. package/src/nodes/html-option-element/HTMLOptionElement.ts +29 -30
  282. package/src/nodes/html-script-element/HTMLScriptElement.ts +16 -16
  283. package/src/nodes/html-script-element/ScriptUtility.ts +5 -5
  284. package/src/nodes/{html-option-element → html-select-element}/HTMLOptionsCollection.ts +5 -9
  285. package/src/nodes/html-select-element/HTMLSelectElement.ts +159 -170
  286. package/src/nodes/{html-option-element → html-select-element}/IHTMLOptionsCollection.ts +4 -8
  287. package/src/nodes/html-select-element/IHTMLSelectElement.ts +25 -2
  288. package/src/nodes/html-slot-element/HTMLSlotElement.ts +2 -2
  289. package/src/nodes/html-style-element/HTMLStyleElement.ts +7 -7
  290. package/src/nodes/html-text-area-element/HTMLTextAreaElement.ts +174 -41
  291. package/src/nodes/html-text-area-element/IHTMLTextAreaElement.ts +18 -0
  292. package/src/nodes/node/Node.ts +61 -6
  293. package/src/nodes/node/NodeList.ts +2 -3
  294. package/src/nodes/parent-node/IParentNode.ts +7 -4
  295. package/src/nodes/parent-node/ParentNodeUtility.ts +25 -15
  296. package/src/nodes/text/Text.ts +38 -0
  297. package/src/query-selector/QuerySelector.ts +2 -2
  298. package/src/query-selector/SelectorItem.ts +3 -0
  299. package/src/validity-state/ValidityState.ts +211 -0
  300. package/src/window/GlobalWindow.ts +0 -2
  301. package/src/window/INodeJSGlobal.ts +70 -0
  302. package/src/window/IWindow.ts +32 -10
  303. package/src/window/Window.ts +43 -21
  304. package/src/xml-http-request/XMLHttpRequest.ts +27 -26
  305. package/src/xml-parser/XMLParser.ts +1 -1
  306. package/lib/fetch/FetchHandler.d.ts +0 -18
  307. package/lib/fetch/FetchHandler.js +0 -83
  308. package/lib/fetch/FetchHandler.js.map +0 -1
  309. package/lib/fetch/IAbortSignal.d.ts +0 -16
  310. package/lib/fetch/IAbortSignal.js +0 -4
  311. package/lib/fetch/IAbortSignal.js.map +0 -1
  312. package/lib/fetch/IBody.d.ts +0 -17
  313. package/lib/fetch/IBody.js.map +0 -1
  314. package/lib/fetch/IHeaders.d.ts +0 -18
  315. package/lib/fetch/IHeadersInit.js.map +0 -1
  316. package/lib/fetch/IRequest.d.ts +0 -18
  317. package/lib/fetch/IRequestInit.d.ts +0 -16
  318. package/lib/fetch/IRequestInit.js.map +0 -1
  319. package/lib/fetch/IResponse.d.ts +0 -20
  320. package/lib/fetch/IResponseInit.d.ts +0 -9
  321. package/lib/fetch/IResponseInit.js.map +0 -1
  322. package/lib/fetch/RequestInfo.js +0 -3
  323. package/lib/fetch/RequestInfo.js.map +0 -1
  324. package/lib/fetch/ResourceFetchHandler.js.map +0 -1
  325. package/lib/form-data/IFormData.d.ts +0 -32
  326. package/lib/form-data/IFormData.js +0 -3
  327. package/lib/form-data/IFormData.js.map +0 -1
  328. package/lib/location/RelativeURL.d.ts +0 -15
  329. package/lib/location/RelativeURL.js +0 -19
  330. package/lib/location/RelativeURL.js.map +0 -1
  331. package/lib/nodes/element/HTMLCollectionFactory.d.ts +0 -21
  332. package/lib/nodes/element/HTMLCollectionFactory.js +0 -31
  333. package/lib/nodes/element/HTMLCollectionFactory.js.map +0 -1
  334. package/lib/nodes/html-option-element/IHTMLOptionsCollection.js.map +0 -1
  335. package/lib/nodes/node/NodeListFactory.d.ts +0 -21
  336. package/lib/nodes/node/NodeListFactory.js +0 -31
  337. package/lib/nodes/node/NodeListFactory.js.map +0 -1
  338. package/lib/nodes/validity-state/ValidityState.d.ts +0 -52
  339. package/lib/nodes/validity-state/ValidityState.js +0 -81
  340. package/lib/nodes/validity-state/ValidityState.js.map +0 -1
  341. package/src/fetch/FetchHandler.ts +0 -90
  342. package/src/fetch/IAbortSignal.ts +0 -34
  343. package/src/fetch/IBody.ts +0 -18
  344. package/src/fetch/IHeaders.ts +0 -18
  345. package/src/fetch/IRequest.ts +0 -59
  346. package/src/fetch/IRequestInit.ts +0 -41
  347. package/src/fetch/IResponse.ts +0 -22
  348. package/src/fetch/IResponseInit.ts +0 -10
  349. package/src/fetch/RequestInfo.ts +0 -6
  350. package/src/form-data/IFormData.ts +0 -33
  351. package/src/location/RelativeURL.ts +0 -17
  352. package/src/nodes/element/HTMLCollectionFactory.ts +0 -31
  353. package/src/nodes/node/NodeListFactory.ts +0 -31
  354. package/src/nodes/validity-state/ValidityState.ts +0 -84
  355. /package/lib/fetch/{IHeaders.js → types/IHeaders.js} +0 -0
  356. /package/lib/fetch/{IHeadersInit.d.ts → types/IHeadersInit.d.ts} +0 -0
  357. /package/lib/fetch/{IHeadersInit.js → types/IHeadersInit.js} +0 -0
  358. /package/lib/fetch/{IRequest.js → types/IRequest.js} +0 -0
  359. /package/lib/fetch/{IRequestInit.js → types/IRequestInit.js} +0 -0
  360. /package/lib/fetch/{IResponse.js → types/IResponse.js} +0 -0
  361. /package/lib/fetch/{IResponseInit.js → types/IResponseInit.js} +0 -0
  362. /package/lib/nodes/{html-option-element → html-select-element}/HTMLOptionsCollection.js +0 -0
  363. /package/lib/nodes/{html-option-element → html-select-element}/IHTMLOptionsCollection.js +0 -0
  364. /package/src/fetch/{IHeadersInit.ts → types/IHeadersInit.ts} +0 -0
@@ -31,14 +31,14 @@ export default class DOMTokenList implements IDOMTokenList {
31
31
  * @param value Value.
32
32
  */
33
33
  public set value(value: string) {
34
- this._ownerElement.setAttributeNS(null, this._attributeName, value);
34
+ this._ownerElement.setAttribute(this._attributeName, value);
35
35
  }
36
36
 
37
37
  /**
38
38
  * Get value.
39
39
  */
40
40
  public get value(): string {
41
- return this._ownerElement.getAttributeNS(null, this._attributeName);
41
+ return this._ownerElement.getAttribute(this._attributeName);
42
42
  }
43
43
 
44
44
  /**
@@ -58,14 +58,14 @@ export default class DOMTokenList implements IDOMTokenList {
58
58
  * @param newToken NewToken.
59
59
  */
60
60
  public replace(token: string, newToken: string): boolean {
61
- const attr = this._ownerElement.getAttributeNS(null, this._attributeName);
62
- const list = attr ? attr.split(' ') : [];
61
+ const attr = this._ownerElement.getAttribute(this._attributeName);
62
+ const list = attr ? Array.from(new Set(attr.split(' '))) : [];
63
63
  const index = list.indexOf(token);
64
64
  if (index === -1) {
65
65
  return false;
66
66
  }
67
67
  list[index] = newToken;
68
- this._ownerElement.setAttributeNS(null, this._attributeName, list.join(' '));
68
+ this._ownerElement.setAttribute(this._attributeName, list.join(' '));
69
69
  return true;
70
70
  }
71
71
 
@@ -86,16 +86,18 @@ export default class DOMTokenList implements IDOMTokenList {
86
86
  * Returns an iterator, allowing you to go through all values of the key/value pairs contained in this object.
87
87
  */
88
88
  public values(): IterableIterator<string> {
89
- const attr = this._ownerElement.getAttributeNS(null, this._attributeName);
90
- return (attr ? attr.split(' ') : []).values();
89
+ const attr = this._ownerElement.getAttribute(this._attributeName);
90
+ const list = attr ? Array.from(new Set(attr.split(' '))) : [];
91
+ return list.values();
91
92
  }
92
93
 
93
94
  /**
94
95
  * Returns an iterator, allowing you to go through all key/value pairs contained in this object.
95
96
  */
96
97
  public entries(): IterableIterator<[number, string]> {
97
- const attr = this._ownerElement.getAttributeNS(null, this._attributeName);
98
- return (attr ? attr.split(' ') : []).entries();
98
+ const attr = this._ownerElement.getAttribute(this._attributeName);
99
+ const list = attr ? Array.from(new Set(attr.split(' '))) : [];
100
+ return list.entries();
99
101
  }
100
102
 
101
103
  /**
@@ -105,8 +107,9 @@ export default class DOMTokenList implements IDOMTokenList {
105
107
  * @param thisArg
106
108
  */
107
109
  public forEach(callback: (currentValue, currentIndex, listObj) => void, thisArg?: this): void {
108
- const attr = this._ownerElement.getAttributeNS(null, this._attributeName);
109
- return (attr ? attr.split(' ') : []).forEach(callback, thisArg);
110
+ const attr = this._ownerElement.getAttribute(this._attributeName);
111
+ const list = attr ? Array.from(new Set(attr.split(' '))) : [];
112
+ return list.forEach(callback, thisArg);
110
113
  }
111
114
 
112
115
  /**
@@ -114,8 +117,9 @@ export default class DOMTokenList implements IDOMTokenList {
114
117
  *
115
118
  */
116
119
  public keys(): IterableIterator<number> {
117
- const attr = this._ownerElement.getAttributeNS(null, this._attributeName);
118
- return (attr ? attr.split(' ') : []).keys();
120
+ const attr = this._ownerElement.getAttribute(this._attributeName);
121
+ const list = attr ? Array.from(new Set(attr.split(' '))) : [];
122
+ return list.keys();
119
123
  }
120
124
 
121
125
  /**
@@ -124,8 +128,8 @@ export default class DOMTokenList implements IDOMTokenList {
124
128
  * @param tokens Tokens.
125
129
  */
126
130
  public add(...tokens: string[]): void {
127
- const attr = this._ownerElement.getAttributeNS(null, this._attributeName);
128
- const list = attr ? attr.split(' ') : [];
131
+ const attr = this._ownerElement.getAttribute(this._attributeName);
132
+ const list = attr ? Array.from(new Set(attr.split(' '))) : [];
129
133
 
130
134
  for (const token of tokens) {
131
135
  const index = list.indexOf(token);
@@ -136,7 +140,7 @@ export default class DOMTokenList implements IDOMTokenList {
136
140
  }
137
141
  }
138
142
 
139
- this._ownerElement.setAttributeNS(null, this._attributeName, list.join(' '));
143
+ this._ownerElement.setAttribute(this._attributeName, list.join(' '));
140
144
  }
141
145
 
142
146
  /**
@@ -145,8 +149,8 @@ export default class DOMTokenList implements IDOMTokenList {
145
149
  * @param tokens Tokens.
146
150
  */
147
151
  public remove(...tokens: string[]): void {
148
- const attr = this._ownerElement.getAttributeNS(null, this._attributeName);
149
- const list = attr ? attr.split(' ') : [];
152
+ const attr = this._ownerElement.getAttribute(this._attributeName);
153
+ const list = attr ? Array.from(new Set(attr.split(' '))) : [];
150
154
 
151
155
  for (const token of tokens) {
152
156
  const index = list.indexOf(token);
@@ -155,7 +159,7 @@ export default class DOMTokenList implements IDOMTokenList {
155
159
  }
156
160
  }
157
161
 
158
- this._ownerElement.setAttributeNS(null, this._attributeName, list.join(' '));
162
+ this._ownerElement.setAttribute(this._attributeName, list.join(' '));
159
163
  }
160
164
 
161
165
  /**
@@ -165,7 +169,7 @@ export default class DOMTokenList implements IDOMTokenList {
165
169
  * @returns TRUE if it contains.
166
170
  */
167
171
  public contains(className: string): boolean {
168
- const attr = this._ownerElement.getAttributeNS(null, this._attributeName);
172
+ const attr = this._ownerElement.getAttribute(this._attributeName);
169
173
  return (attr ? attr.split(' ') : []).includes(className);
170
174
  }
171
175
 
@@ -73,9 +73,13 @@ export default abstract class EventTarget implements IEventTarget {
73
73
  }
74
74
 
75
75
  if (this._listeners[event.type]) {
76
- for (let i = 0, max = this._listeners[event.type].length; i < max; i++) {
77
- const listener = this._listeners[event.type][i];
78
- const options = this._listenerOptions[event.type][i];
76
+ // We need to clone the arrays because the listeners may remove themselves while we are iterating.
77
+ const listeners = this._listeners[event.type].slice();
78
+ const listenerOptions = this._listenerOptions[event.type].slice();
79
+
80
+ for (let i = 0, max = listeners.length; i < max; i++) {
81
+ const listener = listeners[i];
82
+ const options = listenerOptions[i];
79
83
 
80
84
  if ((<IEventListener>listener).handleEvent) {
81
85
  (<IEventListener>listener).handleEvent(event);
@@ -11,6 +11,10 @@ enum DOMExceptionNameEnum {
11
11
  securityError = 'SecurityError',
12
12
  networkError = 'NetworkError',
13
13
  domException = 'DOMException',
14
- invalidAccessError = 'InvalidAccessError'
14
+ invalidAccessError = 'InvalidAccessError',
15
+ unknownError = 'UnknownError',
16
+ abortError = 'AbortError',
17
+ encodingError = 'EncodingError',
18
+ uriMismatchError = 'URIMismatchError'
15
19
  }
16
20
  export default DOMExceptionNameEnum;
@@ -0,0 +1,26 @@
1
+ import AbortSignal from './AbortSignal';
2
+
3
+ /**
4
+ * AbortController.
5
+ *
6
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortController
7
+ */
8
+ export default class AbortController {
9
+ public readonly signal: AbortSignal = new AbortSignal();
10
+
11
+ /**
12
+ * Constructor.
13
+ */
14
+ constructor() {
15
+ this.signal = new AbortSignal();
16
+ }
17
+
18
+ /**
19
+ * Aborts the signal.
20
+ *
21
+ * @param [reason] Reason.
22
+ */
23
+ public abort(reason?: string): void {
24
+ this.signal._abort(reason);
25
+ }
26
+ }
@@ -0,0 +1,44 @@
1
+ import EventTarget from '../event/EventTarget';
2
+ import Event from '../event/Event';
3
+
4
+ /**
5
+ * AbortSignal.
6
+ *
7
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
8
+ */
9
+ export default class AbortSignal extends EventTarget {
10
+ public readonly aborted: boolean = false;
11
+ public readonly reason: string | null = null;
12
+ public onabort: ((this: AbortSignal, event: Event) => void) | null = null;
13
+
14
+ /**
15
+ * Aborts the signal.
16
+ *
17
+ * @param [reason] Reason.
18
+ */
19
+ public _abort(reason?: string): void {
20
+ if (this.aborted) {
21
+ return;
22
+ }
23
+ if (reason) {
24
+ (<string>this.reason) = reason;
25
+ }
26
+ (<boolean>this.aborted) = true;
27
+ this.dispatchEvent(new Event('abort'));
28
+ }
29
+
30
+ /**
31
+ * Returns an AbortSignal instance that has been set as aborted.
32
+ *
33
+ * @param [reason] Reason.
34
+ * @returns AbortSignal instance.
35
+ */
36
+ public static abort(reason?: string): AbortSignal {
37
+ const signal = new AbortSignal();
38
+ if (reason) {
39
+ (<string>signal.reason) = reason;
40
+ }
41
+ (<boolean>signal.aborted) = true;
42
+ return signal;
43
+ }
44
+ }