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,18 +1,23 @@
1
1
  import HTMLElement from '../html-element/HTMLElement';
2
2
  import IHTMLElement from '../html-element/IHTMLElement';
3
3
  import IHTMLFormElement from '../html-form-element/IHTMLFormElement';
4
- import ValidityState from '../validity-state/ValidityState';
4
+ import ValidityState from '../../validity-state/ValidityState';
5
5
  import IHTMLLabelElement from '../html-label-element/IHTMLLabelElement';
6
6
  import HTMLOptionElement from '../html-option-element/HTMLOptionElement';
7
- import HTMLOptionsCollection from '../html-option-element/HTMLOptionsCollection';
7
+ import HTMLOptionsCollection from './HTMLOptionsCollection';
8
8
  import INodeList from '../node/INodeList';
9
9
  import IHTMLSelectElement from './IHTMLSelectElement';
10
10
  import Event from '../../event/Event';
11
11
  import IHTMLOptionElement from '../html-option-element/IHTMLOptionElement';
12
- import IHTMLOptGroupElement from '../html-opt-group-element/IHTMLOptGroupElement';
13
- import IHTMLOptionsCollection from '../html-option-element/IHTMLOptionsCollection';
12
+ import IHTMLOptionsCollection from './IHTMLOptionsCollection';
14
13
  import INode from '../node/INode';
15
14
  import NodeTypeEnum from '../node/NodeTypeEnum';
15
+ import HTMLFormElement from '../html-form-element/HTMLFormElement';
16
+ import IAttr from '../attr/IAttr';
17
+ import IHTMLCollection from '../element/IHTMLCollection';
18
+ import NodeList from '../node/NodeList';
19
+ import IDocument from '../document/IDocument';
20
+ import IShadowRoot from '../shadow-root/IShadowRoot';
16
21
 
17
22
  /**
18
23
  * HTML Select Element.
@@ -21,8 +26,14 @@ import NodeTypeEnum from '../node/NodeTypeEnum';
21
26
  * https://developer.mozilla.org/en-US/docs/Web/API/HTMLSelectElement.
22
27
  */
