happy-dom 8.8.0 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of happy-dom might be problematic. Click here for more details.

Files changed (364) hide show
  1. package/README.md +2 -2
  2. package/lib/cookie/CookieJar.js +1 -1
  3. package/lib/cookie/CookieJar.js.map +1 -1
  4. package/lib/dom-token-list/DOMTokenList.js +24 -20
  5. package/lib/dom-token-list/DOMTokenList.js.map +1 -1
  6. package/lib/event/EventTarget.js +6 -3
  7. package/lib/event/EventTarget.js.map +1 -1
  8. package/lib/exception/DOMExceptionNameEnum.d.ts +5 -1
  9. package/lib/exception/DOMExceptionNameEnum.js +4 -0
  10. package/lib/exception/DOMExceptionNameEnum.js.map +1 -1
  11. package/lib/fetch/AbortController.d.ts +19 -0
  12. package/lib/fetch/AbortController.js +30 -0
  13. package/lib/fetch/AbortController.js.map +1 -0
  14. package/lib/fetch/AbortSignal.d.ts +25 -0
  15. package/lib/fetch/AbortSignal.js +51 -0
  16. package/lib/fetch/AbortSignal.js.map +1 -0
  17. package/lib/fetch/Fetch.d.ts +117 -0
  18. package/lib/fetch/Fetch.js +530 -0
  19. package/lib/fetch/Fetch.js.map +1 -0
  20. package/lib/fetch/Headers.d.ts +81 -3
  21. package/lib/fetch/Headers.js +139 -24
  22. package/lib/fetch/Headers.js.map +1 -1
  23. package/lib/fetch/Request.d.ts +56 -32
  24. package/lib/fetch/Request.js +165 -110
  25. package/lib/fetch/Request.js.map +1 -1
  26. package/lib/fetch/{ResourceFetchHandler.d.ts → ResourceFetch.d.ts} +1 -1
  27. package/lib/fetch/{ResourceFetchHandler.js → ResourceFetch.js} +5 -5
  28. package/lib/fetch/ResourceFetch.js.map +1 -0
  29. package/lib/fetch/Response.d.ts +60 -26
  30. package/lib/fetch/Response.js +196 -104
  31. package/lib/fetch/Response.js.map +1 -1
  32. package/lib/fetch/data-uri/DataURIParser.d.ts +20 -0
  33. package/lib/fetch/data-uri/DataURIParser.js +60 -0
  34. package/lib/fetch/data-uri/DataURIParser.js.map +1 -0
  35. package/lib/fetch/multipart/MultipartFormDataParser.d.ts +40 -0
  36. package/lib/fetch/multipart/MultipartFormDataParser.js +81 -0
  37. package/lib/fetch/multipart/MultipartFormDataParser.js.map +1 -0
  38. package/lib/fetch/multipart/MultipartReader.d.ts +49 -0
  39. package/lib/fetch/multipart/MultipartReader.js +178 -0
  40. package/lib/fetch/multipart/MultipartReader.js.map +1 -0
  41. package/lib/fetch/types/IHeaders.d.ts +71 -0
  42. package/lib/fetch/{IHeaders.js.map → types/IHeaders.js.map} +1 -1
  43. package/lib/fetch/types/IHeadersInit.js.map +1 -0
  44. package/lib/fetch/types/IRequest.d.ts +60 -0
  45. package/lib/fetch/{IRequest.js.map → types/IRequest.js.map} +1 -1
  46. package/lib/fetch/types/IRequestBody.d.ts +7 -0
  47. package/lib/fetch/{IBody.js → types/IRequestBody.js} +1 -1
  48. package/lib/fetch/types/IRequestBody.js.map +1 -0
  49. package/lib/fetch/types/IRequestCredentials.d.ts +2 -0
  50. package/lib/fetch/types/IRequestCredentials.js +3 -0
  51. package/lib/fetch/types/IRequestCredentials.js.map +1 -0
  52. package/lib/fetch/{RequestInfo.d.ts → types/IRequestInfo.d.ts} +2 -2
  53. package/lib/fetch/types/IRequestInfo.js +3 -0
  54. package/lib/fetch/types/IRequestInfo.js.map +1 -0
  55. package/lib/fetch/types/IRequestInit.d.ts +21 -0
  56. package/lib/fetch/types/IRequestInit.js.map +1 -0
  57. package/lib/fetch/types/IRequestRedirect.d.ts +2 -0
  58. package/lib/fetch/types/IRequestRedirect.js +3 -0
  59. package/lib/fetch/types/IRequestRedirect.js.map +1 -0
  60. package/lib/fetch/types/IRequestReferrerPolicy.d.ts +2 -0
  61. package/lib/fetch/types/IRequestReferrerPolicy.js +3 -0
  62. package/lib/fetch/types/IRequestReferrerPolicy.js.map +1 -0
  63. package/lib/fetch/types/IResponse.d.ts +27 -0
  64. package/lib/fetch/{IResponse.js.map → types/IResponse.js.map} +1 -1
  65. package/lib/fetch/types/IResponseBody.d.ts +7 -0
  66. package/lib/fetch/types/IResponseBody.js +3 -0
  67. package/lib/fetch/types/IResponseBody.js.map +1 -0
  68. package/lib/fetch/types/IResponseInit.d.ts +9 -0
  69. package/lib/fetch/types/IResponseInit.js.map +1 -0
  70. package/lib/fetch/utilities/FetchBodyUtility.d.ts +44 -0
  71. package/lib/fetch/utilities/FetchBodyUtility.js +156 -0
  72. package/lib/fetch/utilities/FetchBodyUtility.js.map +1 -0
  73. package/lib/fetch/utilities/FetchCORSUtility.d.ts +12 -0
  74. package/lib/fetch/utilities/FetchCORSUtility.js +20 -0
  75. package/lib/fetch/utilities/FetchCORSUtility.js.map +1 -0
  76. package/lib/fetch/utilities/FetchRequestHeaderUtility.d.ts +12 -0
  77. package/lib/fetch/utilities/FetchRequestHeaderUtility.js +45 -0
  78. package/lib/fetch/utilities/FetchRequestHeaderUtility.js.map +1 -0
  79. package/lib/fetch/utilities/FetchRequestReferrerUtility.d.ts +55 -0
  80. package/lib/fetch/utilities/FetchRequestReferrerUtility.js +194 -0
  81. package/lib/fetch/utilities/FetchRequestReferrerUtility.js.map +1 -0
  82. package/lib/fetch/utilities/FetchRequestValidationUtility.d.ts +38 -0
  83. package/lib/fetch/utilities/FetchRequestValidationUtility.js +70 -0
  84. package/lib/fetch/utilities/FetchRequestValidationUtility.js.map +1 -0
  85. package/lib/file/Blob.d.ts +2 -2
  86. package/lib/file/Blob.js +1 -1
  87. package/lib/file/Blob.js.map +1 -1
  88. package/lib/file/File.d.ts +2 -1
  89. package/lib/file/File.js.map +1 -1
  90. package/lib/form-data/FormData.d.ts +98 -0
  91. package/lib/form-data/FormData.js +212 -0
  92. package/lib/form-data/FormData.js.map +1 -0
  93. package/lib/index.d.ts +14 -1
  94. package/lib/index.js +20 -2
  95. package/lib/index.js.map +1 -1
  96. package/lib/nodes/document/Document.d.ts +5 -17
  97. package/lib/nodes/document/Document.js +11 -54
  98. package/lib/nodes/document/Document.js.map +1 -1
  99. package/lib/nodes/document/IDocument.d.ts +1 -1
  100. package/lib/nodes/document-fragment/DocumentFragment.d.ts +3 -14
  101. package/lib/nodes/document-fragment/DocumentFragment.js +7 -51
  102. package/lib/nodes/document-fragment/DocumentFragment.js.map +1 -1
  103. package/lib/nodes/document-fragment/IDocumentFragment.d.ts +2 -1
  104. package/lib/nodes/element/Element.d.ts +8 -8
  105. package/lib/nodes/element/Element.js +28 -45
  106. package/lib/nodes/element/Element.js.map +1 -1
  107. package/lib/nodes/element/ElementUtility.d.ts +32 -0
  108. package/lib/nodes/element/ElementUtility.js +105 -0
  109. package/lib/nodes/element/ElementUtility.js.map +1 -0
  110. package/lib/nodes/element/HTMLCollection.d.ts +26 -3
  111. package/lib/nodes/element/HTMLCollection.js +51 -0
  112. package/lib/nodes/element/HTMLCollection.js.map +1 -1
  113. package/lib/nodes/element/IHTMLCollection.d.ts +9 -2
  114. package/lib/nodes/html-anchor-element/HTMLAnchorElement.js +24 -24
  115. package/lib/nodes/html-anchor-element/HTMLAnchorElement.js.map +1 -1
  116. package/lib/nodes/html-audio-element/Audio.d.ts +15 -0
  117. package/lib/nodes/html-audio-element/Audio.js +27 -0
  118. package/lib/nodes/html-audio-element/Audio.js.map +1 -0
  119. package/lib/nodes/html-base-element/HTMLBaseElement.js +4 -4
  120. package/lib/nodes/html-base-element/HTMLBaseElement.js.map +1 -1
  121. package/lib/nodes/html-button-element/HTMLButtonElement.d.ts +79 -3
  122. package/lib/nodes/html-button-element/HTMLButtonElement.js +158 -10
  123. package/lib/nodes/html-button-element/HTMLButtonElement.js.map +1 -1
  124. package/lib/nodes/html-button-element/IHTMLButtonElement.d.ts +28 -2
  125. package/lib/nodes/html-dialog-element/HTMLDialogElement.js +3 -3
  126. package/lib/nodes/html-dialog-element/HTMLDialogElement.js.map +1 -1
  127. package/lib/nodes/html-element/HTMLElement.js +12 -12
  128. package/lib/nodes/html-element/HTMLElement.js.map +1 -1
  129. package/lib/nodes/html-form-element/HTMLFormControlsCollection.d.ts +32 -0
  130. package/lib/nodes/html-form-element/HTMLFormControlsCollection.js +58 -0
  131. package/lib/nodes/html-form-element/HTMLFormControlsCollection.js.map +1 -0
  132. package/lib/nodes/html-form-element/HTMLFormElement.d.ts +37 -17
  133. package/lib/nodes/html-form-element/HTMLFormElement.js +128 -37
  134. package/lib/nodes/html-form-element/HTMLFormElement.js.map +1 -1
  135. package/lib/nodes/html-form-element/IHTMLFormControlsCollection.d.ts +25 -0
  136. package/lib/nodes/html-form-element/IHTMLFormControlsCollection.js +3 -0
  137. package/lib/nodes/html-form-element/IHTMLFormControlsCollection.js.map +1 -0
  138. package/lib/nodes/html-form-element/IHTMLFormElement.d.ts +16 -6
  139. package/lib/nodes/html-form-element/IRadioNodeList.d.ts +15 -0
  140. package/lib/nodes/html-form-element/IRadioNodeList.js +3 -0
  141. package/lib/nodes/html-form-element/IRadioNodeList.js.map +1 -0
  142. package/lib/nodes/html-form-element/RadioNodeList.d.ts +16 -0
  143. package/lib/nodes/html-form-element/RadioNodeList.js +28 -0
  144. package/lib/nodes/html-form-element/RadioNodeList.js.map +1 -0
  145. package/lib/nodes/html-image-element/HTMLImageElement.js +19 -19
  146. package/lib/nodes/html-image-element/HTMLImageElement.js.map +1 -1
  147. package/lib/nodes/html-input-element/HTMLInputElement.d.ts +43 -19
  148. package/lib/nodes/html-input-element/HTMLInputElement.js +206 -111
  149. package/lib/nodes/html-input-element/HTMLInputElement.js.map +1 -1
  150. package/lib/nodes/html-input-element/IHTMLInputElement.d.ts +14 -1
  151. package/lib/nodes/html-label-element/HTMLLabelElement.js +3 -7
  152. package/lib/nodes/html-label-element/HTMLLabelElement.js.map +1 -1
  153. package/lib/nodes/html-link-element/HTMLLinkElement.js +21 -21
  154. package/lib/nodes/html-link-element/HTMLLinkElement.js.map +1 -1
  155. package/lib/nodes/html-media-element/HTMLMediaElement.js +21 -21
  156. package/lib/nodes/html-media-element/HTMLMediaElement.js.map +1 -1
  157. package/lib/nodes/html-meta-element/HTMLMetaElement.js +8 -8
  158. package/lib/nodes/html-meta-element/HTMLMetaElement.js.map +1 -1
  159. package/lib/nodes/html-opt-group-element/HTMLOptGroupElement.js +6 -6
  160. package/lib/nodes/html-opt-group-element/HTMLOptGroupElement.js.map +1 -1
  161. package/lib/nodes/html-option-element/HTMLOptionElement.d.ts +3 -4
  162. package/lib/nodes/html-option-element/HTMLOptionElement.js +26 -29
  163. package/lib/nodes/html-option-element/HTMLOptionElement.js.map +1 -1
  164. package/lib/nodes/html-script-element/HTMLScriptElement.js +16 -16
  165. package/lib/nodes/html-script-element/HTMLScriptElement.js.map +1 -1
  166. package/lib/nodes/html-script-element/ScriptUtility.js +5 -5
  167. package/lib/nodes/html-script-element/ScriptUtility.js.map +1 -1
  168. package/lib/nodes/{html-option-element → html-select-element}/HTMLOptionsCollection.d.ts +5 -6
  169. package/lib/nodes/{html-option-element → html-select-element}/HTMLOptionsCollection.js.map +1 -1
  170. package/lib/nodes/html-select-element/HTMLSelectElement.d.ts +42 -41
  171. package/lib/nodes/html-select-element/HTMLSelectElement.js +134 -138
  172. package/lib/nodes/html-select-element/HTMLSelectElement.js.map +1 -1
  173. package/lib/nodes/{html-option-element → html-select-element}/IHTMLOptionsCollection.d.ts +4 -5
  174. package/lib/nodes/html-select-element/IHTMLOptionsCollection.js.map +1 -0
  175. package/lib/nodes/html-select-element/IHTMLSelectElement.d.ts +22 -2
  176. package/lib/nodes/html-slot-element/HTMLSlotElement.js +2 -2
  177. package/lib/nodes/html-slot-element/HTMLSlotElement.js.map +1 -1
  178. package/lib/nodes/html-style-element/HTMLStyleElement.js +7 -7
  179. package/lib/nodes/html-style-element/HTMLStyleElement.js.map +1 -1
  180. package/lib/nodes/html-text-area-element/HTMLTextAreaElement.d.ts +55 -2
  181. package/lib/nodes/html-text-area-element/HTMLTextAreaElement.js +150 -40
  182. package/lib/nodes/html-text-area-element/HTMLTextAreaElement.js.map +1 -1
  183. package/lib/nodes/html-text-area-element/IHTMLTextAreaElement.d.ts +16 -0
  184. package/lib/nodes/node/Node.d.ts +12 -1
  185. package/lib/nodes/node/Node.js +50 -4
  186. package/lib/nodes/node/Node.js.map +1 -1
  187. package/lib/nodes/node/NodeList.d.ts +2 -3
  188. package/lib/nodes/node/NodeList.js.map +1 -1
  189. package/lib/nodes/parent-node/IParentNode.d.ts +4 -4
  190. package/lib/nodes/parent-node/ParentNodeUtility.d.ts +3 -3
  191. package/lib/nodes/parent-node/ParentNodeUtility.js +13 -11
  192. package/lib/nodes/parent-node/ParentNodeUtility.js.map +1 -1
  193. package/lib/nodes/text/Text.d.ts +13 -0
  194. package/lib/nodes/text/Text.js +30 -0
  195. package/lib/nodes/text/Text.js.map +1 -1
  196. package/lib/query-selector/QuerySelector.js +2 -2
  197. package/lib/query-selector/QuerySelector.js.map +1 -1
  198. package/lib/query-selector/SelectorItem.js +2 -0
  199. package/lib/query-selector/SelectorItem.js.map +1 -1
  200. package/lib/validity-state/ValidityState.d.ts +87 -0
  201. package/lib/validity-state/ValidityState.js +171 -0
  202. package/lib/validity-state/ValidityState.js.map +1 -0
  203. package/lib/window/GlobalWindow.d.ts +0 -8
  204. package/lib/window/GlobalWindow.js +0 -2
  205. package/lib/window/GlobalWindow.js.map +1 -1
  206. package/lib/window/INodeJSGlobal.d.ts +71 -0
  207. package/lib/window/INodeJSGlobal.js +2 -0
  208. package/lib/window/INodeJSGlobal.js.map +1 -0
  209. package/lib/window/IWindow.d.ts +30 -10
  210. package/lib/window/Window.d.ts +37 -20
  211. package/lib/window/Window.js +22 -10
  212. package/lib/window/Window.js.map +1 -1
  213. package/lib/xml-http-request/XMLHttpRequest.js +20 -12
  214. package/lib/xml-http-request/XMLHttpRequest.js.map +1 -1
  215. package/lib/xml-parser/XMLParser.js +1 -1
  216. package/lib/xml-parser/XMLParser.js.map +1 -1
  217. package/package.json +2 -3
  218. package/src/cookie/CookieJar.ts +1 -1
  219. package/src/dom-token-list/DOMTokenList.ts +24 -20
  220. package/src/event/EventTarget.ts +7 -3
  221. package/src/exception/DOMExceptionNameEnum.ts +5 -1
  222. package/src/fetch/AbortController.ts +26 -0
  223. package/src/fetch/AbortSignal.ts +44 -0
  224. package/src/fetch/Fetch.ts +666 -0
  225. package/src/fetch/Headers.ts +151 -3
  226. package/src/fetch/Request.ts +226 -94
  227. package/src/fetch/{ResourceFetchHandler.ts → ResourceFetch.ts} +3 -3
  228. package/src/fetch/Response.ts +252 -89
  229. package/src/fetch/data-uri/DataURIParser.ts +66 -0
  230. package/src/fetch/multipart/MultipartFormDataParser.ts +113 -0
  231. package/src/fetch/multipart/MultipartReader.ts +217 -0
  232. package/src/fetch/types/IHeaders.ts +80 -0
  233. package/src/fetch/types/IRequest.ts +65 -0
  234. package/src/fetch/types/IRequestBody.ts +15 -0
  235. package/src/fetch/types/IRequestCredentials.ts +2 -0
  236. package/src/fetch/types/IRequestInfo.ts +6 -0
  237. package/src/fetch/types/IRequestInit.ts +21 -0
  238. package/src/fetch/types/IRequestRedirect.ts +3 -0
  239. package/src/fetch/types/IRequestReferrerPolicy.ts +11 -0
  240. package/src/fetch/types/IResponse.ts +27 -0
  241. package/src/fetch/types/IResponseBody.ts +15 -0
  242. package/src/fetch/types/IResponseInit.ts +10 -0
  243. package/src/fetch/utilities/FetchBodyUtility.ts +175 -0
  244. package/src/fetch/utilities/FetchCORSUtility.ts +18 -0
  245. package/src/fetch/utilities/FetchRequestHeaderUtility.ts +47 -0
  246. package/src/fetch/utilities/FetchRequestReferrerUtility.ts +241 -0
  247. package/src/fetch/utilities/FetchRequestValidationUtility.ts +82 -0
  248. package/src/file/Blob.ts +2 -2
  249. package/src/file/File.ts +5 -1
  250. package/src/form-data/FormData.ts +237 -0
  251. package/src/index.ts +27 -1
  252. package/src/nodes/document/Document.ts +23 -64
  253. package/src/nodes/document/IDocument.ts +1 -1
  254. package/src/nodes/document-fragment/DocumentFragment.ts +9 -59
  255. package/src/nodes/document-fragment/IDocumentFragment.ts +2 -1
  256. package/src/nodes/element/Element.ts +43 -56
  257. package/src/nodes/element/ElementUtility.ts +137 -0
  258. package/src/nodes/element/HTMLCollection.ts +60 -3
  259. package/src/nodes/element/IHTMLCollection.ts +10 -2
  260. package/src/nodes/html-anchor-element/HTMLAnchorElement.ts +24 -24
  261. package/src/nodes/html-audio-element/Audio.ts +22 -0
  262. package/src/nodes/html-base-element/HTMLBaseElement.ts +4 -4
  263. package/src/nodes/html-button-element/HTMLButtonElement.ts +184 -10
  264. package/src/nodes/html-button-element/IHTMLButtonElement.ts +31 -2
  265. package/src/nodes/html-dialog-element/HTMLDialogElement.ts +3 -3
  266. package/src/nodes/html-element/HTMLElement.ts +12 -12
  267. package/src/nodes/html-form-element/HTMLFormControlsCollection.ts +76 -0
  268. package/src/nodes/html-form-element/HTMLFormElement.ts +147 -41
  269. package/src/nodes/html-form-element/IHTMLFormControlsCollection.ts +45 -0
  270. package/src/nodes/html-form-element/IHTMLFormElement.ts +17 -6
  271. package/src/nodes/html-form-element/IRadioNodeList.ts +16 -0
  272. package/src/nodes/html-form-element/RadioNodeList.ts +24 -0
  273. package/src/nodes/html-image-element/HTMLImageElement.ts +19 -19
  274. package/src/nodes/html-input-element/HTMLInputElement.ts +232 -113
  275. package/src/nodes/html-input-element/IHTMLInputElement.ts +20 -1
  276. package/src/nodes/html-label-element/HTMLLabelElement.ts +3 -7
  277. package/src/nodes/html-link-element/HTMLLinkElement.ts +21 -21
  278. package/src/nodes/html-media-element/HTMLMediaElement.ts +21 -21
  279. package/src/nodes/html-meta-element/HTMLMetaElement.ts +8 -8
  280. package/src/nodes/html-opt-group-element/HTMLOptGroupElement.ts +6 -6
  281. package/src/nodes/html-option-element/HTMLOptionElement.ts +29 -30
  282. package/src/nodes/html-script-element/HTMLScriptElement.ts +16 -16
  283. package/src/nodes/html-script-element/ScriptUtility.ts +5 -5
  284. package/src/nodes/{html-option-element → html-select-element}/HTMLOptionsCollection.ts +5 -9
  285. package/src/nodes/html-select-element/HTMLSelectElement.ts +159 -170
  286. package/src/nodes/{html-option-element → html-select-element}/IHTMLOptionsCollection.ts +4 -8
  287. package/src/nodes/html-select-element/IHTMLSelectElement.ts +25 -2
  288. package/src/nodes/html-slot-element/HTMLSlotElement.ts +2 -2
  289. package/src/nodes/html-style-element/HTMLStyleElement.ts +7 -7
  290. package/src/nodes/html-text-area-element/HTMLTextAreaElement.ts +174 -41
  291. package/src/nodes/html-text-area-element/IHTMLTextAreaElement.ts +18 -0
  292. package/src/nodes/node/Node.ts +61 -6
  293. package/src/nodes/node/NodeList.ts +2 -3
  294. package/src/nodes/parent-node/IParentNode.ts +7 -4
  295. package/src/nodes/parent-node/ParentNodeUtility.ts +25 -15
  296. package/src/nodes/text/Text.ts +38 -0
  297. package/src/query-selector/QuerySelector.ts +2 -2
  298. package/src/query-selector/SelectorItem.ts +3 -0
  299. package/src/validity-state/ValidityState.ts +211 -0
  300. package/src/window/GlobalWindow.ts +0 -2
  301. package/src/window/INodeJSGlobal.ts +70 -0
  302. package/src/window/IWindow.ts +32 -10
  303. package/src/window/Window.ts +43 -21
  304. package/src/xml-http-request/XMLHttpRequest.ts +27 -26
  305. package/src/xml-parser/XMLParser.ts +1 -1
  306. package/lib/fetch/FetchHandler.d.ts +0 -18
  307. package/lib/fetch/FetchHandler.js +0 -83
  308. package/lib/fetch/FetchHandler.js.map +0 -1
  309. package/lib/fetch/IAbortSignal.d.ts +0 -16
  310. package/lib/fetch/IAbortSignal.js +0 -4
  311. package/lib/fetch/IAbortSignal.js.map +0 -1
  312. package/lib/fetch/IBody.d.ts +0 -17
  313. package/lib/fetch/IBody.js.map +0 -1
  314. package/lib/fetch/IHeaders.d.ts +0 -18
  315. package/lib/fetch/IHeadersInit.js.map +0 -1
  316. package/lib/fetch/IRequest.d.ts +0 -18
  317. package/lib/fetch/IRequestInit.d.ts +0 -16
  318. package/lib/fetch/IRequestInit.js.map +0 -1
  319. package/lib/fetch/IResponse.d.ts +0 -20
  320. package/lib/fetch/IResponseInit.d.ts +0 -9
  321. package/lib/fetch/IResponseInit.js.map +0 -1
  322. package/lib/fetch/RequestInfo.js +0 -3
  323. package/lib/fetch/RequestInfo.js.map +0 -1
  324. package/lib/fetch/ResourceFetchHandler.js.map +0 -1
  325. package/lib/form-data/IFormData.d.ts +0 -32
  326. package/lib/form-data/IFormData.js +0 -3
  327. package/lib/form-data/IFormData.js.map +0 -1
  328. package/lib/location/RelativeURL.d.ts +0 -15
  329. package/lib/location/RelativeURL.js +0 -19
  330. package/lib/location/RelativeURL.js.map +0 -1
  331. package/lib/nodes/element/HTMLCollectionFactory.d.ts +0 -21
  332. package/lib/nodes/element/HTMLCollectionFactory.js +0 -31
  333. package/lib/nodes/element/HTMLCollectionFactory.js.map +0 -1
  334. package/lib/nodes/html-option-element/IHTMLOptionsCollection.js.map +0 -1
  335. package/lib/nodes/node/NodeListFactory.d.ts +0 -21
  336. package/lib/nodes/node/NodeListFactory.js +0 -31
  337. package/lib/nodes/node/NodeListFactory.js.map +0 -1
  338. package/lib/nodes/validity-state/ValidityState.d.ts +0 -52
  339. package/lib/nodes/validity-state/ValidityState.js +0 -81
  340. package/lib/nodes/validity-state/ValidityState.js.map +0 -1
  341. package/src/fetch/FetchHandler.ts +0 -90
  342. package/src/fetch/IAbortSignal.ts +0 -34
  343. package/src/fetch/IBody.ts +0 -18
  344. package/src/fetch/IHeaders.ts +0 -18
  345. package/src/fetch/IRequest.ts +0 -59
  346. package/src/fetch/IRequestInit.ts +0 -41
  347. package/src/fetch/IResponse.ts +0 -22
  348. package/src/fetch/IResponseInit.ts +0 -10
  349. package/src/fetch/RequestInfo.ts +0 -6
  350. package/src/form-data/IFormData.ts +0 -33
  351. package/src/location/RelativeURL.ts +0 -17
  352. package/src/nodes/element/HTMLCollectionFactory.ts +0 -31
  353. package/src/nodes/node/NodeListFactory.ts +0 -31
  354. package/src/nodes/validity-state/ValidityState.ts +0 -84
  355. /package/lib/fetch/{IHeaders.js → types/IHeaders.js} +0 -0
  356. /package/lib/fetch/{IHeadersInit.d.ts → types/IHeadersInit.d.ts} +0 -0
  357. /package/lib/fetch/{IHeadersInit.js → types/IHeadersInit.js} +0 -0
  358. /package/lib/fetch/{IRequest.js → types/IRequest.js} +0 -0
  359. /package/lib/fetch/{IRequestInit.js → types/IRequestInit.js} +0 -0
  360. /package/lib/fetch/{IResponse.js → types/IResponse.js} +0 -0
  361. /package/lib/fetch/{IResponseInit.js → types/IResponseInit.js} +0 -0
  362. /package/lib/nodes/{html-option-element → html-select-element}/HTMLOptionsCollection.js +0 -0
  363. /package/lib/nodes/{html-option-element → html-select-element}/IHTMLOptionsCollection.js +0 -0
  364. /package/src/fetch/{IHeadersInit.ts → types/IHeadersInit.ts} +0 -0
