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
let addEventListener: ( DomTypes.document, EventTypes.eventType, EventTypes.eventListener<'event>, ~options: EventTypes.addEventListenerOptions=?,) => unitParameters
DomTypes.document EventTypes.eventType EventTypes.eventListener option< EventTypes.addEventListenerOptions >Return type
unitaddEventListenerWithCapture
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
let addEventListenerWithCapture: ( DomTypes.document, EventTypes.eventType, EventTypes.eventListener<'event>,) => unitParameters
DomTypes.document EventTypes.eventType EventTypes.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
let adoptNode: (DomTypes.document, 't) => 'tappend
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
let append: (DomTypes.document, DomTypes.node) => unitParameters
DomTypes.document DomTypes.nodeReturn type
unitappend2
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
let append2: (DomTypes.document, string) => unitParameters
DomTypes.document stringReturn type
unitasEventTarget
let asEventTarget: DomTypes.document => EventTypes.eventTargetParameters
DomTypes.documentReturn type
EventTypes.eventTargetasNode
let asNode: DomTypes.document => DomTypes.nodeParameters
DomTypes.documentReturn type
DomTypes.nodecaretPositionFromPoint
let caretPositionFromPoint: ( DomTypes.document, ~x: float, ~y: float, ~options: DomTypes.caretPositionFromPointOptions=?,) => DomTypes.caretPositionParameters
DomTypes.document float float option< DomTypes.caretPositionFromPointOptions >Return type
DomTypes.caretPositioncloneNode
Returns a copy of node. If deep is true, the copy also includes the node's descendants. Read more on MDN
let cloneNode: (DomTypes.document, ~deep: bool=?) => DomTypes.documentParameters
DomTypes.document option< bool >Return type
DomTypes.documentclose
Closes an output stream and forces the sent data to display. Read more on MDN
let close: DomTypes.document => unitParameters
DomTypes.documentReturn type
unitcompareDocumentPosition
Returns a bitmask indicating the position of other relative to node. Read more on MDN
let compareDocumentPosition: (DomTypes.document, DomTypes.node) => intParameters
DomTypes.document DomTypes.nodeReturn type
intcontains
Returns true if other is an inclusive descendant of node, and false otherwise. Read more on MDN
let contains: (DomTypes.document, DomTypes.node) => boolParameters
DomTypes.document DomTypes.nodeReturn type
boolcreateAttribute
Creates an attribute object with a specified name. @param name String that sets the attribute object's name. Read more on MDN
let createAttribute: (DomTypes.document, string) => DomTypes.attrParameters
DomTypes.document stringReturn type
DomTypes.attrcreateAttributeNS
let createAttributeNS: ( DomTypes.document, ~namespace: string, ~qualifiedName: string,) => DomTypes.attrParameters
DomTypes.document string stringReturn type
DomTypes.attrcreateCDATASection
Returns a CDATASection node whose data is data. Read more on MDN
let createCDATASection: (DomTypes.document, string) => DomTypes.cdataSectionParameters
DomTypes.document stringReturn type
DomTypes.cdataSectioncreateComment
Creates a comment object with the specified data. @param data Sets the comment object's data. Read more on MDN
let createComment: (DomTypes.document, string) => DomTypes.commentParameters
DomTypes.document stringReturn type
DomTypes.commentcreateDocumentFragment
Creates a new document. Read more on MDN
let createDocumentFragment: DomTypes.document => DomTypes.documentFragmentParameters
DomTypes.documentReturn type
DomTypes.documentFragmentcreateElement
Creates an instance of the element for the specified tag. @param tagName The name of an element. Read more on MDN
let createElement: ( DomTypes.document, string, ~options: string=?,) => DomTypes.elementParameters
DomTypes.document string option< string >Return type
DomTypes.elementcreateElement2
Creates an instance of the element for the specified tag. @param tagName The name of an element. Read more on MDN
let createElement2: ( DomTypes.document, ~localName: string, ~options: DomTypes.elementCreationOptions=?,) => DomTypes.elementParameters
DomTypes.document string option< DomTypes.elementCreationOptions >Return type
DomTypes.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
let createElementNS: ( DomTypes.document, ~namespace: string, ~qualifiedName: string, ~options: string=?,) => DomTypes.elementParameters
DomTypes.document string string option< string >Return type
DomTypes.elementcreateElementNS2
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
let createElementNS2: ( DomTypes.document, ~namespace: string, ~qualifiedName: string, ~options: DomTypes.elementCreationOptions=?,) => DomTypes.elementParameters
DomTypes.document string string option< DomTypes.elementCreationOptions >Return type
DomTypes.elementcreateEvent
let createEvent: (DomTypes.document, string) => EventTypes.eventParameters
DomTypes.document stringReturn type
EventTypes.eventcreateExpression
let createExpression: ( DomTypes.document, ~expression: string, ~resolver: DomTypes.xPathNSResolver=?,) => DomTypes.xPathExpressionParameters
DomTypes.document string option< DomTypes.xPathNSResolver >Return type
DomTypes.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
let createNodeIterator: ( DomTypes.document, ~root: DomTypes.node, ~whatToShow: int=?, ~filter: DomTypes.nodeFilter=?,) => DomTypes.nodeIteratorParameters
DomTypes.document DomTypes.node option< int > option< DomTypes.nodeFilter >Return type
DomTypes.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
let createProcessingInstruction: ( DomTypes.document, ~target: string, ~data: string,) => DomTypes.processingInstructionParameters
DomTypes.document string stringReturn type
DomTypes.processingInstructioncreateRange
Returns an empty range object that has both of its boundary points positioned at the beginning of the document. Read more on MDN
let createRange: DomTypes.document => DomTypes.rangeParameters
DomTypes.documentReturn type
DomTypes.rangecreateTextNode
Creates a text string from the specified value. @param data String that specifies the nodeValue property of the text node. Read more on MDN
let createTextNode: (DomTypes.document, string) => DomTypes.textParameters
DomTypes.document stringReturn type
DomTypes.textcreateTreeWalker
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
let createTreeWalker: ( DomTypes.document, ~root: DomTypes.node, ~whatToShow: int=?, ~filter: DomTypes.nodeFilter=?,) => DomTypes.treeWalkerParameters
DomTypes.document DomTypes.node option< int > option< DomTypes.nodeFilter >Return type
DomTypes.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
let dispatchEvent: (DomTypes.document, EventTypes.event) => boolParameters
DomTypes.document EventTypes.eventReturn type
boolevaluate
let evaluate: ( DomTypes.document, ~expression: string, ~contextNode: DomTypes.node, ~resolver: DomTypes.xPathNSResolver=?, ~type_: int=?, ~result: DomTypes.xPathResult=?,) => DomTypes.xPathResultParameters
DomTypes.document string DomTypes.node option< DomTypes.xPathNSResolver > option< int > option< DomTypes.xPathResult >Return type
DomTypes.xPathResultexitFullscreen
Stops document's fullscreen element from being displayed fullscreen and resolves promise when done. Read more on MDN
let exitFullscreen: DomTypes.document => promise<unit>Parameters
DomTypes.documentReturn type
promise< unit >exitPictureInPicture
let exitPictureInPicture: DomTypes.document => promise<unit>Parameters
DomTypes.documentReturn type
promise< unit >exitPointerLock
let exitPointerLock: DomTypes.document => unitParameters
DomTypes.documentReturn type
unitgetAnimations
let getAnimations: DomTypes.document => array<DomTypes.animation>Parameters
DomTypes.documentReturn type
array< DomTypes.animation >getElementById
Returns the first element within node's descendants whose ID is elementId. Read more on MDN
let getElementById: (DomTypes.document, string) => null<DomTypes.element>Parameters
DomTypes.document stringReturn type
Stdlib.null< DomTypes.element >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
let getElementsByClassName: ( DomTypes.document, string,) => DomTypes.htmlCollection<DomTypes.element>Parameters
DomTypes.document stringReturn type
DomTypes.htmlCollection< DomTypes.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
let getElementsByName: ( DomTypes.document, string,) => DomTypes.nodeList<DomTypes.htmlElement>Parameters
DomTypes.document stringReturn type
DomTypes.nodeList< DomTypes.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
let getElementsByTagName: ( DomTypes.document, string,) => DomTypes.htmlCollection<DomTypes.element>Parameters
DomTypes.document stringReturn type
DomTypes.htmlCollection< DomTypes.element >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
let getElementsByTagNameNS: ( DomTypes.document, ~namespace: string, ~localName: string,) => DomTypes.htmlCollection<DomTypes.element>Parameters
DomTypes.document string stringReturn type
DomTypes.htmlCollection< DomTypes.element >getRootNode
Returns node's root. Read more on MDN
let getRootNode: ( DomTypes.document, ~options: DomTypes.getRootNodeOptions=?,) => DomTypes.nodeParameters
DomTypes.document option< DomTypes.getRootNodeOptions >Return type
DomTypes.nodegetSelection
Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. Read more on MDN
let getSelection: DomTypes.document => null<DomTypes.selection>Parameters
DomTypes.documentReturn type
Stdlib.null< DomTypes.selection >hasChildNodes
Returns whether node has children. Read more on MDN
let hasChildNodes: DomTypes.document => boolParameters
DomTypes.documentReturn type
boolhasFocus
Gets a value indicating whether the object currently has focus. Read more on MDN
let hasFocus: DomTypes.document => boolParameters
DomTypes.documentReturn type
boolhasStorageAccess
let hasStorageAccess: DomTypes.document => promise<bool>Parameters
DomTypes.documentReturn type
promise< bool >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
let importNode: (DomTypes.document, 't, ~deep: bool=?) => 'tParameters
DomTypes.documentReturn type
option< bool >insertBefore
let insertBefore: (DomTypes.document, 't, ~child: DomTypes.node) => 'tParameters
DomTypes.documentReturn type
DomTypes.nodeisDefaultNamespace
let isDefaultNamespace: (DomTypes.document, string) => boolParameters
DomTypes.document stringReturn type
boolisEqualNode
Returns whether node and otherNode have the same properties. Read more on MDN
let isEqualNode: (DomTypes.document, DomTypes.node) => boolParameters
DomTypes.document DomTypes.nodeReturn type
boolisInstanceOf
let isInstanceOf: 't => boolisSameNode
let isSameNode: (DomTypes.document, DomTypes.node) => boolParameters
DomTypes.document DomTypes.nodeReturn type
boollookupNamespaceURI
let lookupNamespaceURI: (DomTypes.document, string) => stringParameters
DomTypes.document stringReturn type
stringlookupPrefix
let lookupPrefix: (DomTypes.document, string) => stringParameters
DomTypes.document stringReturn type
stringmake
let make: unit => DomTypes.documentParameters
unitReturn type
DomTypes.documentnormalize
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
let normalize: DomTypes.document => unitParameters
DomTypes.documentReturn type
unitopen_
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
let open_: ( DomTypes.document, ~unused1: string=?, ~unused2: string=?,) => DomTypes.documentParameters
DomTypes.document option< string > option< string >Return type
DomTypes.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
let open2: ( DomTypes.document, ~url: string, ~name: string, ~features: string,) => DomTypes.windowParameters
DomTypes.document string string stringReturn type
DomTypes.windowparseHTMLUnsafe
let parseHTMLUnsafe: string => DomTypes.documentParameters
stringReturn type
DomTypes.documentprepend
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
let prepend: (DomTypes.document, DomTypes.node) => unitParameters
DomTypes.document DomTypes.nodeReturn type
unitprepend2
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
let prepend2: (DomTypes.document, string) => unitParameters
DomTypes.document stringReturn type
unitquerySelector
Returns the first element that is a descendant of node that matches selectors. Read more on MDN
let querySelector: (DomTypes.document, string) => Null.t<DomTypes.element>Parameters
DomTypes.document stringReturn type
Stdlib.Null.t< DomTypes.element >querySelectorAll
Returns all element descendants of node that match selectors. Read more on MDN
let querySelectorAll: ( DomTypes.document, string,) => DomTypes.nodeList<DomTypes.element>Parameters
DomTypes.document stringReturn type
DomTypes.nodeList< DomTypes.element >removeEventListener
Removes the event listener in target's event listener list with the same type, callback, and options. Read more on MDN
let removeEventListener: ( DomTypes.document, EventTypes.eventType, EventTypes.eventListener<'event>, ~options: EventTypes.eventListenerOptions=?,) => unitParameters
DomTypes.document EventTypes.eventType EventTypes.eventListener option< EventTypes.eventListenerOptions >Return type
unitremoveEventListenerUseCapture
Removes the event listener in target's event listener list with the same type, callback, and options. Read more on MDN
let removeEventListenerUseCapture: ( DomTypes.document, EventTypes.eventType, EventTypes.eventListener<'event>,) => unitParameters
DomTypes.document EventTypes.eventType EventTypes.eventListenerReturn type
unitreplaceChild
let replaceChild: (DomTypes.document, ~node: DomTypes.node, 't) => 'tParameters
DomTypes.documentReturn type
DomTypes.nodereplaceChildren
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
let replaceChildren: (DomTypes.document, DomTypes.node) => unitParameters
DomTypes.document DomTypes.nodeReturn type
unitreplaceChildren2
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
let replaceChildren2: (DomTypes.document, string) => unitParameters
DomTypes.document stringReturn type
unitrequestStorageAccess
let requestStorageAccess: DomTypes.document => promise<unit>Parameters
DomTypes.documentReturn type
promise< unit >startViewTransition
let startViewTransition: ( DomTypes.document, ~callbackOptions: ViewTransitionsTypes.viewTransitionUpdateCallback=?,) => ViewTransitionsTypes.viewTransitionParameters
DomTypes.document option< ViewTransitionsTypes.viewTransitionUpdateCallback >Return type
ViewTransitionsTypes.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
let write: (DomTypes.document, string) => unitParameters
DomTypes.document stringReturn type
unitwriteln
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
let writeln: (DomTypes.document, string) => unit