happy-dom 8.9.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 (360) 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-base-element/HTMLBaseElement.js +4 -4
  117. package/lib/nodes/html-base-element/HTMLBaseElement.js.map +1 -1
  118. package/lib/nodes/html-button-element/HTMLButtonElement.d.ts +79 -3
  119. package/lib/nodes/html-button-element/HTMLButtonElement.js +158 -10
  120. package/lib/nodes/html-button-element/HTMLButtonElement.js.map +1 -1
  121. package/lib/nodes/html-button-element/IHTMLButtonElement.d.ts +28 -2
  122. package/lib/nodes/html-dialog-element/HTMLDialogElement.js +3 -3
  123. package/lib/nodes/html-dialog-element/HTMLDialogElement.js.map +1 -1
  124. package/lib/nodes/html-element/HTMLElement.js +12 -12
  125. package/lib/nodes/html-element/HTMLElement.js.map +1 -1
  126. package/lib/nodes/html-form-element/HTMLFormControlsCollection.d.ts +32 -0
  127. package/lib/nodes/html-form-element/HTMLFormControlsCollection.js +58 -0
  128. package/lib/nodes/html-form-element/HTMLFormControlsCollection.js.map +1 -0
  129. package/lib/nodes/html-form-element/HTMLFormElement.d.ts +37 -17
  130. package/lib/nodes/html-form-element/HTMLFormElement.js +128 -37
  131. package/lib/nodes/html-form-element/HTMLFormElement.js.map +1 -1
  132. package/lib/nodes/html-form-element/IHTMLFormControlsCollection.d.ts +25 -0
  133. package/lib/nodes/html-form-element/IHTMLFormControlsCollection.js +3 -0
  134. package/lib/nodes/html-form-element/IHTMLFormControlsCollection.js.map +1 -0
  135. package/lib/nodes/html-form-element/IHTMLFormElement.d.ts +16 -6
  136. package/lib/nodes/html-form-element/IRadioNodeList.d.ts +15 -0
  137. package/lib/nodes/html-form-element/IRadioNodeList.js +3 -0
  138. package/lib/nodes/html-form-element/IRadioNodeList.js.map +1 -0
  139. package/lib/nodes/html-form-element/RadioNodeList.d.ts +16 -0
  140. package/lib/nodes/html-form-element/RadioNodeList.js +28 -0
  141. package/lib/nodes/html-form-element/RadioNodeList.js.map +1 -0
  142. package/lib/nodes/html-image-element/HTMLImageElement.js +19 -19
  143. package/lib/nodes/html-image-element/HTMLImageElement.js.map +1 -1
  144. package/lib/nodes/html-input-element/HTMLInputElement.d.ts +43 -19
  145. package/lib/nodes/html-input-element/HTMLInputElement.js +206 -111
  146. package/lib/nodes/html-input-element/HTMLInputElement.js.map +1 -1
  147. package/lib/nodes/html-input-element/IHTMLInputElement.d.ts +14 -1
  148. package/lib/nodes/html-label-element/HTMLLabelElement.js +3 -7
  149. package/lib/nodes/html-label-element/HTMLLabelElement.js.map +1 -1
  150. package/lib/nodes/html-link-element/HTMLLinkElement.js +21 -21
  151. package/lib/nodes/html-link-element/HTMLLinkElement.js.map +1 -1
  152. package/lib/nodes/html-media-element/HTMLMediaElement.js +21 -21
  153. package/lib/nodes/html-media-element/HTMLMediaElement.js.map +1 -1
  154. package/lib/nodes/html-meta-element/HTMLMetaElement.js +8 -8
  155. package/lib/nodes/html-meta-element/HTMLMetaElement.js.map +1 -1
  156. package/lib/nodes/html-opt-group-element/HTMLOptGroupElement.js +6 -6
  157. package/lib/nodes/html-opt-group-element/HTMLOptGroupElement.js.map +1 -1
  158. package/lib/nodes/html-option-element/HTMLOptionElement.d.ts +3 -4
  159. package/lib/nodes/html-option-element/HTMLOptionElement.js +26 -29
  160. package/lib/nodes/html-option-element/HTMLOptionElement.js.map +1 -1
  161. package/lib/nodes/html-script-element/HTMLScriptElement.js +16 -16
  162. package/lib/nodes/html-script-element/HTMLScriptElement.js.map +1 -1
  163. package/lib/nodes/html-script-element/ScriptUtility.js +5 -5
  164. package/lib/nodes/html-script-element/ScriptUtility.js.map +1 -1
  165. package/lib/nodes/{html-option-element → html-select-element}/HTMLOptionsCollection.d.ts +5 -6
  166. package/lib/nodes/{html-option-element → html-select-element}/HTMLOptionsCollection.js.map +1 -1
  167. package/lib/nodes/html-select-element/HTMLSelectElement.d.ts +42 -41
  168. package/lib/nodes/html-select-element/HTMLSelectElement.js +134 -138
  169. package/lib/nodes/html-select-element/HTMLSelectElement.js.map +1 -1
  170. package/lib/nodes/{html-option-element → html-select-element}/IHTMLOptionsCollection.d.ts +4 -5
  171. package/lib/nodes/html-select-element/IHTMLOptionsCollection.js.map +1 -0
  172. package/lib/nodes/html-select-element/IHTMLSelectElement.d.ts +22 -2
  173. package/lib/nodes/html-slot-element/HTMLSlotElement.js +2 -2
  174. package/lib/nodes/html-slot-element/HTMLSlotElement.js.map +1 -1
  175. package/lib/nodes/html-style-element/HTMLStyleElement.js +7 -7
  176. package/lib/nodes/html-style-element/HTMLStyleElement.js.map +1 -1
  177. package/lib/nodes/html-text-area-element/HTMLTextAreaElement.d.ts +55 -2
  178. package/lib/nodes/html-text-area-element/HTMLTextAreaElement.js +150 -40
  179. package/lib/nodes/html-text-area-element/HTMLTextAreaElement.js.map +1 -1
  180. package/lib/nodes/html-text-area-element/IHTMLTextAreaElement.d.ts +16 -0
  181. package/lib/nodes/node/Node.d.ts +12 -1
  182. package/lib/nodes/node/Node.js +50 -4
  183. package/lib/nodes/node/Node.js.map +1 -1
  184. package/lib/nodes/node/NodeList.d.ts +2 -3
  185. package/lib/nodes/node/NodeList.js.map +1 -1
  186. package/lib/nodes/parent-node/IParentNode.d.ts +4 -4
  187. package/lib/nodes/parent-node/ParentNodeUtility.d.ts +3 -3
  188. package/lib/nodes/parent-node/ParentNodeUtility.js +13 -11
  189. package/lib/nodes/parent-node/ParentNodeUtility.js.map +1 -1
  190. package/lib/nodes/text/Text.d.ts +13 -0
  191. package/lib/nodes/text/Text.js +30 -0
  192. package/lib/nodes/text/Text.js.map +1 -1
  193. package/lib/query-selector/QuerySelector.js +2 -2
  194. package/lib/query-selector/QuerySelector.js.map +1 -1
  195. package/lib/query-selector/SelectorItem.js +2 -0
  196. package/lib/query-selector/SelectorItem.js.map +1 -1
  197. package/lib/validity-state/ValidityState.d.ts +87 -0
  198. package/lib/validity-state/ValidityState.js +171 -0
  199. package/lib/validity-state/ValidityState.js.map +1 -0
  200. package/lib/window/GlobalWindow.d.ts +0 -8
  201. package/lib/window/GlobalWindow.js +0 -2
  202. package/lib/window/GlobalWindow.js.map +1 -1
  203. package/lib/window/INodeJSGlobal.d.ts +71 -0
  204. package/lib/window/INodeJSGlobal.js +2 -0
  205. package/lib/window/INodeJSGlobal.js.map +1 -0
  206. package/lib/window/IWindow.d.ts +30 -10
  207. package/lib/window/Window.d.ts +36 -20
  208. package/lib/window/Window.js +16 -9
  209. package/lib/window/Window.js.map +1 -1
  210. package/lib/xml-http-request/XMLHttpRequest.js +20 -12
  211. package/lib/xml-http-request/XMLHttpRequest.js.map +1 -1
  212. package/lib/xml-parser/XMLParser.js +1 -1
  213. package/lib/xml-parser/XMLParser.js.map +1 -1
  214. package/package.json +2 -3
  215. package/src/cookie/CookieJar.ts +1 -1
  216. package/src/dom-token-list/DOMTokenList.ts +24 -20
  217. package/src/event/EventTarget.ts +7 -3
  218. package/src/exception/DOMExceptionNameEnum.ts +5 -1
  219. package/src/fetch/AbortController.ts +26 -0
  220. package/src/fetch/AbortSignal.ts +44 -0
  221. package/src/fetch/Fetch.ts +666 -0
  222. package/src/fetch/Headers.ts +151 -3
  223. package/src/fetch/Request.ts +226 -94
  224. package/src/fetch/{ResourceFetchHandler.ts → ResourceFetch.ts} +3 -3
  225. package/src/fetch/Response.ts +252 -89
  226. package/src/fetch/data-uri/DataURIParser.ts +66 -0
  227. package/src/fetch/multipart/MultipartFormDataParser.ts +113 -0
  228. package/src/fetch/multipart/MultipartReader.ts +217 -0
  229. package/src/fetch/types/IHeaders.ts +80 -0
  230. package/src/fetch/types/IRequest.ts +65 -0
  231. package/src/fetch/types/IRequestBody.ts +15 -0
  232. package/src/fetch/types/IRequestCredentials.ts +2 -0
  233. package/src/fetch/types/IRequestInfo.ts +6 -0
  234. package/src/fetch/types/IRequestInit.ts +21 -0
  235. package/src/fetch/types/IRequestRedirect.ts +3 -0
  236. package/src/fetch/types/IRequestReferrerPolicy.ts +11 -0
  237. package/src/fetch/types/IResponse.ts +27 -0
  238. package/src/fetch/types/IResponseBody.ts +15 -0
  239. package/src/fetch/types/IResponseInit.ts +10 -0
  240. package/src/fetch/utilities/FetchBodyUtility.ts +175 -0
  241. package/src/fetch/utilities/FetchCORSUtility.ts +18 -0
  242. package/src/fetch/utilities/FetchRequestHeaderUtility.ts +47 -0
  243. package/src/fetch/utilities/FetchRequestReferrerUtility.ts +241 -0
  244. package/src/fetch/utilities/FetchRequestValidationUtility.ts +82 -0
  245. package/src/file/Blob.ts +2 -2
  246. package/src/file/File.ts +5 -1
  247. package/src/form-data/FormData.ts +237 -0
  248. package/src/index.ts +27 -1
  249. package/src/nodes/document/Document.ts +23 -64
  250. package/src/nodes/document/IDocument.ts +1 -1
  251. package/src/nodes/document-fragment/DocumentFragment.ts +9 -59
  252. package/src/nodes/document-fragment/IDocumentFragment.ts +2 -1
  253. package/src/nodes/element/Element.ts +43 -56
  254. package/src/nodes/element/ElementUtility.ts +137 -0
  255. package/src/nodes/element/HTMLCollection.ts +60 -3
  256. package/src/nodes/element/IHTMLCollection.ts +10 -2
  257. package/src/nodes/html-anchor-element/HTMLAnchorElement.ts +24 -24
  258. package/src/nodes/html-base-element/HTMLBaseElement.ts +4 -4
  259. package/src/nodes/html-button-element/HTMLButtonElement.ts +184 -10
  260. package/src/nodes/html-button-element/IHTMLButtonElement.ts +31 -2
  261. package/src/nodes/html-dialog-element/HTMLDialogElement.ts +3 -3
  262. package/src/nodes/html-element/HTMLElement.ts +12 -12
  263. package/src/nodes/html-form-element/HTMLFormControlsCollection.ts +76 -0
  264. package/src/nodes/html-form-element/HTMLFormElement.ts +147 -41
  265. package/src/nodes/html-form-element/IHTMLFormControlsCollection.ts +45 -0
  266. package/src/nodes/html-form-element/IHTMLFormElement.ts +17 -6
  267. package/src/nodes/html-form-element/IRadioNodeList.ts +16 -0
  268. package/src/nodes/html-form-element/RadioNodeList.ts +24 -0
  269. package/src/nodes/html-image-element/HTMLImageElement.ts +19 -19
  270. package/src/nodes/html-input-element/HTMLInputElement.ts +232 -113
  271. package/src/nodes/html-input-element/IHTMLInputElement.ts +20 -1
  272. package/src/nodes/html-label-element/HTMLLabelElement.ts +3 -7
  273. package/src/nodes/html-link-element/HTMLLinkElement.ts +21 -21
  274. package/src/nodes/html-media-element/HTMLMediaElement.ts +21 -21
  275. package/src/nodes/html-meta-element/HTMLMetaElement.ts +8 -8
  276. package/src/nodes/html-opt-group-element/HTMLOptGroupElement.ts +6 -6
  277. package/src/nodes/html-option-element/HTMLOptionElement.ts +29 -30
  278. package/src/nodes/html-script-element/HTMLScriptElement.ts +16 -16
  279. package/src/nodes/html-script-element/ScriptUtility.ts +5 -5
  280. package/src/nodes/{html-option-element → html-select-element}/HTMLOptionsCollection.ts +5 -9
  281. package/src/nodes/html-select-element/HTMLSelectElement.ts +159 -170
  282. package/src/nodes/{html-option-element → html-select-element}/IHTMLOptionsCollection.ts +4 -8
  283. package/src/nodes/html-select-element/IHTMLSelectElement.ts +25 -2
  284. package/src/nodes/html-slot-element/HTMLSlotElement.ts +2 -2
  285. package/src/nodes/html-style-element/HTMLStyleElement.ts +7 -7
  286. package/src/nodes/html-text-area-element/HTMLTextAreaElement.ts +174 -41
  287. package/src/nodes/html-text-area-element/IHTMLTextAreaElement.ts +18 -0
  288. package/src/nodes/node/Node.ts +61 -6
  289. package/src/nodes/node/NodeList.ts +2 -3
  290. package/src/nodes/parent-node/IParentNode.ts +7 -4
  291. package/src/nodes/parent-node/ParentNodeUtility.ts +25 -15
  292. package/src/nodes/text/Text.ts +38 -0
  293. package/src/query-selector/QuerySelector.ts +2 -2
  294. package/src/query-selector/SelectorItem.ts +3 -0
  295. package/src/validity-state/ValidityState.ts +211 -0
  296. package/src/window/GlobalWindow.ts +0 -2
  297. package/src/window/INodeJSGlobal.ts +70 -0
  298. package/src/window/IWindow.ts +32 -10
  299. package/src/window/Window.ts +37 -20
  300. package/src/xml-http-request/XMLHttpRequest.ts +27 -26
  301. package/src/xml-parser/XMLParser.ts +1 -1
  302. package/lib/fetch/FetchHandler.d.ts +0 -18
  303. package/lib/fetch/FetchHandler.js +0 -83
  304. package/lib/fetch/FetchHandler.js.map +0 -1
  305. package/lib/fetch/IAbortSignal.d.ts +0 -16
  306. package/lib/fetch/IAbortSignal.js +0 -4
  307. package/lib/fetch/IAbortSignal.js.map +0 -1
  308. package/lib/fetch/IBody.d.ts +0 -17
  309. package/lib/fetch/IBody.js.map +0 -1
  310. package/lib/fetch/IHeaders.d.ts +0 -18
  311. package/lib/fetch/IHeadersInit.js.map +0 -1
  312. package/lib/fetch/IRequest.d.ts +0 -18
  313. package/lib/fetch/IRequestInit.d.ts +0 -16
  314. package/lib/fetch/IRequestInit.js.map +0 -1
  315. package/lib/fetch/IResponse.d.ts +0 -20
  316. package/lib/fetch/IResponseInit.d.ts +0 -9
  317. package/lib/fetch/IResponseInit.js.map +0 -1
  318. package/lib/fetch/RequestInfo.js +0 -3
  319. package/lib/fetch/RequestInfo.js.map +0 -1
  320. package/lib/fetch/ResourceFetchHandler.js.map +0 -1
  321. package/lib/form-data/IFormData.d.ts +0 -32
  322. package/lib/form-data/IFormData.js +0 -3
  323. package/lib/form-data/IFormData.js.map +0 -1
  324. package/lib/location/RelativeURL.d.ts +0 -15
  325. package/lib/location/RelativeURL.js +0 -19
  326. package/lib/location/RelativeURL.js.map +0 -1
  327. package/lib/nodes/element/HTMLCollectionFactory.d.ts +0 -21
  328. package/lib/nodes/element/HTMLCollectionFactory.js +0 -31
  329. package/lib/nodes/element/HTMLCollectionFactory.js.map +0 -1
  330. package/lib/nodes/html-option-element/IHTMLOptionsCollection.js.map +0 -1
  331. package/lib/nodes/node/NodeListFactory.d.ts +0 -21
  332. package/lib/nodes/node/NodeListFactory.js +0 -31
  333. package/lib/nodes/node/NodeListFactory.js.map +0 -1
  334. package/lib/nodes/validity-state/ValidityState.d.ts +0 -52
  335. package/lib/nodes/validity-state/ValidityState.js +0 -81
  336. package/lib/nodes/validity-state/ValidityState.js.map +0 -1
  337. package/src/fetch/FetchHandler.ts +0 -90
  338. package/src/fetch/IAbortSignal.ts +0 -34
  339. package/src/fetch/IBody.ts +0 -18
  340. package/src/fetch/IHeaders.ts +0 -18
  341. package/src/fetch/IRequest.ts +0 -59
  342. package/src/fetch/IRequestInit.ts +0 -41
  343. package/src/fetch/IResponse.ts +0 -22
  344. package/src/fetch/IResponseInit.ts +0 -10
  345. package/src/fetch/RequestInfo.ts +0 -6
  346. package/src/form-data/IFormData.ts +0 -33
  347. package/src/location/RelativeURL.ts +0 -17
  348. package/src/nodes/element/HTMLCollectionFactory.ts +0 -31
  349. package/src/nodes/node/NodeListFactory.ts +0 -31
  350. package/src/nodes/validity-state/ValidityState.ts +0 -84
  351. /package/lib/fetch/{IHeaders.js → types/IHeaders.js} +0 -0
  352. /package/lib/fetch/{IHeadersInit.d.ts → types/IHeadersInit.d.ts} +0 -0
  353. /package/lib/fetch/{IHeadersInit.js → types/IHeadersInit.js} +0 -0
  354. /package/lib/fetch/{IRequest.js → types/IRequest.js} +0 -0
  355. /package/lib/fetch/{IRequestInit.js → types/IRequestInit.js} +0 -0
  356. /package/lib/fetch/{IResponse.js → types/IResponse.js} +0 -0
  357. /package/lib/fetch/{IResponseInit.js → types/IResponseInit.js} +0 -0
  358. /package/lib/nodes/{html-option-element → html-select-element}/HTMLOptionsCollection.js +0 -0
  359. /package/lib/nodes/{html-option-element → html-select-element}/IHTMLOptionsCollection.js +0 -0
  360. /package/src/fetch/{IHeadersInit.ts → types/IHeadersInit.ts} +0 -0
