MutationRecord object
Represents a single mutation that occurred on the element(s) being observed.
![]() |
Syntax
function mutationObjectCallback(mutationRecordsList) {
mutationRecordsList.forEach(function(mutationRecord) {
console.log("Type of mutation: " + mutationRecord.type);
});
}
DOM Information
Inheritance Hierarchy
The MutationRecord does not inherit from any class or interface.Members
The MutationRecord object has these types of members:
Properties
The MutationRecord object has these properties.
| Property | Access type | Description |
|---|---|---|
|
Read-only |
Retrieves an array of nodes that were added. The array may be empty. | |
|
Read-only |
Retrieves the name of the attribute that was added, removed, or changed (or null otherwise). | |
|
Read-only |
Retrieves the namespace of the attribute that was added, removed, or changed (or null otherwise). | |
|
Read-only |
Retrieves the next sibling of the node that was added or removed, or null if none exists (or if MutationRecord.type is not childList) | |
|
Read-only |
Retrieves the previous value of the attribute or characterData that was mutated (or null otherwise).. | |
|
Read-only |
Retrieves the previous sibling of the node that was added or removed, or null if none exists (or if MutationRecord.type is not childList) | |
|
Read-only |
Retrieves an array of nodes that were removed. The array may be empty. | |
|
Read-only |
Retrieves the node on which the MutationRecord was logged. | |
|
Retrieves the type of mutation represented by the MutationRecord. |
Remarks
Each MutationObserver instance maintains an array of MutationRecords which is passed as the first parameter whenever the MutationObserver's callback function is invoked.
The MutationObserver's array of MutationRecords will accumulate all relevant changes until the MutationObserver.takeRecords method is called, which empties the queue and returns the records that were previously there.
See also
