MutationEvent in DOM Level 2 Events

Provides contextual information associated with a specific Mutation event.

For more information see http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-eventgroupings-mutationevents.

Inherits from:

Instance Properties

name type description
attrChange Number (read only)
attrName String (read only)
bubbles Boolean (read only) [from Event]
cancelable Boolean (read only) [from Event]
currentTarget EventTarget (read only) The object to which the event handler was assigned. [from Event]
eventPhase Number (read only) When/where did the event take place? [from Event]
newValue String (read only)
prevValue String (read only)
relatedNode Node (read only)
target EventTarget (read only) The object which caught the event. [from Event]
timeStamp Number (read only) Date/time that the event occurred. [from Event]
type String (read only) [from Event]

Instance Methods

name returns description
initEvent(eventTypeArg,canBubbleArg,cancelableArg) (none) Initialize the event object prior to dispatching it. [from Event]
initMutationEvent(typeArg,canBubbleArg,cancelableArg,…) (none)
preventDefault() (none) [from Event]
stopPropagation() (none) [from Event]

Constants

name object value description
MODIFICATION MutationEvent 1
ADDITION MutationEvent 2
REMOVAL MutationEvent 3

Description

The mutation event module is designed to allow notification of any changes to the structure of a document, including attr and text modifications. It may be noted that none of the mutation events listed are designated as cancelable. This stems from the fact that it is very difficult to make use of existing DOM interfaces which cause document modifications if any change to the document might or might not take place due to cancelation of the related event. Although this is still a desired capability, it was decided that it would be better left until the addition of transactions into the DOM. Many single modifications of the tree can cause multiple mutation events to be fired. Rather than attempt to specify the ordering of mutation events due to every possible modification of the tree, the ordering of these events is left to the implementation. A DOM application may use the hasFeature(feature, version) method of the DOMImplementation interface with parameter values "MutationEvents" and "2.0" (respectively) to determine whether or not the Mutation event module is supported by the implementation. In order to fully support this module, an implementation must also support the "Events" feature defined in this specification. Note: To create an instance of the MutationEvent interface, use the feature string "MutationEvents" as the value of the eventType parameter passed to createEvent(...).