@@ -1,16 +1,73 @@
1
1
  import IHTMLCollection from './IHTMLCollection';
2
- import INode from '../node/INode';
3
2
 
4
3
  /**
5
4
  * Class list.
6
5
  */
7
- export default class HTMLCollection extends Array implements IHTMLCollection<INode> {
6
+ export default class HTMLCollection<T, NamedItem>
7
+ extends Array
8
+ implements IHTMLCollection<T, NamedItem>
9
+ {
10
+ protected _namedItems: { [k: string]: T[] } = {};
11
+
8
12
  /**
9
13
  * Returns item by index.
10
14
  *
11
15
  * @param index Index.
12
16
  */
13
- public item(index: number): INode {
17
+ public item(index: number): T | null {
14
18
  return index >= 0 && this[index] ? this[index] : null;
15
19
  }
20
+
21
+ /**
22
+ * Returns named item.
23
+ *
24
+ * @param name Name.
25
+ * @returns Node.
26
+ */
27
+ public namedItem(name: string): NamedItem | null {
28
+ return this[name] || null;
29
+ }
30
+
31
+ /**
32
+ * Appends named item.
33
+ *
34
+ * @param node Node.
35
+ * @param name Name.
36
+ */
37
+ public _appendNamedItem(node: T, name: string): void {
38
+ if (name) {
39
+ this._namedItems[name] = this._namedItems[name] || [];
40
+
41
+ if (!this._namedItems[name].includes(node)) {
42
+ this._namedItems[name].push(node);
43
+ }
44
+
45
+ if (!this[name]) {
46
+ this[name] = this._namedItems[name][0];
47
+ }
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Appends named item.
53
+ *
54
+ * @param node Node.
55
+ * @param name Name.
56
+ */
57
+ public _removeNamedItem(node: T, name: string): void {
58
+ if (name && this._namedItems[name]) {
59
+ const index = this._namedItems[name].indexOf(node);
60
+
61
+ if (index > -1) {
62
+ this._namedItems[name].splice(index, 1);
63
+
64
+ if (this._namedItems[name].length === 0) {
65
+ delete this._namedItems[name];
66
+ delete this[name];
67
+ } else {
68
+ this[name] = this._namedItems[name][0];
69
+ }
70
+ }
71
+ }
72
+ }
16
73
  }
@@ -1,11 +1,19 @@
1
1
  /**
2
2
  * HTMLCollection.
3
3
  */
4
- export default interface IHTMLCollection<T> extends Array<T> {
4
+ export default interface IHTMLCollection<T, NamedItem> extends Array<T> {
5
5
  /**
6
6
  * Returns item by index.
7
7
  *
8
8
  * @param index Index.
9
9
  */
10
- item(index: number): T;
10
+ item(index: number): T | null;
11
+
12
+ /**
13
+ * Returns named item.
14
+ *
15
+ * @param name Name.
16
+ * @returns Node.
17
+ */
18
+ namedItem(name: string): NamedItem | null;
11
19
  }
@@ -31,7 +31,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
31
31
  * @param download Download.
32
32
  */
33
33
  public set download(download: string) {
34
- this.setAttributeNS(null, 'download', download);
34
+ this.setAttribute('download', download);
35
35
  }
36
36
 
37
37
  /**
@@ -51,7 +51,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
51
51
  public set hash(hash: string) {
52
52
  if (this._url && !HTMLAnchorElementUtility.isBlobURL(this._url)) {
53
53
  this._url.hash = hash;
54
- this.setAttributeNS(null, 'href', this._url.toString());
54
+ this.setAttribute('href', this._url.toString());
55
55
  }
56
56
  }
57
57
 
@@ -65,7 +65,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
65
65
  return this._url.toString();
66
66
  }
67
67
 
68
- return this.getAttributeNS(null, 'href') || '';
68
+ return this.getAttribute('href') || '';
69
69
  }
70
70
 
71
71
  /**
@@ -74,7 +74,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
74
74
  * @param href Href.
75
75
  */
76
76
  public set href(href: string) {
77
- this.setAttributeNS(null, 'href', href);
77
+ this.setAttribute('href', href);
78
78
  }
79
79
 
80
80
  /**
@@ -83,7 +83,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
83
83
  * @returns Hreflang.
84
84
  */
85
85
  public get hreflang(): string {
86
- return this.getAttributeNS(null, 'hreflang') || '';
86
+ return this.getAttribute('hreflang') || '';
87
87
  }
88
88
 
89
89
  /**
@@ -92,7 +92,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
92
92
  * @param hreflang Hreflang.
93
93
  */
94
94
  public set hreflang(hreflang: string) {
95
- this.setAttributeNS(null, 'hreflang', hreflang);
95
+ this.setAttribute('hreflang', hreflang);
96
96
  }
97
97
 
98
98
  /**
@@ -110,7 +110,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
110
110
  * @returns Ping.
111
111
  */
112
112
  public get ping(): string {
113
- return this.getAttributeNS(null, 'ping') || '';
113
+ return this.getAttribute('ping') || '';
114
114
  }
115
115
 
116
116
  /**
@@ -119,7 +119,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
119
119
  * @param ping Ping.
120
120
  */
121
121
  public set ping(ping: string) {
122
- this.setAttributeNS(null, 'ping', ping);
122
+ this.setAttribute('ping', ping);
123
123
  }
124
124
 
125
125
  /**
@@ -139,7 +139,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
139
139
  public set protocol(protocol: string) {
140
140
  if (this._url && !HTMLAnchorElementUtility.isBlobURL(this._url)) {
141
141
  this._url.protocol = protocol;
142
- this.setAttributeNS(null, 'href', this._url.toString());
142
+ this.setAttribute('href', this._url.toString());
143
143
  }
144
144
  }
145
145
 
@@ -165,7 +165,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
165
165
  this._url.protocol != 'file'
166
166
  ) {
167
167
  this._url.username = username;
168
- this.setAttributeNS(null, 'href', this._url.toString());
168
+ this.setAttribute('href', this._url.toString());
169
169
  }
170
170
  }
171
171
 
@@ -191,7 +191,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
191
191
  this._url.protocol != 'file'
192
192
  ) {
193
193
  this._url.password = password;
194
- this.setAttributeNS(null, 'href', this._url.toString());
194
+ this.setAttribute('href', this._url.toString());
195
195
  }
196
196
  }
197
197
 
@@ -212,7 +212,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
212
212
  public set pathname(pathname: string) {
213
213
  if (this._url && !HTMLAnchorElementUtility.isBlobURL(this._url)) {
214
214
  this._url.pathname = pathname;
215
- this.setAttributeNS(null, 'href', this._url.toString());
215
+ this.setAttribute('href', this._url.toString());
216
216
  }
217
217
  }
218
218
 
@@ -238,7 +238,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
238
238
  this._url.protocol != 'file'
239
239
  ) {
240
240
  this._url.port = port;
241
- this.setAttributeNS(null, 'href', this._url.toString());
241
+ this.setAttribute('href', this._url.toString());
242
242
  }
243
243
  }
244
244
 
@@ -259,7 +259,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
259
259
  public set host(host: string) {
260
260
  if (this._url && !HTMLAnchorElementUtility.isBlobURL(this._url)) {
261
261
  this._url.host = host;
262
- this.setAttributeNS(null, 'href', this._url.toString());
262
+ this.setAttribute('href', this._url.toString());
263
263
  }
264
264
  }
265
265
 
@@ -280,7 +280,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
280
280
  public set hostname(hostname: string) {
281
281
  if (this._url && !HTMLAnchorElementUtility.isBlobURL(this._url)) {
282
282
  this._url.hostname = hostname;
283
- this.setAttributeNS(null, 'href', this._url.toString());
283
+ this.setAttribute('href', this._url.toString());
284
284
  }
285
285
  }
286
286
 
@@ -290,7 +290,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
290
290
  * @returns Referrer Policy.
291
291
  */
292
292
  public get referrerPolicy(): string {
293
- return this.getAttributeNS(null, 'referrerPolicy') || '';
293
+ return this.getAttribute('referrerPolicy') || '';
294
294
  }
295
295
 
296
296
  /**
@@ -299,7 +299,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
299
299
  * @param referrerPolicy Referrer Policy.
300
300
  */
301
301
  public set referrerPolicy(referrerPolicy: string) {
302
- this.setAttributeNS(null, 'referrerPolicy', referrerPolicy);
302
+ this.setAttribute('referrerPolicy', referrerPolicy);
303
303
  }
304
304
 
305
305
  /**
@@ -308,7 +308,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
308
308
  * @returns Rel.
309
309
  */
310
310
  public get rel(): string {
311
- return this.getAttributeNS(null, 'rel') || '';
311
+ return this.getAttribute('rel') || '';
312
312
  }
313
313
 
314
314
  /**
@@ -317,7 +317,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
317
317
  * @param rel Rel.
318
318
  */
319
319
  public set rel(rel: string) {
320
- this.setAttributeNS(null, 'rel', rel);
320
+ this.setAttribute('rel', rel);
321
321
  }
322
322
 
323
323
  /**
@@ -349,7 +349,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
349
349
  public set search(search: string) {
350
350
  if (this._url && !HTMLAnchorElementUtility.isBlobURL(this._url)) {
351
351
  this._url.search = search;
352
- this.setAttributeNS(null, 'href', this._url.toString());
352
+ this.setAttribute('href', this._url.toString());
353
353
  }
354
354
  }
355
355
 
@@ -359,7 +359,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
359
359
  * @returns target.
360
360
  */
361
361
  public get target(): string {
362
- return this.getAttributeNS(null, 'target') || '';
362
+ return this.getAttribute('target') || '';
363
363
  }
364
364
 
365
365
  /**
@@ -368,7 +368,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
368
368
  * @param target Target.
369
369
  */
370
370
  public set target(target: string) {
371
- this.setAttributeNS(null, 'target', target);
371
+ this.setAttribute('target', target);
372
372
  }
373
373
 
374
374
  /**
@@ -395,7 +395,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
395
395
  * @returns Type.
396
396
  */
397
397
  public get type(): string {
398
- return this.getAttributeNS(null, 'type') || '';
398
+ return this.getAttribute('type') || '';
399
399
  }
400
400
 
401
401
  /**
@@ -404,7 +404,7 @@ export default class HTMLAnchorElement extends HTMLElement implements IHTMLAncho
404
404
  * @param type Type.
405
405
  */
406
406
  public set type(type: string) {
407
- this.setAttributeNS(null, 'type', type);
407
+ this.setAttribute('type', type);
408
408
  }
409
409
 
410
410
  /**
@@ -14,7 +14,7 @@ export default class HTMLBaseElement extends HTMLElement implements IHTMLBaseEle
14
14
  * @returns Href.
15
15
  */
16
16
  public get href(): string {
17
- const href = this.getAttributeNS(null, 'href');
17
+ const href = this.getAttribute('href');
18
18
  if (href !== null) {
19
19
  return href;
20
20
  }
@@ -27,7 +27,7 @@ export default class HTMLBaseElement extends HTMLElement implements IHTMLBaseEle
27
27
  * @param href Href.
28
28
  */
29
29
  public set href(href: string) {
30
- this.setAttributeNS(null, 'href', href);
30
+ this.setAttribute('href', href);
31
31
  }
32
32
 
33
33
  /**
@@ -36,7 +36,7 @@ export default class HTMLBaseElement extends HTMLElement implements IHTMLBaseEle
36
36
  * @returns Target.
37
37
  */
38
38
  public get target(): string {
39
- return this.getAttributeNS(null, 'target') || '';
39
+ return this.getAttribute('target') || '';
40
40
  }
41
41
 
42
42
  /**
@@ -45,7 +45,7 @@ export default class HTMLBaseElement extends HTMLElement implements IHTMLBaseEle
45
45
  * @param target Target.
46
46
  */
47
47
  public set target(target: string) {
48
- this.setAttributeNS(null, 'target', target);
48
+ this.setAttribute('target', target);
49
49
  }
50
50
 
51
51
  /**
@@ -1,24 +1,54 @@
1
+ import Event from '../../event/Event';
2
+ import ValidityState from '../../validity-state/ValidityState';
3
+ import IAttr from '../attr/IAttr';
4
+ import IDocument from '../document/IDocument';
1
5
  import HTMLElement from '../html-element/HTMLElement';
6
+ import HTMLFormElement from '../html-form-element/HTMLFormElement';
7
+ import IHTMLFormElement from '../html-form-element/IHTMLFormElement';
8
+ import IHTMLLabelElement from '../html-label-element/IHTMLLabelElement';
9
+ import INode from '../node/INode';
10
+ import INodeList from '../node/INodeList';
11
+ import NodeList from '../node/NodeList';
12
+ import IShadowRoot from '../shadow-root/IShadowRoot';
2
13
  import IHTMLButtonElement from './IHTMLButtonElement';
3
14
 
4
15
  const BUTTON_TYPES = ['submit', 'reset', 'button', 'menu'];
5
16
 
6
17
  /**
7
-
8
- We can improve performance a bit if we make the types as a constant.
9
18
  * HTML Button Element.
10
19
  *
11
20
  * Reference:
12
21
  * https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement.
13
22
  */
14
23
  export default class HTMLButtonElement extends HTMLElement implements IHTMLButtonElement {
24
+ public readonly validationMessage = '';
25
+ public readonly validity = new ValidityState(this);
26
+
27
+ /**
28
+ * Returns name.
29
+ *
30
+ * @returns Name.
31
+ */
32
+ public get name(): string {
33
+ return this.getAttribute('name') || '';
34
+ }
35
+
36
+ /**
37
+ * Sets name.
38
+ *
39
+ * @param name Name.
40
+ */
41
+ public set name(name: string) {
42
+ this.setAttribute('name', name);
43
+ }
44
+
15
45
  /**
16
46
  * Returns value.
17
47
  *
18
48
  * @returns Value.
19
49
  */
20
50
  public get value(): string {
21
- return this.getAttributeNS(null, 'value');
51
+ return this.getAttribute('value');
22
52
  }
23
53
 
24
54
  /**
@@ -27,7 +57,7 @@ export default class HTMLButtonElement extends HTMLElement implements IHTMLButto
27
57
  * @param value Value.
28
58
  */
29
59
  public set value(value: string) {
30
- this.setAttributeNS(null, 'value', value);
60
+ this.setAttribute('value', value);
31
61
  }
32
62
 
33
63
  /**
@@ -36,7 +66,7 @@ export default class HTMLButtonElement extends HTMLElement implements IHTMLButto
36
66
  * @returns Disabled.
37
67
  */
38
68
  public get disabled(): boolean {
39
- return this.getAttributeNS(null, 'disabled') !== null;
69
+ return this.getAttribute('disabled') !== null;
40
70
  }
41
71
 
42
72
  /**
@@ -46,9 +76,9 @@ export default class HTMLButtonElement extends HTMLElement implements IHTMLButto
46
76
  */
47
77
  public set disabled(disabled: boolean) {
48
78
  if (!disabled) {
49
- this.removeAttributeNS(null, 'disabled');
79
+ this.removeAttribute('disabled');
50
80
  } else {
51
- this.setAttributeNS(null, 'disabled', '');
81
+ this.setAttribute('disabled', '');
52
82
  }
53
83
  }
54
84
 
@@ -58,7 +88,7 @@ export default class HTMLButtonElement extends HTMLElement implements IHTMLButto
58
88
  * @returns Type
59
89
  */
60
90
  public get type(): string {
61
- return this._sanitizeType(this.getAttributeNS(null, 'type'));
91
+ return this._sanitizeType(this.getAttribute('type'));
62
92
  }
63
93
 
64
94
  /**
@@ -67,12 +97,104 @@ export default class HTMLButtonElement extends HTMLElement implements IHTMLButto
67
97
  * @param v Type
68
98
  */
69
99
  public set type(v: string) {
70
- this.setAttributeNS(null, 'type', this._sanitizeType(v));
100
+ this.setAttribute('type', this._sanitizeType(v));
101
+ }
102
+
103
+ /**
104
+ * Returns no validate.
105
+ *
106
+ * @returns No validate.
107
+ */
108
+ public get formNoValidate(): boolean {
109
+ return this.getAttribute('formnovalidate') !== null;
110
+ }
111
+
112
+ /**
113
+ * Sets no validate.
114
+ *
115
+ * @param formNoValidate No validate.
116
+ */
117
+ public set formNoValidate(formNoValidate: boolean) {
118
+ if (!formNoValidate) {
119
+ this.removeAttribute('formnovalidate');
120
+ } else {
121
+ this.setAttribute('formnovalidate', '');
122
+ }
123
+ }
124
+
125
+ /**
126
+ * Returns the parent form element.
127
+ *
128
+ * @returns Form.
129
+ */
130
+ public get form(): IHTMLFormElement {
131
+ return <IHTMLFormElement>this._formNode;
132
+ }
133
+
134
+ /**
135
+ * Returns the associated label elements.
136
+ *
137
+ * @returns Label elements.
138
+ */
139
+ public get labels(): INodeList<IHTMLLabelElement> {
140
+ const id = this.id;
141
+ if (id) {
142
+ const rootNode = <IDocument | IShadowRoot>this.getRootNode();
143
+ const labels = rootNode.querySelectorAll(`label[for="${id}"]`);
144
+
145
+ let parent = this.parentNode;
146
+ while (parent) {
147
+ if (parent['tagName'] === 'LABEL') {
148
+ labels.push(<IHTMLLabelElement>parent);
149
+ break;
150
+ }
151
+ parent = parent.parentNode;
152
+ }
153
+
154
+ return <INodeList<IHTMLLabelElement>>labels;
155
+ }
156
+ return new NodeList<IHTMLLabelElement>();
157
+ }
158
+
159
+ /**
160
+ * Checks validity.
161
+ *
162
+ * @returns "true" if the field is valid.
163
+ */
164
+ public checkValidity(): boolean {
165
+ const valid =
166
+ this.disabled || this.type === 'reset' || this.type === 'button' || this.validity.valid;
167
+ if (!valid) {
168
+ this.dispatchEvent(new Event('invalid', { bubbles: true, cancelable: true }));
169
+ }
170
+ return valid;
171
+ }
172
+
173
+ /**
174
+ * Reports validity.
175
+ *
176
+ * @returns Validity.
177
+ */
178
+ public reportValidity(): boolean {
179
+ return this.checkValidity();
71
180
  }
72
181
 
73
182
  /**
183
+ * Sets validation message.
74
184
  *
75
- * @param type
185
+ * @param message Message.
186
+ */
187
+ public setCustomValidity(message: string): void {
188
+ (<string>this.validationMessage) = String(message);
189
+ }
190
+
191
+ /**
192
+ * Sanitizes type.
193
+ *
194
+ * TODO: We can improve performance a bit if we make the types as a constant.
195
+ *
196
+ * @param type Type.
197
+ * @returns Type sanitized.
76
198
  */
77
199
  protected _sanitizeType(type: string): string {
78
200
  type = (type && type.toLowerCase()) || 'submit';
@@ -83,4 +205,56 @@ export default class HTMLButtonElement extends HTMLElement implements IHTMLButto
83
205
 
84
206
  return type;
85
207
  }
208
+
209
+ /**
210
+ * @override
211
+ */
212
+ public override setAttributeNode(attribute: IAttr): IAttr {
213
+ const replacedAttribute = super.setAttributeNode(attribute);
214
+ const oldValue = replacedAttribute ? replacedAttribute.value : null;
215
+
216
+ if ((attribute.name === 'id' || attribute.name === 'name') && this._formNode) {
217
+ if (oldValue) {
218
+ (<HTMLFormElement>this._formNode)._removeFormControlItem(this, oldValue);
219
+ }
220
+ if (attribute.value) {
221
+ (<HTMLFormElement>this._formNode)._appendFormControlItem(this, attribute.value);
222
+ }
223
+ }
224
+
225
+ return replacedAttribute;
226
+ }
227
+
228
+ /**
229
+ * @override
230
+ */
231
+ public override removeAttributeNode(attribute: IAttr): IAttr {
232
+ super.removeAttributeNode(attribute);
233
+
234
+ if ((attribute.name === 'id' || attribute.name === 'name') && this._formNode) {
235
+ (<HTMLFormElement>this._formNode)._removeFormControlItem(this, attribute.value);
236
+ }
237
+
238
+ return attribute;
239
+ }
240
+
241
+ /**
242
+ * @override
243
+ */
244
+ public override _connectToNode(parentNode: INode = null): void {
245
+ const oldFormNode = <HTMLFormElement>this._formNode;
246
+
247
+ super._connectToNode(parentNode);
248
+
249
+ if (oldFormNode !== this._formNode) {
250
+ if (oldFormNode) {
251
+ oldFormNode._removeFormControlItem(this, this.name);
252
+ oldFormNode._removeFormControlItem(this, this.id);
253
+ }
254
+ if (this._formNode) {
255
+ (<HTMLFormElement>this._formNode)._appendFormControlItem(this, this.name);
256
+ (<HTMLFormElement>this._formNode)._appendFormControlItem(this, this.id);
257
+ }
258
+ }
259
+ }
86
260
  }
@@ -1,4 +1,7 @@
1
1
  import IHTMLElement from '../html-element/IHTMLElement';
2
+ import IHTMLFormElement from '../html-form-element/IHTMLFormElement';
3
+ import IHTMLLabelElement from '../html-label-element/IHTMLLabelElement';
4
+ import INodeList from '../node/INodeList';
2
5
 
3
6
  /**
4
7
  * HTML Button Element.
@@ -7,7 +10,33 @@ import IHTMLElement from '../html-element/IHTMLElement';
7
10
  * https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement.
8
11
  */
9
12
  export default interface IHTMLButtonElement extends IHTMLElement {
10
- type: string;
11
- disabled: boolean;
13
+ name: string;
12
14
  value: string;
15
+ disabled: boolean;
16
+ type: string;
17
+ formNoValidate: boolean;
18
+ readonly form: IHTMLFormElement;
19
+ readonly validationMessage: string;
20
+ readonly labels: INodeList<IHTMLLabelElement>;
21
+
22
+ /**
23
+ * Checks validity.
24
+ *
25
+ * @returns Validity.
26
+ */
27
+ checkValidity(): boolean;
28
+
29
+ /**
30
+ * Reports validity.
31
+ *
32
+ * @returns Validity.
33
+ */
34
+ reportValidity(): boolean;
35
+
36
+ /**
37
+ * Sets validation message.
38
+ *
39
+ * @param message Message.
40
+ */
41
+ setCustomValidity(message: string): void;
13
42
  }
@@ -30,7 +30,7 @@ export default class HTMLDialogElement extends HTMLElement implements IHTMLDialo
30
30
  * @param [returnValue] ReturnValue.
31
31
  */
32
32
  public close(returnValue = ''): void {
33
- this.removeAttributeNS(null, 'open');
33
+ this.removeAttribute('open');
34
34
  this.returnValue = returnValue;
35
35
  this.dispatchEvent(new Event('close'));
36
36
  }
@@ -39,13 +39,13 @@ export default class HTMLDialogElement extends HTMLElement implements IHTMLDialo
39
39
  * Shows the modal.
40
40
  */
41
41
  public showModal(): void {
42
- this.setAttributeNS(null, 'open', '');
42
+ this.setAttribute('open', '');
43
43
  }
44
44
 
45
45
  /**
46
46
  * Shows the dialog.
47
47
  */
48
48
  public show(): void {
49
- this.setAttributeNS(null, 'open', '');
49
+ this.setAttribute('open', '');
50
50
  }
51
51
  }