happy-dom 13.6.2 → 13.7.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 (368) hide show
  1. package/cjs/PropertySymbol.cjs +2 -1
  2. package/cjs/PropertySymbol.cjs.map +1 -1
  3. package/cjs/PropertySymbol.d.ts +1 -0
  4. package/cjs/PropertySymbol.d.ts.map +1 -1
  5. package/cjs/browser/BrowserFrame.cjs +12 -2
  6. package/cjs/browser/BrowserFrame.cjs.map +1 -1
  7. package/cjs/browser/BrowserFrame.d.ts.map +1 -1
  8. package/cjs/browser/detached-browser/DetachedBrowserFrame.cjs +12 -2
  9. package/cjs/browser/detached-browser/DetachedBrowserFrame.cjs.map +1 -1
  10. package/cjs/browser/detached-browser/DetachedBrowserFrame.d.ts.map +1 -1
  11. package/cjs/browser/utilities/BrowserFrameFactory.cjs +5 -0
  12. package/cjs/browser/utilities/BrowserFrameFactory.cjs.map +1 -1
  13. package/cjs/browser/utilities/BrowserFrameFactory.d.ts.map +1 -1
  14. package/cjs/browser/utilities/BrowserFrameNavigator.cjs +20 -13
  15. package/cjs/browser/utilities/BrowserFrameNavigator.cjs.map +1 -1
  16. package/cjs/browser/utilities/BrowserFrameNavigator.d.ts +21 -10
  17. package/cjs/browser/utilities/BrowserFrameNavigator.d.ts.map +1 -1
  18. package/cjs/browser/utilities/BrowserFrameURL.cjs +2 -2
  19. package/cjs/browser/utilities/BrowserFrameURL.cjs.map +1 -1
  20. package/cjs/browser/utilities/BrowserFrameURL.d.ts.map +1 -1
  21. package/cjs/config/IHTMLElementTagNameMap.cjs +3 -0
  22. package/cjs/config/IHTMLElementTagNameMap.cjs.map +1 -0
  23. package/cjs/config/IHTMLElementTagNameMap.d.ts +146 -0
  24. package/cjs/config/IHTMLElementTagNameMap.d.ts.map +1 -0
  25. package/cjs/config/ISVGElementTagNameMap.cjs +3 -0
  26. package/cjs/config/ISVGElementTagNameMap.cjs.map +1 -0
  27. package/cjs/config/ISVGElementTagNameMap.d.ts +67 -0
  28. package/cjs/config/ISVGElementTagNameMap.d.ts.map +1 -0
  29. package/cjs/event/events/HashChangeEvent.cjs +26 -0
  30. package/cjs/event/events/HashChangeEvent.cjs.map +1 -0
  31. package/cjs/event/events/HashChangeEvent.d.ts +19 -0
  32. package/cjs/event/events/HashChangeEvent.d.ts.map +1 -0
  33. package/cjs/event/events/IHashChangeEventInit.cjs +3 -0
  34. package/cjs/event/events/IHashChangeEventInit.cjs.map +1 -0
  35. package/cjs/event/events/IHashChangeEventInit.d.ts +6 -0
  36. package/cjs/event/events/IHashChangeEventInit.d.ts.map +1 -0
  37. package/cjs/fetch/Fetch.cjs +10 -34
  38. package/cjs/fetch/Fetch.cjs.map +1 -1
  39. package/cjs/fetch/Fetch.d.ts +0 -10
  40. package/cjs/fetch/Fetch.d.ts.map +1 -1
  41. package/cjs/fetch/Request.cjs +2 -2
  42. package/cjs/fetch/Request.cjs.map +1 -1
  43. package/cjs/fetch/Response.cjs +2 -6
  44. package/cjs/fetch/Response.cjs.map +1 -1
  45. package/cjs/fetch/Response.d.ts.map +1 -1
  46. package/cjs/fetch/SyncFetch.cjs +3 -3
  47. package/cjs/fetch/SyncFetch.cjs.map +1 -1
  48. package/cjs/fetch/utilities/FetchBodyUtility.cjs +62 -19
  49. package/cjs/fetch/utilities/FetchBodyUtility.cjs.map +1 -1
  50. package/cjs/fetch/utilities/FetchBodyUtility.d.ts +24 -12
  51. package/cjs/fetch/utilities/FetchBodyUtility.d.ts.map +1 -1
  52. package/cjs/fetch/utilities/FetchRequestHeaderUtility.cjs +5 -3
  53. package/cjs/fetch/utilities/FetchRequestHeaderUtility.cjs.map +1 -1
  54. package/cjs/fetch/utilities/FetchRequestHeaderUtility.d.ts.map +1 -1
  55. package/cjs/fetch/utilities/FetchRequestReferrerUtility.cjs +1 -1
  56. package/cjs/fetch/utilities/FetchRequestReferrerUtility.cjs.map +1 -1
  57. package/cjs/fetch/utilities/FetchRequestReferrerUtility.d.ts.map +1 -1
  58. package/cjs/form-data/FormData.cjs +1 -1
  59. package/cjs/form-data/FormData.cjs.map +1 -1
  60. package/cjs/form-data/FormData.d.ts +1 -1
  61. package/cjs/form-data/FormData.d.ts.map +1 -1
  62. package/cjs/index.cjs +7 -3
  63. package/cjs/index.cjs.map +1 -1
  64. package/cjs/index.d.ts +7 -3
  65. package/cjs/index.d.ts.map +1 -1
  66. package/cjs/location/Location.cjs +270 -0
  67. package/cjs/location/Location.cjs.map +1 -0
  68. package/cjs/location/Location.d.ts +144 -0
  69. package/cjs/location/Location.d.ts.map +1 -0
  70. package/cjs/named-node-map/NamedNodeMap.cjs +2 -1
  71. package/cjs/named-node-map/NamedNodeMap.cjs.map +1 -1
  72. package/cjs/named-node-map/NamedNodeMap.d.ts.map +1 -1
  73. package/cjs/nodes/document/Document.cjs +4 -4
  74. package/cjs/nodes/document/Document.cjs.map +1 -1
  75. package/cjs/nodes/document/Document.d.ts +114 -6
  76. package/cjs/nodes/document/Document.d.ts.map +1 -1
  77. package/cjs/nodes/document/IDocument.d.ts +28 -12
  78. package/cjs/nodes/document/IDocument.d.ts.map +1 -1
  79. package/cjs/nodes/document-fragment/DocumentFragment.cjs +2 -2
  80. package/cjs/nodes/document-fragment/DocumentFragment.cjs.map +1 -1
  81. package/cjs/nodes/document-fragment/DocumentFragment.d.ts +31 -1
  82. package/cjs/nodes/document-fragment/DocumentFragment.d.ts.map +1 -1
  83. package/cjs/nodes/document-fragment/IDocumentFragment.d.ts +6 -0
  84. package/cjs/nodes/document-fragment/IDocumentFragment.d.ts.map +1 -1
  85. package/cjs/nodes/element/Element.cjs +1 -1
  86. package/cjs/nodes/element/Element.cjs.map +1 -1
  87. package/cjs/nodes/element/Element.d.ts +61 -1
  88. package/cjs/nodes/element/Element.d.ts.map +1 -1
  89. package/cjs/nodes/element/HTMLCollection.cjs +2 -1
  90. package/cjs/nodes/element/HTMLCollection.cjs.map +1 -1
  91. package/cjs/nodes/element/HTMLCollection.d.ts.map +1 -1
  92. package/cjs/nodes/html-anchor-element/HTMLAnchorElement.cjs +2 -0
  93. package/cjs/nodes/html-anchor-element/HTMLAnchorElement.cjs.map +1 -1
  94. package/cjs/nodes/html-anchor-element/HTMLAnchorElement.d.ts.map +1 -1
  95. package/cjs/nodes/html-button-element/HTMLButtonElement.cjs +93 -4
  96. package/cjs/nodes/html-button-element/HTMLButtonElement.cjs.map +1 -1
  97. package/cjs/nodes/html-button-element/HTMLButtonElement.d.ts +49 -1
  98. package/cjs/nodes/html-button-element/HTMLButtonElement.d.ts.map +1 -1
  99. package/cjs/nodes/html-button-element/IHTMLButtonElement.d.ts +5 -1
  100. package/cjs/nodes/html-button-element/IHTMLButtonElement.d.ts.map +1 -1
  101. package/cjs/nodes/html-form-element/HTMLFormControlsCollection.cjs +2 -1
  102. package/cjs/nodes/html-form-element/HTMLFormControlsCollection.cjs.map +1 -1
  103. package/cjs/nodes/html-form-element/HTMLFormControlsCollection.d.ts.map +1 -1
  104. package/cjs/nodes/html-form-element/HTMLFormElement.cjs +104 -9
  105. package/cjs/nodes/html-form-element/HTMLFormElement.cjs.map +1 -1
  106. package/cjs/nodes/html-form-element/HTMLFormElement.d.ts +8 -2
  107. package/cjs/nodes/html-form-element/HTMLFormElement.d.ts.map +1 -1
  108. package/cjs/nodes/html-iframe-element/HTMLIFrameElement.cjs +14 -0
  109. package/cjs/nodes/html-iframe-element/HTMLIFrameElement.cjs.map +1 -1
  110. package/cjs/nodes/html-iframe-element/HTMLIFrameElement.d.ts +10 -0
  111. package/cjs/nodes/html-iframe-element/HTMLIFrameElement.d.ts.map +1 -1
  112. package/cjs/nodes/html-iframe-element/HTMLIFrameElementPageLoader.cjs +4 -1
  113. package/cjs/nodes/html-iframe-element/HTMLIFrameElementPageLoader.cjs.map +1 -1
  114. package/cjs/nodes/html-iframe-element/HTMLIFrameElementPageLoader.d.ts.map +1 -1
  115. package/cjs/nodes/html-iframe-element/IHTMLIFrameElement.d.ts +1 -0
  116. package/cjs/nodes/html-iframe-element/IHTMLIFrameElement.d.ts.map +1 -1
  117. package/cjs/nodes/html-input-element/HTMLInputElement.cjs +100 -52
  118. package/cjs/nodes/html-input-element/HTMLInputElement.cjs.map +1 -1
  119. package/cjs/nodes/html-input-element/HTMLInputElement.d.ts +49 -23
  120. package/cjs/nodes/html-input-element/HTMLInputElement.d.ts.map +1 -1
  121. package/cjs/nodes/html-input-element/IHTMLInputElement.d.ts +2 -0
  122. package/cjs/nodes/html-input-element/IHTMLInputElement.d.ts.map +1 -1
  123. package/cjs/nodes/html-label-element/HTMLLabelElement.cjs +1 -0
  124. package/cjs/nodes/html-label-element/HTMLLabelElement.cjs.map +1 -1
  125. package/cjs/nodes/html-label-element/HTMLLabelElement.d.ts.map +1 -1
  126. package/cjs/nodes/html-link-element/HTMLLinkElementStyleSheetLoader.cjs +1 -1
  127. package/cjs/nodes/html-link-element/HTMLLinkElementStyleSheetLoader.cjs.map +1 -1
  128. package/cjs/nodes/html-script-element/HTMLScriptElementScriptLoader.cjs +1 -1
  129. package/cjs/nodes/html-script-element/HTMLScriptElementScriptLoader.cjs.map +1 -1
  130. package/cjs/nodes/html-select-element/HTMLSelectElement.cjs.map +1 -1
  131. package/cjs/nodes/html-select-element/HTMLSelectElement.d.ts.map +1 -1
  132. package/cjs/nodes/node/Node.cjs.map +1 -1
  133. package/cjs/nodes/node/Node.d.ts.map +1 -1
  134. package/cjs/nodes/parent-node/IParentNode.d.ts +17 -0
  135. package/cjs/nodes/parent-node/IParentNode.d.ts.map +1 -1
  136. package/cjs/nodes/parent-node/ParentNodeUtility.cjs.map +1 -1
  137. package/cjs/nodes/parent-node/ParentNodeUtility.d.ts.map +1 -1
  138. package/cjs/query-selector/QuerySelector.cjs.map +1 -1
  139. package/cjs/query-selector/QuerySelector.d.ts +34 -0
  140. package/cjs/query-selector/QuerySelector.d.ts.map +1 -1
  141. package/cjs/version.cjs +1 -1
  142. package/cjs/window/BrowserWindow.cjs +9 -3
  143. package/cjs/window/BrowserWindow.cjs.map +1 -1
  144. package/cjs/window/BrowserWindow.d.ts +5 -4
  145. package/cjs/window/BrowserWindow.d.ts.map +1 -1
  146. package/cjs/window/CrossOriginBrowserWindow.d.ts +1 -1
  147. package/cjs/window/CrossOriginBrowserWindow.d.ts.map +1 -1
  148. package/cjs/window/IBrowserWindow.d.ts +3 -2
  149. package/cjs/window/IBrowserWindow.d.ts.map +1 -1
  150. package/cjs/window/ICrossOriginBrowserWindow.d.ts +1 -1
  151. package/cjs/window/ICrossOriginBrowserWindow.d.ts.map +1 -1
  152. package/cjs/window/WindowPageOpenUtility.cjs +4 -2
  153. package/cjs/window/WindowPageOpenUtility.cjs.map +1 -1
  154. package/cjs/window/WindowPageOpenUtility.d.ts.map +1 -1
  155. package/lib/PropertySymbol.d.ts +1 -0
  156. package/lib/PropertySymbol.d.ts.map +1 -1
  157. package/lib/PropertySymbol.js +1 -0
  158. package/lib/PropertySymbol.js.map +1 -1
  159. package/lib/browser/BrowserFrame.d.ts.map +1 -1
  160. package/lib/browser/BrowserFrame.js +12 -2
  161. package/lib/browser/BrowserFrame.js.map +1 -1
  162. package/lib/browser/detached-browser/DetachedBrowserFrame.d.ts.map +1 -1
  163. package/lib/browser/detached-browser/DetachedBrowserFrame.js +12 -2
  164. package/lib/browser/detached-browser/DetachedBrowserFrame.js.map +1 -1
  165. package/lib/browser/utilities/BrowserFrameFactory.d.ts.map +1 -1
  166. package/lib/browser/utilities/BrowserFrameFactory.js +5 -0
  167. package/lib/browser/utilities/BrowserFrameFactory.js.map +1 -1
  168. package/lib/browser/utilities/BrowserFrameNavigator.d.ts +21 -10
  169. package/lib/browser/utilities/BrowserFrameNavigator.d.ts.map +1 -1
  170. package/lib/browser/utilities/BrowserFrameNavigator.js +20 -13
  171. package/lib/browser/utilities/BrowserFrameNavigator.js.map +1 -1
  172. package/lib/browser/utilities/BrowserFrameURL.d.ts.map +1 -1
  173. package/lib/browser/utilities/BrowserFrameURL.js +2 -2
  174. package/lib/browser/utilities/BrowserFrameURL.js.map +1 -1
  175. package/lib/config/IHTMLElementTagNameMap.d.ts +146 -0
  176. package/lib/config/IHTMLElementTagNameMap.d.ts.map +1 -0
  177. package/lib/config/IHTMLElementTagNameMap.js +2 -0
  178. package/lib/config/IHTMLElementTagNameMap.js.map +1 -0
  179. package/lib/config/ISVGElementTagNameMap.d.ts +67 -0
  180. package/lib/config/ISVGElementTagNameMap.d.ts.map +1 -0
  181. package/lib/config/ISVGElementTagNameMap.js +2 -0
  182. package/lib/config/ISVGElementTagNameMap.js.map +1 -0
  183. package/lib/event/events/HashChangeEvent.d.ts +19 -0
  184. package/lib/event/events/HashChangeEvent.d.ts.map +1 -0
  185. package/lib/event/events/HashChangeEvent.js +20 -0
  186. package/lib/event/events/HashChangeEvent.js.map +1 -0
  187. package/lib/event/events/IHashChangeEventInit.d.ts +6 -0
  188. package/lib/event/events/IHashChangeEventInit.d.ts.map +1 -0
  189. package/lib/event/events/IHashChangeEventInit.js +2 -0
  190. package/lib/event/events/IHashChangeEventInit.js.map +1 -0
  191. package/lib/fetch/Fetch.d.ts +0 -10
  192. package/lib/fetch/Fetch.d.ts.map +1 -1
  193. package/lib/fetch/Fetch.js +10 -34
  194. package/lib/fetch/Fetch.js.map +1 -1
  195. package/lib/fetch/Request.js +2 -2
  196. package/lib/fetch/Request.js.map +1 -1
  197. package/lib/fetch/Response.d.ts.map +1 -1
  198. package/lib/fetch/Response.js +2 -6
  199. package/lib/fetch/Response.js.map +1 -1
  200. package/lib/fetch/SyncFetch.js +3 -3
  201. package/lib/fetch/SyncFetch.js.map +1 -1
  202. package/lib/fetch/utilities/FetchBodyUtility.d.ts +24 -12
  203. package/lib/fetch/utilities/FetchBodyUtility.d.ts.map +1 -1
  204. package/lib/fetch/utilities/FetchBodyUtility.js +62 -19
  205. package/lib/fetch/utilities/FetchBodyUtility.js.map +1 -1
  206. package/lib/fetch/utilities/FetchRequestHeaderUtility.d.ts.map +1 -1
  207. package/lib/fetch/utilities/FetchRequestHeaderUtility.js +4 -2
  208. package/lib/fetch/utilities/FetchRequestHeaderUtility.js.map +1 -1
  209. package/lib/fetch/utilities/FetchRequestReferrerUtility.d.ts.map +1 -1
  210. package/lib/fetch/utilities/FetchRequestReferrerUtility.js +1 -1
  211. package/lib/fetch/utilities/FetchRequestReferrerUtility.js.map +1 -1
  212. package/lib/form-data/FormData.d.ts +1 -1
  213. package/lib/form-data/FormData.d.ts.map +1 -1
  214. package/lib/form-data/FormData.js +1 -1
  215. package/lib/form-data/FormData.js.map +1 -1
  216. package/lib/index.d.ts +7 -3
  217. package/lib/index.d.ts.map +1 -1
  218. package/lib/index.js +4 -2
  219. package/lib/index.js.map +1 -1
  220. package/lib/location/Location.d.ts +144 -0
  221. package/lib/location/Location.d.ts.map +1 -0
  222. package/lib/location/Location.js +241 -0
  223. package/lib/location/Location.js.map +1 -0
  224. package/lib/named-node-map/NamedNodeMap.d.ts.map +1 -1
  225. package/lib/named-node-map/NamedNodeMap.js +2 -1
  226. package/lib/named-node-map/NamedNodeMap.js.map +1 -1
  227. package/lib/nodes/document/Document.d.ts +114 -6
  228. package/lib/nodes/document/Document.d.ts.map +1 -1
  229. package/lib/nodes/document/Document.js +4 -4
  230. package/lib/nodes/document/Document.js.map +1 -1
  231. package/lib/nodes/document/IDocument.d.ts +28 -12
  232. package/lib/nodes/document/IDocument.d.ts.map +1 -1
  233. package/lib/nodes/document-fragment/DocumentFragment.d.ts +31 -1
  234. package/lib/nodes/document-fragment/DocumentFragment.d.ts.map +1 -1
  235. package/lib/nodes/document-fragment/DocumentFragment.js +2 -2
  236. package/lib/nodes/document-fragment/DocumentFragment.js.map +1 -1
  237. package/lib/nodes/document-fragment/IDocumentFragment.d.ts +6 -0
  238. package/lib/nodes/document-fragment/IDocumentFragment.d.ts.map +1 -1
  239. package/lib/nodes/element/Element.d.ts +61 -1
  240. package/lib/nodes/element/Element.d.ts.map +1 -1
  241. package/lib/nodes/element/Element.js +1 -1
  242. package/lib/nodes/element/Element.js.map +1 -1
  243. package/lib/nodes/element/HTMLCollection.d.ts.map +1 -1
  244. package/lib/nodes/element/HTMLCollection.js +2 -1
  245. package/lib/nodes/element/HTMLCollection.js.map +1 -1
  246. package/lib/nodes/html-anchor-element/HTMLAnchorElement.d.ts.map +1 -1
  247. package/lib/nodes/html-anchor-element/HTMLAnchorElement.js +2 -0
  248. package/lib/nodes/html-anchor-element/HTMLAnchorElement.js.map +1 -1
  249. package/lib/nodes/html-button-element/HTMLButtonElement.d.ts +49 -1
  250. package/lib/nodes/html-button-element/HTMLButtonElement.d.ts.map +1 -1
  251. package/lib/nodes/html-button-element/HTMLButtonElement.js +93 -4
  252. package/lib/nodes/html-button-element/HTMLButtonElement.js.map +1 -1
  253. package/lib/nodes/html-button-element/IHTMLButtonElement.d.ts +5 -1
  254. package/lib/nodes/html-button-element/IHTMLButtonElement.d.ts.map +1 -1
  255. package/lib/nodes/html-form-element/HTMLFormControlsCollection.d.ts.map +1 -1
  256. package/lib/nodes/html-form-element/HTMLFormControlsCollection.js +2 -1
  257. package/lib/nodes/html-form-element/HTMLFormControlsCollection.js.map +1 -1
  258. package/lib/nodes/html-form-element/HTMLFormElement.d.ts +8 -2
  259. package/lib/nodes/html-form-element/HTMLFormElement.d.ts.map +1 -1
  260. package/lib/nodes/html-form-element/HTMLFormElement.js +106 -10
  261. package/lib/nodes/html-form-element/HTMLFormElement.js.map +1 -1
  262. package/lib/nodes/html-iframe-element/HTMLIFrameElement.d.ts +10 -0
  263. package/lib/nodes/html-iframe-element/HTMLIFrameElement.d.ts.map +1 -1
  264. package/lib/nodes/html-iframe-element/HTMLIFrameElement.js +14 -0
  265. package/lib/nodes/html-iframe-element/HTMLIFrameElement.js.map +1 -1
  266. package/lib/nodes/html-iframe-element/HTMLIFrameElementPageLoader.d.ts.map +1 -1
  267. package/lib/nodes/html-iframe-element/HTMLIFrameElementPageLoader.js +4 -1
  268. package/lib/nodes/html-iframe-element/HTMLIFrameElementPageLoader.js.map +1 -1
  269. package/lib/nodes/html-iframe-element/IHTMLIFrameElement.d.ts +1 -0
  270. package/lib/nodes/html-iframe-element/IHTMLIFrameElement.d.ts.map +1 -1
  271. package/lib/nodes/html-input-element/HTMLInputElement.d.ts +49 -23
  272. package/lib/nodes/html-input-element/HTMLInputElement.d.ts.map +1 -1
  273. package/lib/nodes/html-input-element/HTMLInputElement.js +100 -52
  274. package/lib/nodes/html-input-element/HTMLInputElement.js.map +1 -1
  275. package/lib/nodes/html-input-element/IHTMLInputElement.d.ts +2 -0
  276. package/lib/nodes/html-input-element/IHTMLInputElement.d.ts.map +1 -1
  277. package/lib/nodes/html-label-element/HTMLLabelElement.d.ts.map +1 -1
  278. package/lib/nodes/html-label-element/HTMLLabelElement.js +1 -0
  279. package/lib/nodes/html-label-element/HTMLLabelElement.js.map +1 -1
  280. package/lib/nodes/html-link-element/HTMLLinkElementStyleSheetLoader.js +1 -1
  281. package/lib/nodes/html-link-element/HTMLLinkElementStyleSheetLoader.js.map +1 -1
  282. package/lib/nodes/html-script-element/HTMLScriptElementScriptLoader.js +1 -1
  283. package/lib/nodes/html-script-element/HTMLScriptElementScriptLoader.js.map +1 -1
  284. package/lib/nodes/html-select-element/HTMLSelectElement.d.ts.map +1 -1
  285. package/lib/nodes/html-select-element/HTMLSelectElement.js.map +1 -1
  286. package/lib/nodes/node/Node.d.ts.map +1 -1
  287. package/lib/nodes/node/Node.js.map +1 -1
  288. package/lib/nodes/parent-node/IParentNode.d.ts +17 -0
  289. package/lib/nodes/parent-node/IParentNode.d.ts.map +1 -1
  290. package/lib/nodes/parent-node/ParentNodeUtility.d.ts.map +1 -1
  291. package/lib/nodes/parent-node/ParentNodeUtility.js.map +1 -1
  292. package/lib/query-selector/QuerySelector.d.ts +34 -0
  293. package/lib/query-selector/QuerySelector.d.ts.map +1 -1
  294. package/lib/query-selector/QuerySelector.js.map +1 -1
  295. package/lib/version.js +1 -1
  296. package/lib/window/BrowserWindow.d.ts +5 -4
  297. package/lib/window/BrowserWindow.d.ts.map +1 -1
  298. package/lib/window/BrowserWindow.js +10 -4
  299. package/lib/window/BrowserWindow.js.map +1 -1
  300. package/lib/window/CrossOriginBrowserWindow.d.ts +1 -1
  301. package/lib/window/CrossOriginBrowserWindow.d.ts.map +1 -1
  302. package/lib/window/IBrowserWindow.d.ts +3 -2
  303. package/lib/window/IBrowserWindow.d.ts.map +1 -1
  304. package/lib/window/ICrossOriginBrowserWindow.d.ts +1 -1
  305. package/lib/window/ICrossOriginBrowserWindow.d.ts.map +1 -1
  306. package/lib/window/WindowPageOpenUtility.d.ts.map +1 -1
  307. package/lib/window/WindowPageOpenUtility.js +4 -2
  308. package/lib/window/WindowPageOpenUtility.js.map +1 -1
  309. package/package.json +1 -1
  310. package/src/PropertySymbol.ts +1 -0
  311. package/src/browser/BrowserFrame.ts +12 -2
  312. package/src/browser/detached-browser/DetachedBrowserFrame.ts +12 -7
  313. package/src/browser/utilities/BrowserFrameFactory.ts +7 -0
  314. package/src/browser/utilities/BrowserFrameNavigator.ts +28 -18
  315. package/src/browser/utilities/BrowserFrameURL.ts +2 -2
  316. package/src/config/IHTMLElementTagNameMap.ts +151 -0
  317. package/src/config/ISVGElementTagNameMap.ts +67 -0
  318. package/src/event/events/HashChangeEvent.ts +25 -0
  319. package/src/event/events/IHashChangeEventInit.ts +6 -0
  320. package/src/fetch/Fetch.ts +28 -37
  321. package/src/fetch/Request.ts +2 -2
  322. package/src/fetch/Response.ts +3 -6
  323. package/src/fetch/SyncFetch.ts +3 -3
  324. package/src/fetch/utilities/FetchBodyUtility.ts +67 -20
  325. package/src/fetch/utilities/FetchRequestHeaderUtility.ts +4 -5
  326. package/src/fetch/utilities/FetchRequestReferrerUtility.ts +2 -1
  327. package/src/form-data/FormData.ts +2 -2
  328. package/src/index.ts +9 -1
  329. package/src/location/Location.ts +257 -0
  330. package/src/named-node-map/NamedNodeMap.ts +1 -0
  331. package/src/nodes/document/Document.ts +224 -17
  332. package/src/nodes/document/IDocument.ts +33 -11
  333. package/src/nodes/document-fragment/DocumentFragment.ts +59 -1
  334. package/src/nodes/document-fragment/IDocumentFragment.ts +14 -0
  335. package/src/nodes/element/Element.ts +120 -1
  336. package/src/nodes/element/HTMLCollection.ts +1 -0
  337. package/src/nodes/html-anchor-element/HTMLAnchorElement.ts +2 -0
  338. package/src/nodes/html-button-element/HTMLButtonElement.ts +107 -5
  339. package/src/nodes/html-button-element/IHTMLButtonElement.ts +5 -1
  340. package/src/nodes/html-form-element/HTMLFormControlsCollection.ts +1 -0
  341. package/src/nodes/html-form-element/HTMLFormElement.ts +111 -5
  342. package/src/nodes/html-iframe-element/HTMLIFrameElement.ts +16 -0
  343. package/src/nodes/html-iframe-element/HTMLIFrameElementPageLoader.ts +5 -1
  344. package/src/nodes/html-iframe-element/IHTMLIFrameElement.ts +1 -0
  345. package/src/nodes/html-input-element/HTMLInputElement.ts +111 -57
  346. package/src/nodes/html-input-element/IHTMLInputElement.ts +2 -0
  347. package/src/nodes/html-label-element/HTMLLabelElement.ts +1 -0
  348. package/src/nodes/html-link-element/HTMLLinkElementStyleSheetLoader.ts +1 -1
  349. package/src/nodes/html-script-element/HTMLScriptElementScriptLoader.ts +1 -1
  350. package/src/nodes/html-select-element/HTMLSelectElement.ts +1 -2
  351. package/src/nodes/node/Node.ts +1 -2
  352. package/src/nodes/parent-node/IParentNode.ts +36 -0
  353. package/src/nodes/parent-node/ParentNodeUtility.ts +1 -0
  354. package/src/query-selector/QuerySelector.ts +76 -2
  355. package/src/window/BrowserWindow.ts +11 -4
  356. package/src/window/CrossOriginBrowserWindow.ts +1 -1
  357. package/src/window/IBrowserWindow.ts +3 -2
  358. package/src/window/ICrossOriginBrowserWindow.ts +1 -1
  359. package/src/window/WindowPageOpenUtility.ts +4 -2
  360. package/cjs/url/Location.cjs +0 -111
  361. package/cjs/url/Location.cjs.map +0 -1
  362. package/cjs/url/Location.d.ts +0 -48
  363. package/cjs/url/Location.d.ts.map +0 -1
  364. package/lib/url/Location.d.ts +0 -48
  365. package/lib/url/Location.d.ts.map +0 -1
  366. package/lib/url/Location.js +0 -82
  367. package/lib/url/Location.js.map +0 -1
  368. package/src/url/Location.ts +0 -79
