Document
Values
addEventListener
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture. Read more on MDN
Parameters
WebAPI.DOMAPI.document WebAPI.EventAPI.eventType WebAPI.EventAPI.eventListener option< WebAPI.EventAPI.addEventListenerOptions >Return type
unitaddEventListener_useCapture
Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture.
When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET.
When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners.
When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed.
If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted.
The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture. Read more on MDN
Parameters
WebAPI.DOMAPI.document WebAPI.EventAPI.eventType WebAPI.EventAPI.eventListenerReturn type
unitadoptNode
Moves node from another document and returns it.
If node is a document, throws a "NotSupportedError" DOMException or, if node is a shadow root, throws a "HierarchyRequestError" DOMException. Read more on MDN
append
Inserts nodes after the last child of node, while replacing strings in nodes with equivalent Text nodes.
Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. Read more on MDN
append2
Inserts nodes after the last child of node, while replacing strings in nodes with equivalent Text nodes.
Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. Read more on MDN
appendChild
asEventTarget
asNode
caretPositionFromPoint
Parameters
WebAPI.DOMAPI.document float float option< WebAPI.DOMAPI.caretPositionFromPointOptions >Return type
WebAPI.DOMAPI.caretPositioncloneNode
Returns a copy of node. If deep is true, the copy also includes the node's descendants. Read more on MDN
close
Closes an output stream and forces the sent data to display. Read more on MDN
compareDocumentPosition
Returns a bitmask indicating the position of other relative to node. Read more on MDN
contains
Returns true if other is an inclusive descendant of node, and false otherwise. Read more on MDN
createAttribute
Creates an attribute object with a specified name. @param name String that sets the attribute object's name. Read more on MDN
createAttributeNS
createCDATASection
Returns a CDATASection node whose data is data. Read more on MDN
createComment
Creates a comment object with the specified data. @param data Sets the comment object's data. Read more on MDN
createDocumentFragment
Creates a new document. Read more on MDN
createElement
Creates an instance of the element for the specified tag. @param tagName The name of an element. Read more on MDN
createElement2
Creates an instance of the element for the specified tag. @param tagName The name of an element. Read more on MDN
Parameters
WebAPI.DOMAPI.document string option< WebAPI.DOMAPI.elementCreationOptions >Return type
WebAPI.DOMAPI.elementcreateElementNS
Returns an element with namespace namespace. Its namespace prefix will be everything before ":" (U+003E) in qualifiedName or null. Its local name will be everything after ":" (U+003E) in qualifiedName or qualifiedName.
If localName does not match the Name production an "InvalidCharacterError" DOMException will be thrown.
If one of the following conditions is true a "NamespaceError" DOMException will be thrown:
localName does not match the QName production. Namespace prefix is not null and namespace is the empty string. Namespace prefix is "xml" and namespace is not the XML namespace. qualifiedName or namespace prefix is "xmlns" and namespace is not the XMLNS namespace. namespace is the XMLNS namespace and neither qualifiedName nor namespace prefix is "xmlns".
When supplied, options's is can be used to create a customized built-in element. Read more on MDN
createElementNS2
Returns an element with namespace namespace. Its namespace prefix will be everything before ":" (U+003E) in qualifiedName or null. Its local name will be everything after ":" (U+003E) in qualifiedName or qualifiedName.
If localName does not match the Name production an "InvalidCharacterError" DOMException will be thrown.
If one of the following conditions is true a "NamespaceError" DOMException will be thrown:
localName does not match the QName production. Namespace prefix is not null and namespace is the empty string. Namespace prefix is "xml" and namespace is not the XML namespace. qualifiedName or namespace prefix is "xmlns" and namespace is not the XMLNS namespace. namespace is the XMLNS namespace and neither qualifiedName nor namespace prefix is "xmlns".
When supplied, options's is can be used to create a customized built-in element. Read more on MDN
Parameters
WebAPI.DOMAPI.document string string option< WebAPI.DOMAPI.elementCreationOptions >Return type
WebAPI.DOMAPI.elementcreateEvent
createExpression
Parameters
WebAPI.DOMAPI.document string option< WebAPI.DOMAPI.xPathNSResolver >Return type
WebAPI.DOMAPI.xPathExpressioncreateNodeIterator
Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. @param root The root element or node to start traversing on. @param whatToShow The type of nodes or elements to appear in the node list @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. Read more on MDN
Parameters
WebAPI.DOMAPI.document WebAPI.DOMAPI.node option< int > option< WebAPI.DOMAPI.nodeFilter >Return type
WebAPI.DOMAPI.nodeIteratorcreateProcessingInstruction
Returns a ProcessingInstruction node whose target is target and data is data. If target does not match the Name production an "InvalidCharacterError" DOMException will be thrown. If data contains "?>" an "InvalidCharacterError" DOMException will be thrown. Read more on MDN
createRange
Returns an empty range object that has both of its boundary points positioned at the beginning of the document. Read more on MDN
createTextNode
Creates a text string from the specified value. @param data String that specifies the nodeValue property of the text node. Read more on MDN
createTreeWalker
Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. @param root The root element or node to start traversing on. @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. @param filter A custom NodeFilter function to use. Read more on MDN
Parameters
WebAPI.DOMAPI.document WebAPI.DOMAPI.node option< int > option< WebAPI.DOMAPI.nodeFilter >Return type
WebAPI.DOMAPI.treeWalkerdispatchEvent
Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. Read more on MDN
evaluate
Parameters
WebAPI.DOMAPI.document string WebAPI.DOMAPI.node option< WebAPI.DOMAPI.xPathNSResolver > option< int > option< WebAPI.DOMAPI.xPathResult >Return type
WebAPI.DOMAPI.xPathResultexitFullscreen
Stops document's fullscreen element from being displayed fullscreen and resolves promise when done. Read more on MDN
exitPictureInPicture
getAnimations
getElementById
Returns the first element within node's descendants whose ID is elementId. Read more on MDN
getElementsByClassName
Returns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes. Read more on MDN
Parameters
WebAPI.DOMAPI.document stringReturn type
WebAPI.DOMAPI.htmlCollectionOf< WebAPI.DOMAPI.element >getElementsByName
Gets a collection of objects based on the value of the NAME or ID attribute. @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. Read more on MDN
Parameters
WebAPI.DOMAPI.document stringReturn type
WebAPI.DOMAPI.nodeListOf< WebAPI.DOMAPI.htmlElement >getElementsByTagName
Retrieves a collection of objects based on the specified element name. @param name Specifies the name of an element. Read more on MDN
getElementsByTagNameNS
If namespace and localName are "*" returns a HTMLCollection of all descendant elements.
If only namespace is "*" returns a HTMLCollection of all descendant elements whose local name is localName.
If only localName is "*" returns a HTMLCollection of all descendant elements whose namespace is namespace.
Otherwise, returns a HTMLCollection of all descendant elements whose namespace is namespace and local name is localName. Read more on MDN
Parameters
WebAPI.DOMAPI.document string stringReturn type
WebAPI.DOMAPI.htmlCollectionOf< WebAPI.DOMAPI.element >getRootNode
Returns node's root. Read more on MDN
Parameters
WebAPI.DOMAPI.document option< WebAPI.DOMAPI.getRootNodeOptions >Return type
WebAPI.DOMAPI.nodegetSelection
Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. Read more on MDN
hasChildNodes
Returns whether node has children. Read more on MDN
hasFocus
Gets a value indicating whether the object currently has focus. Read more on MDN
importNode
Returns a copy of node. If deep is true, the copy also includes the node's descendants.
If node is a document or a shadow root, throws a "NotSupportedError" DOMException. Read more on MDN
isEqualNode
Returns whether node and otherNode have the same properties. Read more on MDN
normalize
Removes empty exclusive Text nodes and concatenates the data of remaining contiguous exclusive Text nodes into the first of their nodes. Read more on MDN
open_
Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. @param url Specifies a MIME type for the document. @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. @param replace Specifies whether the existing entry for the document is replaced in the history list. Read more on MDN
Parameters
WebAPI.DOMAPI.document option< string > option< string >Return type
WebAPI.DOMAPI.documentopen2
Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. @param url Specifies a MIME type for the document. @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. @param replace Specifies whether the existing entry for the document is replaced in the history list. Read more on MDN
prepend
Inserts nodes before the first child of node, while replacing strings in nodes with equivalent Text nodes.
Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. Read more on MDN
prepend2
Inserts nodes before the first child of node, while replacing strings in nodes with equivalent Text nodes.
Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. Read more on MDN
querySelector
Returns the first element that is a descendant of node that matches selectors. Read more on MDN
querySelectorAll
Returns all element descendants of node that match selectors. Read more on MDN
removeChild
removeEventListener
Removes the event listener in target's event listener list with the same type, callback, and options. Read more on MDN
Parameters
WebAPI.DOMAPI.document WebAPI.EventAPI.eventType WebAPI.EventAPI.eventListener option< WebAPI.EventAPI.eventListenerOptions >Return type
unitremoveEventListener_useCapture
Removes the event listener in target's event listener list with the same type, callback, and options. Read more on MDN
Parameters
WebAPI.DOMAPI.document WebAPI.EventAPI.eventType WebAPI.EventAPI.eventListenerReturn type
unitreplaceChildren
Replace all children of node with nodes, while replacing strings in nodes with equivalent Text nodes.
Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. Read more on MDN
replaceChildren2
Replace all children of node with nodes, while replacing strings in nodes with equivalent Text nodes.
Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. Read more on MDN
requestStorageAccess
startViewTransition
Parameters
WebAPI.DOMAPI.document option< WebAPI.ViewTransitionsAPI.viewTransitionUpdateCallback >Return type
WebAPI.ViewTransitionsAPI.viewTransitionwrite
Writes one or more HTML expressions to a document in the specified window. @param content Specifies the text and HTML tags to write. Read more on MDN
writeln
Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. @param content The text and HTML tags to write. Read more on MDN