Skip to content

DOM

Types

abortController

A controller object that allows you to abort one or more WebApiDOM requests as and when desired. See AbortController on MDN

type abortController = private {signal: abortSignal}

Record fields

signal

Returns the AbortSignal object associated with this object. Read more on MDN

abortSignal

A signal object that allows you to communicate with a WebApiDOM request (such as a WebApiFetch) and abort it if required via an AbortController object. See AbortSignal on MDN

type abortSignal = private {aborted: bool, reason: JSON.t}

Record fields

aborted
bool

Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. Read more on MDN

reason
JSON.t

alphaOption

type alphaOption = @as("discard") Discard | @as("keep") Keep

animationPlayState

type animationPlayState =
| @as("finished") Finished
| @as("idle") Idle
| @as("paused") Paused
| @as("running") Running

animationReplaceState

type animationReplaceState =
| @as("active") Active
| @as("persisted") Persisted
| @as("removed") Removed

assignedNodesOptions

type assignedNodesOptions = {mutable flatten?: bool}

Record fields

flatten
option<bool>

autoFillBase

type autoFillBase = @as("off") Off | @as("on") On

barProp

type barProp = {visible: bool}

Record fields

visible
bool

blob

A file-like object of immutable, raw data. See Blob on MDN

type blob = private {size: int, type_: string}

Record fields

size
int
type_
string

canvasContext2DAttributes

type canvasContext2DAttributes = {
alpha: bool,
colorspace?: predefinedColorSpace,
desynchronized: bool,
willReadFrequently: bool,
}

Record fields

alpha
bool
colorspace
desynchronized
bool
willReadFrequently
bool

canvasRenderingContext2D

The CanvasRenderingContext2D interface, part of the WebApiCanvas API, provides the 2D rendering context for the drawing surface of a <canvas> element. It is used for drawing shapes, text, images, and other objects. See CanvasRenderingContext2D on MDN

type canvasRenderingContext2D

caretPosition

type caretPosition = private {}

checkVisibilityOptions

type checkVisibilityOptions = {
mutable checkOpacity?: bool,
mutable checkVisibilityCSS?: bool,
mutable contentVisibilityAuto?: bool,
mutable opacityProperty?: bool,
mutable visibilityProperty?: bool,
}

Record fields

checkOpacity
option<bool>
checkVisibilityCSS
option<bool>
contentVisibilityAuto
option<bool>
opacityProperty
option<bool>
visibilityProperty
option<bool>

colorSpaceConversion

type colorSpaceConversion =
| @as("default") Default
| @as("none") None

customElementConstructor

type customElementConstructor

customElementRegistry

type customElementRegistry = private {}

document

Any web page loaded in the browser that serves as an entry point into the page's DOM tree. See Document on MDN

type document = private {}

documentReadyState

type documentReadyState =
| @as("complete") Complete
| @as("interactive") Interactive
| @as("loading") Loading

documentTimeline

type documentTimeline = private {currentTime: Null.t<float>}

Record fields

currentTime
Null.t<float>

documentTimelineOptions

type documentTimelineOptions = {mutable originTime?: float}

Record fields

originTime
option<float>

documentVisibilityState

type documentVisibilityState =
| @as("hidden") Hidden
| @as("visible") Visible

domException

An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API. See DOMException on MDN

type domException = {name: string, message: string}

Record fields

message
string

domMatrix

type domMatrix = private {
a: float,
b: float,
c: float,
d: float,
e: float,
f: float,
m11: float,
m12: float,
m13: float,
m14: float,
m21: float,
m22: float,
m23: float,
m24: float,
m31: float,
m32: float,
m33: float,
m34: float,
m41: float,
m42: float,
m43: float,
m44: float,
}

Record fields

domMatrix2DInit

