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.
- 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-audio-element/Audio.d.ts +15 -0
- package/lib/nodes/html-audio-element/Audio.js +27 -0
- package/lib/nodes/html-audio-element/Audio.js.map +1 -0
- 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 +79 -3
- package/lib/nodes/html-button-element/HTMLButtonElement.js +158 -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 +37 -20
- package/lib/window/Window.js +22 -10
- 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-audio-element/Audio.ts +22 -0
- package/src/nodes/html-base-element/HTMLBaseElement.ts +4 -4
- package/src/nodes/html-button-element/HTMLButtonElement.ts +184 -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 +43 -21
- 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,5 +1,5 @@
|
|
1
1
|
import HTMLElement from '../html-element/HTMLElement';
|
2
|
-
import ValidityState from '
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
438
|
+
this.removeAttribute('readonly');
|
428
439
|
} else {
|
429
|
-
this.
|
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.
|
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.
|
460
|
+
this.removeAttribute('disabled');
|
450
461
|
} else {
|
451
|
-
this.
|
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.
|
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.
|
482
|
+
this.removeAttribute('autofocus');
|
472
483
|
} else {
|
473
|
-
this.
|
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.
|
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.
|
504
|
+
this.removeAttribute('required');
|
494
505
|
} else {
|
495
|
-
this.
|
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.
|
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.
|
526
|
+
this.removeAttribute('indeterminate');
|
516
527
|
} else {
|
517
|
-
this.
|
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.
|
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.
|
548
|
+
this.removeAttribute('multiple');
|
538
549
|
} else {
|
539
|
-
this.
|
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
|
-
|
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
|
-
|
559
|
-
|
560
|
-
|
561
|
-
this.
|
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.
|
598
|
+
return this.getAttribute('value') || '';
|
578
599
|
case 'checkbox':
|
579
600
|
case 'radio':
|
580
|
-
const attritube = this.
|
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.
|
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.
|
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
|
750
|
+
* Returns no validate.
|
730
751
|
*
|
731
|
-
* @returns
|
752
|
+
* @returns No validate.
|
732
753
|
*/
|
733
|
-
public get
|
734
|
-
|
735
|
-
|
736
|
-
|
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
|
772
|
+
* Returns the parent form element.
|
743
773
|
*
|
744
|
-
* @returns
|
774
|
+
* @returns Form.
|
745
775
|
*/
|
746
|
-
public get
|
747
|
-
return
|
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
|
814
|
+
* Returns the associated label elements.
|
785
815
|
*
|
786
|
-
* @returns
|
816
|
+
* @returns Label elements.
|
787
817
|
*/
|
788
|
-
public get
|
789
|
-
|
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.
|
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
|
-
|
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
|
-
*
|
990
|
-
*
|
991
|
-
* @returns "true" if private value is supported.
|
1039
|
+
* @override
|
992
1040
|
*/
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
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.
|