happy-dom 13.6.1 → 13.7.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 (351) hide show
  1. package/cjs/browser/BrowserFrame.cjs +12 -2
  2. package/cjs/browser/BrowserFrame.cjs.map +1 -1
  3. package/cjs/browser/BrowserFrame.d.ts.map +1 -1
  4. package/cjs/browser/detached-browser/DetachedBrowserFrame.cjs +12 -2
  5. package/cjs/browser/detached-browser/DetachedBrowserFrame.cjs.map +1 -1
  6. package/cjs/browser/detached-browser/DetachedBrowserFrame.d.ts.map +1 -1
  7. package/cjs/browser/utilities/BrowserFrameFactory.cjs +5 -0
  8. package/cjs/browser/utilities/BrowserFrameFactory.cjs.map +1 -1
  9. package/cjs/browser/utilities/BrowserFrameFactory.d.ts.map +1 -1
  10. package/cjs/browser/utilities/BrowserFrameNavigator.cjs +20 -13
  11. package/cjs/browser/utilities/BrowserFrameNavigator.cjs.map +1 -1
  12. package/cjs/browser/utilities/BrowserFrameNavigator.d.ts +21 -10
  13. package/cjs/browser/utilities/BrowserFrameNavigator.d.ts.map +1 -1
  14. package/cjs/browser/utilities/BrowserFrameURL.cjs +2 -2
  15. package/cjs/browser/utilities/BrowserFrameURL.cjs.map +1 -1
  16. package/cjs/browser/utilities/BrowserFrameURL.d.ts.map +1 -1
  17. package/cjs/config/IHTMLElementTagNameMap.cjs +3 -0
  18. package/cjs/config/IHTMLElementTagNameMap.cjs.map +1 -0
  19. package/cjs/config/IHTMLElementTagNameMap.d.ts +146 -0
  20. package/cjs/config/IHTMLElementTagNameMap.d.ts.map +1 -0
  21. package/cjs/config/ISVGElementTagNameMap.cjs +3 -0
  22. package/cjs/config/ISVGElementTagNameMap.cjs.map +1 -0
  23. package/cjs/config/ISVGElementTagNameMap.d.ts +67 -0
  24. package/cjs/config/ISVGElementTagNameMap.d.ts.map +1 -0
  25. package/cjs/event/EventTarget.cjs +1 -1
  26. package/cjs/event/EventTarget.cjs.map +1 -1
  27. package/cjs/event/events/HashChangeEvent.cjs +26 -0
  28. package/cjs/event/events/HashChangeEvent.cjs.map +1 -0
  29. package/cjs/event/events/HashChangeEvent.d.ts +19 -0
  30. package/cjs/event/events/HashChangeEvent.d.ts.map +1 -0
  31. package/cjs/event/events/IHashChangeEventInit.cjs +3 -0
  32. package/cjs/event/events/IHashChangeEventInit.cjs.map +1 -0
  33. package/cjs/event/events/IHashChangeEventInit.d.ts +6 -0
  34. package/cjs/event/events/IHashChangeEventInit.d.ts.map +1 -0
  35. package/cjs/fetch/Fetch.cjs +3 -3
  36. package/cjs/fetch/Fetch.cjs.map +1 -1
  37. package/cjs/fetch/Request.cjs +2 -2
  38. package/cjs/fetch/Request.cjs.map +1 -1
  39. package/cjs/fetch/SyncFetch.cjs +3 -3
  40. package/cjs/fetch/SyncFetch.cjs.map +1 -1
  41. package/cjs/fetch/utilities/FetchRequestHeaderUtility.cjs +5 -3
  42. package/cjs/fetch/utilities/FetchRequestHeaderUtility.cjs.map +1 -1
  43. package/cjs/fetch/utilities/FetchRequestHeaderUtility.d.ts.map +1 -1
  44. package/cjs/fetch/utilities/FetchRequestReferrerUtility.cjs +1 -1
  45. package/cjs/fetch/utilities/FetchRequestReferrerUtility.cjs.map +1 -1
  46. package/cjs/fetch/utilities/FetchRequestReferrerUtility.d.ts.map +1 -1
  47. package/cjs/form-data/FormData.cjs +1 -1
  48. package/cjs/form-data/FormData.cjs.map +1 -1
  49. package/cjs/form-data/FormData.d.ts +1 -1
  50. package/cjs/form-data/FormData.d.ts.map +1 -1
  51. package/cjs/index.cjs +7 -3
  52. package/cjs/index.cjs.map +1 -1
  53. package/cjs/index.d.ts +7 -3
  54. package/cjs/index.d.ts.map +1 -1
  55. package/cjs/location/Location.cjs +270 -0
  56. package/cjs/location/Location.cjs.map +1 -0
  57. package/cjs/location/Location.d.ts +144 -0
  58. package/cjs/location/Location.d.ts.map +1 -0
  59. package/cjs/named-node-map/NamedNodeMap.cjs +2 -1
  60. package/cjs/named-node-map/NamedNodeMap.cjs.map +1 -1
  61. package/cjs/named-node-map/NamedNodeMap.d.ts.map +1 -1
  62. package/cjs/nodes/document/Document.cjs +4 -4
  63. package/cjs/nodes/document/Document.cjs.map +1 -1
  64. package/cjs/nodes/document/Document.d.ts +114 -6
  65. package/cjs/nodes/document/Document.d.ts.map +1 -1
  66. package/cjs/nodes/document/IDocument.d.ts +28 -12
  67. package/cjs/nodes/document/IDocument.d.ts.map +1 -1
  68. package/cjs/nodes/document-fragment/DocumentFragment.cjs +2 -2
  69. package/cjs/nodes/document-fragment/DocumentFragment.cjs.map +1 -1
  70. package/cjs/nodes/document-fragment/DocumentFragment.d.ts +31 -1
  71. package/cjs/nodes/document-fragment/DocumentFragment.d.ts.map +1 -1
  72. package/cjs/nodes/document-fragment/IDocumentFragment.d.ts +6 -0
  73. package/cjs/nodes/document-fragment/IDocumentFragment.d.ts.map +1 -1
  74. package/cjs/nodes/element/Element.cjs +1 -1
  75. package/cjs/nodes/element/Element.cjs.map +1 -1
  76. package/cjs/nodes/element/Element.d.ts +61 -1
  77. package/cjs/nodes/element/Element.d.ts.map +1 -1
  78. package/cjs/nodes/element/HTMLCollection.cjs +2 -1
  79. package/cjs/nodes/element/HTMLCollection.cjs.map +1 -1
  80. package/cjs/nodes/element/HTMLCollection.d.ts.map +1 -1
  81. package/cjs/nodes/html-anchor-element/HTMLAnchorElement.cjs +2 -0
  82. package/cjs/nodes/html-anchor-element/HTMLAnchorElement.cjs.map +1 -1
  83. package/cjs/nodes/html-anchor-element/HTMLAnchorElement.d.ts.map +1 -1
  84. package/cjs/nodes/html-button-element/HTMLButtonElement.cjs +93 -4
  85. package/cjs/nodes/html-button-element/HTMLButtonElement.cjs.map +1 -1
  86. package/cjs/nodes/html-button-element/HTMLButtonElement.d.ts +49 -1
  87. package/cjs/nodes/html-button-element/HTMLButtonElement.d.ts.map +1 -1
  88. package/cjs/nodes/html-button-element/IHTMLButtonElement.d.ts +5 -1
  89. package/cjs/nodes/html-button-element/IHTMLButtonElement.d.ts.map +1 -1
  90. package/cjs/nodes/html-form-element/HTMLFormControlsCollection.cjs +2 -1
  91. package/cjs/nodes/html-form-element/HTMLFormControlsCollection.cjs.map +1 -1
  92. package/cjs/nodes/html-form-element/HTMLFormControlsCollection.d.ts.map +1 -1
  93. package/cjs/nodes/html-form-element/HTMLFormElement.cjs +104 -9
  94. package/cjs/nodes/html-form-element/HTMLFormElement.cjs.map +1 -1
  95. package/cjs/nodes/html-form-element/HTMLFormElement.d.ts +8 -2
  96. package/cjs/nodes/html-form-element/HTMLFormElement.d.ts.map +1 -1
  97. package/cjs/nodes/html-iframe-element/HTMLIFrameElement.cjs +14 -0
  98. package/cjs/nodes/html-iframe-element/HTMLIFrameElement.cjs.map +1 -1
  99. package/cjs/nodes/html-iframe-element/HTMLIFrameElement.d.ts +10 -0
  100. package/cjs/nodes/html-iframe-element/HTMLIFrameElement.d.ts.map +1 -1
  101. package/cjs/nodes/html-iframe-element/HTMLIFrameElementPageLoader.cjs +4 -1
  102. package/cjs/nodes/html-iframe-element/HTMLIFrameElementPageLoader.cjs.map +1 -1
  103. package/cjs/nodes/html-iframe-element/HTMLIFrameElementPageLoader.d.ts.map +1 -1
  104. package/cjs/nodes/html-iframe-element/IHTMLIFrameElement.d.ts +1 -0
  105. package/cjs/nodes/html-iframe-element/IHTMLIFrameElement.d.ts.map +1 -1
  106. package/cjs/nodes/html-input-element/HTMLInputElement.cjs +100 -52
  107. package/cjs/nodes/html-input-element/HTMLInputElement.cjs.map +1 -1
  108. package/cjs/nodes/html-input-element/HTMLInputElement.d.ts +49 -23
  109. package/cjs/nodes/html-input-element/HTMLInputElement.d.ts.map +1 -1
  110. package/cjs/nodes/html-input-element/IHTMLInputElement.d.ts +2 -0
  111. package/cjs/nodes/html-input-element/IHTMLInputElement.d.ts.map +1 -1
  112. package/cjs/nodes/html-label-element/HTMLLabelElement.cjs +1 -0
  113. package/cjs/nodes/html-label-element/HTMLLabelElement.cjs.map +1 -1
  114. package/cjs/nodes/html-label-element/HTMLLabelElement.d.ts.map +1 -1
  115. package/cjs/nodes/html-link-element/HTMLLinkElementStyleSheetLoader.cjs +1 -1
  116. package/cjs/nodes/html-link-element/HTMLLinkElementStyleSheetLoader.cjs.map +1 -1
  117. package/cjs/nodes/html-script-element/HTMLScriptElementScriptLoader.cjs +1 -1
  118. package/cjs/nodes/html-script-element/HTMLScriptElementScriptLoader.cjs.map +1 -1
  119. package/cjs/nodes/html-select-element/HTMLSelectElement.cjs.map +1 -1
  120. package/cjs/nodes/html-select-element/HTMLSelectElement.d.ts.map +1 -1
  121. package/cjs/nodes/node/Node.cjs.map +1 -1
  122. package/cjs/nodes/node/Node.d.ts.map +1 -1
  123. package/cjs/nodes/parent-node/IParentNode.d.ts +17 -0
  124. package/cjs/nodes/parent-node/IParentNode.d.ts.map +1 -1
  125. package/cjs/nodes/parent-node/ParentNodeUtility.cjs.map +1 -1
  126. package/cjs/nodes/parent-node/ParentNodeUtility.d.ts.map +1 -1
  127. package/cjs/query-selector/QuerySelector.cjs.map +1 -1
  128. package/cjs/query-selector/QuerySelector.d.ts +34 -0
  129. package/cjs/query-selector/QuerySelector.d.ts.map +1 -1
  130. package/cjs/query-selector/SelectorItem.cjs +6 -0
  131. package/cjs/query-selector/SelectorItem.cjs.map +1 -1
  132. package/cjs/query-selector/SelectorItem.d.ts.map +1 -1
  133. package/cjs/version.cjs +1 -1
  134. package/cjs/window/BrowserWindow.cjs +9 -3
  135. package/cjs/window/BrowserWindow.cjs.map +1 -1
  136. package/cjs/window/BrowserWindow.d.ts +5 -4
  137. package/cjs/window/BrowserWindow.d.ts.map +1 -1
  138. package/cjs/window/CrossOriginBrowserWindow.d.ts +1 -1
  139. package/cjs/window/CrossOriginBrowserWindow.d.ts.map +1 -1
  140. package/cjs/window/IBrowserWindow.d.ts +3 -2
  141. package/cjs/window/IBrowserWindow.d.ts.map +1 -1
  142. package/cjs/window/ICrossOriginBrowserWindow.d.ts +1 -1
  143. package/cjs/window/ICrossOriginBrowserWindow.d.ts.map +1 -1
  144. package/cjs/window/WindowPageOpenUtility.cjs +4 -2
  145. package/cjs/window/WindowPageOpenUtility.cjs.map +1 -1
  146. package/cjs/window/WindowPageOpenUtility.d.ts.map +1 -1
  147. package/lib/browser/BrowserFrame.d.ts.map +1 -1
  148. package/lib/browser/BrowserFrame.js +12 -2
  149. package/lib/browser/BrowserFrame.js.map +1 -1
  150. package/lib/browser/detached-browser/DetachedBrowserFrame.d.ts.map +1 -1
  151. package/lib/browser/detached-browser/DetachedBrowserFrame.js +12 -2
  152. package/lib/browser/detached-browser/DetachedBrowserFrame.js.map +1 -1
  153. package/lib/browser/utilities/BrowserFrameFactory.d.ts.map +1 -1
  154. package/lib/browser/utilities/BrowserFrameFactory.js +5 -0
  155. package/lib/browser/utilities/BrowserFrameFactory.js.map +1 -1
  156. package/lib/browser/utilities/BrowserFrameNavigator.d.ts +21 -10
  157. package/lib/browser/utilities/BrowserFrameNavigator.d.ts.map +1 -1
  158. package/lib/browser/utilities/BrowserFrameNavigator.js +20 -13
  159. package/lib/browser/utilities/BrowserFrameNavigator.js.map +1 -1
  160. package/lib/browser/utilities/BrowserFrameURL.d.ts.map +1 -1
  161. package/lib/browser/utilities/BrowserFrameURL.js +2 -2
  162. package/lib/browser/utilities/BrowserFrameURL.js.map +1 -1
  163. package/lib/config/IHTMLElementTagNameMap.d.ts +146 -0
  164. package/lib/config/IHTMLElementTagNameMap.d.ts.map +1 -0
  165. package/lib/config/IHTMLElementTagNameMap.js +2 -0
  166. package/lib/config/IHTMLElementTagNameMap.js.map +1 -0
  167. package/lib/config/ISVGElementTagNameMap.d.ts +67 -0
  168. package/lib/config/ISVGElementTagNameMap.d.ts.map +1 -0
  169. package/lib/config/ISVGElementTagNameMap.js +2 -0
  170. package/lib/config/ISVGElementTagNameMap.js.map +1 -0
  171. package/lib/event/EventTarget.js +1 -1
  172. package/lib/event/EventTarget.js.map +1 -1
  173. package/lib/event/events/HashChangeEvent.d.ts +19 -0
  174. package/lib/event/events/HashChangeEvent.d.ts.map +1 -0
  175. package/lib/event/events/HashChangeEvent.js +20 -0
  176. package/lib/event/events/HashChangeEvent.js.map +1 -0
  177. package/lib/event/events/IHashChangeEventInit.d.ts +6 -0
  178. package/lib/event/events/IHashChangeEventInit.d.ts.map +1 -0
  179. package/lib/event/events/IHashChangeEventInit.js +2 -0
  180. package/lib/event/events/IHashChangeEventInit.js.map +1 -0
  181. package/lib/fetch/Fetch.js +3 -3
  182. package/lib/fetch/Fetch.js.map +1 -1
  183. package/lib/fetch/Request.js +2 -2
  184. package/lib/fetch/Request.js.map +1 -1
  185. package/lib/fetch/SyncFetch.js +3 -3
  186. package/lib/fetch/SyncFetch.js.map +1 -1
  187. package/lib/fetch/utilities/FetchRequestHeaderUtility.d.ts.map +1 -1
  188. package/lib/fetch/utilities/FetchRequestHeaderUtility.js +4 -2
  189. package/lib/fetch/utilities/FetchRequestHeaderUtility.js.map +1 -1
  190. package/lib/fetch/utilities/FetchRequestReferrerUtility.d.ts.map +1 -1
  191. package/lib/fetch/utilities/FetchRequestReferrerUtility.js +1 -1
  192. package/lib/fetch/utilities/FetchRequestReferrerUtility.js.map +1 -1
  193. package/lib/form-data/FormData.d.ts +1 -1
  194. package/lib/form-data/FormData.d.ts.map +1 -1
  195. package/lib/form-data/FormData.js +1 -1
  196. package/lib/form-data/FormData.js.map +1 -1
  197. package/lib/index.d.ts +7 -3
  198. package/lib/index.d.ts.map +1 -1
  199. package/lib/index.js +4 -2
  200. package/lib/index.js.map +1 -1
  201. package/lib/location/Location.d.ts +144 -0
  202. package/lib/location/Location.d.ts.map +1 -0
  203. package/lib/location/Location.js +241 -0
  204. package/lib/location/Location.js.map +1 -0
  205. package/lib/named-node-map/NamedNodeMap.d.ts.map +1 -1
  206. package/lib/named-node-map/NamedNodeMap.js +2 -1
  207. package/lib/named-node-map/NamedNodeMap.js.map +1 -1
  208. package/lib/nodes/document/Document.d.ts +114 -6
  209. package/lib/nodes/document/Document.d.ts.map +1 -1
  210. package/lib/nodes/document/Document.js +4 -4
  211. package/lib/nodes/document/Document.js.map +1 -1
  212. package/lib/nodes/document/IDocument.d.ts +28 -12
  213. package/lib/nodes/document/IDocument.d.ts.map +1 -1
  214. package/lib/nodes/document-fragment/DocumentFragment.d.ts +31 -1
  215. package/lib/nodes/document-fragment/DocumentFragment.d.ts.map +1 -1
  216. package/lib/nodes/document-fragment/DocumentFragment.js +2 -2
  217. package/lib/nodes/document-fragment/DocumentFragment.js.map +1 -1
  218. package/lib/nodes/document-fragment/IDocumentFragment.d.ts +6 -0
  219. package/lib/nodes/document-fragment/IDocumentFragment.d.ts.map +1 -1
  220. package/lib/nodes/element/Element.d.ts +61 -1
  221. package/lib/nodes/element/Element.d.ts.map +1 -1
  222. package/lib/nodes/element/Element.js +1 -1
  223. package/lib/nodes/element/Element.js.map +1 -1
  224. package/lib/nodes/element/HTMLCollection.d.ts.map +1 -1
  225. package/lib/nodes/element/HTMLCollection.js +2 -1
  226. package/lib/nodes/element/HTMLCollection.js.map +1 -1
  227. package/lib/nodes/html-anchor-element/HTMLAnchorElement.d.ts.map +1 -1
  228. package/lib/nodes/html-anchor-element/HTMLAnchorElement.js +2 -0
  229. package/lib/nodes/html-anchor-element/HTMLAnchorElement.js.map +1 -1
  230. package/lib/nodes/html-button-element/HTMLButtonElement.d.ts +49 -1
  231. package/lib/nodes/html-button-element/HTMLButtonElement.d.ts.map +1 -1
  232. package/lib/nodes/html-button-element/HTMLButtonElement.js +93 -4
  233. package/lib/nodes/html-button-element/HTMLButtonElement.js.map +1 -1
  234. package/lib/nodes/html-button-element/IHTMLButtonElement.d.ts +5 -1
  235. package/lib/nodes/html-button-element/IHTMLButtonElement.d.ts.map +1 -1
  236. package/lib/nodes/html-form-element/HTMLFormControlsCollection.d.ts.map +1 -1
  237. package/lib/nodes/html-form-element/HTMLFormControlsCollection.js +2 -1
  238. package/lib/nodes/html-form-element/HTMLFormControlsCollection.js.map +1 -1
  239. package/lib/nodes/html-form-element/HTMLFormElement.d.ts +8 -2
  240. package/lib/nodes/html-form-element/HTMLFormElement.d.ts.map +1 -1
  241. package/lib/nodes/html-form-element/HTMLFormElement.js +106 -10
  242. package/lib/nodes/html-form-element/HTMLFormElement.js.map +1 -1
  243. package/lib/nodes/html-iframe-element/HTMLIFrameElement.d.ts +10 -0
  244. package/lib/nodes/html-iframe-element/HTMLIFrameElement.d.ts.map +1 -1
  245. package/lib/nodes/html-iframe-element/HTMLIFrameElement.js +14 -0
  246. package/lib/nodes/html-iframe-element/HTMLIFrameElement.js.map +1 -1
  247. package/lib/nodes/html-iframe-element/HTMLIFrameElementPageLoader.d.ts.map +1 -1
  248. package/lib/nodes/html-iframe-element/HTMLIFrameElementPageLoader.js +4 -1
  249. package/lib/nodes/html-iframe-element/HTMLIFrameElementPageLoader.js.map +1 -1
  250. package/lib/nodes/html-iframe-element/IHTMLIFrameElement.d.ts +1 -0
  251. package/lib/nodes/html-iframe-element/IHTMLIFrameElement.d.ts.map +1 -1
  252. package/lib/nodes/html-input-element/HTMLInputElement.d.ts +49 -23
  253. package/lib/nodes/html-input-element/HTMLInputElement.d.ts.map +1 -1
  254. package/lib/nodes/html-input-element/HTMLInputElement.js +100 -52
  255. package/lib/nodes/html-input-element/HTMLInputElement.js.map +1 -1
  256. package/lib/nodes/html-input-element/IHTMLInputElement.d.ts +2 -0
  257. package/lib/nodes/html-input-element/IHTMLInputElement.d.ts.map +1 -1
  258. package/lib/nodes/html-label-element/HTMLLabelElement.d.ts.map +1 -1
  259. package/lib/nodes/html-label-element/HTMLLabelElement.js +1 -0
  260. package/lib/nodes/html-label-element/HTMLLabelElement.js.map +1 -1
  261. package/lib/nodes/html-link-element/HTMLLinkElementStyleSheetLoader.js +1 -1
  262. package/lib/nodes/html-link-element/HTMLLinkElementStyleSheetLoader.js.map +1 -1
  263. package/lib/nodes/html-script-element/HTMLScriptElementScriptLoader.js +1 -1
  264. package/lib/nodes/html-script-element/HTMLScriptElementScriptLoader.js.map +1 -1
  265. package/lib/nodes/html-select-element/HTMLSelectElement.d.ts.map +1 -1
  266. package/lib/nodes/html-select-element/HTMLSelectElement.js.map +1 -1
  267. package/lib/nodes/node/Node.d.ts.map +1 -1
  268. package/lib/nodes/node/Node.js.map +1 -1
  269. package/lib/nodes/parent-node/IParentNode.d.ts +17 -0
  270. package/lib/nodes/parent-node/IParentNode.d.ts.map +1 -1
  271. package/lib/nodes/parent-node/ParentNodeUtility.d.ts.map +1 -1
  272. package/lib/nodes/parent-node/ParentNodeUtility.js.map +1 -1
  273. package/lib/query-selector/QuerySelector.d.ts +34 -0
  274. package/lib/query-selector/QuerySelector.d.ts.map +1 -1
  275. package/lib/query-selector/QuerySelector.js.map +1 -1
  276. package/lib/query-selector/SelectorItem.d.ts.map +1 -1
  277. package/lib/query-selector/SelectorItem.js +6 -0
  278. package/lib/query-selector/SelectorItem.js.map +1 -1
  279. package/lib/version.js +1 -1
  280. package/lib/window/BrowserWindow.d.ts +5 -4
  281. package/lib/window/BrowserWindow.d.ts.map +1 -1
  282. package/lib/window/BrowserWindow.js +10 -4
  283. package/lib/window/BrowserWindow.js.map +1 -1
  284. package/lib/window/CrossOriginBrowserWindow.d.ts +1 -1
  285. package/lib/window/CrossOriginBrowserWindow.d.ts.map +1 -1
  286. package/lib/window/IBrowserWindow.d.ts +3 -2
  287. package/lib/window/IBrowserWindow.d.ts.map +1 -1
  288. package/lib/window/ICrossOriginBrowserWindow.d.ts +1 -1
  289. package/lib/window/ICrossOriginBrowserWindow.d.ts.map +1 -1
  290. package/lib/window/WindowPageOpenUtility.d.ts.map +1 -1
  291. package/lib/window/WindowPageOpenUtility.js +4 -2
  292. package/lib/window/WindowPageOpenUtility.js.map +1 -1
  293. package/package.json +1 -1
  294. package/src/browser/BrowserFrame.ts +12 -2
  295. package/src/browser/detached-browser/DetachedBrowserFrame.ts +12 -7
  296. package/src/browser/utilities/BrowserFrameFactory.ts +7 -0
  297. package/src/browser/utilities/BrowserFrameNavigator.ts +28 -18
  298. package/src/browser/utilities/BrowserFrameURL.ts +2 -2
  299. package/src/config/IHTMLElementTagNameMap.ts +148 -0
  300. package/src/config/ISVGElementTagNameMap.ts +67 -0
  301. package/src/event/EventTarget.ts +1 -1
  302. package/src/event/events/HashChangeEvent.ts +25 -0
  303. package/src/event/events/IHashChangeEventInit.ts +6 -0
  304. package/src/fetch/Fetch.ts +3 -3
  305. package/src/fetch/Request.ts +2 -2
  306. package/src/fetch/SyncFetch.ts +3 -3
  307. package/src/fetch/utilities/FetchRequestHeaderUtility.ts +4 -5
  308. package/src/fetch/utilities/FetchRequestReferrerUtility.ts +2 -1
  309. package/src/form-data/FormData.ts +2 -2
  310. package/src/index.ts +9 -1
  311. package/src/location/Location.ts +257 -0
  312. package/src/named-node-map/NamedNodeMap.ts +1 -0
  313. package/src/nodes/document/Document.ts +224 -17
  314. package/src/nodes/document/IDocument.ts +33 -11
  315. package/src/nodes/document-fragment/DocumentFragment.ts +59 -1
  316. package/src/nodes/document-fragment/IDocumentFragment.ts +14 -0
  317. package/src/nodes/element/Element.ts +120 -1
  318. package/src/nodes/element/HTMLCollection.ts +1 -0
  319. package/src/nodes/html-anchor-element/HTMLAnchorElement.ts +2 -0
  320. package/src/nodes/html-button-element/HTMLButtonElement.ts +107 -5
  321. package/src/nodes/html-button-element/IHTMLButtonElement.ts +5 -1
  322. package/src/nodes/html-form-element/HTMLFormControlsCollection.ts +1 -0
  323. package/src/nodes/html-form-element/HTMLFormElement.ts +111 -5
  324. package/src/nodes/html-iframe-element/HTMLIFrameElement.ts +16 -0
  325. package/src/nodes/html-iframe-element/HTMLIFrameElementPageLoader.ts +5 -1
  326. package/src/nodes/html-iframe-element/IHTMLIFrameElement.ts +1 -0
  327. package/src/nodes/html-input-element/HTMLInputElement.ts +111 -57
  328. package/src/nodes/html-input-element/IHTMLInputElement.ts +2 -0
  329. package/src/nodes/html-label-element/HTMLLabelElement.ts +1 -0
  330. package/src/nodes/html-link-element/HTMLLinkElementStyleSheetLoader.ts +1 -1
  331. package/src/nodes/html-script-element/HTMLScriptElementScriptLoader.ts +1 -1
  332. package/src/nodes/html-select-element/HTMLSelectElement.ts +1 -2
  333. package/src/nodes/node/Node.ts +1 -2
  334. package/src/nodes/parent-node/IParentNode.ts +36 -0
  335. package/src/nodes/parent-node/ParentNodeUtility.ts +1 -0
  336. package/src/query-selector/QuerySelector.ts +76 -2
  337. package/src/query-selector/SelectorItem.ts +6 -0
  338. package/src/window/BrowserWindow.ts +11 -4
  339. package/src/window/CrossOriginBrowserWindow.ts +1 -1
  340. package/src/window/IBrowserWindow.ts +3 -2
  341. package/src/window/ICrossOriginBrowserWindow.ts +1 -1
  342. package/src/window/WindowPageOpenUtility.ts +4 -2
  343. package/cjs/url/Location.cjs +0 -111
  344. package/cjs/url/Location.cjs.map +0 -1
  345. package/cjs/url/Location.d.ts +0 -48
  346. package/cjs/url/Location.d.ts.map +0 -1
  347. package/lib/url/Location.d.ts +0 -48
  348. package/lib/url/Location.d.ts.map +0 -1
  349. package/lib/url/Location.js +0 -82
  350. package/lib/url/Location.js.map +0 -1
  351. package/src/url/Location.ts +0 -79