type domMatrix2DInit = {
mutable a?: float,
mutable b?: float,
mutable c?: float,
mutable d?: float,
mutable e?: float,
mutable f?: float,
mutable m11?: float,
mutable m12?: float,
mutable m21?: float,
mutable m22?: float,
mutable m41?: float,
mutable m42?: float,
}

Record fields

a
option<float>
b
option<float>
c
option<float>
d
option<float>
e
option<float>
f
option<float>
m11
option<float>
m12
option<float>
m21
option<float>
m22
option<float>
m41
option<float>
m42
option<float>

domMatrixInit

type domMatrixInit = {
mutable a?: float,
mutable b?: float,
mutable c?: float,
mutable d?: float,
mutable e?: float,
mutable f?: float,
mutable m11?: float,
mutable m12?: float,
mutable m21?: float,
mutable m22?: float,
mutable m41?: float,
mutable m42?: float,
mutable m13?: float,
mutable m14?: float,
mutable m23?: float,
mutable m24?: float,
mutable m31?: float,
mutable m32?: float,
mutable m33?: float,
mutable m34?: float,
mutable m43?: float,
mutable m44?: float,
mutable is2D?: bool,
}

Record fields

a
option<float>
b
option<float>
c
option<float>
d
option<float>
e
option<float>
f
option<float>
m11
option<float>
m12
option<float>
m21
option<float>
m22
option<float>
m41
option<float>
m42
option<float>
m13
option<float>
m14
option<float>
m23
option<float>
m24
option<float>
m31
option<float>
m32
option<float>
m33
option<float>
m34
option<float>
m43
option<float>
m44
option<float>
is2D
option<bool>

domMatrixReadOnly

type domMatrixReadOnly = private {
a: float,
b: float,
c: float,
d: float,
e: float,
f: float,
m11: float,
m12: float,
m13: float,
m14: float,
m21: float,
m22: float,
m23: float,
m24: float,
m31: float,
m32: float,
m33: float,
m34: float,
m41: float,
m42: float,
m43: float,
m44: float,
}

Record fields

domPoint

type domPoint = private {
x: float,
y: float,
z: float,
w: float,
}

Record fields

domPointInit

type domPointInit = {
mutable x?: float,
mutable y?: float,
mutable z?: float,
mutable w?: float,
}

Record fields

x
option<float>
y
option<float>
z
option<float>
w
option<float>

domPointReadOnly

type domPointReadOnly = private {
x: float,
y: float,
z: float,
w: float,
}

Record fields

domRect

type domRect = private {
x: float,
y: float,
width: float,
height: float,
top: float,
right: float,
bottom: float,
left: float,
}

Record fields

height
float
bottom
float

domRectInit

type domRectInit = {
mutable x?: float,
mutable y?: float,
mutable width?: float,
mutable height?: float,
}

Record fields

x
option<float>
y
option<float>
width
option<float>
height
option<float>

domRectList

type domRectList = private {}

domRectReadOnly

type domRectReadOnly = private {
x: float,
y: float,
width: float,
height: float,
top: float,
right: float,
bottom: float,
left: float,
}

Record fields

height
float
bottom
float

domStringList

A type returned by some APIs which contains a list of DOMString (strings). See DOMStringList on MDN

type domStringList = {length: int}

Record fields

length
int

Returns the number of strings in strings. Read more on MDN

domTokenList

type domTokenList = {length: int, mutable value: string}

Record fields

length
int

Returns the number of tokens. Read more on MDN

value
string

Returns the associated set as string.

Can be set, to change the associated attribute. Read more on MDN

elementDefinitionOptions

type elementDefinitionOptions = {mutable extends?: string}

Record fields

extends
option<string>

event

An event which takes place in the DOM. See WebApiEvent on MDN

type event = private {
type_: WebAPI.EventType.t,
target: Null.t<eventTarget>,
currentTarget: Null.t<eventTarget>,
eventPhase: int,
bubbles: bool,
cancelable: bool,
defaultPrevented: bool,
composed: bool,
isTrusted: bool,
timeStamp: float,
}