@@ -9,29 +9,12 @@ import DOMExceptionNameEnum from '../../exception/DOMExceptionNameEnum.js';
9
9
  import IRequestBody from '../types/IRequestBody.js';
10
10
  import IResponseBody from '../types/IResponseBody.js';
11
11
  import { Buffer } from 'buffer';
12
+ import Stream from 'stream';
12
13
 
13
14
  /**
14
15
  * Fetch body utility.
15
16
  */
16
17
  export default class FetchBodyUtility {
17
- /**
18
- * Wraps a given value in a browser ReadableStream.
19
- *
20
- * This method creates a ReadableStream and immediately enqueues and closes it
21
- * with the provided value, useful for stream API compatibility.
22
- *
23
- * @param value The value to be wrapped in a ReadableStream.
24
- * @returns ReadableStream
25
- */
26
- public static toReadableStream(value): ReadableStream {
27
- return new ReadableStream({
28
- start(controller) {
29
- controller.enqueue(value);
30
- controller.close();
31
- }
32
- });
33
- }
34
-
35
18
  /**
36
19
  * Parses body and returns stream and type.
37
20
  *
@@ -115,8 +98,8 @@ export default class FetchBodyUtility {
115
98
  * It creates a pass through stream and pipes the original stream to it.
116
99
  *
117
100
  * @param requestOrResponse Request or Response.
118
- * @param requestOrResponse.body
119
- * @param requestOrResponse.bodyUsed
101
+ * @param requestOrResponse.body Body.
102
+ * @param requestOrResponse.bodyUsed Body used.
120
103
  * @returns New stream.
121
104
  */
122
105
  public static cloneBodyStream(requestOrResponse: {
@@ -130,7 +113,25 @@ export default class FetchBodyUtility {
130
113
  );
131
114
  }
132
115
 
116
+ // If a buffer is set, use it to create a new stream.
117
+ if (requestOrResponse[PropertySymbol.buffer]) {
118
+ return this.toReadableStream(requestOrResponse[PropertySymbol.buffer]);
119
+ }
120
+
121
+ // Pipe underlying node stream if it exists.
122
+ if (requestOrResponse.body[PropertySymbol.nodeStream]) {
123
+ const stream1 = new Stream.PassThrough();
124
+ const stream2 = new Stream.PassThrough();
125
+ requestOrResponse.body[PropertySymbol.nodeStream].pipe(stream1);
126
+ requestOrResponse.body[PropertySymbol.nodeStream].pipe(stream2);
127
+ // Sets the body of the cloned request/response to the first pass through stream.
128
+ requestOrResponse.body = this.nodeToWebStream(stream1);
129
+ // Returns the clone.
130
+ return this.nodeToWebStream(stream2);
131
+ }
132
+
133
133
  // Uses the tee() method to clone the ReadableStream
134
+ // This requires the stream to be consumed in parallel which is not the case for the fetch API
134
135
  const [stream1, stream2] = requestOrResponse.body.tee();
135
136
 
136
137
  // Sets the body of the cloned request to the first pass through stream.
@@ -198,4 +199,50 @@ export default class FetchBodyUtility {
198
199
  );
199
200
  }
200
201
  }
