type property

Retrieves the type of mutation represented by the MutationRecord.

IE11

Syntax

JavaScript

p = object.type

Property values

Type: DOMString

attributes

An attribute changed on the target node.

characterData

The text content (a child text node) value of the target node changed.

childList

A child (or subtree descendent) of the target node was added or removed.

Remarks

If the MutationRecord is of type attributes, you can use its attributeName property to identify the specific attribute that changed. If you registered (via the MutationObserver.observe method) to collect attributeOldValue data on your target node, the oldValue property provides the original attribute value before it was changed.

If the MutationRecord is of type characterData and you registered (via the MutationObserver.observe method) to collect characterDataOldValue data on your target node, the oldValue property provides the original text data before it was changed.

If the MutationRecord is of type childList, you can use the addedNodes and removedNodes properties to inspect the nature of the DOM tree change (including descendent node changes, if subtree was specified as an observe option). The previousSibling and nextSibling properties return the siblings of the node that was changed (or null otherwise).

See also

MutationRecord
MutationObserver

 

 

Show:
© 2014 Microsoft