@@ -1,5 +1,5 @@
1
1
  import HTMLElement from '../html-element/HTMLElement';
2
- import ValidityState from '../validity-state/ValidityState';
2
+ import ValidityState from '../../validity-state/ValidityState';
3
3
  import DOMException from '../../exception/DOMException';
4
4
  import DOMExceptionNameEnum from '../../exception/DOMExceptionNameEnum';
5
5
  import Event from '../../event/Event';
@@ -13,6 +13,14 @@ import HTMLInputElementValueStepping from './HTMLInputElementValueStepping';
13
13
  import FileList from './FileList';
14
14
  import File from '../../file/File';
15
15
  import IFileList from './IFileList';
16
+ import IAttr from '../attr/IAttr';
17
+ import INode from '../node/INode';
18
+ import HTMLFormElement from '../html-form-element/HTMLFormElement';
19
+ import INodeList from '../node/INodeList';
20
+ import IHTMLLabelElement from '../html-label-element/IHTMLLabelElement';
21
+ import IDocument from '../document/IDocument';
22
+ import IShadowRoot from '../shadow-root/IShadowRoot';
23
+ import NodeList from '../node/NodeList';
16
24
 
17
25
  /**
18
26
  * HTML Input Element.
@@ -27,7 +35,6 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
27
35
  // Related to parent form.
28
36
  public formAction = '';
29
37
  public formMethod = '';
30
- public formNoValidate = false;
31
38
 
32
39
  // Any type of input
33
40
  public _value = null;
@@ -36,10 +43,15 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
36
43
 
37
44
  // Type specific: checkbox/radio
38
45
  public defaultChecked = false;
46
+ public _checked: boolean | null = null;
39
47
 
40
48
  // Type specific: file
41
49
  public files: IFileList<File> = new FileList();
42
50
 
51
+ // All fields
52
+ public readonly validationMessage = '';
53
+ public readonly validity = new ValidityState(this);
54
+
43
55
  // Events
44
56
  public oninput: (event: Event) => void | null = null;
45
57
  public oninvalid: (event: Event) => void | null = null;
@@ -50,7 +62,6 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
50
62
  private _selectionEnd: number = null;
51
63
  private _selectionDirection: HTMLInputElementSelectionDirectionEnum =
52
64
  HTMLInputElementSelectionDirectionEnum.none;
53
- private _validationMessage = '';
54
65
 
55
66
  /**
56
67
  * Returns height.
@@ -68,7 +79,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
68
79
  */
