DOMTree
Types
customStateSet
type customStateSet = {}documentFragment
A minimal document object that has no parent. It is used as a lightweight version of Document that stores a segment of a document structure comprised of nodes just like a standard document. The key difference is that because the document fragment isn't part of the active document tree structure, changes made to the fragment don't affect the document, cause reflow, or incur any performance impact that can occur when changes are made. See DocumentFragment on MDN TODO: mark as private once mutating fields of private records is allowed
type documentFragment = { nodeType: int, nodeName: string, baseURI: string, isConnected: bool, ownerDocument: Null.t<WebAPI.DOM.document>, parentNode: Null.t<node>, parentElement: Null.t<htmlElement>, childNodes: WebAPI.DOM.nodeList<node>, firstChild: Null.t<node>, lastChild: Null.t<node>, previousSibling: Null.t<node>, nextSibling: Null.t<node>, mutable nodeValue: Null.t<string>, mutable textContent: Null.t<string>, children: WebAPI.HTMLCollection.t<element>, firstElementChild: Null.t<element>, lastElementChild: Null.t<element>, childElementCount: int,}Record fields
ownerDocument
Returns the node document. Returns null for documents. Read more on MDN
firstElementChild
Returns the first child that is an element, and null otherwise. Read more on MDN
lastElementChild
Returns the last child that is an element, and null otherwise. Read more on MDN
element
Element is the most general base class from which all objects in a Document inherit. It only has methods and properties common to all kinds of elements. More specific classes inherit from Element. See Element on MDN TODO: mark as private once mutating fields of private records is allowed
type element = { nodeType: int, nodeName: string, baseURI: string, isConnected: bool, ownerDocument: Null.t<WebAPI.DOM.document>, parentNode: Null.t<node>, parentElement: Null.t<element>, childNodes: WebAPI.DOM.nodeList<node>, firstChild: Null.t<node>, lastChild: Null.t<node>, previousSibling: Null.t<node>, nextSibling: Null.t<node>, mutable nodeValue: Null.t<string>, mutable textContent: Null.t<string>, namespaceURI: Null.t<string>, prefix: Null.t<string>, localName: string, tagName: string, mutable id: string, mutable className: string, classList: WebAPI.DOM.domTokenList, mutable slot: string, attributes: WebAPI.DOM.namedNodeMap, shadowRoot: Null.t<shadowRoot>, part: WebAPI.DOM.domTokenList, mutable scrollTop: float, mutable scrollLeft: float, scrollWidth: int, scrollHeight: int, clientTop: int, clientLeft: int, clientWidth: int, clientHeight: int, currentCSSZoom: float, mutable innerHTML: string, mutable outerHTML: string, children: WebAPI.HTMLCollection.t<element>, firstElementChild: Null.t<element>, lastElementChild: Null.t<element>, childElementCount: int, previousElementSibling: Null.t<element>, nextElementSibling: Null.t<element>, assignedSlot: Null.t<htmlSlotElement>, mutable ariaAtomic: Null.t<string>, mutable ariaAutoComplete: Null.t<string>, mutable ariaBrailleLabel: Null.t<string>, mutable ariaBrailleRoleDescription: Null.t<string>, mutable ariaBusy: Null.t<string>, mutable ariaChecked: Null.t<string>, mutable ariaColCount: Null.t<string>, mutable ariaColIndex: Null.t<string>, mutable ariaColIndexText: Null.t<string>, mutable ariaColSpan: Null.t<string>, mutable ariaCurrent: Null.t<string>, mutable ariaDescription: Null.t<string>, mutable ariaDisabled: Null.t<string>, mutable ariaExpanded: Null.t<string>, mutable ariaHasPopup: Null.t<string>, mutable ariaHidden: Null.t<string>, mutable ariaKeyShortcuts: Null.t<string>, mutable ariaLabel: Null.t<string>, mutable ariaLevel: Null.t<string>, mutable ariaLive: Null.t<string>, mutable ariaModal: Null.t<string>, mutable ariaMultiLine: Null.t<string>, mutable ariaMultiSelectable: Null.t<string>, mutable ariaOrientation: Null.t<string>, mutable ariaPlaceholder: Null.t<string>, mutable ariaPosInSet: Null.t<string>, mutable ariaPressed: Null.t<string>, mutable ariaReadOnly: Null.t<string>, mutable ariaRequired: Null.t<string>, mutable ariaRoleDescription: Null.t<string>, mutable ariaRowCount: Null.t<string>, mutable ariaRowIndex: Null.t<string>, mutable ariaRowIndexText: Null.t<string>, mutable ariaRowSpan: Null.t<string>, mutable ariaSelected: Null.t<string>, mutable ariaSetSize: Null.t<string>, mutable ariaSort: Null.t<string>, mutable ariaValueMax: Null.t<string>, mutable ariaValueMin: Null.t<string>, mutable ariaValueNow: Null.t<string>, mutable ariaValueText: Null.t<string>,}Record fields
ownerDocument
Returns the node document. Returns null for documents. Read more on MDN
id
Returns the value of element's id content attribute. Can be set to change it. Read more on MDN
className
Returns the value of element's class content attribute. Can be set to change it. Read more on MDN
classList
Allows for manipulation of element's class content attribute as a set of whitespace-separated tokens through a DOMTokenList object. Read more on MDN
slot
Returns the value of element's slot content attribute. Can be set to change it. Read more on MDN
shadowRoot
Returns element's shadow root, if any, and if shadow root's mode is "open", and null otherwise. Read more on MDN
firstElementChild
Returns the first child that is an element, and null otherwise. Read more on MDN
lastElementChild
Returns the last child that is an element, and null otherwise. Read more on MDN
previousElementSibling
Returns the first preceding sibling that is an element, and null otherwise. Read more on MDN
nextElementSibling
Returns the first following sibling that is an element, and null otherwise. Read more on MDN
elementInternals
type elementInternals = { shadowRoot: Null.t<shadowRoot>, form: Null.t<htmlFormElement>, willValidate: bool, validity: WebAPI.DOM.validityState, validationMessage: string, labels: WebAPI.DOM.nodeList<unknown>, states: customStateSet, mutable ariaAtomic: Null.t<string>, mutable ariaAutoComplete: Null.t<string>, mutable ariaBrailleLabel: Null.t<string>, mutable ariaBrailleRoleDescription: Null.t<string>, mutable ariaBusy: Null.t<string>, mutable ariaChecked: Null.t<string>, mutable ariaColCount: Null.t<string>, mutable ariaColIndex: Null.t<string>, mutable ariaColIndexText: Null.t<string>, mutable ariaColSpan: Null.t<string>, mutable ariaCurrent: Null.t<string>, mutable ariaDescription: Null.t<string>, mutable ariaDisabled: Null.t<string>, mutable ariaExpanded: Null.t<string>, mutable ariaHasPopup: Null.t<string>, mutable ariaHidden: Null.t<string>, mutable ariaKeyShortcuts: Null.t<string>, mutable ariaLabel: Null.t<string>, mutable ariaLevel: Null.t<string>, mutable ariaLive: Null.t<string>, mutable ariaModal: Null.t<string>, mutable ariaMultiLine: Null.t<string>, mutable ariaMultiSelectable: Null.t<string>, mutable ariaOrientation: Null.t<string>, mutable ariaPlaceholder: Null.t<string>, mutable ariaPosInSet: Null.t<string>, mutable ariaPressed: Null.t<string>, mutable ariaReadOnly: Null.t<string>, mutable ariaRequired: Null.t<string>, mutable ariaRoleDescription: Null.t<string>, mutable ariaRowCount: Null.t<string>, mutable ariaRowIndex: Null.t<string>, mutable ariaRowIndexText: Null.t<string>, mutable ariaRowSpan: Null.t<string>, mutable ariaSelected: Null.t<string>, mutable ariaSetSize: Null.t<string>, mutable ariaSort: Null.t<string>, mutable ariaValueMax: Null.t<string>, mutable ariaValueMin: Null.t<string>, mutable ariaValueNow: Null.t<string>, mutable ariaValueText: Null.t<string>,}Record fields
shadowRoot
form
willValidate
validity
validationMessage
labels
states
ariaAtomic
ariaAutoComplete
ariaBrailleLabel
ariaBrailleRoleDescription
ariaBusy
ariaChecked
ariaColCount
ariaColIndex
ariaColIndexText
ariaColSpan
ariaCurrent
ariaDescription
ariaDisabled
ariaExpanded
ariaHasPopup
ariaHidden
ariaKeyShortcuts
ariaLabel
ariaLevel
ariaLive
ariaModal
ariaMultiLine
ariaMultiSelectable
ariaOrientation
ariaPlaceholder
ariaPosInSet
ariaPressed
ariaReadOnly
ariaRequired
ariaRoleDescription
ariaRowCount
ariaRowIndex
ariaRowIndexText
ariaRowSpan
ariaSelected
ariaSetSize
ariaSort
ariaValueMax
ariaValueMin
ariaValueNow
ariaValueText
htmlElement
Any HTML element. Some elements directly implement this interface, while others implement it via an interface that inherits it. See HTMLElement on MDN TODO: mark as private once mutating fields of private records is allowed
type htmlElement = { namespaceURI: Null.t<string>, prefix: Null.t<string>, localName: string, tagName: string, mutable id: string, mutable className: string, classList: WebAPI.DOM.domTokenList, mutable slot: string, attributes: WebAPI.DOM.namedNodeMap, shadowRoot: Null.t<shadowRoot>, part: WebAPI.DOM.domTokenList, mutable scrollTop: float, mutable scrollLeft: float, scrollWidth: int, scrollHeight: int, clientTop: int, clientLeft: int, clientWidth: int, clientHeight: int, currentCSSZoom: float, mutable innerHTML: string, mutable outerHTML: string, nodeType: int, nodeName: string, baseURI: string, isConnected: bool, ownerDocument: Null.t<WebAPI.DOM.document>, parentNode: Null.t<node>, parentElement: Null.t<htmlElement>, childNodes: WebAPI.DOM.nodeList<node>, firstChild: Null.t<node>, lastChild: Null.t<node>, previousSibling: Null.t<node>, nextSibling: Null.t<node>, mutable nodeValue: Null.t<string>, mutable textContent: Null.t<string>, mutable title: string, mutable lang: string, mutable translate: bool, mutable dir: string, mutable inert: bool, mutable accessKey: string, accessKeyLabel: string, mutable draggable: bool, mutable spellcheck: bool, mutable autocapitalize: string, mutable innerText: string, mutable outerText: string, mutable popover: Null.t<string>, offsetParent: Null.t<element>, offsetTop: int, offsetLeft: int, offsetWidth: int, offsetHeight: int, style: WebAPI.CSSStyleDeclaration.t, attributeStyleMap: WebAPI.StylePropertyMap.t, mutable contentEditable: string, mutable enterKeyHint: string, isContentEditable: bool, mutable inputMode: string, dataset: WebAPI.DOMStringMap.t, mutable nonce?: string, mutable autofocus: bool, mutable tabIndex: int,}Record fields
id
Returns the value of element's id content attribute. Can be set to change it. Read more on MDN
className
Returns the value of element's class content attribute. Can be set to change it. Read more on MDN
classList
Allows for manipulation of element's class content attribute as a set of whitespace-separated tokens through a DOMTokenList object. Read more on MDN
slot
Returns the value of element's slot content attribute. Can be set to change it. Read more on MDN
shadowRoot
Returns element's shadow root, if any, and if shadow root's mode is "open", and null otherwise. Read more on MDN
ownerDocument
Returns the node document. Returns null for documents. Read more on MDN
htmlFormControlsCollection
type htmlFormControlsCollection = {length: int}Record fields
length
htmlFormElement
A <form> element in the WebApiDOM; it allows access to and in some cases modification of aspects of the form, as well as access to its component elements. See HTMLFormElement on MDN TODO: mark as private once mutating fields of private records is allowed
type htmlFormElement = { mutable title: string, mutable lang: string, mutable translate: bool, mutable dir: string, mutable inert: bool, mutable accessKey: string, accessKeyLabel: string, mutable draggable: bool, mutable spellcheck: bool, mutable autocapitalize: string, mutable innerText: string, mutable outerText: string, mutable popover: Null.t<string>, offsetParent: Null.t<element>, offsetTop: int, offsetLeft: int, offsetWidth: int, offsetHeight: int, namespaceURI: Null.t<string>, prefix: Null.t<string>, localName: string, tagName: string, mutable id: string, mutable className: string, classList: WebAPI.DOM.domTokenList, mutable slot: string, attributes: WebAPI.DOM.namedNodeMap, shadowRoot: Null.t<shadowRoot>, part: WebAPI.DOM.domTokenList, mutable scrollTop: float, mutable scrollLeft: float, scrollWidth: int, scrollHeight: int, clientTop: int, clientLeft: int, clientWidth: int, clientHeight: int, currentCSSZoom: float, mutable innerHTML: string, mutable outerHTML: string, nodeType: int, nodeName: string, baseURI: string, isConnected: bool, ownerDocument: Null.t<WebAPI.DOM.document>, parentNode: Null.t<node>, parentElement: Null.t<htmlElement>, childNodes: WebAPI.DOM.nodeList<node>, firstChild: Null.t<node>, lastChild: Null.t<node>, previousSibling: Null.t<node>, nextSibling: Null.t<node>, mutable nodeValue: Null.t<string>, mutable textContent: Null.t<string>, mutable acceptCharset: string, mutable action: string, mutable autocomplete: WebAPI.DOM.autoFillBase, mutable enctype: string, mutable encoding: string, mutable method: string, mutable name: string, mutable target: string, elements: htmlFormControlsCollection, length: int,}Record fields
id
Returns the value of element's id content attribute. Can be set to change it. Read more on MDN
className
Returns the value of element's class content attribute. Can be set to change it. Read more on MDN
classList
Allows for manipulation of element's class content attribute as a set of whitespace-separated tokens through a DOMTokenList object. Read more on MDN
slot
Returns the value of element's slot content attribute. Can be set to change it. Read more on MDN
shadowRoot
Returns element's shadow root, if any, and if shadow root's mode is "open", and null otherwise. Read more on MDN
ownerDocument
Returns the node document. Returns null for documents. Read more on MDN
acceptCharset
Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form. Read more on MDN
action
Sets or retrieves the WebApiURL to which the form content is sent for processing. Read more on MDN
autocomplete
Specifies whether autocomplete is applied to an editable text field. Read more on MDN
elements
Retrieves a collection, in source order, of all controls in a given form. Read more on MDN
htmlSlotElement
type htmlSlotElement = { namespaceURI: Null.t<string>, prefix: Null.t<string>, localName: string, tagName: string, mutable id: string, mutable className: string, classList: WebAPI.DOM.domTokenList, mutable slot: string, attributes: WebAPI.DOM.namedNodeMap, shadowRoot: Null.t<shadowRoot>, part: WebAPI.DOM.domTokenList, mutable scrollTop: float, mutable scrollLeft: float, scrollWidth: int, scrollHeight: int, clientTop: int, clientLeft: int, clientWidth: int, clientHeight: int, currentCSSZoom: float, mutable innerHTML: string, mutable outerHTML: string, nodeType: int, nodeName: string, baseURI: string, isConnected: bool, ownerDocument: Null.t<WebAPI.DOM.document>, parentNode: Null.t<node>, parentElement: Null.t<htmlElement>, childNodes: WebAPI.DOM.nodeList<node>, firstChild: Null.t<node>, lastChild: Null.t<node>, previousSibling: Null.t<node>, nextSibling: Null.t<node>, mutable nodeValue: Null.t<string>, mutable textContent: Null.t<string>, mutable title: string, mutable lang: string, mutable translate: bool, mutable dir: string, mutable inert: bool, mutable accessKey: string, accessKeyLabel: string, mutable draggable: bool, mutable spellcheck: bool, mutable autocapitalize: string, mutable innerText: string, mutable outerText: string, mutable popover: Null.t<string>, offsetParent: Null.t<element>, offsetTop: int, offsetLeft: int, offsetWidth: int, offsetHeight: int, style: WebAPI.CSSStyleDeclaration.t, attributeStyleMap: WebAPI.StylePropertyMap.t, mutable contentEditable: string, mutable enterKeyHint: string, isContentEditable: bool, mutable inputMode: string, dataset: WebAPI.DOMStringMap.t, mutable nonce?: string, mutable autofocus: bool, mutable tabIndex: int, mutable name: string,}Record fields
id
Returns the value of element's id content attribute. Can be set to change it. Read more on MDN
className
Returns the value of element's class content attribute. Can be set to change it. Read more on MDN
classList
Allows for manipulation of element's class content attribute as a set of whitespace-separated tokens through a DOMTokenList object. Read more on MDN
slot
Returns the value of element's slot content attribute. Can be set to change it. Read more on MDN
shadowRoot
Returns element's shadow root, if any, and if shadow root's mode is "open", and null otherwise. Read more on MDN
ownerDocument
Returns the node document. Returns null for documents. Read more on MDN
node
Node is an interface from which a number of WebApiDOM API object types inherit. It allows those types to be treated similarly; for example, inheriting the same set of methods, or being tested in the same way. See Node on MDN TODO: mark as private once mutating fields of private records is allowed
type node = { nodeType: int, nodeName: string, baseURI: string, isConnected: bool, ownerDocument: Null.t<WebAPI.DOM.document>, parentNode: Null.t<node>, parentElement: Null.t<element>, childNodes: WebAPI.DOM.nodeList<node>, firstChild: Null.t<node>, lastChild: Null.t<node>, previousSibling: Null.t<node>, nextSibling: Null.t<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
shadowRoot
See ShadowRoot on MDN TODO: mark as private once mutating fields of private records is allowed
type shadowRoot = { nodeType: int, nodeName: string, baseURI: string, isConnected: bool, ownerDocument: Null.t<WebAPI.DOM.document>, parentNode: Null.t<node>, parentElement: Null.t<htmlElement>, childNodes: WebAPI.DOM.nodeList<node>, firstChild: Null.t<node>, lastChild: Null.t<node>, previousSibling: Null.t<node>, nextSibling: Null.t<node>, mutable nodeValue: Null.t<string>, mutable textContent: Null.t<string>, mode: shadowRootMode, delegatesFocus: bool, slotAssignment: slotAssignmentMode, clonable: bool, serializable: bool, host: element, mutable innerHTML: string, styleSheets: WebAPI.StyleSheetList.t, mutable adoptedStyleSheets: array< WebAPI.StyleSheet.cssStyleSheet, >, fullscreenElement: Null.t<element>, activeElement: Null.t<element>, pictureInPictureElement: Null.t<element>, pointerLockElement: Null.t<element>,}Record fields
ownerDocument
Returns the node document. Returns null for documents. Read more on MDN
styleSheets
Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. Read more on MDN
activeElement
Returns the deepest element in the document through which or to which key events are being routed. This is, roughly speaking, the focused element in the document.
For the purposes of this API, when a child browsing context is focused, its container is focused in the parent browsing context. For example, if the user moves the focus to a text control in an iframe, the iframe is the element returned by the activeElement API in the iframe's node document.
Similarly, when the focused element is in a different node tree than documentOrShadowRoot, the element returned will be the host that's located in the same node tree as documentOrShadowRoot if documentOrShadowRoot is a shadow-including inclusive ancestor of the focused element, and null if not. Read more on MDN
shadowRootMode
type shadowRootMode = | @as("closed") Closed | @as("open") OpenslotAssignmentMode
type slotAssignmentMode = | @as("manual") Manual | @as("named") Named