ShadowRoot
Types
getRootNodeOptions
type getRootNodeOptions = {mutable composed?: bool}Record fields
composed
t
type t = WebAPI.DOMTree.shadowRoot = { 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.htmlElement>, 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>, mode: WebAPI.DOMTree.shadowRootMode, delegatesFocus: bool, slotAssignment: WebAPI.DOMTree.slotAssignmentMode, clonable: bool, serializable: bool, host: WebAPI.DOMTree.element, mutable innerHTML: string, styleSheets: WebAPI.StyleSheetList.t, mutable adoptedStyleSheets: array< WebAPI.StyleSheet.cssStyleSheet, >, fullscreenElement: Null.t<WebAPI.DOMTree.element>, activeElement: Null.t<WebAPI.DOMTree.element>, pictureInPictureElement: Null.t<WebAPI.DOMTree.element>, pointerLockElement: Null.t<WebAPI.DOMTree.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
fullscreenElement
Returns document's fullscreen element. 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
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>,) => unitappend
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: (t, WebAPI.DOMTree.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: (t, string) => unitasDocumentFragment
let asDocumentFragment: t => WebAPI.DOMTree.documentFragmentasEventTarget
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) => boolgetAnimations
let getAnimations: WebAPI.DOMTree.shadowRoot => array<WebAPI.Animation.t>getElementById
Returns the first element within node's descendants whose ID is elementId. Read more on MDN
let getElementById: (t, string) => Null.t<WebAPI.DOMTree.element>getHTML
let getHTML: ( WebAPI.DOMTree.shadowRoot, ~options: WebAPI.HTML.getHTMLOptions=?,) => stringgetRootNode
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 => unitprepend
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: (t, WebAPI.DOMTree.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: (t, string) => unitquerySelector
Returns the first element that is a descendant of node that matches selectors. Read more on MDN
let querySelector: (t, string) => Null.t<WebAPI.DOMTree.element>querySelectorAll
Returns all element descendants of node that match selectors. Read more on MDN
let querySelectorAll: (t, string) => WebAPI.DOM.nodeList<WebAPI.DOMTree.element>removeEventListener
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) => '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: (t, WebAPI.DOMTree.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: (t, string) => unitsetHTMLUnsafe
let setHTMLUnsafe: (WebAPI.DOMTree.shadowRoot, string) => unit