JavaScript Programmer’s Reference MutationEvent object (Object/DOM) A notification (Remote web server)
JavaScript Programmer’s Reference MutationEvent object (Object/DOM) A notification that the document content has changed should trigger a mutation event which is described in one of these objects. Availability: DOM level 2 JavaScript 1.5 Netscape 6.0 JavaScript syntax: N myMutationEvent = new MutationEvent() Object properties: attrChange, attrName, bubbles, cancelable, currentTarget, eventPhase, newValue, prevValue, relatedNode, target, timeStamp, type Class constants: ADDITION, MODIFICATION, REMOVAL Object methods: stopPropagation() initEvent(), initMutationEvent(), preventDefault(), The availability of the MutationEventobject handling can be determined with the Implementation.hasFeature() method call. These event types are enumerated in the DOM level 2 specification and are: . DOMSubtreeModified . DOMNodeInserted . DOMNodeRemoved . DOMNodeRemovedFromDocument . DOMNodeInsertedIntoDocument . DOMAttrModified . DOMCharacterDataModified The DOM level 2 event module specification doesn’t describe the binding of these events to event handlers so although this event model is implemented in Netscape 6.0, you may need to explore the event naming conventions to make effective use of it. Taking the event names and placing the ‘on’ prefix in front of them and using that as a property name to which you can attach a handler function may work. The DOM level 2 event module also provides an EventListener registration which allows you to register event types with EventTarget objects, using the addEventListener() method. The contextual information is carried in the detail property, and when it is present, will usually describe a reference to a node object or an attribute value. When the document content is modified, a MutationEvent object is instantiated to carry a description of that change to the event handler. Mutation events cannot be cancelled. This is because the DOM interface would become unwieldy if the document changes were not properly completed. This may change later when the DOM standard introduces transaction handling, although the DOM level 2 event specification does not go to great lengths to explain in detail how that is likely to be implemented. 1472