MutationObserver
Types
mutationObserverCallback
type mutationObserverCallback = ( array<mutationRecord>, t,) => unitmutationObserverInit
type mutationObserverInit = { mutable childList?: bool, mutable attributes?: bool, mutable characterData?: bool, mutable subtree?: bool, mutable attributeOldValue?: bool, mutable characterDataOldValue?: bool, mutable attributeFilter?: array<string>,}Record fields
childList
attributes
characterData
subtree
attributeOldValue
characterDataOldValue
attributeFilter
mutationRecord
Represents an individual DOM mutation. See MutationRecord on MDN
type mutationRecord = { type_: string, target: WebAPI.DOMTree.node, addedNodes: WebAPI.DOM.nodeList<WebAPI.DOMTree.node>, removedNodes: WebAPI.DOM.nodeList<WebAPI.DOMTree.node>, previousSibling: Null.t<WebAPI.DOMTree.node>, nextSibling: Null.t<WebAPI.DOMTree.node>, attributeName: Null.t<string>, attributeNamespace: Null.t<string>, oldValue: Null.t<string>,}Record fields
type_
Returns "attributes" if it was an attribute mutation. "characterData" if it was a mutation to a CharacterData node. And "childList" if it was a mutation to the tree of nodes. Read more on MDN
target
Returns the node the mutation affected, depending on the type. For "attributes", it is the element whose attribute changed. For "characterData", it is the CharacterData node. For "childList", it is the node whose children changed. Read more on MDN
addedNodes
Return the nodes added and removed respectively. Read more on MDN
removedNodes
Return the nodes added and removed respectively. Read more on MDN
previousSibling
Return the previous and next sibling respectively of the added or removed nodes, and null otherwise. Read more on MDN
nextSibling
Return the previous and next sibling respectively of the added or removed nodes, and null otherwise. Read more on MDN
attributeName
Returns the local name of the changed attribute, and null otherwise. Read more on MDN
attributeNamespace
Returns the namespace of the changed attribute, and null otherwise. Read more on MDN
oldValue
The return value depends on type. For "attributes", it is the value of the changed attribute before the change. For "characterData", it is the data of the changed node before the change. For "childList", it is null. Read more on MDN
Values
make
let make: mutationObserverCallback => tobserve
let observe: ( t, ~target: WebAPI.DOMTree.node, ~options: mutationObserverInit=?,) => unittakeRecords
let takeRecords: t => array<mutationRecord>