Node
Types
getRootNodeOptions
type getRootNodeOptions = {mutable composed?: bool}Record fields
composed
t
type t = WebAPI.DOMTree.node = { nodeType: int, nodeName: string, baseURI: string, isConnected: bool, ownerDocument: Null.t<WebAPI.DOM.document>, parentNode: Null.t<WebAPI.DOMTree.node>, parentElement: Null.t<WebAPI.DOMTree.element>, childNodes: WebAPI.DOM.nodeList<WebAPI.DOMTree.node>, firstChild: Null.t<WebAPI.DOMTree.node>, lastChild: Null.t<WebAPI.DOMTree.node>, previousSibling: Null.t<WebAPI.DOMTree.node>, nextSibling: Null.t<WebAPI.DOMTree.node>, mutable nodeValue: Null.t<string>, mutable textContent: Null.t<string>,}Record fields
ownerDocument
Returns the node document. Returns null for documents. Read more on MDN
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: ( t, WebAPI.EventType.t, WebAPI.DOM.EventListener.t<'event>, ~options: WebAPI.DOM.EventListener.addEventListenerOptions=?,) => unitParameters
tWebAPI.EventType.tWebAPI.DOM.EventListener.toption<WebAPI.DOM.EventListener.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: ( t, WebAPI.EventType.t, WebAPI.DOM.EventListener.t<'event>,) => unitasEventTarget
let asEventTarget: t => WebAPI.DOM.eventTargetcloneNode
Returns a copy of node. If deep is true, the copy also includes the node's descendants. Read more on MDN
let cloneNode: (t, ~deep: bool=?) => tcompareDocumentPosition
Returns a bitmask indicating the position of other relative to node. Read more on MDN
let compareDocumentPosition: (t, WebAPI.DOMTree.node) => intcontains
Returns true if other is an inclusive descendant of node, and false otherwise. Read more on MDN
let contains: (t, WebAPI.DOMTree.node) => booldispatchEvent
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: (t, WebAPI.DOM.event) => boolgetRootNode
Returns node's root. Read more on MDN
let getRootNode: (t, ~options: getRootNodeOptions=?) => WebAPI.DOMTree.nodeinsertBefore
let insertBefore: (t, 't, ~child: WebAPI.DOMTree.node) => 'tisDefaultNamespace
let isDefaultNamespace: (t, string) => boolisEqualNode
Returns whether node and otherNode have the same properties. Read more on MDN
let isEqualNode: (t, WebAPI.DOMTree.node) => boolisSameNode
let isSameNode: (t, WebAPI.DOMTree.node) => boollookupNamespaceURI
let lookupNamespaceURI: (t, string) => Null.t<string>lookupPrefix
let lookupPrefix: (t, string) => Null.t<string>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
let normalize: t => unitremoveEventListener
Removes the event listener in target's event listener list with the same type, callback, and options. Read more on MDN
let removeEventListener: ( t, WebAPI.EventType.t, WebAPI.DOM.EventListener.t<'event>, ~options: WebAPI.DOM.EventListener.options=?,) => unitParameters
tWebAPI.EventType.tWebAPI.DOM.EventListener.toption<WebAPI.DOM.EventListener.options>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: ( t, WebAPI.EventType.t, WebAPI.DOM.EventListener.t<'event>,) => unitreplaceChild
let replaceChild: (t, ~node: WebAPI.DOMTree.node, 't) => 't