diff --git a/images/event-inheritance.svg b/images/event-inheritance.svg
index a09c6ae..2559c57 100644
--- a/images/event-inheritance.svg
+++ b/images/event-inheritance.svg
@@ -51,7 +51,7 @@
Initializing all the attributes of a MutationEvent requires calls to two initializer methods:
- initEvent
and initMutationEvent
.
+
Initializing all the attributes of a UIEvent requires calls to two initializer methods:
+ initEvent
and initUIEvent
.
DOMAttrModified
Element
MutationEvent
DOMCharacterDataModified
Text
, Comment
, ProcessingInstruction
MutationEvent
DOMFocusIn
DOMNodeInserted
Element
, Attr
, Text
, Comment
, DocumentType
,
- ProcessingInstruction
MutationEvent
DOMNodeInsertedIntoDocument
Element
, Attr
, Text
, Comment
, DocumentType
,
- ProcessingInstruction
MutationEvent
DOMNodeRemoved
Element
, Attr
, Text
, Comment
, DocumentType
,
- ProcessingInstruction
MutationEvent
DOMNodeRemovedFromDocument
Element
, Attr
, Text
, Comment
, DocumentType
,
- ProcessingInstruction
MutationEvent
DOMSubtreeModified
Window
, Document
, DocumentFragment
, Element
, Attr
- MutationEvent
keypress
keypress
e
- MutationEvent
eventsThe mutation and mutation name event modules are designed to allow notification of any - changes to the structure of a document, including attribute, text, or name modifications. -
- -Note:
- None of the event types associated with the MutationEvent
interface 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 resulting 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 dispatched. - 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. -
- -Warning!
-The MutationEvent interface was introduced in - DOM Level 2 Events, but has not yet been completely and interoperably implemented across - user agents. - In addition, there have been critiques that the interface, as designed, introduces a - performance and implementation challenge. -
-DOM4 [DOM4] provides a new mechanism using a
- MutationObserver
interface which addresses the use cases that mutation events
- solve, but in a more performant manner.
- Thus, this specification describes mutation events for reference and completeness of legacy
- behavior, but deprecates the use of the
- MutationEvent
interface.
-
Introduced in DOM Level 2, deprecated in this specification
- -The MutationEvent
interface provides specific contextual information associated
- with Mutation events.
-
To create an instance of the MutationEvent
interface, use the
- DocumentEvent.createEvent("MutationEvent")
- method call.
-
The Attr
was modified in place.
The Attr
was just added.
The Attr
was just removed.
relatedNode
MUST be used to identify a secondary node related to a
- mutation event.
- For example, if a mutation event is dispatched to a node indicating that its parent
- has changed, the relatedNode
will be the changed parent.
- If an event is instead dispatched to a subtree indicating a node was changed
- within it, the relatedNode
MUST be the changed node.
- In the case of the
- DOMAttrModified
- event, it indicates the Attr
node which was modified, added, or removed.
-
The un-initialized value of
- this attribute MUST be null
.
-
prevValue
indicates the previous value of the Attr
node
- in DOMAttrModified
- events, and of the CharacterData
node in
- DOMCharacterDataModified
- events.
-
The un-initialized value of this
- attribute MUST be ""
(the empty string).
-
newValue
indicates the new value of the Attr
node in
- DOMAttrModified
- events, and of the CharacterData
node in
- DOMCharacterDataModified
- events.
-
The un-initialized value of this
- attribute MUST be ""
(the empty string).
-
attrName
indicates the name of the changed Attr
node in
- a DOMAttrModified
- event.
-
The un-initialized value of this
- attribute MUST be ""
(the empty string).
-
attrChange
indicates the type of change which triggered the
- DOMAttrModified
- event. The values can be MODIFICATION
, ADDITION
,
- or REMOVAL
.
-
The un-initialized value of this
- attribute MUST be 0
.
-
Note: - There is no defined constant for the attrChange value of 0 (the un-initialized value). -
-Initializes attributes of a MutationEvent
object.
- This method has the same behavior as Event.initEvent()
.
-
Refer to the Event.initEvent()
method for a description of this parameter.
Refer to the Event.initEvent()
method for a description of this parameter.
Refer to the Event.initEvent()
method for a description of this parameter.
Specifies MutationEvent.relatedNode
.
Specifies MutationEvent.prevValue
.
- This value MAY be the empty string.
-
Specifies MutationEvent.newValue
.
- This value MAY be the empty string.
-
Specifies MutationEvent.attrName
.
- This value MAY be the empty string.
-
Specifies MutationEvent.attrChange
.
- This value MAY be 0
.
-
The mutation event types are listed below.
- - -DOMAttrModified
Type | -DOMAttrModified |
-
---|---|
Interface | -MutationEvent |
-
Sync / Async | -Sync | -
Bubbles | -Yes | -
Trusted Targets | -Element |
-
Cancelable | -No | -
Default action | -None | -
Context (trusted events) |
-
-
|
-
A user agent MUST dispatch this event after
- an Attr.value
has been modified and after an Attr
node has been
- added to or removed from an Element
.
- The event target of this event MUST be
- the Element
node where the change occurred.
- It is implementation dependent whether this event type occurs when the children of the
- Attr
node are changed in ways that do not affect the value of Attr.value
.
-
Warning!
- The DOMAttrModified
- event type is defined in this specification for reference and completeness, but this
- specification deprecates the use of this event type.
-
DOMCharacterDataModified
Type | -DOMCharacterDataModified |
-
---|---|
Interface | -MutationEvent |
-
Sync / Async | -Sync | -
Bubbles | -Yes | -
Trusted Targets | -Text , Comment , ProcessingInstruction |
-
Cancelable | -No | -
Default action | -None | -
Context (trusted events) |
-
-
|
-
A user agent MUST dispatch this event
- after CharacterData.data
or ProcessingInstruction.data
- have been modified, but the node itself has not been inserted or deleted.
- The event target of this event MUST
- be the CharacterData
node or the ProcessingInstruction
node.
-
Warning!
- The DOMCharacterDataModified
- event type is defined in this specification for reference and completeness, but this specification
- deprecates the use of this event type.
-
DOMNodeInserted
Type | -DOMNodeInserted |
-
---|---|
Interface | -MutationEvent |
-
Sync / Async | -Sync | -
Bubbles | -Yes | -
Trusted Targets | -Element , Attr , Text , Comment , DocumentType ,
- ProcessingInstruction |
-
Cancelable | -No | -
Default action | -None | -
Context (trusted events) |
-
-
|
-
A user agent MUST dispatch this event type when
- a node other than an Attr
node has been added as a child of another node.
- A user agent MAY dispatch this event when
- an Attr
node has been added to an Element
node
- (see note below).
- This event MUST be dispatched after the insertion has taken place.
- The event target of this event MUST be the
- node being inserted.
-
Note:
- For detecting attribute insertion, use the
- DOMAttrModified
- event type instead.
-
Warning!
- The DOMNodeInserted
event
- type is defined in this specification for reference and completeness, but this specification
- deprecates the use of this event type.
-
DOMNodeInsertedIntoDocument
Type | -DOMNodeInsertedIntoDocument |
-
---|---|
Interface | -MutationEvent |
-
Sync / Async | -Sync | -
Bubbles | -No | -
Trusted Targets | -Element , Attr , Text , Comment , DocumentType ,
- ProcessingInstruction |
-
Cancelable | -No | -
Default action | -None | -
Context (trusted events) |
-
-
|
-
A user agent MUST dispatch this event when a node
- has been inserted into a document, either through direct insertion of the node or insertion of a
- subtree in which it is contained.
- A user agent MAY treat an Attr
- node as part of an Element
's subtree.
- This event MUST be dispatched after the insertion has taken place.
- The event target of this event MUST be the node
- being inserted.
- If the node is being directly inserted, the event type
- DOMNodeInserted
- MUST occur before this event type.
-
Warning!
- The DOMNodeInsertedIntoDocument
- event type is defined in this specification for reference and completeness, but this specification
- deprecates the use of this event type.
-
DOMNodeRemoved
Type | -DOMNodeRemoved |
-
---|---|
Interface | -MutationEvent |
-
Sync / Async | -Sync | -
Bubbles | -Yes | -
Trusted Targets | -Element , Attr , Text , Comment , DocumentType ,
- ProcessingInstruction |
-
Cancelable | -No | -
Default action | -None | -
Context (trusted events) |
-
-
|
-
A user agent MUST dispatch this event when a node
- other than an Attr
node is being removed from its parent node.
- A user agent MAY dispatch this event when an
- Attr
node is being removed from its ownerElement
- (see note below).
- This event MUST be dispatched before the removal takes place. The
- event target of this event MUST be the node being removed.
-
Note:
- For reliably detecting attribute removal, use the
- DOMAttrModified
- event type instead.
-
Warning!
- The DOMNodeRemoved
event type
- is defined in this specification for reference and completeness, but this specification
- deprecates the use of this event type.
-
DOMNodeRemovedFromDocument
Type | -DOMNodeRemovedFromDocument |
-
---|---|
Interface | -MutationEvent |
-
Sync / Async | -Sync | -
Bubbles | -No | -
Trusted Targets | -Element , Attr , Text , Comment , DocumentType ,
- ProcessingInstruction |
-
Cancelable | -No | -
Default action | -None | -
Context (trusted events) |
-
-
|
-
A user agent MUST dispatch this event when a node is
- being removed from a document, either through direct removal of the node or removal of a subtree in
- which it is contained.
- A user agent MAY treat an Attr
- node as part of an Element
's subtree.
- This event MUST be dispatched before the removal takes place.
- The event target of this event type MUST be the node
- being removed.
- If the node is being directly removed, the event type
- DOMNodeRemoved
- MUST occur before this event type.
-
Note:
- For reliably detecting attribute removal, use the
- DOMAttrModified
- event type instead.
-
Warning!
- The DOMNodeRemovedFromDocument
- event type is defined in this specification for reference and completeness, but this specification
- deprecates the use of this event type.
-
DOMSubtreeModified
Type | -DOMSubtreeModified |
-
---|---|
Interface | -MutationEvent |
-
Sync / Async | -Sync | -
Bubbles | -Yes | -
Trusted Targets | -Window , Document , DocumentFragment , Element , Attr
- |
-
Cancelable | -No | -
Default action | -None | -
Context (trusted events) |
-
-
|
-
This is a general event for notification of all changes to the document. - It can be used instead of the more specific mutation and mutation name events. - It MAY be dispatched after a single modification to the document or, at the implementation's - discretion, after multiple changes have occurred. - The latter case SHOULD generally be used to accommodate multiple changes which occur either - simultaneously or in rapid succession. - The target of this event MUST be the lowest common parent of the changes which have taken place. - This event MUST be dispatched after any other events caused by the mutation(s) have occurred. -
- -Warning!
- The DOMSubtreeModified
event
- type is defined in this specification for reference and completeness, but this specification
- deprecates the use of this event type.
-
initEvent
and
-initMutationEvent
.
+initUIEvent
.
Element
| UIEvent | Yes | Yes | None |
-+| DOMAttrModified | Sync | Yes | Element
| MutationEvent | No | No | None |
-+| DOMCharacterDataModified | Sync | Yes | Text
, | MutationEvent | No | No | None |
- | | | | Comment
, | | | | |
- | | | | ProcessingInstruction
| | | | |
+| DOMFocusIn | Sync | Yes | Window
, | FocusEvent | No | Yes | None |
| | | | Element
| | | | |
+| DOMFocusOut | Sync | Yes | Window
, | FocusEvent | No | Yes | None |
| | | | Element
| | | | |
-+| DOMNodeInserted | Sync | Yes | Element
, Attr
, | MutationEvent | No | No | None |
- | | | | Text
, Comment
, | | | | |
- | | | | DocumentType
, | | | | |
- | | | | ProcessingInstruction
| | | | |
-+| DOMNodeInsertedIntoDocument | Sync | No | Element
, Attr
, | MutationEvent | No | No | None |
- | | | | Text
, Comment
, | | | | |
- | | | | DocumentType
, | | | | |
- | | | | ProcessingInstruction
| | | | |
-+| DOMNodeRemoved | Sync | Yes | Element
, Attr
, | MutationEvent | No | No | None |
- | | | | Text
, Comment
, | | | | |
- | | | | DocumentType
, | | | | |
- | | | | ProcessingInstruction
| | | | |
-+| DOMNodeRemovedFromDocument | Sync | No | Element
, Attr
, | MutationEvent | No | No | None |
- | | | | Text
, Comment
, | | | | |
- | | | | DocumentType
, | | | | |
- | | | | ProcessingInstruction
| | | | |
-+| DOMSubtreeModified | Sync | Yes | Window
, | MutationEvent | No | No | None |
- | | | | Document
, | | | | |
- | | | | DocumentFragment
, | | | | |
- | | | | Element
, Attr
| | | | |
+| keypress | Sync | Yes | Element
| KeyboardEvent | Yes | Yes | Varies: launch text composition system; |
| | | | | | | | EVENT{blur} and EVENT{focus} events; |
| | | | | | | | EVENT{DOMActivate} event; other event |
@@ -533,731 +509,4 @@ interface TextEvent : UIEvent {
Issue: See Text Event section in UI Events Algorithms for the {{TextEvent}} interface and the textInput event.
-
-- None of the event types associated with the {{MutationEvent}} interface 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 resulting 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 dispatched. 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. - -- The {{MutationEvent}} interface was introduced in DOM Level 2 Events, but - has not yet been completely and interoperably implemented across user - agents. In addition, there have been critiques that the interface, as - designed, introduces a performance and implementation challenge. -
-
- DOM4 [[!DOM]] provides a new mechanism using a
- MutationObserver
interface which addresses the use cases that
- mutation events solve, but in a more performant manner. Thus, this
- specification describes mutation events for reference and completeness of
- legacy behavior, but deprecates the use of the {{MutationEvent}}
- interface.
-
Introduced in DOM Level 2, deprecated in this - specification
- - TheMutationEvent
interface provides specific contextual
- information associated with Mutation events.
-
- To create an instance of the MutationEvent
interface, use
- the {{Document/createEvent()}} method call.
-
- - [Exposed=Window] - interface MutationEvent : Event { - // attrChangeType - const unsigned short MODIFICATION = 1; - const unsigned short ADDITION = 2; - const unsigned short REMOVAL = 3; - - readonly attribute Node? relatedNode; - readonly attribute DOMString prevValue; - readonly attribute DOMString newValue; - readonly attribute DOMString attrName; - readonly attribute unsigned short attrChange; - - undefined initMutationEvent(DOMString typeArg, - optional boolean bubblesArg = false, - optional boolean cancelableArg = false, - optional Node? relatedNodeArg = null, - optional DOMString prevValueArg = "", - optional DOMString newValueArg = "", - optional DOMString attrNameArg = "", - optional unsigned short attrChangeArg = 0); - }; -- -
Attr
was modified in place.
- Attr
was just added.
- Attr
was just removed.
- relatedNode
MUST be used to identify a secondary
- node related to a mutation event. For example, if a mutation
- event is dispatched to a node indicating that its parent has
- changed, the relatedNode
will be the changed
- parent. If an event is instead dispatched to a subtree
- indicating a node was changed within it, the
- relatedNode
MUST be the changed node. In the case
- of the EVENT{DOMAttrModified} event, it indicates the
- Attr
node which was modified, added, or removed.
-
- The un-initialized value of this attribute MUST be
- null
.
- prevValue
indicates the previous value of the
- Attr
node in EVENT{DOMAttrModified} events, and of
- the CharacterData
node in
- EVENT{DOMCharacterDataModified} events.
-
- The un-initialized value of this attribute MUST be
- ""
(the empty string).
- newValue
indicates the new value of the
- Attr
node in EVENT{DOMAttrModified} events, and of
- the CharacterData
node in
- EVENT{DOMCharacterDataModified} events.
-
- The un-initialized value of this attribute MUST be
- ""
(the empty string).
- attrName
indicates the name of the changed
- Attr
node in a EVENT{DOMAttrModified} event.
-
- The un-initialized value of this attribute MUST be
- ""
(the empty string).
- attrChange
indicates the type of change which
- triggered the EVENT{DOMAttrModified} event. The values can be
- MODIFICATION
, ADDITION
, or
- REMOVAL
.
-
- The un-initialized value of this attribute MUST be
- 0
.
-
- - There is no defined constant for the attrChange value of 0 (the - un-initialized value). -
-MutationEvent
object.
- This method has the same behavior as {{Event/initEvent()}}.
-
- relatedNode
.
- prevValue
. This value MAY be the empty string.
- newValue
.
- This value MAY be the empty string.
- attrName
.
- This value MAY be the empty string.
- attrChange
.
- This value MAY be 0
.
- Type | -DOMAttrModified |
-
---|---|
Interface | -{{MutationEvent}} | -
Sync / Async | -Sync | -
Bubbles | -Yes | -
Trusted Targets | -Element |
-
Cancelable | -No | -
Composed | -No | -
Default action | -None | -
Context (trusted events) |
-
-
|
-
Attr.value
has been modified and after an
- Attr
node has been added to or removed from an
- Element
. The event target of this event MUST be
- the Element
node where the change occurred. It is
- implementation dependent whether this event type occurs when the
- children of the Attr
node are changed in ways that do
- not affect the value of Attr.value
.
-
- - The EVENT{DOMAttrModified} event type is defined in this - specification for reference and completeness, but this specification - deprecates the use of this event type. -
- -Type | -DOMCharacterDataModified |
-
---|---|
Interface | -{{MutationEvent}} | -
Sync / Async | -Sync | -
Bubbles | -Yes | -
Trusted Targets | -Text , Comment , ProcessingInstruction |
-
Cancelable | -No | -
Composed | -No | -
Default action | -None | -
Context (trusted events) |
-
-
|
-
CharacterData.data
or
- ProcessingInstruction.data
have been modified, but the
- node itself has not been inserted or deleted. The event
- target of this event MUST be the CharacterData
node
- or the ProcessingInstruction
node.
-
- - The EVENT{DOMCharacterDataModified} event type is defined in this - specification for reference and completeness, but this specification - deprecates the use of this event type. -
- -Type | -DOMNodeInserted |
-
---|---|
Interface | -{{MutationEvent}} | -
Sync / Async | -Sync | -
Bubbles | -Yes | -
Trusted Targets | -Element , Attr , Text , Comment , DocumentType ,
- ProcessingInstruction |
-
Cancelable | -No | -
Composed | -No | -
Default action | -None | -
Context (trusted events) |
-
-
|
-
Attr
node has been added as a child of another
- node. A user agent MAY dispatch this event when an
- Attr
node has been added to an Element
- node (see note below). This
- event MUST be dispatched after the insertion has taken place. The
- event target of this event MUST be the node being inserted.
-
- - For detecting attribute insertion, use the EVENT{DOMAttrModified} - event type instead. -
- -- The EVENT{DOMNodeInserted} event type is defined in this - specification for reference and completeness, but this specification - deprecates the use of this event type. -
- -Type | -DOMNodeInsertedIntoDocument |
-
---|---|
Interface | -{{MutationEvent}} | -
Sync / Async | -Sync | -
Bubbles | -No | -
Trusted Targets | -Element , Attr , Text , Comment , DocumentType ,
- ProcessingInstruction |
-
Cancelable | -No | -
Composed | -No | -
Default action | -None | -
Context (trusted events) |
-
-
|
-
Attr
node as part of an
- Element
's subtree. This event MUST be dispatched after
- the insertion has taken place. The event target of this event
- MUST be the node being inserted. If the node is being directly
- inserted, the event type EVENT{DOMNodeInserted} MUST occur before
- this event type.
-
- - The EVENT{DOMNodeInsertedIntoDocument} event type is defined in this - specification for reference and completeness, but this specification - deprecates the use of this event type. -
- -Type | -DOMNodeRemoved |
-
---|---|
Interface | -{{MutationEvent}} | -
Sync / Async | -Sync | -
Bubbles | -Yes | -
Trusted Targets | -Element , Attr , Text , Comment , DocumentType ,
- ProcessingInstruction |
-
Cancelable | -No | -
Composed | -No | -
Default action | -None | -
Context (trusted events) |
-
-
|
-
Attr
node is being removed from its parent node. A
- user agent MAY dispatch this event when an Attr
- node is being removed from its ownerElement
(see note below). This event MUST be
- dispatched before the removal takes place. The event target
- of this event MUST be the node being removed.
-
- - For reliably detecting attribute removal, use the - EVENT{DOMAttrModified} event type instead. -
- -- The EVENT{DOMNodeRemoved} event type is defined in this - specification for reference and completeness, but this specification - deprecates the use of this event type. -
- -Type | -DOMNodeRemovedFromDocument |
-
---|---|
Interface | -{{MutationEvent}} | -
Sync / Async | -Sync | -
Bubbles | -No | -
Trusted Targets | -Element , Attr , Text , Comment , DocumentType ,
- ProcessingInstruction |
-
Cancelable | -No | -
Composed | -No | -
Default action | -None | -
Context (trusted events) |
-
-
|
-
Attr
node as part of an
- Element
's subtree. This event MUST be dispatched before
- the removal takes place. The event target of this event type
- MUST be the node being removed. If the node is being directly
- removed, the event type EVENT{DOMNodeRemoved} MUST occur before this
- event type.
-
- - For reliably detecting attribute removal, use the - EVENT{DOMAttrModified} event type instead. -
- -- The EVENT{DOMNodeRemovedFromDocument} event type is defined in this - specification for reference and completeness, but this specification - deprecates the use of this event type. -
- -Type | -DOMSubtreeModified |
-
---|---|
Interface | -{{MutationEvent}} | -
Sync / Async | -Sync | -
Bubbles | -Yes | -
Trusted Targets | -Window , Document , DocumentFragment , Element , Attr
- |
-
Cancelable | -No | -
Composed | -No | -
Default action | -None | -
Context (trusted events) |
-
-
|
-
- The EVENT{DOMSubtreeModified} event type is defined in this - specification for reference and completeness, but this specification - deprecates the use of this event type. -
-