happy-dom 8.9.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-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 +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 +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 +37 -20
- package/src/xml-http-request/XMLHttpRequest.ts +27 -26
- package/src/xml-parser/XMLParser.ts +1 -1
- package/lib/fetch/FetchHandler.d.ts +0 -18
- package/lib/fetch/FetchHandler.js +0 -83
- package/lib/fetch/FetchHandler.js.map +0 -1
- package/lib/fetch/IAbortSignal.d.ts +0 -16
- package/lib/fetch/IAbortSignal.js +0 -4
- package/lib/fetch/IAbortSignal.js.map +0 -1
- package/lib/fetch/IBody.d.ts +0 -17
- package/lib/fetch/IBody.js.map +0 -1
- package/lib/fetch/IHeaders.d.ts +0 -18
- package/lib/fetch/IHeadersInit.js.map +0 -1
- package/lib/fetch/IRequest.d.ts +0 -18
- package/lib/fetch/IRequestInit.d.ts +0 -16
- package/lib/fetch/IRequestInit.js.map +0 -1
- package/lib/fetch/IResponse.d.ts +0 -20
- package/lib/fetch/IResponseInit.d.ts +0 -9
- package/lib/fetch/IResponseInit.js.map +0 -1
- package/lib/fetch/RequestInfo.js +0 -3
- package/lib/fetch/RequestInfo.js.map +0 -1
- package/lib/fetch/ResourceFetchHandler.js.map +0 -1
- package/lib/form-data/IFormData.d.ts +0 -32
- package/lib/form-data/IFormData.js +0 -3
- package/lib/form-data/IFormData.js.map +0 -1
- package/lib/location/RelativeURL.d.ts +0 -15
- package/lib/location/RelativeURL.js +0 -19
- package/lib/location/RelativeURL.js.map +0 -1
- package/lib/nodes/element/HTMLCollectionFactory.d.ts +0 -21
- package/lib/nodes/element/HTMLCollectionFactory.js +0 -31
- package/lib/nodes/element/HTMLCollectionFactory.js.map +0 -1
- package/lib/nodes/html-option-element/IHTMLOptionsCollection.js.map +0 -1
- package/lib/nodes/node/NodeListFactory.d.ts +0 -21
- package/lib/nodes/node/NodeListFactory.js +0 -31
- package/lib/nodes/node/NodeListFactory.js.map +0 -1
- package/lib/nodes/validity-state/ValidityState.d.ts +0 -52
- package/lib/nodes/validity-state/ValidityState.js +0 -81
- package/lib/nodes/validity-state/ValidityState.js.map +0 -1
- package/src/fetch/FetchHandler.ts +0 -90
- package/src/fetch/IAbortSignal.ts +0 -34
- package/src/fetch/IBody.ts +0 -18
- package/src/fetch/IHeaders.ts +0 -18
- package/src/fetch/IRequest.ts +0 -59
- package/src/fetch/IRequestInit.ts +0 -41
- package/src/fetch/IResponse.ts +0 -22
- package/src/fetch/IResponseInit.ts +0 -10
- package/src/fetch/RequestInfo.ts +0 -6
- package/src/form-data/IFormData.ts +0 -33
- package/src/location/RelativeURL.ts +0 -17
- package/src/nodes/element/HTMLCollectionFactory.ts +0 -31
- package/src/nodes/node/NodeListFactory.ts +0 -31
- package/src/nodes/validity-state/ValidityState.ts +0 -84
- /package/lib/fetch/{IHeaders.js → types/IHeaders.js} +0 -0
- /package/lib/fetch/{IHeadersInit.d.ts → types/IHeadersInit.d.ts} +0 -0
- /package/lib/fetch/{IHeadersInit.js → types/IHeadersInit.js} +0 -0
- /package/lib/fetch/{IRequest.js → types/IRequest.js} +0 -0
- /package/lib/fetch/{IRequestInit.js → types/IRequestInit.js} +0 -0
- /package/lib/fetch/{IResponse.js → types/IResponse.js} +0 -0
- /package/lib/fetch/{IResponseInit.js → types/IResponseInit.js} +0 -0
- /package/lib/nodes/{html-option-element → html-select-element}/HTMLOptionsCollection.js +0 -0
- /package/lib/nodes/{html-option-element → html-select-element}/IHTMLOptionsCollection.js +0 -0
- /package/src/fetch/{IHeadersInit.ts → types/IHeadersInit.ts} +0 -0
@@ -1,19 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const url_1 = require("url");
|
4
|
-
/**
|
5
|
-
* Helper class for getting the URL relative to a Location object.
|
6
|
-
*/
|
7
|
-
class RelativeURL {
|
8
|
-
/**
|
9
|
-
* Returns a URL relative to the given Location object.
|
10
|
-
*
|
11
|
-
* @param location Location.
|
12
|
-
* @param url URL.
|
13
|
-
*/
|
14
|
-
static getAbsoluteURL(location, url) {
|
15
|
-
return new url_1.URL(url, location.href);
|
16
|
-
}
|
17
|
-
}
|
18
|
-
exports.default = RelativeURL;
|
19
|
-
//# sourceMappingURL=RelativeURL.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"RelativeURL.js","sourceRoot":"","sources":["../../src/location/RelativeURL.ts"],"names":[],"mappings":";;AACA,6BAA0B;AAE1B;;GAEG;AACH,MAAqB,WAAW;IAC/B;;;;;OAKG;IACI,MAAM,CAAC,cAAc,CAAC,QAAkB,EAAE,GAAW;QAC3D,OAAO,IAAI,SAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;CACD;AAVD,8BAUC"}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import IElement from './IElement';
|
2
|
-
import IHTMLCollection from './IHTMLCollection';
|
3
|
-
/**
|
4
|
-
*
|
5
|
-
*/
|
6
|
-
export default class HTMLCollectionFactory {
|
7
|
-
/**
|
8
|
-
* Creates an HTMLCollection.
|
9
|
-
*
|
10
|
-
* @param nodes Nodes.
|
11
|
-
* @returns HTMLCollection.
|
12
|
-
*/
|
13
|
-
static create(nodes?: IElement[]): IHTMLCollection<IElement>;
|
14
|
-
/**
|
15
|
-
* Returns node by index.
|
16
|
-
*
|
17
|
-
* @param nodes
|
18
|
-
* @param index Index.
|
19
|
-
*/
|
20
|
-
private static getItem;
|
21
|
-
}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
/**
|
4
|
-
*
|
5
|
-
*/
|
6
|
-
class HTMLCollectionFactory {
|
7
|
-
/**
|
8
|
-
* Creates an HTMLCollection.
|
9
|
-
*
|
10
|
-
* @param nodes Nodes.
|
11
|
-
* @returns HTMLCollection.
|
12
|
-
*/
|
13
|
-
static create(nodes) {
|
14
|
-
nodes = nodes ? nodes.slice() : [];
|
15
|
-
Object.defineProperty(nodes, 'item', {
|
16
|
-
value: this.getItem.bind(null, nodes)
|
17
|
-
});
|
18
|
-
return nodes;
|
19
|
-
}
|
20
|
-
/**
|
21
|
-
* Returns node by index.
|
22
|
-
*
|
23
|
-
* @param nodes
|
24
|
-
* @param index Index.
|
25
|
-
*/
|
26
|
-
static getItem(nodes, index) {
|
27
|
-
return nodes[index] || null;
|
28
|
-
}
|
29
|
-
}
|
30
|
-
exports.default = HTMLCollectionFactory;
|
31
|
-
//# sourceMappingURL=HTMLCollectionFactory.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"HTMLCollectionFactory.js","sourceRoot":"","sources":["../../../src/nodes/element/HTMLCollectionFactory.ts"],"names":[],"mappings":";;AAGA;;GAEG;AACH,MAAqB,qBAAqB;IACzC;;;;;OAKG;IACI,MAAM,CAAC,MAAM,CAAC,KAAkB;QACtC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnC,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE;YACpC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC;SACrC,CAAC,CAAC;QACH,OAAkC,KAAK,CAAC;IACzC,CAAC;IAED;;;;;OAKG;IACK,MAAM,CAAC,OAAO,CAAC,KAAiB,EAAE,KAAa;QACtD,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;IAC7B,CAAC;CACD;AAxBD,wCAwBC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"IHTMLOptionsCollection.js","sourceRoot":"","sources":["../../../src/nodes/html-option-element/IHTMLOptionsCollection.ts"],"names":[],"mappings":""}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import INode from './INode';
|
2
|
-
import INodeList from './INodeList';
|
3
|
-
/**
|
4
|
-
*
|
5
|
-
*/
|
6
|
-
export default class NodeListFactory {
|
7
|
-
/**
|
8
|
-
* Creates a NodeList.
|
9
|
-
*
|
10
|
-
* @param nodes Nodes.
|
11
|
-
* @returns NodeList.
|
12
|
-
*/
|
13
|
-
static create(nodes?: INode[]): INodeList<INode>;
|
14
|
-
/**
|
15
|
-
* Returns node by index.
|
16
|
-
*
|
17
|
-
* @param nodes
|
18
|
-
* @param index Index.
|
19
|
-
*/
|
20
|
-
private static getItem;
|
21
|
-
}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
/**
|
4
|
-
*
|
5
|
-
*/
|
6
|
-
class NodeListFactory {
|
7
|
-
/**
|
8
|
-
* Creates a NodeList.
|
9
|
-
*
|
10
|
-
* @param nodes Nodes.
|
11
|
-
* @returns NodeList.
|
12
|
-
*/
|
13
|
-
static create(nodes) {
|
14
|
-
nodes = nodes ? nodes.slice() : [];
|
15
|
-
Object.defineProperty(nodes, 'item', {
|
16
|
-
value: this.getItem.bind(null, nodes)
|
17
|
-
});
|
18
|
-
return nodes;
|
19
|
-
}
|
20
|
-
/**
|
21
|
-
* Returns node by index.
|
22
|
-
*
|
23
|
-
* @param nodes
|
24
|
-
* @param index Index.
|
25
|
-
*/
|
26
|
-
static getItem(nodes, index) {
|
27
|
-
return nodes[index] || null;
|
28
|
-
}
|
29
|
-
}
|
30
|
-
exports.default = NodeListFactory;
|
31
|
-
//# sourceMappingURL=NodeListFactory.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"NodeListFactory.js","sourceRoot":"","sources":["../../../src/nodes/node/NodeListFactory.ts"],"names":[],"mappings":";;AAGA;;GAEG;AACH,MAAqB,eAAe;IACnC;;;;;OAKG;IACI,MAAM,CAAC,MAAM,CAAC,KAAe;QACnC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnC,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE;YACpC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC;SACrC,CAAC,CAAC;QACH,OAAyB,KAAK,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACK,MAAM,CAAC,OAAO,CAAC,KAAc,EAAE,KAAa;QACnD,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;IAC7B,CAAC;CACD;AAxBD,kCAwBC"}
|
@@ -1,52 +0,0 @@
|
|
1
|
-
import HTMLInputElement from '../html-input-element/HTMLInputElement';
|
2
|
-
import HTMLSelectElement from '../html-select-element/HTMLSelectElement';
|
3
|
-
/**
|
4
|
-
* Input validity state.
|
5
|
-
*
|
6
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/ValidityState
|
7
|
-
*/
|
8
|
-
export default class ValidityState {
|
9
|
-
badInput: boolean;
|
10
|
-
customError: boolean;
|
11
|
-
patternMismatch: boolean;
|
12
|
-
rangeOverflow: boolean;
|
13
|
-
rangeUnderflow: boolean;
|
14
|
-
stepMismatch: boolean;
|
15
|
-
private element;
|
16
|
-
/**
|
17
|
-
* Constructor.
|
18
|
-
*
|
19
|
-
* @param element Input element.
|
20
|
-
*/
|
21
|
-
constructor(element: HTMLInputElement | HTMLSelectElement);
|
22
|
-
/**
|
23
|
-
* Returns validity.
|
24
|
-
*
|
25
|
-
* @returns "true" if valid.
|
26
|
-
*/
|
27
|
-
get tooLong(): boolean;
|
28
|
-
/**
|
29
|
-
* Returns validity.
|
30
|
-
*
|
31
|
-
* @returns "true" if valid.
|
32
|
-
*/
|
33
|
-
get tooShort(): boolean;
|
34
|
-
/**
|
35
|
-
* Returns validity.
|
36
|
-
*
|
37
|
-
* @returns "true" if valid.
|
38
|
-
*/
|
39
|
-
get typeMismatch(): boolean;
|
40
|
-
/**
|
41
|
-
* Returns validity.
|
42
|
-
*
|
43
|
-
* @returns "true" if valid.
|
44
|
-
*/
|
45
|
-
get valueMissing(): boolean;
|
46
|
-
/**
|
47
|
-
* Returns validity.
|
48
|
-
*
|
49
|
-
* @returns "true" if valid.
|
50
|
-
*/
|
51
|
-
get valid(): boolean;
|
52
|
-
}
|
@@ -1,81 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
const HTMLInputElement_1 = __importDefault(require("../html-input-element/HTMLInputElement"));
|
7
|
-
/**
|
8
|
-
* Input validity state.
|
9
|
-
*
|
10
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/ValidityState
|
11
|
-
*/
|
12
|
-
class ValidityState {
|
13
|
-
/**
|
14
|
-
* Constructor.
|
15
|
-
*
|
16
|
-
* @param element Input element.
|
17
|
-
*/
|
18
|
-
constructor(element) {
|
19
|
-
this.badInput = false;
|
20
|
-
this.customError = false;
|
21
|
-
this.patternMismatch = false;
|
22
|
-
this.rangeOverflow = false;
|
23
|
-
this.rangeUnderflow = false;
|
24
|
-
this.stepMismatch = false;
|
25
|
-
this.element = null;
|
26
|
-
this.element = element;
|
27
|
-
}
|
28
|
-
/**
|
29
|
-
* Returns validity.
|
30
|
-
*
|
31
|
-
* @returns "true" if valid.
|
32
|
-
*/
|
33
|
-
get tooLong() {
|
34
|
-
if (this.element instanceof HTMLInputElement_1.default) {
|
35
|
-
return this.element.maxLength && this.element.value.length > this.element.maxLength;
|
36
|
-
}
|
37
|
-
return false;
|
38
|
-
}
|
39
|
-
/**
|
40
|
-
* Returns validity.
|
41
|
-
*
|
42
|
-
* @returns "true" if valid.
|
43
|
-
*/
|
44
|
-
get tooShort() {
|
45
|
-
if (this.element instanceof HTMLInputElement_1.default) {
|
46
|
-
return this.element.minLength && this.element.value.length < this.element.minLength;
|
47
|
-
}
|
48
|
-
return false;
|
49
|
-
}
|
50
|
-
/**
|
51
|
-
* Returns validity.
|
52
|
-
*
|
53
|
-
* @returns "true" if valid.
|
54
|
-
*/
|
55
|
-
get typeMismatch() {
|
56
|
-
return false;
|
57
|
-
}
|
58
|
-
/**
|
59
|
-
* Returns validity.
|
60
|
-
*
|
61
|
-
* @returns "true" if valid.
|
62
|
-
*/
|
63
|
-
get valueMissing() {
|
64
|
-
return this.element.required && !this.element.value;
|
65
|
-
}
|
66
|
-
/**
|
67
|
-
* Returns validity.
|
68
|
-
*
|
69
|
-
* @returns "true" if valid.
|
70
|
-
*/
|
71
|
-
get valid() {
|
72
|
-
for (const key of Object.keys(this)) {
|
73
|
-
if (this[key]) {
|
74
|
-
return false;
|
75
|
-
}
|
76
|
-
}
|
77
|
-
return !this.tooLong && !this.tooShort && !this.typeMismatch && !this.valueMissing;
|
78
|
-
}
|
79
|
-
}
|
80
|
-
exports.default = ValidityState;
|
81
|
-
//# sourceMappingURL=ValidityState.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"ValidityState.js","sourceRoot":"","sources":["../../../src/nodes/validity-state/ValidityState.ts"],"names":[],"mappings":";;;;;AAAA,8FAAsE;AAGtE;;;;GAIG;AACH,MAAqB,aAAa;IASjC;;;;OAIG;IACH,YAAY,OAA6C;QAblD,aAAQ,GAAG,KAAK,CAAC;QACjB,gBAAW,GAAG,KAAK,CAAC;QACpB,oBAAe,GAAG,KAAK,CAAC;QACxB,kBAAa,GAAG,KAAK,CAAC;QACtB,mBAAc,GAAG,KAAK,CAAC;QACvB,iBAAY,GAAG,KAAK,CAAC;QACpB,YAAO,GAAyC,IAAI,CAAC;QAQ5D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACH,IAAW,OAAO;QACjB,IAAI,IAAI,CAAC,OAAO,YAAY,0BAAgB,EAAE;YAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;SACpF;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,IAAW,QAAQ;QAClB,IAAI,IAAI,CAAC,OAAO,YAAY,0BAAgB,EAAE;YAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;SACpF;QAED,OAAO,KAAK,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,IAAW,YAAY;QACtB,OAAO,KAAK,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACH,IAAW,KAAK;QACf,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACpC,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE;gBACd,OAAO,KAAK,CAAC;aACb;SACD;QAED,OAAO,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;IACpF,CAAC;CACD;AA3ED,gCA2EC"}
|
@@ -1,90 +0,0 @@
|
|
1
|
-
import RelativeURL from '../location/RelativeURL';
|
2
|
-
import IRequestInit from './IRequestInit';
|
3
|
-
import IDocument from '../nodes/document/IDocument';
|
4
|
-
import IResponse from './IResponse';
|
5
|
-
import Response from './Response';
|
6
|
-
import NodeFetch from 'node-fetch';
|
7
|
-
import Request from './Request';
|
8
|
-
import RequestInfo from './RequestInfo';
|
9
|
-
import { URL } from 'url';
|
10
|
-
|
11
|
-
/**
|
12
|
-
* Helper class for performing fetch.
|
13
|
-
*/
|
14
|
-
export default class FetchHandler {
|
15
|
-
/**
|
16
|
-
* Returns resource data asynchronously.
|
17
|
-
*
|
18
|
-
* @param document Document.
|
19
|
-
* @param url URL to resource.
|
20
|
-
* @param [init] Init.
|
21
|
-
* @returns Response.
|
22
|
-
*/
|
23
|
-
public static fetch(
|
24
|
-
document: IDocument,
|
25
|
-
url: RequestInfo,
|
26
|
-
init?: IRequestInit
|
27
|
-
): Promise<IResponse> {
|
28
|
-
const taskManager = document.defaultView.happyDOM.asyncTaskManager;
|
29
|
-
const requestInit = { ...init, headers: { ...init?.headers } };
|
30
|
-
const cookie = document.defaultView.document.cookie;
|
31
|
-
const referer = document.defaultView.location.origin;
|
32
|
-
|
33
|
-
requestInit.headers['user-agent'] = document.defaultView.navigator.userAgent;
|
34
|
-
|
35
|
-
// We need set referer to solve anti-hotlinking.
|
36
|
-
// And the browser will set the referer to the origin of the page.
|
37
|
-
// Referer is "null" when the URL is set to "about:blank".
|
38
|
-
// This is also how the browser behaves.
|
39
|
-
if (referer !== 'null') {
|
40
|
-
requestInit.headers['referer'] = referer;
|
41
|
-
}
|
42
|
-
|
43
|
-
if (cookie) {
|
44
|
-
requestInit.headers['set-cookie'] = cookie;
|
45
|
-
}
|
46
|
-
|
47
|
-
let request;
|
48
|
-
|
49
|
-
if (typeof url === 'string') {
|
50
|
-
request = new Request(RelativeURL.getAbsoluteURL(document.defaultView.location, url));
|
51
|
-
} else if (url instanceof URL) {
|
52
|
-
// URLs are always absolute, no need for getAbsoluteURL.
|
53
|
-
request = new Request(url);
|
54
|
-
} else {
|
55
|
-
request = new Request(RelativeURL.getAbsoluteURL(document.defaultView.location, url.url), {
|
56
|
-
...url
|
57
|
-
});
|
58
|
-
}
|
59
|
-
|
60
|
-
return new Promise((resolve, reject) => {
|
61
|
-
const taskID = taskManager.startTask();
|
62
|
-
|
63
|
-
NodeFetch(request, requestInit)
|
64
|
-
.then((response) => {
|
65
|
-
if (taskManager.getTaskCount() === 0) {
|
66
|
-
reject(new Error('Failed to complete fetch request. Task was canceled.'));
|
67
|
-
} else {
|
68
|
-
response.constructor['_ownerDocument'] = document;
|
69
|
-
|
70
|
-
for (const key of Object.keys(Response.prototype)) {
|
71
|
-
if (Response.prototype.hasOwnProperty(key) && key !== 'constructor') {
|
72
|
-
if (typeof Response.prototype[key] === 'function') {
|
73
|
-
response[key] = Response.prototype[key].bind(response);
|
74
|
-
} else {
|
75
|
-
response[key] = Response.prototype[key];
|
76
|
-
}
|
77
|
-
}
|
78
|
-
}
|
79
|
-
|
80
|
-
taskManager.endTask(taskID);
|
81
|
-
resolve(response);
|
82
|
-
}
|
83
|
-
})
|
84
|
-
.catch((error) => {
|
85
|
-
reject(error);
|
86
|
-
taskManager.cancelAll(error);
|
87
|
-
});
|
88
|
-
});
|
89
|
-
}
|
90
|
-
}
|
@@ -1,34 +0,0 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Abort signal.
|
5
|
-
*/
|
6
|
-
export default interface IAbortSignal {
|
7
|
-
aborted: boolean;
|
8
|
-
|
9
|
-
addEventListener: (
|
10
|
-
type: 'abort',
|
11
|
-
listener: (this: IAbortSignal, event: any) => any,
|
12
|
-
options?:
|
13
|
-
| boolean
|
14
|
-
| {
|
15
|
-
capture?: boolean | undefined;
|
16
|
-
once?: boolean | undefined;
|
17
|
-
passive?: boolean | undefined;
|
18
|
-
}
|
19
|
-
) => void;
|
20
|
-
|
21
|
-
removeEventListener: (
|
22
|
-
type: 'abort',
|
23
|
-
listener: (this: IAbortSignal, event: any) => any,
|
24
|
-
options?:
|
25
|
-
| boolean
|
26
|
-
| {
|
27
|
-
capture?: boolean | undefined;
|
28
|
-
}
|
29
|
-
) => void;
|
30
|
-
|
31
|
-
dispatchEvent: (event: any) => boolean;
|
32
|
-
|
33
|
-
onabort: null | ((this: IAbortSignal, event: any) => void);
|
34
|
-
}
|
package/src/fetch/IBody.ts
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
import IBlob from '../file/IBlob';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Fetch response.
|
5
|
-
*/
|
6
|
-
export default interface IBody {
|
7
|
-
readonly body: NodeJS.ReadableStream;
|
8
|
-
readonly bodyUsed: boolean;
|
9
|
-
readonly size: number;
|
10
|
-
readonly timeout: number;
|
11
|
-
|
12
|
-
arrayBuffer(): Promise<ArrayBuffer>;
|
13
|
-
blob(): Promise<IBlob>;
|
14
|
-
buffer(): Promise<Buffer>;
|
15
|
-
json(): Promise<unknown>;
|
16
|
-
text(): Promise<string>;
|
17
|
-
textConverted(): Promise<string>;
|
18
|
-
}
|
package/src/fetch/IHeaders.ts
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Fetch headers.
|
3
|
-
*/
|
4
|
-
export default interface IHeaders extends Iterable<[string, string]> {
|
5
|
-
forEach(callback: (value: string, name: string) => void): void;
|
6
|
-
append(name: string, value: string): void;
|
7
|
-
delete(name: string): void;
|
8
|
-
get(name: string): string | null;
|
9
|
-
has(name: string): boolean;
|
10
|
-
raw(): { [k: string]: string[] };
|
11
|
-
set(name: string, value: string): void;
|
12
|
-
|
13
|
-
// Iterable methods
|
14
|
-
entries(): IterableIterator<[string, string]>;
|
15
|
-
keys(): IterableIterator<string>;
|
16
|
-
values(): IterableIterator<string>;
|
17
|
-
[Symbol.iterator](): Iterator<[string, string]>;
|
18
|
-
}
|
package/src/fetch/IRequest.ts
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
import IHeaders from './IHeaders';
|
2
|
-
import IBody from './IBody';
|
3
|
-
|
4
|
-
/**
|
5
|
-
* Fetch request.
|
6
|
-
*/
|
7
|
-
export default interface IRequest extends IBody {
|
8
|
-
readonly headers: IHeaders;
|
9
|
-
readonly method: string;
|
10
|
-
readonly redirect: 'error' | 'follow' | 'manual';
|
11
|
-
readonly referrer: string;
|
12
|
-
readonly url: string;
|
13
|
-
|
14
|
-
/**
|
15
|
-
* Returns a clone.
|
16
|
-
*
|
17
|
-
* @returns Clone.
|
18
|
-
*/
|
19
|
-
clone(): IRequest;
|
20
|
-
|
21
|
-
// Not implemented:
|
22
|
-
// Readonly cache: 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload';
|
23
|
-
// Readonly credentials: 'include' | 'omit' | 'same-origin';
|
24
|
-
// Readonly destination:
|
25
|
-
// | ''
|
26
|
-
// | 'object'
|
27
|
-
// | 'audio'
|
28
|
-
// | 'audioworklet'
|
29
|
-
// | 'document'
|
30
|
-
// | 'embed'
|
31
|
-
// | 'font'
|
32
|
-
// | 'frame'
|
33
|
-
// | 'iframe'
|
34
|
-
// | 'image'
|
35
|
-
// | 'manifest'
|
36
|
-
// | 'paintworklet'
|
37
|
-
// | 'report'
|
38
|
-
// | 'script'
|
39
|
-
// | 'sharedworker'
|
40
|
-
// | 'style'
|
41
|
-
// | 'track'
|
42
|
-
// | 'video'
|
43
|
-
// | 'worker'
|
44
|
-
// | 'xslt';
|
45
|
-
// Readonly referrerPolicy:
|
46
|
-
// | ''
|
47
|
-
// | 'same-origin'
|
48
|
-
// | 'no-referrer'
|
49
|
-
// | 'no-referrer-when-downgrade'
|
50
|
-
// | 'origin'
|
51
|
-
// | 'origin-when-cross-origin'
|
52
|
-
// | 'strict-origin'
|
53
|
-
// | 'strict-origin-when-cross-origin'
|
54
|
-
// | 'unsafe-url';
|
55
|
-
// Readonly signal: AbortSignal;
|
56
|
-
// Readonly integrity: string;
|
57
|
-
// Readonly keepalive: boolean;
|
58
|
-
// Readonly mode: 'same-origin' | 'cors' | 'navigate' | 'no-cors';
|
59
|
-
}
|
@@ -1,41 +0,0 @@
|
|
1
|
-
import IHeadersInit from './IHeadersInit';
|
2
|
-
import IAbortSignal from './IAbortSignal';
|
3
|
-
import { URLSearchParams } from 'url';
|
4
|
-
import IFormData from '../form-data/IFormData';
|
5
|
-
|
6
|
-
/**
|
7
|
-
* Fetch request init.
|
8
|
-
*/
|
9
|
-
export default interface IRequestInit {
|
10
|
-
body?:
|
11
|
-
| ArrayBuffer
|
12
|
-
| ArrayBufferView
|
13
|
-
| NodeJS.ReadableStream
|
14
|
-
| string
|
15
|
-
| URLSearchParams
|
16
|
-
| IFormData
|
17
|
-
| null;
|
18
|
-
headers?: IHeadersInit;
|
19
|
-
method?: string;
|
20
|
-
redirect?: 'error' | 'manual' | 'follow';
|
21
|
-
signal?: IAbortSignal | null;
|
22
|
-
|
23
|
-
// Not implemented:
|
24
|
-
// Cache?: 'default' | 'force-cache' | 'no-cache' | 'no-store' | 'only-if-cached' | 'reload';
|
25
|
-
// Credentials?: 'include' | 'omit' | 'same-origin';
|
26
|
-
// Integrity?: string;
|
27
|
-
// Keepalive?: boolean;
|
28
|
-
// Mode?: 'same-origin' | 'cors' | 'navigate' | 'no-cors';
|
29
|
-
// Referrer?: string;
|
30
|
-
// ReferrerPolicy?:
|
31
|
-
// | ''
|
32
|
-
// | 'same-origin'
|
33
|
-
// | 'no-referrer'
|
34
|
-
// | 'no-referrer-when-downgrade'
|
35
|
-
// | 'origin'
|
36
|
-
// | 'origin-when-cross-origin'
|
37
|
-
// | 'strict-origin'
|
38
|
-
// | 'strict-origin-when-cross-origin'
|
39
|
-
// | 'unsafe-url';
|
40
|
-
// Window?: unknown;
|
41
|
-
}
|
package/src/fetch/IResponse.ts
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
import IHeaders from './IHeaders';
|
2
|
-
import IBody from './IBody';
|
3
|
-
|
4
|
-
/**
|
5
|
-
* Fetch response.
|
6
|
-
*/
|
7
|
-
export default interface IResponse extends IBody {
|
8
|
-
readonly headers: IHeaders;
|
9
|
-
readonly ok: boolean;
|
10
|
-
readonly redirected: boolean;
|
11
|
-
readonly status: number;
|
12
|
-
readonly statusText: string;
|
13
|
-
readonly type: 'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect';
|
14
|
-
readonly url: string;
|
15
|
-
|
16
|
-
/**
|
17
|
-
* Returns a clone.
|
18
|
-
*
|
19
|
-
* @returns Clone.
|
20
|
-
*/
|
21
|
-
clone(): IResponse;
|
22
|
-
}
|
package/src/fetch/RequestInfo.ts
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
import Stream from 'stream';
|
2
|
-
import HTTP from 'http';
|
3
|
-
|
4
|
-
interface IHeaders {
|
5
|
-
[key: string]: unknown;
|
6
|
-
}
|
7
|
-
|
8
|
-
interface IAppendOptions {
|
9
|
-
header?: string | IHeaders;
|
10
|
-
knownLength?: number;
|
11
|
-
filename?: string;
|
12
|
-
filepath?: string;
|
13
|
-
contentType?: string;
|
14
|
-
}
|
15
|
-
|
16
|
-
interface ISubmitOptions extends HTTP.RequestOptions {
|
17
|
-
protocol?: 'https:' | 'http:';
|
18
|
-
}
|
19
|
-
|
20
|
-
export default interface IFormData extends Stream.Readable {
|
21
|
-
append(key: string, value: unknown, options?: IAppendOptions | string): void;
|
22
|
-
getHeaders(userHeaders?: IHeaders): { [key: string]: IHeaders };
|
23
|
-
submit(
|
24
|
-
params: string | ISubmitOptions,
|
25
|
-
callback?: (error: Error | null, response: HTTP.IncomingMessage) => void
|
26
|
-
): HTTP.ClientRequest;
|
27
|
-
getBuffer(): Buffer;
|
28
|
-
setBoundary(boundary: string): void;
|
29
|
-
getBoundary(): string;
|
30
|
-
getLength(callback: (err: Error | null, length: number) => void): void;
|
31
|
-
getLengthSync(): number;
|
32
|
-
hasKnownLength(): boolean;
|
33
|
-
}
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import Location from './Location';
|
2
|
-
import { URL } from 'url';
|
3
|
-
|
4
|
-
/**
|
5
|
-
* Helper class for getting the URL relative to a Location object.
|
6
|
-
*/
|
7
|
-
export default class RelativeURL {
|
8
|
-
/**
|
9
|
-
* Returns a URL relative to the given Location object.
|
10
|
-
*
|
11
|
-
* @param location Location.
|
12
|
-
* @param url URL.
|
13
|
-
*/
|
14
|
-
public static getAbsoluteURL(location: Location, url: string): URL {
|
15
|
-
return new URL(url, location.href);
|
16
|
-
}
|
17
|
-
}
|
@@ -1,31 +0,0 @@
|
|
1
|
-
import IElement from './IElement';
|
2
|
-
import IHTMLCollection from './IHTMLCollection';
|
3
|
-
|
4
|
-
/**
|
5
|
-
*
|
6
|
-
*/
|
7
|
-
export default class HTMLCollectionFactory {
|
8
|
-
/**
|
9
|
-
* Creates an HTMLCollection.
|
10
|
-
*
|
11
|
-
* @param nodes Nodes.
|
12
|
-
* @returns HTMLCollection.
|
13
|
-
*/
|
14
|
-
public static create(nodes?: IElement[]): IHTMLCollection<IElement> {
|
15
|
-
nodes = nodes ? nodes.slice() : [];
|
16
|
-
Object.defineProperty(nodes, 'item', {
|
17
|
-
value: this.getItem.bind(null, nodes)
|
18
|
-
});
|
19
|
-
return <IHTMLCollection<IElement>>nodes;
|
20
|
-
}
|
21
|
-
|
22
|
-
/**
|
23
|
-
* Returns node by index.
|
24
|
-
*
|
25
|
-
* @param nodes
|
26
|
-
* @param index Index.
|
27
|
-
*/
|
28
|
-
private static getItem(nodes: IElement[], index: number): IElement {
|
29
|
-
return nodes[index] || null;
|
30
|
-
}
|
31
|
-
}
|