Record fields

type_

Returns the type of event, e.g. "click", "hashchange", or "submit". Read more on MDN

target
Null.t<eventTarget>

Returns the object to which event is dispatched (its target). Read more on MDN

currentTarget
Null.t<eventTarget>

Returns the object whose event listener's callback is currently being invoked. Read more on MDN

eventPhase
int

Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. Read more on MDN

bubbles
bool

Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. Read more on MDN

cancelable
bool

Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. Read more on MDN

defaultPrevented
bool

Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. Read more on MDN

composed
bool

Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. Read more on MDN

isTrusted
bool

Returns true if event was dispatched by the user agent, and false otherwise. Read more on MDN

timeStamp
float

Returns the event's timestamp as the number of milliseconds measured relative to the time origin. Read more on MDN

eventInit

type eventInit = {
mutable bubbles?: bool,
mutable cancelable?: bool,
mutable composed?: bool,
}

Record fields

bubbles
option<bool>
cancelable
option<bool>
composed
option<bool>

eventTarget

EventTarget is a WebApiDOM interface implemented by objects that can receive events and may have listeners for them. See EventTarget on MDN

type eventTarget = private {}

extendableEvent

The ExtendableEvent interface extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. See ExtendableEvent on MDN

type extendableEvent = private {
type_: WebAPI.EventType.t,
target: Null.t<eventTarget>,
currentTarget: Null.t<eventTarget>,
eventPhase: int,
bubbles: bool,
cancelable: bool,
defaultPrevented: bool,
composed: bool,
isTrusted: bool,
timeStamp: float,
}

Record fields

type_

Returns the type of event, e.g. "click", "hashchange", or "submit". Read more on MDN

target
Null.t<eventTarget>

Returns the object to which event is dispatched (its target). Read more on MDN

currentTarget
Null.t<eventTarget>

Returns the object whose event listener's callback is currently being invoked. Read more on MDN

eventPhase
int

Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. Read more on MDN

bubbles
bool

Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. Read more on MDN

cancelable
bool

Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. Read more on MDN

defaultPrevented
bool

Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. Read more on MDN

composed
bool

Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. Read more on MDN

isTrusted
bool

Returns true if event was dispatched by the user agent, and false otherwise. Read more on MDN

timeStamp
float

Returns the event's timestamp as the number of milliseconds measured relative to the time origin. Read more on MDN

file

Provides information about a file selected by or available to the user. See File on MDN

type file = private {
size: int,
type_: string,
name: string,
lastModified: int,
webkitRelativePath: string,
}

Record fields

size
int
type_
string
name
string
lastModified
int
webkitRelativePath
string

fileList

An object of this type is returned by the files property of the HTML <input> element; this lets you access the list of files selected with the <input type="file"> element. It's also used for a list of files dropped into web content when using the drag and drop API; see the DataTransfer object for details on this usage. See FileList on MDN

type fileList = private {length: int}

Record fields

fillMode

type fillMode =
| @as("auto") Auto
| @as("backwards") Backwards
| @as("both") Both
| @as("forwards") Forwards
| @as("none") None

focusOptions

type focusOptions = {mutable preventScroll?: bool}

Record fields

preventScroll
option<bool>

fragmentDirective

type fragmentDirective = {}

fullscreenNavigationUI

type fullscreenNavigationUI =
| @as("auto") Auto
| @as("hide") Hide
| @as("show") Show

fullscreenOptions

type fullscreenOptions = {
mutable navigationUI?: fullscreenNavigationUI,
}

Record fields

navigationUI

idleDeadline

type idleDeadline = private {didTimeout: bool}

Record fields

didTimeout
bool

idleRequestOptions

type idleRequestOptions = {mutable timeout?: int}

Record fields

timeout
option<int>

imageBitmapOptions

