Skip to content

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

nodeType
int

Returns the type of node. Read more on MDN

nodeName
string

Returns a string appropriate for the type of node. Read more on MDN

baseURI
string

Returns node's node document's document base URL. Read more on MDN

isConnected
bool

Returns true if node is connected and false otherwise. Read more on MDN

ownerDocument

Returns the node document. Returns null for documents. Read more on MDN

parentNode
Null.t<node>

Returns the parent. Read more on MDN

parentElement
Null.t<htmlElement>

Returns the parent element. Read more on MDN

childNodes

Returns the children. Read more on MDN

firstChild
Null.t<node>

Returns the first child. Read more on MDN

lastChild
Null.t<node>

Returns the last child. Read more on MDN

previousSibling
Null.t<node>

Returns the previous sibling. Read more on MDN

nextSibling
Null.t<node>

Returns the next sibling. Read more on MDN

nodeValue
Null.t<string>
textContent
Null.t<string>
children

Returns the child elements. Read more on MDN

firstElementChild
Null.t<element>

Returns the first child that is an element, and null otherwise. Read more on MDN

lastElementChild
Null.t<element>

Returns the last child that is an element, and null otherwise. Read more on MDN

childElementCount
int

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

nodeType
int

Returns the type of node. Read more on MDN

nodeName
string

Returns a string appropriate for the type of node. Read more on MDN

baseURI
string

Returns node's node document's document base URL. Read more on MDN

isConnected
bool

Returns true if node is connected and false otherwise. Read more on MDN

ownerDocument

Returns the node document. Returns null for documents. Read more on MDN

parentNode
Null.t<node>

Returns the parent. Read more on MDN

parentElement
Null.t<element>

Returns the parent element. Read more on MDN

childNodes

Returns the children. Read more on MDN

firstChild
Null.t<node>

Returns the first child. Read more on MDN

lastChild
Null.t<node>

Returns the last child. Read more on MDN

previousSibling
Null.t<node>

Returns the previous sibling. Read more on MDN

nextSibling
Null.t<node>

Returns the next sibling. Read more on MDN

nodeValue
Null.t<string>
textContent
Null.t<string>
namespaceURI
Null.t<string>

Returns the namespace. Read more on MDN

prefix
Null.t<string>

Returns the namespace prefix. Read more on MDN

localName
string

Returns the local name. Read more on MDN

tagName
string

Returns the HTML-uppercased qualified name. Read more on MDN

id
string

Returns the value of element's id content attribute. Can be set to change it. Read more on MDN

className
string

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
string

Returns the value of element's slot content attribute. Can be set to change it. Read more on MDN

shadowRoot
Null.t<shadowRoot>

Returns element's shadow root, if any, and if shadow root's mode is "open", and null otherwise. Read more on MDN

scrollTop
float
scrollLeft
float
scrollWidth
int
scrollHeight
int
clientTop
int
clientLeft
int
clientWidth
int
clientHeight
int
currentCSSZoom
float
innerHTML
string
outerHTML
string
children

Returns the child elements. Read more on MDN

firstElementChild
Null.t<element>

Returns the first child that is an element, and null otherwise. Read more on MDN

lastElementChild
Null.t<element>

Returns the last child that is an element, and null otherwise. Read more on MDN

childElementCount
int
previousElementSibling
Null.t<element>

Returns the first preceding sibling that is an element, and null otherwise. Read more on MDN

nextElementSibling
Null.t<element>

Returns the first following sibling that is an element, and null otherwise. Read more on MDN