69
80
  public set height(height: number) {
70
81
  this._height = height;
71
- this.setAttributeNS(null, 'height', String(height));
82
+ this.setAttribute('height', String(height));
72
83
  }
73
84
 
74
85
  /**
@@ -87,7 +98,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
87
98
  */
88
99
  public set width(width: number) {
89
100
  this._width = width;
90
- this.setAttributeNS(null, 'width', String(width));
101
+ this.setAttribute('width', String(width));
91
102
  }
92
103
 
93
104
  /**
@@ -96,7 +107,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
96
107
  * @returns Size.
97
108
  */
98
109
  public get size(): number {
99
- const size = this.getAttributeNS(null, 'size');
110
+ const size = this.getAttribute('size');
100
111
  if (size !== null) {
101
112
  return parseInt(size);
102
113
  }
@@ -109,7 +120,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
109
120
  * @param size Size.
110
121
  */
111
122
  public set size(size: number) {
112
- this.setAttributeNS(null, 'size', String(size));
123
+ this.setAttribute('size', String(size));
113
124
  }
114
125
 
115
126
  /**
@@ -118,7 +129,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
118
129
  * @returns Min length.
119
130
  */
120
131
  public get minLength(): number {
121
- const minLength = this.getAttributeNS(null, 'minlength');
132
+ const minLength = this.getAttribute('minlength');
122
133
  if (minLength !== null) {
123
134
  return parseInt(minLength);
124
135
  }
@@ -131,7 +142,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
131
142
  * @param minLength Min length.
132
143
  */
133
144
  public set minLength(minlength: number) {
134
- this.setAttributeNS(null, 'minlength', String(minlength));
145
+ this.setAttribute('minlength', String(minlength));
135
146
  }
136
147
 
137
148
  /**
@@ -140,7 +151,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
140
151
  * @returns Max length.
141
152
  */
142
153
  public get maxLength(): number {
143
- const maxLength = this.getAttributeNS(null, 'maxlength');
154
+ const maxLength = this.getAttribute('maxlength');
144
155
  if (maxLength !== null) {
145
156
  return parseInt(maxLength);
146
157
  }
@@ -153,7 +164,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
153
164
  * @param maxlength Max length.
154
165
  */
155
166
  public set maxLength(maxLength: number) {
156
- this.setAttributeNS(null, 'maxlength', String(maxLength));
167
+ this.setAttribute('maxlength', String(maxLength));
157
168
  }
158
169
 
159
170
  /**
@@ -162,7 +173,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
162
173
  * @returns Type. Defaults to "text".
163
174
  */
164
175
  public get type(): string {
165
- return this.getAttributeNS(null, 'type') || 'text';
176
+ return this.getAttribute('type') || 'text';
166
177
  }
167
178
 
168
179
  /**
@@ -171,7 +182,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
171
182
  * @param type Type.
172
183
  */
173
184
  public set type(type: string) {
174
- this.setAttributeNS(null, 'type', type.toLowerCase());
185
+ this.setAttribute('type', type.toLowerCase());
175
186
  }
176
187
 
177
188
  /**
@@ -180,7 +191,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
180
191
  * @returns Name.
181
192
  */
182
193
  public get name(): string {
183
- return this.getAttributeNS(null, 'name') || '';
194
+ return this.getAttribute('name') || '';
184
195
  }
185
196
 
186
197
  /**
@@ -189,7 +200,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
189
200
  * @param name Name.
190
201
  */
191
202
  public set name(name: string) {
192
- this.setAttributeNS(null, 'name', name);
203
+ this.setAttribute('name', name);
193
204
  }
194
205
 
195
206
  /**
@@ -198,7 +209,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
198
209
  * @returns Alt.
199
210
  */
200
211
  public get alt(): string {
201
- return this.getAttributeNS(null, 'alt') || '';
212
+ return this.getAttribute('alt') || '';
202
213
  }
203
214
 
204
215
  /**
@@ -207,7 +218,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
207
218
  * @param alt Alt.
208
219
  */
209
220
  public set alt(alt: string) {
210
- this.setAttributeNS(null, 'alt', alt);
221
+ this.setAttribute('alt', alt);
211
222
  }
212
223
 
213
224
  /**
@@ -216,7 +227,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
216
227
  * @returns Min.
217
228
  */
218
229
  public get min(): string {
219
- return this.getAttributeNS(null, 'min') || '';
230
+ return this.getAttribute('min') || '';
220
231
  }
221
232
 
222
233
  /**
@@ -225,7 +236,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
225
236
  * @param min Min.
226
237
  */
227
238
  public set min(min: string) {
228
- this.setAttributeNS(null, 'min', min);
239
+ this.setAttribute('min', min);
229
240
  }
230
241
 
231
242
  /**
@@ -234,7 +245,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
234
245
  * @returns Max.
235
246
  */
236
247
  public get max(): string {
237
- return this.getAttributeNS(null, 'max') || '';
248
+ return this.getAttribute('max') || '';
238
249
  }
239
250
 
240
251
  /**
@@ -243,7 +254,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
243
254
  * @param max Max.
244
255
  */
245
256
  public set max(max: string) {
246
- this.setAttributeNS(null, 'max', max);
257
+ this.setAttribute('max', max);
247
258
  }
248
259
 
249
260
  /**
@@ -252,7 +263,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
252
263
  * @returns Pattern.
253
264
  */
254
265
  public get pattern(): string {
255
- return this.getAttributeNS(null, 'pattern') || '';
266
+ return this.getAttribute('pattern') || '';
256
267
  }
257
268
 
258
269
  /**
@@ -261,7 +272,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
261
272
  * @param pattern Pattern.
262
273
  */
263
274
  public set pattern(pattern: string) {
264
- this.setAttributeNS(null, 'pattern', pattern);
275
+ this.setAttribute('pattern', pattern);
265
276
  }
266
277
 
267
278
  /**
@@ -270,7 +281,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
270
281
  * @returns Placeholder.
271
282
  */
272
283
  public get placeholder(): string {
273
- return this.getAttributeNS(null, 'placeholder') || '';
284
+ return this.getAttribute('placeholder') || '';
274
285
  }
275
286
 
276
287
  /**
@@ -279,7 +290,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
279
290
  * @param placeholder Placeholder.
280
291
  */
281
292
  public set placeholder(placeholder: string) {
282
- this.setAttributeNS(null, 'placeholder', placeholder);
293
+ this.setAttribute('placeholder', placeholder);
283
294
  }
284
295
 
285
296
  /**
@@ -288,7 +299,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
288
299
  * @returns Step.
289
300
  */
290
301
  public get step(): string {
291
- return this.getAttributeNS(null, 'step') || '';
302
+ return this.getAttribute('step') || '';
292
303
  }
293
304
 
294
305
  /**
@@ -297,7 +308,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
297
308
  * @param step Step.
298
309
  */
299
310
  public set step(step: string) {
300
- this.setAttributeNS(null, 'step', step);
311
+ this.setAttribute('step', step);
301
312
  }
302
313
 
303
314
  /**
@@ -306,7 +317,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
306
317
  * @returns Inputmode.
307
318
  */
308
319
  public get inputmode(): string {
309
- return this.getAttributeNS(null, 'inputmode') || '';
320
+ return this.getAttribute('inputmode') || '';
310
321
  }
311
322
 
312
323
  /**
@@ -315,7 +326,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
315
326
  * @param inputmode Inputmode.
316
327
  */
317
328
  public set inputmode(inputmode: string) {
318
- this.setAttributeNS(null, 'inputmode', inputmode);
329
+ this.setAttribute('inputmode', inputmode);
319
330
  }
320
331
 
321
332
  /**
@@ -324,7 +335,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
324
335
  * @returns Accept.
325
336
  */
326
337
  public get accept(): string {
327
- return this.getAttributeNS(null, 'accept') || '';
338
+ return this.getAttribute('accept') || '';
328
339
  }
329
340
 
330
341
  /**
@@ -333,7 +344,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
333
344
  * @param accept Accept.
334
345
  */
335
346
  public set accept(accept: string) {
336
- this.setAttributeNS(null, 'accept', accept);
347
+ this.setAttribute('accept', accept);
337
348
  }
338
349
 
339
350
  /**
@@ -342,7 +353,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
342
353
  * @returns Allowdirs.
343
354
  */
344
355
  public get allowdirs(): string {
345
- return this.getAttributeNS(null, 'allowdirs') || '';
356
+ return this.getAttribute('allowdirs') || '';
346
357
  }
347
358
 
348
359
  /**
@@ -351,7 +362,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
351
362
  * @param allowdirs Allowdirs.
352
363
  */
353
364
  public set allowdirs(allowdirs: string) {
354
- this.setAttributeNS(null, 'allowdirs', allowdirs);
365
+ this.setAttribute('allowdirs', allowdirs);
355
366
  }
356
367
 
357
368
  /**
@@ -360,7 +371,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
360
371
  * @returns Autocomplete.
361
372
  */
362
373
  public get autocomplete(): string {
363
- return this.getAttributeNS(null, 'autocomplete') || '';
374
+ return this.getAttribute('autocomplete') || '';
364
375
  }
365
376
 
366
377
  /**
@@ -369,7 +380,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
369
380
  * @param autocomplete Autocomplete.
370
381
  */
371
382
  public set autocomplete(autocomplete: string) {
372
- this.setAttributeNS(null, 'autocomplete', autocomplete);
383
+ this.setAttribute('autocomplete', autocomplete);
373
384
  }
374
385
 
375
386
  /**
@@ -378,7 +389,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
378
389
  * @returns Src.
379
390
  */
380
391
  public get src(): string {
381
- return this.getAttributeNS(null, 'src') || '';
392
+ return this.getAttribute('src') || '';
382
393
  }
383
394
 
384
395
  /**
@@ -387,7 +398,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
387
398
  * @param src Src.
388
399
  */
389
400
  public set src(src: string) {
390
- this.setAttributeNS(null, 'src', src);
401
+ this.setAttribute('src', src);
391
402
  }
392
403
 
393
404
  /**
@@ -396,7 +407,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
396
407
  * @returns Defaultvalue.
397
408
  */
398
409
  public get defaultValue(): string {
399
- return this.getAttributeNS(null, 'defaultvalue') || '';
410
+ return this.getAttribute('value') || '';
400
411
  }
401
412
 
402
413
  /**
@@ -405,7 +416,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
405
416
  * @param defaultValue Defaultvalue.
406
417
  */
407
418
  public set defaultValue(defaultValue: string) {
408
- this.setAttributeNS(null, 'defaultvalue', defaultValue);
419
+ this.setAttribute('value', defaultValue);
409
420
  }
410
421
 
411
422
  /**
@@ -414,7 +425,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
414
425
  * @returns Read only.
415
426
  */
416
427
  public get readOnly(): boolean {
417
- return this.getAttributeNS(null, 'readonly') !== null;
428
+ return this.getAttribute('readonly') !== null;
418
429
  }
419
430
 
420
431
  /**
@@ -424,9 +435,9 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
424
435
  */
425
436
  public set readOnly(readOnly: boolean) {
426
437
  if (!readOnly) {
427
- this.removeAttributeNS(null, 'readonly');
438
+ this.removeAttribute('readonly');
428
439
  } else {
429
- this.setAttributeNS(null, 'readonly', '');
440
+ this.setAttribute('readonly', '');
430
441
  }
431
442
  }
432
443
 
@@ -436,7 +447,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
436
447
  * @returns Disabled.
437
448
  */
438
449
  public get disabled(): boolean {
439
- return this.getAttributeNS(null, 'disabled') !== null;
450
+ return this.getAttribute('disabled') !== null;
440
451
  }
441
452
 
442
453
  /**
@@ -446,9 +457,9 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
446
457
  */
447
458
  public set disabled(disabled: boolean) {
448
459
  if (!disabled) {
449
- this.removeAttributeNS(null, 'disabled');
460
+ this.removeAttribute('disabled');
450
461
  } else {
451
- this.setAttributeNS(null, 'disabled', '');
462
+ this.setAttribute('disabled', '');
452
463
  }
453
464
  }
454
465
 
@@ -458,7 +469,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
458
469
  * @returns Autofocus.
459
470
  */
460
471
  public get autofocus(): boolean {
461
- return this.getAttributeNS(null, 'autofocus') !== null;
472
+ return this.getAttribute('autofocus') !== null;
462
473
  }
463
474
 
464
475
  /**
@@ -468,9 +479,9 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
468
479
  */
469
480
  public set autofocus(autofocus: boolean) {
470
481
  if (!autofocus) {
471
- this.removeAttributeNS(null, 'autofocus');
482
+ this.removeAttribute('autofocus');
472
483
  } else {
473
- this.setAttributeNS(null, 'autofocus', '');
484
+ this.setAttribute('autofocus', '');
474
485
  }
475
486
  }
476
487
 
@@ -480,7 +491,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
480
491
  * @returns Required.
481
492
  */
482
493
  public get required(): boolean {
483
- return this.getAttributeNS(null, 'required') !== null;
494
+ return this.getAttribute('required') !== null;
484
495
  }
485
496
 
486
497
  /**
@@ -490,9 +501,9 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
490
501
  */
491
502
  public set required(required: boolean) {
492
503
  if (!required) {
493
- this.removeAttributeNS(null, 'required');
504
+ this.removeAttribute('required');
494
505
  } else {
495
- this.setAttributeNS(null, 'required', '');
506
+ this.setAttribute('required', '');
496
507
  }
497
508
  }
498
509
 
@@ -502,7 +513,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
502
513
  * @returns Indeterminate.
503
514
  */
504
515
  public get indeterminate(): boolean {
505
- return this.getAttributeNS(null, 'indeterminate') !== null;
516
+ return this.getAttribute('indeterminate') !== null;
506
517
  }
507
518
 
508
519
  /**
@@ -512,9 +523,9 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
512
523
  */
513
524
  public set indeterminate(indeterminate: boolean) {
514
525
  if (!indeterminate) {
515
- this.removeAttributeNS(null, 'indeterminate');
526
+ this.removeAttribute('indeterminate');
516
527
  } else {
517
- this.setAttributeNS(null, 'indeterminate', '');
528
+ this.setAttribute('indeterminate', '');
518
529
  }
519
530
  }
520
531
 
@@ -524,7 +535,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
524
535
  * @returns Multiple.
525
536
  */
526
537
  public get multiple(): boolean {
527
- return this.getAttributeNS(null, 'multiple') !== null;
538
+ return this.getAttribute('multiple') !== null;
528
539
  }
529
540
 
530
541
  /**
@@ -534,9 +545,9 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
534
545
  */
535
546
  public set multiple(multiple: boolean) {
536
547
  if (!multiple) {
537
- this.removeAttributeNS(null, 'multiple');
548
+ this.removeAttribute('multiple');
538
549
  } else {
539
- this.setAttributeNS(null, 'multiple', '');
550
+ this.setAttribute('multiple', '');
540
551
  }
541
552
  }
542
553
 
@@ -546,7 +557,10 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
546
557
  * @returns Checked.
547
558
  */
548
559
  public get checked(): boolean {
549
- return this.getAttributeNS(null, 'checked') !== null;
560
+ if (this._checked !== null) {
561
+ return this._checked;
562
+ }
563
+ return this.getAttribute('checked') !== null;
550
564
  }
551
565
 
552
566
  /**
@@ -555,10 +569,17 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
555
569
  * @param checked Checked.
556
570
  */
557
571
  public set checked(checked: boolean) {
558
- if (!checked) {
559
- this.removeAttributeNS(null, 'checked');
560
- } else {
561
- this.setAttributeNS(null, 'checked', '');
572
+ this._checked = checked;
573
+
574
+ if (checked && this.type === 'radio' && this.name) {
575
+ const root = <IHTMLElement>(<IHTMLFormElement>this._formNode || this.getRootNode());
576
+ const radioButtons = root.querySelectorAll(`input[type="radio"][name="${this.name}"]`);
577
+
578
+ for (const radioButton of radioButtons) {
579
+ if (radioButton !== this) {
580
+ radioButton['_checked'] = false;
581
+ }
582
+ }
562
583
  }
563
584
  }
564
585
 
@@ -574,17 +595,17 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
574
595
  case 'image':
575
596
  case 'reset':
576
597
  case 'button':
577
- return this.getAttributeNS(null, 'value') || '';
598
+ return this.getAttribute('value') || '';
578
599
  case 'checkbox':
579
600
  case 'radio':
580
- const attritube = this.getAttributeNS(null, 'value');
601
+ const attritube = this.getAttribute('value');
581
602
  return attritube !== null ? attritube : 'on';
582
603
  case 'file':
583
604
  return this.files.length > 0 ? '/fake/path/' + this.files[0].name : '';
584
605
  }
585
606
 
586
607
  if (this._value === null) {
587
- return this.getAttributeNS(null, 'value') || '';
608
+ return this.getAttribute('value') || '';
588
609
  }
589
610
 
590
611
  return this._value;
@@ -606,7 +627,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
606
627
  case 'button':
607
628
  case 'checkbox':
608
629
  case 'radio':
609
- this.setAttributeNS(null, 'value', value);
630
+ this.setAttribute('value', value);
610
631
  break;
611
632
  case 'file':
612
633
  if (value !== '') {
@@ -726,25 +747,34 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
726
747
  }
727
748
 
728
749
  /**
729
- * Returns the parent form element.
750
+ * Returns no validate.
730
751
  *
731
- * @returns Form.
752
+ * @returns No validate.
732
753
  */
733
- public get form(): IHTMLFormElement {
734
- let parent = <IHTMLElement>this.parentNode;
735
- while (parent && parent.tagName !== 'FORM') {
736
- parent = <IHTMLElement>parent.parentNode;
754
+ public get formNoValidate(): boolean {
755
+ return this.getAttribute('formnovalidate') !== null;
756
+ }
757
+
758
+ /**
759
+ * Sets no validate.
760
+ *
761
+ * @param formNoValidate No validate.
762
+ */
763
+ public set formNoValidate(formNoValidate: boolean) {
764
+ if (!formNoValidate) {
765
+ this.removeAttribute('formnovalidate');
766
+ } else {
767
+ this.setAttribute('formnovalidate', '');
737
768
  }
738
- return <IHTMLFormElement>parent;
739
769
  }
740
770
 
741
771
  /**
742
- * Returns validity state.
772
+ * Returns the parent form element.
743
773
  *
744
- * @returns Validity state.
774
+ * @returns Form.
745
775
  */
746
- public get validity(): ValidityState {
747
- return new ValidityState(this);
776
+ public get form(): IHTMLFormElement {
777
+ return <IHTMLFormElement>this._formNode;
748
778
  }
749
779
 
750
780
  /**
@@ -781,12 +811,28 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
781
811
  }
782
812
 
783
813
  /**
784
- * Returns validation message.
814
+ * Returns the associated label elements.
785
815
  *
786
- * @returns Validation message.
816
+ * @returns Label elements.
787
817
  */
788
- public get validationMessage(): string {
789
- return this._validationMessage;
818
+ public get labels(): INodeList<IHTMLLabelElement> {
819
+ const id = this.id;
820
+ if (id) {
821
+ const rootNode = <IDocument | IShadowRoot>this.getRootNode();
822
+ const labels = rootNode.querySelectorAll(`label[for="${id}"]`);
823
+
824
+ let parent = this.parentNode;
825
+ while (parent) {
826
+ if (parent['tagName'] === 'LABEL') {
827
+ labels.push(<IHTMLLabelElement>parent);
828
+ break;
829
+ }
830
+ parent = parent.parentNode;
831
+ }
832
+
833
+ return <INodeList<IHTMLLabelElement>>labels;
834
+ }
835
+ return new NodeList<IHTMLLabelElement>();
790
836
  }
791
837
 
792
838
  /**
@@ -795,21 +841,7 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
795
841
  * @param message Message.
796
842
  */
797
843
  public setCustomValidity(message: string): void {
798
- this._validationMessage = String(message);
799
- }
800
-
801
- /**
802
- * Reports validity by dispatching an "invalid" event.
803
- */
804
- public reportValidity(): void {
805
- if (this._validationMessage) {
806
- this.dispatchEvent(
807
- new Event('invalid', {
808
- bubbles: true,
809
- cancelable: true
810
- })
811
- );
812
- }
844
+ (<string>this.validationMessage) = String(message);
813
845
  }
814
846
 
815
847
  /**
@@ -935,7 +967,26 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
935
967
  * @returns "true" if the field is valid.
936
968
  */
937
969
  public checkValidity(): boolean {
938
- return true;
970
+ const valid =
971
+ this.disabled ||
972
+ this.readOnly ||
973
+ this.type === 'hidden' ||
974
+ this.type === 'reset' ||
975
+ this.type === 'button' ||
976
+ this.validity.valid;
977
+ if (!valid) {
978
+ this.dispatchEvent(new Event('invalid', { bubbles: true, cancelable: true }));
979
+ }
980
+ return valid;
981
+ }
982
+
983
+ /**
984
+ * Reports validity.
985
+ *
986
+ * @returns "true" if the field is valid.
987
+ */
988
+ public reportValidity(): boolean {
989
+ return this.checkValidity();
939
990
  }
940
991
 
941
992
  /**
@@ -973,7 +1024,6 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
973
1024
  const clone = <HTMLInputElement>super.cloneNode(deep);
974
1025
  clone.formAction = this.formAction;
975
1026
  clone.formMethod = this.formMethod;
976
- clone.formNoValidate = this.formNoValidate;
977
1027
  clone._value = this._value;
978
1028
  clone._height = this._height;
979
1029
  clone._width = this._width;
@@ -986,22 +1036,91 @@ export default class HTMLInputElement extends HTMLElement implements IHTMLInputE
986
1036
  }
987
1037
 
988
1038
  /**
989
- * Checks if private value is supported.
990
- *
991
- * @returns "true" if private value is supported.
1039
+ * @override
992
1040
  */
993
- // Private _isPrivateValueSupported(): boolean {
994
- // Return (
995
- // This.type !== 'hidden' &&
996
- // This.type !== 'submit' &&
997
- // This.type !== 'image' &&
998
- // This.type !== 'reset' &&
999
- // This.type !== 'button' &&
1000
- // This.type !== 'checkbox' &&
1001
- // This.type !== 'radio' &&
1002
- // This.type !== 'file'
1003
- // );
1004
- // }
1041
+ public dispatchEvent(event: Event): boolean {
1042
+ if (event.type === 'click' && this.disabled) {
1043
+ return false;
1044
+ }
1045
+
1046
+ const returnValue = super.dispatchEvent(event);
1047
+
1048
+ if (
1049
+ event.type === 'click' &&
1050
+ this.isConnected &&
1051
+ (!this.readOnly || this.type === 'checkbox' || this.type === 'radio')
1052
+ ) {
1053
+ if (this.type === 'checkbox' || this.type === 'radio') {
1054
+ this.checked = this.type === 'checkbox' ? !this.checked : true;
1055
+ this.dispatchEvent(new Event('input', { bubbles: true, cancelable: true }));
1056
+ this.dispatchEvent(new Event('change', { bubbles: true, cancelable: true }));
1057
+ } else if (this.type === 'submit') {
1058
+ const form = <IHTMLFormElement>this._formNode;
1059
+ if (form) {
1060
+ form.requestSubmit();
1061
+ }
1062
+ } else if (this.type === 'reset') {
1063
+ const form = <IHTMLFormElement>this._formNode;
1064
+ if (form) {
1065
+ form.reset();
1066
+ }
1067
+ }
1068
+ }
1069
+
1070
+ return returnValue;
1071
+ }
1072
+
1073
+ /**
1074
+ * @override
1075
+ */
1076
+ public override setAttributeNode(attribute: IAttr): IAttr {
1077
+ const replacedAttribute = super.setAttributeNode(attribute);
1078
+ const oldValue = replacedAttribute ? replacedAttribute.value : null;
1079
+
1080
+ if ((attribute.name === 'id' || attribute.name === 'name') && this._formNode) {
1081
+ if (oldValue) {
1082
+ (<HTMLFormElement>this._formNode)._removeFormControlItem(this, oldValue);
1083
+ }
1084
+ if (attribute.value) {
1085
+ (<HTMLFormElement>this._formNode)._appendFormControlItem(this, attribute.value);
1086
+ }
1087
+ }
1088
+
1089
+ return replacedAttribute;
1090
+ }
1091
+
1092
+ /**
1093
+ * @override
1094
+ */
1095
+ public override removeAttributeNode(attribute: IAttr): IAttr {
1096
+ super.removeAttributeNode(attribute);
1097
+
1098
+ if ((attribute.name === 'id' || attribute.name === 'name') && this._formNode) {
1099
+ (<HTMLFormElement>this._formNode)._removeFormControlItem(this, attribute.value);
1100
+ }
1101
+
1102
+ return attribute;
1103
+ }
1104
+
1105
+ /**
1106
+ * @override
1107
+ */
1108
+ public override _connectToNode(parentNode: INode = null): void {
1109
+ const oldFormNode = <HTMLFormElement>this._formNode;
1110
+
1111
+ super._connectToNode(parentNode);
1112
+
1113
+ if (oldFormNode !== this._formNode) {
1114
+ if (oldFormNode) {
1115
+ oldFormNode._removeFormControlItem(this, this.name);
1116
+ oldFormNode._removeFormControlItem(this, this.id);
1117
+ }
1118
+ if (this._formNode) {
1119
+ (<HTMLFormElement>this._formNode)._appendFormControlItem(this, this.name);
1120
+ (<HTMLFormElement>this._formNode)._appendFormControlItem(this, this.id);
1121
+ }
1122
+ }
1123
+ }
1005
1124
 
1006
1125
  /**
1007
1126
  * Checks is selection is supported.