#[1]copyright [2]glossary [3]Start [4]author [5]help
[1] http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/copyright-notice.html
[2] http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/glossary.html
[3] http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/Overview.html
[4] mailto:www-dom@w3.org
[5] http://www.w3.org/DOM/
[6]W3C
[6] http://www.w3.org/
Document Object Model (DOM) Level 3 Events Specification
Version 1.0
W3C Working Group Note 07 November 2003
This version:
[7]http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107
[7] http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107
Latest version:
[8]http://www.w3.org/TR/DOM-Level-3-Events
[8] http://www.w3.org/TR/DOM-Level-3-Events
Previous version:
[9]http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331
[9] http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331
Editors:
Philippe Le Hégaret, W3C
Tom Pixley, Netscape Communications Corporation (until July
2002)
This document is also available in these non-normative formats:
[10]XML file, [11]plain text, [12]PostScript file, [13]PDF file,
[14]single HTML file, and [15]ZIP file.
[10] http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/xml-source.xml
[11] http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/DOM3-Events.txt
[12] http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/DOM3-Events.ps
[13] http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/DOM3-Events.pdf
[14] http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/DOM3-Events.html
[15] http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/DOM3-Events.zip
[16]Copyright ©2003 [17]W3C^® ([18]MIT, [19]ERCIM, [20]Keio), All
Rights Reserved. W3C [21]liability, [22]trademark, [23]document use
and [24]software licensing rules apply.
[16] http://www.w3.org/Consortium/Legal/ipr-notice#Copyright
[17] http://www.w3.org/
[18] http://www.lcs.mit.edu/
[19] http://www.ercim.org/
[20] http://www.keio.ac.jp/
[21] http://www.w3.org/Consortium/Legal/ipr-notice#Legal_Disclaimer
[22] http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks
[23] http://www.w3.org/Consortium/Legal/copyright-documents
[24] http://www.w3.org/Consortium/Legal/copyright-software
_________________________________________________________________
Abstract
This specification defines the Document Object Model Events Level 3, a
generic platform- and language-neutral event system which allows
registration of event handlers, describes event flow through a tree
structure, and provides basic contextual information for each event.
The Document Object Model Events Level 3 builds on the Document Object
Model Events Level 2 [25]DOM Level 2 Events].
Status of this document
This section describes the status of this document at the time of its
publication. Other documents may supersede this document. A list of
current W3C publications and the latest revision of this technical
report can be found in the [26]W3C technical reports index at
http://www.w3.org/TR/.
[26] http://www.w3.org/TR/
This document contains the Document Object Model Level 3 Events
specification and is a [27]W3C Working Group Note. It is based on the
feedback during the [28]Last Call period. The W3C DOM Working Group
participants do not expect to provide interoperable implementations of
this module. Implementation feedbacks are however welcome and have to
be sent to the public mailing list [29]www-dom@w3.org (public
[30]archive). Other W3C Working Groups may continue the work and
provide implementations of this document.
[27] http://www.w3.org/2003/06/Process-20030618/tr.html#WGNote
[28] http://www.w3.org/2002/07/DOM-Level-3-Events-issues/issues.html
[29] mailto:www-dom@w3.org
[30] http://lists.w3.org/Archives/Public/www-dom/
Individuals or organizations are also invited to send a message to the
public mailing list if they intend to produce an implementation of
this module.
Publication as a Working Group Note does not imply endorsement by the
W3C Membership. This is a draft document and may be updated, replaced
or obsoleted by other documents at any time.
This document has been produced as part of the [31]W3C DOM Activity.
The authors of this document are the DOM Working Group members.
[31] http://www.w3.org/DOM/Activity.html
Patent disclosures relevant to this specification may be found on the
DOM Working Group's [32]patent disclosure page.
[32] http://www.w3.org/2002/08/02-DOM-Disclosures.html
Table of contents
* [33]Expanded Table of Contents
* [34]W3C Copyright Notices and Licenses
* [35]1. Document Object Model Events
* [36]Appendix A: Keyboard events and key identifiers
* [37]Appendix B: Changes
* [38]Appendix C: IDL Definitions
* [39]Appendix D: Java Language Binding
* [40]Appendix E: ECMAScript Language Binding
* [41]Appendix F: Acknowledgements
* [42]Glossary
* [43]References
* [44]Index
07 November 2003
Expanded Table of Contents
* [45]Expanded Table of Contents
* [46]W3C Copyright Notices and Licenses
+ [47]W3C^® Document Copyright Notice and License
+ [48]W3C^® Software Copyright Notice and License
+ [49]W3C^® Short Software Notice
* [50]1 Document Object Model Events
+ [51]1.1 Introduction
o [52]1.1.1 Event flows
o [53]1.1.2 Conformance
+ [54]1.2 DOM event flow
o [55]1.2.1 Phases
o [56]1.2.2 Event listeners
+ [57]1.3 Default actions and cancelable events
+ [58]1.4 Event types
o [59]1.4.1 Event types and event categories
o [60]1.4.2 Complete list of event types
o [61]1.4.3 Compatibility with DOM Level 2 Events
+ [62]1.5 Event listener registration
o [63]1.5.1 Using the EventTarget methods
o [64]1.5.2 Using XML Events
o [65]1.5.3 Using VoiceXML Events
o [66]1.5.4 Using XML or HTML attributes
+ [67]1.6 Basic interfaces
o [68]1.6.1 Event creation
+ [69]1.7 Event module definitions
o [70]1.7.1 User Interface event types
o [71]1.7.2 Text events types
o [72]1.7.3 Mouse event types
o [73]1.7.4 Keyboard event types
o [74]1.7.5 Mutation and mutation name event types
o [75]1.7.6 Basic event types
o [76]1.7.7 HTML Events
* [77]Appendix A: Keyboard events and key identifiers
+ [78]A.1 Introduction
o [79]A.1.1 Modifier keys
o [80]A.1.2 Dead keys
o [81]A.1.3 Input Method Editors
o [82]A.1.4 Guidelines for defining key identifiers
+ [83]A.2 Key identifiers set
* [84]Appendix B: Changes
+ [85]B.1 Changes between DOM Level 2 Events and DOM Level 3
Events
o [86]B.1.1 Changes to DOM Level 2 event flow
o [87]B.1.2 Changes to DOM Level 2 event types
o [88]B.1.3 Changes to DOM Level 2 Events interfaces
o [89]B.1.4 New Interfaces
* [90]Appendix C: IDL Definitions
* [91]Appendix D: Java Language Binding
* [92]Appendix E: ECMAScript Language Binding
* [93]Appendix F: Acknowledgements
+ [94]F.1 Production Systems
* [95]Glossary
* [96]References
+ [97]1 Normative references
+ [98]2 Informative references
* [99]Index
07 November 2003
W3C Copyright Notices and Licenses
Copyright © 2003 [100]World Wide Web Consortium, ([101]Massachusetts
Institute of Technology, [102]European Research Consortium for
Informatics and Mathematics, [103]Keio University). All Rights
Reserved.
[100] http://www.w3.org/
[101] http://www.lcs.mit.edu/
[102] http://www.ercim.org/
[103] http://www.keio.ac.jp/
This document is published under the [104]W3C^® Document Copyright
Notice and License. The bindings within this document are published
under the [105]W3C^® Software Copyright Notice and License. The
software license requires "Notice of any changes or modifications to
the W3C files, including the date changes were made." Consequently,
modified versions of the DOM bindings must document that they do not
conform to the W3C standard; in the case of the IDL definitions, the
pragma prefix can no longer be 'w3c.org'; in the case of the Java
language binding, the package names can no longer be in the 'org.w3c'
package.
_________________________________________________________________
W3C^® Document Copyright Notice and License
Note: This section is a copy of the W3C^® Document Notice and License
and could be found at
[106]http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021
231.
[106] http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231
Copyright © 2003 [107]World Wide Web Consortium, ([108]Massachusetts
Institute of Technology, [109]European Research Consortium for
Informatics and Mathematics, [110]Keio University). All Rights
Reserved.
[107] http://www.w3.org/
[108] http://www.lcs.mit.edu/
[109] http://www.ercim.org/
[110] http://www.keio.ac.jp/
http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231
Public documents on the W3C site are provided by the copyright holders
under the following license. By using and/or copying this document, or
the W3C document from which this statement is linked, you (the
licensee) agree that you have read, understood, and will comply with
the following terms and conditions:
Permission to copy, and distribute the contents of this document, or
the W3C document from which this statement is linked, in any medium
for any purpose and without fee or royalty is hereby granted, provided
that you include the following on ALL copies of the document, or
portions thereof, that you use:
1. A link or URL to the original W3C document.
2. The pre-existing copyright notice of the original author, or if it
doesn't exist, a notice (hypertext is preferred, but a textual
representation is permitted) of the form: "Copyright ©
[$date-of-document] [111]World Wide Web Consortium,
([112]Massachusetts Institute of Technology, [113]European
Research Consortium for Informatics and Mathematics, [114]Keio
University). All Rights Reserved.
[115]http://www.w3.org/Consortium/Legal/2002/copyright-documents-2
0021231"
3. If it exists, the STATUS of the W3C document.
[111] http://www.w3.org/
[112] http://www.lcs.mit.edu/
[113] http://www.ercim.org/
[114] http://www.keio.ac.jp/
[115] http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231
When space permits, inclusion of the full text of this NOTICE should
be provided. We request that authorship attribution be provided in any
software, documents, or other items or products that you create
pursuant to the implementation of the contents of this document, or
any portion thereof.
No right to create modifications or derivatives of W3C documents is
granted pursuant to this license. However, if additional requirements
(documented in the [116]Copyright FAQ) are satisfied, the right to
create modifications or derivatives is sometimes granted by the W3C to
individuals complying with those requirements.
[116] http://www.w3.org/Consortium/Legal/IPR-FAQ
THIS DOCUMENT IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO
REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT
ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH
CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
TRADEMARKS OR OTHER RIGHTS.
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL
OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE
PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF.
The name and trademarks of copyright holders may NOT be used in
advertising or publicity pertaining to this document or its contents
without specific, written prior permission. Title to copyright in this
document will at all times remain with copyright holders.
_________________________________________________________________
W3C^® Software Copyright Notice and License
Note: This section is a copy of the W3C^® Software Copyright Notice
and License and could be found at
[117]http://www.w3.org/Consortium/Legal/2002/copyright-software-200212
31
[117] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
Copyright © 2003 [118]World Wide Web Consortium, ([119]Massachusetts
Institute of Technology, [120]European Research Consortium for
Informatics and Mathematics, [121]Keio University). All Rights
Reserved.
[118] http://www.w3.org/
[119] http://www.lcs.mit.edu/
[120] http://www.ercim.org/
[121] http://www.keio.ac.jp/
http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
This work (and included software, documentation such as READMEs, or
other related items) is being provided by the copyright holders under
the following license. By obtaining, using and/or copying this work,
you (the licensee) agree that you have read, understood, and will
comply with the following terms and conditions.
Permission to copy, modify, and distribute this software and its
documentation, with or without modification, for any purpose and
without fee or royalty is hereby granted, provided that you include
the following on ALL copies of the software and documentation or
portions thereof, including modifications:
1. The full text of this NOTICE in a location viewable to users of
the redistributed or derivative work.
2. Any pre-existing intellectual property disclaimers, notices, or
terms and conditions. If none exist, the [122]W3C^® Short Software
Notice should be included (hypertext is preferred, text is
permitted) within the body of any redistributed or derivative
code.
3. Notice of any changes or modifications to the files, including the
date changes were made. (We recommend you provide URIs to the
location from which the code is derived.)
THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT
HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR
DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
TRADEMARKS OR OTHER RIGHTS.
COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL
OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
DOCUMENTATION.
The name and trademarks of copyright holders may NOT be used in
advertising or publicity pertaining to the software without specific,
written prior permission. Title to copyright in this software and any
associated documentation will at all times remain with copyright
holders.
W3C^® Short Software Notice
Note: This section is a copy of the W3C^® Short Software Notice and
could be found at
[123]http://www.w3.org/Consortium/Legal/2002/copyright-software-short-
notice-20021231
[123] http://www.w3.org/Consortium/Legal/2002/copyright-software-short-notice-20021231
Copyright © 2003 [124]World Wide Web Consortium, ([125]Massachusetts
Institute of Technology, [126]European Research Consortium for
Informatics and Mathematics, [127]Keio University). All Rights
Reserved.
[124] http://www.w3.org/
[125] http://www.lcs.mit.edu/
[126] http://www.ercim.org/
[127] http://www.keio.ac.jp/
Copyright © [$date-of-software] [128]World Wide Web Consortium,
([129]Massachusetts Institute of Technology, [130]European Research
Consortium for Informatics and Mathematics, [131]Keio University). All
Rights Reserved. This work is distributed under the W3C^® Software
License [$1\47] in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.
[128] http://www.w3.org/
[129] http://www.lcs.mit.edu/
[130] http://www.ercim.org/
[131] http://www.keio.ac.jp/
[$1\47]
http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
07 November 2003
1. Document Object Model Events
Editors:
Philippe Le Hégaret, W3C
Tom Pixley, Netscape Communications Corporation (until July
2002)
Table of contents
* [132]1.1 Introduction
+ [133]1.1.1 Event flows
+ [134]1.1.2 Conformance
* [135]1.2 DOM event flow
+ [136]1.2.1 Phases
+ [137]1.2.2 Event listeners
* [138]1.3 Default actions and cancelable events
* [139]1.4 Event types
+ [140]1.4.1 Event types and event categories
+ [141]1.4.2 Complete list of event types
+ [142]1.4.3 Compatibility with DOM Level 2 Events
* [143]1.5 Event listener registration
+ [144]1.5.1 Using the EventTarget methods
+ [145]1.5.2 Using XML Events
+ [146]1.5.3 Using VoiceXML Events
+ [147]1.5.4 Using XML or HTML attributes
* [148]1.6 Basic interfaces
+ [149]Event, [150]EventTarget, [151]EventListener,
[152]EventException, [153]EventExceptionCode
+ [154]1.6.1 Event creation
o [155]DocumentEvent, [156]CustomEvent
* [157]1.7 Event module definitions
+ [158]1.7.1 User Interface event types
o [159]UIEvent
+ [160]1.7.2 Text events types
o [161]TextEvent
+ [162]1.7.3 Mouse event types
o [163]MouseEvent
+ [164]1.7.4 Keyboard event types
o [165]KeyboardEvent
+ [166]1.7.5 Mutation and mutation name event types
o [167]MutationEvent, [168]MutationNameEvent
+ [169]1.7.6 Basic event types
+ [170]1.7.7 HTML Events
1.1 Introduction
DOM Events is designed with two main goals. The first goal is the
design of an [171]event system which allows registration of event
listeners and describes event flow through a tree structure.
Additionally, the specification will provide standard modules of
events for user interface control and document mutation notifications,
including defined contextual information for each of these event
modules.
The second goal of the DOM Events is to provide a common subset of the
current event systems used in [172]DOM Level 0 browsers. This is
intended to foster interoperability of existing scripts and content.
It is not expected that this goal will be met with full backwards
compatibility. However, the specification attempts to achieve this
when possible.
The following sections of the specification define both the
specification for the DOM Event Model and a number of conformant event
modules designed for use within the model. The DOM Event Model
consists of:
* The [173]DOM event flow, which describe the flow of events in a
tree-based structure.
* A set of interfaces to access contextual information on events and
to register event listeners.
1.1.1 Event flows
This document specifies an event flow for tree-based structures:
[174]DOM event flow. While it is expected that HTML and XML
applications will follow this event flow, applications might reuse the
interfaces defined in this document for non tree-based structures. In
that case, it is the responsibility of such applications to define
their event flow and how it relates to the [175]DOM event flow. An
example of such use can be found in [176]DOM Level 3 Load and Save].
1.1.2 Conformance
An implementation is DOM Level 3 Events conformant if it supports the
Core module defined in [177]DOM Level 2 Core], the [178]DOM event
flow and the interfaces with their associated semantics defined in
[179]Basic interfaces. An implementation conforms to a DOM Level 3
Events module if it conforms to DOM Level 3 Events and the event types
defined in the module. An implementation conforms to an event type if
it conforms to its associated semantics and DOM interfaces. For
example, an implementation conforms to the DOM Level 3 User Interface
Events module (see [180]User Interface event types) if it conforms to
DOM Level 3 Events (i.e. implements all the basic interfaces), can
generate the event types {"http://www.w3.org/2001/xml-events",
"DOMActivate"} {"http://www.w3.org/2001/xml-events", "DOMFocusIn"}
{"http://www.w3.org/2001/xml-events", "DOMFocusOut"} accordingly to
their semantics, supports the [181]UIEvent interface, and conforms to
the DOM Level 2 Core module.
Note: An implementation which does not conform to an event module can
still implement the DOM interfaces associated with it. The DOM
application can then create an event object using the
[182]DocumentEvent.createEvent() method and dispatch an event type
associated with this interface using the
[183]EventTarget.dispatchEvent() method.
A DOM application may use the hasFeature(feature, version) method of
the DOMImplementation interface with parameter values "Events" and
"3.0" (respectively) to determine whether or not DOM Level 3 Events is
supported by the implementation. In order to fully support DOM Level 3
Events, an implementation must also support the "Core" feature defined
in the DOM Level 2 Core specification [184]DOM Level 2 Core] and use
the [185]DOM event flow. For additional information about
[186]conformance, please see the DOM Level 3 Core specification
[187]DOM Level 3 Core]. DOM Level 3 Events is built on top of DOM
Level 2 Events [188]DOM Level 2 Events], i.e. a DOM Level 3 Events
implementation where hasFeature("Events", "3.0") returns true must
also return true when the version number is "2.0", "" or, null.
[186] http://www.w3.org/TR/DOM-Level-3-Core/introduction.html#ID-Conformance
Each event module describes its own feature string in the event module
listing.
1.2 DOM event flow
The DOM event flow is the process through which the [189]event
originates from the DOM Events implementation and is dispatched into a
tree. Each event has an [190]event target, a targeted node in the case
of the DOM Event flow, toward which the event is dispatched by the DOM
Events implementation.
1.2.1 Phases
The event is dispatched following a path from the root of the tree to
this [191]target node. It can then be handled locally at the target
node level or from any target's ancestors higher in the tree. The
event dispatching (also called event propagation) occurs in three
phases and the following order:
1. The [192]capture phase: the event is dispatched to the target's
ancestors from the root of the tree to the direct parent of the
[193]target node.
2. The [194]target phase: the event is dispatched to the [195]target
node.
3. The [196]bubbling phase: the event is dispatched to the target's
ancestors from the direct parent of the [197]target node to the
root of the tree.
graphical representation of an event dispatched in a DOM tree using
the DOM event flow
Figure: graphical representation of an event dispatched in a DOM tree
using the DOM event flow [198]SVG 1.0 version]
[198] http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/images/eventflow
Note: An [199]SVG 1.0 version of the representation above is also
available.
[199] http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/images/eventflow.svg
The target's ancestors are determined before the initial dispatch of
the event. If the target node is removed during the dispatching, or a
target's ancestor is added or removed, the event propagation will
always be based on the target node and the target's ancestors
determined before the dispatch.
Some events may not necessarily accomplish the three phases of the DOM
event flow, e.g. the event could only be defined for one or two
phases. As an example, events defined in this specification will
always accomplish the capture and target phases but some will not
accomplish the bubbling phase ("bubbling events" versus "non-bubbling
events", see also the [200]Event.bubbles attribute).
1.2.2 Event listeners
Each node encountered during the dispatch of the event may contain
event listeners.
1.2.2.1 Registration of event listeners
Event listeners can be registered on all nodes in the tree for a
specific type of event ([201]Event types) or event category
([202]Event types and event categories), phase, and group ([203]Event
groups).
If the event listener is being registered on a node while an event
gets processed on this node, the event listener will not be triggered
during the current phase but may be triggered during a later phase in
the event flow, i.e. the [204]bubbling phase.
1.2.2.2 Event groups
An event listener is always part of a group. It is either explicitly
in a group if a group has been specified at the registration or
implicitly in the default group if no group has been specified. Within
a group, event listeners are ordered in their order of registration.
If two event listeners {A1, A2}, which are part of the same group, are
registered one after the other (A1, then A2) for the same phase, the
DOM event flow guarantees their triggering order (A1, then A2). If the
two listeners are not part of the same group, no specification is made
as to the order in which they will be triggered.
In general, a DOM application does not need to define and use a
separate group unless other event listeners, external to the DOM
application, may change the event propagation (e.g. from a concurrent
DOM application, from imported functionalities that rely on the event
system, etc.).
Note: While this specification does not specify a full ordering (i.e.
groups are still unordered), it does specify ordering within a group.
This implies that if the event listeners {A1, A2, B1, B2}, with A and
B being two different groups, are registered for the same phase in the
order A1, A2, B1, and B2, the following triggering orders are possible
and conform to the DOM event flow: {A1, A2, B1, B2}, {A1, B1, A2, B2},
{B1, A1, A2, B2}, {A1, B1, B2, A2}, {B1, A1, B2, A2}, {B1, B2, A1,
A2}. DOM Events implementations may impose priorities on groups but
DOM applications must not rely on it. Unlike this specification,
[205]DOM Level 2 Events] did not specify any triggering order for
event listeners.
1.2.2.3 Triggering an event listener
When the event is dispatched through the tree, from node to node,
event listeners registered on the node are triggered if the following
three conditions are all met:
1. they were registered for the same type of event, or the same
category.
2. they were registered for the same phase;
3. the event propagation has not been stopped for the group.
1.2.2.4 Removing an event listener
If an event listener is removed from a node while an event is being
processed on the node, it will not be triggered by the current
actions. Once removed, the event listener is never invoked again
(unless registered again for future processing).
1.2.2.5 Reentrance
It is expected that actions taken by an event listener may cause
additional events to be dispatched. Additional events should be
handled in a synchronous manner and may cause reentrance into the
event model. If an event listener fires a new event using
[206]EventTarget.dispatchEvent(), the event propagation that causes
the event listener to be triggered will resume only after the event
propagation of the new event is completed.
Since implementations may have restrictions such as stack-usage or
other memory requirements, applications should not depend on how many
synchronous events may be triggered.
1.2.2.6 Event propagation and event groups
All event listeners are part of a group (see [207]Registration of
event listeners). An event listener may prevent event listeners that
are part of a same group from being triggered. The effect can be:
* immediate: no more event listeners from the same group will be
triggered by the event object (see
[208]Event.stopImmediatePropagation());
* deferred until all event listeners from the same group have been
triggered on the current node, i.e. the event listeners of the
same group attached on other nodes will not be triggered (see
[209]Event.stopPropagation()).
If two event listeners are registered for two different groups, one
cannot prevent the other from being triggered.
1.3 Default actions and cancelable events
Implementations may have a default action associated with an event
type. An example is the [210]HTML 4.01] form element. When the user
submits the form (e.g. by pressing on a submit button), the event
{"http://www.w3.org/2001/xml-events", "submit"} is dispatched to the
element and the default action for this event type is generally to
send a request to a Web server with the parameters from the form.
The default actions are not part of the DOM Event flow. Before
invoking a default action, the implementation must first dispatch the
event as described in the [211]DOM event flow.
A cancelable event is an event associated with a default action which
is allowed to be canceled during the DOM event flow. At any phase
during the event flow, the triggered event listeners have the option
of canceling the default action or allowing the default action to
proceed. In the case of the hyperlink in the browser, canceling the
action would have the result of not activating the hyperlink. Not all
events defined in this specification are cancelable events.
Different implementations will specify their own default actions, if
any, associated with each event. The DOM Events specification does not
attempt to specify these actions.
This specification does not provide mechanisms for accessing default
actions or adding new ones.
Note: Some implementations also provide default actions before the
dispatch of the event. It is not possible to cancel those default
actions and this specification does not address them. An example of
such default actions can be found in [212]DOM Level 2 HTML] on the
HTMLInputElement.checked attribute.
1.4 Event types
Each event is associated with a type, called event type. The event
type is composed of a [213]local name and a [214]namespace URI as used
in [215]DOM Level 3 Core]. All events defined in this specification
use the namespace URI "http://www.w3.org/2001/xml-events".
1.4.1 Event types and event categories
An event type could be part of one or more categories. A category is
represented using a [216]local name and a [217]namespace URI as
defined in [218]XML Namespaces]. The event types defined in this
specification are not associated with one or more event categories and
this specification does not provide methods to associate them. Other
specifications may create and associate event categories with event
listeners but in such case would need to inform the dispatch mechanism
of those event categories. An example of the use of categories is
given at [219]Using VoiceXML Events.
1.4.2 Complete list of event types
Depending on the level of DOM support, or the devices used for display
(e.g. screen) or interaction (e.g. mouse, keyboard, touch screen,
voice, ...), these event types can be generated by the implementation.
When used with an [220]XML 1.0] or [221]HTML 4.01] 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 [222]XHTML 1.0] elements except 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 list defines all event types (with the exception of two
event types preserved for backward compatibility with [223]HTML
[ 4.01], see [224]HTML Events) provided in this specification. All event
types defined in this specification are bound to the namespace URI
"http://www.w3.org/2001/xml-events" and the following list only
enumerates the local name of the event type.
DOMActivate
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.
DOMFocusIn
An [225]event target receives focus, for instance via a
pointing device being moved onto an element or using keyboard
navigation. The focus is given to the element before the
dispatch of this event type.
DOMFocusOut
A [226]event target loses focus, for instance via a pointing
device being moved out of an element or by tabbing navigation
out of the element. The focus is taken from the element before
the dispatch of this event type.
textInput
One or more characters have been entered. The characters can
originate from a variety of sources. For example, it could be
characters resulting from a key being pressed or released on a
keyboard device, characters resulting from the processing of an
[227]input method editor, or resulting from a voice command.
Where a "paste" operation generates a simple sequence of
characters, i.e. a text without any structure or style
information, this event type should be generated as well.
click
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.
mousedown
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.
mouseup
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.
mouseover
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.
mousemove
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.
mouseout
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.
keydown
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 an [228]input method editor. This event should logically
happen before the event {"http://www.w3.org/2001/xml-events",
"keyup"} is produced. Whether a keydown contributes or not to
the generation of a text event is implementation dependent.
keyup
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 an [229]input method editor. This event should logically
happen after the event {"http://www.w3.org/2001/xml-events",
"keydown"} is produced. Whether a keyup contributes or not to
the generation of a text event is implementation dependent.
DOMSubtreeModified
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.
DOMNodeInserted
A node has been added as a [230]child of another node. This
event is dispatched after the insertion has taken place. The
[231]target node of this event is the node being inserted.
DOMNodeRemoved
A node is being removed from its parent node. This event is
dispatched before the node is removed from the tree. The
[232]target node of this event is the node being removed.
DOMNodeRemovedFromDocument
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 [233]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.
DOMNodeInsertedIntoDocument
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 [234]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.
DOMAttrModified
Occurs after an Attr has been modified on a node. The
[235]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.
DOMCharacterDataModified
Occurs after CharacterData.data or ProcessingInstruction.data
have been modified but the node itself has not been inserted or
deleted. The [236]target node of this event is the
CharacterData node or the ProcessingInstruction node.
DOMElementNameChanged
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.
DOMAttributeNameChanged
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.
load
The DOM Implementation finishes loading the resource (such as
the document) and any dependent resources (such as images,
style sheets, or scripts). Dependent resources that fail to
load will not prevent this event from firing if the resource
that loaded them is still accessible via the DOM. If this event
type is dispatched, implementations are required to dispatch
this event at least on the Document node.
unload
The DOM implementation removes from the environment the
resource (such as the document) or any dependent resources
(such as images, style sheets, scripts). The document is
unloaded after the dispatch of this event type. If this event
type is dispatched, implementations are required to dispatch
this event at least on the Document node.
abort
The loading of the document, or a resource linked from it, is
stopped before being entirely loaded.
error
The document, or a resource linked from it, has been loaded but
cannot be interpreted according to its semantic, such as an
invalid image, a script execution error, or non-well-formed
XML.
select
A user selects some text. DOM Level 3 Events does not provide
contextual information to access the selected text. The
selection occured before the dispatch of this event type.
change
A control loses the input focus and its value has been modified
since gaining focus.
submit
A form, such as [237]HTML 4.01], [238]XHTML 1.0], or
[239]XForms 1.0] form, is submitted.
reset
A form, such as [240]HTML 4.01], [241]XHTML 1.0], or
[242]XForms 1.0] form, is reset.
resize
A document view or an element has been resized. The resize
occured before the dispatch of this event type.
scroll
A document view or an element has been scrolled. The scroll
occured before the dispatch of this event type.
The following table provides additional information on the event
types. All events will accomplish the capture and target phases, but
not all of them will accomplish the bubbling phase (see also [243]DOM
event flow). Some events are not [244]cancelable (see [245]Default
actions and cancelable events). Some events will only be dispatched to
a specific set of possible targets, specified using node types.
Contextual information related to the event type is accessible using
DOM interfaces.
type Bubbling phase Cancelable Target node types DOM interface
[246]DOMActivate Yes Yes Element [247]UIEvent
[248]DOMFocusIn Yes No Element [249]UIEvent
[250]DOMFocusOut Yes No Element [251]UIEvent
[252]textInput Yes Yes Element [253]TextEvent
[254]click Yes Yes Element [255]MouseEvent
[256]mousedown Yes Yes Element [257]MouseEvent
[258]mouseup Yes Yes Element [259]MouseEvent
[260]mouseover Yes Yes Element [261]MouseEvent
[262]mousemove Yes Yes Element [263]MouseEvent
[264]mouseout Yes Yes Element [265]MouseEvent
[266]keydown Yes Yes Element [267]KeyboardEvent
[268]keyup Yes Yes Element [269]KeyboardEvent
[270]DOMSubtreeModified Yes No Document, DocumentFragment, Element,
Attr [271]MutationEvent
[272]DOMNodeInserted Yes No Element, Attr, Text, Comment,
CDATASection, DocumentType, EntityReference, ProcessingInstruction
[273]MutationEvent
[274]DOMNodeRemoved Yes No Element, Attr, Text, Comment, CDATASection,
DocumentType, EntityReference, ProcessingInstruction
[275]MutationEvent
[276]DOMNodeRemovedFromDocument No No Element, Attr, Text, Comment,
CDATASection, DocumentType, EntityReference, ProcessingInstruction
[277]MutationEvent
[278]DOMNodeInsertedIntoDocument No No Element, Attr, Text, Comment,
CDATASection, DocumentType, EntityReference, ProcessingInstruction
[279]MutationEvent
[280]DOMAttrModified Yes No Element [281]MutationEvent
[282]DOMCharacterDataModified Yes No Text, Comment, CDATASection,
ProcessingInstruction [283]MutationEvent
[284]DOMElementNameChanged Yes No Element [285]MutationNameEvent
[286]DOMAttributeNameChanged Yes No Element [287]MutationNameEvent
[288]load No No Document, Element [289]Event
[290]unload No No Document, Element [291]Event
[292]abort Yes No Element [293]Event
[294]error Yes No Element [295]Event
[296]select Yes No Element [297]Event
[298]change Yes No Element [299]Event
[300]submit Yes Yes Element [301]Event
[302]reset Yes Yes Element [303]Event
[304]resize Yes No Document, Element [305]UIEvent
[306]scroll Yes No Document, Element [307]UIEvent
As an example, the event {"http://www.w3.org/2001/xml-events", "load"}
will trigger event listeners attached on Element nodes for that event
and on the capture and target phases. This event cannot be cancelled.
If an event listener for the load event is attached to a node other
than Element nodes, or if it is attached to the bubbling phase only,
this event listener cannot be triggered.
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.
1.4.3 Compatibility with DOM Level 2 Events
[308]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
[309]XML name, specified in the [310]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
[311]Event.type. On the contrary, the namespaces aware DOM Level 3
Events methods, identify attribute nodes by their
[312]Event.namespaceURI and [313]Event.type. Because of this
fundamental difference, mixing both sets of methods can lead to
unpredictable results. For example, using
[314]EventTarget.addEventListenerNS(namespaceURI, type, listener,
...), two event listeners (or more) could be registered using the same
type and same useCapture values, but different namespaceURIs. Calling
[315]EventTarget.removeEventListener(type, listener, ...) 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,
[316]EventTarget.removeEventListenerNS(namespaceURI, type, listener,
...) removes the event that
[317]EventTarget.addEventListenerNS(namespaceURI, type, listener, ...)
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 [318]DOM event flow. If a DOM
Level 3 event (i.e. with a namespace URI) is dispatched in the DOM
tree, all event listeners with the same type and the same or null
namespace URI will be triggered as described in the [319]DOM event
flow.
1.5 Event listener registration
Note: This section is informative.
There are mainly two ways to associate an event listener to a node in
the tree:
1. at the programming level using the [320]EventTarget methods.
2. at the document level using [321]XML Events] or an ad-hoc syntax,
as the ones provided in [322]XHTML 1.0] or [323]SVG 1.1].
1.5.1 Using the [324]EventTarget methods
The user can attach an event listener using the methods on the
[325]EventTarget interface:
myCircle.addEventListenerNS("http://www.w3.org/2001/xml-events",
"DOMActivate",
myListener,
true,
null);
The methods do not provide the ability to register the same event
listener more than once for the same event type and the same phase. It
is not possible to register an event listener:
* for only one of the [326]target and [327]bubbling phases since
those phases are coupled during the registration (but the listener
itself could ignore events during one of these phases if desired).
* for a specific event category.
To register an event listener, DOM applications must use the methods
[328]EventTarget.addEventListener() and
[329]EventTarget.addEventListenerNS().
An [330]EventListener being registered on an [331]EventTarget may
choose to have that [332]EventListener triggered during the capture
phase by specifying the useCapture parameter of the
[333]EventTarget.addEventListener() or
[334]EventTarget.addEventListenerNS() methods to be true. If false,
the [335]EventListener will be triggered during the target and
bubbling phases.
1.5.2 Using XML Events
In [336]XML Events], event listeners are attached using elements and
attributes:
Event listeners can only be registered on Element nodes, i.e. other
Node types are not addressable, and cannot be registered for a
specific group either, i.e. they are always attached to the default
group. The [337]target phase and the [338]bubbling phase are coupled
during the registration. [339]XML Events] does not address namespaces
in event types. If the value of the event attribute of the listener
element contains a colon (':'), it should be interpreted as a QName as
defined in [340]XML Schema Part 2].
1.5.3 Using VoiceXML Events
In [341]VoiceXML 2.0], event listeners are attached using elements:
Event listeners can only be registered on Element nodes, i.e. other
Node types are not addressable, and cannot be registered for a
specific group either, i.e. they are always attached to the default
group. The [342]target phase and the [343]bubbling phase are coupled
during the registration. [344]VoiceXML 2.0] does not address
namespaces in event types but uses the notion of event categories. The
event type "connection.disconnect.hangup" could be associated to the
event categories {"http://www.example.org/2003/voicexml",
"connection"} and {"http://www.example.org/2003/voicexml",
"connection.disconnect"}.
1.5.4 Using XML or HTML attributes
In languages such as [345]HTML 4.01], [346]XHTML 1.0], or [347]SVG
1.1], event listeners are specified as attributes:
Since only one attribute with the same name can appear on an element,
it is therefore not possible to register more than one event listener
on a single [348]EventTarget for the event type. Also, event listeners
can only be registered on Element nodes for the [349]target phase and
[350]bubbling phase, i.e. other Node types and the [351]capture phase
are not addressable with these languages. Event listeners cannot be
registered for a specific group either, i.e. they are always attached
to the default group.
In order to achieve compatibility with those languages, implementors
may view the setting of attributes which represent event handlers as
the creation and registration of an EventListener on the
[352]EventTarget. The value of useCapture defaults to false. This
[353]EventListener behaves in the same manner as any other
[354]EventListeners which may be registered on the [355]EventTarget.
If the attribute representing the event listener is changed, this may
be viewed as the removal of the previously registered
[356]EventListener and the registration of a new one. Furthermore, no
specification is made as to the order in which event attributes will
receive the event with regards to the other [357]EventListeners on the
[358]EventTarget.
1.6 Basic interfaces
The interfaces described in this section are fundamental to DOM Level
3 Events and must always be supported by the implementation.
Interface Event (introduced in DOM Level 2)
The Event interface is used to provide contextual information
about an event to the listener processing the event. An object
which implements the Event interface is passed as the parameter
to an [359]EventListener. More specific context information is
passed to event listeners by deriving additional interfaces
from Event which contain information directly relating to the
type of event they represent. These derived interfaces are also
implemented by the object passed to the event listener.
To create an instance of the Event interface, use the
[360]DocumentEvent.createEvent("Event") method call.
IDL Definition
// Introduced in DOM Level 2:
interface [361]Event {
// PhaseType
const unsigned short [362]CAPTURING_PHASE = 1;
const unsigned short [363]AT_TARGET = 2;
const unsigned short [364]BUBBLING_PHASE = 3;
readonly attribute DOMString [365]type;
readonly attribute [366]EventTarget [367]target;
readonly attribute [368]EventTarget [369]currentTarget;
readonly attribute unsigned short [370]eventPhase;
readonly attribute boolean [371]bubbles;
readonly attribute boolean [372]cancelable;
readonly attribute DOMTimeStamp [373]timeStamp;
void [374]stopPropagation();
void [375]preventDefault();
void [376]initEvent(in DOMString eventTypeArg,
in boolean canBubbleArg,
in boolean cancelableArg);
// Introduced in DOM Level 3:
readonly attribute DOMString [377]namespaceURI;
// Introduced in DOM Level 3:
boolean [378]isCustom();
// Introduced in DOM Level 3:
void [379]stopImmediatePropagation();
// Introduced in DOM Level 3:
boolean [380]isDefaultPrevented();
// Introduced in DOM Level 3:
void [381]initEventNS(in DOMString namespaceURIArg,
in DOMString eventTypeArg,
in boolean canBubbleArg,
in boolean cancelableArg);
};
Definition group PhaseType
An integer indicating which phase of the event flow is
being processed as defined in [382]DOM event flow.
Defined Constants
AT_TARGET
The current event is in the [383]target
phase, i.e. it is being evaluated at the
[384]event target.
BUBBLING_PHASE
The current event phase is the [385]bubbling
phase.
CAPTURING_PHASE
The current event phase is the [386]capture
phase.
Attributes
bubbles of type boolean, readonly
Used to indicate whether or not an event is a
bubbling event. If the event can bubble the value
is true, otherwise the value is false.
cancelable of type boolean, readonly
Used to indicate whether or not an event can have
its default action prevented (see also [387]Default
actions and cancelable events). If the default
action can be prevented the value is true,
otherwise the value is false.
currentTarget of type [388]EventTarget, readonly
Used to indicate the [389]EventTarget whose
[390]EventListeners are currently being processed.
This is particularly useful during the capture and
bubbling phases. This attribute could contain the
[391]target node or a target ancestor when used
with the [392]DOM event flow.
eventPhase of type unsigned short, readonly
Used to indicate which phase of event flow is
currently being accomplished.
namespaceURI of type DOMString, readonly, introduced in DOM
Level 3
The [393]namespace URI associated with this event
at creation time, or null if it is unspecified.
For events initialized with a DOM Level 2 Events
method, such as [394]Event.initEvent(), this is
always null.
target of type [395]EventTarget, readonly
Used to indicate the [396]event target. This
attribute contains the [397]target node when used
with the [398]DOM event flow.
timeStamp of type DOMTimeStamp, readonly
Used to specify the time (in milliseconds relative
to the epoch) at which the event was created. Due
to the fact that some systems may not provide this
information the value of timeStamp may be not
available for all events. When not available, a
value of 0 will be returned. Examples of epoch time
are the time of the system start or 0:0:0 UTC 1st
January 1970.
type of type DOMString, readonly
The name should be an [399]NCName as defined in
[400]XML Namespaces] and is case-sensitive.
If the attribute [401]Event.namespaceURI is
different from null, this attribute represents a
[402]local name.
[399] http://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-NCName
Methods
initEvent
The initEvent method is used to initialize the
value of an Event created through the
[403]DocumentEvent.createEvent method. This method
may only be called before the Event has been
dispatched via the [404]EventTarget.dispatchEvent()
method. If the method is called several times
before invoking [405]EventTarget.dispatchEvent,
only the final invocation takes precedence. This
method has no effect if called after the event has
been dispatched. If called from a subclass of the
Event interface only the values specified in this
method are modified, all other attributes are left
unchanged.
This method sets the [406]Event.type attribute to
eventTypeArg, and [407]Event.namespaceURI to null.
To initialize an event with a namespace URI, use
the [408]Event.initEventNS(namespaceURIArg,
eventTypeArg, ...) method.
Parameters
eventTypeArg of type DOMString
Specifies [409]Event.type.
canBubbleArg of type boolean
Specifies [410]Event.bubbles. This parameter
overrides the intrinsic bubbling behavior of
the event.
cancelableArg of type boolean
Specifies [411]Event.cancelable. This
parameter overrides the intrinsic cancelable
behavior of the event.
No Return Value
No Exceptions
initEventNS introduced in DOM Level 3
The initEventNS method is used to initialize the
value of an Event object and has the same behavior
as [412]Event.initEvent().
Parameters
namespaceURIArg of type DOMString
Specifies Event.namespaceuRI, the
[413]namespace URI associated with this
event, or null if no namespace.
eventTypeArg of type DOMString
Specifies [414]Event.type, the [415]local
name of the event type.
canBubbleArg of type boolean
Refer to the [416]Event.initEvent() method
for a description of this parameter.
cancelableArg of type boolean
Refer to the [417]Event.initEvent() method
for a description of this parameter.
No Return Value
No Exceptions
isCustom introduced in DOM Level 3
This method will always return false, unless the
event implements the [418]CustomEvent interface.
Return Value
boolean
false, unless the event object implements the [419]CustomEvent
interface.
No Parameters
No Exceptions
isDefaultPrevented introduced in DOM Level 3
This method will return true if the method
[420]Event.preventDefault() has been called for
this event, false otherwise.
Return Value
boolean
true if [421]Event.preventDefault() has been called for this event.
No Parameters
No Exceptions
preventDefault
If an event is cancelable, the preventDefault
method is used to signify that the event is to be
canceled, meaning any default action normally taken
by the implementation as a result of the event will
not occur (see also [422]Default actions and
cancelable events), and thus independently of event
groups. Calling this method for a non-cancelable
event has no effect.
Note: This method does not stop the event
propagation; use stopPropagation or
stopImmediatePropagation for that effect.
No Parameters
No Return Value
No Exceptions
stopImmediatePropagation introduced in DOM Level 3
This method is used to prevent event listeners of
the same group to be triggered and, unlike
stopPropagation its effect is immediate (see
[423]Event propagation and event groups). Once it
has been called, further calls to that method have
no additional effect.
Note: This method does not prevent the default
action from being invoked; use
[424]Event.preventDefault() for that effect.
No Parameters
No Return Value
No Exceptions
stopPropagation
This method is used to prevent event listeners of
the same group to be triggered but its effect is
deferred until all event listeners attached on the
currentTarget have been triggered (see [425]Event
propagation and event groups). Once it has been
called, further calls to that method have no
additional effect.
Note: This method does not prevent the default
action from being invoked; use preventDefault for
that effect.
No Parameters
No Return Value
No Exceptions
Interface EventTarget (introduced in DOM Level 2)
The EventTarget interface is implemented by all the objects
which could be [426]event targets in an implementation which
supports the [427]Event flows. The interface allows
registration, removal or query of event listeners, and dispatch
of events to an event target.
When used with [428]DOM event flow, this interface is
implemented by all [429]target nodes and target ancestors, i.e.
all DOM Nodes of the tree support this interface when the
implementation conforms to DOM Level 3 Events and, therefore,
this interface can be obtained by using binding-specific
casting methods on an instance of the Node interface.
Invoking addEventListener or addEventListenerNS multiple times
on the same EventTarget with the same parameters (namespaceURI,
type, listener, and useCapture) is considered to be a no-op and
thus independently of the event group. They do not cause the
[430]EventListener to be called more than once and do not cause
a change in the triggering order. In order to guarantee that an
event listener will be added to the event target for the
specified event group, one needs to invoke removeEventListener
or removeEventListenerNS first.
IDL Definition
// Introduced in DOM Level 2:
interface [431]EventTarget {
void [432]addEventListener(in DOMString type,
in [433]EventListener listener,
in boolean useCapture);
void [434]removeEventListener(in DOMString type,
in [435]EventListener listener,
in boolean useCapture);
// Modified in DOM Level 3:
boolean [436]dispatchEvent(in [437]Event evt)
raises([438]EventException);
// Introduced in DOM Level 3:
void [439]addEventListenerNS(in DOMString namespaceURI,
in DOMString type,
in [440]EventListener listener,
in boolean useCapture,
in DOMObject evtGroup);
// Introduced in DOM Level 3:
void [441]removeEventListenerNS(in DOMString namespaceURI,
in DOMString type,
in [442]EventListener listener,
in boolean useCapture);
// Introduced in DOM Level 3:
boolean [443]willTriggerNS(in DOMString namespaceURI,
in DOMString type);
// Introduced in DOM Level 3:
boolean [444]hasEventListenerNS(in DOMString namespaceURI,
in DOMString type);
};
Methods
addEventListener
This method allows the registration of an event
listener in the default group and, depending on the
useCapture parameter, on the capture phase of the
DOM event flow or its target and bubbling phases.
Parameters
type of type DOMString
Specifies the [445]Event.type associated with
the event for which the user is registering.
listener of type [446]EventListener
The listener parameter takes an object
implemented by the user which implements the
[447]EventListener interface and contains the
method to be called when the event occurs.
useCapture of type boolean
If true, useCapture indicates that the user
wishes to add the event listener for the
[448]capture phase only, i.e. this event
listener will not be triggered during the
[449]target and [450]bubbling phases. If
false, the event listener will only be
triggered during the target and bubbling
phases.
No Return Value
No Exceptions
addEventListenerNS introduced in DOM Level 3
This method allows the registration of an event
listener in a specified group or the default group
and, depending on the useCapture parameter, on the
capture phase of the DOM event flow or its target
and bubbling phases.
Parameters
namespaceURI of type DOMString
Specifies the [451]Event.namespaceURI
associated with the event for which the user
is registering.
type of type DOMString
Specifies the [452]Event.type associated with
the event for which the user is registering.
listener of type [453]EventListener
The listener parameter takes an object
implemented by the user which implements the
[454]EventListener interface and contains the
method to be called when the event occurs.
useCapture of type boolean
If true, useCapture indicates that the user
wishes to add the event listener for the
[455]capture phase only, i.e. this event
listener will not be triggered during the
[456]target and [457]bubbling phases. If
false, the event listener will only be
triggered during the target and bubbling
phases.
evtGroup of type DOMObject
The object that represents the event group to
associate with the [458]EventListener (see
also [459]Event propagation and event
groups). Use null to attach the event
listener to the default group.
No Return Value
No Exceptions
dispatchEvent modified in DOM Level 3
This method allows the dispatch of events into the
implementation's event model. The [460]event target
of the event is the EventTarget object on which
dispatchEvent is called.
Parameters
evt of type [461]Event
The event to be dispatched.
Return Value
boolean
Indicates whether any of the listeners which handled the event called
[462]Event.preventDefault(). If [463]Event.preventDefault() was called
the returned value is false, else it is true.
Exceptions
[464]EventException
UNSPECIFIED_EVENT_TYPE_ERR: Raised if the [465]Event.type was not
specified by initializing the event before dispatchEvent was called.
Specification of the [466]Event.type as null or an empty string will
also trigger this exception.
DISPATCH_REQUEST_ERR: Raised if the [467]Event object is already being
dispatched in the tree.
NOT_SUPPORTED_ERR: Raised if the [468]Event object has not been
created using [469]DocumentEvent.createEvent() or does not support the
interface [470]CustomEvent.
hasEventListenerNS introduced in DOM Level 3
This method allows the DOM application to know if
this EventTarget contains an event listener
registered for the specified event type. This is
useful for determining at which nodes within a
hierarchy altered handling of specific event types
has been introduced, but should not be used to
determine whether the specified event type triggers
an event listener (see
[471]EventTarget.willTriggerNS()).
Parameters
namespaceURI of type DOMString
Specifies the [472]Event.namespaceURI
associated with the event.
type of type DOMString
Specifies the [473]Event.type associated with
the event.
Return Value
boolean
true if an event listener is registered on this EventTarget for the
specified event type, false otherwise.
No Exceptions
removeEventListener
This method allows the removal of event listeners
from the default group.
Calling removeEventListener with arguments which do
not identify any currently registered
[474]EventListener on the EventTarget has no
effect.
Parameters
type of type DOMString
Specifies the [475]Event.type for which the
user registered the event listener.
listener of type [476]EventListener
The [477]EventListener to be removed.
useCapture of type boolean
Specifies whether the [478]EventListener
being removed was registered for the capture
phase or not. If a listener was registered
twice, once for the capture phase and once
for the target and bubbling phases, each must
be removed separately. Removal of an event
listener registered for the capture phase
does not affect the same event listener
registered for the target and bubbling
phases, and vice versa.
No Return Value
No Exceptions
removeEventListenerNS introduced in DOM Level 3
This method allows the removal of an event
listener, independently of the associated event
group.
Calling removeEventListenerNS with arguments which
do not identify any currently registered
[479]EventListener on the EventTarget has no
effect.
Parameters
namespaceURI of type DOMString
Specifies the [480]Event.namespaceURI
associated with the event for which the user
registered the event listener.
type of type DOMString
Specifies the [481]Event.type associated with
the event for which the user registered the
event listener.
listener of type [482]EventListener
The [483]EventListener parameter indicates
the [484]EventListener to be removed.
useCapture of type boolean
Specifies whether the [485]EventListener
being removed was registered for the capture
phase or not. If a listener was registered
twice, once for the capture phase and once
for the target and bubbling phases, each must
be removed separately. Removal of an event
listener registered for the capture phase
does not affect the same event listener
registered for the target and bubbling
phases, and vice versa.
No Return Value
No Exceptions
willTriggerNS introduced in DOM Level 3
This method allows the DOM application to know if
an event listener, attached to this EventTarget or
one of its ancestors, will be triggered by the
specified event type during the dispatch of the
event to this event target or one of its
descendants.
Parameters
namespaceURI of type DOMString
Specifies the [486]Event.namespaceURI
associated with the event.
type of type DOMString
Specifies the [487]Event.type associated with
the event.
Return Value
boolean
true if an event listener will be triggered on the EventTarget with
the specified event type, false otherwise.
No Exceptions
Interface EventListener (introduced in DOM Level 2)
The EventListener interface is the primary way for handling
events. Users implement the EventListener interface and
register their event listener on an [488]EventTarget. The users
should also remove their EventListener from its
[489]EventTarget after they have completed using the listener.
Copying a Node, with methods such as Node.cloneNode or
Range.cloneContents, does not copy the event listeners attached
to it. Event listeners must be attached to the newly created
Node afterwards if so desired.
Moving a Node, with methods Document.adoptNode,
Node.appendChild, or Range.extractContents, does not affect the
event listeners attached to it.
IDL Definition
// Introduced in DOM Level 2:
interface [490]EventListener {
void [491]handleEvent(in [492]Event evt);
};
Methods
handleEvent
This method is called whenever an event occurs of
the event type for which the EventListener
interface was registered.
Parameters
evt of type [493]Event
The [494]Event contains contextual
information about the [495]event.
No Return Value
No Exceptions
Exception EventException introduced in DOM Level 2
Event operations may throw an [496]EventException as specified
in their method descriptions.
IDL Definition
// Introduced in DOM Level 2:
exception [497]EventException {
unsigned short code;
};
// EventExceptionCode
const unsigned short [498]UNSPECIFIED_EVENT_TYPE_ERR = 0;
// Introduced in DOM Level 3:
const unsigned short [499]DISPATCH_REQUEST_ERR = 1;
Definition group EventExceptionCode
An integer indicating the type of error generated.
Defined Constants
DISPATCH_REQUEST_ERR, introduced in DOM Level 3.
If the [500]Event object is already
dispatched in the tree.
UNSPECIFIED_EVENT_TYPE_ERR
If the [501]Event.type was not specified by
initializing the event before the method was
called. Specification of the [502]Event.type
as null or an empty string will also trigger
this exception.
1.6.1 Event creation
In most cases, the events dispatched by the DOM Events implementation
are also created by the implementation. It is however possible to
simulate events such as mouse events by creating the [503]Event
objects and dispatch them using the DOM Events implementation.
DOM Events provides two ways for creating [504]Event objects. An
application can either create [505]Event objects that are known to the
implementation, or create its own objects and have them dispatched by
the DOM Events implementation.
Creating [506]Event objects that are known to the DOM Events
implementation is done using [507]DocumentEvent.createEvent(). The
application must then initialize the object by calling the appropriate
initialization method before invoking
[508]EventTarget.dispatchEvent(). The [509]Event objects created must
be known by the DOM Events implementation; otherwise an event
exception is thrown.
The DOM application might want to create its own [510]Event objects,
in order to change the default [511]Event implementation provided by
the DOM Events implementation or to generate new event types with
specific contextual information. In any case, the application is
responsible for creating and initializing the [512]Event object. The
application can then dispatch the event using the DOM Events
implementation by using [513]EventTarget.dispatchEvent().
However, the DOM Events implementation requires to have access to two
attributes in the [514]Event object in order to accomplish the
dispatch appropriately: [515]Event.currentTarget and
[516]Event.eventPhase. Those attributes are defined as readonly in the
[517]Event interface since event listeners must not change them and it
is the responsibility of the DOM Events implementation to update them
during the event flow. Therefore, implementing the [518]Event
interface when creating its own events is not enough for an
application since the DOM Events implementation will not be able to
update the current phase and the current node during the dispatch,
unless the event object also implements the [519]CustomEvent interface
to give access to the relevant attributes.
Interface DocumentEvent (introduced in DOM Level 2)
The DocumentEvent interface provides a mechanism by which the
user can create an [520]Event object of a type supported by the
implementation. If the feature "Events" is supported by the
Document object, the DocumentEvent interface must be
implemented on the same object. If the feature "+Events" is
supported by the Document object, an object that supports the
DocumentEvent interface must be returned by invoking the method
Node.getFeature("+Events", "3.0") on the Document object.
IDL Definition
// Introduced in DOM Level 2:
interface [521]DocumentEvent {
[522]Event [523]createEvent(in DOMString eventType)
raises(DOMException);
// Introduced in DOM Level 3:
boolean [524]canDispatch(in DOMString namespaceURI,
in DOMString type);
};
Methods
canDispatch introduced in DOM Level 3
Test if the implementation can generate events of a
specified type.
Parameters
namespaceURI of type DOMString
Specifies the [525]Event.namespaceURI of the
event.
type of type DOMString
Specifies the [526]Event.type of the event.
Return Value
boolean
true if the implementation can generate and dispatch this event type,
false otherwise.
No Exceptions
createEvent
Parameters
eventType of type DOMString
The eventType parameter specifies the name of
the DOM Events interface to be supported by
the created event object, e.g. "Event",
"MouseEvent", "MutationEvent" and so on. If
the [527]Event is to be dispatched via the
[528]EventTarget.dispatchEvent() method the
appropriate event init method must be called
after creation in order to initialize the
[529]Event's values.
As an example, a user wishing to synthesize
some kind of [530]UIEvent would invoke
[531]DocumentEvent.createEvent("UIEvent").
The [532]UIEvent.initUIEventNS() method could
then be called on the newly created
[533]UIEvent object to set the specific type
of user interface event to be dispatched,
{"http://www.w3.org/2001/xml-events",
"DOMActivate"} for example, and set its
context information, e.g. [534]UIEvent.detail
in this example.
The createEvent method is used in creating
[535]Events when it is either inconvenient or
unnecessary for the user to create an
[536]Event themselves. In cases where the
implementation provided [537]Event is
insufficient, users may supply their own
[538]Event implementations for use with the
[539]EventTarget.dispatchEvent() method.
However, the DOM implementation needs access
to the attributes [540]Event.currentTarget
and [541]Event.eventPhase to appropriately
propagate the event in the DOM tree.
Therefore users' [542]Event implementations
might need to support the [543]CustomEvent
interface for that effect.
Note: For backward compatibility reason,
"UIEvents", "MouseEvents", "MutationEvents",
and "HTMLEvents" feature names are valid
values for the parameter eventType and
represent respectively the interfaces
"UIEvent", "MouseEvent", "MutationEvent", and
"Event".
Return Value
[544]Event
The newly created event object.
Exceptions
DOMException
NOT_SUPPORTED_ERR: Raised if the implementation does not support the
[545]Event interface requested.
Interface CustomEvent (introduced in DOM Level 3)
The CustomEvent interface gives access to the attributes
[546]Event.currentTarget and [547]Event.eventPhase. It is
intended to be used by the DOM Events implementation to access
the underlying current target and event phase while dispatching
a custom [548]Event in the tree; it is also intended to be
implemented, and not used, by DOM applications.
The methods contained in this interface are not intended to be
used by a DOM application, especially during the dispatch on
the [549]Event object. Changing the current target or the
current phase may result in unpredictable results of the event
flow. The DOM Events implementation should ensure that both
methods return the appropriate current target and phase before
invoking each event listener on the current target to protect
DOM applications from malicious event listeners.
Note: If this interface is supported by the event object,
[550]Event.isCustom() must return true.
IDL Definition
// Introduced in DOM Level 3:
interface [551]CustomEvent : [552]Event {
void [553]setDispatchState(in [554]EventTarget target,
in unsigned short phase);
boolean [555]isPropagationStopped();
boolean [556]isImmediatePropagationStopped();
};
Methods
isImmediatePropagationStopped
The isImmediatePropagationStopped method is used by
the DOM Events implementation to know if the method
stopImmediatePropagation() has been called for this
event. It returns true if the method has been
called, false otherwise.
Return Value
boolean
true if the event propagation has been stopped immediately in the
current group.
No Parameters
No Exceptions
isPropagationStopped
This method will return true if the method
stopPropagation() has been called for this event,
false in any other cases.
Return Value
boolean
true if the event propagation has been stopped in the current group.
No Parameters
No Exceptions
setDispatchState
The setDispatchState method is used by the DOM
Events implementation to set the values of
[557]Event.currentTarget and [558]Event.eventPhase.
It also reset the states of isPropagationStopped
and isImmediatePropagationStopped.
Parameters
target of type [559]EventTarget
Specifies the new value for the
[560]Event.currentTarget attribute.
phase of type unsigned short
Specifies the new value for the
[561]Event.eventPhase attribute.
No Return Value
No Exceptions
1.7 Event module definitions
The DOM Event Model allows a DOM implementation to support multiple
modules of events. The model has been designed to allow addition of
new event modules if required. The DOM will not attempt to define all
possible events. For purposes of interoperability, the DOM defines a
module of user interface events including lower level device dependent
events and a module of document mutation events.
1.7.1 User Interface event types
The User Interface event module contains basic event types associated
with user interfaces.
Interface UIEvent (introduced in DOM Level 2)
The UIEvent interface provides specific contextual information
associated with User Interface events.
To create an instance of the UIEvent interface, use the
[562]DocumentEvent.createEvent("UIEvent") method call.
IDL Definition
// Introduced in DOM Level 2:
interface [563]UIEvent : [564]Event {
readonly attribute views::AbstractView [565]view;
readonly attribute long [566]detail;
void [567]initUIEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in views::AbstractView viewArg,
in long detailArg);
// Introduced in DOM Level 3:
void [568]initUIEventNS(in DOMString namespaceURI,
in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in views::AbstractView viewArg,
in long detailArg);
};
Attributes
detail of type long, readonly
Specifies some detail information about the
[569]Event, depending on the type of event.
view of type views::AbstractView, readonly
The view attribute identifies the AbstractView from
which the event was generated.
Methods
initUIEvent
The initUIEvent method is used to initialize the
value of a UIEvent object and has the same behavior
as [570]Event.initEvent().
Parameters
typeArg of type DOMString
Refer to the [571]Event.initEvent() method
for a description of this parameter.
canBubbleArg of type boolean
Refer to the [572]Event.initEvent() method
for a description of this parameter.
cancelableArg of type boolean
Refer to the [573]Event.initEvent() method
for a description of this parameter.
viewArg of type views::AbstractView
Specifies [574]UIEvent.view.
detailArg of type long
Specifies [575]UIEvent.detail.
No Return Value
No Exceptions
initUIEventNS introduced in DOM Level 3
The initUIEventNS method is used to initialize the
value of a UIEvent object and has the same behavior
as [576]Event.initEventNS().
Parameters
namespaceURI of type DOMString
Refer to the [577]Event.initEventNS() method
for a description of this parameter.
typeArg of type DOMString
Refer to the [578]Event.initEventNS() method
for a description of this parameter.
canBubbleArg of type boolean
Refer to the [579]Event.initEventNS() method
for a description of this parameter.
cancelableArg of type boolean
Refer to the [580]Event.initEventNS() method
for a description of this parameter.
viewArg of type views::AbstractView
Refer to the [581]UIEvent.initUIEvent()
method for a description of this parameter.
detailArg of type long
Refer to the [582]UIEvent.initUIEvent()
method for a description of this parameter.
No Return Value
No Exceptions
The User Interface event types are listed below. For a full
description of the semantics associated with these event types, refer
to the [583]Complete list of event types. A DOM application may use
the hasFeature(feature, version) method of the DOMImplementation
interface with parameter values "UIEvents" and "3.0" (respectively) to
determine whether or not the DOM Level 3 User Interface event types
are supported by the implementation. In order to fully support this
module, an implementation must also support the "Events" feature
defined in this specification and the "Views" feature defined in the
DOM Level 2 Views specification [584]DOM Level 2 Views]. For
additional information about [585]conformance, please see the DOM
Level 3 Core specification [586]DOM Level 3 Core]. The DOM Level 3
User Interface Events module is built on top of the DOM Level 2 User
Interface Events [587]DOM Level 2 Events] module, i.e. a DOM Level 3
User Interface Events implementation where hasFeature("UIEvents",
"3.0") returns true must also return true when the version number is
"2.0", "" or, null.
type Context information
[588]DOMActivate [589]UIEvent.view is in use.
[590]DOMFocusIn (same as above)
[591]DOMFocusOut (same as above)
[585] http://www.w3.org/TR/DOM-Level-3-Core/introduction.html#ID-Conformance
1.7.2 Text events types
The text event module originates from the [592]HTML 4.01] onkeypress
attribute. Unlike this attribute, the event type
{"http://www.w3.org/2001/xml-events", "textInput"} applies only to
characters and is designed for use with any text input devices, not
just keyboards. Refer to Appendix A, "[593]Keyboard events and key
identifiers", for examples on how text events are used in combination
with keyboard events.
Interface TextEvent (introduced in DOM Level 3)
The TextEvent interface provides specific contextual
information associated with Text Events.
To create an instance of the TextEvent interface, use the
[594]DocumentEvent.createEvent("TextEvent") method call.
IDL Definition
// Introduced in DOM Level 3:
interface [595]TextEvent : [596]UIEvent {
readonly attribute DOMString [597]data;
void [598]initTextEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in views::AbstractView viewArg,
in DOMString dataArg);
void [599]initTextEventNS(in DOMString namespaceURI,
in DOMString type,
in boolean canBubbleArg,
in boolean cancelableArg,
in views::AbstractView viewArg,
in DOMString dataArg);
};
Attributes
data of type DOMString, readonly
data holds the value of the characters generated by
the character device. This may be a single Unicode
character or a non-empty sequence of Unicode
characters [600]Unicode]. Characters should be
normalized as defined by the Unicode normalization
form NFC, defined in [601]UTR #15]. This attribute
cannot be null or contain the empty string.
Methods
initTextEvent
The initTextEvent method is used to initialize the
value of a TextEvent object and has the same
behavior as [602]UIEvent.initUIEvent(). The value
of [603]UIEvent.detail remains undefined.
Parameters
typeArg of type DOMString
Refer to the [604]UIEvent.initUIEvent()
method for a description of this parameter.
canBubbleArg of type boolean
Refer to the [605]UIEvent.initUIEvent()
method for a description of this parameter.
cancelableArg of type boolean
Refer to the [606]UIEvent.initUIEvent()
method for a description of this parameter.
viewArg of type views::AbstractView
Refer to the [607]UIEvent.initUIEvent()
method for a description of this parameter.
dataArg of type DOMString
Specifies [608]TextEvent.data.
No Return Value
No Exceptions
initTextEventNS
The initTextEventNS method is used to initialize
the value of a TextEvent object and has the same
behavior as [609]UIEvent.initUIEventNS(). The value
of [610]UIEvent.detail remains undefined.
Parameters
namespaceURI of type DOMString
Refer to the [611]UIEvent.initUIEventNS()
method for a description of this parameter.
type of type DOMString
Refer to the [612]UIEvent.initUIEventNS()
method for a description of this parameter.
canBubbleArg of type boolean
Refer to the [613]UIEvent.initUIEventNS()
method for a description of this parameter.
cancelableArg of type boolean
Refer to the [614]UIEvent.initUIEventNS()
method for a description of this parameter.
viewArg of type views::AbstractView
Refer to the [615]UIEvent.initUIEventNS()
method for a description of this parameter.
dataArg of type DOMString
Refer to the [616]TextEvent.initTextEvent()
method for a description of this parameter.
No Return Value
No Exceptions
The text event type is listed below. For a full description of the
semantics associated with this event type, refer to the [617]Complete
list of event types. A DOM application may use the hasFeature(feature,
version) method of the DOMImplementation interface with parameter
values "TextEvents" and "3.0" (respectively) to determine whether or
not the Text event module is supported by the implementation. In order
to fully support this module, an implementation must also support the
"UIEvents" feature defined in this specification. For additional
information about [618]conformance, please see the DOM Level 3 Core
specification [619]DOM Level 3 Core].
type Context information
[620]textInput [621]UIEvent.view and [622]TextEvent.data are in use.
[618] http://www.w3.org/TR/DOM-Level-3-Core/introduction.html#ID-Conformance
1.7.3 Mouse event types
The Mouse event module originates from the [623]HTML 4.01] onclick,
ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, and
onmouseout attributes. This event module is specifically designed for
use with pointing input devices, such as a mouse or a trackball.
Interface MouseEvent (introduced in DOM Level 2)
The MouseEvent interface provides specific contextual
information associated with Mouse events.
In the case of nested elements mouse events are always targeted
at the most deeply nested element. Ancestors of the targeted
element may use bubbling to obtain notification of mouse events
which occur within theirs descendent elements.
To create an instance of the MouseEvent interface, use the
[624]DocumentEvent.createEvent("MouseEvent") method call.
Note: When initializing MouseEvent objects using initMouseEvent
or initMouseEventNS, implementations should use the client
coordinates clientX and clientY for calculation of other
coordinates (such as target coordinates exposed by [625]DOM
Level 0 implementations).
IDL Definition
// Introduced in DOM Level 2:
interface [626]MouseEvent : [627]UIEvent {
readonly attribute long [628]screenX;
readonly attribute long [629]screenY;
readonly attribute long [630]clientX;
readonly attribute long [631]clientY;
readonly attribute boolean [632]ctrlKey;
readonly attribute boolean [633]shiftKey;
readonly attribute boolean [634]altKey;
readonly attribute boolean [635]metaKey;
readonly attribute unsigned short [636]button;
readonly attribute [637]EventTarget [638]relatedTarget;
void [639]initMouseEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in views::AbstractView viewArg,
in long detailArg,
in long screenXArg,
in long screenYArg,
in long clientXArg,
in long clientYArg,
in boolean ctrlKeyArg,
in boolean altKeyArg,
in boolean shiftKeyArg,
in boolean metaKeyArg,
in unsigned short buttonArg,
in [640]EventTarget relatedTargetArg);
// Introduced in DOM Level 3:
boolean [641]getModifierState(in DOMString keyIdentifierArg);
// Introduced in DOM Level 3:
void [642]initMouseEventNS(in DOMString namespaceURI,
in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in views::AbstractView viewArg,
in long detailArg,
in long screenXArg,
in long screenYArg,
in long clientXArg,
in long clientYArg,
in unsigned short buttonArg,
in [643]EventTarget relatedTargetArg,
in DOMString modifiersList);
};
Attributes
altKey of type boolean, readonly
true if the alt (alternative) key modifier is
activated.
Note: The Option key modifier on Macintosh systems
must be represented using this key modifier.
button of type unsigned short, readonly
During mouse events caused by the depression or
release of a mouse button, button is used to
indicate which mouse button changed state. 0
indicates the normal button of the mouse (in
general on the left or the one button on Macintosh
mice, used to activate a button or select text). 2
indicates the contextual property (in general on
the right, used to display a context menu) button
of the mouse if present. 1 indicates the extra (in
general in the middle and often combined with the
mouse wheel) button. Some mice may provide or
simulate more buttons, and values higher than 2 can
be used to represent such buttons.
clientX of type long, readonly
The horizontal coordinate at which the event
occurred relative to the DOM implementation's
client area.
clientY of type long, readonly
The vertical coordinate at which the event occurred
relative to the DOM implementation's client area.
ctrlKey of type boolean, readonly
true if the control (Ctrl) key modifier is
activated.
metaKey of type boolean, readonly
true if the meta (Meta) key modifier is activated.
Note: The Command key modifier on Macintosh system
must be represented using this meta key.
relatedTarget of type [644]EventTarget, readonly
Used to identify a secondary [645]EventTarget
related to a UI event. Currently this attribute is
used with the mouseover event to indicate the
[646]EventTarget which the pointing device exited
and with the mouseout event to indicate the
[647]EventTarget which the pointing device entered.
screenX of type long, readonly
The horizontal coordinate at which the event
occurred relative to the origin of the screen
coordinate system.
screenY of type long, readonly
The vertical coordinate at which the event occurred
relative to the origin of the screen coordinate
system.
shiftKey of type boolean, readonly
true if the shift (Shift) key modifier is
activated.
Methods
getModifierState introduced in DOM Level 3
This methods queries the state of a modifier using
a key identifier. See also [648]Modifier keys.
Parameters
keyIdentifierArg of type DOMString
A modifier key identifier, as defined by the
[649]KeyboardEvent.keyIdentifier attribute.
Common modifier keys are "Alt", "AltGraph",
"CapsLock", "Control", "Meta", "NumLock",
"Scroll", or "Shift".
Note: If an application wishes to distinguish
between right and left modifiers, this
information could be deduced using keyboard
events and [650]KeyboardEvent.keyLocation.
Return Value
boolean
true if it is modifier key and the modifier is activated, false
otherwise.
No Exceptions
initMouseEvent
The initMouseEvent method is used to initialize the
value of a MouseEvent object and has the same
behavior as [651]UIEvent.initUIEvent().
Parameters
typeArg of type DOMString
Refer to the [652]UIEvent.initUIEvent()
method for a description of this parameter.
canBubbleArg of type boolean
Refer to the [653]UIEvent.initUIEvent()
method for a description of this parameter.
cancelableArg of type boolean
Refer to the [654]UIEvent.initUIEvent()
method for a description of this parameter.
viewArg of type views::AbstractView
Refer to the [655]UIEvent.initUIEvent()
method for a description of this parameter.
detailArg of type long
Refer to the [656]UIEvent.initUIEvent()
method for a description of this parameter.
screenXArg of type long
Specifies [657]MouseEvent.screenX.
screenYArg of type long
Specifies [658]MouseEvent.screenY.
clientXArg of type long
Specifies [659]MouseEvent.clientX.
clientYArg of type long
Specifies [660]MouseEvent.clientY.
ctrlKeyArg of type boolean
Specifies [661]MouseEvent.ctrlKey.
altKeyArg of type boolean
Specifies [662]MouseEvent.altKey.
shiftKeyArg of type boolean
Specifies [663]MouseEvent.shiftKey.
metaKeyArg of type boolean
Specifies [664]MouseEvent.metaKey.
buttonArg of type unsigned short
Specifies [665]MouseEvent.button.
relatedTargetArg of type [666]EventTarget
Specifies [667]MouseEvent.relatedTarget.
No Return Value
No Exceptions
initMouseEventNS introduced in DOM Level 3
The initMouseEventNS method is used to initialize
the value of a MouseEvent object and has the same
behavior as [668]UIEvent.initUIEventNS().
Parameters
namespaceURI of type DOMString
Refer to the [669]UIEvent.initUIEventNS()
method for a description of this parameter.
typeArg of type DOMString
Refer to the [670]UIEvent.initUIEventNS()
method for a description of this parameter.
canBubbleArg of type boolean
Refer to the [671]UIEvent.initUIEventNS()
method for a description of this parameter.
cancelableArg of type boolean
Refer to the [672]UIEvent.initUIEventNS()
method for a description of this parameter.
viewArg of type views::AbstractView
Refer to the [673]UIEvent.initUIEventNS()
method for a description of this parameter.
detailArg of type long
Refer to the [674]UIEvent.initUIEventNS()
method for a description of this parameter.
screenXArg of type long
Refer to the [675]MouseEvent.initMouseEvent()
method for a description of this parameter.
screenYArg of type long
Refer to the [676]MouseEvent.initMouseEvent()
method for a description of this parameter.
clientXArg of type long
Refer to the [677]MouseEvent.initMouseEvent()
method for a description of this parameter.
clientYArg of type long
Refer to the [678]MouseEvent.initMouseEvent()
method for a description of this parameter.
buttonArg of type unsigned short
Refer to the [679]MouseEvent.initMouseEvent()
method for a description of this parameter.
relatedTargetArg of type [680]EventTarget
Refer to the [681]MouseEvent.initMouseEvent()
method for a description of this parameter.
modifiersList of type DOMString
A [682]white space separated list of modifier
key identifiers to be activated on this
object. As an example, "Control Alt" will
activated the control and alt modifiers.
[682] http://www.w3.org/TR/2000/REC-xml-20001006#NT-S
No Return Value
No Exceptions
The Mouse event types are listed below. For a full description of the
semantics associated with these event types, refer to the
[683]Complete list of event types. In the case of nested elements,
mouse event types are always targeted at the most deeply nested
element. Ancestors of the targeted element may use bubbling to obtain
notification of mouse events which occur within its descendent
elements.
A DOM application may use the hasFeature(feature, version) method of
the DOMImplementation interface with parameter values "MouseEvents"
and "3.0" (respectively) to determine whether or not the Mouse event
module is supported by the implementation. In order to fully support
this module, an implementation must also support the "UIEvents"
feature defined in this specification. For additional information
about [684]conformance, please see the DOM Level 3 Core specification
[685]DOM Level 3 Core]. The DOM Level 3 Mouse Events module is built
on top of the DOM Level 2 Mouse Events [686]DOM Level 2 Events]
module, i.e. a DOM Level 3 Mouse Events implementation where
hasFeature("MouseEvents", "3.0") returns true must also return true
when the version number is "2.0", "" or, null.
type Context information
[687]click [688]MouseEvent.screenX, [689]MouseEvent.screenY,
[690]MouseEvent.clientX, [691]MouseEvent.clientY,
[692]MouseEvent.altKey, [693]MouseEvent.ctrlKey,
[694]MouseEvent.shiftKey, [695]MouseEvent.metaKey,
MouseEvent.altGraphKey, [696]MouseEvent.button, and [697]UIEvent.view
are in use. The [698]UIEvent.detail attribute indicates the number of
consecutive clicks of a pointing device button during a user action.
The attribute value is 1 when the user begins this action and
increments by 1 for each click. The notion of consecutive clicks
depends on the environment configuration. For example, a "double
click" will not happen if there is a long delay between the two
clicks, even if the pointing device did not move.
[699]mousedown [700]MouseEvent.screenX, [701]MouseEvent.screenY,
[702]MouseEvent.clientX, [703]MouseEvent.clientY,
[704]MouseEvent.altKey, [705]MouseEvent.ctrlKey,
[706]MouseEvent.shiftKey, [707]MouseEvent.metaKey,
MouseEvent.altGraphKey, [708]MouseEvent.button, and [709]UIEvent.view
are in use. The [710]UIEvent.detail attribute indicates the number of
consecutive clicks, incremented by one, of a pointing device button
during a user action. For example, if no click happened before the
mousedown, [711]UIEvent.detail will contain the value 1.
[712]mouseup [713]MouseEvent.screenX, [714]MouseEvent.screenY,
[715]MouseEvent.clientX, [716]MouseEvent.clientY,
[717]MouseEvent.altKey, [718]MouseEvent.ctrlKey,
[719]MouseEvent.shiftKey, [720]MouseEvent.metaKey,
MouseEvent.altGraphKey, [721]MouseEvent.button, and [722]UIEvent.view
are in use. The [723]UIEvent.detail attribute indicates the number of
consecutive clicks, incremented by one, of a pointing device button
during a user action.
[724]mouseover [725]MouseEvent.screenX, [726]MouseEvent.screenY,
[727]MouseEvent.clientX, [728]MouseEvent.clientY,
[729]MouseEvent.altKey, [730]MouseEvent.ctrlKey,
[731]MouseEvent.shiftKey, [732]MouseEvent.metaKey,
MouseEvent.altGraphKey, and [733]UIEvent.view are in use.
[734]MouseEvent.relatedTarget indicates the [735]event target a
pointing device is exiting.
[736]mousemove [737]MouseEvent.screenX, [738]MouseEvent.screenY,
[739]MouseEvent.clientX, [740]MouseEvent.clientY,
[741]MouseEvent.altKey, [742]MouseEvent.ctrlKey,
[743]MouseEvent.shiftKey, [744]MouseEvent.metaKey,
MouseEvent.altGraphKey, and [745]UIEvent.view are in use.
[746]mouseout [747]MouseEvent.screenX, [748]MouseEvent.screenY,
[749]MouseEvent.clientX, [750]MouseEvent.clientY,
[751]MouseEvent.altKey, [752]MouseEvent.ctrlKey,
[753]MouseEvent.shiftKey, [754]MouseEvent.metaKey,
MouseEvent.altGraphKey, and [755]UIEvent.view are in use.
[756]MouseEvent.relatedTarget indicates the [757]event target a
pointing device is entering.
[684] http://www.w3.org/TR/DOM-Level-3-Core/introduction.html#ID-Conformance
As an example, a "double-click" on a mouse device will produce the
following events (the value of [758]UIEvent.detail is indicated in
parenthesis):
1. {"http://www.w3.org/2001/xml-events", "mousedown"} (1)
2. {"http://www.w3.org/2001/xml-events", "mouseup"} (1)
3. {"http://www.w3.org/2001/xml-events", "click"} (1)
4. {"http://www.w3.org/2001/xml-events", "mousedown"} (2)
5. {"http://www.w3.org/2001/xml-events", "mouseup"} (2)
6. {"http://www.w3.org/2001/xml-events", "click"} (2)
1.7.4 Keyboard event types
Keyboard events are device dependent, i.e. they rely on the
capabilities of the input devices and how they are mapped in the
operating systems. It is therefore highly recommended to rely on
[759]Text events types when dealing with character input.
Interface KeyboardEvent (introduced in DOM Level 3)
The KeyboardEvent interface provides specific contextual
information associated with keyboard devices. Each keyboard
event references a key using an identifier. Keyboard events are
commonly directed at the element that has the focus.
The KeyboardEvent interface provides convenient attributes for
some common modifiers keys: [760]KeyboardEvent.ctrlKey,
[761]KeyboardEvent.shiftKey, [762]KeyboardEvent.altKey,
[763]KeyboardEvent.metaKey. These attributes are equivalent to
use the method
[764]KeyboardEvent.getModifierState(keyIdentifierArg) with
"Control", "Shift", "Alt", or "Meta" respectively.
To create an instance of the KeyboardEvent interface, use the
[765]DocumentEvent.createEvent("KeyboardEvent") method call.
IDL Definition
// Introduced in DOM Level 3:
interface [766]KeyboardEvent : [767]UIEvent {
// KeyLocationCode
const unsigned long [768]DOM_KEY_LOCATION_STANDARD = 0x00;
const unsigned long [769]DOM_KEY_LOCATION_LEFT = 0x01;
const unsigned long [770]DOM_KEY_LOCATION_RIGHT = 0x02;
const unsigned long [771]DOM_KEY_LOCATION_NUMPAD = 0x03;
readonly attribute DOMString [772]keyIdentifier;
readonly attribute unsigned long [773]keyLocation;
readonly attribute boolean [774]ctrlKey;
readonly attribute boolean [775]shiftKey;
readonly attribute boolean [776]altKey;
readonly attribute boolean [777]metaKey;
boolean [778]getModifierState(in DOMString keyIdentifierArg);
void [779]initKeyboardEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in views::AbstractView viewArg,
in DOMString keyIdentifierArg,
in unsigned long keyLocationArg,
in DOMString modifiersList);
void [780]initKeyboardEventNS(in DOMString namespaceURI,
in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in views::AbstractView viewArg,
in DOMString keyIdentifierArg,
in unsigned long keyLocationArg,
in DOMString modifiersList);
};
Definition group KeyLocationCode
This set of constants is used to indicate the location of
a key on the device. In case a DOM implementation wishes
to provide a new location information, a value different
from the following constant values must be used.
Defined Constants
DOM_KEY_LOCATION_LEFT
The key activated is in the left key location
(there is more than one possible location for
this key). Example: the left Shift key on a
PC 101 Key US keyboard.
DOM_KEY_LOCATION_NUMPAD
The key activation originated on the numeric
keypad or with a virtual key corresponding to
the numeric keypad. Example: the '1' key on a
PC 101 Key US keyboard located on the numeric
pad.
DOM_KEY_LOCATION_RIGHT
The key activation is in the right key
location (there is more than one possible
location for this key). Example: the right
Shift key on a PC 101 Key US keyboard.
DOM_KEY_LOCATION_STANDARD
The key activation is not distinguished as
the left or right version of the key, and did
not originate from the numeric keypad (or did
not originate with a virtual key
corresponding to the numeric keypad).
Example: the 'Q' key on a PC 101 Key US
keyboard.
Attributes
altKey of type boolean, readonly
true if the alternative (Alt) key modifier is
activated.
Note: The Option key modifier on Macintosh systems
must be represented using this key modifier.
ctrlKey of type boolean, readonly
true if the control (Ctrl) key modifier is
activated.
keyIdentifier of type DOMString, readonly
keyIdentifier holds the identifier of the key. The
key identifiers are defined in Appendix A.2
"[781]Key identifiers set". Implementations that
are unable to identify a key must use the key
identifier "Unidentified".
keyLocation of type unsigned long, readonly
The keyLocation attribute contains an indication of
the location of they key on the device, as
described in [782]Keyboard event types.
metaKey of type boolean, readonly
true if the meta (Meta) key modifier is activated.
Note: The Command key modifier on Macintosh systems
must be represented using this key modifier.
shiftKey of type boolean, readonly
true if the shift (Shift) key modifier is
activated.
Methods
getModifierState
This methods queries the state of a modifier using
a key identifier. See also [783]Modifier keys.
Parameters
keyIdentifierArg of type DOMString
A modifier key identifier. Common modifier
keys are "Alt", "AltGraph", "CapsLock",
"Control", "Meta", "NumLock", "Scroll", or
"Shift".
Note: If an application wishes to distinguish
between right and left modifiers, this
information could be deduced using keyboard
events and [784]KeyboardEvent.keyLocation.
Return Value
boolean
true if it is modifier key and the modifier is activated, false
otherwise.
No Exceptions
initKeyboardEvent
The initKeyboardEvent method is used to initialize
the value of a KeyboardEvent object and has the
same behavior as [785]UIEvent.initUIEvent(). The
value of [786]UIEvent.detail remains undefined.
Parameters
typeArg of type DOMString
Refer to the [787]UIEvent.initUIEvent()
method for a description of this parameter.
canBubbleArg of type boolean
Refer to the [788]UIEvent.initUIEvent()
method for a description of this parameter.
cancelableArg of type boolean
Refer to the [789]UIEvent.initUIEvent()
method for a description of this parameter.
viewArg of type views::AbstractView
Refer to the [790]UIEvent.initUIEvent()
method for a description of this parameter.
keyIdentifierArg of type DOMString
Specifies [791]KeyboardEvent.keyIdentifier.
keyLocationArg of type unsigned long
Specifies [792]KeyboardEvent.keyLocation.
modifiersList of type DOMString
A [793]white space separated list of modifier
key identifiers to be activated on this
object.
[793] http://www.w3.org/TR/2000/REC-xml-20001006#NT-S
No Return Value
No Exceptions
initKeyboardEventNS
The initKeyboardEventNS method is used to
initialize the value of a KeyboardEvent object and
has the same behavior as
[794]UIEvent.initUIEventNS(). The value of
[795]UIEvent.detail remains undefined.
Parameters
namespaceURI of type DOMString
Refer to the [796]UIEvent.initUIEventNS()
method for a description of this parameter.
typeArg of type DOMString
Refer to the [797]UIEvent.initUIEventNS()
method for a description of this parameter.
canBubbleArg of type boolean
Refer to the [798]UIEvent.initUIEventNS()
method for a description of this parameter.
cancelableArg of type boolean
Refer to the [799]UIEvent.initUIEventNS()
method for a description of this parameter.
viewArg of type views::AbstractView
Refer to the [800]UIEvent.initUIEventNS()
method for a description of this parameter.
keyIdentifierArg of type DOMString
Refer to the
[801]KeyboardEvent.initKeyboardEvent() method
for a description of this parameter.
keyLocationArg of type unsigned long
Refer to the
[802]KeyboardEvent.initKeyboardEvent() method
for a description of this parameter.
modifiersList of type DOMString
A [803]white space separated list of modifier
key identifiers to be activated on this
object. As an example, "Control Alt" will
activated the control and alt modifiers.
[803] http://www.w3.org/TR/2000/REC-xml-20001006#NT-S
No Return Value
No Exceptions
Depending on the character generation device, keyboard events may or
may not be generated.
The keyboard event types are listed below. For a full description of
the semantics associated with these event types, refer to the
[804]Complete list of event types. A DOM application may use the
hasFeature(feature, version) method of the DOMImplementation interface
with parameter values "KeyboardEvents" and "3.0" (respectively) to
determine whether or not the Keyboard event module is supported by the
implementation. In order to fully support this module, an
implementation must also support the "UIEvents" feature defined in
this specification. For additional information about [805]conformance,
please see the DOM Level 3 Core specification [806]DOM Level 3 Core].
type Context information
[807]keydown [808]UIEvent.view, [809]KeyboardEvent.keyIdentifier,
KeyboardEvent.location, [810]KeyboardEvent.altKey,
KeyboardEvent.altGraphKey, [811]KeyboardEvent.shiftKey,
[812]KeyboardEvent.ctrlKey, and [813]KeyboardEvent.metaKey are in use.
[814]keyup [815]UIEvent.view, [816]KeyboardEvent.keyIdentifier, and
KeyboardEvent.location are in use. [817]KeyboardEvent.altKey,
KeyboardEvent.altGraphKey, [818]KeyboardEvent.shiftKey,
[819]KeyboardEvent.ctrlKey, and [820]KeyboardEvent.metaKey are in use
unless the Keyboard.keyIdentifier corresponds to the key modifier
itself.
[805] http://www.w3.org/TR/DOM-Level-3-Core/introduction.html#ID-Conformance
1.7.5 Mutation and mutation name event types
The 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. It may be noted that none of
the event types associated with the modules 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.
Interface MutationEvent (introduced in DOM Level 2)
The MutationEvent interface provides specific contextual
information associated with Mutation events.
To create an instance of the MutationEvent interface, use the
[821]DocumentEvent.createEvent("MutationEvent") method call.
IDL Definition
// Introduced in DOM Level 2:
interface [822]MutationEvent : [823]Event {
// attrChangeType
const unsigned short [824]MODIFICATION = 1;
const unsigned short [825]ADDITION = 2;
const unsigned short [826]REMOVAL = 3;
readonly attribute Node [827]relatedNode;
readonly attribute DOMString [828]prevValue;
readonly attribute DOMString [829]newValue;
readonly attribute DOMString [830]attrName;
readonly attribute unsigned short [831]attrChange;
void [832]initMutationEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in Node relatedNodeArg,
in DOMString prevValueArg,
in DOMString newValueArg,
in DOMString attrNameArg,
in unsigned short attrChangeArg);
// Introduced in DOM Level 3:
void [833]initMutationEventNS(in DOMString namespaceURI,
in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in Node relatedNodeArg,
in DOMString prevValueArg,
in DOMString newValueArg,
in DOMString attrNameArg,
in unsigned short attrChangeArg);
};
Definition group attrChangeType
An integer indicating in which way the Attr was changed.
Defined Constants
ADDITION
The Attr was just added.
MODIFICATION
The Attr was modified in place.
REMOVAL
The Attr was just removed.
Attributes
attrChange of type unsigned short, readonly
attrChange indicates the type of change which
triggered the {"http://www.w3.org/2001/xml-events",
"DOMAttrModified"} event. The values can be
MODIFICATION, ADDITION, or REMOVAL.
attrName of type DOMString, readonly
attrName indicates the name of the changed Attr
node in a {"http://www.w3.org/2001/xml-events",
"DOMAttrModified"} event.
newValue of type DOMString, readonly
newValue indicates the new value of the Attr node
in {"http://www.w3.org/2001/xml-events",
"DOMAttrModified"} events, and of the CharacterData
node in {"http://www.w3.org/2001/xml-events",
"DOMCharacterDataModified"} events.
prevValue of type DOMString, readonly
prevValue indicates the previous value of the Attr
node in {"http://www.w3.org/2001/xml-events",
"DOMAttrModified"} events, and of the CharacterData
node in {"http://www.w3.org/2001/xml-events",
"DOMCharacterDataModified"} events.
relatedNode of type Node, readonly
relatedNode is 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 is the
changed parent. If an event is instead dispatched
to a subtree indicating a node was changed within
it, the relatedNode is the changed node. In the
case of the {"http://www.w3.org/2001/xml-events",
"DOMAttrModified"} event it indicates the Attr node
which was modified, added, or removed.
Methods
initMutationEvent
The initMutationEvent method is used to initialize
the value of a MutationEvent object and has the
same behavior as [834]Event.initEvent().
Parameters
typeArg of type DOMString
Refer to the [835]Event.initEvent() method
for a description of this parameter.
canBubbleArg of type boolean
Refer to the [836]Event.initEvent() method
for a description of this parameter.
cancelableArg of type boolean
Refer to the [837]Event.initEvent() method
for a description of this parameter.
relatedNodeArg of type Node
Specifies [838]MutationEvent.relatedNode.
prevValueArg of type DOMString
Specifies [839]MutationEvent.prevValue. This
value may be null.
newValueArg of type DOMString
Specifies [840]MutationEvent.newValue. This
value may be null.
attrNameArg of type DOMString
Specifies MutationEvent.attrname. This value
may be null.
attrChangeArg of type unsigned short
Specifies [841]MutationEvent.attrChange. This
value may be null.
No Return Value
No Exceptions
initMutationEventNS introduced in DOM Level 3
The initMutationEventNS method is used to
initialize the value of a MutationEvent object and
has the same behavior as [842]Event.initEventNS().
Parameters
namespaceURI of type DOMString
Refer to the [843]Event.initEventNS() method
for a description of this parameter.
typeArg of type DOMString
Refer to the [844]Event.initEventNS() method
for a description of this parameter.
canBubbleArg of type boolean
Refer to the [845]Event.initEventNS() method
for a description of this parameter.
cancelableArg of type boolean
Refer to the [846]Event.initEventNS() method
for a description of this parameter.
relatedNodeArg of type Node
Refer to the
[847]MutationEvent.initMutationEvent() method
for a description of this parameter.
prevValueArg of type DOMString
Refer to the
[848]MutationEvent.initMutationEvent() method
for a description of this parameter.
newValueArg of type DOMString
Refer to the
[849]MutationEvent.initMutationEvent() method
for a description of this parameter.
attrNameArg of type DOMString
Refer to the
[850]MutationEvent.initMutationEvent() method
for a description of this parameter.
attrChangeArg of type unsigned short
Refer to the
[851]MutationEvent.initMutationEvent() method
for a description of this parameter.
No Return Value
No Exceptions
The mutation event types are listed below. For a full description of
the semantics associated with these event types, refer to the
[852]Complete list of event types. A DOM application may use the
hasFeature(feature, version) method of the DOMImplementation interface
with parameter values "MutationEvents" and "3.0" (respectively) to
determine whether or not the [853]MutationEvent is supported by the
implementation. In order to fully support this module, an
implementation must also support the "Events" feature defined in this
specification. For additional information about [854]conformance,
please see the DOM Level 3 Core specification [855]DOM Level 3 Core].
This [856]MutationEvent interface is built on top of the DOM Level 2
Mutation Events [857]DOM Level 2 Events] module, i.e. a DOM Level 3
[858]MutationEvent interface implementation where
hasFeature("MutationEvents","3.0") returns true must also return true
when the version number is "2.0", "" or, null.
type Context information
[859]DOMSubtreeModified None
[860]DOMNodeInserted [861]MutationEvent.relatedNode holds the parent
node of the node being inserted.
[862]DOMNodeRemoved [863]MutationEvent.relatedNode holds the parent
node of the node being removed.
[864]DOMNodeRemovedFromDocument None
[865]DOMNodeInsertedIntoDocument None
[866]DOMAttrModified [867]MutationEvent.attrName is in use. The value
of [868]MutationEvent.relatedNode indicates the Attr node whose value
has been affected. The value of [869]MutationEvent.attrChange
indicates whether the Attr was modified, added, or removed. If the
Attr node is being added, [870]MutationEvent.newValue is in use. If
the Attr node is being removed, [871]MutationEvent.prevValue is in
value. If the Attr node is being modified, [872]MutationEvent.newValue
and [873]MutationEvent.prevValue are in use.
[874]DOMCharacterDataModified [875]MutationEvent.prevValue, and
[876]MutationEvent.newValue are in use.
[854] http://www.w3.org/TR/DOM-Level-3-Core/introduction.html#ID-Conformance
Interface MutationNameEvent (introduced in DOM Level 3)
The MutationNameEvent interface provides specific contextual
information associated with Mutation name event types.
To create an instance of the MutationNameEvent interface, use
the Document.createEvent("MutationNameEvent") method call.
IDL Definition
// Introduced in DOM Level 3:
interface [877]MutationNameEvent : [878]MutationEvent {
readonly attribute DOMString [879]prevNamespaceURI;
readonly attribute DOMString [880]prevNodeName;
// Introduced in DOM Level 3:
void [881]initMutationNameEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in Node relatedNodeArg,
in DOMString prevNamespaceURIArg,
in DOMString prevNodeNameArg);
// Introduced in DOM Level 3:
void [882]initMutationNameEventNS(in DOMString namespaceURI,
in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in Node relatedNodeArg,
in DOMString prevNamespaceURIArg,
in DOMString prevNodeNameArg);
};
Attributes
prevNamespaceURI of type DOMString, readonly
The previous value of the relatedNode's
namespaceURI.
prevNodeName of type DOMString, readonly
The previous value of the relatedNode's nodeName.
Methods
initMutationNameEvent introduced in DOM Level 3
The initMutationNameEvent method is used to
initialize the value of a MutationNameEvent object
and has the same behavior as
[883]MutationEvent.initMutationEvent().
Parameters
typeArg of type DOMString
Refer to the
[884]MutationEvent.initMutationEvent() method
for a description of this parameter.
canBubbleArg of type boolean
Refer to the
[885]MutationEvent.initMutationEvent() method
for a description of this parameter.
cancelableArg of type boolean
Refer to the
[886]MutationEvent.initMutationEvent() method
for a description of this parameter.
relatedNodeArg of type Node
Refer to the
[887]MutationEvent.initMutationEvent() method
for a description of this parameter.
prevNamespaceURIArg of type DOMString
Specifies
[888]MutationNameEvent.prevNamespaceURI. This
value may be null.
prevNodeNameArg of type DOMString
Specifies
[889]MutationNameEvent.prevNodeName.
No Return Value
No Exceptions
initMutationNameEventNS introduced in DOM Level 3
The initMutationNameEventNS method is used to
initialize the value of a MutationNameEvent object
and has the same behavior as
[890]MutationEvent.initMutationEventNS().
Parameters
namespaceURI of type DOMString
Refer to the
[891]MutationEvent.initMutationEventNS()
method for a description of this parameter.
typeArg of type DOMString
Refer to the
[892]MutationEvent.initMutationEventNS()
method for a description of this parameter.
canBubbleArg of type boolean
Refer to the
[893]MutationEvent.initMutationEventNS()
method for a description of this parameter.
cancelableArg of type boolean
Refer to the
[894]MutationEvent.initMutationEventNS()
method for a description of this parameter.
relatedNodeArg of type Node
Refer to the
[895]MutationEvent.initMutationEventNS()
method for a description of this parameter.
prevNamespaceURIArg of type DOMString
Refer to the
[896]MutationEvent.initMutationEvent() method
for a description of this parameter.
prevNodeNameArg of type DOMString
Refer to the
[897]MutationEvent.initMutationEvent() method
for a description of this parameter.
No Return Value
No Exceptions
The mutation name event types are listed below. For a full description
of the semantics associated with these event types, refer to the
[898]Complete list of event types. A DOM application may use the
hasFeature(feature, version) method of the DOMImplementation interface
with parameter values "MutationNameEvents" and "3.0" (respectively) to
determine whether or not the [899]MutationNameEvent is supported by
the implementation. In order to fully support this module, an
implementation must also support the "MutationEvents" feature defined
in this specification and the "Core" feature defined in the DOM Level
3 Core specification [900]DOM Level 3 Core]. For additional
information about [901]conformance, please see the DOM Level 3 Core
specification [902]DOM Level 3 Core].
type Context information
[903]DOMElementNameChanged [904]MutationNameEvent.prevNamespaceURI,
and [905]MutationNameEvent.prevNodeName are in use.
[906]DOMAttributeNameChanged [907]MutationNameEvent.prevNamespaceURI,
and [908]MutationNameEvent.prevNodeName are in use. The value of
[909]MutationEvent.relatedNode contains the renamed Attr node.
[901] http://www.w3.org/TR/DOM-Level-3-Core/introduction.html#ID-Conformance
1.7.6 Basic event types
This event module contains basic event types associated with document
manipulation.
A DOM application may use the hasFeature(feature, version) method of
the DOMImplementation interface with parameter values "BasicEvents"
and "3.0" (respectively) to determine whether or not the basic 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. For additional information about
[910]conformance, please see the DOM Level 3 Core specification
[911]DOM Level 3 Core].
[910] http://www.w3.org/TR/DOM-Level-3-Core/introduction.html#ID-Conformance
The basic event types are listed below. For a full description of the
semantics associated with these event types, refer to the
[912]Complete list of event types.
The event types {"http://www.w3.org/2001/xml-events", "resize"} and
{"http://www.w3.org/2001/xml-events", "scroll"} implement the
[913]UIEvent interface. All other HTML event types implement at least
the basic [914]Event interface. However, they may be generated from a
user interface; in that case, the event objects also implements the
[915]UIEvent interface and [916]UIEvent.view is in use.
type Context information
[917]load [918]UIEvent.view may be in use.
[919]unload (same as above)
[920]abort (same as above)
[921]error (same as above)
[922]select (same as above)
[923]change (same as above)
[924]submit (same as above)
[925]reset (same as above)
[926]resize [927]UIEvent.view is in use.
[928]scroll [929]UIEvent.view is in use.
1.7.7 HTML Events
The HTML event module is composed of events listed in [930]HTML 4.01]
and additional events which are supported in [931]DOM Level 0
browsers. It refines the semantics and scope of the basic event types
and provides two new event types. This event module is only applicable
if the Document supports the [932]DOM Level 2 HTML] specification.
Use Node.isSupported(feature, version) with the parameter values
"HTML" and "2.0" (respectively) to determine whether or not the
Document node supports the HTML module.
A DOM application may use the hasFeature(feature, version) method of
the DOMImplementation interface with parameter values "HTMLEvents" and
"3.0" (respectively) to determine whether or not the HTML event module
is supported by the implementation. In order to fully support this
module, an implementation must also support the "BasicEvents" feature
defined in this specification and the "HTML" feature defined in
[933]DOM Level 2 HTML]. For additional information about
[934]conformance, please see the DOM Level 3 Core specification
[935]DOM Level 3 Core]. The DOM Level 3 HTML Events module is built
on top of the DOM Level 2 HTML Events [936]DOM Level 2 Events]
module, i.e. a DOM Level 3 HTML Events implementation where
hasFeature("HTMLEvents", "3.0") returns true must also return true
when the version number is "2.0", "" or, null.
[934] http://www.w3.org/TR/DOM-Level-3-Core/introduction.html#ID-Conformance
The following descriptions of event types are refinements of the
general descriptions provided in [937]Complete list of event types,
with the addition of the events {"http://www.w3.org/2001/xml-events",
"focus"} and {"http://www.w3.org/2001/xml-events", "blur"}. All events
types are bound to the namespace URI
"http://www.w3.org/2001/xml-events" and the following list only
enumerates the local name of the event type.
load
The DOM implementation finishes loading all content within the
BODY element, all frames within a FRAMESET, or any resource
linked from the document.
unload
The DOM implementation removes a document from a window or
frame. This event is valid for BODY and FRAMESET elements.
abort
The page loading is stopped before an image has been allowed to
completely load. This event applies to OBJECT elements.
error
An image does not load properly or when an error occurs during
script execution. This event is valid for OBJECT elements, BODY
elements, and FRAMESET element.
select
A user selects some text in a text field either via the user
interface or via attributes defined in [938]DOM Level 2 HTML].
This event is valid for INPUT and TEXTAREA elements.
change
A control loses the input focus and its value has been modified
since gaining focus. This event can occur either via a user
interface manipulation or the focus() methods and the
attributes defined in [939]DOM Level 2 HTML]. This event is
valid for INPUT, SELECT, and TEXTAREA element.
submit
A form is submitted either via a button. This event only
applies to the FORM element. Note that the
HTMLFormElement.submit() method defined in [940]DOM Level 2
HTML] does not fire this event type.
reset
A form is reset either via a button, or the
HTMLFormElement.reset() method defined in [941]DOM Level 2
HTML]. This event only applies to the FORM element.
resize
see [942]resize in [943]Complete list of event types.
scroll
see [944]scroll in [945]Complete list of event types.
focus
An element receives focus either via a pointing device, the
focus() methods defined in [946]DOM Level 2 HTML], or by
tabbing navigation. This event is only valid for the following
elements: A, AREA, LABEL, INPUT, SELECT, TEXTAREA, and BUTTON.
This event type is dispatched after the event type
{"http://www.w3.org/2001/xml-events", "DOMFocusIn"}.
blur
An element loses focus either via a pointing device, the blur()
methods defined in [947]DOM Level 2 HTML], or by tabbing
navigation. This event is only valid for the following
elements: A, AREA, LABEL, INPUT, SELECT, TEXTAREA, and BUTTON.
This event type is dispatched after the event type
{"http://www.w3.org/2001/xml-events", "DOMFocusOut"}.
The following table provides refinements or additional information on
the event types. Some events will only be dispatched to a specific set
of possible targets, specified using HTML node types.
type Bubbling phase Cancelable Target node types DOM interface
[948]load [no changes] [no changes] HTMLDocument, HTMLBodyElement,
HTMLFrameSetElement, HTMLObjectElement, HTMLLinkElement,
HTMLMetaElement, HTMLScriptElement, HTMLFrameElement,
HTMLIFrameElement, HTMLImageElement [no changes]
[949]unload [no changes] [no changes] HTMLDocument, HTMLBodyElement,
HTMLFrameSetElement [no changes]
[950]abort [no changes] [no changes] HTMLObjectElement [no changes]
[951]error [no changes] [no changes] HTMLObjectElement,
HTMLBodyElement, HTMLFrameSetElement [no changes]
[952]select [no changes] [no changes] HTMLInputElement,
HTMLTextAreaElement [no changes]
[953]change [no changes] [no changes] HTMLInputElement,
HTMLSelectElement, HTMLTextAreaElement [no changes]
[954]submit [no changes] [no changes] HTMLFormElement [no changes]
[955]reset [no changes] [no changes] HTMLFormElement [no changes]
[956]resize [no changes] [no changes] HTMLDocument, HTMLElement no
changes]
[957]scroll [no changes] [no changes] HTMLDocument, HTMLElement no
changes]
[958]focus No No HTMLAnchorElement, HTMLAreaElement, HTMLLabelElement,
HTMLInputElement, HTMLSelectElement, HTMLtextAreaElement,
HTMLButtonElement. [959]Event
[960]blur No No HTMLAnchorElement, HTMLAreaElement, HTMLLabelElement,
HTMLInputElement, HTMLSelectElement, HTMLtextAreaElement,
HTMLButtonElement. [961]Event
The event types {"http://www.w3.org/2001/xml-events", "focus"} and
{"http://www.w3.org/2001/xml-events", "blur"} may be generated from a
user interface; in that case, the event objects also implements the
[962]UIEvent interface and [963]UIEvent.view is in use.
1.7.7.1 Activation and default actions
The concept of activation ({"http://www.w3.org/2001/xml-events",
"DOMActivate"}) was introduced in [964]DOM Level 2 Events] to
separate generic actions from the devices used to activate them. For
example, an hyperlink can be activated using a mouse or a keyboard,
and the activation will force the user agent to follow the link. It is
expected that the action of following the link is done using a default
action attached to the hyperlink element. In such case, the default
action of the device event type is to trigger the event type
{"http://www.w3.org/2001/xml-events", "DOMActivate"}. Preventing the
default action of a mouse click when the target node is an hyperlink
will prevent the activation. The same approach is made for control
elements.
Implementations could react to an event before dispatching it and do
changes on the display and the DOM tree. In such case, if a DOM
attribute is changed before the event is fired, cancelling the device
event type will also reverse the change. A good example is the
attribute HTMLInputElement.checked: As described in [965]DOM Level 2
HTML], the value of this property may be changed before the dispatch
of the event; the user clicks on the radio button, the radio button is
being checked (or unchecked) on the display, the attribute
HTMLInputElement.checked is changed as well, and then the device event
type {"http://www.w3.org/2001/xml-events", "click"} is being
dispatched. If the default action of the device event type is
prevented, or if the default action attached to the
{"http://www.w3.org/2001/xml-events", "DOMActivate"} event type is
prevented, the property HTMLInputElement.checked will need to be
changed back to its original value.
07 November 2003
Appendix A: Keyboard events and key identifiers
Editor:
Philippe Le Hégaret, W3C
Table of contents
* [966]A.1 Introduction
+ [967]A.1.1 Modifier keys
+ [968]A.1.2 Dead keys
+ [969]A.1.3 Input Method Editors
+ [970]A.1.4 Guidelines for defining key identifiers
* [971]A.2 Key identifiers set
This section contains necessary information regarding keyboard events:
* Relations between keys, such as dead keys or modifiers keys.
* Relations between keyboard events, their default actions, and text
events.
* The set of key identifiers, and guidelines on how to extend this
set.
Note: This section uses serbian and kanji characters which are not
always available (or are misrepresented) in the alternative versions
or printed versions of this specification.
A.1 Introduction
Each keyboard event references a key using a DOMString key identifier.
The set contained in this appendix is based on the sets of keycodes
from:
* the interface java.awt.event.KeyEvent of the Java 2 Platform v1.4
[972]KeyEvent for Java];
* the enumeration System.Windows.Forms.Keys of the Microsoft .NET
Framework 1.0 [973]Keys enumeration for .Net].
While implementations are recommended to use the most relevant
identifier for a key independently of the platform or keyboard layout
mappings, DOM applications should not make assumption on the ability
of keyboard devices to generate them. When using keyboard events,
"consider using numbers and function keys (F4, F5, and so on) instead
of letters in shortcut-key combinations" ([974]DWW95]) given that
most keyboard layouts will provide keys for those.
"U+0000", "U+0001", ..., "U+FFFFFF" are Unicode based key identifiers
([975]Unicode]). When a key cannot be mapped to Unicode, a specific
identifier is used (see also [976]Guidelines for defining key
identifiers). In any case, no assumption should be made between the
sequence of keyboard events and the text events. The following three
examples illustrate the concept of keyboard layout mappings and its
relation with keyboard events (following the [977]Guidelines for
defining key identifiers, the 'Q' key is mapped to the Latin Capital
Letter Q key).
The keystroke "U+0051" (Latin Capital Letter Q key) will produce (on a
PC/AT US keyboard using a US keyboard layout mapping and without any
modifier activated) the Unicode character q (Latin Small Letter Q):
1. {"http://www.w3.org/2001/xml-events", "keydown"}: "U+0051" (Latin
Capital Letter Q key)
2. {"http://www.w3.org/2001/xml-events", "textInput"}: "q"
3. {"http://www.w3.org/2001/xml-events", "keyup"}: "U+0051"
If the keyboard layout mapping is switched to a french mapping,
pressing the same key will produce:
1. {"http://www.w3.org/2001/xml-events", "keydown"}: "U+0041" (Latin
Capital Letter A key)
2. {"http://www.w3.org/2001/xml-events", "textInput"}: "a"
3. {"http://www.w3.org/2001/xml-events", "keyup"}: "U+0041"
If the keyboard layout mapping is switched to a serbian (cyrillic)
mapping, pressing the same key will produce:
1. {"http://www.w3.org/2001/xml-events", "keydown"}: "U+0409"
(Cyrillic Capital Letter LJE)
2. {"http://www.w3.org/2001/xml-events", "textInput"}: "lj"
3. {"http://www.w3.org/2001/xml-events", "keyup"}: "U+0409"
Note: The order between the text event and keyboard events may differ
depending on the keyboard devices.
A.1.1 Modifier keys
Keyboard input uses modifier keys to change the normal behavior of a
key. Keys associated with modifiers generate, like other keys,
"keydown" and "keyup" events as shown in the example below. Some
modifiers are activated while the key is being pressed down or
maintained pressed such as "Alt", "Control", "Shift", "AltGraph", or
"Meta". Others modifiers are activated depending on their state such
as "CapsLock", "NumLock", or "Scroll". Change in the state happens
when the modifier key is being pressed down. The [978]KeyboardEvent
interface provides convenient attributes for some common modifiers
keys: [979]KeyboardEvent.ctrlKey, [980]KeyboardEvent.shiftKey,
[981]KeyboardEvent.altKey, [982]KeyboardEvent.metaKey. Some operating
systems simulate the "AltGraph" modifier key with the combination of
the "Alt and "Control" modifier keys. Implementations are encouraged
to use the "AltGraph" modifier key.
The following example describes a possible sequence of keys to
generate the Unicode character Q (Latin Capital Letter Q) on a PC/AT
US keyboard using a US mapping:
1. {"http://www.w3.org/2001/xml-events", "keydown"}: "Shift",
shiftKey
2. {"http://www.w3.org/2001/xml-events", "keydown"}: "U+0051" (Latin
Capital Letter Q key), shiftKey
3. {"http://www.w3.org/2001/xml-events", "textInput"}: "Q"
4. {"http://www.w3.org/2001/xml-events", "keyup"}: "U+0051", shiftKey
5. {"http://www.w3.org/2001/xml-events", "keyup"}: "Shift"
The following example describes a possible sequence of keys that does
not generate a Unicode character (using the same configuration):
1. {"http://www.w3.org/2001/xml-events", "keydown"}: "Control",
ctrlKey
2. {"http://www.w3.org/2001/xml-events", "keydown"}: "U+0056" (Latin
Capital Letter V key), ctrlKey
3. {"http://www.w3.org/2001/xml-events", "keyup"}: "U+0056", ctrlKey
4. {"http://www.w3.org/2001/xml-events", "keyup"}: "Control"
Preventing a keydown or keyup event with a modifier does affect the
subsequent
A.1.2 Dead keys
Keyboard input uses dead keys for the input of composed character
sequences. Unlike the handwriting sequence, in which users enter the
base character first, keyboard input requires to enter a special state
when a dead key is pressed and emit the character(s) only when one of
a limited number of "legal" base character is entered.
The dead keys are represented in the key identifiers set using
combining diacritical marks. The sequence of keystrokes "U+0302"
(Combining Circumflex Accent key) and "U+0045" (Latin Capital Letter E
key) will likely produce (on a PC/AT french keyboard using a french
mapping and without any modifier activated) the Unicode character ê
(Latin Small Letter E With Circumflex), as preferred by the Unicode
Normalization Form NFC:
1. {"http://www.w3.org/2001/xml-events", "keydown"}: "U+0302"
(Combining Circumflex Accent key)
2. {"http://www.w3.org/2001/xml-events", "keyup"}: "U+0302"
3. {"http://www.w3.org/2001/xml-events", "keydown"}: "U+0045" (Latin
Capital Letter E key)
4. {"http://www.w3.org/2001/xml-events", "textInput"}: "é"
5. {"http://www.w3.org/2001/xml-events", "keyup"}: "U+0045"
A.1.3 Input Method Editors
Also known as front end processor, an input method editor (IME) is an
application that performs the conversion between keystrokes and
ideographs or other characters, usually by user-guided dictionary
lookup.
This specification does not provide a representation of the input
method editor (IME) events, e.g. representing the input context, i.e.
the IME's functions are not represented in this set. As an example,
receiving a keydown for the "Accept" key identifier does not
necessarily imply that the text currently selected in the IME is being
accepted. It only indicates that a keystroke happened, disconnected
from the IME Accept functionality. Depending on the device in use, the
IME Accept functionality can be obtain using the Accept key or the
Return key. Keyboard events cannot be used to determine the current
state of the input method editor.
Keyboard events correspond to the events generated by the input device
after the keyboard layout mapping but before the processing of the
input method editor.
The following example describes a possible sequence of keys to
generate the Unicode character 市 (Kanji character, part of CJK
Unified Ideographs) using Japanese input methods. This example assumes
that the input method editor is activated and in the Japanese-Romaji
input mode. The keys "Convert" and "Accept" may be replaced by others
depending on the input device in use and the configuration of the IME,
e.g. it could be respectively "U+0020" (Space key) and "Enter".
1. {"http://www.w3.org/2001/xml-events", "keydown"}: "U+0053" (Latin
Capital Letter S key)
2. {"http://www.w3.org/2001/xml-events", "keyup"}: "U+0053" (Latin
Capital Letter S key)
3. {"http://www.w3.org/2001/xml-events", "keydown"}: "U+0049" (Latin
Capital Letter I key)
4. {"http://www.w3.org/2001/xml-events", "keyup"}: "U+0049" (Latin
Capital Letter I key)
5. {"http://www.w3.org/2001/xml-events", "keydown"}: "Convert"
6. {"http://www.w3.org/2001/xml-events", "keyup"}: "Convert"
7. {"http://www.w3.org/2001/xml-events", "keydown"}: "Accept"
8. {"http://www.w3.org/2001/xml-events", "textInput"}: "市"
9. {"http://www.w3.org/2001/xml-events", "keyup"}: "Accept"
A.1.4 Guidelines for defining key identifiers
Note: This section is informative.
The list of key identifiers contained in this appendix is not
exhaustive and input devices may have to define their own key
identifiers. Here is a algorithm to determine which key identifier to
use:
1. Determine a representation for the key by looking at the keyboard
layout mapping in use (and not the keyboard device in use). This
representation should be unique, as human friendly as possible,
platform independent, and consistent. For example, on PC/AT US
keyboards with a US mapping, the 'Q' key is mapped to the key
identifier "U+0051" (Latin Capital Letter Q key), the '1/!' key is
mapped to the key identifier "U+0031" (Digit One key), the key
'`/~' is mapped to the key identifier "U+0060" (Grave Accent key),
and the 'Enter' key is mapped to the key identifier "Enter".
2. Find an appropriate mapping in the Unicode character set. There
might not always be an appropriate and obvious mapping: the
Unicode set contains characters and symbols, the key might
generate different characters depending on the operating system,
... In general, unless the representation of the key can be mapped
to a unique Unicode character, it is better to create a new one.
3. If no appropriate mapping was found, create a key identifier as
human friendly as possible. The key identifier must not contain
white spaces. As an example, the Enter key is mapped to the key
identifier "Enter" and not to "U+000A" (Line Feed), given that
this key generates the character 00000A on Unix operating systems
and the characters 00000D and 00000A on Windows operating systems.
A.2 Key identifiers set
Note: The keycodes Multiply, Add, Substract, Decimal, Separator,
Divide, NumPad0, NumPad1, NumPad2, NumPad3, NumPad4, NumPad5, NumPad6,
NumPad7, NumPad8, and NumPad9 are not part of this set. Use
KeyBoard.keyLocation to know if a key originated from the numeric
keypad.
"Accept"
The Accept (Commit) key.
"Again"
The Again key.
"AllCandidates"
The All Candidates key.
"Alphanumeric"
The Alphanumeric key.
"Alt"
The Alt (Menu) key.
"AltGraph"
The Alt-Graph key.
"Apps"
The Application key.
"Attn"
The ATTN key.
"BrowserBack"
The Browser Back key.
"BrowserFavorites"
The Browser Favorites key.
"BrowserForward"
The Browser Forward key.
"BrowserHome"
The Browser Home key.
"BrowserRefresh"
The Browser Refresh key.
"BrowserSearch"
The Browser Search key.
"BrowserStop"
The Browser Stop key.
"CapsLock"
The Caps Lock (Capital) key.
"Clear"
The Clear key.
"CodeInput"
The Code Input key.
"Compose"
The Compose key.
"Control"
The Control (Ctrl) key.
"Crsel"
The Crsel key.
"Convert"
The Convert key.
"Copy"
The Copy key.
"Cut"
The Cut key.
"Down"
The Down Arrow key.
"End"
The End key.
"Enter"
The Enter key.
Note: This key identifier is also used for the Return
(Macintosh numpad) key.
"EraseEof"
The Erase EOF key.
"Execute"
The Execute key.
"Exsel"
The Exsel key.
"F1"
The F1 key.
"F2"
The F2 key.
"F3"
The F3 key.
"F4"
The F4 key.
"F5"
The F5 key.
"F6"
The F6 key.
"F7"
The F7 key.
"F8"
The F8 key.
"F9"
The F9 key.
"F10"
The F10 key.
"F11"
The F11 key.
"F12"
The F12 key.
"F13"
The F13 key.
"F14"
The F14 key.
"F15"
The F15 key.
"F16"
The F16 key.
"F17"
The F17 key.
"F18"
The F18 key.
"F19"
The F19 key.
"F20"
The F20 key.
"F21"
The F21 key.
"F22"
The F22 key.
"F23"
The F23 key.
"F24"
The F24 key.
"FinalMode"
The Final Mode (Final) key used on some asian keyboards.
"Find"
The Find key.
"FullWidth"
The Full-Width Characters key.
"HalfWidth"
The Half-Width Characters key.
"HangulMode"
The Hangul (Korean characters) Mode key.
"HanjaMode"
The Hanja (Korean characters) Mode key.
"Help"
The Help key.
"Hiragana"
The Hiragana (Japanese Kana characters) key.
"Home"
The Home key.
"Insert"
The Insert (Ins) key.
"JapaneseHiragana"
The Japanese-Hiragana key.
"JapaneseKatakana"
The Japanese-Katakana key.
"JapaneseRomaji"
The Japanese-Romaji key.
"JunjaMode"
The Junja Mode key.
"KanaMode"
The Kana Mode (Kana Lock) key.
"KanjiMode"
The Kanji (Japanese name for ideographic characters of Chinese
origin) Mode key.
"Katakana"
The Katakana (Japanese Kana characters) key.
"LaunchApplication1"
The Start Application One key.
"LaunchApplication2"
The Start Application Two key.
"LaunchMail"
The Start Mail key.
"Left"
The Left Arrow key.
"Meta"
The Meta key.
"MediaNextTrack"
The Media Next Track key.
"MediaPlayPause"
The Media Play Pause key.
"MediaPreviousTrack"
The Media Previous Track key.
"MediaStop"
The Media Stok key.
"ModeChange"
The Mode Change key.
"Nonconvert"
The Nonconvert (Don't Convert) key.
"NumLock"
The Num Lock key.
"PageDown"
The Page Down (Next) key.
"PageUp"
The Page Up key.
"Paste"
The Paste key.
"Pause"
The Pause key.
"Play"
The Play key.
"PreviousCandidate"
The Previous Candidate function key.
"PrintScreen"
The Print Screen (PrintScrn, SnapShot) key.
"Process"
The Process key.
"Props"
The Props key.
"Right"
The Right Arrow key.
"RomanCharacters"
The Roman Characters function key.
"Scroll"
The Scroll Lock key.
"Select"
The Select key.
"SelectMedia"
The Select Media key.
"Shift"
The Shift key.
"Stop"
The Stop key.
"Up"
The Up Arrow key.
"Undo"
The Undo key.
"VolumeDown"
The Volume Down key.
"VolumeMute"
The Volume Mute key.
"VolumeUp"
The Volume Up key.
"Win"
The Windows Logo key.
"Zoom"
The Zoom key.
"U+0008"
The Backspace (Back) key.
"U+0009"
The Horizontal Tabulation (Tab) key.
"U+0018"
The Cancel key.
"U+001B"
The Escape (Esc) key.
"U+0020"
The Space (Spacebar) key.
"U+0021"
The Exclamation Mark (Factorial, Bang) key (!).
"U+0022"
The Quotation Mark (Quote Double) key (").
"U+0023"
The Number Sign (Pound Sign, Hash, Crosshatch, Octothorpe) key
(#).
"U+0024"
The Dollar Sign (milreis, escudo) key ($).
"U+0026"
The Ampersand key (&).
"U+0027"
The Apostrophe (Apostrophe-Quote, APL Quote) key (').
"U+0028"
The Left Parenthesis (Opening Parenthesis) key (().
"U+0029"
The Right Parenthesis (Closing Parenthesis) key ()).
"U+002A"
The Asterix (Star) key (*).
"U+002B"
The Plus Sign (Plus) key (+).
"U+002C"
The Comma (decimal separator) sign key (,).
"U+002D"
The Hyphen-minus (hyphen or minus sign) key (-).
"U+002E"
The Full Stop (period, dot, decimal point) key (.).
"U+002F"
The Solidus (slash, virgule, shilling) key (/).
"U+0030"
The Digit Zero key (0).
"U+0031"
The Digit One key (1).
"U+0032"
The Digit Two key (2).
"U+0033"
The Digit Three key (3).
"U+0034"
The Digit Four key (4).
"U+0035"
The Digit Five key (5).
"U+0036"
The Digit Six key (6).
"U+0037"
The Digit Seven key (7).
"U+0038"
The Digit Eight key (8).
"U+0039"
The Digit Nine key (9).
"U+003A"
The Colon key (:).
"U+003B"
The Semicolon key (;).
"U+003C"
The Less-Than Sign key (<).
"U+003D"
The Equals Sign key (=).
"U+003E"
The Greater-Than Sign key (>).
"U+003F"
The Question Mark key (?).
"U+0040"
The Commercial At (@) key.
"U+0041"
The Latin Capital Letter A key (A).
"U+0042"
The Latin Capital Letter B key (B).
"U+0043"
The Latin Capital Letter C key (C).
"U+0044"
The Latin Capital Letter D key (D).
"U+0045"
The Latin Capital Letter E key (E).
"U+0046"
The Latin Capital Letter F key (F).
"U+0047"
The Latin Capital Letter G key (G).
"U+0048"
The Latin Capital Letter H key (H).
"U+0049"
The Latin Capital Letter I key (I).
"U+004A"
The Latin Capital Letter J key (J).
"U+004B"
The Latin Capital Letter K key (K).
"U+004C"
The Latin Capital Letter L key (L).
"U+004D"
The Latin Capital Letter M key (M).
"U+004E"
The Latin Capital Letter N key (N).
"U+004F"
The Latin Capital Letter O key (O).
"U+0050"
The Latin Capital Letter P key (P).
"U+0051"
The Latin Capital Letter Q key (Q).
"U+0052"
The Latin Capital Letter R key (R).
"U+0053"
The Latin Capital Letter S key (S).
"U+0054"
The Latin Capital Letter T key (T).
"U+0055"
The Latin Capital Letter U key (U).
"U+0056"
The Latin Capital Letter V key (V).
"U+0057"
The Latin Capital Letter W key (W).
"U+0058"
The Latin Capital Letter X key (X).
"U+0059"
The Latin Capital Letter Y key (Y).
"U+005A"
The Latin Capital Letter Z key (Z).
"U+005B"
The Left Square Bracket (Opening Square Bracket) key ([).
"U+005C"
The Reverse Solidus (Backslash) key (\).
"U+005D"
The Right Square Bracket (Closing Square Bracket) key (]).
"U+005E"
The Circumflex Accent key (^).
"U+005F"
The Low Sign (Spacing Underscore, Underscore) key (_).
"U+0060"
The Grave Accent (Back Quote) key (`).
"U+007B"
The Left Curly Bracket (Opening Curly Bracket, Opening Brace,
Brace Left) key ({).
"U+007C"
The Vertical Line (Vertical Bar, Pipe) key (|).
"U+007D"
The Right Curly Bracket (Closing Curly Bracket, Closing Brace,
Brace Right) key (}).
"U+007F"
The Delete (Del) Key.
"U+00A1"
The Inverted Exclamation Mark key (¡).
"U+0300"
The Combining Grave Accent (Greek Varia, Dead Grave) key.
"U+0301"
The Combining Acute Accent (Stress Mark, Greek Oxia, Tonos,
Dead Eacute) key.
"U+0302"
The Combining Circumflex Accent (Hat, Dead Circumflex) key.
"U+0303"
The Combining Tilde (Dead Tilde) key.
"U+0304"
The Combining Macron (Long, Dead Macron) key.
"U+0306"
The Combining Breve (Short, Dead Breve) key.
"U+0307"
The Combining Dot Above (Derivative, Dead Above Dot) key.
"U+0308"
The Combining Diaeresis (Double Dot Abode, Umlaut, Greek
Dialytika, Double Derivative, Dead Diaeresis) key.
"U+030A"
The Combining Ring Above (Dead Above Ring) key.
"U+030B"
The Combining Double Acute Accent (Dead Doubleacute) key.
"U+030C"
The Combining Caron (Hacek, V Above, Dead Caron) key.
"U+0327"
The Combining Cedilla (Dead Cedilla) key.
"U+0328"
The Combining Ogonek (Nasal Hook, Dead Ogonek) key.
"U+0345"
The Combining Greek Ypogegrammeni (Greek Non-Spacing Iota
Below, Iota Subscript, Dead Iota) key.
"U+20AC"
The Euro Currency Sign key (EUR).
"U+3099"
The Combining Katakana-Hiragana Voiced Sound Mark (Dead Voiced
Sound) key.
"U+309A"
The Combining Katakana-Hiragana Semi-Voiced Sound Mark (Dead
Semivoiced Sound) key.
07 November 2003
Appendix B: Changes
Editor:
Philippe Le Hégaret, W3C
B.1 Changes between DOM Level 2 Events and DOM Level 3 Events
This new specification provides a better separation between the DOM
event flow, the event types, and the DOM interfaces.
B.1.1 Changes to DOM Level 2 event flow
This new specification introduced two new concepts in the event flow:
* event groups: unlike DOM Level 2 Events,
[983]Event.stopPropagation() does no longer stop the event
propagation entirely. It only stops it for a given event group.
* partial ordering of event listeners: within an event group, event
listeners are now ordered while ordering was unspecified in DOM
Level 2 Events.
B.1.2 Changes to DOM Level 2 event types
Lots of clarifications have been made on the event types. The
conformance is now explicitly defined against the event types, and not
only in terms of interfaces required by the event types. Support for
namespaces and the features "BasicEvents", "TextEvents",
"KeyboardEvents", and "MutationNameEvents" have been introduced.
The DOM Level 2 Event load event type can now be dispatched to more
[984]HTML 4.01] elements. blur and focus have been clarified and
restricted to [985]HTML 4.01] applications only.
B.1.3 Changes to DOM Level 2 Events interfaces
Interface [986]Event
The [987]Event interface has a new attribute
[988]Event.namespaceURI, and a four new methods:
[989]Event.isCustom(), [990]Event.stopImmediatePropagation(),
[991]Event.isDefaultPrevented(), and [992]Event.initEventNS.
Interface [993]EventTarget
The [994]EventTarget interface has four new methods:
[995]EventTarget.addEventListenerNS(namespaceURI, type,
listener, useCapture, evtGroup),
[996]EventTarget.removeEventListenerNS(namespaceURI, type,
listener, useCapture),
[997]EventTarget.willTriggerNS(namespaceURI, type),
[998]EventTarget.hasEventListenerNS(namespaceURI, type). The
method [999]EventTarget.dispatchEvent(evt) was modified.
Interface [1000]DocumentEvent
The [1001]DocumentEvent interface has one new method:
[1002]DocumentEvent.canDispatch(namespaceURI, type).
Interface [1003]UIEvent
The [1004]UIEvent interface has a new method
[1005]UIEvent.initUIEventNS(...).
Interface [1006]MouseEvent
The [1007]MouseEvent interface has two new methods
[1008]MouseEvent.getModifierState(keyIdentifierArg) and
[1009]MouseEvent.initMouseEventNS(...).
Interface [1010]MutationEvent
The [1011]MutationEvent interface has a new method
[1012]MutationEvent.initMutationEventNS(...).
Exception [1013]EventException
The [1014]DISPATCH_REQUEST_ERR constant has been added.
B.1.4 New Interfaces
The interfaces [1015]CustomEvent, [1016]TextEvent,
[1017]KeyboardEvent, and [1018]MutationNameEvent were added to the
Events module.
07 November 2003
Appendix C: IDL Definitions
This appendix contains the complete OMG IDL [1019]OMG IDL] for the
Level 3 Document Object Model Events definitions.
The IDL files are also available as:
[1020]http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/idl.z
ip
[1020] http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/idl.zip
[1021]events.idl:
[1021] http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/idl/events.idl
// File: events.idl
#ifndef _EVENTS_IDL_
#define _EVENTS_IDL_
#include "dom.idl"
#include "views.idl"
#pragma prefix "dom.w3c.org"
module events
{
typedef dom::DOMString DOMString;
typedef dom::DOMTimeStamp DOMTimeStamp;
typedef dom::DOMObject DOMObject;
typedef dom::Node Node;
interface EventTarget;
interface EventListener;
// Introduced in DOM Level 2:
exception [1022]EventException {
unsigned short code;
};
// EventExceptionCode
const unsigned short [1023]UNSPECIFIED_EVENT_TYPE_ERR = 0;
// Introduced in DOM Level 3:
const unsigned short [1024]DISPATCH_REQUEST_ERR = 1;
// Introduced in DOM Level 2:
interface [1025]Event {
// PhaseType
const unsigned short [1026]CAPTURING_PHASE = 1;
const unsigned short [1027]AT_TARGET = 2;
const unsigned short [1028]BUBBLING_PHASE = 3;
readonly attribute DOMString [1029]type;
readonly attribute [1030]EventTarget [1031]target;
readonly attribute [1032]EventTarget [1033]currentTarget;
readonly attribute unsigned short [1034]eventPhase;
readonly attribute boolean [1035]bubbles;
readonly attribute boolean [1036]cancelable;
readonly attribute DOMTimeStamp [1037]timeStamp;
void [1038]stopPropagation();
void [1039]preventDefault();
void [1040]initEvent(in DOMString eventTypeArg,
in boolean canBubbleArg,
in boolean cancelableArg);
// Introduced in DOM Level 3:
readonly attribute DOMString [1041]namespaceURI;
// Introduced in DOM Level 3:
boolean [1042]isCustom();
// Introduced in DOM Level 3:
void [1043]stopImmediatePropagation();
// Introduced in DOM Level 3:
boolean [1044]isDefaultPrevented();
// Introduced in DOM Level 3:
void [1045]initEventNS(in DOMString namespaceURIArg,
in DOMString eventTypeArg,
in boolean canBubbleArg,
in boolean cancelableArg);
};
// Introduced in DOM Level 2:
interface [1046]EventTarget {
void [1047]addEventListener(in DOMString type,
in [1048]EventListener listener,
in boolean useCapture);
void [1049]removeEventListener(in DOMString type,
in [1050]EventListener listener,
in boolean useCapture);
// Modified in DOM Level 3:
boolean [1051]dispatchEvent(in [1052]Event evt)
raises([1053]EventException);
// Introduced in DOM Level 3:
void [1054]addEventListenerNS(in DOMString namespaceURI,
in DOMString type,
in [1055]EventListener listener,
in boolean useCapture,
in DOMObject evtGroup);
// Introduced in DOM Level 3:
void [1056]removeEventListenerNS(in DOMString namespaceURI,
in DOMString type,
in [1057]EventListener listener,
in boolean useCapture);
// Introduced in DOM Level 3:
boolean [1058]willTriggerNS(in DOMString namespaceURI,
in DOMString type);
// Introduced in DOM Level 3:
boolean [1059]hasEventListenerNS(in DOMString namespaceURI,
in DOMString type);
};
// Introduced in DOM Level 2:
interface [1060]EventListener {
void [1061]handleEvent(in [1062]Event evt);
};
// Introduced in DOM Level 2:
interface [1063]DocumentEvent {
[1064]Event [1065]createEvent(in DOMString eventType)
raises(dom::DOMException);
// Introduced in DOM Level 3:
boolean [1066]canDispatch(in DOMString namespaceURI,
in DOMString type);
};
// Introduced in DOM Level 3:
interface [1067]CustomEvent : [1068]Event {
void [1069]setDispatchState(in [1070]EventTarget target,
in unsigned short phase);
boolean [1071]isPropagationStopped();
boolean [1072]isImmediatePropagationStopped();
};
// Introduced in DOM Level 2:
interface [1073]UIEvent : [1074]Event {
readonly attribute views::AbstractView [1075]view;
readonly attribute long [1076]detail;
void [1077]initUIEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in views::AbstractView viewArg,
in long detailArg);
// Introduced in DOM Level 3:
void [1078]initUIEventNS(in DOMString namespaceURI,
in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in views::AbstractView viewArg,
in long detailArg);
};
// Introduced in DOM Level 3:
interface [1079]TextEvent : [1080]UIEvent {
readonly attribute DOMString [1081]data;
void [1082]initTextEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in views::AbstractView viewArg,
in DOMString dataArg);
void [1083]initTextEventNS(in DOMString namespaceURI,
in DOMString type,
in boolean canBubbleArg,
in boolean cancelableArg,
in views::AbstractView viewArg,
in DOMString dataArg);
};
// Introduced in DOM Level 2:
interface [1084]MouseEvent : [1085]UIEvent {
readonly attribute long [1086]screenX;
readonly attribute long [1087]screenY;
readonly attribute long [1088]clientX;
readonly attribute long [1089]clientY;
readonly attribute boolean [1090]ctrlKey;
readonly attribute boolean [1091]shiftKey;
readonly attribute boolean [1092]altKey;
readonly attribute boolean [1093]metaKey;
readonly attribute unsigned short [1094]button;
readonly attribute [1095]EventTarget [1096]relatedTarget;
void [1097]initMouseEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in views::AbstractView viewArg,
in long detailArg,
in long screenXArg,
in long screenYArg,
in long clientXArg,
in long clientYArg,
in boolean ctrlKeyArg,
in boolean altKeyArg,
in boolean shiftKeyArg,
in boolean metaKeyArg,
in unsigned short buttonArg,
in [1098]EventTarget relatedTargetArg);
// Introduced in DOM Level 3:
boolean [1099]getModifierState(in DOMString keyIdentifierArg);
// Introduced in DOM Level 3:
void [1100]initMouseEventNS(in DOMString namespaceURI,
in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in views::AbstractView viewArg,
in long detailArg,
in long screenXArg,
in long screenYArg,
in long clientXArg,
in long clientYArg,
in unsigned short buttonArg,
in [1101]EventTarget relatedTargetArg,
in DOMString modifiersList);
};
// Introduced in DOM Level 3:
interface [1102]KeyboardEvent : [1103]UIEvent {
// KeyLocationCode
const unsigned long [1104]DOM_KEY_LOCATION_STANDARD = 0x00;
const unsigned long [1105]DOM_KEY_LOCATION_LEFT = 0x01;
const unsigned long [1106]DOM_KEY_LOCATION_RIGHT = 0x02;
const unsigned long [1107]DOM_KEY_LOCATION_NUMPAD = 0x03;
readonly attribute DOMString [1108]keyIdentifier;
readonly attribute unsigned long [1109]keyLocation;
readonly attribute boolean [1110]ctrlKey;
readonly attribute boolean [1111]shiftKey;
readonly attribute boolean [1112]altKey;
readonly attribute boolean [1113]metaKey;
boolean [1114]getModifierState(in DOMString keyIdentifierArg);
void [1115]initKeyboardEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in views::AbstractView viewArg,
in DOMString keyIdentifierArg,
in unsigned long keyLocationArg,
in DOMString modifiersList);
void [1116]initKeyboardEventNS(in DOMString namespaceURI,
in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in views::AbstractView viewArg,
in DOMString keyIdentifierArg,
in unsigned long keyLocationArg,
in DOMString modifiersList);
};
// Introduced in DOM Level 2:
interface [1117]MutationEvent : [1118]Event {
// attrChangeType
const unsigned short [1119]MODIFICATION = 1;
const unsigned short [1120]ADDITION = 2;
const unsigned short [1121]REMOVAL = 3;
readonly attribute Node [1122]relatedNode;
readonly attribute DOMString [1123]prevValue;
readonly attribute DOMString [1124]newValue;
readonly attribute DOMString [1125]attrName;
readonly attribute unsigned short [1126]attrChange;
void [1127]initMutationEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in Node relatedNodeArg,
in DOMString prevValueArg,
in DOMString newValueArg,
in DOMString attrNameArg,
in unsigned short attrChangeArg);
// Introduced in DOM Level 3:
void [1128]initMutationEventNS(in DOMString namespaceURI,
in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in Node relatedNodeArg,
in DOMString prevValueArg,
in DOMString newValueArg,
in DOMString attrNameArg,
in unsigned short attrChangeArg);
};
// Introduced in DOM Level 3:
interface [1129]MutationNameEvent : [1130]MutationEvent {
readonly attribute DOMString [1131]prevNamespaceURI;
readonly attribute DOMString [1132]prevNodeName;
// Introduced in DOM Level 3:
void [1133]initMutationNameEvent(in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in Node relatedNodeArg,
in DOMString prevNamespaceURIArg,
in DOMString prevNodeNameArg);
// Introduced in DOM Level 3:
void [1134]initMutationNameEventNS(in DOMString namespaceURI,
in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in Node relatedNodeArg,
in DOMString prevNamespaceURIArg
,
in DOMString prevNodeNameArg);
};
};
#endif // _EVENTS_IDL_
07 November 2003
Appendix D: Java Language Binding
This appendix contains the complete Java [1135]Java] bindings for the
Level 3 Document Object Model Events.
The Java files are also available as
[1136]http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/java-
binding.zip
[1136] http://www.w3.org/TR/2003/NOTE-DOM-Level-3-Events-20031107/java-binding.zip
org/w3c/dom/events/EventException.java:
package org.w3c.dom.events;
public class EventException extends RuntimeException {
public EventException(short code, String message) {
super(message);
this.code = code;
}
public short code;
// EventExceptionCode
public static final short UNSPECIFIED_EVENT_TYPE_ERR = 0;
public static final short DISPATCH_REQUEST_ERR = 1;
}
org/w3c/dom/events/Event.java:
package org.w3c.dom.events;
public interface Event {
// PhaseType
public static final short CAPTURING_PHASE = 1;
public static final short AT_TARGET = 2;
public static final short BUBBLING_PHASE = 3;
public String getType();
public EventTarget getTarget();
public EventTarget getCurrentTarget();
public short getEventPhase();
public boolean getBubbles();
public boolean getCancelable();
public long getTimeStamp();
public void stopPropagation();
public void preventDefault();
public void initEvent(String eventTypeArg,
boolean canBubbleArg,
boolean cancelableArg);
public String getNamespaceURI();
public boolean isCustom();
public void stopImmediatePropagation();
public boolean isDefaultPrevented();
public void initEventNS(String namespaceURIArg,
String eventTypeArg,
boolean canBubbleArg,
boolean cancelableArg);
}
org/w3c/dom/events/EventTarget.java:
package org.w3c.dom.events;
public interface EventTarget {
public void addEventListener(String type,
EventListener listener,
boolean useCapture);
public void removeEventListener(String type,
EventListener listener,
boolean useCapture);
public boolean dispatchEvent(Event evt)
throws EventException;
public void addEventListenerNS(String namespaceURI,
String type,
EventListener listener,
boolean useCapture,
Object evtGroup);
public void removeEventListenerNS(String namespaceURI,
String type,
EventListener listener,
boolean useCapture);
public boolean willTriggerNS(String namespaceURI,
String type);
public boolean hasEventListenerNS(String namespaceURI,
String type);
}
org/w3c/dom/events/EventListener.java:
package org.w3c.dom.events;
public interface EventListener {
public void handleEvent(Event evt);
}
org/w3c/dom/events/DocumentEvent.java:
package org.w3c.dom.events;
import org.w3c.dom.DOMException;
public interface DocumentEvent {
public Event createEvent(String eventType)
throws DOMException;
public boolean canDispatch(String namespaceURI,
String type);
}
org/w3c/dom/events/CustomEvent.java:
package org.w3c.dom.events;
public interface CustomEvent extends Event {
public void setDispatchState(EventTarget target,
short phase);
public boolean isPropagationStopped();
public boolean isImmediatePropagationStopped();
}
org/w3c/dom/events/UIEvent.java:
package org.w3c.dom.events;
import org.w3c.dom.views.AbstractView;
public interface UIEvent extends Event {
public AbstractView getView();
public int getDetail();
public void initUIEvent(String typeArg,
boolean canBubbleArg,
boolean cancelableArg,
AbstractView viewArg,
int detailArg);
public void initUIEventNS(String namespaceURI,
String typeArg,
boolean canBubbleArg,
boolean cancelableArg,
AbstractView viewArg,
int detailArg);
}
org/w3c/dom/events/TextEvent.java:
package org.w3c.dom.events;
import org.w3c.dom.views.AbstractView;
public interface TextEvent extends UIEvent {
public String getData();
public void initTextEvent(String typeArg,
boolean canBubbleArg,
boolean cancelableArg,
AbstractView viewArg,
String dataArg);
public void initTextEventNS(String namespaceURI,
String type,
boolean canBubbleArg,
boolean cancelableArg,
AbstractView viewArg,
String dataArg);
}
org/w3c/dom/events/MouseEvent.java:
package org.w3c.dom.events;
import org.w3c.dom.views.AbstractView;
public interface MouseEvent extends UIEvent {
public int getScreenX();
public int getScreenY();
public int getClientX();
public int getClientY();
public boolean getCtrlKey();
public boolean getShiftKey();
public boolean getAltKey();
public boolean getMetaKey();
public short getButton();
public EventTarget getRelatedTarget();
public void initMouseEvent(String typeArg,
boolean canBubbleArg,
boolean cancelableArg,
AbstractView viewArg,
int detailArg,
int screenXArg,
int screenYArg,
int clientXArg,
int clientYArg,
boolean ctrlKeyArg,
boolean altKeyArg,
boolean shiftKeyArg,
boolean metaKeyArg,
short buttonArg,
EventTarget relatedTargetArg);
public boolean getModifierState(String keyIdentifierArg);
public void initMouseEventNS(String namespaceURI,
String typeArg,
boolean canBubbleArg,
boolean cancelableArg,
AbstractView viewArg,
int detailArg,
int screenXArg,
int screenYArg,
int clientXArg,
int clientYArg,
short buttonArg,
EventTarget relatedTargetArg,
String modifiersList);
}
org/w3c/dom/events/KeyboardEvent.java:
package org.w3c.dom.events;
import org.w3c.dom.views.AbstractView;
public interface KeyboardEvent extends UIEvent {
// KeyLocationCode
public static final int DOM_KEY_LOCATION_STANDARD = 0x00;
public static final int DOM_KEY_LOCATION_LEFT = 0x01;
public static final int DOM_KEY_LOCATION_RIGHT = 0x02;
public static final int DOM_KEY_LOCATION_NUMPAD = 0x03;
public String getKeyIdentifier();
public int getKeyLocation();
public boolean getCtrlKey();
public boolean getShiftKey();
public boolean getAltKey();
public boolean getMetaKey();
public boolean getModifierState(String keyIdentifierArg);
public void initKeyboardEvent(String typeArg,
boolean canBubbleArg,
boolean cancelableArg,
AbstractView viewArg,
String keyIdentifierArg,
int keyLocationArg,
String modifiersList);
public void initKeyboardEventNS(String namespaceURI,
String typeArg,
boolean canBubbleArg,
boolean cancelableArg,
AbstractView viewArg,
String keyIdentifierArg,
int keyLocationArg,
String modifiersList);
}
org/w3c/dom/events/MutationEvent.java:
package org.w3c.dom.events;
import org.w3c.dom.Node;
public interface MutationEvent extends Event {
// attrChangeType
public static final short MODIFICATION = 1;
public static final short ADDITION = 2;
public static final short REMOVAL = 3;
public Node getRelatedNode();
public String getPrevValue();
public String getNewValue();
public String getAttrName();
public short getAttrChange();
public void initMutationEvent(String typeArg,
boolean canBubbleArg,
boolean cancelableArg,
Node relatedNodeArg,
String prevValueArg,
String newValueArg,
String attrNameArg,
short attrChangeArg);
public void initMutationEventNS(String namespaceURI,
String typeArg,
boolean canBubbleArg,
boolean cancelableArg,
Node relatedNodeArg,
String prevValueArg,
String newValueArg,
String attrNameArg,
short attrChangeArg);
}
org/w3c/dom/events/MutationNameEvent.java:
package org.w3c.dom.events;
import org.w3c.dom.Node;
public interface MutationNameEvent extends MutationEvent {
public String getPrevNamespaceURI();
public String getPrevNodeName();
public void initMutationNameEvent(String typeArg,
boolean canBubbleArg,
boolean cancelableArg,
Node relatedNodeArg,
String prevNamespaceURIArg,
String prevNodeNameArg);
public void initMutationNameEventNS(String namespaceURI,
String typeArg,
boolean canBubbleArg,
boolean cancelableArg,
Node relatedNodeArg,
String prevNamespaceURIArg,
String prevNodeNameArg);
}
07 November 2003
Appendix E: ECMAScript Language Binding
This appendix contains the complete ECMAScript [1137]ECMAScript]
binding for the Level 3 Document Object Model Events definitions.
Properties of the Event Constructor function:
Event.CAPTURING_PHASE
The value of the constant Event.CAPTURING_PHASE is 1.
Event.AT_TARGET
The value of the constant Event.AT_TARGET is 2.
Event.BUBBLING_PHASE
The value of the constant Event.BUBBLING_PHASE is 3.
Objects that implement the Event interface:
Properties of objects that implement the Event interface:
type
This read-only property is a String.
target
This read-only property is an object that
implements the EventTarget interface.
currentTarget
This read-only property is an object that
implements the EventTarget interface.
eventPhase
This read-only property is a Number.
bubbles
This read-only property is a Boolean.
cancelable
This read-only property is a Boolean.
timeStamp
This read-only property is an object that
implements the Date interface.
namespaceURI
This read-only property is a String.
Functions of objects that implement the Event interface:
stopPropagation()
This function has no return value.
preventDefault()
This function has no return value.
initEvent(eventTypeArg, canBubbleArg, cancelableArg)
This function has no return value.
The eventTypeArg parameter is a String.
The canBubbleArg parameter is a Boolean.
The cancelableArg parameter is a Boolean.
isCustom()
This function returns a Boolean.
stopImmediatePropagation()
This function has no return value.
isDefaultPrevented()
This function returns a Boolean.
initEventNS(namespaceURIArg, eventTypeArg, canBubbleArg,
cancelableArg)
This function has no return value.
The namespaceURIArg parameter is a String.
The eventTypeArg parameter is a String.
The canBubbleArg parameter is a Boolean.
The cancelableArg parameter is a Boolean.
Objects that implement the EventTarget interface:
Functions of objects that implement the EventTarget interface:
addEventListener(type, listener, useCapture)
This function has no return value.
The type parameter is a String.
The listener parameter is an object that implements
the EventListener interface.
The useCapture parameter is a Boolean.
removeEventListener(type, listener, useCapture)
This function has no return value.
The type parameter is a String.
The listener parameter is an object that implements
the EventListener interface.
The useCapture parameter is a Boolean.
dispatchEvent(evt)
This function returns a Boolean.
The evt parameter is an object that implements the
Event interface.
This function can raise an object that implements
the EventException interface.
addEventListenerNS(namespaceURI, type, listener,
useCapture, evtGroup)
This function has no return value.
The namespaceURI parameter is a String.
The type parameter is a String.
The listener parameter is an object that implements
the EventListener interface.
The useCapture parameter is a Boolean.
The evtGroup parameter is an object that implements
the Object interface.
removeEventListenerNS(namespaceURI, type, listener,
useCapture)
This function has no return value.
The namespaceURI parameter is a String.
The type parameter is a String.
The listener parameter is an object that implements
the EventListener interface.
The useCapture parameter is a Boolean.
willTriggerNS(namespaceURI, type)
This function returns a Boolean.
The namespaceURI parameter is a String.
The type parameter is a String.
hasEventListenerNS(namespaceURI, type)
This function returns a Boolean.
The namespaceURI parameter is a String.
The type parameter is a String.
EventListener function:
This function has no return value. The parameter is an object
that implements the Event interface.
Properties of the EventException Constructor function:
EventException.UNSPECIFIED_EVENT_TYPE_ERR
The value of the constant
EventException.UNSPECIFIED_EVENT_TYPE_ERR is 0.
EventException.DISPATCH_REQUEST_ERR
The value of the constant
EventException.DISPATCH_REQUEST_ERR is 1.
Objects that implement the EventException interface:
Properties of objects that implement the EventException
interface:
code
This property is a Number.
Objects that implement the DocumentEvent interface:
Functions of objects that implement the DocumentEvent interface:
createEvent(eventType)
This function returns an object that implements the
Event interface.
The eventType parameter is a String.
This function can raise an object that implements
the DOMException interface.
canDispatch(namespaceURI, type)
This function returns a Boolean.
The namespaceURI parameter is a String.
The type parameter is a String.
Objects that implement the CustomEvent interface:
Objects that implement the CustomEvent interface have all
properties and functions of the Event interface as well
as the properties and functions defined below.
Functions of objects that implement the CustomEvent interface:
setDispatchState(target, phase)
This function has no return value.
The target parameter is an object that implements
the EventTarget interface.
The phase parameter is a Number.
isPropagationStopped()
This function returns a Boolean.
isImmediatePropagationStopped()
This function returns a Boolean.
Objects that implement the UIEvent interface:
Objects that implement the UIEvent interface have all properties
and functions of the Event interface as well as the
properties and functions defined below.
Properties of objects that implement the UIEvent interface:
view
This read-only property is an object that
implements the AbstractView interface.
detail
This read-only property is a Number.
Functions of objects that implement the UIEvent interface:
initUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg,
detailArg)
This function has no return value.
The typeArg parameter is a String.
The canBubbleArg parameter is a Boolean.
The cancelableArg parameter is a Boolean.
The viewArg parameter is an object that implements
the AbstractView interface.
The detailArg parameter is a Number.
initUIEventNS(namespaceURI, typeArg, canBubbleArg,
cancelableArg, viewArg, detailArg)
This function has no return value.
The namespaceURI parameter is a String.
The typeArg parameter is a String.
The canBubbleArg parameter is a Boolean.
The cancelableArg parameter is a Boolean.
The viewArg parameter is an object that implements
the AbstractView interface.
The detailArg parameter is a Number.
Objects that implement the TextEvent interface:
Objects that implement the TextEvent interface have all
properties and functions of the UIEvent interface as well
as the properties and functions defined below.
Properties of objects that implement the TextEvent interface:
data
This read-only property is a String.
Functions of objects that implement the TextEvent interface:
initTextEvent(typeArg, canBubbleArg, cancelableArg,
viewArg, dataArg)
This function has no return value.
The typeArg parameter is a String.
The canBubbleArg parameter is a Boolean.
The cancelableArg parameter is a Boolean.
The viewArg parameter is an object that implements
the AbstractView interface.
The dataArg parameter is a String.
initTextEventNS(namespaceURI, type, canBubbleArg,
cancelableArg, viewArg, dataArg)
This function has no return value.
The namespaceURI parameter is a String.
The type parameter is a String.
The canBubbleArg parameter is a Boolean.
The cancelableArg parameter is a Boolean.
The viewArg parameter is an object that implements
the AbstractView interface.
The dataArg parameter is a String.
Objects that implement the MouseEvent interface:
Objects that implement the MouseEvent interface have all
properties and functions of the UIEvent interface as well
as the properties and functions defined below.
Properties of objects that implement the MouseEvent interface:
screenX
This read-only property is a Number.
screenY
This read-only property is a Number.
clientX
This read-only property is a Number.
clientY
This read-only property is a Number.
ctrlKey
This read-only property is a Boolean.
shiftKey
This read-only property is a Boolean.
altKey
This read-only property is a Boolean.
metaKey
This read-only property is a Boolean.
button
This read-only property is a Number.
relatedTarget
This read-only property is an object that
implements the EventTarget interface.
Functions of objects that implement the MouseEvent interface:
initMouseEvent(typeArg, canBubbleArg, cancelableArg,
viewArg, detailArg, screenXArg, screenYArg,
clientXArg, clientYArg, ctrlKeyArg, altKeyArg,
shiftKeyArg, metaKeyArg, buttonArg,
relatedTargetArg)
This function has no return value.
The typeArg parameter is a String.
The canBubbleArg parameter is a Boolean.
The cancelableArg parameter is a Boolean.
The viewArg parameter is an object that implements
the AbstractView interface.
The detailArg parameter is a Number.
The screenXArg parameter is a Number.
The screenYArg parameter is a Number.
The clientXArg parameter is a Number.
The clientYArg parameter is a Number.
The ctrlKeyArg parameter is a Boolean.
The altKeyArg parameter is a Boolean.
The shiftKeyArg parameter is a Boolean.
The metaKeyArg parameter is a Boolean.
The buttonArg parameter is a Number.
The relatedTargetArg parameter is an object that
implements the EventTarget interface.
getModifierState(keyIdentifierArg)
This function returns a Boolean.
The keyIdentifierArg parameter is a String.
initMouseEventNS(namespaceURI, typeArg, canBubbleArg,
cancelableArg, viewArg, detailArg, screenXArg,
screenYArg, clientXArg, clientYArg, buttonArg,
relatedTargetArg, modifiersList)
This function has no return value.
The namespaceURI parameter is a String.
The typeArg parameter is a String.
The canBubbleArg parameter is a Boolean.
The cancelableArg parameter is a Boolean.
The viewArg parameter is an object that implements
the AbstractView interface.
The detailArg parameter is a Number.
The screenXArg parameter is a Number.
The screenYArg parameter is a Number.
The clientXArg parameter is a Number.
The clientYArg parameter is a Number.
The buttonArg parameter is a Number.
The relatedTargetArg parameter is an object that
implements the EventTarget interface.
The modifiersList parameter is a String.
Properties of the KeyboardEvent Constructor function:
KeyboardEvent.DOM_KEY_LOCATION_STANDARD
The value of the constant
KeyboardEvent.DOM_KEY_LOCATION_STANDARD is 0x00.
KeyboardEvent.DOM_KEY_LOCATION_LEFT
The value of the constant
KeyboardEvent.DOM_KEY_LOCATION_LEFT is 0x01.
KeyboardEvent.DOM_KEY_LOCATION_RIGHT
The value of the constant
KeyboardEvent.DOM_KEY_LOCATION_RIGHT is 0x02.
KeyboardEvent.DOM_KEY_LOCATION_NUMPAD
The value of the constant
KeyboardEvent.DOM_KEY_LOCATION_NUMPAD is 0x03.
Objects that implement the KeyboardEvent interface:
Objects that implement the KeyboardEvent interface have all
properties and functions of the UIEvent interface as well
as the properties and functions defined below.
Properties of objects that implement the KeyboardEvent interface:
keyIdentifier
This read-only property is a String.
keyLocation
This read-only property is a Number.
ctrlKey
This read-only property is a Boolean.
shiftKey
This read-only property is a Boolean.
altKey
This read-only property is a Boolean.
metaKey
This read-only property is a Boolean.
Functions of objects that implement the KeyboardEvent interface:
getModifierState(keyIdentifierArg)
This function returns a Boolean.
The keyIdentifierArg parameter is a String.
initKeyboardEvent(typeArg, canBubbleArg, cancelableArg,
viewArg, keyIdentifierArg, keyLocationArg,
modifiersList)
This function has no return value.
The typeArg parameter is a String.
The canBubbleArg parameter is a Boolean.
The cancelableArg parameter is a Boolean.
The viewArg parameter is an object that implements
the AbstractView interface.
The keyIdentifierArg parameter is a String.
The keyLocationArg parameter is a Number.
The modifiersList parameter is a String.
initKeyboardEventNS(namespaceURI, typeArg, canBubbleArg,
cancelableArg, viewArg, keyIdentifierArg,
keyLocationArg, modifiersList)
This function has no return value.
The namespaceURI parameter is a String.
The typeArg parameter is a String.
The canBubbleArg parameter is a Boolean.
The cancelableArg parameter is a Boolean.
The viewArg parameter is an object that implements
the AbstractView interface.
The keyIdentifierArg parameter is a String.
The keyLocationArg parameter is a Number.
The modifiersList parameter is a String.
Properties of the MutationEvent Constructor function:
MutationEvent.MODIFICATION
The value of the constant MutationEvent.MODIFICATION is
1.
MutationEvent.ADDITION
The value of the constant MutationEvent.ADDITION is 2.
MutationEvent.REMOVAL
The value of the constant MutationEvent.REMOVAL is 3.
Objects that implement the MutationEvent interface:
Objects that implement the MutationEvent interface have all
properties and functions of the Event interface as well
as the properties and functions defined below.
Properties of objects that implement the MutationEvent interface:
relatedNode
This read-only property is an object that
implements the Node interface.
prevValue
This read-only property is a String.
newValue
This read-only property is a String.
attrName
This read-only property is a String.
attrChange
This read-only property is a Number.
Functions of objects that implement the MutationEvent interface:
initMutationEvent(typeArg, canBubbleArg, cancelableArg,
relatedNodeArg, prevValueArg, newValueArg,
attrNameArg, attrChangeArg)
This function has no return value.
The typeArg parameter is a String.
The canBubbleArg parameter is a Boolean.
The cancelableArg parameter is a Boolean.
The relatedNodeArg parameter is an object that
implements the Node interface.
The prevValueArg parameter is a String.
The newValueArg parameter is a String.
The attrNameArg parameter is a String.
The attrChangeArg parameter is a Number.
initMutationEventNS(namespaceURI, typeArg, canBubbleArg,
cancelableArg, relatedNodeArg, prevValueArg,
newValueArg, attrNameArg, attrChangeArg)
This function has no return value.
The namespaceURI parameter is a String.
The typeArg parameter is a String.
The canBubbleArg parameter is a Boolean.
The cancelableArg parameter is a Boolean.
The relatedNodeArg parameter is an object that
implements the Node interface.
The prevValueArg parameter is a String.
The newValueArg parameter is a String.
The attrNameArg parameter is a String.
The attrChangeArg parameter is a Number.
Objects that implement the MutationNameEvent interface:
Objects that implement the MutationNameEvent interface have all
properties and functions of the MutationEvent interface
as well as the properties and functions defined below.
Properties of objects that implement the MutationNameEvent
interface:
prevNamespaceURI
This read-only property is a String.
prevNodeName
This read-only property is a String.
Functions of objects that implement the MutationNameEvent
interface:
initMutationNameEvent(typeArg, canBubbleArg, cancelableArg,
relatedNodeArg, prevNamespaceURIArg,
prevNodeNameArg)
This function has no return value.
The typeArg parameter is a String.
The canBubbleArg parameter is a Boolean.
The cancelableArg parameter is a Boolean.
The relatedNodeArg parameter is an object that
implements the Node interface.
The prevNamespaceURIArg parameter is a String.
The prevNodeNameArg parameter is a String.
initMutationNameEventNS(namespaceURI, typeArg,
canBubbleArg, cancelableArg, relatedNodeArg,
prevNamespaceURIArg, prevNodeNameArg)
This function has no return value.
The namespaceURI parameter is a String.
The typeArg parameter is a String.
The canBubbleArg parameter is a Boolean.
The cancelableArg parameter is a Boolean.
The relatedNodeArg parameter is an object that
implements the Node interface.
The prevNamespaceURIArg parameter is a String.
The prevNodeNameArg parameter is a String.
07 November 2003
Appendix F: Acknowledgements
Many people contributed to the DOM specifications (Level 1, 2 or 3),
including participants of the DOM Working Group and the DOM Interest
Group. We especially thank the following:
Andrew Watson (Object Management Group), Andy Heninger (IBM), Angel
Diaz (IBM), Arnaud Le Hors (W3C and IBM), Ashok Malhotra (IBM and
Microsoft), Ben Chang (Oracle), Bill Smith (Sun), Bill Shea (Merrill
Lynch), Bob Sutor (IBM), Chris Lovett (Microsoft), Chris Wilson
(Microsoft), David Brownell (Sun), David Ezell (Hewlett-Packard
Company), David Singer (IBM), Dimitris Dimitriadis (Improve AB and
invited expert), Don Park (invited), Elena Litani (IBM), Eric Vasilik
(Microsoft), Gavin Nicol (INSO), Ian Jacobs (W3C), James Clark
(invited), James Davidson (Sun), Jared Sorensen (Novell), Jeroen van
Rotterdam (X-Hive Corporation), Joe Kesselman (IBM), Joe Lapp
(webMethods), Joe Marini (Macromedia), Johnny Stenback (Netscape/AOL),
Jon Ferraiolo (Adobe), Jonathan Marsh (Microsoft), Jonathan Robie
(Texcel Research and Software AG), Kim Adamson-Sharpe (SoftQuad
Software Inc.), Lauren Wood (SoftQuad Software Inc., former Chair),
Laurence Cable (Sun), Mark Davis (IBM), Mark Scardina (Oracle), Martin
Dürst (W3C), Mary Brady (NIST), Mick Goulish (Software AG), Mike
Champion (Arbortext and Software AG), Miles Sabin (Cromwell Media),
Patti Lutsky (Arbortext), Paul Grosso (Arbortext), Peter Sharpe
(SoftQuad Software Inc.), Phil Karlton (Netscape), Philippe Le Hégaret
(W3C, W3C Team Contact and former Chair), Ramesh Lekshmynarayanan
(Merrill Lynch), Ray Whitmer (iMall, Excite@Home, and Netscape/AOL,
Chair), Rezaur Rahman (Intel), Rich Rollman (Microsoft), Rick Gessner
(Netscape), Rick Jelliffe (invited), Rob Relyea (Microsoft), Scott
Isaacs (Microsoft), Sharon Adler (INSO), Steve Byrne (JavaSoft), Tim
Bray (invited), Tim Yu (Oracle), Tom Pixley (Netscape/AOL), Vidur
Apparao (Netscape), Vinod Anupam (Lucent).
Thanks to all those who have helped to improve this specification by
sending suggestions and corrections (Please, keep bugging us with your
issues!).
Many thanks to Brad Pettit, Dylan Schiemann, David Flanagan, Steven
Pemberton, Curt Arnold, Al Gilman, Misha Wolf, Sigurd Lerstad, Michael
B. Allen, Alexander J. Vincent, Martin Dürst, and Ken Rehor for their
review and comments of this document.
Special thanks to the [1138]DOM Conformance Test Suites contributors:
Fred Drake, Mary Brady (NIST), Rick Rivello (NIST), Robert Clary
(Netscape), Neil Delima (IBM), with a special mention to Curt Arnold.
[1138] http://www.w3.org/DOM/Test
F.1 Production Systems
This specification was written in XML. The HTML, OMG IDL, Java and
ECMAScript bindings were all produced automatically.
Thanks to Joe English, author of [1139]cost, which was used as the
basis for producing DOM Level 1. Thanks also to Gavin Nicol, who wrote
the scripts which run on top of cost. Arnaud Le Hors and Philippe Le
Hégaret maintained the scripts.
[1139] http://www.flightlab.com/cost
After DOM Level 1, we used [1140]Xerces as the basis DOM
implementation and wish to thank the authors. Philippe Le Hégaret and
Arnaud Le Hors wrote the [1141]Java programs which are the DOM
application.
[1140] http://xml.apache.org/xerces-j
[1141] http://dev.w3.org/cvsweb/java/classes/org/w3c/tools/specgenerator/
Thanks also to Jan Kärrman, author of [1142]html2ps, which we use in
creating the PostScript version of the specification.
[1142] http://user.it.uu.se/~jan/html2ps.html
07 November 2003
Glossary
Editors:
Arnaud Le Hors, W3C
Robert S. Sutor, IBM Research (for DOM Level 1)
Some of the following term definitions have been borrowed or modified
from similar definitions in other W3C or standards documents. See the
links within the definitions for more information.
bubbling phase
The process by which an [1143]event can be handled by one of
the target ancestors after being handled by the [1144]target
node.
capture phase
The process by which an [1145]event can be handled by one of
the target ancestors before being handled by the [1146]target
node.
child
A child is an immediate descendant node of a node.
DOM Level 0
The term "DOM Level 0" refers to a mix (not formally specified)
of HTML document functionalities offered by Netscape Navigator
version 3.0 and Microsoft Internet Explorer version 3.0. In
some cases, attributes or methods have been included for
reasons of backward compatibility with "DOM Level 0".
event
An event is the representation of some asynchronous occurrence
(such as a mouse click on the presentation of the element, or
the removal of child node from an element, or any of
unthinkably many other possibilities) that gets associated with
an [1147]event target.
event target
The object to which an [1148]event is targeted.
local name
A local name is the local part of a qualified name. This is
called the local part in Namespaces in XML [1149]XML
Namespaces].
namespace URI
A namespace URI is a URI that identifies an XML namespace. This
is called the namespace name in Namespaces in XML [1150]XML
[ Namespaces]. See also sections 1.3.2 "[1151] DOM URIs" and
1.3.3 "[1152] XML Namespaces" regarding URIs and namespace URIs
handling and comparison in the DOM APIs.
[1151] http://www.w3.org/TR/DOM-Level-3-Core/core.html#baseURIs-Considerations
[1152] http://www.w3.org/TR/DOM-Level-3-Core/core.html#Namespaces-Considerations
target node
The target node is the node representing the [1153]event target
to which an [1154]event is targeted using the DOM event flow.
target phase
The process by which an [1155]event can be handled by the
[1156]event target.
XML name
See [1157]XML name in the XML specification ([1158]XML 1.0]).
[1157] http://www.w3.org/TR/2000/REC-xml-20001006#NT-Name
07 November 2003