@@ -31,7 +31,7 @@ import IHTMLCollection from '../element/IHTMLCollection.js';
31
31
  import IHTMLLinkElement from '../html-link-element/IHTMLLinkElement.js';
32
32
  import IHTMLStyleElement from '../html-style-element/IHTMLStyleElement.js';
33
33
  import DocumentReadyStateEnum from './DocumentReadyStateEnum.js';
34
- import Location from '../../url/Location.js';
34
+ import Location from '../../location/Location.js';
35
35
  import Selection from '../../selection/Selection.js';
36
36
  import IShadowRoot from '../shadow-root/IShadowRoot.js';
37
37
  import Range from '../../range/Range.js';
@@ -45,6 +45,12 @@ import NodeTypeEnum from '../node/NodeTypeEnum.js';
45
45
  import CookieStringUtility from '../../cookie/urilities/CookieStringUtility.js';
46
46
  import IBrowserFrame from '../../browser/types/IBrowserFrame.js';
47
47
  import NodeFactory from '../NodeFactory.js';
48
+ import { URL } from 'url';
49
+ import IHTMLElementTagNameMap from '../../config/IHTMLElementTagNameMap.js';
50
+ import ISVGElementTagNameMap from '../../config/ISVGElementTagNameMap.js';
51
+ import ISVGElement from '../svg-element/ISVGElement.js';
52
+ import IHTMLFormElement from '../html-form-element/IHTMLFormElement.js';
53
+ import IHTMLAnchorElement from '../html-anchor-element/IHTMLAnchorElement.js';
48
54
 
