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: ( WebAPI.DOMAPI.document, WebAPI.EventAPI.eventType, WebAPI.EventAPI.eventListener<'event>, ~options: WebAPI.EventAPI.addEventListenerOptions=?,) => unitParameters
WebAPI.DOMAPI.document WebAPI.EventAPI.eventType WebAPI.EventAPI.eventListener option< WebAPI.EventAPI.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: ( WebAPI.DOMAPI.document, WebAPI.EventAPI.eventType, WebAPI.EventAPI.eventListener<'event>,) => unitParameters
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
let adoptNode: (WebAPI.DOMAPI.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: (WebAPI.DOMAPI.document, WebAPI.DOMAPI.node) => 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: (WebAPI.DOMAPI.document, string) => unitasEventTarget
let asEventTarget: WebAPI.DOMAPI.document => WebAPI.EventAPI.eventTargetasNode
let asNode: WebAPI.DOMAPI.document => WebAPI.DOMAPI.nodecaretPositionFromPoint
let caretPositionFromPoint: ( WebAPI.DOMAPI.document, ~x: float, ~y: float, ~options: WebAPI.DOMAPI.caretPositionFromPointOptions=?,) => WebAPI.DOMAPI.caretPositionParameters
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
let cloneNode: ( WebAPI.DOMAPI.document, ~deep: bool=?,) => WebAPI.DOMAPI.documentclose
Closes an output stream and forces the sent data to display. Read more on MDN
let close: WebAPI.DOMAPI.document => unitcompareDocumentPosition
Returns a bitmask indicating the position of other relative to node. Read more on MDN
let compareDocumentPosition: (WebAPI.DOMAPI.document, WebAPI.DOMAPI.node) => intcontains
Returns true if other is an inclusive descendant of node, and false otherwise. Read more on MDN
let contains: (WebAPI.DOMAPI.document, WebAPI.DOMAPI.node) => 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: (WebAPI.DOMAPI.document, string) => WebAPI.DOMAPI.attrcreateAttributeNS
let createAttributeNS: ( WebAPI.DOMAPI.document, ~namespace: string, ~qualifiedName: string,) => WebAPI.DOMAPI.attrcreateCDATASection
Returns a CDATASection node whose data is data. Read more on MDN
let createCDATASection: ( WebAPI.DOMAPI.document, string,) => WebAPI.DOMAPI.cdataSectioncreateComment
Creates a comment object with the specified data. @param data Sets the comment object's data. Read more on MDN
let createComment: (WebAPI.DOMAPI.document, string) => WebAPI.DOMAPI.commentcreateDocumentFragment
Creates a new document. Read more on MDN
let createDocumentFragment: WebAPI.DOMAPI.document => WebAPI.DOMAPI.documentFragmentcreateElement
Creates an instance of the element for the specified tag. @param tagName The name of an element. Read more on MDN
let createElement: ( WebAPI.DOMAPI.document, string, ~options: string=?,) => WebAPI.DOMAPI.elementcreateElement2
Creates an instance of the element for the specified tag. @param tagName The name of an element. Read more on MDN
let createElement2: ( WebAPI.DOMAPI.document, ~localName: string, ~options: WebAPI.DOMAPI.elementCreationOptions=?,) => WebAPI.DOMAPI.elementParameters
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
let createElementNS: ( WebAPI.DOMAPI.document, ~namespace: string, ~qualifiedName: string, ~options: string=?,) => WebAPI.DOMAPI.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: ( WebAPI.DOMAPI.document, ~namespace: string, ~qualifiedName: string, ~options: WebAPI.DOMAPI.elementCreationOptions=?,) => WebAPI.DOMAPI.elementParameters
WebAPI.DOMAPI.document string string option< WebAPI.DOMAPI.elementCreationOptions >Return type
WebAPI.DOMAPI.elementcreateEvent
let createEvent: (WebAPI.DOMAPI.document, string) => WebAPI.EventAPI.eventcreateExpression
let createExpression: ( WebAPI.DOMAPI.document, ~expression: string, ~resolver: WebAPI.DOMAPI.xPathNSResolver=?,) => WebAPI.DOMAPI.xPathExpressionParameters
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
let createNodeIterator: ( WebAPI.DOMAPI.document, ~root: WebAPI.DOMAPI.node, ~whatToShow: int=?, ~filter: WebAPI.DOMAPI.nodeFilter=?,) => WebAPI.DOMAPI.nodeIteratorParameters
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
let createProcessingInstruction: ( WebAPI.DOMAPI.document, ~target: string, ~data: string,) => WebAPI.DOMAPI.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: WebAPI.DOMAPI.document => WebAPI.DOMAPI.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: (WebAPI.DOMAPI.document, string) => WebAPI.DOMAPI.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: ( WebAPI.DOMAPI.document, ~root: WebAPI.DOMAPI.node, ~whatToShow: int=?, ~filter: WebAPI.DOMAPI.nodeFilter=?,) => WebAPI.DOMAPI.treeWalkerParameters
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
let dispatchEvent: (WebAPI.DOMAPI.document, WebAPI.EventAPI.event) => boolevaluate
let evaluate: ( WebAPI.DOMAPI.document, ~expression: string, ~contextNode: WebAPI.DOMAPI.node, ~resolver: WebAPI.DOMAPI.xPathNSResolver=?, ~type_: int=?, ~result: WebAPI.DOMAPI.xPathResult=?,) => WebAPI.DOMAPI.xPathResultParameters
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
let exitFullscreen: WebAPI.DOMAPI.document => promise<unit>exitPictureInPicture
let exitPictureInPicture: WebAPI.DOMAPI.document => promise<unit>exitPointerLock
let exitPointerLock: WebAPI.DOMAPI.document => unitgetAnimations
let getAnimations: WebAPI.DOMAPI.document => array<WebAPI.DOMAPI.animation>getElementById
Returns the first element within node's descendants whose ID is elementId. Read more on MDN
let getElementById: (WebAPI.DOMAPI.document, string) => WebAPI.DOMAPI.elementgetElementsByClassName
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: ( WebAPI.DOMAPI.document, string,) => WebAPI.DOMAPI.htmlCollectionOf<WebAPI.DOMAPI.element>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
let getElementsByName: ( WebAPI.DOMAPI.document, string,) => WebAPI.DOMAPI.nodeListOf<WebAPI.DOMAPI.htmlElement>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
let getElementsByTagName: ( WebAPI.DOMAPI.document, string,) => WebAPI.DOMAPI.htmlCollectiongetElementsByTagNameNS
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: ( WebAPI.DOMAPI.document, ~namespace: string, ~localName: string,) => WebAPI.DOMAPI.htmlCollectionOf<WebAPI.DOMAPI.element>Parameters
WebAPI.DOMAPI.document string stringReturn type
WebAPI.DOMAPI.htmlCollectionOf< WebAPI.DOMAPI.element >getRootNode
Returns node's root. Read more on MDN
let getRootNode: ( WebAPI.DOMAPI.document, ~options: WebAPI.DOMAPI.getRootNodeOptions=?,) => WebAPI.DOMAPI.nodeParameters
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
let getSelection: WebAPI.DOMAPI.document => WebAPI.DOMAPI.selectionhasChildNodes
Returns whether node has children. Read more on MDN
let hasChildNodes: WebAPI.DOMAPI.document => boolhasFocus
Gets a value indicating whether the object currently has focus. Read more on MDN
let hasFocus: WebAPI.DOMAPI.document => boolhasStorageAccess
let hasStorageAccess: WebAPI.DOMAPI.document => 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: (WebAPI.DOMAPI.document, 't, ~deep: bool=?) => 'tinsertBefore
let insertBefore: ( WebAPI.DOMAPI.document, 't, ~child: WebAPI.DOMAPI.node,) => 'tisDefaultNamespace
let isDefaultNamespace: (WebAPI.DOMAPI.document, string) => boolisEqualNode
Returns whether node and otherNode have the same properties. Read more on MDN
let isEqualNode: (WebAPI.DOMAPI.document, WebAPI.DOMAPI.node) => boolisInstanceOf
let isInstanceOf: 't => boolisSameNode
let isSameNode: (WebAPI.DOMAPI.document, WebAPI.DOMAPI.node) => boollookupNamespaceURI
let lookupNamespaceURI: (WebAPI.DOMAPI.document, string) => stringlookupPrefix
let lookupPrefix: (WebAPI.DOMAPI.document, string) => stringmake
let make: unit => WebAPI.DOMAPI.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: WebAPI.DOMAPI.document => 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_: ( WebAPI.DOMAPI.document, ~unused1: string=?, ~unused2: string=?,) => WebAPI.DOMAPI.documentParameters
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
let open2: ( WebAPI.DOMAPI.document, ~url: string, ~name: string, ~features: string,) => WebAPI.DOMAPI.windowparseHTMLUnsafe
let parseHTMLUnsafe: string => WebAPI.DOMAPI.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: (WebAPI.DOMAPI.document, WebAPI.DOMAPI.node) => 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: (WebAPI.DOMAPI.document, string) => unitquerySelector
Returns the first element that is a descendant of node that matches selectors. Read more on MDN
let querySelector: ( WebAPI.DOMAPI.document, string,) => Null.t<WebAPI.DOMAPI.element>querySelectorAll
Returns all element descendants of node that match selectors. Read more on MDN
let querySelectorAll: (WebAPI.DOMAPI.document, string) => WebAPI.DOMAPI.nodeListremoveEventListener
Removes the event listener in target's event listener list with the same type, callback, and options. Read more on MDN
let removeEventListener: ( WebAPI.DOMAPI.document, WebAPI.EventAPI.eventType, WebAPI.EventAPI.eventListener<'event>, ~options: WebAPI.EventAPI.eventListenerOptions=?,) => unitParameters
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
let removeEventListener_useCapture: ( WebAPI.DOMAPI.document, WebAPI.EventAPI.eventType, WebAPI.EventAPI.eventListener<'event>,) => unitParameters
WebAPI.DOMAPI.document WebAPI.EventAPI.eventType WebAPI.EventAPI.eventListenerReturn type
unitreplaceChild
let replaceChild: ( WebAPI.DOMAPI.document, ~node: WebAPI.DOMAPI.node, 't,) => 'treplaceChildren
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: (WebAPI.DOMAPI.document, WebAPI.DOMAPI.node) => 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: (WebAPI.DOMAPI.document, string) => unitrequestStorageAccess
let requestStorageAccess: WebAPI.DOMAPI.document => promise<unit>startViewTransition
let startViewTransition: ( WebAPI.DOMAPI.document, ~callbackOptions: WebAPI.ViewTransitionsAPI.viewTransitionUpdateCallback=?,) => WebAPI.ViewTransitionsAPI.viewTransitionParameters
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
let write: (WebAPI.DOMAPI.document, string) => 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: (WebAPI.DOMAPI.document, string) => unit