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
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
6
|
const HTMLElement_1 = __importDefault(require("../html-element/HTMLElement"));
|
7
|
-
const ValidityState_1 = __importDefault(require("
|
7
|
+
const ValidityState_1 = __importDefault(require("../../validity-state/ValidityState"));
|
8
8
|
const DOMException_1 = __importDefault(require("../../exception/DOMException"));
|
9
9
|
const DOMExceptionNameEnum_1 = __importDefault(require("../../exception/DOMExceptionNameEnum"));
|
10
10
|
const Event_1 = __importDefault(require("../../event/Event"));
|
@@ -13,6 +13,7 @@ const HTMLInputElementSelectionModeEnum_1 = __importDefault(require("./HTMLInput
|
|
13
13
|
const HTMLInputElementSelectionDirectionEnum_1 = __importDefault(require("./HTMLInputElementSelectionDirectionEnum"));
|
14
14
|
const HTMLInputElementValueStepping_1 = __importDefault(require("./HTMLInputElementValueStepping"));
|
15
15
|
const FileList_1 = __importDefault(require("./FileList"));
|
16
|
+
const NodeList_1 = __importDefault(require("../node/NodeList"));
|
16
17
|
/**
|
17
18
|
* HTML Input Element.
|
18
19
|
*
|
@@ -28,15 +29,18 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
28
29
|
// Related to parent form.
|
29
30
|
this.formAction = '';
|
30
31
|
this.formMethod = '';
|
31
|
-
this.formNoValidate = false;
|
32
32
|
// Any type of input
|
33
33
|
this._value = null;
|
34
34
|
this._height = 0;
|
35
35
|
this._width = 0;
|
36
36
|
// Type specific: checkbox/radio
|
37
37
|
this.defaultChecked = false;
|
38
|
+
this._checked = null;
|
38
39
|
// Type specific: file
|
39
40
|
this.files = new FileList_1.default();
|
41
|
+
// All fields
|
42
|
+
this.validationMessage = '';
|
43
|
+
this.validity = new ValidityState_1.default(this);
|
40
44
|
// Events
|
41
45
|
this.oninput = null;
|
42
46
|
this.oninvalid = null;
|
@@ -45,7 +49,6 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
45
49
|
this._selectionStart = null;
|
46
50
|
this._selectionEnd = null;
|
47
51
|
this._selectionDirection = HTMLInputElementSelectionDirectionEnum_1.default.none;
|
48
|
-
this._validationMessage = '';
|
49
52
|
}
|
50
53
|
/**
|
51
54
|
* Returns height.
|
@@ -62,7 +65,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
62
65
|
*/
|
63
66
|
set height(height) {
|
64
67
|
this._height = height;
|
65
|
-
this.
|
68
|
+
this.setAttribute('height', String(height));
|
66
69
|
}
|
67
70
|
/**
|
68
71
|
* Returns width.
|
@@ -79,7 +82,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
79
82
|
*/
|
80
83
|
set width(width) {
|
81
84
|
this._width = width;
|
82
|
-
this.
|
85
|
+
this.setAttribute('width', String(width));
|
83
86
|
}
|
84
87
|
/**
|
85
88
|
* Returns size.
|
@@ -87,7 +90,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
87
90
|
* @returns Size.
|
88
91
|
*/
|
89
92
|
get size() {
|
90
|
-
const size = this.
|
93
|
+
const size = this.getAttribute('size');
|
91
94
|
if (size !== null) {
|
92
95
|
return parseInt(size);
|
93
96
|
}
|
@@ -99,7 +102,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
99
102
|
* @param size Size.
|
100
103
|
*/
|
101
104
|
set size(size) {
|
102
|
-
this.
|
105
|
+
this.setAttribute('size', String(size));
|
103
106
|
}
|
104
107
|
/**
|
105
108
|
* Returns minlength.
|
@@ -107,7 +110,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
107
110
|
* @returns Min length.
|
108
111
|
*/
|
109
112
|
get minLength() {
|
110
|
-
const minLength = this.
|
113
|
+
const minLength = this.getAttribute('minlength');
|
111
114
|
if (minLength !== null) {
|
112
115
|
return parseInt(minLength);
|
113
116
|
}
|
@@ -119,7 +122,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
119
122
|
* @param minLength Min length.
|
120
123
|
*/
|
121
124
|
set minLength(minlength) {
|
122
|
-
this.
|
125
|
+
this.setAttribute('minlength', String(minlength));
|
123
126
|
}
|
124
127
|
/**
|
125
128
|
* Returns maxlength.
|
@@ -127,7 +130,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
127
130
|
* @returns Max length.
|
128
131
|
*/
|
129
132
|
get maxLength() {
|
130
|
-
const maxLength = this.
|
133
|
+
const maxLength = this.getAttribute('maxlength');
|
131
134
|
if (maxLength !== null) {
|
132
135
|
return parseInt(maxLength);
|
133
136
|
}
|
@@ -139,7 +142,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
139
142
|
* @param maxlength Max length.
|
140
143
|
*/
|
141
144
|
set maxLength(maxLength) {
|
142
|
-
this.
|
145
|
+
this.setAttribute('maxlength', String(maxLength));
|
143
146
|
}
|
144
147
|
/**
|
145
148
|
* Returns type.
|
@@ -147,7 +150,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
147
150
|
* @returns Type. Defaults to "text".
|
148
151
|
*/
|
149
152
|
get type() {
|
150
|
-
return this.
|
153
|
+
return this.getAttribute('type') || 'text';
|
151
154
|
}
|
152
155
|
/**
|
153
156
|
* Sets type.
|
@@ -155,7 +158,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
155
158
|
* @param type Type.
|
156
159
|
*/
|
157
160
|
set type(type) {
|
158
|
-
this.
|
161
|
+
this.setAttribute('type', type.toLowerCase());
|
159
162
|
}
|
160
163
|
/**
|
161
164
|
* Returns name.
|
@@ -163,7 +166,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
163
166
|
* @returns Name.
|
164
167
|
*/
|
165
168
|
get name() {
|
166
|
-
return this.
|
169
|
+
return this.getAttribute('name') || '';
|
167
170
|
}
|
168
171
|
/**
|
169
172
|
* Sets name.
|
@@ -171,7 +174,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
171
174
|
* @param name Name.
|
172
175
|
*/
|
173
176
|
set name(name) {
|
174
|
-
this.
|
177
|
+
this.setAttribute('name', name);
|
175
178
|
}
|
176
179
|
/**
|
177
180
|
* Returns alt.
|
@@ -179,7 +182,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
179
182
|
* @returns Alt.
|
180
183
|
*/
|
181
184
|
get alt() {
|
182
|
-
return this.
|
185
|
+
return this.getAttribute('alt') || '';
|
183
186
|
}
|
184
187
|
/**
|
185
188
|
* Sets alt.
|
@@ -187,7 +190,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
187
190
|
* @param alt Alt.
|
188
191
|
*/
|
189
192
|
set alt(alt) {
|
190
|
-
this.
|
193
|
+
this.setAttribute('alt', alt);
|
191
194
|
}
|
192
195
|
/**
|
193
196
|
* Returns min.
|
@@ -195,7 +198,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
195
198
|
* @returns Min.
|
196
199
|
*/
|
197
200
|
get min() {
|
198
|
-
return this.
|
201
|
+
return this.getAttribute('min') || '';
|
199
202
|
}
|
200
203
|
/**
|
201
204
|
* Sets min.
|
@@ -203,7 +206,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
203
206
|
* @param min Min.
|
204
207
|
*/
|
205
208
|
set min(min) {
|
206
|
-
this.
|
209
|
+
this.setAttribute('min', min);
|
207
210
|
}
|
208
211
|
/**
|
209
212
|
* Returns max.
|
@@ -211,7 +214,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
211
214
|
* @returns Max.
|
212
215
|
*/
|
213
216
|
get max() {
|
214
|
-
return this.
|
217
|
+
return this.getAttribute('max') || '';
|
215
218
|
}
|
216
219
|
/**
|
217
220
|
* Sets max.
|
@@ -219,7 +222,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
219
222
|
* @param max Max.
|
220
223
|
*/
|
221
224
|
set max(max) {
|
222
|
-
this.
|
225
|
+
this.setAttribute('max', max);
|
223
226
|
}
|
224
227
|
/**
|
225
228
|
* Returns pattern.
|
@@ -227,7 +230,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
227
230
|
* @returns Pattern.
|
228
231
|
*/
|
229
232
|
get pattern() {
|
230
|
-
return this.
|
233
|
+
return this.getAttribute('pattern') || '';
|
231
234
|
}
|
232
235
|
/**
|
233
236
|
* Sets pattern.
|
@@ -235,7 +238,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
235
238
|
* @param pattern Pattern.
|
236
239
|
*/
|
237
240
|
set pattern(pattern) {
|
238
|
-
this.
|
241
|
+
this.setAttribute('pattern', pattern);
|
239
242
|
}
|
240
243
|
/**
|
241
244
|
* Returns placeholder.
|
@@ -243,7 +246,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
243
246
|
* @returns Placeholder.
|
244
247
|
*/
|
245
248
|
get placeholder() {
|
246
|
-
return this.
|
249
|
+
return this.getAttribute('placeholder') || '';
|
247
250
|
}
|
248
251
|
/**
|
249
252
|
* Sets placeholder.
|
@@ -251,7 +254,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
251
254
|
* @param placeholder Placeholder.
|
252
255
|
*/
|
253
256
|
set placeholder(placeholder) {
|
254
|
-
this.
|
257
|
+
this.setAttribute('placeholder', placeholder);
|
255
258
|
}
|
256
259
|
/**
|
257
260
|
* Returns step.
|
@@ -259,7 +262,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
259
262
|
* @returns Step.
|
260
263
|
*/
|
261
264
|
get step() {
|
262
|
-
return this.
|
265
|
+
return this.getAttribute('step') || '';
|
263
266
|
}
|
264
267
|
/**
|
265
268
|
* Sets step.
|
@@ -267,7 +270,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
267
270
|
* @param step Step.
|
268
271
|
*/
|
269
272
|
set step(step) {
|
270
|
-
this.
|
273
|
+
this.setAttribute('step', step);
|
271
274
|
}
|
272
275
|
/**
|
273
276
|
* Returns inputmode.
|
@@ -275,7 +278,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
275
278
|
* @returns Inputmode.
|
276
279
|
*/
|
277
280
|
get inputmode() {
|
278
|
-
return this.
|
281
|
+
return this.getAttribute('inputmode') || '';
|
279
282
|
}
|
280
283
|
/**
|
281
284
|
* Sets inputmode.
|
@@ -283,7 +286,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
283
286
|
* @param inputmode Inputmode.
|
284
287
|
*/
|
285
288
|
set inputmode(inputmode) {
|
286
|
-
this.
|
289
|
+
this.setAttribute('inputmode', inputmode);
|
287
290
|
}
|
288
291
|
/**
|
289
292
|
* Returns accept.
|
@@ -291,7 +294,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
291
294
|
* @returns Accept.
|
292
295
|
*/
|
293
296
|
get accept() {
|
294
|
-
return this.
|
297
|
+
return this.getAttribute('accept') || '';
|
295
298
|
}
|
296
299
|
/**
|
297
300
|
* Sets accept.
|
@@ -299,7 +302,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
299
302
|
* @param accept Accept.
|
300
303
|
*/
|
301
304
|
set accept(accept) {
|
302
|
-
this.
|
305
|
+
this.setAttribute('accept', accept);
|
303
306
|
}
|
304
307
|
/**
|
305
308
|
* Returns allowdirs.
|
@@ -307,7 +310,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
307
310
|
* @returns Allowdirs.
|
308
311
|
*/
|
309
312
|
get allowdirs() {
|
310
|
-
return this.
|
313
|
+
return this.getAttribute('allowdirs') || '';
|
311
314
|
}
|
312
315
|
/**
|
313
316
|
* Sets allowdirs.
|
@@ -315,7 +318,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
315
318
|
* @param allowdirs Allowdirs.
|
316
319
|
*/
|
317
320
|
set allowdirs(allowdirs) {
|
318
|
-
this.
|
321
|
+
this.setAttribute('allowdirs', allowdirs);
|
319
322
|
}
|
320
323
|
/**
|
321
324
|
* Returns autocomplete.
|
@@ -323,7 +326,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
323
326
|
* @returns Autocomplete.
|
324
327
|
*/
|
325
328
|
get autocomplete() {
|
326
|
-
return this.
|
329
|
+
return this.getAttribute('autocomplete') || '';
|
327
330
|
}
|
328
331
|
/**
|
329
332
|
* Sets autocomplete.
|
@@ -331,7 +334,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
331
334
|
* @param autocomplete Autocomplete.
|
332
335
|
*/
|
333
336
|
set autocomplete(autocomplete) {
|
334
|
-
this.
|
337
|
+
this.setAttribute('autocomplete', autocomplete);
|
335
338
|
}
|
336
339
|
/**
|
337
340
|
* Returns src.
|
@@ -339,7 +342,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
339
342
|
* @returns Src.
|
340
343
|
*/
|
341
344
|
get src() {
|
342
|
-
return this.
|
345
|
+
return this.getAttribute('src') || '';
|
343
346
|
}
|
344
347
|
/**
|
345
348
|
* Sets src.
|
@@ -347,7 +350,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
347
350
|
* @param src Src.
|
348
351
|
*/
|
349
352
|
set src(src) {
|
350
|
-
this.
|
353
|
+
this.setAttribute('src', src);
|
351
354
|
}
|
352
355
|
/**
|
353
356
|
* Returns defaultValue.
|
@@ -355,7 +358,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
355
358
|
* @returns Defaultvalue.
|
356
359
|
*/
|
357
360
|
get defaultValue() {
|
358
|
-
return this.
|
361
|
+
return this.getAttribute('value') || '';
|
359
362
|
}
|
360
363
|
/**
|
361
364
|
* Sets defaultValue.
|
@@ -363,7 +366,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
363
366
|
* @param defaultValue Defaultvalue.
|
364
367
|
*/
|
365
368
|
set defaultValue(defaultValue) {
|
366
|
-
this.
|
369
|
+
this.setAttribute('value', defaultValue);
|
367
370
|
}
|
368
371
|
/**
|
369
372
|
* Returns read only.
|
@@ -371,7 +374,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
371
374
|
* @returns Read only.
|
372
375
|
*/
|
373
376
|
get readOnly() {
|
374
|
-
return this.
|
377
|
+
return this.getAttribute('readonly') !== null;
|
375
378
|
}
|
376
379
|
/**
|
377
380
|
* Sets read only.
|
@@ -380,10 +383,10 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
380
383
|
*/
|
381
384
|
set readOnly(readOnly) {
|
382
385
|
if (!readOnly) {
|
383
|
-
this.
|
386
|
+
this.removeAttribute('readonly');
|
384
387
|
}
|
385
388
|
else {
|
386
|
-
this.
|
389
|
+
this.setAttribute('readonly', '');
|
387
390
|
}
|
388
391
|
}
|
389
392
|
/**
|
@@ -392,7 +395,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
392
395
|
* @returns Disabled.
|
393
396
|
*/
|
394
397
|
get disabled() {
|
395
|
-
return this.
|
398
|
+
return this.getAttribute('disabled') !== null;
|
396
399
|
}
|
397
400
|
/**
|
398
401
|
* Sets disabled.
|
@@ -401,10 +404,10 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
401
404
|
*/
|
402
405
|
set disabled(disabled) {
|
403
406
|
if (!disabled) {
|
404
|
-
this.
|
407
|
+
this.removeAttribute('disabled');
|
405
408
|
}
|
406
409
|
else {
|
407
|
-
this.
|
410
|
+
this.setAttribute('disabled', '');
|
408
411
|
}
|
409
412
|
}
|
410
413
|
/**
|
@@ -413,7 +416,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
413
416
|
* @returns Autofocus.
|
414
417
|
*/
|
415
418
|
get autofocus() {
|
416
|
-
return this.
|
419
|
+
return this.getAttribute('autofocus') !== null;
|
417
420
|
}
|
418
421
|
/**
|
419
422
|
* Sets autofocus.
|
@@ -422,10 +425,10 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
422
425
|
*/
|
423
426
|
set autofocus(autofocus) {
|
424
427
|
if (!autofocus) {
|
425
|
-
this.
|
428
|
+
this.removeAttribute('autofocus');
|
426
429
|
}
|
427
430
|
else {
|
428
|
-
this.
|
431
|
+
this.setAttribute('autofocus', '');
|
429
432
|
}
|
430
433
|
}
|
431
434
|
/**
|
@@ -434,7 +437,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
434
437
|
* @returns Required.
|
435
438
|
*/
|
436
439
|
get required() {
|
437
|
-
return this.
|
440
|
+
return this.getAttribute('required') !== null;
|
438
441
|
}
|
439
442
|
/**
|
440
443
|
* Sets required.
|
@@ -443,10 +446,10 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
443
446
|
*/
|
444
447
|
set required(required) {
|
445
448
|
if (!required) {
|
446
|
-
this.
|
449
|
+
this.removeAttribute('required');
|
447
450
|
}
|
448
451
|
else {
|
449
|
-
this.
|
452
|
+
this.setAttribute('required', '');
|
450
453
|
}
|
451
454
|
}
|
452
455
|
/**
|
@@ -455,7 +458,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
455
458
|
* @returns Indeterminate.
|
456
459
|
*/
|
457
460
|
get indeterminate() {
|
458
|
-
return this.
|
461
|
+
return this.getAttribute('indeterminate') !== null;
|
459
462
|
}
|
460
463
|
/**
|
461
464
|
* Sets indeterminate.
|
@@ -464,10 +467,10 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
464
467
|
*/
|
465
468
|
set indeterminate(indeterminate) {
|
466
469
|
if (!indeterminate) {
|
467
|
-
this.
|
470
|
+
this.removeAttribute('indeterminate');
|
468
471
|
}
|
469
472
|
else {
|
470
|
-
this.
|
473
|
+
this.setAttribute('indeterminate', '');
|
471
474
|
}
|
472
475
|
}
|
473
476
|
/**
|
@@ -476,7 +479,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
476
479
|
* @returns Multiple.
|
477
480
|
*/
|
478
481
|
get multiple() {
|
479
|
-
return this.
|
482
|
+
return this.getAttribute('multiple') !== null;
|
480
483
|
}
|
481
484
|
/**
|
482
485
|
* Sets multiple.
|
@@ -485,10 +488,10 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
485
488
|
*/
|
486
489
|
set multiple(multiple) {
|
487
490
|
if (!multiple) {
|
488
|
-
this.
|
491
|
+
this.removeAttribute('multiple');
|
489
492
|
}
|
490
493
|
else {
|
491
|
-
this.
|
494
|
+
this.setAttribute('multiple', '');
|
492
495
|
}
|
493
496
|
}
|
494
497
|
/**
|
@@ -497,7 +500,10 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
497
500
|
* @returns Checked.
|
498
501
|
*/
|
499
502
|
get checked() {
|
500
|
-
|
503
|
+
if (this._checked !== null) {
|
504
|
+
return this._checked;
|
505
|
+
}
|
506
|
+
return this.getAttribute('checked') !== null;
|
501
507
|
}
|
502
508
|
/**
|
503
509
|
* Sets checked.
|
@@ -505,11 +511,15 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
505
511
|
* @param checked Checked.
|
506
512
|
*/
|
507
513
|
set checked(checked) {
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
514
|
+
this._checked = checked;
|
515
|
+
if (checked && this.type === 'radio' && this.name) {
|
516
|
+
const root = (this._formNode || this.getRootNode());
|
517
|
+
const radioButtons = root.querySelectorAll(`input[type="radio"][name="${this.name}"]`);
|
518
|
+
for (const radioButton of radioButtons) {
|
519
|
+
if (radioButton !== this) {
|
520
|
+
radioButton['_checked'] = false;
|
521
|
+
}
|
522
|
+
}
|
513
523
|
}
|
514
524
|
}
|
515
525
|
/**
|
@@ -524,16 +534,16 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
524
534
|
case 'image':
|
525
535
|
case 'reset':
|
526
536
|
case 'button':
|
527
|
-
return this.
|
537
|
+
return this.getAttribute('value') || '';
|
528
538
|
case 'checkbox':
|
529
539
|
case 'radio':
|
530
|
-
const attritube = this.
|
540
|
+
const attritube = this.getAttribute('value');
|
531
541
|
return attritube !== null ? attritube : 'on';
|
532
542
|
case 'file':
|
533
543
|
return this.files.length > 0 ? '/fake/path/' + this.files[0].name : '';
|
534
544
|
}
|
535
545
|
if (this._value === null) {
|
536
|
-
return this.
|
546
|
+
return this.getAttribute('value') || '';
|
537
547
|
}
|
538
548
|
return this._value;
|
539
549
|
}
|
@@ -553,7 +563,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
553
563
|
case 'button':
|
554
564
|
case 'checkbox':
|
555
565
|
case 'radio':
|
556
|
-
this.
|
566
|
+
this.setAttribute('value', value);
|
557
567
|
break;
|
558
568
|
case 'file':
|
559
569
|
if (value !== '') {
|
@@ -644,24 +654,33 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
644
654
|
this.setSelectionRange(this._selectionStart, this._selectionEnd, direction);
|
645
655
|
}
|
646
656
|
/**
|
647
|
-
* Returns
|
657
|
+
* Returns no validate.
|
648
658
|
*
|
649
|
-
* @returns
|
659
|
+
* @returns No validate.
|
650
660
|
*/
|
651
|
-
get
|
652
|
-
|
653
|
-
|
654
|
-
|
661
|
+
get formNoValidate() {
|
662
|
+
return this.getAttribute('formnovalidate') !== null;
|
663
|
+
}
|
664
|
+
/**
|
665
|
+
* Sets no validate.
|
666
|
+
*
|
667
|
+
* @param formNoValidate No validate.
|
668
|
+
*/
|
669
|
+
set formNoValidate(formNoValidate) {
|
670
|
+
if (!formNoValidate) {
|
671
|
+
this.removeAttribute('formnovalidate');
|
672
|
+
}
|
673
|
+
else {
|
674
|
+
this.setAttribute('formnovalidate', '');
|
655
675
|
}
|
656
|
-
return parent;
|
657
676
|
}
|
658
677
|
/**
|
659
|
-
* Returns
|
678
|
+
* Returns the parent form element.
|
660
679
|
*
|
661
|
-
* @returns
|
680
|
+
* @returns Form.
|
662
681
|
*/
|
663
|
-
get
|
664
|
-
return
|
682
|
+
get form() {
|
683
|
+
return this._formNode;
|
665
684
|
}
|
666
685
|
/**
|
667
686
|
* Returns "true" if it will validate.
|
@@ -692,12 +711,26 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
692
711
|
return this.value ? parseFloat(this.value) : NaN;
|
693
712
|
}
|
694
713
|
/**
|
695
|
-
* Returns
|
714
|
+
* Returns the associated label elements.
|
696
715
|
*
|
697
|
-
* @returns
|
716
|
+
* @returns Label elements.
|
698
717
|
*/
|
699
|
-
get
|
700
|
-
|
718
|
+
get labels() {
|
719
|
+
const id = this.id;
|
720
|
+
if (id) {
|
721
|
+
const rootNode = this.getRootNode();
|
722
|
+
const labels = rootNode.querySelectorAll(`label[for="${id}"]`);
|
723
|
+
let parent = this.parentNode;
|
724
|
+
while (parent) {
|
725
|
+
if (parent['tagName'] === 'LABEL') {
|
726
|
+
labels.push(parent);
|
727
|
+
break;
|
728
|
+
}
|
729
|
+
parent = parent.parentNode;
|
730
|
+
}
|
731
|
+
return labels;
|
732
|
+
}
|
733
|
+
return new NodeList_1.default();
|
701
734
|
}
|
702
735
|
/**
|
703
736
|
* Sets validation message.
|
@@ -705,18 +738,7 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
705
738
|
* @param message Message.
|
706
739
|
*/
|
707
740
|
setCustomValidity(message) {
|
708
|
-
this.
|
709
|
-
}
|
710
|
-
/**
|
711
|
-
* Reports validity by dispatching an "invalid" event.
|
712
|
-
*/
|
713
|
-
reportValidity() {
|
714
|
-
if (this._validationMessage) {
|
715
|
-
this.dispatchEvent(new Event_1.default('invalid', {
|
716
|
-
bubbles: true,
|
717
|
-
cancelable: true
|
718
|
-
}));
|
719
|
-
}
|
741
|
+
this.validationMessage = String(message);
|
720
742
|
}
|
721
743
|
/**
|
722
744
|
* Selects the text.
|
@@ -813,7 +835,24 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
813
835
|
* @returns "true" if the field is valid.
|
814
836
|
*/
|
815
837
|
checkValidity() {
|
816
|
-
|
838
|
+
const valid = this.disabled ||
|
839
|
+
this.readOnly ||
|
840
|
+
this.type === 'hidden' ||
|
841
|
+
this.type === 'reset' ||
|
842
|
+
this.type === 'button' ||
|
843
|
+
this.validity.valid;
|
844
|
+
if (!valid) {
|
845
|
+
this.dispatchEvent(new Event_1.default('invalid', { bubbles: true, cancelable: true }));
|
846
|
+
}
|
847
|
+
return valid;
|
848
|
+
}
|
849
|
+
/**
|
850
|
+
* Reports validity.
|
851
|
+
*
|
852
|
+
* @returns "true" if the field is valid.
|
853
|
+
*/
|
854
|
+
reportValidity() {
|
855
|
+
return this.checkValidity();
|
817
856
|
}
|
818
857
|
/**
|
819
858
|
* Steps up.
|
@@ -848,7 +887,6 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
848
887
|
const clone = super.cloneNode(deep);
|
849
888
|
clone.formAction = this.formAction;
|
850
889
|
clone.formMethod = this.formMethod;
|
851
|
-
clone.formNoValidate = this.formNoValidate;
|
852
890
|
clone._value = this._value;
|
853
891
|
clone._height = this._height;
|
854
892
|
clone._width = this._width;
|
@@ -860,22 +898,79 @@ class HTMLInputElement extends HTMLElement_1.default {
|
|
860
898
|
return clone;
|
861
899
|
}
|
862
900
|
/**
|
863
|
-
*
|
864
|
-
|
865
|
-
|
901
|
+
* @override
|
902
|
+
*/
|
903
|
+
dispatchEvent(event) {
|
904
|
+
if (event.type === 'click' && this.disabled) {
|
905
|
+
return false;
|
906
|
+
}
|
907
|
+
const returnValue = super.dispatchEvent(event);
|
908
|
+
if (event.type === 'click' &&
|
909
|
+
this.isConnected &&
|
910
|
+
(!this.readOnly || this.type === 'checkbox' || this.type === 'radio')) {
|
911
|
+
if (this.type === 'checkbox' || this.type === 'radio') {
|
912
|
+
this.checked = this.type === 'checkbox' ? !this.checked : true;
|
913
|
+
this.dispatchEvent(new Event_1.default('input', { bubbles: true, cancelable: true }));
|
914
|
+
this.dispatchEvent(new Event_1.default('change', { bubbles: true, cancelable: true }));
|
915
|
+
}
|
916
|
+
else if (this.type === 'submit') {
|
917
|
+
const form = this._formNode;
|
918
|
+
if (form) {
|
919
|
+
form.requestSubmit();
|
920
|
+
}
|
921
|
+
}
|
922
|
+
else if (this.type === 'reset') {
|
923
|
+
const form = this._formNode;
|
924
|
+
if (form) {
|
925
|
+
form.reset();
|
926
|
+
}
|
927
|
+
}
|
928
|
+
}
|
929
|
+
return returnValue;
|
930
|
+
}
|
931
|
+
/**
|
932
|
+
* @override
|
866
933
|
*/
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
934
|
+
setAttributeNode(attribute) {
|
935
|
+
const replacedAttribute = super.setAttributeNode(attribute);
|
936
|
+
const oldValue = replacedAttribute ? replacedAttribute.value : null;
|
937
|
+
if ((attribute.name === 'id' || attribute.name === 'name') && this._formNode) {
|
938
|
+
if (oldValue) {
|
939
|
+
this._formNode._removeFormControlItem(this, oldValue);
|
940
|
+
}
|
941
|
+
if (attribute.value) {
|
942
|
+
this._formNode._appendFormControlItem(this, attribute.value);
|
943
|
+
}
|
944
|
+
}
|
945
|
+
return replacedAttribute;
|
946
|
+
}
|
947
|
+
/**
|
948
|
+
* @override
|
949
|
+
*/
|
950
|
+
removeAttributeNode(attribute) {
|
951
|
+
super.removeAttributeNode(attribute);
|
952
|
+
if ((attribute.name === 'id' || attribute.name === 'name') && this._formNode) {
|
953
|
+
this._formNode._removeFormControlItem(this, attribute.value);
|
954
|
+
}
|
955
|
+
return attribute;
|
956
|
+
}
|
957
|
+
/**
|
958
|
+
* @override
|
959
|
+
*/
|
960
|
+
_connectToNode(parentNode = null) {
|
961
|
+
const oldFormNode = this._formNode;
|
962
|
+
super._connectToNode(parentNode);
|
963
|
+
if (oldFormNode !== this._formNode) {
|
964
|
+
if (oldFormNode) {
|
965
|
+
oldFormNode._removeFormControlItem(this, this.name);
|
966
|
+
oldFormNode._removeFormControlItem(this, this.id);
|
967
|
+
}
|
968
|
+
if (this._formNode) {
|
969
|
+
this._formNode._appendFormControlItem(this, this.name);
|
970
|
+
this._formNode._appendFormControlItem(this, this.id);
|
971
|
+
}
|
972
|
+
}
|
973
|
+
}
|
879
974
|
/**
|
880
975
|
* Checks is selection is supported.
|
881
976
|
*
|