ariaAtomic
Null.t<string>
ariaAutoComplete
Null.t<string>
ariaBrailleLabel
Null.t<string>
ariaBrailleRoleDescription
Null.t<string>
ariaBusy
Null.t<string>
ariaChecked
Null.t<string>
ariaColCount
Null.t<string>
ariaColIndex
Null.t<string>
ariaColIndexText
Null.t<string>
ariaColSpan
Null.t<string>
ariaCurrent
Null.t<string>
ariaDescription
Null.t<string>
ariaDisabled
Null.t<string>
ariaExpanded
Null.t<string>
ariaHasPopup
Null.t<string>
ariaHidden
Null.t<string>
ariaKeyShortcuts
Null.t<string>
ariaLabel
Null.t<string>
ariaLevel
Null.t<string>
ariaLive
Null.t<string>
ariaModal
Null.t<string>
ariaMultiLine
Null.t<string>
ariaMultiSelectable
Null.t<string>
ariaOrientation
Null.t<string>
ariaPlaceholder
Null.t<string>
ariaPosInSet
Null.t<string>
ariaPressed
Null.t<string>
ariaReadOnly
Null.t<string>
ariaRequired
Null.t<string>
ariaRoleDescription
Null.t<string>
ariaRowCount
Null.t<string>
ariaRowIndex
Null.t<string>
ariaRowIndexText
Null.t<string>
ariaRowSpan
Null.t<string>
ariaSelected
Null.t<string>
ariaSetSize
Null.t<string>
ariaSort
Null.t<string>
ariaValueMax
Null.t<string>
ariaValueMin
Null.t<string>
ariaValueNow
Null.t<string>
ariaValueText
Null.t<string>

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
Null.t<shadowRoot>
form
willValidate
bool
validationMessage
string
labels
ariaAtomic
Null.t<string>
ariaAutoComplete
Null.t<string>
ariaBrailleLabel
Null.t<string>
ariaBrailleRoleDescription
Null.t<string>
ariaBusy
Null.t<string>
ariaChecked
Null.t<string>
ariaColCount
Null.t<string>
ariaColIndex
Null.t<string>
ariaColIndexText
Null.t<string>
ariaColSpan
Null.t<string>
ariaCurrent
Null.t<string>
ariaDescription
Null.t<string>
ariaDisabled
Null.t<string>
ariaExpanded
Null.t<string>
ariaHasPopup
Null.t<string>
ariaHidden
Null.t<string>
ariaKeyShortcuts
Null.t<string>
ariaLabel
Null.t<string>
ariaLevel
Null.t<string>
ariaLive
Null.t<string>
ariaModal
Null.t<string>
ariaMultiLine
Null.t<string>
ariaMultiSelectable
Null.t<string>
ariaOrientation
Null.t<string>
ariaPlaceholder
Null.t<string>
ariaPosInSet
Null.t<string>
ariaPressed
Null.t<string>
ariaReadOnly
Null.t<string>
ariaRequired
Null.t<string>
ariaRoleDescription
Null.t<string>
ariaRowCount
Null.t<string>
ariaRowIndex
Null.t<string>
ariaRowIndexText
Null.t<string>
ariaRowSpan
Null.t<string>
ariaSelected
Null.t<string>
ariaSetSize
Null.t<string>
ariaSort
Null.t<string>
ariaValueMax
Null.t<string>
ariaValueMin
Null.t<string>
ariaValueNow
Null.t<string>
ariaValueText
Null.t<string>

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

namespaceURI
Null.t<string>

Returns the namespace. Read more on MDN

prefix
Null.t<string>

Returns the namespace prefix. Read more on MDN

localName
string

Returns the local name. Read more on MDN

tagName
string

Returns the HTML-uppercased qualified name. Read more on MDN

id
string

Returns the value of element's id content attribute. Can be set to change it. Read more on MDN

className
string

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
string

Returns the value of element's slot content attribute. Can be set to change it. Read more on MDN

shadowRoot
Null.t<shadowRoot>

Returns element's shadow root, if any, and if shadow root's mode is "open", and null otherwise. Read more on MDN

scrollTop
float
scrollLeft
float
scrollWidth
int
scrollHeight
int
clientTop
int
clientLeft
int
clientWidth
int
clientHeight
int
currentCSSZoom
float
innerHTML
string
outerHTML
string
nodeType
int

Returns the type of node. Read more on MDN

nodeName
string

Returns a string appropriate for the type of node. Read more on MDN

baseURI
string

Returns node's node document's document base URL. Read more on MDN

isConnected
bool

Returns true if node is connected and false otherwise. Read more on MDN

ownerDocument

Returns the node document. Returns null for documents. Read more on MDN

parentNode
Null.t<node>

Returns the parent. Read more on MDN

parentElement
Null.t<htmlElement>