type imageBitmapOptions = {
mutable imageOrientation?: imageOrientation,
mutable premultiplyAlpha?: premultiplyAlpha,
mutable colorSpaceConversion?: colorSpaceConversion,
mutable resizeWidth?: int,
mutable resizeHeight?: int,
mutable resizeQuality?: resizeQuality,
}

Record fields

imageOrientation
premultiplyAlpha
colorSpaceConversion
resizeWidth
option<int>
resizeHeight
option<int>
resizeQuality

imageBitmapSource

type imageBitmapSource

imageData

The underlying pixel data of an area of a <canvas> element. It is created using the ImageData() constructor or creator methods on the CanvasRenderingContext2D object associated with a canvas: createImageData() and getImageData(). It can also be used to set a part of the canvas by using putImageData(). See ImageData on MDN

type imageData = private {
width: int,
height: int,
data: Uint8ClampedArray.t,
colorSpace: predefinedColorSpace,
}

Record fields

width
int

Returns the actual dimensions of the data in the ImageData object, in pixels. Read more on MDN

height
int

Returns the actual dimensions of the data in the ImageData object, in pixels. Read more on MDN

data
Uint8ClampedArray.t

Returns the one-dimensional array containing the data in RGBA order, as integers in the range 0 to 255. Read more on MDN

imageDataSettings

type imageDataSettings = {
mutable colorSpace?: predefinedColorSpace,
}

Record fields

colorSpace

imageOrientation

type imageOrientation =
| @as("flipY") FlipY
| @as("from-image") FromImage
| @as("none") None

insertPosition

type insertPosition =
| @as("afterbegin") Afterbegin
| @as("afterend") Afterend
| @as("beforebegin") Beforebegin
| @as("beforeend") Beforeend

namedNodeMap

A collection of Attr objects. Objects inside a NamedNodeMap are not in any particular order, unlike NodeList, although they may be accessed by an index as in an array. See NamedNodeMap on MDN

type namedNodeMap = private {length: int}

Record fields

The state and the identity of the user agent. It allows scripts to query it and to register themselves to carry on some activities. See Navigator on MDN

type navigator

nodeList

NodeList objects are collections of nodes, usually returned by properties such as Node.childNodes and methods such as document.querySelectorAll(). See NodeList on MDN

type nodeList<'tNode> = private {length: int}

Record fields

length
int

Returns the number of nodes in the collection. Read more on MDN

offscreenRenderingContext

type offscreenRenderingContext = unknown

orientationType

type orientationType =
| @as("landscape-primary") LandscapePrimary
| @as("landscape-secondary") LandscapeSecondary
| @as("portrait-primary") PortraitPrimary
| @as("portrait-secondary") PortraitSecondary

planeLayout

type planeLayout = {
mutable offset: int,
mutable stride: int,
}

Record fields

offset
int
stride
int

playbackDirection

type playbackDirection =
| @as("alternate") Alternate
| @as("alternate-reverse") AlternateReverse
| @as("normal") Normal
| @as("reverse") Reverse

pointerLockOptions

type pointerLockOptions = {
mutable unadjustedMovement?: bool,
}

Record fields

unadjustedMovement
option<bool>

predefinedColorSpace

type predefinedColorSpace =
| @as("display-p3") DisplayP3
| @as("srgb") Srgb

premultiplyAlpha

type premultiplyAlpha =
| @as("default") Default
| @as("none") None
| @as("premultiply") Premultiply

referrerPolicy

type referrerPolicy =
| @as("no-referrer") NoReferrer
| @as("no-referrer-when-downgrade") NoReferrerWhenDowngrade
| @as("origin") Origin
| @as("origin-when-cross-origin") OriginWhenCrossOrigin
| @as("same-origin") SameOrigin
| @as("strict-origin") StrictOrigin
| @as("strict-origin-when-cross-origin") StrictOriginWhenCrossOrigin
| @as("unsafe-url") UnsafeUrl

remotePlaybackState

