happy-dom 8.9.0 → 9.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of happy-dom might be problematic. Click here for more details.
- package/README.md +2 -2
- package/lib/cookie/CookieJar.js +1 -1
- package/lib/cookie/CookieJar.js.map +1 -1
- package/lib/dom-token-list/DOMTokenList.js +24 -20
- package/lib/dom-token-list/DOMTokenList.js.map +1 -1
- package/lib/event/EventTarget.js +6 -3
- package/lib/event/EventTarget.js.map +1 -1
- package/lib/exception/DOMExceptionNameEnum.d.ts +5 -1
- package/lib/exception/DOMExceptionNameEnum.js +4 -0
- package/lib/exception/DOMExceptionNameEnum.js.map +1 -1
- package/lib/fetch/AbortController.d.ts +19 -0
- package/lib/fetch/AbortController.js +30 -0
- package/lib/fetch/AbortController.js.map +1 -0
- package/lib/fetch/AbortSignal.d.ts +25 -0
- package/lib/fetch/AbortSignal.js +51 -0
- package/lib/fetch/AbortSignal.js.map +1 -0
- package/lib/fetch/Fetch.d.ts +117 -0
- package/lib/fetch/Fetch.js +530 -0
- package/lib/fetch/Fetch.js.map +1 -0
- package/lib/fetch/Headers.d.ts +81 -3
- package/lib/fetch/Headers.js +139 -24
- package/lib/fetch/Headers.js.map +1 -1
- package/lib/fetch/Request.d.ts +56 -32
- package/lib/fetch/Request.js +165 -110
- package/lib/fetch/Request.js.map +1 -1
- package/lib/fetch/{ResourceFetchHandler.d.ts → ResourceFetch.d.ts} +1 -1
- package/lib/fetch/{ResourceFetchHandler.js → ResourceFetch.js} +5 -5
- package/lib/fetch/ResourceFetch.js.map +1 -0
- package/lib/fetch/Response.d.ts +60 -26
- package/lib/fetch/Response.js +196 -104
- package/lib/fetch/Response.js.map +1 -1
- package/lib/fetch/data-uri/DataURIParser.d.ts +20 -0
- package/lib/fetch/data-uri/DataURIParser.js +60 -0
- package/lib/fetch/data-uri/DataURIParser.js.map +1 -0
- package/lib/fetch/multipart/MultipartFormDataParser.d.ts +40 -0
- package/lib/fetch/multipart/MultipartFormDataParser.js +81 -0
- package/lib/fetch/multipart/MultipartFormDataParser.js.map +1 -0
- package/lib/fetch/multipart/MultipartReader.d.ts +49 -0
- package/lib/fetch/multipart/MultipartReader.js +178 -0
- package/lib/fetch/multipart/MultipartReader.js.map +1 -0
- package/lib/fetch/types/IHeaders.d.ts +71 -0
- package/lib/fetch/{IHeaders.js.map → types/IHeaders.js.map} +1 -1
- package/lib/fetch/types/IHeadersInit.js.map +1 -0
- package/lib/fetch/types/IRequest.d.ts +60 -0
- package/lib/fetch/{IRequest.js.map → types/IRequest.js.map} +1 -1
- package/lib/fetch/types/IRequestBody.d.ts +7 -0
- package/lib/fetch/{IBody.js → types/IRequestBody.js} +1 -1
- package/lib/fetch/types/IRequestBody.js.map +1 -0
- package/lib/fetch/types/IRequestCredentials.d.ts +2 -0
- package/lib/fetch/types/IRequestCredentials.js +3 -0
- package/lib/fetch/types/IRequestCredentials.js.map +1 -0
- package/lib/fetch/{RequestInfo.d.ts → types/IRequestInfo.d.ts} +2 -2
- package/lib/fetch/types/IRequestInfo.js +3 -0
- package/lib/fetch/types/IRequestInfo.js.map +1 -0
- package/lib/fetch/types/IRequestInit.d.ts +21 -0
- package/lib/fetch/types/IRequestInit.js.map +1 -0
- package/lib/fetch/types/IRequestRedirect.d.ts +2 -0
- package/lib/fetch/types/IRequestRedirect.js +3 -0
- package/lib/fetch/types/IRequestRedirect.js.map +1 -0
- package/lib/fetch/types/IRequestReferrerPolicy.d.ts +2 -0
- package/lib/fetch/types/IRequestReferrerPolicy.js +3 -0
- package/lib/fetch/types/IRequestReferrerPolicy.js.map +1 -0
- package/lib/fetch/types/IResponse.d.ts +27 -0
- package/lib/fetch/{IResponse.js.map → types/IResponse.js.map} +1 -1
- package/lib/fetch/types/IResponseBody.d.ts +7 -0
- package/lib/fetch/types/IResponseBody.js +3 -0
- package/lib/fetch/types/IResponseBody.js.map +1 -0
- package/lib/fetch/types/IResponseInit.d.ts +9 -0
- package/lib/fetch/types/IResponseInit.js.map +1 -0
- package/lib/fetch/utilities/FetchBodyUtility.d.ts +44 -0
- package/lib/fetch/utilities/FetchBodyUtility.js +156 -0
- package/lib/fetch/utilities/FetchBodyUtility.js.map +1 -0
- package/lib/fetch/utilities/FetchCORSUtility.d.ts +12 -0
- package/lib/fetch/utilities/FetchCORSUtility.js +20 -0
- package/lib/fetch/utilities/FetchCORSUtility.js.map +1 -0
- package/lib/fetch/utilities/FetchRequestHeaderUtility.d.ts +12 -0
- package/lib/fetch/utilities/FetchRequestHeaderUtility.js +45 -0
- package/lib/fetch/utilities/FetchRequestHeaderUtility.js.map +1 -0
- package/lib/fetch/utilities/FetchRequestReferrerUtility.d.ts +55 -0
- package/lib/fetch/utilities/FetchRequestReferrerUtility.js +194 -0
- package/lib/fetch/utilities/FetchRequestReferrerUtility.js.map +1 -0
- package/lib/fetch/utilities/FetchRequestValidationUtility.d.ts +38 -0
- package/lib/fetch/utilities/FetchRequestValidationUtility.js +70 -0
- package/lib/fetch/utilities/FetchRequestValidationUtility.js.map +1 -0
- package/lib/file/Blob.d.ts +2 -2
- package/lib/file/Blob.js +1 -1
- package/lib/file/Blob.js.map +1 -1
- package/lib/file/File.d.ts +2 -1
- package/lib/file/File.js.map +1 -1
- package/lib/form-data/FormData.d.ts +98 -0
- package/lib/form-data/FormData.js +212 -0
- package/lib/form-data/FormData.js.map +1 -0
- package/lib/index.d.ts +14 -1
- package/lib/index.js +20 -2
- package/lib/index.js.map +1 -1
- package/lib/nodes/document/Document.d.ts +5 -17
- package/lib/nodes/document/Document.js +11 -54
- package/lib/nodes/document/Document.js.map +1 -1
- package/lib/nodes/document/IDocument.d.ts +1 -1
- package/lib/nodes/document-fragment/DocumentFragment.d.ts +3 -14
- package/lib/nodes/document-fragment/DocumentFragment.js +7 -51
- package/lib/nodes/document-fragment/DocumentFragment.js.map +1 -1
- package/lib/nodes/document-fragment/IDocumentFragment.d.ts +2 -1
- package/lib/nodes/element/Element.d.ts +8 -8
- package/lib/nodes/element/Element.js +28 -45
- package/lib/nodes/element/Element.js.map +1 -1
- package/lib/nodes/element/ElementUtility.d.ts +32 -0
- package/lib/nodes/element/ElementUtility.js +105 -0
- package/lib/nodes/element/ElementUtility.js.map +1 -0
- package/lib/nodes/element/HTMLCollection.d.ts +26 -3
- package/lib/nodes/element/HTMLCollection.js +51 -0
- package/lib/nodes/element/HTMLCollection.js.map +1 -1
- package/lib/nodes/element/IHTMLCollection.d.ts +9 -2
- package/lib/nodes/html-anchor-element/HTMLAnchorElement.js +24 -24
- package/lib/nodes/html-anchor-element/HTMLAnchorElement.js.map +1 -1
- package/lib/nodes/html-base-element/HTMLBaseElement.js +4 -4
- package/lib/nodes/html-base-element/HTMLBaseElement.js.map +1 -1
- package/lib/nodes/html-button-element/HTMLButtonElement.d.ts +84 -3
- package/lib/nodes/html-button-element/HTMLButtonElement.js +183 -10
- package/lib/nodes/html-button-element/HTMLButtonElement.js.map +1 -1
- package/lib/nodes/html-button-element/IHTMLButtonElement.d.ts +28 -2
- package/lib/nodes/html-dialog-element/HTMLDialogElement.js +3 -3
- package/lib/nodes/html-dialog-element/HTMLDialogElement.js.map +1 -1
- package/lib/nodes/html-element/HTMLElement.js +12 -12
- package/lib/nodes/html-element/HTMLElement.js.map +1 -1
- package/lib/nodes/html-form-element/HTMLFormControlsCollection.d.ts +32 -0
- package/lib/nodes/html-form-element/HTMLFormControlsCollection.js +58 -0
- package/lib/nodes/html-form-element/HTMLFormControlsCollection.js.map +1 -0
- package/lib/nodes/html-form-element/HTMLFormElement.d.ts +37 -17
- package/lib/nodes/html-form-element/HTMLFormElement.js +128 -37
- package/lib/nodes/html-form-element/HTMLFormElement.js.map +1 -1
- package/lib/nodes/html-form-element/IHTMLFormControlsCollection.d.ts +25 -0
- package/lib/nodes/html-form-element/IHTMLFormControlsCollection.js +3 -0
- package/lib/nodes/html-form-element/IHTMLFormControlsCollection.js.map +1 -0
- package/lib/nodes/html-form-element/IHTMLFormElement.d.ts +16 -6
- package/lib/nodes/html-form-element/IRadioNodeList.d.ts +15 -0
- package/lib/nodes/html-form-element/IRadioNodeList.js +3 -0
- package/lib/nodes/html-form-element/IRadioNodeList.js.map +1 -0
- package/lib/nodes/html-form-element/RadioNodeList.d.ts +16 -0
- package/lib/nodes/html-form-element/RadioNodeList.js +28 -0
- package/lib/nodes/html-form-element/RadioNodeList.js.map +1 -0
- package/lib/nodes/html-image-element/HTMLImageElement.js +19 -19
- package/lib/nodes/html-image-element/HTMLImageElement.js.map +1 -1
- package/lib/nodes/html-input-element/HTMLInputElement.d.ts +43 -19
- package/lib/nodes/html-input-element/HTMLInputElement.js +206 -111
- package/lib/nodes/html-input-element/HTMLInputElement.js.map +1 -1
- package/lib/nodes/html-input-element/IHTMLInputElement.d.ts +14 -1
- package/lib/nodes/html-label-element/HTMLLabelElement.js +3 -7
- package/lib/nodes/html-label-element/HTMLLabelElement.js.map +1 -1
- package/lib/nodes/html-link-element/HTMLLinkElement.js +21 -21
- package/lib/nodes/html-link-element/HTMLLinkElement.js.map +1 -1
- package/lib/nodes/html-media-element/HTMLMediaElement.js +21 -21
- package/lib/nodes/html-media-element/HTMLMediaElement.js.map +1 -1
- package/lib/nodes/html-meta-element/HTMLMetaElement.js +8 -8
- package/lib/nodes/html-meta-element/HTMLMetaElement.js.map +1 -1
- package/lib/nodes/html-opt-group-element/HTMLOptGroupElement.js +6 -6
- package/lib/nodes/html-opt-group-element/HTMLOptGroupElement.js.map +1 -1
- package/lib/nodes/html-option-element/HTMLOptionElement.d.ts +3 -4
- package/lib/nodes/html-option-element/HTMLOptionElement.js +26 -29
- package/lib/nodes/html-option-element/HTMLOptionElement.js.map +1 -1
- package/lib/nodes/html-script-element/HTMLScriptElement.js +16 -16
- package/lib/nodes/html-script-element/HTMLScriptElement.js.map +1 -1
- package/lib/nodes/html-script-element/ScriptUtility.js +5 -5
- package/lib/nodes/html-script-element/ScriptUtility.js.map +1 -1
- package/lib/nodes/{html-option-element → html-select-element}/HTMLOptionsCollection.d.ts +5 -6
- package/lib/nodes/{html-option-element → html-select-element}/HTMLOptionsCollection.js.map +1 -1
- package/lib/nodes/html-select-element/HTMLSelectElement.d.ts +42 -41
- package/lib/nodes/html-select-element/HTMLSelectElement.js +134 -138
- package/lib/nodes/html-select-element/HTMLSelectElement.js.map +1 -1
- package/lib/nodes/{html-option-element → html-select-element}/IHTMLOptionsCollection.d.ts +4 -5
- package/lib/nodes/html-select-element/IHTMLOptionsCollection.js.map +1 -0
- package/lib/nodes/html-select-element/IHTMLSelectElement.d.ts +22 -2
- package/lib/nodes/html-slot-element/HTMLSlotElement.js +2 -2
- package/lib/nodes/html-slot-element/HTMLSlotElement.js.map +1 -1
- package/lib/nodes/html-style-element/HTMLStyleElement.js +7 -7
- package/lib/nodes/html-style-element/HTMLStyleElement.js.map +1 -1
- package/lib/nodes/html-text-area-element/HTMLTextAreaElement.d.ts +55 -2
- package/lib/nodes/html-text-area-element/HTMLTextAreaElement.js +150 -40
- package/lib/nodes/html-text-area-element/HTMLTextAreaElement.js.map +1 -1
- package/lib/nodes/html-text-area-element/IHTMLTextAreaElement.d.ts +16 -0
- package/lib/nodes/node/Node.d.ts +12 -1
- package/lib/nodes/node/Node.js +50 -4
- package/lib/nodes/node/Node.js.map +1 -1
- package/lib/nodes/node/NodeList.d.ts +2 -3
- package/lib/nodes/node/NodeList.js.map +1 -1
- package/lib/nodes/parent-node/IParentNode.d.ts +4 -4
- package/lib/nodes/parent-node/ParentNodeUtility.d.ts +3 -3
- package/lib/nodes/parent-node/ParentNodeUtility.js +13 -11
- package/lib/nodes/parent-node/ParentNodeUtility.js.map +1 -1
- package/lib/nodes/text/Text.d.ts +13 -0
- package/lib/nodes/text/Text.js +30 -0
- package/lib/nodes/text/Text.js.map +1 -1
- package/lib/query-selector/QuerySelector.js +2 -2
- package/lib/query-selector/QuerySelector.js.map +1 -1
- package/lib/query-selector/SelectorItem.js +2 -0
- package/lib/query-selector/SelectorItem.js.map +1 -1
- package/lib/validity-state/ValidityState.d.ts +87 -0
- package/lib/validity-state/ValidityState.js +171 -0
- package/lib/validity-state/ValidityState.js.map +1 -0
- package/lib/window/GlobalWindow.d.ts +0 -8
- package/lib/window/GlobalWindow.js +0 -2
- package/lib/window/GlobalWindow.js.map +1 -1
- package/lib/window/INodeJSGlobal.d.ts +71 -0
- package/lib/window/INodeJSGlobal.js +2 -0
- package/lib/window/INodeJSGlobal.js.map +1 -0
- package/lib/window/IWindow.d.ts +30 -10
- package/lib/window/Window.d.ts +36 -20
- package/lib/window/Window.js +16 -9
- package/lib/window/Window.js.map +1 -1
- package/lib/xml-http-request/XMLHttpRequest.js +20 -12
- package/lib/xml-http-request/XMLHttpRequest.js.map +1 -1
- package/lib/xml-parser/XMLParser.js +1 -1
- package/lib/xml-parser/XMLParser.js.map +1 -1
- package/package.json +2 -3
- package/src/cookie/CookieJar.ts +1 -1
- package/src/dom-token-list/DOMTokenList.ts +24 -20
- package/src/event/EventTarget.ts +7 -3
- package/src/exception/DOMExceptionNameEnum.ts +5 -1
- package/src/fetch/AbortController.ts +26 -0
- package/src/fetch/AbortSignal.ts +44 -0
- package/src/fetch/Fetch.ts +666 -0
- package/src/fetch/Headers.ts +151 -3
- package/src/fetch/Request.ts +226 -94
- package/src/fetch/{ResourceFetchHandler.ts → ResourceFetch.ts} +3 -3
- package/src/fetch/Response.ts +252 -89
- package/src/fetch/data-uri/DataURIParser.ts +66 -0
- package/src/fetch/multipart/MultipartFormDataParser.ts +113 -0
- package/src/fetch/multipart/MultipartReader.ts +217 -0
- package/src/fetch/types/IHeaders.ts +80 -0
- package/src/fetch/types/IRequest.ts +65 -0
- package/src/fetch/types/IRequestBody.ts +15 -0
- package/src/fetch/types/IRequestCredentials.ts +2 -0
- package/src/fetch/types/IRequestInfo.ts +6 -0
- package/src/fetch/types/IRequestInit.ts +21 -0
- package/src/fetch/types/IRequestRedirect.ts +3 -0
- package/src/fetch/types/IRequestReferrerPolicy.ts +11 -0
- package/src/fetch/types/IResponse.ts +27 -0
- package/src/fetch/types/IResponseBody.ts +15 -0
- package/src/fetch/types/IResponseInit.ts +10 -0
- package/src/fetch/utilities/FetchBodyUtility.ts +175 -0
- package/src/fetch/utilities/FetchCORSUtility.ts +18 -0
- package/src/fetch/utilities/FetchRequestHeaderUtility.ts +47 -0
- package/src/fetch/utilities/FetchRequestReferrerUtility.ts +241 -0
- package/src/fetch/utilities/FetchRequestValidationUtility.ts +82 -0
- package/src/file/Blob.ts +2 -2
- package/src/file/File.ts +5 -1
- package/src/form-data/FormData.ts +237 -0
- package/src/index.ts +27 -1
- package/src/nodes/document/Document.ts +23 -64
- package/src/nodes/document/IDocument.ts +1 -1
- package/src/nodes/document-fragment/DocumentFragment.ts +9 -59
- package/src/nodes/document-fragment/IDocumentFragment.ts +2 -1
- package/src/nodes/element/Element.ts +43 -56
- package/src/nodes/element/ElementUtility.ts +137 -0
- package/src/nodes/element/HTMLCollection.ts +60 -3
- package/src/nodes/element/IHTMLCollection.ts +10 -2
- package/src/nodes/html-anchor-element/HTMLAnchorElement.ts +24 -24
- package/src/nodes/html-base-element/HTMLBaseElement.ts +4 -4
- package/src/nodes/html-button-element/HTMLButtonElement.ts +213 -10
- package/src/nodes/html-button-element/IHTMLButtonElement.ts +31 -2
- package/src/nodes/html-dialog-element/HTMLDialogElement.ts +3 -3
- package/src/nodes/html-element/HTMLElement.ts +12 -12
- package/src/nodes/html-form-element/HTMLFormControlsCollection.ts +76 -0
- package/src/nodes/html-form-element/HTMLFormElement.ts +147 -41
- package/src/nodes/html-form-element/IHTMLFormControlsCollection.ts +45 -0
- package/src/nodes/html-form-element/IHTMLFormElement.ts +17 -6
- package/src/nodes/html-form-element/IRadioNodeList.ts +16 -0
- package/src/nodes/html-form-element/RadioNodeList.ts +24 -0
- package/src/nodes/html-image-element/HTMLImageElement.ts +19 -19
- package/src/nodes/html-input-element/HTMLInputElement.ts +232 -113
- package/src/nodes/html-input-element/IHTMLInputElement.ts +20 -1
- package/src/nodes/html-label-element/HTMLLabelElement.ts +3 -7
- package/src/nodes/html-link-element/HTMLLinkElement.ts +21 -21
- package/src/nodes/html-media-element/HTMLMediaElement.ts +21 -21
- package/src/nodes/html-meta-element/HTMLMetaElement.ts +8 -8
- package/src/nodes/html-opt-group-element/HTMLOptGroupElement.ts +6 -6
- package/src/nodes/html-option-element/HTMLOptionElement.ts +29 -30
- package/src/nodes/html-script-element/HTMLScriptElement.ts +16 -16
- package/src/nodes/html-script-element/ScriptUtility.ts +5 -5
- package/src/nodes/{html-option-element → html-select-element}/HTMLOptionsCollection.ts +5 -9
- package/src/nodes/html-select-element/HTMLSelectElement.ts +159 -170
- package/src/nodes/{html-option-element → html-select-element}/IHTMLOptionsCollection.ts +4 -8
- package/src/nodes/html-select-element/IHTMLSelectElement.ts +25 -2
- package/src/nodes/html-slot-element/HTMLSlotElement.ts +2 -2
- package/src/nodes/html-style-element/HTMLStyleElement.ts +7 -7
- package/src/nodes/html-text-area-element/HTMLTextAreaElement.ts +174 -41
- package/src/nodes/html-text-area-element/IHTMLTextAreaElement.ts +18 -0
- package/src/nodes/node/Node.ts +61 -6
- package/src/nodes/node/NodeList.ts +2 -3
- package/src/nodes/parent-node/IParentNode.ts +7 -4
- package/src/nodes/parent-node/ParentNodeUtility.ts +25 -15
- package/src/nodes/text/Text.ts +38 -0
- package/src/query-selector/QuerySelector.ts +2 -2
- package/src/query-selector/SelectorItem.ts +3 -0
- package/src/validity-state/ValidityState.ts +211 -0
- package/src/window/GlobalWindow.ts +0 -2
- package/src/window/INodeJSGlobal.ts +70 -0
- package/src/window/IWindow.ts +32 -10
- package/src/window/Window.ts +37 -20
- package/src/xml-http-request/XMLHttpRequest.ts +27 -26
- package/src/xml-parser/XMLParser.ts +1 -1
- package/lib/fetch/FetchHandler.d.ts +0 -18
- package/lib/fetch/FetchHandler.js +0 -83
- package/lib/fetch/FetchHandler.js.map +0 -1
- package/lib/fetch/IAbortSignal.d.ts +0 -16
- package/lib/fetch/IAbortSignal.js +0 -4
- package/lib/fetch/IAbortSignal.js.map +0 -1
- package/lib/fetch/IBody.d.ts +0 -17
- package/lib/fetch/IBody.js.map +0 -1
- package/lib/fetch/IHeaders.d.ts +0 -18
- package/lib/fetch/IHeadersInit.js.map +0 -1
- package/lib/fetch/IRequest.d.ts +0 -18
- package/lib/fetch/IRequestInit.d.ts +0 -16
- package/lib/fetch/IRequestInit.js.map +0 -1
- package/lib/fetch/IResponse.d.ts +0 -20
- package/lib/fetch/IResponseInit.d.ts +0 -9
- package/lib/fetch/IResponseInit.js.map +0 -1
- package/lib/fetch/RequestInfo.js +0 -3
- package/lib/fetch/RequestInfo.js.map +0 -1
- package/lib/fetch/ResourceFetchHandler.js.map +0 -1
- package/lib/form-data/IFormData.d.ts +0 -32
- package/lib/form-data/IFormData.js +0 -3
- package/lib/form-data/IFormData.js.map +0 -1
- package/lib/location/RelativeURL.d.ts +0 -15
- package/lib/location/RelativeURL.js +0 -19
- package/lib/location/RelativeURL.js.map +0 -1
- package/lib/nodes/element/HTMLCollectionFactory.d.ts +0 -21
- package/lib/nodes/element/HTMLCollectionFactory.js +0 -31
- package/lib/nodes/element/HTMLCollectionFactory.js.map +0 -1
- package/lib/nodes/html-option-element/IHTMLOptionsCollection.js.map +0 -1
- package/lib/nodes/node/NodeListFactory.d.ts +0 -21
- package/lib/nodes/node/NodeListFactory.js +0 -31
- package/lib/nodes/node/NodeListFactory.js.map +0 -1
- package/lib/nodes/validity-state/ValidityState.d.ts +0 -52
- package/lib/nodes/validity-state/ValidityState.js +0 -81
- package/lib/nodes/validity-state/ValidityState.js.map +0 -1
- package/src/fetch/FetchHandler.ts +0 -90
- package/src/fetch/IAbortSignal.ts +0 -34
- package/src/fetch/IBody.ts +0 -18
- package/src/fetch/IHeaders.ts +0 -18
- package/src/fetch/IRequest.ts +0 -59
- package/src/fetch/IRequestInit.ts +0 -41
- package/src/fetch/IResponse.ts +0 -22
- package/src/fetch/IResponseInit.ts +0 -10
- package/src/fetch/RequestInfo.ts +0 -6
- package/src/form-data/IFormData.ts +0 -33
- package/src/location/RelativeURL.ts +0 -17
- package/src/nodes/element/HTMLCollectionFactory.ts +0 -31
- package/src/nodes/node/NodeListFactory.ts +0 -31
- package/src/nodes/validity-state/ValidityState.ts +0 -84
- /package/lib/fetch/{IHeaders.js → types/IHeaders.js} +0 -0
- /package/lib/fetch/{IHeadersInit.d.ts → types/IHeadersInit.d.ts} +0 -0
- /package/lib/fetch/{IHeadersInit.js → types/IHeadersInit.js} +0 -0
- /package/lib/fetch/{IRequest.js → types/IRequest.js} +0 -0
- /package/lib/fetch/{IRequestInit.js → types/IRequestInit.js} +0 -0
- /package/lib/fetch/{IResponse.js → types/IResponse.js} +0 -0
- /package/lib/fetch/{IResponseInit.js → types/IResponseInit.js} +0 -0
- /package/lib/nodes/{html-option-element → html-select-element}/HTMLOptionsCollection.js +0 -0
- /package/lib/nodes/{html-option-element → html-select-element}/IHTMLOptionsCollection.js +0 -0
- /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 '
|
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 '
|
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
|
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
|
-
|
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.
|
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.
|
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.
|
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.
|
76
|
+
this.removeAttribute('disabled');
|
66
77
|
} else {
|
67
|
-
this.
|
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.
|
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.
|
98
|
+
this.removeAttribute('multiple');
|
88
99
|
} else {
|
89
|
-
this.
|
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.
|
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.
|
120
|
+
this.removeAttribute('autofocus');
|
110
121
|
} else {
|
111
|
-
this.
|
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.
|
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.
|
142
|
+
this.removeAttribute('required');
|
150
143
|
} else {
|
151
|
-
this.
|
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
|
224
|
+
* Returns the associated label elements.
|
232
225
|
*
|
233
|
-
* @returns
|
226
|
+
* @returns Label elements.
|
234
227
|
*/
|
235
|
-
public get
|
236
|
-
|
237
|
-
|
238
|
-
|
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 <
|
245
|
+
return new NodeList<IHTMLLabelElement>();
|
241
246
|
}
|
242
247
|
|
243
248
|
/**
|
244
|
-
* Returns
|
249
|
+
* Returns the parent form element.
|
245
250
|
*
|
246
|
-
* @returns
|
251
|
+
* @returns Form.
|
247
252
|
*/
|
248
|
-
public get
|
249
|
-
return
|
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
|
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
|
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
|
-
*
|
305
|
+
* Sets validation message.
|
306
|
+
*
|
307
|
+
* @param message Message.
|
304
308
|
*/
|
305
|
-
public
|
306
|
-
|
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
|
-
*
|
314
|
+
* Checks validity.
|
315
|
+
*
|
316
|
+
* @returns "true" if the field is valid.
|
323
317
|
*/
|
324
|
-
public
|
325
|
-
const
|
326
|
-
|
327
|
-
|
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
|
-
*
|
327
|
+
* Reports validity.
|
328
|
+
*
|
329
|
+
* @returns "true" if the field is valid.
|
368
330
|
*/
|
369
|
-
public
|
370
|
-
|
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
|
-
*
|
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
|
399
|
-
|
400
|
-
|
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
|
406
|
-
|
407
|
-
|
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 (
|
411
|
-
|
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 =
|
419
|
-
const option = <HTMLOptionElement>
|
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 =
|
439
|
-
(<HTMLOptionElement>
|
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.
|
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
|
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
|
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
|
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 '
|
6
|
-
import ValidityState from '
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
82
|
+
this.removeAttribute('disabled');
|
83
83
|
} else {
|
84
|
-
this.
|
84
|
+
this.setAttribute('disabled', '');
|
85
85
|
}
|
86
86
|
}
|
87
87
|
}
|