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,11 +1,10 @@
|
|
1
|
-
import QuerySelector from '../../query-selector/QuerySelector';
|
2
1
|
import XMLParser from '../../xml-parser/XMLParser';
|
3
2
|
import IDocumentFragment from '../document-fragment/IDocumentFragment';
|
4
3
|
import IDocument from '../document/IDocument';
|
5
4
|
import IElement from '../element/IElement';
|
6
5
|
import IHTMLCollection from '../element/IHTMLCollection';
|
7
6
|
import INode from '../node/INode';
|
8
|
-
import
|
7
|
+
import HTMLCollection from '../element/HTMLCollection';
|
9
8
|
|
10
9
|
/**
|
11
10
|
* Parent node utility.
|
@@ -78,10 +77,21 @@ export default class ParentNodeUtility {
|
|
78
77
|
* @returns Matching element.
|
79
78
|
*/
|
80
79
|
public static getElementsByClassName(
|
81
|
-
parentNode:
|
80
|
+
parentNode: IElement | IDocumentFragment | IDocument,
|
82
81
|
className: string
|
83
|
-
): IHTMLCollection<IElement> {
|
84
|
-
|
82
|
+
): IHTMLCollection<IElement, IElement> {
|
83
|
+
let matches = new HTMLCollection<IElement, IElement>();
|
84
|
+
|
85
|
+
for (const child of parentNode.children) {
|
86
|
+
if (child.className.split(' ').includes(className)) {
|
87
|
+
matches.push(child);
|
88
|
+
}
|
89
|
+
matches = <HTMLCollection<IElement, IElement>>(
|
90
|
+
matches.concat(this.getElementsByClassName(<IElement>child, className))
|
91
|
+
);
|
92
|
+
}
|
93
|
+
|
94
|
+
return matches;
|
85
95
|
}
|
86
96
|
|
87
97
|
/**
|
@@ -94,18 +104,18 @@ export default class ParentNodeUtility {
|
|
94
104
|
public static getElementsByTagName(
|
95
105
|
parentNode: IElement | IDocumentFragment | IDocument,
|
96
106
|
tagName: string
|
97
|
-
): IHTMLCollection<IElement> {
|
107
|
+
): IHTMLCollection<IElement, IElement> {
|
98
108
|
const upperTagName = tagName.toUpperCase();
|
99
|
-
const matches = HTMLCollectionFactory.create();
|
100
109
|
const includeAll = tagName === '*';
|
110
|
+
let matches = new HTMLCollection<IElement, IElement>();
|
101
111
|
|
102
112
|
for (const child of parentNode.children) {
|
103
113
|
if (includeAll || child.tagName === upperTagName) {
|
104
114
|
matches.push(child);
|
105
115
|
}
|
106
|
-
|
107
|
-
matches.
|
108
|
-
|
116
|
+
matches = <HTMLCollection<IElement, IElement>>(
|
117
|
+
matches.concat(this.getElementsByTagName(<IElement>child, tagName))
|
118
|
+
);
|
109
119
|
}
|
110
120
|
|
111
121
|
return matches;
|
@@ -123,18 +133,18 @@ export default class ParentNodeUtility {
|
|
123
133
|
parentNode: IElement | IDocumentFragment | IDocument,
|
124
134
|
namespaceURI: string,
|
125
135
|
tagName: string
|
126
|
-
): IHTMLCollection<IElement> {
|
136
|
+
): IHTMLCollection<IElement, IElement> {
|
127
137
|
const upperTagName = tagName.toUpperCase();
|
128
|
-
const matches = HTMLCollectionFactory.create();
|
129
138
|
const includeAll = tagName === '*';
|
139
|
+
let matches = new HTMLCollection<IElement, IElement>();
|
130
140
|
|
131
141
|
for (const child of parentNode.children) {
|
132
142
|
if ((includeAll || child.tagName === upperTagName) && child.namespaceURI === namespaceURI) {
|
133
143
|
matches.push(child);
|
134
144
|
}
|
135
|
-
|
136
|
-
matches.
|
137
|
-
|
145
|
+
matches = <HTMLCollection<IElement, IElement>>(
|
146
|
+
matches.concat(this.getElementsByTagNameNS(<IElement>child, namespaceURI, tagName))
|
147
|
+
);
|
138
148
|
}
|
139
149
|
|
140
150
|
return matches;
|
package/src/nodes/text/Text.ts
CHANGED
@@ -3,6 +3,8 @@ import CharacterData from '../character-data/CharacterData';
|
|
3
3
|
import IText from './IText';
|
4
4
|
import DOMException from '../../exception/DOMException';
|
5
5
|
import DOMExceptionNameEnum from '../../exception/DOMExceptionNameEnum';
|
6
|
+
import HTMLTextAreaElement from '../html-text-area-element/HTMLTextAreaElement';
|
7
|
+
import INode from '../node/INode';
|
6
8
|
|
7
9
|
/**
|
8
10
|
* Text node.
|
@@ -19,6 +21,24 @@ export default class Text extends CharacterData implements IText {
|
|
19
21
|
return '#text';
|
20
22
|
}
|
21
23
|
|
24
|
+
/**
|
25
|
+
* @override
|
26
|
+
*/
|
27
|
+
public override get data(): string {
|
28
|
+
return this._data;
|
29
|
+
}
|
30
|
+
|
31
|
+
/**
|
32
|
+
* @override
|
33
|
+
*/
|
34
|
+
public override set data(data: string) {
|
35
|
+
super.data = data;
|
36
|
+
|
37
|
+
if (this._textAreaNode) {
|
38
|
+
(<HTMLTextAreaElement>this._textAreaNode)._resetSelection();
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
22
42
|
/**
|
23
43
|
* Breaks the Text node into two nodes at the specified offset, keeping both nodes in the tree as siblings.
|
24
44
|
*
|
@@ -69,4 +89,22 @@ export default class Text extends CharacterData implements IText {
|
|
69
89
|
public cloneNode(deep = false): IText {
|
70
90
|
return <Text>super.cloneNode(deep);
|
71
91
|
}
|
92
|
+
|
93
|
+
/**
|
94
|
+
* @override
|
95
|
+
*/
|
96
|
+
public override _connectToNode(parentNode: INode = null): void {
|
97
|
+
const oldTextAreaNode = <HTMLTextAreaElement>this._textAreaNode;
|
98
|
+
|
99
|
+
super._connectToNode(parentNode);
|
100
|
+
|
101
|
+
if (oldTextAreaNode !== this._textAreaNode) {
|
102
|
+
if (oldTextAreaNode) {
|
103
|
+
oldTextAreaNode._resetSelection();
|
104
|
+
}
|
105
|
+
if (this._textAreaNode) {
|
106
|
+
(<HTMLTextAreaElement>this._textAreaNode)._resetSelection();
|
107
|
+
}
|
108
|
+
}
|
109
|
+
}
|
72
110
|
}
|
@@ -4,7 +4,7 @@ import INode from '../nodes/node/INode';
|
|
4
4
|
import Node from '../nodes/node/Node';
|
5
5
|
import INodeList from '../nodes/node/INodeList';
|
6
6
|
import SelectorItem from './SelectorItem';
|
7
|
-
import
|
7
|
+
import NodeList from '../nodes/node/NodeList';
|
8
8
|
|
9
9
|
const SELECTOR_PART_REGEXP = /(\[[^\]]+\]|[a-zA-Z0-9-_.#"*:()\]]+)|([ ,>]+)/g;
|
10
10
|
|
@@ -22,7 +22,7 @@ export default class QuerySelector {
|
|
22
22
|
* @returns HTML elements.
|
23
23
|
*/
|
24
24
|
public static querySelectorAll(node: INode, selector: string): INodeList<IElement> {
|
25
|
-
const matches = <
|
25
|
+
const matches = new NodeList<IElement>();
|
26
26
|
|
27
27
|
for (const parts of this.getSelectorParts(selector)) {
|
28
28
|
for (const element of this.findAll(node, [node], parts)) {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import DOMException from '../exception/DOMException';
|
2
2
|
import IElement from '../nodes/element/IElement';
|
3
3
|
import Element from '../nodes/element/Element';
|
4
|
+
import IHTMLInputElement from '../nodes/html-input-element/IHTMLInputElement';
|
4
5
|
|
5
6
|
const ATTRIBUTE_REGEXP =
|
6
7
|
/\[([a-zA-Z0-9-_]+)\]|\[([a-zA-Z0-9-_]+)([~|^$*]{0,1})[ ]*=[ ]*["']{0,1}([^"']+)["']{0,1}\]/g;
|
@@ -252,6 +253,8 @@ export default class SelectorItem {
|
|
252
253
|
}
|
253
254
|
}
|
254
255
|
return isFound;
|
256
|
+
case 'checked':
|
257
|
+
return element.tagName === 'INPUT' && (<IHTMLInputElement>element).checked;
|
255
258
|
}
|
256
259
|
|
257
260
|
return false;
|
@@ -0,0 +1,211 @@
|
|
1
|
+
import IHTMLButtonElement from '../nodes/html-button-element/IHTMLButtonElement';
|
2
|
+
import IHTMLFormElement from '../nodes/html-form-element/IHTMLFormElement';
|
3
|
+
import HTMLInputElement from '../nodes/html-input-element/HTMLInputElement';
|
4
|
+
import IHTMLInputElement from '../nodes/html-input-element/IHTMLInputElement';
|
5
|
+
import IHTMLSelectElement from '../nodes/html-select-element/IHTMLSelectElement';
|
6
|
+
import HTMLTextAreaElement from '../nodes/html-text-area-element/HTMLTextAreaElement';
|
7
|
+
import IHTMLTextAreaElement from '../nodes/html-text-area-element/IHTMLTextAreaElement';
|
8
|
+
import IShadowRoot from '../nodes/shadow-root/IShadowRoot';
|
9
|
+
|
10
|
+
const EMAIL_REGEXP =
|
11
|
+
/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/;
|
12
|
+
const URL_REGEXP =
|
13
|
+
/^(?:(?:https?|HTTPS?|ftp|FTP):\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-zA-Z\u00a1-\uffff0-9]-*)*[a-zA-Z\u00a1-\uffff0-9]+)(?:\.(?:[a-zA-Z\u00a1-\uffff0-9]-*)*[a-zA-Z\u00a1-\uffff0-9]+)*)(?::\d{2,5})?(?:[\/?#]\S*)?$/;
|
14
|
+
|
15
|
+
/**
|
16
|
+
* Input validity state.
|
17
|
+
*
|
18
|
+
* Based on:
|
19
|
+
* https://github.com/cferdinandi/validate/blob/master/src/js/_validityState.polyfill.js
|
20
|
+
*
|
21
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/ValidityState
|
22
|
+
*/
|
23
|
+
export default class ValidityState {
|
24
|
+
private element:
|
25
|
+
| IHTMLInputElement
|
26
|
+
| IHTMLTextAreaElement
|
27
|
+
| IHTMLSelectElement
|
28
|
+
| IHTMLButtonElement;
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Constructor.
|
32
|
+
*
|
33
|
+
* @param element Input element.
|
34
|
+
*/
|
35
|
+
constructor(
|
36
|
+
element: IHTMLInputElement | IHTMLTextAreaElement | IHTMLSelectElement | IHTMLButtonElement
|
37
|
+
) {
|
38
|
+
this.element = element;
|
39
|
+
}
|
40
|
+
|
41
|
+
/**
|
42
|
+
* Returns validity.
|
43
|
+
*
|
44
|
+
* @returns "true" if valid.
|
45
|
+
*/
|
46
|
+
public get badInput(): boolean {
|
47
|
+
return (
|
48
|
+
this.element instanceof HTMLInputElement &&
|
49
|
+
(this.element.type === 'number' || this.element.type === 'range') &&
|
50
|
+
this.element.value.length > 0 &&
|
51
|
+
!/^[-+]?(?:\d+|\d*[.,]\d+)$/.test(this.element.value)
|
52
|
+
);
|
53
|
+
}
|
54
|
+
|
55
|
+
/**
|
56
|
+
* Returns validity.
|
57
|
+
*
|
58
|
+
* @returns "true" if valid.
|
59
|
+
*/
|
60
|
+
public get customError(): boolean {
|
61
|
+
return this.element.validationMessage.length > 0;
|
62
|
+
}
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Returns validity.
|
66
|
+
*
|
67
|
+
* @returns "true" if valid.
|
68
|
+
*/
|
69
|
+
public get patternMismatch(): boolean {
|
70
|
+
return (
|
71
|
+
this.element instanceof HTMLInputElement &&
|
72
|
+
this.element.hasAttribute('pattern') &&
|
73
|
+
this.element.value.length > 0 &&
|
74
|
+
this.element.value.replace(new RegExp(this.element.getAttribute('pattern')), '').length > 0
|
75
|
+
);
|
76
|
+
}
|
77
|
+
|
78
|
+
/**
|
79
|
+
* Returns validity.
|
80
|
+
*
|
81
|
+
* @returns "true" if valid.
|
82
|
+
*/
|
83
|
+
public get rangeOverflow(): boolean {
|
84
|
+
return (
|
85
|
+
this.element instanceof HTMLInputElement &&
|
86
|
+
this.element.hasAttribute('max') &&
|
87
|
+
(this.element.type === 'number' || this.element.type === 'range') &&
|
88
|
+
this.element.value.length > 0 &&
|
89
|
+
Number(this.element.value) > Number(this.element.getAttribute('max'))
|
90
|
+
);
|
91
|
+
}
|
92
|
+
|
93
|
+
/**
|
94
|
+
* Returns validity.
|
95
|
+
*
|
96
|
+
* @returns "true" if valid.
|
97
|
+
*/
|
98
|
+
public get rangeUnderflow(): boolean {
|
99
|
+
return (
|
100
|
+
this.element instanceof HTMLInputElement &&
|
101
|
+
this.element.hasAttribute('min') &&
|
102
|
+
(this.element.type === 'number' || this.element.type === 'range') &&
|
103
|
+
this.element.value.length > 0 &&
|
104
|
+
Number(this.element.value) < Number(this.element.getAttribute('min'))
|
105
|
+
);
|
106
|
+
}
|
107
|
+
|
108
|
+
/**
|
109
|
+
* Returns validity.
|
110
|
+
*
|
111
|
+
* @returns "true" if valid.
|
112
|
+
*/
|
113
|
+
public get stepMismatch(): boolean {
|
114
|
+
return (
|
115
|
+
this.element instanceof HTMLInputElement &&
|
116
|
+
(this.element.type === 'number' || this.element.type === 'range') &&
|
117
|
+
((this.element.hasAttribute('step') &&
|
118
|
+
this.element.getAttribute('step') !== 'any' &&
|
119
|
+
Number(this.element.value) % Number(this.element.getAttribute('step')) !== 0) ||
|
120
|
+
(!this.element.hasAttribute('step') && Number(this.element.value) % 1 !== 0))
|
121
|
+
);
|
122
|
+
}
|
123
|
+
|
124
|
+
/**
|
125
|
+
* Returns validity.
|
126
|
+
*
|
127
|
+
* @returns "true" if valid.
|
128
|
+
*/
|
129
|
+
public get tooLong(): boolean {
|
130
|
+
return (
|
131
|
+
(this.element instanceof HTMLInputElement || this.element instanceof HTMLTextAreaElement) &&
|
132
|
+
this.element.maxLength > 0 &&
|
133
|
+
this.element.value.length > this.element.maxLength
|
134
|
+
);
|
135
|
+
}
|
136
|
+
|
137
|
+
/**
|
138
|
+
* Returns validity.
|
139
|
+
*
|
140
|
+
* @returns "true" if valid.
|
141
|
+
*/
|
142
|
+
public get tooShort(): boolean {
|
143
|
+
return (
|
144
|
+
(this.element instanceof HTMLInputElement || this.element instanceof HTMLTextAreaElement) &&
|
145
|
+
this.element.minLength > 0 &&
|
146
|
+
this.element.value.length > 0 &&
|
147
|
+
this.element.value.length < this.element.minLength
|
148
|
+
);
|
149
|
+
}
|
150
|
+
|
151
|
+
/**
|
152
|
+
* Returns validity.
|
153
|
+
*
|
154
|
+
* @returns "true" if valid.
|
155
|
+
*/
|
156
|
+
public get typeMismatch(): boolean {
|
157
|
+
return (
|
158
|
+
this.element instanceof HTMLInputElement &&
|
159
|
+
this.element.value.length > 0 &&
|
160
|
+
((this.element.type === 'email' && !EMAIL_REGEXP.test(this.element.value)) ||
|
161
|
+
(this.element.type === 'url' && !URL_REGEXP.test(this.element.value)))
|
162
|
+
);
|
163
|
+
}
|
164
|
+
|
165
|
+
/**
|
166
|
+
* Returns validity.
|
167
|
+
*
|
168
|
+
* @returns "true" if valid.
|
169
|
+
*/
|
170
|
+
public get valueMissing(): boolean {
|
171
|
+
if (!(<IHTMLInputElement>this.element).required) {
|
172
|
+
return false;
|
173
|
+
}
|
174
|
+
if (this.element instanceof HTMLInputElement) {
|
175
|
+
if (this.element.type === 'checkbox') {
|
176
|
+
return !this.element.checked;
|
177
|
+
} else if (this.element.type === 'radio') {
|
178
|
+
if (this.element.checked) {
|
179
|
+
return false;
|
180
|
+
}
|
181
|
+
if (!this.element.name) {
|
182
|
+
return true;
|
183
|
+
}
|
184
|
+
const root =
|
185
|
+
<IHTMLFormElement>this.element._formNode || <IShadowRoot>this.element.getRootNode();
|
186
|
+
return !root || !root.querySelector(`input[name="${this.element.name}"]:checked`);
|
187
|
+
}
|
188
|
+
}
|
189
|
+
return this.element.value.length === 0;
|
190
|
+
}
|
191
|
+
|
192
|
+
/**
|
193
|
+
* Returns validity.
|
194
|
+
*
|
195
|
+
* @returns "true" if valid.
|
196
|
+
*/
|
197
|
+
public get valid(): boolean {
|
198
|
+
return (
|
199
|
+
!this.badInput &&
|
200
|
+
!this.customError &&
|
201
|
+
!this.patternMismatch &&
|
202
|
+
!this.rangeOverflow &&
|
203
|
+
!this.rangeUnderflow &&
|
204
|
+
!this.stepMismatch &&
|
205
|
+
!this.tooLong &&
|
206
|
+
!this.tooShort &&
|
207
|
+
!this.typeMismatch &&
|
208
|
+
!this.valueMissing
|
209
|
+
);
|
210
|
+
}
|
211
|
+
}
|
@@ -64,8 +64,6 @@ export default class GlobalWindow extends Window {
|
|
64
64
|
public unescape = globalThis.unescape;
|
65
65
|
public gc = globalThis.gc;
|
66
66
|
public v8debug = globalThis.v8debug;
|
67
|
-
public AbortController = globalThis.AbortController;
|
68
|
-
public AbortSignal = globalThis.AbortSignal;
|
69
67
|
public Array = globalThis.Array;
|
70
68
|
public Object = globalThis.Object;
|
71
69
|
public Function = globalThis.Function;
|
@@ -0,0 +1,70 @@
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
2
|
+
|
3
|
+
interface INodeJSGlobal {
|
4
|
+
Array: typeof Array;
|
5
|
+
ArrayBuffer: typeof ArrayBuffer;
|
6
|
+
Boolean: typeof Boolean;
|
7
|
+
Buffer: typeof Buffer;
|
8
|
+
DataView: typeof DataView;
|
9
|
+
Date: typeof Date;
|
10
|
+
Error: typeof Error;
|
11
|
+
EvalError: typeof EvalError;
|
12
|
+
Float32Array: typeof Float32Array;
|
13
|
+
Float64Array: typeof Float64Array;
|
14
|
+
Function: typeof Function;
|
15
|
+
Infinity: typeof Infinity;
|
16
|
+
Int16Array: typeof Int16Array;
|
17
|
+
Int32Array: typeof Int32Array;
|
18
|
+
Int8Array: typeof Int8Array;
|
19
|
+
Intl: typeof Intl;
|
20
|
+
JSON: typeof JSON;
|
21
|
+
Map: MapConstructor;
|
22
|
+
Math: typeof Math;
|
23
|
+
NaN: typeof NaN;
|
24
|
+
Number: typeof Number;
|
25
|
+
Object: typeof Object;
|
26
|
+
Promise: typeof Promise;
|
27
|
+
RangeError: typeof RangeError;
|
28
|
+
ReferenceError: typeof ReferenceError;
|
29
|
+
RegExp: typeof RegExp;
|
30
|
+
Set: SetConstructor;
|
31
|
+
String: typeof String;
|
32
|
+
Symbol: Function;
|
33
|
+
SyntaxError: typeof SyntaxError;
|
34
|
+
TypeError: typeof TypeError;
|
35
|
+
URIError: typeof URIError;
|
36
|
+
Uint16Array: typeof Uint16Array;
|
37
|
+
Uint32Array: typeof Uint32Array;
|
38
|
+
Uint8Array: typeof Uint8Array;
|
39
|
+
Uint8ClampedArray: typeof Uint8ClampedArray;
|
40
|
+
WeakMap: WeakMapConstructor;
|
41
|
+
WeakSet: WeakSetConstructor;
|
42
|
+
clearImmediate: (immediateId: NodeJS.Immediate) => void;
|
43
|
+
clearInterval: (intervalId: NodeJS.Timeout) => void;
|
44
|
+
clearTimeout: (timeoutId: NodeJS.Timeout) => void;
|
45
|
+
decodeURI: typeof decodeURI;
|
46
|
+
decodeURIComponent: typeof decodeURIComponent;
|
47
|
+
encodeURI: typeof encodeURI;
|
48
|
+
encodeURIComponent: typeof encodeURIComponent;
|
49
|
+
/**
|
50
|
+
* @deprecated
|
51
|
+
*/
|
52
|
+
escape: (str: string) => string;
|
53
|
+
eval: typeof eval;
|
54
|
+
global: NodeJS.Global;
|
55
|
+
isFinite: typeof isFinite;
|
56
|
+
isNaN: typeof isNaN;
|
57
|
+
parseFloat: typeof parseFloat;
|
58
|
+
parseInt: typeof parseInt;
|
59
|
+
setImmediate: (callback: (...args: any[]) => void, ...args: any[]) => NodeJS.Immediate;
|
60
|
+
setInterval: (callback: (...args: any[]) => void, ms?: number, ...args: any[]) => NodeJS.Timeout;
|
61
|
+
setTimeout: (callback: (...args: any[]) => void, ms?: number, ...args: any[]) => NodeJS.Timeout;
|
62
|
+
queueMicrotask: typeof queueMicrotask;
|
63
|
+
undefined: typeof undefined;
|
64
|
+
/**
|
65
|
+
* @deprecated
|
66
|
+
*/
|
67
|
+
unescape: (str: string) => string;
|
68
|
+
gc: () => void;
|
69
|
+
v8debug?: any;
|
70
|
+
}
|
package/src/window/IWindow.ts
CHANGED
@@ -63,6 +63,7 @@ import CSSKeyframeRule from '../css/rules/CSSKeyframeRule';
|
|
63
63
|
import CSSKeyframesRule from '../css/rules/CSSKeyframesRule';
|
64
64
|
import CSSMediaRule from '../css/rules/CSSMediaRule';
|
65
65
|
import CSSStyleRule from '../css/rules/CSSStyleRule';
|
66
|
+
import CSSSupportsRule from '../css/rules/CSSSupportsRule';
|
66
67
|
import PointerEvent from '../event/events/PointerEvent';
|
67
68
|
import MouseEvent from '../event/events/MouseEvent';
|
68
69
|
import FocusEvent from '../event/events/FocusEvent';
|
@@ -81,6 +82,7 @@ import AsyncTaskManager from '../async-task-manager/AsyncTaskManager';
|
|
81
82
|
import Storage from '../storage/Storage';
|
82
83
|
import NodeFilter from '../tree-walker/NodeFilter';
|
83
84
|
import HTMLCollection from '../nodes/element/HTMLCollection';
|
85
|
+
import HTMLFormControlsCollection from '../nodes/html-form-element/HTMLFormControlsCollection';
|
84
86
|
import NodeList from '../nodes/node/NodeList';
|
85
87
|
import Selection from '../selection/Selection';
|
86
88
|
import IEventTarget from '../event/IEventTarget';
|
@@ -89,11 +91,11 @@ import MimeType from '../navigator/MimeType';
|
|
89
91
|
import MimeTypeArray from '../navigator/MimeTypeArray';
|
90
92
|
import Plugin from '../navigator/Plugin';
|
91
93
|
import PluginArray from '../navigator/PluginArray';
|
92
|
-
import IResponseInit from '../fetch/IResponseInit';
|
93
|
-
import IRequest from '../fetch/IRequest';
|
94
|
-
import IHeaders from '../fetch/IHeaders';
|
95
|
-
import IRequestInit from '../fetch/IRequestInit';
|
96
|
-
import IResponse from '../fetch/IResponse';
|
94
|
+
import IResponseInit from '../fetch/types/IResponseInit';
|
95
|
+
import IRequest from '../fetch/types/IRequest';
|
96
|
+
import IHeaders from '../fetch/types/IHeaders';
|
97
|
+
import IRequestInit from '../fetch/types/IRequestInit';
|
98
|
+
import IResponse from '../fetch/types/IResponse';
|
97
99
|
import Range from '../range/Range';
|
98
100
|
import MediaQueryList from '../match-media/MediaQueryList';
|
99
101
|
import XMLHttpRequest from '../xml-http-request/XMLHttpRequest';
|
@@ -107,13 +109,22 @@ import { Performance } from 'perf_hooks';
|
|
107
109
|
import IElement from '../nodes/element/IElement';
|
108
110
|
import ProcessingInstruction from '../nodes/processing-instruction/ProcessingInstruction';
|
109
111
|
import IHappyDOMSettings from './IHappyDOMSettings';
|
110
|
-
import RequestInfo from '../fetch/
|
112
|
+
import RequestInfo from '../fetch/types/IRequestInfo';
|
111
113
|
import FileList from '../nodes/html-input-element/FileList';
|
114
|
+
import Stream from 'stream';
|
115
|
+
import FormData from '../form-data/FormData';
|
116
|
+
import AbortController from '../fetch/AbortController';
|
117
|
+
import AbortSignal from '../fetch/AbortSignal';
|
118
|
+
import IResponseBody from '../fetch/types/IResponseBody';
|
119
|
+
import IRequestInfo from '../fetch/types/IRequestInfo';
|
120
|
+
import IHeadersInit from '../fetch/types/IHeadersInit';
|
121
|
+
import RadioNodeList from '../nodes/html-form-element/RadioNodeList';
|
122
|
+
import ValidityState from '../validity-state/ValidityState';
|
112
123
|
|
113
124
|
/**
|
114
125
|
* Window without dependencies to server side specific packages.
|
115
126
|
*/
|
116
|
-
export default interface IWindow extends IEventTarget,
|
127
|
+
export default interface IWindow extends IEventTarget, INodeJSGlobal {
|
117
128
|
// Public Properties
|
118
129
|
readonly happyDOM: {
|
119
130
|
whenAsyncComplete: () => Promise<void>;
|
@@ -203,6 +214,7 @@ export default interface IWindow extends IEventTarget, NodeJS.Global {
|
|
203
214
|
readonly Screen: typeof Screen;
|
204
215
|
readonly Storage: typeof Storage;
|
205
216
|
readonly HTMLCollection: typeof HTMLCollection;
|
217
|
+
readonly HTMLFormControlsCollection: typeof HTMLFormControlsCollection;
|
206
218
|
readonly NodeList: typeof NodeList;
|
207
219
|
readonly CSSUnitValue: typeof CSSUnitValue;
|
208
220
|
readonly CSS: CSS;
|
@@ -213,21 +225,31 @@ export default interface IWindow extends IEventTarget, NodeJS.Global {
|
|
213
225
|
readonly CSSKeyframesRule: typeof CSSKeyframesRule;
|
214
226
|
readonly CSSMediaRule: typeof CSSMediaRule;
|
215
227
|
readonly CSSStyleRule: typeof CSSStyleRule;
|
228
|
+
readonly CSSSupportsRule: typeof CSSSupportsRule;
|
216
229
|
readonly Selection: typeof Selection;
|
217
230
|
readonly Navigator: typeof Navigator;
|
218
231
|
readonly MimeType: typeof MimeType;
|
219
232
|
readonly MimeTypeArray: typeof MimeTypeArray;
|
220
233
|
readonly Plugin: typeof Plugin;
|
221
234
|
readonly PluginArray: typeof PluginArray;
|
222
|
-
readonly Headers: { new (init?:
|
223
|
-
readonly Request: {
|
224
|
-
|
235
|
+
readonly Headers: { new (init?: IHeadersInit): IHeaders };
|
236
|
+
readonly Request: {
|
237
|
+
new (input: IRequestInfo, init?: IRequestInit): IRequest;
|
238
|
+
};
|
239
|
+
readonly Response: { new (body?: IResponseBody | null, init?: IResponseInit): IResponse };
|
225
240
|
readonly Range: typeof Range;
|
226
241
|
readonly DOMRect: typeof DOMRect;
|
227
242
|
readonly XMLHttpRequest: typeof XMLHttpRequest;
|
228
243
|
readonly XMLHttpRequestUpload: typeof XMLHttpRequestUpload;
|
229
244
|
readonly XMLHttpRequestEventTarget: typeof XMLHttpRequestEventTarget;
|
230
245
|
readonly FileList: typeof FileList;
|
246
|
+
readonly ReadableStream: typeof Stream.Readable;
|
247
|
+
readonly WritableStream: typeof Stream.Writable;
|
248
|
+
readonly FormData: typeof FormData;
|
249
|
+
readonly AbortController: typeof AbortController;
|
250
|
+
readonly AbortSignal: typeof AbortSignal;
|
251
|
+
readonly RadioNodeList: typeof RadioNodeList;
|
252
|
+
readonly ValidityState: typeof ValidityState;
|
231
253
|
|
232
254
|
// Events
|
233
255
|
onload: (event: Event) => void;
|