type remotePlaybackState =
| @as("connected") Connected
| @as("connecting") Connecting
| @as("disconnected") Disconnected

renderingContext

type renderingContext = unknown

resizeQuality

type resizeQuality =
| @as("high") High
| @as("low") Low
| @as("medium") Medium
| @as("pixelated") Pixelated

screen

A screen, usually the one on which the current window is being rendered, and is obtained using window.screen. See Screen on MDN

type screen = {
availWidth: int,
availHeight: int,
width: int,
height: int,
colorDepth: int,
pixelDepth: int,
orientation: screenOrientation,
}

Record fields

availWidth
int
availHeight
int
colorDepth
int
pixelDepth
int

screenOrientation

type screenOrientation = private {
type_: orientationType,
angle: int,
}

Record fields

scrollBehavior

type scrollBehavior =
| @as("auto") Auto
| @as("instant") Instant
| @as("smooth") Smooth

scrollIntoViewOptions

type scrollIntoViewOptions = {
mutable behavior?: scrollBehavior,
mutable block?: scrollLogicalPosition,
mutable inline?: scrollLogicalPosition,
}

Record fields

behavior
inline

scrollLogicalPosition

type scrollLogicalPosition =
| @as("center") Center
| @as("end") End
| @as("nearest") Nearest
| @as("start") Start

scrollOptions

type scrollOptions = {mutable behavior?: scrollBehavior}

Record fields

behavior

scrollToOptions

type scrollToOptions = {
mutable behavior?: scrollBehavior,
mutable left?: float,
mutable top?: float,
}

Record fields

behavior
left
option<float>
top
option<float>

selectionMode

type selectionMode =
| @as("end") End
| @as("preserve") Preserve
| @as("select") Select
| @as("start") Start

shareData

type shareData = {
mutable files?: array<file>,
mutable title?: string,
mutable text?: string,
mutable url?: string,
}

Record fields

files
option<array<file>>
title
option<string>
text
option<string>
url
option<string>

slotAssignmentMode

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

structuredSerializeOptions

type structuredSerializeOptions = {
mutable transfer?: array<Dict.t<string>>,
}

Record fields

transfer
option<array<Dict.t<string>>>

timeoutId

type timeoutId

userActivation

type userActivation = {hasBeenActive: bool, isActive: bool}

Record fields

hasBeenActive
bool
isActive
bool

validityState

The validity states that an element can be in, with respect to constraint validation. Together, they help explain why an element's value fails to validate, if it's not valid. See ValidityState on MDN

type validityState = {
valueMissing: bool,
typeMismatch: bool,
patternMismatch: bool,
tooLong: bool,
tooShort: bool,
rangeUnderflow: bool,
rangeOverflow: bool,
stepMismatch: bool,
badInput: bool,
customError: bool,
valid: bool,
}

Record fields

valueMissing
bool
typeMismatch
bool
patternMismatch
bool
tooLong
bool
tooShort
bool
rangeUnderflow
bool
rangeOverflow
bool
stepMismatch
bool
badInput
bool
customError
bool

validityStateFlags

type validityStateFlags = {
mutable valueMissing?: bool,
mutable typeMismatch?: bool,
mutable patternMismatch?: bool,
mutable tooLong?: bool,
mutable tooShort?: bool,
mutable rangeUnderflow?: bool,
mutable rangeOverflow?: bool,
mutable stepMismatch?: bool,
mutable badInput?: bool,
mutable customError?: bool,
}

Record fields

valueMissing
option<bool>
typeMismatch
option<bool>
patternMismatch
option<bool>
tooLong
option<bool>
tooShort
option<bool>
rangeUnderflow
option<bool>
rangeOverflow
option<bool>
stepMismatch
option<bool>
badInput
option<bool>
customError
option<bool>

vibratePattern

@unboxed
type vibratePattern = Int(int) | IntArray(array<int>)

videoColorPrimaries

