happy-dom 13.6.2 → 13.7.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/cjs/browser/BrowserFrame.cjs +12 -2
- package/cjs/browser/BrowserFrame.cjs.map +1 -1
- package/cjs/browser/BrowserFrame.d.ts.map +1 -1
- package/cjs/browser/detached-browser/DetachedBrowserFrame.cjs +12 -2
- package/cjs/browser/detached-browser/DetachedBrowserFrame.cjs.map +1 -1
- package/cjs/browser/detached-browser/DetachedBrowserFrame.d.ts.map +1 -1
- package/cjs/browser/utilities/BrowserFrameFactory.cjs +5 -0
- package/cjs/browser/utilities/BrowserFrameFactory.cjs.map +1 -1
- package/cjs/browser/utilities/BrowserFrameFactory.d.ts.map +1 -1
- package/cjs/browser/utilities/BrowserFrameNavigator.cjs +20 -13
- package/cjs/browser/utilities/BrowserFrameNavigator.cjs.map +1 -1
- package/cjs/browser/utilities/BrowserFrameNavigator.d.ts +21 -10
- package/cjs/browser/utilities/BrowserFrameNavigator.d.ts.map +1 -1
- package/cjs/browser/utilities/BrowserFrameURL.cjs +2 -2
- package/cjs/browser/utilities/BrowserFrameURL.cjs.map +1 -1
- package/cjs/browser/utilities/BrowserFrameURL.d.ts.map +1 -1
- package/cjs/config/IHTMLElementTagNameMap.cjs +3 -0
- package/cjs/config/IHTMLElementTagNameMap.cjs.map +1 -0
- package/cjs/config/IHTMLElementTagNameMap.d.ts +146 -0
- package/cjs/config/IHTMLElementTagNameMap.d.ts.map +1 -0
- package/cjs/config/ISVGElementTagNameMap.cjs +3 -0
- package/cjs/config/ISVGElementTagNameMap.cjs.map +1 -0
- package/cjs/config/ISVGElementTagNameMap.d.ts +67 -0
- package/cjs/config/ISVGElementTagNameMap.d.ts.map +1 -0
- package/cjs/event/events/HashChangeEvent.cjs +26 -0
- package/cjs/event/events/HashChangeEvent.cjs.map +1 -0
- package/cjs/event/events/HashChangeEvent.d.ts +19 -0
- package/cjs/event/events/HashChangeEvent.d.ts.map +1 -0
- package/cjs/event/events/IHashChangeEventInit.cjs +3 -0
- package/cjs/event/events/IHashChangeEventInit.cjs.map +1 -0
- package/cjs/event/events/IHashChangeEventInit.d.ts +6 -0
- package/cjs/event/events/IHashChangeEventInit.d.ts.map +1 -0
- package/cjs/fetch/Fetch.cjs +3 -3
- package/cjs/fetch/Fetch.cjs.map +1 -1
- package/cjs/fetch/Request.cjs +2 -2
- package/cjs/fetch/Request.cjs.map +1 -1
- package/cjs/fetch/SyncFetch.cjs +3 -3
- package/cjs/fetch/SyncFetch.cjs.map +1 -1
- package/cjs/fetch/utilities/FetchRequestHeaderUtility.cjs +5 -3
- package/cjs/fetch/utilities/FetchRequestHeaderUtility.cjs.map +1 -1
- package/cjs/fetch/utilities/FetchRequestHeaderUtility.d.ts.map +1 -1
- package/cjs/fetch/utilities/FetchRequestReferrerUtility.cjs +1 -1
- package/cjs/fetch/utilities/FetchRequestReferrerUtility.cjs.map +1 -1
- package/cjs/fetch/utilities/FetchRequestReferrerUtility.d.ts.map +1 -1
- package/cjs/form-data/FormData.cjs +1 -1
- package/cjs/form-data/FormData.cjs.map +1 -1
- package/cjs/form-data/FormData.d.ts +1 -1
- package/cjs/form-data/FormData.d.ts.map +1 -1
- package/cjs/index.cjs +7 -3
- package/cjs/index.cjs.map +1 -1
- package/cjs/index.d.ts +7 -3
- package/cjs/index.d.ts.map +1 -1
- package/cjs/location/Location.cjs +270 -0
- package/cjs/location/Location.cjs.map +1 -0
- package/cjs/location/Location.d.ts +144 -0
- package/cjs/location/Location.d.ts.map +1 -0
- package/cjs/named-node-map/NamedNodeMap.cjs +2 -1
- package/cjs/named-node-map/NamedNodeMap.cjs.map +1 -1
- package/cjs/named-node-map/NamedNodeMap.d.ts.map +1 -1
- package/cjs/nodes/document/Document.cjs +4 -4
- package/cjs/nodes/document/Document.cjs.map +1 -1
- package/cjs/nodes/document/Document.d.ts +114 -6
- package/cjs/nodes/document/Document.d.ts.map +1 -1
- package/cjs/nodes/document/IDocument.d.ts +28 -12
- package/cjs/nodes/document/IDocument.d.ts.map +1 -1
- package/cjs/nodes/document-fragment/DocumentFragment.cjs +2 -2
- package/cjs/nodes/document-fragment/DocumentFragment.cjs.map +1 -1
- package/cjs/nodes/document-fragment/DocumentFragment.d.ts +31 -1
- package/cjs/nodes/document-fragment/DocumentFragment.d.ts.map +1 -1
- package/cjs/nodes/document-fragment/IDocumentFragment.d.ts +6 -0
- package/cjs/nodes/document-fragment/IDocumentFragment.d.ts.map +1 -1
- package/cjs/nodes/element/Element.cjs +1 -1
- package/cjs/nodes/element/Element.cjs.map +1 -1
- package/cjs/nodes/element/Element.d.ts +61 -1
- package/cjs/nodes/element/Element.d.ts.map +1 -1
- package/cjs/nodes/element/HTMLCollection.cjs +2 -1
- package/cjs/nodes/element/HTMLCollection.cjs.map +1 -1
- package/cjs/nodes/element/HTMLCollection.d.ts.map +1 -1
- package/cjs/nodes/html-anchor-element/HTMLAnchorElement.cjs +2 -0
- package/cjs/nodes/html-anchor-element/HTMLAnchorElement.cjs.map +1 -1
- package/cjs/nodes/html-anchor-element/HTMLAnchorElement.d.ts.map +1 -1
- package/cjs/nodes/html-button-element/HTMLButtonElement.cjs +93 -4
- package/cjs/nodes/html-button-element/HTMLButtonElement.cjs.map +1 -1
- package/cjs/nodes/html-button-element/HTMLButtonElement.d.ts +49 -1
- package/cjs/nodes/html-button-element/HTMLButtonElement.d.ts.map +1 -1
- package/cjs/nodes/html-button-element/IHTMLButtonElement.d.ts +5 -1
- package/cjs/nodes/html-button-element/IHTMLButtonElement.d.ts.map +1 -1
- package/cjs/nodes/html-form-element/HTMLFormControlsCollection.cjs +2 -1
- package/cjs/nodes/html-form-element/HTMLFormControlsCollection.cjs.map +1 -1
- package/cjs/nodes/html-form-element/HTMLFormControlsCollection.d.ts.map +1 -1
- package/cjs/nodes/html-form-element/HTMLFormElement.cjs +104 -9
- package/cjs/nodes/html-form-element/HTMLFormElement.cjs.map +1 -1
- package/cjs/nodes/html-form-element/HTMLFormElement.d.ts +8 -2
- package/cjs/nodes/html-form-element/HTMLFormElement.d.ts.map +1 -1
- package/cjs/nodes/html-iframe-element/HTMLIFrameElement.cjs +14 -0
- package/cjs/nodes/html-iframe-element/HTMLIFrameElement.cjs.map +1 -1
- package/cjs/nodes/html-iframe-element/HTMLIFrameElement.d.ts +10 -0
- package/cjs/nodes/html-iframe-element/HTMLIFrameElement.d.ts.map +1 -1
- package/cjs/nodes/html-iframe-element/HTMLIFrameElementPageLoader.cjs +4 -1
- package/cjs/nodes/html-iframe-element/HTMLIFrameElementPageLoader.cjs.map +1 -1
- package/cjs/nodes/html-iframe-element/HTMLIFrameElementPageLoader.d.ts.map +1 -1
- package/cjs/nodes/html-iframe-element/IHTMLIFrameElement.d.ts +1 -0
- package/cjs/nodes/html-iframe-element/IHTMLIFrameElement.d.ts.map +1 -1
- package/cjs/nodes/html-input-element/HTMLInputElement.cjs +100 -52
- package/cjs/nodes/html-input-element/HTMLInputElement.cjs.map +1 -1
- package/cjs/nodes/html-input-element/HTMLInputElement.d.ts +49 -23
- package/cjs/nodes/html-input-element/HTMLInputElement.d.ts.map +1 -1
- package/cjs/nodes/html-input-element/IHTMLInputElement.d.ts +2 -0
- package/cjs/nodes/html-input-element/IHTMLInputElement.d.ts.map +1 -1
- package/cjs/nodes/html-label-element/HTMLLabelElement.cjs +1 -0
- package/cjs/nodes/html-label-element/HTMLLabelElement.cjs.map +1 -1
- package/cjs/nodes/html-label-element/HTMLLabelElement.d.ts.map +1 -1
- package/cjs/nodes/html-link-element/HTMLLinkElementStyleSheetLoader.cjs +1 -1
- package/cjs/nodes/html-link-element/HTMLLinkElementStyleSheetLoader.cjs.map +1 -1
- package/cjs/nodes/html-script-element/HTMLScriptElementScriptLoader.cjs +1 -1
- package/cjs/nodes/html-script-element/HTMLScriptElementScriptLoader.cjs.map +1 -1
- package/cjs/nodes/html-select-element/HTMLSelectElement.cjs.map +1 -1
- package/cjs/nodes/html-select-element/HTMLSelectElement.d.ts.map +1 -1
- package/cjs/nodes/node/Node.cjs.map +1 -1
- package/cjs/nodes/node/Node.d.ts.map +1 -1
- package/cjs/nodes/parent-node/IParentNode.d.ts +17 -0
- package/cjs/nodes/parent-node/IParentNode.d.ts.map +1 -1
- package/cjs/nodes/parent-node/ParentNodeUtility.cjs.map +1 -1
- package/cjs/nodes/parent-node/ParentNodeUtility.d.ts.map +1 -1
- package/cjs/query-selector/QuerySelector.cjs.map +1 -1
- package/cjs/query-selector/QuerySelector.d.ts +34 -0
- package/cjs/query-selector/QuerySelector.d.ts.map +1 -1
- package/cjs/version.cjs +1 -1
- package/cjs/window/BrowserWindow.cjs +9 -3
- package/cjs/window/BrowserWindow.cjs.map +1 -1
- package/cjs/window/BrowserWindow.d.ts +5 -4
- package/cjs/window/BrowserWindow.d.ts.map +1 -1
- package/cjs/window/CrossOriginBrowserWindow.d.ts +1 -1
- package/cjs/window/CrossOriginBrowserWindow.d.ts.map +1 -1
- package/cjs/window/IBrowserWindow.d.ts +3 -2
- package/cjs/window/IBrowserWindow.d.ts.map +1 -1
- package/cjs/window/ICrossOriginBrowserWindow.d.ts +1 -1
- package/cjs/window/ICrossOriginBrowserWindow.d.ts.map +1 -1
- package/cjs/window/WindowPageOpenUtility.cjs +4 -2
- package/cjs/window/WindowPageOpenUtility.cjs.map +1 -1
- package/cjs/window/WindowPageOpenUtility.d.ts.map +1 -1
- package/lib/browser/BrowserFrame.d.ts.map +1 -1
- package/lib/browser/BrowserFrame.js +12 -2
- package/lib/browser/BrowserFrame.js.map +1 -1
- package/lib/browser/detached-browser/DetachedBrowserFrame.d.ts.map +1 -1
- package/lib/browser/detached-browser/DetachedBrowserFrame.js +12 -2
- package/lib/browser/detached-browser/DetachedBrowserFrame.js.map +1 -1
- package/lib/browser/utilities/BrowserFrameFactory.d.ts.map +1 -1
- package/lib/browser/utilities/BrowserFrameFactory.js +5 -0
- package/lib/browser/utilities/BrowserFrameFactory.js.map +1 -1
- package/lib/browser/utilities/BrowserFrameNavigator.d.ts +21 -10
- package/lib/browser/utilities/BrowserFrameNavigator.d.ts.map +1 -1
- package/lib/browser/utilities/BrowserFrameNavigator.js +20 -13
- package/lib/browser/utilities/BrowserFrameNavigator.js.map +1 -1
- package/lib/browser/utilities/BrowserFrameURL.d.ts.map +1 -1
- package/lib/browser/utilities/BrowserFrameURL.js +2 -2
- package/lib/browser/utilities/BrowserFrameURL.js.map +1 -1
- package/lib/config/IHTMLElementTagNameMap.d.ts +146 -0
- package/lib/config/IHTMLElementTagNameMap.d.ts.map +1 -0
- package/lib/config/IHTMLElementTagNameMap.js +2 -0
- package/lib/config/IHTMLElementTagNameMap.js.map +1 -0
- package/lib/config/ISVGElementTagNameMap.d.ts +67 -0
- package/lib/config/ISVGElementTagNameMap.d.ts.map +1 -0
- package/lib/config/ISVGElementTagNameMap.js +2 -0
- package/lib/config/ISVGElementTagNameMap.js.map +1 -0
- package/lib/event/events/HashChangeEvent.d.ts +19 -0
- package/lib/event/events/HashChangeEvent.d.ts.map +1 -0
- package/lib/event/events/HashChangeEvent.js +20 -0
- package/lib/event/events/HashChangeEvent.js.map +1 -0
- package/lib/event/events/IHashChangeEventInit.d.ts +6 -0
- package/lib/event/events/IHashChangeEventInit.d.ts.map +1 -0
- package/lib/event/events/IHashChangeEventInit.js +2 -0
- package/lib/event/events/IHashChangeEventInit.js.map +1 -0
- package/lib/fetch/Fetch.js +3 -3
- package/lib/fetch/Fetch.js.map +1 -1
- package/lib/fetch/Request.js +2 -2
- package/lib/fetch/Request.js.map +1 -1
- package/lib/fetch/SyncFetch.js +3 -3
- package/lib/fetch/SyncFetch.js.map +1 -1
- package/lib/fetch/utilities/FetchRequestHeaderUtility.d.ts.map +1 -1
- package/lib/fetch/utilities/FetchRequestHeaderUtility.js +4 -2
- package/lib/fetch/utilities/FetchRequestHeaderUtility.js.map +1 -1
- package/lib/fetch/utilities/FetchRequestReferrerUtility.d.ts.map +1 -1
- package/lib/fetch/utilities/FetchRequestReferrerUtility.js +1 -1
- package/lib/fetch/utilities/FetchRequestReferrerUtility.js.map +1 -1
- package/lib/form-data/FormData.d.ts +1 -1
- package/lib/form-data/FormData.d.ts.map +1 -1
- package/lib/form-data/FormData.js +1 -1
- package/lib/form-data/FormData.js.map +1 -1
- package/lib/index.d.ts +7 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -2
- package/lib/index.js.map +1 -1
- package/lib/location/Location.d.ts +144 -0
- package/lib/location/Location.d.ts.map +1 -0
- package/lib/location/Location.js +241 -0
- package/lib/location/Location.js.map +1 -0
- package/lib/named-node-map/NamedNodeMap.d.ts.map +1 -1
- package/lib/named-node-map/NamedNodeMap.js +2 -1
- package/lib/named-node-map/NamedNodeMap.js.map +1 -1
- package/lib/nodes/document/Document.d.ts +114 -6
- package/lib/nodes/document/Document.d.ts.map +1 -1
- package/lib/nodes/document/Document.js +4 -4
- package/lib/nodes/document/Document.js.map +1 -1
- package/lib/nodes/document/IDocument.d.ts +28 -12
- package/lib/nodes/document/IDocument.d.ts.map +1 -1
- package/lib/nodes/document-fragment/DocumentFragment.d.ts +31 -1
- package/lib/nodes/document-fragment/DocumentFragment.d.ts.map +1 -1
- package/lib/nodes/document-fragment/DocumentFragment.js +2 -2
- package/lib/nodes/document-fragment/DocumentFragment.js.map +1 -1
- package/lib/nodes/document-fragment/IDocumentFragment.d.ts +6 -0
- package/lib/nodes/document-fragment/IDocumentFragment.d.ts.map +1 -1
- package/lib/nodes/element/Element.d.ts +61 -1
- package/lib/nodes/element/Element.d.ts.map +1 -1
- package/lib/nodes/element/Element.js +1 -1
- package/lib/nodes/element/Element.js.map +1 -1
- package/lib/nodes/element/HTMLCollection.d.ts.map +1 -1
- package/lib/nodes/element/HTMLCollection.js +2 -1
- package/lib/nodes/element/HTMLCollection.js.map +1 -1
- package/lib/nodes/html-anchor-element/HTMLAnchorElement.d.ts.map +1 -1
- package/lib/nodes/html-anchor-element/HTMLAnchorElement.js +2 -0
- package/lib/nodes/html-anchor-element/HTMLAnchorElement.js.map +1 -1
- package/lib/nodes/html-button-element/HTMLButtonElement.d.ts +49 -1
- package/lib/nodes/html-button-element/HTMLButtonElement.d.ts.map +1 -1
- package/lib/nodes/html-button-element/HTMLButtonElement.js +93 -4
- package/lib/nodes/html-button-element/HTMLButtonElement.js.map +1 -1
- package/lib/nodes/html-button-element/IHTMLButtonElement.d.ts +5 -1
- package/lib/nodes/html-button-element/IHTMLButtonElement.d.ts.map +1 -1
- package/lib/nodes/html-form-element/HTMLFormControlsCollection.d.ts.map +1 -1
- package/lib/nodes/html-form-element/HTMLFormControlsCollection.js +2 -1
- package/lib/nodes/html-form-element/HTMLFormControlsCollection.js.map +1 -1
- package/lib/nodes/html-form-element/HTMLFormElement.d.ts +8 -2
- package/lib/nodes/html-form-element/HTMLFormElement.d.ts.map +1 -1
- package/lib/nodes/html-form-element/HTMLFormElement.js +106 -10
- package/lib/nodes/html-form-element/HTMLFormElement.js.map +1 -1
- package/lib/nodes/html-iframe-element/HTMLIFrameElement.d.ts +10 -0
- package/lib/nodes/html-iframe-element/HTMLIFrameElement.d.ts.map +1 -1
- package/lib/nodes/html-iframe-element/HTMLIFrameElement.js +14 -0
- package/lib/nodes/html-iframe-element/HTMLIFrameElement.js.map +1 -1
- package/lib/nodes/html-iframe-element/HTMLIFrameElementPageLoader.d.ts.map +1 -1
- package/lib/nodes/html-iframe-element/HTMLIFrameElementPageLoader.js +4 -1
- package/lib/nodes/html-iframe-element/HTMLIFrameElementPageLoader.js.map +1 -1
- package/lib/nodes/html-iframe-element/IHTMLIFrameElement.d.ts +1 -0
- package/lib/nodes/html-iframe-element/IHTMLIFrameElement.d.ts.map +1 -1
- package/lib/nodes/html-input-element/HTMLInputElement.d.ts +49 -23
- package/lib/nodes/html-input-element/HTMLInputElement.d.ts.map +1 -1
- package/lib/nodes/html-input-element/HTMLInputElement.js +100 -52
- package/lib/nodes/html-input-element/HTMLInputElement.js.map +1 -1
- package/lib/nodes/html-input-element/IHTMLInputElement.d.ts +2 -0
- package/lib/nodes/html-input-element/IHTMLInputElement.d.ts.map +1 -1
- package/lib/nodes/html-label-element/HTMLLabelElement.d.ts.map +1 -1
- package/lib/nodes/html-label-element/HTMLLabelElement.js +1 -0
- package/lib/nodes/html-label-element/HTMLLabelElement.js.map +1 -1
- package/lib/nodes/html-link-element/HTMLLinkElementStyleSheetLoader.js +1 -1
- package/lib/nodes/html-link-element/HTMLLinkElementStyleSheetLoader.js.map +1 -1
- package/lib/nodes/html-script-element/HTMLScriptElementScriptLoader.js +1 -1
- package/lib/nodes/html-script-element/HTMLScriptElementScriptLoader.js.map +1 -1
- package/lib/nodes/html-select-element/HTMLSelectElement.d.ts.map +1 -1
- package/lib/nodes/html-select-element/HTMLSelectElement.js.map +1 -1
- package/lib/nodes/node/Node.d.ts.map +1 -1
- package/lib/nodes/node/Node.js.map +1 -1
- package/lib/nodes/parent-node/IParentNode.d.ts +17 -0
- package/lib/nodes/parent-node/IParentNode.d.ts.map +1 -1
- package/lib/nodes/parent-node/ParentNodeUtility.d.ts.map +1 -1
- package/lib/nodes/parent-node/ParentNodeUtility.js.map +1 -1
- package/lib/query-selector/QuerySelector.d.ts +34 -0
- package/lib/query-selector/QuerySelector.d.ts.map +1 -1
- package/lib/query-selector/QuerySelector.js.map +1 -1
- package/lib/version.js +1 -1
- package/lib/window/BrowserWindow.d.ts +5 -4
- package/lib/window/BrowserWindow.d.ts.map +1 -1
- package/lib/window/BrowserWindow.js +10 -4
- package/lib/window/BrowserWindow.js.map +1 -1
- package/lib/window/CrossOriginBrowserWindow.d.ts +1 -1
- package/lib/window/CrossOriginBrowserWindow.d.ts.map +1 -1
- package/lib/window/IBrowserWindow.d.ts +3 -2
- package/lib/window/IBrowserWindow.d.ts.map +1 -1
- package/lib/window/ICrossOriginBrowserWindow.d.ts +1 -1
- package/lib/window/ICrossOriginBrowserWindow.d.ts.map +1 -1
- package/lib/window/WindowPageOpenUtility.d.ts.map +1 -1
- package/lib/window/WindowPageOpenUtility.js +4 -2
- package/lib/window/WindowPageOpenUtility.js.map +1 -1
- package/package.json +1 -1
- package/src/browser/BrowserFrame.ts +12 -2
- package/src/browser/detached-browser/DetachedBrowserFrame.ts +12 -7
- package/src/browser/utilities/BrowserFrameFactory.ts +7 -0
- package/src/browser/utilities/BrowserFrameNavigator.ts +28 -18
- package/src/browser/utilities/BrowserFrameURL.ts +2 -2
- package/src/config/IHTMLElementTagNameMap.ts +148 -0
- package/src/config/ISVGElementTagNameMap.ts +67 -0
- package/src/event/events/HashChangeEvent.ts +25 -0
- package/src/event/events/IHashChangeEventInit.ts +6 -0
- package/src/fetch/Fetch.ts +3 -3
- package/src/fetch/Request.ts +2 -2
- package/src/fetch/SyncFetch.ts +3 -3
- package/src/fetch/utilities/FetchRequestHeaderUtility.ts +4 -5
- package/src/fetch/utilities/FetchRequestReferrerUtility.ts +2 -1
- package/src/form-data/FormData.ts +2 -2
- package/src/index.ts +9 -1
- package/src/location/Location.ts +257 -0
- package/src/named-node-map/NamedNodeMap.ts +1 -0
- package/src/nodes/document/Document.ts +224 -17
- package/src/nodes/document/IDocument.ts +33 -11
- package/src/nodes/document-fragment/DocumentFragment.ts +59 -1
- package/src/nodes/document-fragment/IDocumentFragment.ts +14 -0
- package/src/nodes/element/Element.ts +120 -1
- package/src/nodes/element/HTMLCollection.ts +1 -0
- package/src/nodes/html-anchor-element/HTMLAnchorElement.ts +2 -0
- package/src/nodes/html-button-element/HTMLButtonElement.ts +107 -5
- package/src/nodes/html-button-element/IHTMLButtonElement.ts +5 -1
- package/src/nodes/html-form-element/HTMLFormControlsCollection.ts +1 -0
- package/src/nodes/html-form-element/HTMLFormElement.ts +111 -5
- package/src/nodes/html-iframe-element/HTMLIFrameElement.ts +16 -0
- package/src/nodes/html-iframe-element/HTMLIFrameElementPageLoader.ts +5 -1
- package/src/nodes/html-iframe-element/IHTMLIFrameElement.ts +1 -0
- package/src/nodes/html-input-element/HTMLInputElement.ts +111 -57
- package/src/nodes/html-input-element/IHTMLInputElement.ts +2 -0
- package/src/nodes/html-label-element/HTMLLabelElement.ts +1 -0
- package/src/nodes/html-link-element/HTMLLinkElementStyleSheetLoader.ts +1 -1
- package/src/nodes/html-script-element/HTMLScriptElementScriptLoader.ts +1 -1
- package/src/nodes/html-select-element/HTMLSelectElement.ts +1 -2
- package/src/nodes/node/Node.ts +1 -2
- package/src/nodes/parent-node/IParentNode.ts +36 -0
- package/src/nodes/parent-node/ParentNodeUtility.ts +1 -0
- package/src/query-selector/QuerySelector.ts +76 -2
- package/src/window/BrowserWindow.ts +11 -4
- package/src/window/CrossOriginBrowserWindow.ts +1 -1
- package/src/window/IBrowserWindow.ts +3 -2
- package/src/window/ICrossOriginBrowserWindow.ts +1 -1
- package/src/window/WindowPageOpenUtility.ts +4 -2
- package/cjs/url/Location.cjs +0 -111
- package/cjs/url/Location.cjs.map +0 -1
- package/cjs/url/Location.d.ts +0 -48
- package/cjs/url/Location.d.ts.map +0 -1
- package/lib/url/Location.d.ts +0 -48
- package/lib/url/Location.d.ts.map +0 -1
- package/lib/url/Location.js +0 -82
- package/lib/url/Location.js.map +0 -1
- package/src/url/Location.ts +0 -79
@@ -0,0 +1,257 @@
|
|
1
|
+
import IBrowserFrame from '../browser/types/IBrowserFrame.js';
|
2
|
+
import HashChangeEvent from '../event/events/HashChangeEvent.js';
|
3
|
+
import * as PropertySymbol from '../PropertySymbol.js';
|
4
|
+
import { URL } from 'url';
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Location.
|
8
|
+
*/
|
9
|
+
export default class Location {
|
10
|
+
// Public properties
|
11
|
+
public [Symbol.toStringTag]: string = 'Location';
|
12
|
+
|
13
|
+
// Private properties
|
14
|
+
#browserFrame: IBrowserFrame;
|
15
|
+
#url: URL;
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Constructor.
|
19
|
+
*
|
20
|
+
* @param browserFrame Browser frame.
|
21
|
+
* @param url URL.
|
22
|
+
*/
|
23
|
+
constructor(browserFrame: IBrowserFrame, url: string) {
|
24
|
+
this.#browserFrame = browserFrame;
|
25
|
+
this.#url = new URL(url);
|
26
|
+
}
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Returns hash.
|
30
|
+
*
|
31
|
+
* @returns Hash.
|
32
|
+
*/
|
33
|
+
public get hash(): string {
|
34
|
+
return this.#url.hash;
|
35
|
+
}
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Sets hash.
|
39
|
+
*
|
40
|
+
* @param hash Value.
|
41
|
+
*/
|
42
|
+
public set hash(hash: string) {
|
43
|
+
const oldURL = this.#url.href;
|
44
|
+
this.#url.hash = hash;
|
45
|
+
const newURL = this.#url.href;
|
46
|
+
if (newURL !== oldURL) {
|
47
|
+
this.#browserFrame.window?.dispatchEvent(
|
48
|
+
new HashChangeEvent('hashchange', { oldURL, newURL })
|
49
|
+
);
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
/**
|
54
|
+
* Returns host.
|
55
|
+
*
|
56
|
+
* @returns Host.
|
57
|
+
*/
|
58
|
+
public get host(): string {
|
59
|
+
return this.#url.host;
|
60
|
+
}
|
61
|
+
|
62
|
+
/**
|
63
|
+
* Sets host.
|
64
|
+
*
|
65
|
+
* @param host Value.
|
66
|
+
*/
|
67
|
+
public set host(host: string) {
|
68
|
+
const url = new URL(this.#url.href);
|
69
|
+
url.host = host;
|
70
|
+
this.#browserFrame
|
71
|
+
.goto(url.href)
|
72
|
+
.catch((error) => this.#browserFrame.page.console.error(error));
|
73
|
+
}
|
74
|
+
|
75
|
+
/**
|
76
|
+
* Returns hostname.
|
77
|
+
*
|
78
|
+
* @returns Hostname.
|
79
|
+
*/
|
80
|
+
public get hostname(): string {
|
81
|
+
return this.#url.hostname;
|
82
|
+
}
|
83
|
+
|
84
|
+
/**
|
85
|
+
* Sets hostname.
|
86
|
+
*
|
87
|
+
* @param hostname Value.
|
88
|
+
*/
|
89
|
+
public set hostname(hostname: string) {
|
90
|
+
const url = new URL(this.#url.href);
|
91
|
+
url.hostname = hostname;
|
92
|
+
this.#browserFrame
|
93
|
+
.goto(url.href)
|
94
|
+
.catch((error) => this.#browserFrame.page.console.error(error));
|
95
|
+
}
|
96
|
+
|
97
|
+
/**
|
98
|
+
* Override set href.
|
99
|
+
*/
|
100
|
+
public get href(): string {
|
101
|
+
return this.#url.href;
|
102
|
+
}
|
103
|
+
|
104
|
+
/**
|
105
|
+
* Override set href.
|
106
|
+
*/
|
107
|
+
public set href(url: string) {
|
108
|
+
this.#browserFrame.goto(url).catch((error) => this.#browserFrame.page.console.error(error));
|
109
|
+
}
|
110
|
+
|
111
|
+
/**
|
112
|
+
* Returns origin.
|
113
|
+
*
|
114
|
+
* @returns Origin.
|
115
|
+
*/
|
116
|
+
public get origin(): string {
|
117
|
+
return this.#url.origin;
|
118
|
+
}
|
119
|
+
|
120
|
+
/**
|
121
|
+
* Returns pathname
|
122
|
+
*
|
123
|
+
* @returns Pathname.
|
124
|
+
*/
|
125
|
+
public get pathname(): string {
|
126
|
+
return this.#url.pathname;
|
127
|
+
}
|
128
|
+
|
129
|
+
/**
|
130
|
+
* Sets pathname.
|
131
|
+
*
|
132
|
+
* @param pathname Value.
|
133
|
+
*/
|
134
|
+
public set pathname(pathname: string) {
|
135
|
+
const url = new URL(this.#url.href);
|
136
|
+
url.pathname = pathname;
|
137
|
+
this.#browserFrame
|
138
|
+
.goto(url.href)
|
139
|
+
.catch((error) => this.#browserFrame.page.console.error(error));
|
140
|
+
}
|
141
|
+
|
142
|
+
/**
|
143
|
+
* Returns port.
|
144
|
+
*
|
145
|
+
* @returns Port.
|
146
|
+
*/
|
147
|
+
public get port(): string {
|
148
|
+
return this.#url.port;
|
149
|
+
}
|
150
|
+
|
151
|
+
/**
|
152
|
+
* Sets port.
|
153
|
+
*
|
154
|
+
* @param port Value.
|
155
|
+
*/
|
156
|
+
public set port(port: string) {
|
157
|
+
const url = new URL(this.#url.href);
|
158
|
+
url.port = port;
|
159
|
+
this.#browserFrame
|
160
|
+
.goto(url.href)
|
161
|
+
.catch((error) => this.#browserFrame.page.console.error(error));
|
162
|
+
}
|
163
|
+
|
164
|
+
/**
|
165
|
+
* Returns protocol.
|
166
|
+
*
|
167
|
+
* @returns Protocol.
|
168
|
+
*/
|
169
|
+
public get protocol(): string {
|
170
|
+
return this.#url.protocol;
|
171
|
+
}
|
172
|
+
|
173
|
+
/**
|
174
|
+
* Sets protocol.
|
175
|
+
*
|
176
|
+
* @param protocol Value.
|
177
|
+
*/
|
178
|
+
public set protocol(protocol: string) {
|
179
|
+
const url = new URL(this.#url.href);
|
180
|
+
url.protocol = protocol;
|
181
|
+
this.#browserFrame
|
182
|
+
.goto(url.href)
|
183
|
+
.catch((error) => this.#browserFrame.page.console.error(error));
|
184
|
+
}
|
185
|
+
|
186
|
+
/**
|
187
|
+
* Returns search.
|
188
|
+
*
|
189
|
+
* @returns Search.
|
190
|
+
*/
|
191
|
+
public get search(): string {
|
192
|
+
return this.#url.search;
|
193
|
+
}
|
194
|
+
|
195
|
+
/**
|
196
|
+
* Sets search.
|
197
|
+
*
|
198
|
+
* @param search Value.
|
199
|
+
*/
|
200
|
+
public set search(search: string) {
|
201
|
+
const url = new URL(this.#url.href);
|
202
|
+
url.search = search;
|
203
|
+
this.#browserFrame
|
204
|
+
.goto(url.href)
|
205
|
+
.catch((error) => this.#browserFrame.page.console.error(error));
|
206
|
+
}
|
207
|
+
|
208
|
+
/**
|
209
|
+
* Replaces the current resource with the one at the provided URL. The difference from the assign() method is that after using replace() the current page will not be saved in session History, meaning the user won't be able to use the back button to navigate to it.
|
210
|
+
*
|
211
|
+
* @param url URL.
|
212
|
+
*/
|
213
|
+
public replace(url: string): void {
|
214
|
+
this.href = url;
|
215
|
+
}
|
216
|
+
|
217
|
+
/**
|
218
|
+
* Loads the resource at the URL provided in parameter.
|
219
|
+
*
|
220
|
+
* @param url URL.
|
221
|
+
*/
|
222
|
+
public assign(url: string): void {
|
223
|
+
this.href = url;
|
224
|
+
}
|
225
|
+
|
226
|
+
/**
|
227
|
+
* Reloads the resource from the current URL.
|
228
|
+
*/
|
229
|
+
public reload(): void {
|
230
|
+
this.#browserFrame
|
231
|
+
.goto(this.href)
|
232
|
+
.catch((error) => this.#browserFrame.page.console.error(error));
|
233
|
+
}
|
234
|
+
|
235
|
+
/**
|
236
|
+
* Replaces the current URL state with the provided one without navigating to the new URL.
|
237
|
+
*
|
238
|
+
* @param browserFrame Browser frame that must match the current one as validation.
|
239
|
+
* @param url URL.
|
240
|
+
*/
|
241
|
+
public [PropertySymbol.setURL](browserFrame: IBrowserFrame, url: string): void {
|
242
|
+
if (this.#browserFrame !== browserFrame) {
|
243
|
+
throw new Error('Failed to set URL. Browser frame mismatch.');
|
244
|
+
}
|
245
|
+
|
246
|
+
this.#url.href = url;
|
247
|
+
}
|
248
|
+
|
249
|
+
/**
|
250
|
+
* Returns the URL as a string.
|
251
|
+
*
|
252
|
+
* @returns URL as a string.
|
253
|
+
*/
|
254
|
+
public toString(): string {
|
255
|
+
return this.#url.toString();
|
256
|
+
}
|
257
|
+
}
|
@@ -225,6 +225,7 @@ export default class NamedNodeMap implements INamedNodeMap {
|
|
225
225
|
*/
|
226
226
|
protected [PropertySymbol.isValidPropertyName](name: string): boolean {
|
227
227
|
return (
|
228
|
+
!!name &&
|
228
229
|
!this.constructor.prototype.hasOwnProperty(name) &&
|
229
230
|
(isNaN(Number(name)) || name.includes('.'))
|
230
231
|
);
|
@@ -31,7 +31,7 @@ import IHTMLCollection from '../element/IHTMLCollection.js';
|
|
31
31
|
import IHTMLLinkElement from '../html-link-element/IHTMLLinkElement.js';
|
32
32
|
import IHTMLStyleElement from '../html-style-element/IHTMLStyleElement.js';
|
33
33
|
import DocumentReadyStateEnum from './DocumentReadyStateEnum.js';
|
34
|
-
import Location from '../../
|
34
|
+
import Location from '../../location/Location.js';
|
35
35
|
import Selection from '../../selection/Selection.js';
|
36
36
|
import IShadowRoot from '../shadow-root/IShadowRoot.js';
|
37
37
|
import Range from '../../range/Range.js';
|
@@ -45,6 +45,12 @@ import NodeTypeEnum from '../node/NodeTypeEnum.js';
|
|
45
45
|
import CookieStringUtility from '../../cookie/urilities/CookieStringUtility.js';
|
46
46
|
import IBrowserFrame from '../../browser/types/IBrowserFrame.js';
|
47
47
|
import NodeFactory from '../NodeFactory.js';
|
48
|
+
import { URL } from 'url';
|
49
|
+
import IHTMLElementTagNameMap from '../../config/IHTMLElementTagNameMap.js';
|
50
|
+
import ISVGElementTagNameMap from '../../config/ISVGElementTagNameMap.js';
|
51
|
+
import ISVGElement from '../svg-element/ISVGElement.js';
|
52
|
+
import IHTMLFormElement from '../html-form-element/IHTMLFormElement.js';
|
53
|
+
import IHTMLAnchorElement from '../html-anchor-element/IHTMLAnchorElement.js';
|
48
54
|
|
49
55
|
const PROCESSING_INSTRUCTION_TARGET_REGEXP = /^[a-z][a-z0-9-]+$/;
|
50
56
|
|
@@ -311,15 +317,15 @@ export default class Document extends Node implements IDocument {
|
|
311
317
|
/**
|
312
318
|
* Returns a collection of all area elements and a elements in a document with a value for the href attribute.
|
313
319
|
*/
|
314
|
-
public get links():
|
315
|
-
return <
|
320
|
+
public get links(): INodeList<IHTMLAnchorElement | IHTMLElement> {
|
321
|
+
return <INodeList<IHTMLElement>>this.querySelectorAll('a[href],area[href]');
|
316
322
|
}
|
317
323
|
|
318
324
|
/**
|
319
325
|
* Returns a collection of all form elements in a document.
|
320
326
|
*/
|
321
|
-
public get forms():
|
322
|
-
return
|
327
|
+
public get forms(): INodeList<IHTMLFormElement> {
|
328
|
+
return this.querySelectorAll('form');
|
323
329
|
}
|
324
330
|
|
325
331
|
/**
|
@@ -357,7 +363,7 @@ export default class Document extends Node implements IDocument {
|
|
357
363
|
public get cookie(): string {
|
358
364
|
return CookieStringUtility.cookiesToString(
|
359
365
|
this.#browserFrame.page.context.cookieContainer.getCookies(
|
360
|
-
this[PropertySymbol.ownerWindow].location,
|
366
|
+
new URL(this[PropertySymbol.ownerWindow].location.href),
|
361
367
|
true
|
362
368
|
)
|
363
369
|
);
|
@@ -370,7 +376,10 @@ export default class Document extends Node implements IDocument {
|
|
370
376
|
*/
|
371
377
|
public set cookie(cookie: string) {
|
372
378
|
this.#browserFrame.page.context.cookieContainer.addCookies([
|
373
|
-
CookieStringUtility.stringToCookie(
|
379
|
+
CookieStringUtility.stringToCookie(
|
380
|
+
new URL(this[PropertySymbol.ownerWindow].location.href),
|
381
|
+
cookie
|
382
|
+
)
|
374
383
|
]);
|
375
384
|
}
|
376
385
|
|
@@ -497,7 +506,7 @@ export default class Document extends Node implements IDocument {
|
|
497
506
|
* @returns Scripts.
|
498
507
|
*/
|
499
508
|
public get scripts(): IHTMLCollection<IHTMLScriptElement> {
|
500
|
-
return
|
509
|
+
return this.getElementsByTagName('script');
|
501
510
|
}
|
502
511
|
|
503
512
|
/**
|
@@ -594,6 +603,34 @@ export default class Document extends Node implements IDocument {
|
|
594
603
|
ParentNodeUtility.replaceChildren(this, ...nodes);
|
595
604
|
}
|
596
605
|
|
606
|
+
/**
|
607
|
+
* Query CSS selector to find matching nodes.
|
608
|
+
*
|
609
|
+
* @param selector CSS selector.
|
610
|
+
* @returns Matching elements.
|
611
|
+
*/
|
612
|
+
public querySelectorAll<K extends keyof IHTMLElementTagNameMap>(
|
613
|
+
selector: K
|
614
|
+
): INodeList<IHTMLElementTagNameMap[K]>;
|
615
|
+
|
616
|
+
/**
|
617
|
+
* Query CSS selector to find matching elments.
|
618
|
+
*
|
619
|
+
* @param selector CSS selector.
|
620
|
+
* @returns Matching elements.
|
621
|
+
*/
|
622
|
+
public querySelectorAll<K extends keyof ISVGElementTagNameMap>(
|
623
|
+
selector: K
|
624
|
+
): INodeList<ISVGElementTagNameMap[K]>;
|
625
|
+
|
626
|
+
/**
|
627
|
+
* Query CSS selector to find matching elments.
|
628
|
+
*
|
629
|
+
* @param selector CSS selector.
|
630
|
+
* @returns Matching elements.
|
631
|
+
*/
|
632
|
+
public querySelectorAll(selector: string): INodeList<IElement>;
|
633
|
+
|
597
634
|
/**
|
598
635
|
* Query CSS selector to find matching elments.
|
599
636
|
*
|
@@ -605,12 +642,40 @@ export default class Document extends Node implements IDocument {
|
|
605
642
|
}
|
606
643
|
|
607
644
|
/**
|
608
|
-
* Query CSS Selector to find
|
645
|
+
* Query CSS Selector to find matching node.
|
646
|
+
*
|
647
|
+
* @param selector CSS selector.
|
648
|
+
* @returns Matching element.
|
649
|
+
*/
|
650
|
+
public querySelector<K extends keyof IHTMLElementTagNameMap>(
|
651
|
+
selector: K
|
652
|
+
): IHTMLElementTagNameMap[K] | null;
|
653
|
+
|
654
|
+
/**
|
655
|
+
* Query CSS Selector to find matching node.
|
609
656
|
*
|
610
657
|
* @param selector CSS selector.
|
611
658
|
* @returns Matching element.
|
612
659
|
*/
|
613
|
-
public querySelector
|
660
|
+
public querySelector<K extends keyof ISVGElementTagNameMap>(
|
661
|
+
selector: K
|
662
|
+
): ISVGElementTagNameMap[K] | null;
|
663
|
+
|
664
|
+
/**
|
665
|
+
* Query CSS Selector to find matching node.
|
666
|
+
*
|
667
|
+
* @param selector CSS selector.
|
668
|
+
* @returns Matching element.
|
669
|
+
*/
|
670
|
+
public querySelector(selector: string): IElement | null;
|
671
|
+
|
672
|
+
/**
|
673
|
+
* Query CSS Selector to find matching node.
|
674
|
+
*
|
675
|
+
* @param selector CSS selector.
|
676
|
+
* @returns Matching element.
|
677
|
+
*/
|
678
|
+
public querySelector(selector: string): IElement | null {
|
614
679
|
return QuerySelector.querySelector(this, selector);
|
615
680
|
}
|
616
681
|
|
@@ -624,6 +689,34 @@ export default class Document extends Node implements IDocument {
|
|
624
689
|
return ParentNodeUtility.getElementsByClassName(this, className);
|
625
690
|
}
|
626
691
|
|
692
|
+
/**
|
693
|
+
* Returns an elements by tag name.
|
694
|
+
*
|
695
|
+
* @param tagName Tag name.
|
696
|
+
* @returns Matching element.
|
697
|
+
*/
|
698
|
+
public getElementsByTagName<K extends keyof IHTMLElementTagNameMap>(
|
699
|
+
tagName: K
|
700
|
+
): IHTMLCollection<IHTMLElementTagNameMap[K]>;
|
701
|
+
|
702
|
+
/**
|
703
|
+
* Returns an elements by tag name.
|
704
|
+
*
|
705
|
+
* @param tagName Tag name.
|
706
|
+
* @returns Matching element.
|
707
|
+
*/
|
708
|
+
public getElementsByTagName<K extends keyof ISVGElementTagNameMap>(
|
709
|
+
tagName: K
|
710
|
+
): IHTMLCollection<ISVGElementTagNameMap[K]>;
|
711
|
+
|
712
|
+
/**
|
713
|
+
* Returns an elements by tag name.
|
714
|
+
*
|
715
|
+
* @param tagName Tag name.
|
716
|
+
* @returns Matching element.
|
717
|
+
*/
|
718
|
+
public getElementsByTagName(tagName: string): IHTMLCollection<IElement>;
|
719
|
+
|
627
720
|
/**
|
628
721
|
* Returns an elements by tag name.
|
629
722
|
*
|
@@ -634,6 +727,39 @@ export default class Document extends Node implements IDocument {
|
|
634
727
|
return ParentNodeUtility.getElementsByTagName(this, tagName);
|
635
728
|
}
|
636
729
|
|
730
|
+
/**
|
731
|
+
* Returns an elements by tag name and namespace.
|
732
|
+
*
|
733
|
+
* @param namespaceURI Namespace URI.
|
734
|
+
* @param tagName Tag name.
|
735
|
+
* @returns Matching element.
|
736
|
+
*/
|
737
|
+
public getElementsByTagNameNS<K extends keyof IHTMLElementTagNameMap>(
|
738
|
+
namespaceURI: 'http://www.w3.org/1999/xhtml',
|
739
|
+
tagName: K
|
740
|
+
): IHTMLCollection<IHTMLElementTagNameMap[K]>;
|
741
|
+
|
742
|
+
/**
|
743
|
+
* Returns an elements by tag name and namespace.
|
744
|
+
*
|
745
|
+
* @param namespaceURI Namespace URI.
|
746
|
+
* @param tagName Tag name.
|
747
|
+
* @returns Matching element.
|
748
|
+
*/
|
749
|
+
public getElementsByTagNameNS<K extends keyof ISVGElementTagNameMap>(
|
750
|
+
namespaceURI: 'http://www.w3.org/2000/svg',
|
751
|
+
tagName: K
|
752
|
+
): IHTMLCollection<ISVGElementTagNameMap[K]>;
|
753
|
+
|
754
|
+
/**
|
755
|
+
* Returns an elements by tag name and namespace.
|
756
|
+
*
|
757
|
+
* @param namespaceURI Namespace URI.
|
758
|
+
* @param tagName Tag name.
|
759
|
+
* @returns Matching element.
|
760
|
+
*/
|
761
|
+
public getElementsByTagNameNS(namespaceURI: string, tagName: string): IHTMLCollection<IElement>;
|
762
|
+
|
637
763
|
/**
|
638
764
|
* Returns an elements by tag name and namespace.
|
639
765
|
*
|
@@ -867,10 +993,91 @@ export default class Document extends Node implements IDocument {
|
|
867
993
|
* @param [options.is] Tag name of a custom element previously defined via customElements.define().
|
868
994
|
* @returns Element.
|
869
995
|
*/
|
870
|
-
public createElement
|
871
|
-
|
996
|
+
public createElement<K extends keyof IHTMLElementTagNameMap>(
|
997
|
+
qualifiedName: K,
|
998
|
+
options?: { is?: string }
|
999
|
+
): IHTMLElementTagNameMap[K];
|
1000
|
+
|
1001
|
+
/**
|
1002
|
+
* Creates an element.
|
1003
|
+
*
|
1004
|
+
* @param qualifiedName Tag name.
|
1005
|
+
* @param [options] Options.
|
1006
|
+
* @param [options.is] Tag name of a custom element previously defined via customElements.define().
|
1007
|
+
* @returns Element.
|
1008
|
+
*/
|
1009
|
+
public createElement<K extends keyof ISVGElementTagNameMap>(
|
1010
|
+
qualifiedName: K,
|
1011
|
+
options?: { is?: string }
|
1012
|
+
): ISVGElementTagNameMap[K];
|
1013
|
+
|
1014
|
+
/**
|
1015
|
+
* Creates an element.
|
1016
|
+
*
|
1017
|
+
* @param qualifiedName Tag name.
|
1018
|
+
* @param [options] Options.
|
1019
|
+
* @param [options.is] Tag name of a custom element previously defined via customElements.define().
|
1020
|
+
* @returns Element.
|
1021
|
+
*/
|
1022
|
+
public createElement(qualifiedName: string, options?: { is?: string }): IHTMLElement;
|
1023
|
+
|
1024
|
+
/**
|
1025
|
+
* Creates an element.
|
1026
|
+
*
|
1027
|
+
* @param qualifiedName Tag name.
|
1028
|
+
* @param [options] Options.
|
1029
|
+
* @param [options.is] Tag name of a custom element previously defined via customElements.define().
|
1030
|
+
* @returns Element.
|
1031
|
+
*/
|
1032
|
+
public createElement(qualifiedName: string, options?: { is?: string }): IHTMLElement {
|
1033
|
+
return <IHTMLElement>this.createElementNS(NamespaceURI.html, qualifiedName, options);
|
872
1034
|
}
|
873
1035
|
|
1036
|
+
/**
|
1037
|
+
* Creates an element with the specified namespace URI and qualified name.
|
1038
|
+
*
|
1039
|
+
* @param namespaceURI Namespace URI.
|
1040
|
+
* @param qualifiedName Tag name.
|
1041
|
+
* @param [options] Options.
|
1042
|
+
* @param [options.is] Tag name of a custom element previously defined via customElements.define().
|
1043
|
+
* @returns Element.
|
1044
|
+
*/
|
1045
|
+
public createElementNS<K extends keyof IHTMLElementTagNameMap>(
|
1046
|
+
namespaceURI: 'http://www.w3.org/1999/xhtml',
|
1047
|
+
qualifiedName: K,
|
1048
|
+
options?: { is?: string }
|
1049
|
+
): IHTMLElementTagNameMap[K];
|
1050
|
+
|
1051
|
+
/**
|
1052
|
+
* Creates an element with the specified namespace URI and qualified name.
|
1053
|
+
*
|
1054
|
+
* @param namespaceURI Namespace URI.
|
1055
|
+
* @param qualifiedName Tag name.
|
1056
|
+
* @param [options] Options.
|
1057
|
+
* @param [options.is] Tag name of a custom element previously defined via customElements.define().
|
1058
|
+
* @returns Element.
|
1059
|
+
*/
|
1060
|
+
public createElementNS<K extends keyof ISVGElementTagNameMap>(
|
1061
|
+
namespaceURI: 'http://www.w3.org/2000/svg',
|
1062
|
+
qualifiedName: K,
|
1063
|
+
options?: { is?: string }
|
1064
|
+
): ISVGElementTagNameMap[K];
|
1065
|
+
|
1066
|
+
/**
|
1067
|
+
* Creates an element with the specified namespace URI and qualified name.
|
1068
|
+
*
|
1069
|
+
* @param namespaceURI Namespace URI.
|
1070
|
+
* @param qualifiedName Tag name.
|
1071
|
+
* @param [options] Options.
|
1072
|
+
* @param [options.is] Tag name of a custom element previously defined via customElements.define().
|
1073
|
+
* @returns Element.
|
1074
|
+
*/
|
1075
|
+
public createElementNS(
|
1076
|
+
namespaceURI: string,
|
1077
|
+
qualifiedName: string,
|
1078
|
+
options?: { is?: string }
|
1079
|
+
): IElement;
|
1080
|
+
|
874
1081
|
/**
|
875
1082
|
* Creates an element with the specified namespace URI and qualified name.
|
876
1083
|
*
|
@@ -895,7 +1102,7 @@ export default class Document extends Node implements IDocument {
|
|
895
1102
|
|
896
1103
|
// SVG element
|
897
1104
|
if (namespaceURI === NamespaceURI.svg) {
|
898
|
-
const element = NodeFactory.createNode<
|
1105
|
+
const element = NodeFactory.createNode<ISVGElement>(
|
899
1106
|
this,
|
900
1107
|
qualifiedName === 'svg'
|
901
1108
|
? this[PropertySymbol.ownerWindow].SVGSVGElement
|
@@ -905,7 +1112,7 @@ export default class Document extends Node implements IDocument {
|
|
905
1112
|
element[PropertySymbol.localName] = qualifiedName;
|
906
1113
|
element[PropertySymbol.namespaceURI] = namespaceURI;
|
907
1114
|
element[PropertySymbol.isValue] = options && options.is ? String(options.is) : null;
|
908
|
-
return element;
|
1115
|
+
return <IHTMLElement>(<unknown>element);
|
909
1116
|
}
|
910
1117
|
|
911
1118
|
// Custom HTML element
|
@@ -915,7 +1122,7 @@ export default class Document extends Node implements IDocument {
|
|
915
1122
|
];
|
916
1123
|
|
917
1124
|
if (customElement) {
|
918
|
-
const element = NodeFactory.createNode<
|
1125
|
+
const element = NodeFactory.createNode<IHTMLElement>(this, customElement.elementClass);
|
919
1126
|
element[PropertySymbol.tagName] = qualifiedName.toUpperCase();
|
920
1127
|
element[PropertySymbol.localName] = qualifiedName;
|
921
1128
|
element[PropertySymbol.namespaceURI] = namespaceURI;
|
@@ -928,7 +1135,7 @@ export default class Document extends Node implements IDocument {
|
|
928
1135
|
|
929
1136
|
// Known HTML element
|
930
1137
|
if (elementClass) {
|
931
|
-
const element = NodeFactory.createNode<
|
1138
|
+
const element = NodeFactory.createNode<IHTMLElement>(this, elementClass);
|
932
1139
|
|
933
1140
|
element[PropertySymbol.tagName] = qualifiedName.toUpperCase();
|
934
1141
|
element[PropertySymbol.localName] = localName;
|
@@ -952,7 +1159,7 @@ export default class Document extends Node implements IDocument {
|
|
952
1159
|
element[PropertySymbol.namespaceURI] = namespaceURI;
|
953
1160
|
element[PropertySymbol.isValue] = options && options.is ? String(options.is) : null;
|
954
1161
|
|
955
|
-
return element;
|
1162
|
+
return <IHTMLElement>element;
|
956
1163
|
}
|
957
1164
|
|
958
1165
|
/* eslint-enable jsdoc/valid-types */
|