49
55
  const PROCESSING_INSTRUCTION_TARGET_REGEXP = /^[a-z][a-z0-9-]+$/;
50
56
 
@@ -311,15 +317,15 @@ export default class Document extends Node implements IDocument {
311
317
  /**
312
318
  * Returns a collection of all area elements and a elements in a document with a value for the href attribute.
313
319
  */
314
- public get links(): IHTMLCollection<IHTMLElement> {
315
- return <IHTMLCollection<IHTMLElement>>this.querySelectorAll('a[href],area[href]');
320
+ public get links(): INodeList<IHTMLAnchorElement | IHTMLElement> {
321
+ return <INodeList<IHTMLElement>>this.querySelectorAll('a[href],area[href]');
316
322
  }
317
323
 
318
324
  /**
319
325
  * Returns a collection of all form elements in a document.
320
326
  */
321
- public get forms(): IHTMLCollection<IHTMLElement> {
322
- return <IHTMLCollection<IHTMLElement>>this.querySelectorAll('form');
327
+ public get forms(): INodeList<IHTMLFormElement> {
328
+ return this.querySelectorAll('form');
323
329
  }
324
330
 
325
331
  /**
@@ -357,7 +363,7 @@ export default class Document extends Node implements IDocument {
357
363
  public get cookie(): string {
358
364
  return CookieStringUtility.cookiesToString(
359
365
  this.#browserFrame.page.context.cookieContainer.getCookies(
360
- this[PropertySymbol.ownerWindow].location,
366
+ new URL(this[PropertySymbol.ownerWindow].location.href),
361
367
  true
362
368
  )
363
369
  );
@@ -370,7 +376,10 @@ export default class Document extends Node implements IDocument {
370
376
  */
371
377
  public set cookie(cookie: string) {
372
378
  this.#browserFrame.page.context.cookieContainer.addCookies([
373
- CookieStringUtility.stringToCookie(this[PropertySymbol.ownerWindow].location, cookie)
379
+ CookieStringUtility.stringToCookie(
380
+ new URL(this[PropertySymbol.ownerWindow].location.href),
381
+ cookie
382
+ )
374
383
  ]);
375
384
  }
376
385
 
@@ -497,7 +506,7 @@ export default class Document extends Node implements IDocument {
497
506
  * @returns Scripts.
498
507
  */
499
508
  public get scripts(): IHTMLCollection<IHTMLScriptElement> {
500
- return <IHTMLCollection<IHTMLScriptElement>>this.getElementsByTagName('script');
509
+ return this.getElementsByTagName('script');
501
510
  }
502
511
 
503
512
  /**
@@ -594,6 +603,34 @@ export default class Document extends Node implements IDocument {
594
603
  ParentNodeUtility.replaceChildren(this, ...nodes);
595
604
  }
596
605
 
606
+ /**
607
+ * Query CSS selector to find matching nodes.
608
+ *
609
+ * @param selector CSS selector.
610
+ * @returns Matching elements.
611
+ */
612
+ public querySelectorAll<K extends keyof IHTMLElementTagNameMap>(
613
+ selector: K
614
+ ): INodeList<IHTMLElementTagNameMap[K]>;
615
+
616
+ /**
617
+ * Query CSS selector to find matching elments.
618
+ *
619
+ * @param selector CSS selector.
620
+ * @returns Matching elements.
621
+ */
622
+ public querySelectorAll<K extends keyof ISVGElementTagNameMap>(
623
+ selector: K
624
+ ): INodeList<ISVGElementTagNameMap[K]>;
625
+
626
+ /**
627
+ * Query CSS selector to find matching elments.
628
+ *
629
+ * @param selector CSS selector.
630
+ * @returns Matching elements.
631
+ */
632
+ public querySelectorAll(selector: string): INodeList<IElement>;
633
+
597
634
  /**
598
635
  * Query CSS selector to find matching elments.
599
636
  *
@@ -605,12 +642,40 @@ export default class Document extends Node implements IDocument {
605
642
  }
606
643
 
607
644
  /**
608
- * Query CSS Selector to find a matching element.
645
+ * Query CSS Selector to find matching node.
646
+ *
647
+ * @param selector CSS selector.
648
+ * @returns Matching element.
649
+ */
650
+ public querySelector<K extends keyof IHTMLElementTagNameMap>(
651
+ selector: K
652
+ ): IHTMLElementTagNameMap[K] | null;
653
+
654
+ /**
655
+ * Query CSS Selector to find matching node.
609
656
  *
610
657
  * @param selector CSS selector.
611
658
  * @returns Matching element.
612
659
  */
613
- public querySelector(selector: string): IElement {
660
+ public querySelector<K extends keyof ISVGElementTagNameMap>(
661
+ selector: K
662
+ ): ISVGElementTagNameMap[K] | null;
663
+
664
+ /**
665
+ * Query CSS Selector to find matching node.
666
+ *
667
+ * @param selector CSS selector.
668
+ * @returns Matching element.
669
+ */
670
+ public querySelector(selector: string): IElement | null;
671
+
672
+ /**
673
+ * Query CSS Selector to find matching node.
674
+ *
675
+ * @param selector CSS selector.
676
+ * @returns Matching element.
677
+ */
678
+ public querySelector(selector: string): IElement | null {
614
679
  return QuerySelector.querySelector(this, selector);
615
680
  }
616
681
 
@@ -624,6 +689,34 @@ export default class Document extends Node implements IDocument {
624
689
  return ParentNodeUtility.getElementsByClassName(this, className);
625
690
  }
626
691
 
692
+ /**
693
+ * Returns an elements by tag name.
694
+ *
695
+ * @param tagName Tag name.
696
+ * @returns Matching element.
697
+ */
698
+ public getElementsByTagName<K extends keyof IHTMLElementTagNameMap>(
699
+ tagName: K
700
+ ): IHTMLCollection<IHTMLElementTagNameMap[K]>;
701
+
702
+ /**
703
+ * Returns an elements by tag name.
704
+ *
705
+ * @param tagName Tag name.
706
+ * @returns Matching element.
707
+ */
708
+ public getElementsByTagName<K extends keyof ISVGElementTagNameMap>(
709
+ tagName: K
710
+ ): IHTMLCollection<ISVGElementTagNameMap[K]>;
711
+
712
+ /**
713
+ * Returns an elements by tag name.
714
+ *
715
+ * @param tagName Tag name.
716
+ * @returns Matching element.
717
+ */
718
+ public getElementsByTagName(tagName: string): IHTMLCollection<IElement>;
719
+
627
720
  /**
628
721
  * Returns an elements by tag name.
629
722
  *
@@ -634,6 +727,39 @@ export default class Document extends Node implements IDocument {
634
727
  return ParentNodeUtility.getElementsByTagName(this, tagName);
635
728
  }
636
729
 
730
+ /**
731
+ * Returns an elements by tag name and namespace.
732
+ *
733
+ * @param namespaceURI Namespace URI.
734
+ * @param tagName Tag name.
735
+ * @returns Matching element.
736
+ */
737
+ public getElementsByTagNameNS<K extends keyof IHTMLElementTagNameMap>(
738
+ namespaceURI: 'http://www.w3.org/1999/xhtml',
739
+ tagName: K
740
+ ): IHTMLCollection<IHTMLElementTagNameMap[K]>;
741
+
742
+ /**
743
+ * Returns an elements by tag name and namespace.
744
+ *
745
+ * @param namespaceURI Namespace URI.
746
+ * @param tagName Tag name.
747
+ * @returns Matching element.
748
+ */
749
+ public getElementsByTagNameNS<K extends keyof ISVGElementTagNameMap>(
750
+ namespaceURI: 'http://www.w3.org/2000/svg',
751
+ tagName: K
752
+ ): IHTMLCollection<ISVGElementTagNameMap[K]>;
753
+
754
+ /**
755
+ * Returns an elements by tag name and namespace.
756
+ *
757
+ * @param namespaceURI Namespace URI.
758
+ * @param tagName Tag name.
759
+ * @returns Matching element.
760
+ */
761
+ public getElementsByTagNameNS(namespaceURI: string, tagName: string): IHTMLCollection<IElement>;
762
+
637
763
  /**
638
764
  * Returns an elements by tag name and namespace.
639
765
  *
@@ -867,10 +993,91 @@ export default class Document extends Node implements IDocument {
867
993
  * @param [options.is] Tag name of a custom element previously defined via customElements.define().
868
994
  * @returns Element.
869
995
  */
870
- public createElement(qualifiedName: string, options?: { is?: string }): IElement {
871
- return this.createElementNS(NamespaceURI.html, qualifiedName, options);
996
+ public createElement<K extends keyof IHTMLElementTagNameMap>(
997
+ qualifiedName: K,
998
+ options?: { is?: string }
999
+ ): IHTMLElementTagNameMap[K];
1000
+
1001
+ /**
1002
+ * Creates an element.
1003
+ *
1004
+ * @param qualifiedName Tag name.
1005
+ * @param [options] Options.
1006
+ * @param [options.is] Tag name of a custom element previously defined via customElements.define().
1007
+ * @returns Element.
1008
+ */
1009
+ public createElement<K extends keyof ISVGElementTagNameMap>(
1010
+ qualifiedName: K,
1011
+ options?: { is?: string }
1012
+ ): ISVGElementTagNameMap[K];
1013
+
1014
+ /**
1015
+ * Creates an element.
1016
+ *
1017
+ * @param qualifiedName Tag name.
1018
+ * @param [options] Options.
1019
+ * @param [options.is] Tag name of a custom element previously defined via customElements.define().
1020
+ * @returns Element.
1021
+ */
1022
+ public createElement(qualifiedName: string, options?: { is?: string }): IHTMLElement;
1023
+
1024
+ /**
1025
+ * Creates an element.
1026
+ *
1027
+ * @param qualifiedName Tag name.
1028
+ * @param [options] Options.
1029
+ * @param [options.is] Tag name of a custom element previously defined via customElements.define().
1030
+ * @returns Element.
1031
+ */
1032
+ public createElement(qualifiedName: string, options?: { is?: string }): IHTMLElement {
1033
+ return <IHTMLElement>this.createElementNS(NamespaceURI.html, qualifiedName, options);
872
1034
  }
873
1035
 
1036
+ /**
1037
+ * Creates an element with the specified namespace URI and qualified name.
1038
+ *
1039
+ * @param namespaceURI Namespace URI.
1040
+ * @param qualifiedName Tag name.
1041
+ * @param [options] Options.
1042
+ * @param [options.is] Tag name of a custom element previously defined via customElements.define().
1043
+ * @returns Element.
1044
+ */
1045
+ public createElementNS<K extends keyof IHTMLElementTagNameMap>(
1046
+ namespaceURI: 'http://www.w3.org/1999/xhtml',
1047
+ qualifiedName: K,
1048
+ options?: { is?: string }
1049
+ ): IHTMLElementTagNameMap[K];
1050
+
1051
+ /**
1052
+ * Creates an element with the specified namespace URI and qualified name.
1053
+ *
1054
+ * @param namespaceURI Namespace URI.
1055
+ * @param qualifiedName Tag name.
1056
+ * @param [options] Options.
1057
+ * @param [options.is] Tag name of a custom element previously defined via customElements.define().
1058
+ * @returns Element.
1059
+ */
1060
+ public createElementNS<K extends keyof ISVGElementTagNameMap>(
1061
+ namespaceURI: 'http://www.w3.org/2000/svg',
1062
+ qualifiedName: K,
1063
+ options?: { is?: string }
1064
+ ): ISVGElementTagNameMap[K];
1065
+
1066
+ /**
1067
+ * Creates an element with the specified namespace URI and qualified name.
1068
+ *
1069
+ * @param namespaceURI Namespace URI.
1070
+ * @param qualifiedName Tag name.
1071
+ * @param [options] Options.
1072
+ * @param [options.is] Tag name of a custom element previously defined via customElements.define().
1073
+ * @returns Element.
1074
+ */
1075
+ public createElementNS(
1076
+ namespaceURI: string,
1077
+ qualifiedName: string,
1078
+ options?: { is?: string }
1079
+ ): IElement;
1080
+
874
1081
  /**
875
1082
  * Creates an element with the specified namespace URI and qualified name.
876
1083
  *
@@ -895,7 +1102,7 @@ export default class Document extends Node implements IDocument {
895
1102
 
896
1103
  // SVG element
897
1104
  if (namespaceURI === NamespaceURI.svg) {
898
- const element = NodeFactory.createNode<IElement>(
1105
+ const element = NodeFactory.createNode<ISVGElement>(
899
1106
  this,
900
1107
  qualifiedName === 'svg'
901
1108
  ? this[PropertySymbol.ownerWindow].SVGSVGElement
@@ -905,7 +1112,7 @@ export default class Document extends Node implements IDocument {
905
1112
  element[PropertySymbol.localName] = qualifiedName;
906
1113
  element[PropertySymbol.namespaceURI] = namespaceURI;
907
1114
  element[PropertySymbol.isValue] = options && options.is ? String(options.is) : null;
908
- return element;
1115
+ return <IHTMLElement>(<unknown>element);
909
1116
  }
910
1117
 
911
1118
  // Custom HTML element
@@ -915,7 +1122,7 @@ export default class Document extends Node implements IDocument {
915
1122
  ];
916
1123
 
917
1124
  if (customElement) {
918
- const element = NodeFactory.createNode<IElement>(this, customElement.elementClass);
1125
+ const element = NodeFactory.createNode<IHTMLElement>(this, customElement.elementClass);
919
1126
  element[PropertySymbol.tagName] = qualifiedName.toUpperCase();
920
1127
  element[PropertySymbol.localName] = qualifiedName;
921
1128
  element[PropertySymbol.namespaceURI] = namespaceURI;
@@ -928,7 +1135,7 @@ export default class Document extends Node implements IDocument {
928
1135
 
929
1136
  // Known HTML element
930
1137
  if (elementClass) {
931
- const element = NodeFactory.createNode<IElement>(this, elementClass);
1138
+ const element = NodeFactory.createNode<IHTMLElement>(this, elementClass);
932
1139
 
933
1140
  element[PropertySymbol.tagName] = qualifiedName.toUpperCase();
934
1141
  element[PropertySymbol.localName] = localName;
@@ -952,7 +1159,7 @@ export default class Document extends Node implements IDocument {
952
1159
  element[PropertySymbol.namespaceURI] = namespaceURI;
953
1160
  element[PropertySymbol.isValue] = options && options.is ? String(options.is) : null;
954
1161
 
955
- return element;
1162
+ return <IHTMLElement>element;
956
1163
  }
957
1164
 
958
1165
  /* eslint-enable jsdoc/valid-types */
@@ -11,18 +11,22 @@ import IAttr from '../attr/IAttr.js';
11
11
  import IDocumentType from '../document-type/IDocumentType.js';
12
12
  import IParentNode from '../parent-node/IParentNode.js';
13
13
  import INode from '../node/INode.js';
14
- import ICharacterData from '../character-data/ICharacterData.js';
15
14
  import IDocumentFragment from '../document-fragment/IDocumentFragment.js';
16
15
  import Selection from '../../selection/Selection.js';
17
- import IHTMLCollection from '../element/IHTMLCollection.js';
18
16
  import IHTMLScriptElement from '../html-script-element/IHTMLScriptElement.js';
19
17
  import CSSStyleSheet from '../../css/CSSStyleSheet.js';
20
- import Location from '../../url/Location.js';
18
+ import Location from '../../location/Location.js';
21
19
  import DocumentReadyStateEnum from './DocumentReadyStateEnum.js';
22
20
  import INodeList from '../node/INodeList.js';
23
21
  import Range from '../../range/Range.js';
24
22
  import IProcessingInstruction from '../processing-instruction/IProcessingInstruction.js';
25
23
  import VisibilityStateEnum from './VisibilityStateEnum.js';
24
+ import IHTMLElementTagNameMap from '../../config/IHTMLElementTagNameMap.js';
25
+ import ISVGElementTagNameMap from '../../config/ISVGElementTagNameMap.js';
26
+ import IText from '../text/IText.js';
27
+ import IComment from '../comment/IComment.js';
28
+ import IHTMLCollection from '../element/IHTMLCollection.js';
29
+ import IHTMLAnchorElement from '../html-anchor-element/IHTMLAnchorElement.js';
26
30
 
27
31
  /**
28
32
  * Document.
@@ -47,8 +51,8 @@ export default interface IDocument extends IParentNode {
47
51
  readonly documentURI: string;
48
52
  readonly visibilityState: VisibilityStateEnum;
49
53
  readonly hidden: boolean;
50
- readonly links: IHTMLCollection<IHTMLElement>;
51
- readonly forms: IHTMLCollection<IHTMLElement>;
54
+ readonly links: INodeList<IHTMLElement | IHTMLAnchorElement>;
55
+ readonly forms: INodeList<IHTMLElement>;
52
56
  readonly referrer: string;
53
57
  readonly currentScript: IHTMLScriptElement;
54
58
  adoptedStyleSheets: CSSStyleSheet[];
@@ -188,20 +192,38 @@ export default interface IDocument extends IParentNode {
188
192
  /**
189
193
  * Creates an element.
190
194
  *
191
- * @param tagName Tag name.
195
+ * @param qualifiedName Tag name.
192
196
  * @param [options] Options.
193
197
  * @returns Element.
194
198
  */
195
- createElement(tagName: string, options?: { is: string }): IElement;
199
+ createElement<K extends keyof IHTMLElementTagNameMap>(
200
+ qualifiedName: K,
201
+ options?: { is?: string }
202
+ ): IHTMLElementTagNameMap[K];
203
+ createElement<K extends keyof ISVGElementTagNameMap>(
204
+ qualifiedName: K,
205
+ options?: { is?: string }
206
+ ): ISVGElementTagNameMap[K];
207
+ createElement(tagName: string, options?: { is?: string }): IHTMLElement;
196
208
 
197
209
  /**
198
210
  * Creates an element with the specified namespace URI and qualified name.
199
211
  *
200
- * @param tagName Tag name.
212
+ * @param qualifiedName Tag name.
201
213
  * @param [options] Options.
202
214
  * @returns Element.
203
215
  */
204
- createElementNS(namespaceURI: string, qualifiedName: string, options?: { is: string }): IElement;
216
+ createElementNS<K extends keyof IHTMLElementTagNameMap>(
217
+ namespaceURI: 'http://www.w3.org/1999/xhtml',
218
+ qualifiedName: K,
219
+ options?: { is?: string }
220
+ ): IHTMLElementTagNameMap[K];
221
+ createElementNS<K extends keyof ISVGElementTagNameMap>(
222
+ namespaceURI: 'http://www.w3.org/2000/svg',
223
+ qualifiedName: K,
224
+ options?: { is?: string }
225
+ ): ISVGElementTagNameMap[K];
226
+ createElementNS(namespaceURI: string, qualifiedName: string, options?: { is?: string }): IElement;
205
227
 
206
228
  /**
207
229
  * Creates a text node.
@@ -209,7 +231,7 @@ export default interface IDocument extends IParentNode {
209
231
  * @param data Text data.
210
232
  * @returns Text node.
211
233
  */
212
- createTextNode(data?: string): ICharacterData;
234
+ createTextNode(data?: string): IText;
213
235
 
214
236
  /**
215
237
  * Creates a comment node.
@@ -217,7 +239,7 @@ export default interface IDocument extends IParentNode {
217
239
  * @param data Text data.
218
240
  * @returns Text node.
219
241
  */
220
- createComment(data?: string): ICharacterData;
242
+ createComment(data?: string): IComment;
221
243
 
222
244
  /**
223
245
  * Creates a document fragment.
@@ -10,6 +10,8 @@ import ElementUtility from '../element/ElementUtility.js';
10
10
  import HTMLCollection from '../element/HTMLCollection.js';
11
11
  import INodeList from '../node/INodeList.js';
12
12
  import NodeTypeEnum from '../node/NodeTypeEnum.js';
13
+ import IHTMLElementTagNameMap from '../../config/IHTMLElementTagNameMap.js';
14
+ import ISVGElementTagNameMap from '../../config/ISVGElementTagNameMap.js';
13
15
 
14
16
  /**
15
17
  * DocumentFragment.
@@ -118,6 +120,34 @@ export default class DocumentFragment extends Node implements IDocumentFragment
118
120
  * @param selector CSS selector.
119
121
  * @returns Matching elements.
120
122
  */
123
+ public querySelectorAll<K extends keyof IHTMLElementTagNameMap>(
124
+ selector: K
125
+ ): INodeList<IHTMLElementTagNameMap[K]>;
126
+
127
+ /**
128
+ * Query CSS selector to find matching elments.
129
+ *
130
+ * @param selector CSS selector.
131
+ * @returns Matching elements.
132
+ */
133
+ public querySelectorAll<K extends keyof ISVGElementTagNameMap>(
134
+ selector: K
135
+ ): INodeList<ISVGElementTagNameMap[K]>;
136
+
137
+ /**
138
+ * Query CSS selector to find matching elments.
139
+ *
140
+ * @param selector CSS selector.
141
+ * @returns Matching elements.
142
+ */
143
+ public querySelectorAll(selector: string): INodeList<IElement>;
144
+
145
+ /**
146
+ * Query CSS selector to find matching elments.
147
+ *
148
+ * @param selector CSS selector.
149
+ * @returns Matching elements.
150
+ */
121
151
  public querySelectorAll(selector: string): INodeList<IElement> {
122
152
  return QuerySelector.querySelectorAll(this, selector);
123
153
  }
@@ -128,7 +158,35 @@ export default class DocumentFragment extends Node implements IDocumentFragment
128
158
  * @param selector CSS selector.
129
159
  * @returns Matching element.
130
160
  */
131
- public querySelector(selector: string): IElement {
161
+ public querySelector<K extends keyof IHTMLElementTagNameMap>(
162
+ selector: K
163
+ ): IHTMLElementTagNameMap[K] | null;
164
+
165
+ /**
166
+ * Query CSS Selector to find a matching element.
167
+ *
168
+ * @param selector CSS selector.
169
+ * @returns Matching element.
170
+ */
171
+ public querySelector<K extends keyof ISVGElementTagNameMap>(
172
+ selector: K
173
+ ): ISVGElementTagNameMap[K] | null;
174
+
175
+ /**
176
+ * Query CSS Selector to find a matching element.
177
+ *
178
+ * @param selector CSS selector.
179
+ * @returns Matching element.
180
+ */
181
+ public querySelector(selector: string): IElement | null;
182
+
183
+ /**
184
+ * Query CSS Selector to find a matching element.
185
+ *
186
+ * @param selector CSS selector.
187
+ * @returns Matching element.
188
+ */
189
+ public querySelector(selector: string): IElement | null {
132
190
  return QuerySelector.querySelector(this, selector);
133
191
  }
134
192
 
@@ -1,3 +1,5 @@
1
+ import IHTMLElementTagNameMap from '../../config/IHTMLElementTagNameMap.js';
2
+ import ISVGElementTagNameMap from '../../config/ISVGElementTagNameMap.js';
1
3
  import IElement from '../element/IElement.js';
2
4
  import INode from '../node/INode.js';
3
5
  import INodeList from '../node/INodeList.js';
@@ -28,6 +30,12 @@ export default interface IDocumentFragment extends INode {
28
30
  * @param selector CSS selector.
29
31
  * @returns Matching element.
30
32
  */
33
+ querySelector<K extends keyof IHTMLElementTagNameMap>(
34
+ selector: K
35
+ ): IHTMLElementTagNameMap[K] | null;
36
+ querySelector<K extends keyof ISVGElementTagNameMap>(
37
+ selector: K
38
+ ): ISVGElementTagNameMap[K] | null;
31
39
  querySelector(selector: string): IElement | null;
32
40
 
33
41
  /**
@@ -36,6 +44,12 @@ export default interface IDocumentFragment extends INode {
36
44
  * @param selector CSS selector.
37
45
  * @returns Matching elements.
38
46
  */
47
+ querySelectorAll<K extends keyof IHTMLElementTagNameMap>(
48
+ selector: K
49
+ ): INodeList<IHTMLElementTagNameMap[K]>;
50
+ querySelectorAll<K extends keyof ISVGElementTagNameMap>(
51
+ selector: K
52
+ ): INodeList<ISVGElementTagNameMap[K]>;
39
53
  querySelectorAll(selector: string): INodeList<IElement>;
40
54
 
41
55
  /**