Returns the parent element. Read more on MDN

childNodes

Returns the children. Read more on MDN

firstChild
Null.t<node>

Returns the first child. Read more on MDN

lastChild
Null.t<node>

Returns the last child. Read more on MDN

previousSibling
Null.t<node>

Returns the previous sibling. Read more on MDN

nextSibling
Null.t<node>

Returns the next sibling. Read more on MDN

nodeValue
Null.t<string>
textContent
Null.t<string>
title
string
translate
bool
accessKey
string
accessKeyLabel
string
draggable
bool
spellcheck
bool
autocapitalize
string
innerText
string
outerText
string
popover
Null.t<string>
offsetParent
Null.t<element>
offsetTop
int
offsetLeft
int
offsetWidth
int
offsetHeight
int
contentEditable
string
enterKeyHint
string
isContentEditable
bool
inputMode
string
nonce
option<string>
autofocus
bool
tabIndex
int

htmlFormControlsCollection

type htmlFormControlsCollection = {length: int}

Record fields

length
int

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

title
string
translate
bool
accessKey
string
accessKeyLabel
string
draggable
bool
spellcheck
bool
autocapitalize
string
innerText
string
outerText
string
popover
Null.t<string>
offsetParent
Null.t<element>
offsetTop
int
offsetLeft
int
offsetWidth
int
offsetHeight
int
namespaceURI
Null.t<string>

Returns the namespace. Read more on MDN

prefix
Null.t<string>

Returns the namespace prefix. Read more on MDN

localName
string

Returns the local name. Read more on MDN

tagName
string

Returns the HTML-uppercased qualified name. Read more on MDN

id
string

Returns the value of element's id content attribute. Can be set to change it. Read more on MDN

className
string

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
string

Returns the value of element's slot content attribute. Can be set to change it. Read more on MDN

shadowRoot
Null.t<shadowRoot>

Returns element's shadow root, if any, and if shadow root's mode is "open", and null otherwise. Read more on MDN

scrollTop
float
scrollLeft
float
scrollWidth
int
scrollHeight
int
clientTop
int
clientLeft
int
clientWidth
int
clientHeight
int
currentCSSZoom
float
innerHTML
string
outerHTML
string
nodeType
int

Returns the type of node. Read more on MDN

nodeName
string

Returns a string appropriate for the type of node. Read more on MDN

baseURI
string

Returns node's node document's document base URL. Read more on MDN

isConnected
bool

Returns true if node is connected and false otherwise. Read more on MDN

ownerDocument

Returns the node document. Returns null for documents. Read more on MDN

parentNode
Null.t<node>

Returns the parent. Read more on MDN

parentElement
Null.t<htmlElement>

Returns the parent element. Read more on MDN

childNodes

Returns the children. Read more on MDN

firstChild
Null.t<node>

Returns the first child. Read more on MDN

lastChild
Null.t<node>

Returns the last child. Read more on MDN

previousSibling
Null.t<node>

Returns the previous sibling. Read more on MDN

nextSibling
Null.t<node>

Returns the next sibling. Read more on MDN

nodeValue
Null.t<string>
textContent
Null.t<string>
acceptCharset
string

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
string

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

enctype
string

Sets or retrieves the encoding type for the form. Read more on MDN

encoding
string

Sets or retrieves the MIME encoding for the form. Read more on MDN

method
string

Sets or retrieves how to send the form data to the server. Read more on MDN

name
string

Sets or retrieves the name of the object. Read more on MDN

target
string

Sets or retrieves the window or frame at which to target content. Read more on MDN

elements

Retrieves a collection, in source order, of all controls in a given form. Read more on MDN

length
int

Sets or retrieves the number of objects in a collection. 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

namespaceURI
Null.t<string>

Returns the namespace. Read more on MDN

prefix
Null.t<string>

Returns the namespace prefix. Read more on MDN

localName
string

Returns the local name. Read more on MDN

tagName
string

Returns the HTML-uppercased qualified name. Read more on MDN

id
string

Returns the value of element's id content attribute. Can be set to change it. Read more on MDN

className
string

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
string

Returns the value of element's slot content attribute. Can be set to change it. Read more on MDN