202
+ /**
203
+ * Wraps a given value in a browser ReadableStream.
204
+ *
205
+ * This method creates a ReadableStream and immediately enqueues and closes it
206
+ * with the provided value, useful for stream API compatibility.
207
+ *
208
+ * @param value The value to be wrapped in a ReadableStream.
209
+ * @returns ReadableStream
210
+ */
211
+ public static toReadableStream(value): ReadableStream {
212
+ return new ReadableStream({
213
+ start(controller) {
214
+ controller.enqueue(value);
215
+ controller.close();
216
+ }
217
+ });
218
+ }
219
+
220
+ /**
221
+ * Wraps a Node.js stream into a browser-compatible ReadableStream.
222
+ *
223
+ * Enables the use of Node.js streams where browser ReadableStreams are required.
224
+ * Handles 'data', 'end', and 'error' events from the Node.js stream.
225
+ *
226
+ * @param nodeStream The Node.js stream to be converted.
227
+ * @returns ReadableStream
228
+ */
229
+ public static nodeToWebStream(nodeStream: Stream): ReadableStream {
230
+ const readableStream = new ReadableStream({
231
+ start(controller) {
232
+ nodeStream.on('data', (chunk) => {
233
+ controller.enqueue(chunk);
234
+ });
235
+
236
+ nodeStream.on('end', () => {
237
+ controller.close();
238
+ });
239
+
240
+ nodeStream.on('error', (err) => {
241
+ controller.error(err);
242
+ });
243
+ }
244
+ });
245
+ readableStream[PropertySymbol.nodeStream] = nodeStream;
246
+ return readableStream;
247
+ }
201
248
  }