23
28
  export default class HTMLSelectElement extends HTMLElement implements IHTMLSelectElement {
24
- public labels: INodeList<IHTMLLabelElement>;
29
+ // Public properties.
30
+ public readonly length = 0;
25
31
  public readonly options: IHTMLOptionsCollection = new HTMLOptionsCollection(this);
32
+ public readonly validationMessage = '';
33
+ public readonly validity = new ValidityState(this);
34
+
35
+ // Private properties
36
+ public _selectNode: INode = this;
26
37
 
27
38
  // Events
28
39
  public onchange: (event: Event) => void | null = null;
@@ -34,7 +45,7 @@ export default class HTMLSelectElement extends HTMLElement implements IHTMLSelec
34
45
  * @returns Name.
35
46
  */
36
47
  public get name(): string {
37
- return this.getAttributeNS(null, 'name') || '';
48
+ return this.getAttribute('name') || '';
38
49
  }
39
50
 
40
51
  /**
@@ -43,7 +54,7 @@ export default class HTMLSelectElement extends HTMLElement implements IHTMLSelec
43
54
  * @param name Name.
44
55
  */
45
56
  public set name(name: string) {
46
- this.setAttributeNS(null, 'name', name);
57
+ this.setAttribute('name', name);
47
58
  }
48
59
 
49
60
  /**
@@ -52,7 +63,7 @@ export default class HTMLSelectElement extends HTMLElement implements IHTMLSelec
52
63
  * @returns Disabled.
53
64
  */
54
65
  public get disabled(): boolean {
55
- return this.getAttributeNS(null, 'disabled') !== null;
66
+ return this.getAttribute('disabled') !== null;
56
67
  }
57
68
 
58
69
  /**
@@ -62,9 +73,9 @@ export default class HTMLSelectElement extends HTMLElement implements IHTMLSelec
62
73
  */
63
74
  public set disabled(disabled: boolean) {
64
75
  if (!disabled) {
65
- this.removeAttributeNS(null, 'disabled');
76
+ this.removeAttribute('disabled');
66
77
  } else {
67
- this.setAttributeNS(null, 'disabled', '');
78
+ this.setAttribute('disabled', '');
68
79
  }
69
80
  }
70
81
 
@@ -74,7 +85,7 @@ export default class HTMLSelectElement extends HTMLElement implements IHTMLSelec
74
85
  * @returns Multiple.
75
86
  */
76
87
  public get multiple(): boolean {
77
- return this.getAttributeNS(null, 'multiple') !== null;
88
+ return this.getAttribute('multiple') !== null;
78
89
  }
79
90
 
80
91
  /**
@@ -84,9 +95,9 @@ export default class HTMLSelectElement extends HTMLElement implements IHTMLSelec
84
95
  */
85
96
  public set multiple(multiple: boolean) {
86
97
  if (!multiple) {
87
- this.removeAttributeNS(null, 'multiple');
98
+ this.removeAttribute('multiple');
88
99
  } else {
89
- this.setAttributeNS(null, 'multiple', '');
100
+ this.setAttribute('multiple', '');
90
101
  }
91
102
  }
92
103
 
@@ -96,7 +107,7 @@ export default class HTMLSelectElement extends HTMLElement implements IHTMLSelec
96
107
  * @returns Autofocus.
97
108
  */
98
109
  public get autofocus(): boolean {
99
- return this.getAttributeNS(null, 'autofocus') !== null;
110
+ return this.getAttribute('autofocus') !== null;
100
111
  }
101
112
 
102
113
  /**
@@ -106,37 +117,19 @@ export default class HTMLSelectElement extends HTMLElement implements IHTMLSelec
106
117
  */
107
118
  public set autofocus(autofocus: boolean) {
108
119
  if (!autofocus) {
109
- this.removeAttributeNS(null, 'autofocus');
120
+ this.removeAttribute('autofocus');
110
121
  } else {
111
- this.setAttributeNS(null, 'autofocus', '');
122
+ this.setAttribute('autofocus', '');
112
123
  }
113
124
  }
114
125
 
115
- /**
116
- * Returns length.
117
- *
118
- * @returns length.
119
- */
120
- public get length(): number {
121
- return this.options.length;
122
- }
123
-
124
- /**
125
- * Sets length.
126
- *
127
- * @param length Length.
128
- */
129
- public set length(length: number) {
130
- this.options.length = length;
131
- }
132
-
133
126
  /**
134
127
  * Returns required.
135
128
  *
136
129
  * @returns Required.
137
130
  */
138
131
  public get required(): boolean {
139
- return this.getAttributeNS(null, 'required') !== null;
132
+ return this.getAttribute('required') !== null;
140
133
  }
141
134
 
142
135
  /**
@@ -146,9 +139,9 @@ export default class HTMLSelectElement extends HTMLElement implements IHTMLSelec
146
139
  */
147
140
  public set required(required: boolean) {
148
141
  if (!required) {
149
- this.removeAttributeNS(null, 'required');
142
+ this.removeAttribute('required');
150
143
  } else {
151
- this.setAttributeNS(null, 'required', '');
144
+ this.setAttribute('required', '');
152
145
  }
153
146
  }
154
147
 
@@ -228,25 +221,37 @@ export default class HTMLSelectElement extends HTMLElement implements IHTMLSelec
228
221
  }
229
222
 
230
223
  /**
231
- * Returns the parent form element.
224
+ * Returns the associated label elements.
232
225
  *
233
- * @returns Form.
226
+ * @returns Label elements.
234
227
  */
