Table of contents
Appendices
|
1.4 Event types
Event types
Each event is associated with a type, called event
type. The event type is composed of a local name and a namespace URI as defined in
[Namespaces]. All events defined in this
specification use the namespace URI "http://www.w3.org/2001/xml-events".
NOTE:
As in [DOMCore], DOM Level 3
Events does not perform any URI normalization or
canonicalization. The URIs given to the DOM are assumed to be
valid (e.g., characters such as white spaces are properly
escaped), and no lexical checking is performed. Absolute URI
references are treated as strings and compared literally. How
relative namespace URI references are treated is undefined. To
ensure interoperability only absolute namespace URI references
(i.e., URI references beginning with a scheme name and a colon)
should be used. Applications that wish to have no namespace
should use the value null as the namespaceURI
parameter of methods. If they pass an empty string the DOM
implementation turns it into a null.
Complete list of event types[top]
Complete list of event types
Depending on the level of DOM support, or the devices used to
display (e.g. screen) or interact with (e.g. mouse, keyboard,
touch screen, voice, ...), these event types could be generated by
the implementation. When used with an [XML] or [HTML40] application, the specifications of those
languages may restrict the semantics and scope (in particular the
possible target nodes) associated with an event type. For
example, {"http://www.w3.org/2001/xml-events", "click"} can be targeted to all
[XHTML10] elements but applet,
base, basefont, bdo, br, font, frame, frameset, head, html,
iframe, isindex, meta, param, script, style, and title. Refer to
the specification defining the language used in order to find
those restrictions or to find event types that are not defined
in this document.
The following table defines all event types provided in this
specification (with the exception of two event types preserved
for backward compatibility with [HTML40]). All events will accomplish the capture phase
and target phases, but not all of them will accomplish the
bubbling phase (see also [DOM event flow]). Some
events are not cancelable event (see [Default actions and cancelable events]). Contextual information related
to the event type are accessible using DOM interfaces.
This table contains the complete list of event types defined by DOM Level 3 Events. The first column contains the name of the event type. The second column contains the definition of of the event type. The third column indicates if the event accomplish the bubbling phase or not (all events accomplish the capture and target phases). The fourth column indicates if the default action associated with the event can be canceled. The fifth column indicates the nodes that can be target of the event. the sixth (and last) column indicates the DOM interface implemented by the event object.00
Event type
Description
Bubbling phase
Cancelable
Target node
DOM interface
11"http://www.w3.org/2001/xml-events", "DOMActivate" |
11
An element is activated, for instance, using a mouse
device, a keyboard device, or a voice command.
NOTE:
The activation of an element is device dependent but
is also application dependent, e.g. a link in a
document can be activated using a mouse click or a
mouse double click.
|
11Yes |
11Yes |
11Element |
11UIEvent |
11"http://www.w3.org/2001/xml-events", "DOMFocusIn" |
11
An event target
receives focus, for instance via a pointing device being
moved onto an element or using keyboard navigation.
|
11Yes |
11No |
11Element |
11UIEvent |
11"http://www.w3.org/2001/xml-events", "DOMFocusOut" |
11
A event target
loses focus, for instance via a pointing device being
moved out of an element or by tabbing navigation out of
the element.
|
11Yes |
11No |
11Element |
11UIEvent |
11"http://www.w3.org/2001/xml-events", "textInput" |
11
One or more characters have been entered. The characters
can originate from a variety of sources. For example, it
could be a character resulting from a key being pressed or
released on a keyboard device, a character resulting
from the processing of an Input Method Editor, or resulting from a voice
command.
|
11Yes |
11Yes |
11Element |
11TextEvent |
11"http://www.w3.org/2001/xml-events", "click" |
11
A pointing device button is clicked over an element. The
definition of a click depends on the environment
configuration; i.e. may depend on the screen location or
the delay between the press and release of the pointing
device button. In any case, the target node must be the
same between the mousedown, mouseup, and click. The
sequence of these events is: {"http://www.w3.org/2001/xml-events",
"mousedown"}, {"http://www.w3.org/2001/xml-events",
"mouseup"}, and {"http://www.w3.org/2001/xml-events",
"click"}. Note that, given the definition of a
click, If one or more of the event types
{"http://www.w3.org/2001/xml-events", "mouseover"},
{"http://www.w3.org/2001/xml-events", "mousemove"}, and
{"http://www.w3.org/2001/xml-events", "mouseout"} occur between
the press and release of the pointing device button, the
event type {"http://www.w3.org/2001/xml-events", "click"} cannot
occur. In the case of nested elements, this event type is
always targeted at the most deeply nested element.
|
11Yes |
11Yes |
11Element |
11MouseEvent |
11"http://www.w3.org/2001/xml-events", "mousedown" |
11
A pointing device button is pressed over an element. In
the case of nested elements, this event type is always
targeted at the most deeply nested element.
|
11Yes |
11Yes |
11Element |
11MouseEvent |
11"http://www.w3.org/2001/xml-events", "mouseup" |
11
A pointing device button is released over an element. In
the case of nested elements, this event type is always
targeted at the most deeply nested element.
|
11Yes |
11Yes |
11Element |
11MouseEvent |
11"http://www.w3.org/2001/xml-events", "mouseover" |
11
A pointing device is moved onto an element. In the case
of nested elements, this event type is always targeted at
the most deeply nested element.
|
11Yes |
11Yes |
11Element |
11MouseEvent |
11"http://www.w3.org/2001/xml-events", "mousemove" |
11
A pointing device is moved while it is over an
element. In the case of nested elements, this event type
is always targeted at the most deeply nested element.
|
11Yes |
11Yes |
11Element |
11MouseEvent |
11"http://www.w3.org/2001/xml-events", "mouseout" |
11
A pointing device is moved away from an element. In the
case of nested elements, this event type is always
targeted at the most deeply nested element.
|
11Yes |
11Yes |
11Element |
11MouseEvent |
11"http://www.w3.org/2001/xml-events", "keydown" |
11
A key is pressed down. This event type is device dependent
and relies on the capabilities of the input devices and
how they are mapped in the operating system. This event
type is generated after the keyboard mapping but before
the processing of the Input Method Editor. This event should logically happen before
the event {"http://www.w3.org/2001/xml-events", "keyup"} is
produced.
|
11Yes |
11Yes |
11Element |
11KeyboardEvent |
11"http://www.w3.org/2001/xml-events", "keyup" |
11
A key is released. This event type is device dependent and
relies on the capabilities of the input devices and how
they are mapped in the operating system. This event type
is generated after the keyboard mapping but before the
processing of the Input Method Editor. This event should logically happen after
the event {"http://www.w3.org/2001/xml-events", "keydown"} is
produced.
|
11Yes |
11Yes |
11Element |
11KeyboardEvent |
11"http://www.w3.org/2001/xml-events", "DOMSubtreeModified" |
11
This is a general event for notification of all changes
to the document. It can be used instead of the more
specific events listed below. It may be dispatched after
a single modification to the document or, at the
implementation's discretion, after multiple changes have
occurred. The latter use should generally be used to
accommodate multiple changes which occur either
simultaneously or in rapid succession. The target of
this event is the lowest common parent of the changes
which have taken place. This event is dispatched after
any other events caused by the mutation(s) have occurred.
|
11Yes |
11No |
11
Document, DocumentFragment,
Element, Attr
|
11MutationEvent |
11"http://www.w3.org/2001/xml-events", "DOMNodeInserted" |
11
A node has been added as a child of another node. This event
is dispatched after the insertion has taken place. The
target node of
this event is the node being inserted.
|
11Yes |
11No |
11Element, Attr,
Text, Comment,
CDATASection, DocumentType,
EntityReference, ProcessingInstruction |
11MutationEvent |
11"http://www.w3.org/2001/xml-events", "DOMNodeRemoved" |
11
A node is being removed from its parent node. This event
is dispatched before the node is removed from the tree.
The target node of
this event is the node being removed.
|
11Yes |
11No |
11Element, Attr,
Text, Comment,
CDATASection, DocumentType,
EntityReference, ProcessingInstruction |
11MutationEvent |
11"http://www.w3.org/2001/xml-events", "DOMNodeRemovedFromDocument" |
11
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. This event is dispatched before the
removal takes place. The target node of this event
type is the node being removed. If the node is being
directly removed, the event type {"http://www.w3.org/2001/xml-events",
"DOMNodeRemoved"} will fire before this event type.
|
11No |
11No |
11Element, Attr,
Text, Comment,
CDATASection, DocumentType,
EntityReference, ProcessingInstruction |
11MutationEvent |
11"http://www.w3.org/2001/xml-events", "DOMNodeInsertedIntoDocument" |
11
A node is being inserted into a document, either through
direct insertion of the node or insertion of a subtree in
which it is contained. This event is dispatched after the
insertion has taken place. The target node of this event
is the node being inserted. If the node is being directly
inserted, the event type {"http://www.w3.org/2001/xml-events",
"DOMNodeInserted"} will fire before this event
type.
|
11No |
11No |
11Element, Attr,
Text, Comment,
CDATASection, DocumentType,
EntityReference, ProcessingInstruction |
11MutationEvent |
11"http://www.w3.org/2001/xml-events", "DOMAttrModified" |
11
Occurs after an Attr has been modified on a
node. The target
node of this event is the parent
Element node whose Attr changed.
It is expected that string based replacement of an
Attr value will be viewed as a modification
of the Attr since its identity does not
change. Subsequently replacement of the Attr
node with a different Attr node is viewed as
the removal of the first Attr node and the
addition of the second.
|
11Yes |
11No |
11Element |
11MutationEvent |
11"http://www.w3.org/2001/xml-events", "DOMCharacterDataModified" |
11
Occurs after CharacterData.data or
ProcessingInstruction.data have been modified
but the node itself has not been inserted or deleted. The
target node of
this event is the CharacterData node or the
ProcessingInstruction node.
|
11Yes |
11No |
11
Text, Comment,
CDATASection,
ProcessingInstruction
|
11MutationEvent |
11"http://www.w3.org/2001/xml-events", "DOMElementNameChanged" |
11
Occurs after the namespaceURI and/or the
nodeName of an Element node have
been modified (e.g., the element was renamed using
Document.renameNode). The target of this
event is the renamed Element node.
|
11Yes |
11No |
11
Element
|
11MutationNameEvent |
11"http://www.w3.org/2001/xml-events", "DOMAttributeNameChanged" |
11
Occurs after the namespaceURI and/or the
nodeName of a Attr node have
been modified (e.g., the attribute was renamed using
Document.renameNode). The target of this
event is the parent Element node whose
Attr has been renamed.
|
11Yes |
11No |
11
Element
|
11MutationNameEvent |
11"http://www.w3.org/2001/xml-events", "load" |
11
The DOM Implementation finishes loading in the environment
the document or a resource linked from it.
|
11No |
11No |
11
Element
|
11Event |
11"http://www.w3.org/2001/xml-events", "unload" |
11
The DOM implementation removes from the environment the
document or a resource linked from it.
|
11No |
11No |
11
Element
|
11Event |
11"http://www.w3.org/2001/xml-events", "abort" |
11
The loading of the document, or a resource linked from it,
is stopped before being entirely loaded.
|
11Yes |
11No |
11
Element
|
11Event |
11"http://www.w3.org/2001/xml-events", "error" |
11
The document, or a resource linked from it, has been
loaded but cannot be interpreted according to its
semantic, such as an invalid image or a script execution
error.
|
11Yes |
11No |
11
Element
|
11Event |
11"http://www.w3.org/2001/xml-events", "select" |
11
A user selects some text. DOM Level 3 Events does not
provide contextual information to access the selected
text.
|
11Yes |
11No |
11
Element
|
11Event |
11"http://www.w3.org/2001/xml-events", "change" |
11
A control loses the input focus and its values has been
modified since gaining focus.
|
11Yes |
11No |
11
Element
|
11Event |
11"http://www.w3.org/2001/xml-events", "submit" |
11
A form, such as [HTML40],
[XHTML10], or [XForms10] forms, is submitted.
|
11Yes |
11Yes |
11
Element
|
11Event |
11"http://www.w3.org/2001/xml-events", "reset" |
11
A form, such as [HTML40],
[XHTML10], or [XForms10] forms, is reset.
|
11Yes |
11Yes |
11
Element
|
11Event |
11"http://www.w3.org/2001/xml-events", "resize" |
11
A document view is resized.
|
11Yes |
11No |
11
Document
|
11UIEvent |
11"http://www.w3.org/2001/xml-events", "scroll" |
11
A document view is scrolled.
|
11Yes |
11No |
11
Document
|
11UIEvent |
The event objects associated with the event types described
above may contain context information. Refer to the description
of the DOM interfaces for further information.
Compatibility with DOM Level 2 Events[top]
Compatibility with DOM Level 2 Events
Namespace URIs Were
only introduced in DOM Level 3 Events and were not part of DOM
Level 2 Events. DOM Level 2 Events methods are namespace
ignorant and the event type is only represented by an XML name, specified in the
Event.type attribute.
Therefore, while it is safe to use these methods when not
dealing with namespaces, using them and the new ones at the same
time should be avoided. DOM Level 2 Events methods solely
identify events by their Event.type. On the
contrary, the DOM Level 3 Events methods related to namespaces,
identify attribute nodes by their
Event.namespaceURI and
Event.type. Because of this fundamental difference,
mixing both sets of methods can lead to unpredictable
results. For example, using
EventTarget.addEventListenerNS, two event listeners
(or more) could be registered using the same type
and same useCapture values, but different
namespaceURIs. Calling
EventTarget.removeEventListener with that
type and useCapture could then remove
any or none of those event listeners. The result depends on the
implementation. The only guarantee in such cases is that all
methods which access an event listener by its
namespaceURI and type will access the
same event listener. For instance,
EventTarget.removeEventListenerNS removes the event
that EventTarget.addEventListenerNS added.
For compatibility reasons, the dispatching of an event will
ignore namespace URIs if either the event or the event listener
has a null namespace URI. If a DOM Level 2 event
(i.e. with a null namespace URI) is dispatched in
the DOM tree, all event listeners that match the
type will be triggered as described in the [DOM event flow]. If a DOM Level 3 event (i.e. with a
namespace URI) is dispatched in the DOM tree, all event listener
with the same type and the same or null namespace
URI, will be triggered as described in the [DOM event flow].
|