@@ -6,6 +6,7 @@ import Headers from '../Headers.js';
6
6
  import Request from '../Request.js';
7
7
  import IHeaders from '../types/IHeaders.js';
8
8
  import FetchCORSUtility from './FetchCORSUtility.js';
9
+ import { URL } from 'url';
9
10
 
10
11
  const FORBIDDEN_HEADER_NAMES = [
11
12
  'accept-charset',
@@ -77,10 +78,8 @@ export default class FetchRequestHeaderUtility {
77
78
  request: Request;
78
79
  }): { [key: string]: string } {
79
80
  const headers = new Headers(options.request.headers);
80
- const isCORS = FetchCORSUtility.isCORS(
81
- options.window.location,
82
- options.request[PropertySymbol.url]
83
- );
81
+ const originURL = new URL(options.window.location.href);
82
+ const isCORS = FetchCORSUtility.isCORS(originURL, options.request[PropertySymbol.url]);
84
83
 
85
84
  // TODO: Maybe we need to add support for OPTIONS request with 'Access-Control-Allow-*' headers?
86
85
  if (
@@ -107,7 +106,7 @@ export default class FetchRequestHeaderUtility {
107
106
  (options.request.credentials === 'same-origin' && !isCORS)
108
107
  ) {
109
108
  const cookies = options.browserFrame.page.context.cookieContainer.getCookies(
110
- options.window.location,
109
+ originURL,
111
110
  false
112
111
  );
113
112
  if (cookies.length > 0) {
@@ -55,7 +55,8 @@ export default class FetchRequestReferrerUtility {
55
55
  if (referrer === '' || referrer === 'no-referrer' || referrer === 'client') {
56
56
  return referrer;
57
57
  } else if (referrer) {
58
- const referrerURL = referrer instanceof URL ? referrer : new URL(referrer, window.location);
58
+ const referrerURL =
59
+ referrer instanceof URL ? referrer : new URL(referrer, window.location.href);
59
60
  return referrerURL.origin === window.location.origin ? referrerURL : 'client';
60
61
  }
61
62
 
@@ -59,7 +59,7 @@ export default class FormData implements Iterable<[string, string | File]> {
59
59
  this.append(node.name, file);
60
60
  }
61
61
  }
62
- } else {
62
+ } else if (node.value) {
63
63
  this.append(node.name, node.value);
64
64
  }
65
65
  }
@@ -73,7 +73,7 @@ export default class FormData implements Iterable<[string, string | File]> {
73
73
  *
74
74
  * @param callback Callback.
75
75
  */
76
- public forEach(callback: (key: string, value: string | File, thisArg: FormData) => void): void {
76
+ public forEach(callback: (value: string | File, key: string, thisArg: FormData) => void): void {
77
77
  for (const entry of this.#entries) {
78
78
  callback.call(this, entry.value, entry.name, this);
79
79
  }
package/src/index.ts CHANGED
@@ -40,8 +40,10 @@ import ClipboardEvent from './event/events/ClipboardEvent.js';
40
40
  import CustomEvent from './event/events/CustomEvent.js';
41
41
  import ErrorEvent from './event/events/ErrorEvent.js';
42
42
  import FocusEvent from './event/events/FocusEvent.js';
43
+ import HashChangeEvent from './event/events/HashChangeEvent.js';
43
44
  import InputEvent from './event/events/InputEvent.js';
44
45
  import KeyboardEvent from './event/events/KeyboardEvent.js';
46
+ import MediaQueryListEvent from './event/events/MediaQueryListEvent.js';
45
47
  import MouseEvent from './event/events/MouseEvent.js';
46
48
  import ProgressEvent from './event/events/ProgressEvent.js';
47
49
  import SubmitEvent from './event/events/SubmitEvent.js';
@@ -115,7 +117,7 @@ import Storage from './storage/Storage.js';
115
117
  import NodeFilter from './tree-walker/NodeFilter.js';
116
118
  import NodeIterator from './tree-walker/NodeIterator.js';
117
119
  import TreeWalker from './tree-walker/TreeWalker.js';
118
- import Location from './url/Location.js';
120
+ import Location from './location/Location.js';
119
121
  import URL from './url/URL.js';
120
122
  import BrowserWindow from './window/BrowserWindow.js';
121
123
  import GlobalWindow from './window/GlobalWindow.js';
@@ -138,8 +140,10 @@ import type IClipboardEventInit from './event/events/IClipboardEventInit.js';
138
140
  import type ICustomEventInit from './event/events/ICustomEventInit.js';
139
141
  import type IErrorEventInit from './event/events/IErrorEventInit.js';
140
142
  import type IFocusEventInit from './event/events/IFocusEventInit.js';
143
+ import type IHashChangeEventInit from './event/events/IHashChangeEventInit.js';
141
144
  import type IInputEventInit from './event/events/IInputEventInit.js';
142
145
  import type IKeyboardEventInit from './event/events/IKeyboardEventInit.js';
146
+ import type IMediaQueryListInit from './event/events/IMediaQueryListInit.js';
143
147
  import type IMouseEventInit from './event/events/IMouseEventInit.js';
144
148
  import type IProgressEventInit from './event/events/IProgressEventInit.js';
145
149
  import type ISubmitEventInit from './event/events/ISubmitEventInit.js';
@@ -237,9 +241,11 @@ export type {
237
241
  IHTMLTemplateElement,
238
242
  IHTMLTextAreaElement,
239
243
  IHTMLVideoElement,
244
+ IHashChangeEventInit,
240
245
  IHeaders,
241
246
  IInputEventInit,
242
247
  IKeyboardEventInit,
248
+ IMediaQueryListInit,
243
249
  IMouseEventInit,
244
250
  INode,
245
251
  INodeList,
@@ -388,12 +394,14 @@ export {
388
394
  HTMLElement as HTMLUListElement,
389
395
  HTMLUnknownElement,
390
396
  HTMLVideoElement,
397
+ HashChangeEvent,
391
398
  Headers,
392
399
  History,
393
400
  Image,
394
401
  InputEvent,
395
402
  KeyboardEvent,
396
403
  Location,
404
+ MediaQueryListEvent,
397
405
  MouseEvent,
398
406
  MutationObserver,
399
407
  MutationRecord,
@@ -0,0 +1,257 @@
1
+ import IBrowserFrame from '../browser/types/IBrowserFrame.js';
2
+ import HashChangeEvent from '../event/events/HashChangeEvent.js';
3
+ import * as PropertySymbol from '../PropertySymbol.js';
4
+ import { URL } from 'url';
5
+
6
+ /**
7
+ * Location.
8
+ */
9
+ export default class Location {
10
+ // Public properties
11
+ public [Symbol.toStringTag] = 'Location';
12
+
13
+ // Private properties
14
+ #browserFrame: IBrowserFrame;
15
+ #url: URL;
16
+
17
+ /**
18
+ * Constructor.
19
+ *
20
+ * @param browserFrame Browser frame.
21
+ * @param url URL.
22
+ */
23
+ constructor(browserFrame: IBrowserFrame, url: string) {
24
+ this.#browserFrame = browserFrame;
25
+ this.#url = new URL(url);
26
+ }
27
+
28
+ /**
29
+ * Returns hash.
30
+ *
31
+ * @returns Hash.
32
+ */
33
+ public get hash(): string {
34
+ return this.#url.hash;
35
+ }
36
+
37
+ /**
38
+ * Sets hash.
39
+ *
40
+ * @param hash Value.
41
+ */
42
+ public set hash(hash: string) {
43
+ const oldURL = this.#url.href;
44
+ this.#url.hash = hash;
45
+ const newURL = this.#url.href;
46
+ if (newURL !== oldURL) {
47
+ this.#browserFrame.window?.dispatchEvent(
48
+ new HashChangeEvent('hashchange', { oldURL, newURL })
49
+ );
50
+ }
51
+ }
52
+
53
+ /**
54
+ * Returns host.
55
+ *
56
+ * @returns Host.
57
+ */
58
+ public get host(): string {
59
+ return this.#url.host;
60
+ }
61
+
62
+ /**
63
+ * Sets host.
64
+ *
65
+ * @param host Value.
66
+ */
67
+ public set host(host: string) {
68
+ const url = new URL(this.#url.href);
69
+ url.host = host;
70
+ this.#browserFrame
71
+ .goto(url.href)
72
+ .catch((error) => this.#browserFrame.page.console.error(error));
73
+ }
74
+
75
+ /**
76
+ * Returns hostname.
77
+ *
78
+ * @returns Hostname.
79
+ */
80
+ public get hostname(): string {
81
+ return this.#url.hostname;
82
+ }
83
+
84
+ /**
85
+ * Sets hostname.
86
+ *
87
+ * @param hostname Value.
88
+ */
89
+ public set hostname(hostname: string) {
90
+ const url = new URL(this.#url.href);
91
+ url.hostname = hostname;
92
+ this.#browserFrame
93
+ .goto(url.href)
94
+ .catch((error) => this.#browserFrame.page.console.error(error));
95
+ }
96
+
97
+ /**
98
+ * Override set href.
99
+ */
100
+ public get href(): string {
101
+ return this.#url.href;
102
+ }
103
+
104
+ /**
105
+ * Override set href.
106
+ */
107
+ public set href(url: string) {
108
+ this.#browserFrame.goto(url).catch((error) => this.#browserFrame.page.console.error(error));
109
+ }
110
+
111
+ /**
112
+ * Returns origin.
113
+ *
114
+ * @returns Origin.
115
+ */
116
+ public get origin(): string {
117
+ return this.#url.origin;
118
+ }
119
+
120
+ /**
121
+ * Returns pathname
122
+ *
123
+ * @returns Pathname.
124
+ */
125
+ public get pathname(): string {
126
+ return this.#url.pathname;
127
+ }
128
+
129
+ /**
130
+ * Sets pathname.
131
+ *
132
+ * @param pathname Value.
133
+ */
134
+ public set pathname(pathname: string) {
135
+ const url = new URL(this.#url.href);
136
+ url.pathname = pathname;
137
+ this.#browserFrame
138
+ .goto(url.href)
139
+ .catch((error) => this.#browserFrame.page.console.error(error));
140
+ }
141
+
142
+ /**
143
+ * Returns port.
144
+ *
145
+ * @returns Port.
146
+ */
147
+ public get port(): string {
148
+ return this.#url.port;
149
+ }
150
+
151
+ /**
152
+ * Sets port.
153
+ *
154
+ * @param port Value.
155
+ */
156
+ public set port(port: string) {
157
+ const url = new URL(this.#url.href);
158
+ url.port = port;
159
+ this.#browserFrame
160
+ .goto(url.href)
161
+ .catch((error) => this.#browserFrame.page.console.error(error));
162
+ }
163
+
164
+ /**
165
+ * Returns protocol.
166
+ *
167
+ * @returns Protocol.
168
+ */
169
+ public get protocol(): string {
170
+ return this.#url.protocol;
171
+ }
172
+
173
+ /**
174
+ * Sets protocol.
175
+ *
176
+ * @param protocol Value.
177
+ */
178
+ public set protocol(protocol: string) {
179
+ const url = new URL(this.#url.href);
180
+ url.protocol = protocol;
181
+ this.#browserFrame
182
+ .goto(url.href)
183
+ .catch((error) => this.#browserFrame.page.console.error(error));
184
+ }
185
+
186
+ /**
187
+ * Returns search.
188
+ *
189
+ * @returns Search.
190
+ */
191
+ public get search(): string {
192
+ return this.#url.search;
193
+ }
194
+
195
+ /**
196
+ * Sets search.
197
+ *
198
+ * @param search Value.
199
+ */
200
+ public set search(search: string) {
201
+ const url = new URL(this.#url.href);
202
+ url.search = search;
203
+ this.#browserFrame
204
+ .goto(url.href)
205
+ .catch((error) => this.#browserFrame.page.console.error(error));
206
+ }
207
+
208
+ /**
209
+ * Replaces the current resource with the one at the provided URL. The difference from the assign() method is that after using replace() the current page will not be saved in session History, meaning the user won't be able to use the back button to navigate to it.
210
+ *
211
+ * @param url URL.
212
+ */
213
+ public replace(url: string): void {
214
+ this.href = url;
215
+ }
216
+
217
+ /**
218
+ * Loads the resource at the URL provided in parameter.
219
+ *
220
+ * @param url URL.
221
+ */
222
+ public assign(url: string): void {
223
+ this.href = url;
224
+ }
225
+
226
+ /**
227
+ * Reloads the resource from the current URL.
228
+ */
229
+ public reload(): void {
230
+ this.#browserFrame
231
+ .goto(this.href)
232
+ .catch((error) => this.#browserFrame.page.console.error(error));
233
+ }
234
+
235
+ /**
236
+ * Replaces the current URL state with the provided one without navigating to the new URL.
237
+ *
238
+ * @param browserFrame Browser frame that must match the current one as validation.
239
+ * @param url URL.
240
+ */
241
+ public [PropertySymbol.setURL](browserFrame: IBrowserFrame, url: string): void {
242
+ if (this.#browserFrame !== browserFrame) {
243
+ throw new Error('Failed to set URL. Browser frame mismatch.');
244
+ }
245
+
246
+ this.#url.href = url;
247
+ }
248
+
249
+ /**
250
+ * Returns the URL as a string.
251
+ *
252
+ * @returns URL as a string.
253
+ */
254
+ public toString(): string {
255
+ return this.#url.toString();
256
+ }
257
+ }
@@ -225,6 +225,7 @@ export default class NamedNodeMap implements INamedNodeMap {
225
225
  */
226
226
  protected [PropertySymbol.isValidPropertyName](name: string): boolean {
227
227
  return (
228
+ !!name &&
228
229
  !this.constructor.prototype.hasOwnProperty(name) &&
229
230
  (isNaN(Number(name)) || name.includes('.'))
230
231
  );