type videoColorPrimaries =
| @as("bt470bg") Bt470bg
| @as("bt709") Bt709
| @as("smpte170m") Smpte170m

videoColorSpace

type videoColorSpace = private {
primaries: Null.t<videoColorPrimaries>,
transfer: Null.t<videoTransferCharacteristics>,
matrix: Null.t<videoMatrixCoefficients>,
fullRange: Null.t<bool>,
}

Record fields

fullRange
Null.t<bool>

videoColorSpaceInit

type videoColorSpaceInit = {
mutable primaries?: Nullable.t<videoColorPrimaries>,
mutable transfer?: Nullable.t<
videoTransferCharacteristics,
>,
mutable matrix?: Nullable.t<videoMatrixCoefficients>,
mutable fullRange?: Nullable.t<bool>,
}

Record fields

primaries
option<Nullable.t<videoColorPrimaries>>
transfer
option<Nullable.t<videoTransferCharacteristics>>
matrix
option<Nullable.t<videoMatrixCoefficients>>
fullRange
option<Nullable.t<bool>>

videoFrame

type videoFrame = private {
format: Null.t<videoPixelFormat>,
codedWidth: int,
codedHeight: int,
codedRect: Null.t<domRectReadOnly>,
visibleRect: Null.t<domRectReadOnly>,
displayWidth: int,
displayHeight: int,
duration: Null.t<int>,
timestamp: int,
colorSpace: videoColorSpace,
}

Record fields

codedWidth
int
codedHeight
int
displayWidth
int
displayHeight
int
duration
Null.t<int>
timestamp
int

videoFrameBufferInit

type videoFrameBufferInit = {
mutable format: videoPixelFormat,
mutable codedWidth: int,
mutable codedHeight: int,
mutable timestamp: int,
mutable duration?: int,
mutable layout?: array<planeLayout>,
mutable visibleRect?: domRectInit,
mutable displayWidth?: int,
mutable displayHeight?: int,
mutable colorSpace?: videoColorSpaceInit,
}

Record fields

codedWidth
int
codedHeight
int
timestamp
int
duration
option<int>
layout
option<array<planeLayout>>
visibleRect
option<domRectInit>
displayWidth
option<int>
displayHeight
option<int>
colorSpace

videoFrameCopyToOptions

type videoFrameCopyToOptions = {
mutable rect?: domRectInit,
mutable layout?: array<planeLayout>,
mutable format?: videoPixelFormat,
mutable colorSpace?: predefinedColorSpace,
}

Record fields

rect
option<domRectInit>
layout
option<array<planeLayout>>
format
colorSpace

videoFrameInit

type videoFrameInit = {
mutable duration?: int,
mutable timestamp?: int,
mutable alpha?: alphaOption,
mutable visibleRect?: domRectInit,
mutable displayWidth?: int,
mutable displayHeight?: int,
}

Record fields

duration
option<int>
timestamp
option<int>
alpha
option<alphaOption>
visibleRect
option<domRectInit>
displayWidth
option<int>
displayHeight
option<int>

videoMatrixCoefficients

type videoMatrixCoefficients =
| @as("bt470bg") Bt470bg
| @as("bt709") Bt709
| @as("rgb") Rgb
| @as("smpte170m") Smpte170m

videoPixelFormat

type videoPixelFormat =
| BGRA
| BGRX
| I420
| I420A
| I422
| I444
| NV12
| RGBA
| RGBX

videoTransferCharacteristics

type videoTransferCharacteristics =
| @as("bt709") Bt709
| @as("iec61966-2-1") Iec6196621
| @as("smpte170m") Smpte170m

window

type window = private {}

windowPostMessageOptions

type windowPostMessageOptions = {
mutable transfer?: array<Dict.t<string>>,
mutable targetOrigin?: string,
}

Record fields

transfer
option<array<Dict.t<string>>>
targetOrigin
option<string>

xPathNSResolver

type xPathNSResolver

Values

window

let window: window