235
- public get form(): IHTMLFormElement {
236
- let parent = <IHTMLElement>this.parentNode;
237
- while (parent && parent.tagName !== 'FORM') {
238
- parent = <IHTMLElement>parent.parentNode;
228
+ public get labels(): INodeList<IHTMLLabelElement> {
229
+ const id = this.id;
230
+ if (id) {
231
+ const rootNode = <IDocument | IShadowRoot>this.getRootNode();
232
+ const labels = rootNode.querySelectorAll(`label[for="${id}"]`);
233
+
234
+ let parent = this.parentNode;
235
+ while (parent) {
236
+ if (parent['tagName'] === 'LABEL') {
237
+ labels.push(<IHTMLLabelElement>parent);
238
+ break;
239
+ }
240
+ parent = parent.parentNode;
241
+ }
242
+
243
+ return <INodeList<IHTMLLabelElement>>labels;
239
244
  }
240
- return <IHTMLFormElement>parent;
245
+ return new NodeList<IHTMLLabelElement>();
241
246
  }
242
247
 
243
248
  /**
244
- * Returns validity state.
249
+ * Returns the parent form element.
245
250
  *
246
- * @returns Validity state.
251
+ * @returns Form.
247
252
  */
248
- public get validity(): ValidityState {
249
- return new ValidityState(this);
253
+ public get form(): IHTMLFormElement {
254
+ return <IHTMLFormElement>this._formNode;
250
255
  }
251
256
 
252
257
  /**
@@ -269,20 +274,17 @@ export default class HTMLSelectElement extends HTMLElement implements IHTMLSelec
269
274
  *
270
275
  * @param index Index.
271
276
  */
272
- public item(index: number): IHTMLOptionElement | IHTMLOptGroupElement {
277
+ public item(index: number): IHTMLOptionElement {
273
278
  return this.options.item(index);
274
279
  }
275
280
 
276
281
  /**
277
282
  * Adds new option to options collection.
278
283
  *
279
- * @param element HTMLOptionElement or HTMLOptGroupElement to add.
284
+ * @param element HTMLOptionElement to add.
280
285
  * @param before HTMLOptionElement or index number.
281
286
  */
282
- public add(
283
- element: IHTMLOptionElement | IHTMLOptGroupElement,
284
- before?: number | IHTMLOptionElement | IHTMLOptGroupElement
285
- ): void {
287
+ public add(element: IHTMLOptionElement, before?: number | IHTMLOptionElement): void {
286
288
  this.options.add(element, before);
287
289
  }
288
290
 
@@ -300,123 +302,84 @@ export default class HTMLSelectElement extends HTMLElement implements IHTMLSelec
300
302
  }
301
303
 
302
304
  /**
303
- * @override
305
+ * Sets validation message.
306
+ *
307
+ * @param message Message.
304
308
  */
305
- public override appendChild(node: INode): INode {
306
- if (node.nodeType === NodeTypeEnum.elementNode) {
307
- const element = <IHTMLElement>node;
308
- const previousLength = this.options.length;
309
-
310
- if (element.tagName === 'OPTION' || element.tagName === 'OPTGROUP') {
311
- this.options.push(<IHTMLOptionElement | IHTMLOptGroupElement>element);
312
- }
313
-
314
- this._updateIndexProperties(previousLength, this.options.length);
315
- this._resetOptionSelectednes();
316
- }
317
-
318
- return super.appendChild(node);
309
+ public setCustomValidity(message: string): void {
310
+ (<string>this.validationMessage) = String(message);
319
311
  }
320
312
 
321
313
  /**
322
- * @override
314
+ * Checks validity.
315
+ *
316
+ * @returns "true" if the field is valid.
323
317
  */
324
- public override insertBefore(newNode: INode, referenceNode: INode | null): INode {
325
- const returnValue = super.insertBefore(newNode, referenceNode);
326
-
327
- if (
328
- newNode.nodeType === NodeTypeEnum.elementNode &&
329
- referenceNode?.nodeType === NodeTypeEnum.elementNode
330
- ) {
331
- const newElement = <IHTMLElement>newNode;
332
- const previousLength = this.options.length;
333
-
334
- if (newElement.tagName === 'OPTION' || newElement.tagName === 'OPTGROUP') {
335
- const referenceElement = <IHTMLElement>referenceNode;
336
-
337
- if (
338
- referenceElement &&
339
- (referenceElement.tagName === 'OPTION' || referenceElement.tagName === 'OPTGROUP')
340
- ) {
341
- const referenceIndex = this.options.indexOf(
342
- <IHTMLOptGroupElement | IHTMLOptionElement>referenceElement
343
- );
344
- if (referenceIndex !== -1) {
345
- this.options.splice(
346
- referenceIndex,
347
- 0,
348
- <IHTMLOptionElement | IHTMLOptGroupElement>newElement
349
- );
350
- }
351
- } else {
352
- this.options.push(<IHTMLOptionElement | IHTMLOptGroupElement>newElement);
353
- }
354
- }
355
-
356
- this._updateIndexProperties(previousLength, this.options.length);
318
+ public checkValidity(): boolean {
319
+ const valid = this.disabled || this.validity.valid;
320
+ if (!valid) {
321
+ this.dispatchEvent(new Event('invalid', { bubbles: true, cancelable: true }));
357
322
  }
358
-
359
- if (newNode.nodeType === NodeTypeEnum.elementNode) {
360
- this._resetOptionSelectednes();
361
- }
362
-
363
- return returnValue;
323
+ return valid;
364
324
  }
365
325
 
366
326
  /**
367
- * @override
327
+ * Reports validity.
328
+ *
329
+ * @returns "true" if the field is valid.
368
330
  */
369
- public override removeChild(node: INode): INode {
370
- if (node.nodeType === NodeTypeEnum.elementNode) {
371
- const element = <IHTMLElement>node;
372
- const previousLength = this.options.length;
373
-
374
- if (element.tagName === 'OPTION' || element.tagName === 'OPTION') {
375
- const index = this.options.indexOf(<IHTMLOptionElement | IHTMLOptGroupElement>node);
376
-
377
- if (index !== -1) {
378
- this.options.splice(index, 1);
379
- }
380
- }
381
-
382
- this._updateIndexProperties(previousLength, this.options.length);
383
- this._resetOptionSelectednes();
384
- }
385
-
386
- return super.removeChild(node);
331
+ public reportValidity(): boolean {
332
+ return this.checkValidity();
387
333
  }
388
334
 
389
335
  /**
390
- * Resets the option selectedness.
336
+ * Updates option item.
391
337
  *
392
338
  * Based on:
393
339
  * https://github.com/jsdom/jsdom/blob/master/lib/jsdom/living/nodes/HTMLSelectElement-impl.js
394
340
  *
395
- * @param [newOption] Optional new option element to be selected.
396
341
  * @see https://html.spec.whatwg.org/multipage/form-elements.html#selectedness-setting-algorithm
342
+ * @param [selectedOption] Selected option.
397
343
  */
398
- public _resetOptionSelectednes(newOption?: IHTMLOptionElement): void {
399
- if (this.hasAttributeNS(null, 'multiple')) {
400
- return;
344
+ public _updateOptionItems(selectedOption?: IHTMLOptionElement): void {
345
+ const optionElements = <IHTMLCollection<IHTMLOptionElement, IHTMLOptionElement>>(
346
+ this.getElementsByTagName('option')
347
+ );
348
+
349
+ if (optionElements.length < this.options.length) {
350
+ this.options.splice(this.options.length - 1, this.options.length - optionElements.length);
351
+
352
+ for (let i = optionElements.length - 1, max = this.length; i < max; i++) {
353
+ delete this[i];
354
+ }
401
355
  }
402
356
 
357
+ const isMultiple = this.hasAttributeNS(null, 'multiple');
403
358
  const selected: HTMLOptionElement[] = [];
404
359
 
405
- for (let i = 0, max = this.options.length; i < max; i++) {
406
- if (newOption) {
407
- (<HTMLOptionElement>this.options[i])._selectedness = this.options[i] === newOption;
408
- }
360
+ for (let i = 0; i < optionElements.length; i++) {
361
+ this.options[i] = optionElements[i];
362
+ this[i] = optionElements[i];
409
363
 
410
- if ((<HTMLOptionElement>this.options[i])._selectedness) {
411
- selected.push(<HTMLOptionElement>this.options[i]);
364
+ if (!isMultiple) {
365
+ if (selectedOption) {
366
+ (<HTMLOptionElement>optionElements[i])._selectedness =
367
+ optionElements[i] === selectedOption;
368
+ }
369
+
370
+ if ((<HTMLOptionElement>optionElements[i])._selectedness) {
371
+ selected.push(<HTMLOptionElement>optionElements[i]);
372
+ }
412
373
  }
413
374
  }
414
375
 
376
+ (<number>this.length) = optionElements.length;
377
+
415
378
  const size = this._getDisplaySize();
416
379
 
417
380
  if (size === 1 && !selected.length) {
418
- for (let i = 0, max = this.options.length; i < max; i++) {
419
- const option = <HTMLOptionElement>this.options[i];
381
+ for (let i = 0, max = optionElements.length; i < max; i++) {
382
+ const option = <HTMLOptionElement>optionElements[i];
420
383
 
421
384
  let disabled = option.hasAttributeNS(null, 'disabled');
422
385
  const parentNode = <IHTMLElement>option.parentNode;
@@ -435,8 +398,60 @@ export default class HTMLSelectElement extends HTMLElement implements IHTMLSelec
435
398
  }
436
399
  }
437
400
  } else if (selected.length >= 2) {
438
- for (let i = 0, max = this.options.length; i < max; i++) {
439
- (<HTMLOptionElement>this.options[i])._selectedness = i === selected.length - 1;
401
+ for (let i = 0, max = optionElements.length; i < max; i++) {
402
+ (<HTMLOptionElement>optionElements[i])._selectedness = i === selected.length - 1;
403
+ }
404
+ }
405
+ }
406
+
407
+ /**
408
+ * @override
409
+ */
410
+ public override setAttributeNode(attribute: IAttr): IAttr {
411
+ const replacedAttribute = super.setAttributeNode(attribute);
412
+ const oldValue = replacedAttribute ? replacedAttribute.value : null;
413
+
414
+ if ((attribute.name === 'id' || attribute.name === 'name') && this._formNode) {
415
+ if (oldValue) {
416
+ (<HTMLFormElement>this._formNode)._removeFormControlItem(this, oldValue);
417
+ }
418
+ if (attribute.value) {
419
+ (<HTMLFormElement>this._formNode)._appendFormControlItem(this, attribute.value);
420
+ }
421
+ }
422
+
423
+ return replacedAttribute;
424
+ }
425
+
426
+ /**
427
+ * @override
428
+ */
429
+ public override removeAttributeNode(attribute: IAttr): IAttr {
430
+ super.removeAttributeNode(attribute);
431
+
432
+ if ((attribute.name === 'id' || attribute.name === 'name') && this._formNode) {
433
+ (<HTMLFormElement>this._formNode)._removeFormControlItem(this, attribute.value);
434
+ }
435
+
436
+ return attribute;
437
+ }
438
+
439
+ /**
440
+ * @override
441
+ */
442
+ public override _connectToNode(parentNode: INode = null): void {
443
+ const oldFormNode = <HTMLFormElement>this._formNode;
444
+
445
+ super._connectToNode(parentNode);
446
+
447
+ if (oldFormNode !== this._formNode) {
448
+ if (oldFormNode) {
449
+ oldFormNode._removeFormControlItem(this, this.name);
450
+ oldFormNode._removeFormControlItem(this, this.id);
451
+ }
452
+ if (this._formNode) {
453
+ (<HTMLFormElement>this._formNode)._appendFormControlItem(this, this.name);
454
+ (<HTMLFormElement>this._formNode)._appendFormControlItem(this, this.id);
440
455
  }
441
456
  }
442
457
  }
@@ -448,37 +463,11 @@ export default class HTMLSelectElement extends HTMLElement implements IHTMLSelec
448
463
  */
449
464
  protected _getDisplaySize(): number {
450
465
  if (this.hasAttributeNS(null, 'size')) {
451
- const size = parseInt(this.getAttributeNS(null, 'size'));
466
+ const size = parseInt(this.getAttribute('size'));
452
467
  if (!isNaN(size) && size >= 0) {
453
468
  return size;
454
469
  }
455
470
  }
456
471
  return this.hasAttributeNS(null, 'multiple') ? 4 : 1;
457
472
  }
458
-
459
- /**
460
- * Updates index properties.
461
- *
462
- * @param previousLength Length before the update.
463
- * @param newLength Length after the update.
464
- */
465
- protected _updateIndexProperties(previousLength: number, newLength: number): void {
466
- if (previousLength > newLength) {
467
- for (let i = newLength; i < previousLength; i++) {
468
- if (this.hasOwnProperty(String(i))) {
469
- delete this[String(i)];
470
- }
471
- }
472
- } else if (previousLength < newLength) {
473
- for (let i = previousLength; i < newLength; i++) {
474
- Object.defineProperty(this, String(i), {
475
- get: () => {
476
- return this.options[i];
477
- },
478
- enumerable: true,
479
- configurable: true
480
- });
481
- }
482
- }
483
- }
484
473
  }
@@ -1,6 +1,5 @@
1
1
  import IHTMLCollection from '../element/IHTMLCollection';
2
- import IHTMLOptGroupElement from '../html-opt-group-element/IHTMLOptGroupElement';
3
- import IHTMLOptionElement from './IHTMLOptionElement';
2
+ import IHTMLOptionElement from '../html-option-element/IHTMLOptionElement';
4
3
 
5
4
  /**
6
5
  * HTML Options Collection.
@@ -9,7 +8,7 @@ import IHTMLOptionElement from './IHTMLOptionElement';
9
8
  * https://developer.mozilla.org/en-US/docs/Web/API/HTMLOptionsCollection.
10
9
  */
11
10
  export default interface IHTMLOptionsCollection
12
- extends IHTMLCollection<IHTMLOptionElement | IHTMLOptGroupElement> {
11
+ extends IHTMLCollection<IHTMLOptionElement, IHTMLOptionElement> {
13
12
  selectedIndex: number;
14
13
  length: number;
15
14
 
@@ -19,17 +18,14 @@ export default interface IHTMLOptionsCollection
19
18
  * @param element HTMLOptionElement or HTMLOptGroupElement to add.
20
19
  * @param before HTMLOptionElement or index number.
21
20
  */
22
- add(
23
- element: IHTMLOptionElement | IHTMLOptGroupElement,
24
- before?: number | IHTMLOptionElement | IHTMLOptGroupElement
25
- ): void;
21
+ add(element: IHTMLOptionElement, before?: number | IHTMLOptionElement): void;
26
22
 
27
23
  /**
28
24
  * Returns option element by index.
29
25
  *
30
26
  * @param index Index.
31
27
  */
32
- item(index: number): IHTMLOptionElement | IHTMLOptGroupElement;
28
+ item(index: number): IHTMLOptionElement;
33
29
 
34
30
  /**
35
31
  * Removes option element from the collection.
@@ -2,8 +2,8 @@ import IHTMLElement from '../html-element/IHTMLElement';
2
2
  import IHTMLFormElement from '../html-form-element/IHTMLFormElement';
3
3
  import IHTMLLabelElement from '../html-label-element/IHTMLLabelElement';
4
4
  import INodeList from '../node/INodeList';
5
- import IHTMLOptionsCollection from '../html-option-element/IHTMLOptionsCollection';
6
- import ValidityState from '../validity-state/ValidityState';
5
+ import IHTMLOptionsCollection from './IHTMLOptionsCollection';
6
+ import ValidityState from '../../validity-state/ValidityState';
7
7
  import Event from '../../event/Event';
8
8
  import IHTMLOptionElement from '../html-option-element/IHTMLOptionElement';
9
9
  import IHTMLOptGroupElement from '../html-opt-group-element/IHTMLOptGroupElement';
@@ -21,6 +21,7 @@ export default interface IHTMLSelectElement extends IHTMLElement {
21
21
  readonly type: string;
22
22
  readonly validity: ValidityState;
23
23
  readonly willValidate: boolean;
24
+ readonly validationMessage: string;
24
25
  autofocus: boolean;
25
26
  disabled: boolean;
26
27
  length: number;
@@ -28,6 +29,7 @@ export default interface IHTMLSelectElement extends IHTMLElement {
28
29
  value: string;
29
30
  name: string;
30
31
  multiple: boolean;
32
+ required: boolean;
31
33
 
32
34
  // Events
33
35
  onchange: (event: Event) => void | null;
@@ -57,4 +59,25 @@ export default interface IHTMLSelectElement extends IHTMLElement {
57
59
  * @param index Index.
58
60
  */
59
61
  remove(index?: number): void;
62
+
63
+ /**
64
+ * Sets validation message.
65
+ *
66
+ * @param message Message.
67
+ */
68
+ setCustomValidity(message: string): void;
69
+
70
+ /**
71
+ * Checks validity.
72
+ *
73
+ * @returns "true" if the field is valid.
74
+ */
75
+ checkValidity(): boolean;
76
+
77
+ /**
78
+ * Reports validity.
79
+ *
80
+ * @returns "true" if the field is valid.
81
+ */
82
+ reportValidity(): boolean;
60
83
  }
@@ -22,7 +22,7 @@ export default class HTMLSlotElement extends HTMLElement implements IHTMLSlotEle
22
22
  * @returns Name.
23
23
  */
24
24
  public get name(): string {
25
- return this.getAttributeNS(null, 'name') || '';
25
+ return this.getAttribute('name') || '';
26
26
  }
27
27
 
28
28
  /**
@@ -31,7 +31,7 @@ export default class HTMLSlotElement extends HTMLElement implements IHTMLSlotEle
31
31
  * @param name Name.
32
32
  */
33
33
  public set name(name: string) {
34
- this.setAttributeNS(null, 'name', name);
34
+ this.setAttribute('name', name);
35
35
  }
36
36
 
37
37
  /**
@@ -33,7 +33,7 @@ export default class HTMLStyleElement extends HTMLElement implements IHTMLStyleE
33
33
  * @returns Media.
34
34
  */
35
35
  public get media(): string {
36
- return this.getAttributeNS(null, 'media') || '';
36
+ return this.getAttribute('media') || '';
37
37
  }
38
38
 
39
39
  /**
@@ -42,7 +42,7 @@ export default class HTMLStyleElement extends HTMLElement implements IHTMLStyleE
42
42
  * @param media Media.
43
43
  */
44
44
  public set media(media: string) {
45
- this.setAttributeNS(null, 'media', media);
45
+ this.setAttribute('media', media);
46
46
  }
47
47
 
48
48
  /**
@@ -51,7 +51,7 @@ export default class HTMLStyleElement extends HTMLElement implements IHTMLStyleE
51
51
  * @returns Type.
52
52
  */
53
53
  public get type(): string {
54
- return this.getAttributeNS(null, 'type') || '';
54
+ return this.getAttribute('type') || '';
55
55
  }
56
56
 
57
57
  /**
@@ -60,7 +60,7 @@ export default class HTMLStyleElement extends HTMLElement implements IHTMLStyleE
60
60
  * @param type Type.
61
61
  */
62
62
  public set type(type: string) {
63
- this.setAttributeNS(null, 'type', type);
63
+ this.setAttribute('type', type);
64
64
  }
65
65
 
66
66
  /**
@@ -69,7 +69,7 @@ export default class HTMLStyleElement extends HTMLElement implements IHTMLStyleE
69
69
  * @returns Disabled.
70
70
  */
71
71
  public get disabled(): boolean {
72
- return this.getAttributeNS(null, 'disabled') !== null;
72
+ return this.getAttribute('disabled') !== null;
73
73
  }
74
74
 
75
75
  /**
@@ -79,9 +79,9 @@ export default class HTMLStyleElement extends HTMLElement implements IHTMLStyleE
79
79
  */
80
80
  public set disabled(disabled: boolean) {
81
81
  if (!disabled) {
82
- this.removeAttributeNS(null, 'disabled');
82
+ this.removeAttribute('disabled');
83
83
  } else {
84
- this.setAttributeNS(null, 'disabled', '');
84
+ this.setAttribute('disabled', '');
85
85
  }
86
86
  }
87
87
  }