shadowRoot
Null.t<shadowRoot>

Returns element's shadow root, if any, and if shadow root's mode is "open", and null otherwise. Read more on MDN

scrollTop
float
scrollLeft
float
scrollWidth
int
scrollHeight
int
clientTop
int
clientLeft
int
clientWidth
int
clientHeight
int
currentCSSZoom
float
innerHTML
string
outerHTML
string
nodeType
int

Returns the type of node. Read more on MDN

nodeName
string

Returns a string appropriate for the type of node. Read more on MDN

baseURI
string

Returns node's node document's document base URL. Read more on MDN

isConnected
bool

Returns true if node is connected and false otherwise. Read more on MDN

ownerDocument

Returns the node document. Returns null for documents. Read more on MDN

parentNode
Null.t<node>

Returns the parent. Read more on MDN

parentElement
Null.t<htmlElement>

Returns the parent element. Read more on MDN

childNodes

Returns the children. Read more on MDN

firstChild
Null.t<node>

Returns the first child. Read more on MDN

lastChild
Null.t<node>

Returns the last child. Read more on MDN

previousSibling
Null.t<node>

Returns the previous sibling. Read more on MDN

nextSibling
Null.t<node>

Returns the next sibling. Read more on MDN

nodeValue
Null.t<string>
textContent
Null.t<string>
title
string
translate
bool
accessKey
string
accessKeyLabel
string
draggable
bool
spellcheck
bool
autocapitalize
string
innerText
string
outerText
string
popover
Null.t<string>
offsetParent
Null.t<element>
offsetTop
int
offsetLeft
int
offsetWidth
int
offsetHeight
int
contentEditable
string
enterKeyHint
string
isContentEditable
bool
inputMode
string
nonce
option<string>
autofocus
bool
tabIndex
int

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

nodeType
int

Returns the type of node. Read more on MDN

nodeName
string

Returns a string appropriate for the type of node. Read more on MDN

baseURI
string

Returns node's node document's document base URL. Read more on MDN

isConnected
bool

Returns true if node is connected and false otherwise. Read more on MDN

ownerDocument

Returns the node document. Returns null for documents. Read more on MDN

parentNode
Null.t<node>

Returns the parent. Read more on MDN

parentElement
Null.t<element>

Returns the parent element. Read more on MDN

childNodes

Returns the children. Read more on MDN

firstChild
Null.t<node>

Returns the first child. Read more on MDN

lastChild
Null.t<node>

Returns the last child. Read more on MDN

previousSibling
Null.t<node>

Returns the previous sibling. Read more on MDN

nextSibling
Null.t<node>

Returns the next sibling. Read more on MDN

nodeValue
Null.t<string>
textContent
Null.t<string>

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

nodeType
int

Returns the type of node. Read more on MDN

nodeName
string

Returns a string appropriate for the type of node. Read more on MDN

baseURI
string

Returns node's node document's document base URL. Read more on MDN

isConnected
bool

Returns true if node is connected and false otherwise. Read more on MDN

ownerDocument

Returns the node document. Returns null for documents. Read more on MDN

parentNode
Null.t<node>

Returns the parent. Read more on MDN

parentElement
Null.t<htmlElement>

Returns the parent element. Read more on MDN

childNodes

Returns the children. Read more on MDN

firstChild
Null.t<node>

Returns the first child. Read more on MDN

lastChild
Null.t<node>

Returns the last child. Read more on MDN

previousSibling
Null.t<node>

Returns the previous sibling. Read more on MDN

nextSibling
Null.t<node>

Returns the next sibling. Read more on MDN

nodeValue
Null.t<string>
textContent
Null.t<string>
delegatesFocus
bool
clonable
bool
serializable
bool
innerHTML
string
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

fullscreenElement
Null.t<element>

Returns document's fullscreen element. Read more on MDN

activeElement
Null.t<element>

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

pictureInPictureElement
Null.t<element>
pointerLockElement
Null.t<element>

shadowRootMode

type shadowRootMode =
| @as("closed") Closed
| @as("open") Open

slotAssignmentMode

type slotAssignmentMode =
| @as("manual") Manual
| @as("named") Named