W3C

Document Object Model (DOM) Level 3 Events Specification

W3C Working Draft 8 September 2009

This version:
http://www.w3.org/TR/2009/WD-DOM-Level-3-Events-20090908
Latest stable version:
http://www.w3.org/TR/DOM-Level-3-Events
Previous version:
http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-20071221
Editor's Draft:
http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html
Editors:
Doug Schepers, W3C
Björn Höhrmann, Invited Expert (until December 2007)
Philippe Le Hégaret, W3C (until November 2003)
Tom Pixley, Netscape Communications Corporation (until July 2002)

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 [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 W3C technical reports index at http://www.w3.org/TR/.

Publication as a Working Draft 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. It is inappropriate to cite this document as other than work in progress.

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

This is the 8 September 2009 Editor's Draft version of the "Document Object Model (DOM) Level 3 Events" specification. This document was previously published as a W3C Note, pending further feedback from implementers, and is now being revised to reflect the current state of implementation. It is expected that this specification will progress to Recommendation status.

This document is produced by the Web Applications WG, part of the Rich Web Clients Activity in the W3C Interaction Domain. It is expected that this document will progress along the W3C's Recommendation track. Publication as a Working Draft 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. It is inappropriate to cite this document as other than work in progress.

You can find the latest Editor's Draft of this document in the W3C's CVS repository, which is updated on a regular basis. The public is encouraged to send comments to the WebApps Working Group's public mailing list for DOM specifications www-dom@w3.org (archive). See W3C mailing list and archive usage guidelines.

Implementers should be aware that this document is not stable. Implementers who are not taking part in the discussions are likely to find the specification changing out from under them in incompatible ways. Vendors interested in implementing this document before it eventually reaches the Candidate Recommendation stage should join the aforementioned mailing lists and take part in the discussions.

Table of Contents

1. Document Object Model Events

1.1 Introduction

DOM Events is designed with two main goals. The first goal is the design of an 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 DOM Events is to provide a common subset of the current event systems used in 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.

1.2 Conformance

This specification is to be understood in the context of the DOM Level 3 Core specification [DOM Level 3 Core] and the general considerations for DOM implementations apply. For example, handling of namespace URIs is discussed in XML Namespaces, and behavior in exceptional circumstances (such as when a null argument is passed when null was not expected) is discussed under DOMException. For additional information about conformance, please see the DOM Level 3 Core specification [DOM Level 3 Core].

An implementation is DOM Level 3 Events conformant if it supports the Core module defined in [DOM Level 2 Core], the Event dispatch and DOM event flow mechanism and the interfaces with their associated semantics defined in Basic interfaces. An implementation conforms to a DOM Level 3 Events module if it conforms to DOM Level 3 Events, the event types defined in the module, and the modules the module depends upon (if any).

An implementation conforms to an event type if it conforms to its associated semantics and DOM interfaces. This includes that event objects that are generated by the implementation are generated as outlined in the tabular definition of the event type.

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 DocumentEvent.createEvent() method and dispatch an event type associated with this interface using the 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, and the implementation must return true.Since DOM Level 3 Events is built on top of DOM Level 2 Events [DOM Level 2 Events], an implementation that returns true for "Events" and "3.0" shall also return true for the parameters "Events" and "2.0".The same holds for the feature strings defined for the individual event modules as applicable. Refer to DOM Features in [DOM Level 3 Core] for additional information.

2. Glossary

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.

activation behavior
The action taken when an event, typically initiated by users through an input device, causes an element to fulfill a defined role. The role may be defined for that element by the host language, or by author-defined variables, or both. The role for any given element may be a generic action, or may be unique to that element. For example, the activation behavior of an HTML or SVG <a> element shall be to cause the user agent to traverse the link specified in the href attribute, with the further optional parameter of specifying the browsing context for the traversal (such as the current window or tab, a named window, or a new window); the activation behavior of an HTML <input> element with the type attribute value submit shall be to send the values of the form elements to an author-defined IRI by the author-defined HTTP method.
bubbling phase
The process by which an event can be handled by one of the target ancestors after being handled by the target node.
capture phase
The process by which an event can be handled by one of the target ancestors before being handled by the target node.
dead key
A dead key is a key or combination of key that produces no character by itself, but which in combination or sequence with another key produces a modified character, such as a character with diacritical marks (e.g. ö, é, â).
default action
A default action is a supplementary behavior that an implementation must perform in combination with the dispatch of the event object. Each event, and each specification, defines the default action for that event. A default action may be cancelled through the invocation of the Event.preventDefault() method. For more details, see Default actions and cancelable events.
defaultView
The defaultView is the AbstractView interface of the Document's DocumentView interface, which serves as a reference to the containing frame or window. This interface may also be accessed as the Window interface in many implementations.
deprecated
Features marked as deprecated are included in the specification as reference to older implementations or specifications, but are optional and discouraged. Only features which have existing or in-progress replacements shall be deprecated in this specification. Implementations which do not already include support for the feature should not implement deprecated features, and authors creating content should not use deprecated features, unless there is no other way to solve a use case. Other specifications which reference this specification should not use deprecated features, but should point instead to the replacements of which the feature is deprecated in favor.
dispatch
To create an event with attributes and methods appropriate to its type and context, and propagate it through the DOM tree in the specified manner. Interchangeable with the term "fire", e.g. "fire a 'click' event" or "dispatch a 'load' event".
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 event target.
event phase
See phase.
event target
The object to which an event is targeted.
event type
An event object which defines particular trigger conditions, properties, interfaces, and other characteristics which distinguish it from other event types. For example, the click event type has different characteristics than the mouseover or load event types. The event type is exposed as the type attribute on the event object. See event types for more details. Also loosely referred to as 'event', such as the click event.
host language
Any language which integrates the features of another language, while normatively referencing the origin language rather than redefining those features, and extending those features only in ways defined by the origin language. An origin language typically is only intended to be implemented in the context of one or more host languages, not as a standalone language. For example, XHTML, HTML, and SVG are host languages for DOM 3 Events, and they integrate and extend the objects and models defined in this specification.
IME
input method editor
An input method editor (IME), also known as a front end processor, is an application that performs the conversion between keystrokes and ideographs or other characters, usually by user-guided dictionary lookup, often used in East Asian languages (e.g. Chinese, Japanese, Korean). An IME may also be used for dictionary-based word completion, such as on mobile devices. See Input Method Editors for treatment of IMEs in this specification. See also text composition system.
local name
See local name in [XML Namespaces 1.1].
namespace URI
A namespace URI is a URI that identifies an XML namespace. This is called the namespace name in [XML Namespaces 1.1]. See also sections 1.3.2 "DOM URIs" and 1.3.3 "XML Namespaces" regarding URIs and namespace URIs handling and comparison in the DOM APIs.
phase
In the context of events, a phase is set of logical traversals from node to node along the DOM tree, from the root element down to the event target (capture phase), at the event target itself (target phase), and back up to the root element (bubbling phase).
propagation path
The ordered set of event targets though which an event object will pass sequentially on the way to and back from the ultimate event target. The propagation path is initially comprised of one or more event phases as defined by the event type, but may be interrupted. Also known as an event target chain.
target node
The target node is the node representing the event target to which an event is targeted using the DOM event flow.
text composition system
A software component which interprets some form of alternate input, such as a input method editor, a speech processor, or a handwriting recognition system, and converts it to text.
root element
The first element node of a document, of which all other elements are children; the document element.
target phase
The process by which an event can be handled by the event target.
topmost event target
The topmost event target shall be the element highest in the rendering order which is capable of being an event target. In this case, 'top' shall refer not to the position on the screen, but the logical order of the element in relation to other elements in drawing or stacking order on the z-axis (where the x-axis is the screen width and the y-axis is the screen height). In HTML and CSS, or in SVG, this is controlled by the document order, as modified in HTML and CSS by the 'z-index' property. In some cases, such as when using some values of the SVG 'pointer-events' property, the topmost element may not receive pointer events, in which case, the next element in z-index order which can receive pointer-events is the topmost event target. Note that visibility of the element does not necessarily affect its ability to be the topmost event target, since an element which is hidden by use of the CSS 'visibility' property can still receive pointer events (though not one with a 'display' property of 'none'), and the topmost event target may be completely obscured by another element which cannot receive pointer events. Unless otherwise noted, there is only one topmost event target in any event.
tree
A data structure that represents a document as a hierarchical set of nodes with child-parent-sibling relationships, i.e. each node having one or more possible ancestors (nodes higher in the hierarchy in a direct lineage), one or more possible descendants (nodes lower in the hierarchy in a direct lineage), and one or more possible peers (nodes of the same level in the hierarchy, with the same immediate ancestor).
Unicode character categories
The Unicode character categories, a subset of the complete Unicode general categories, comprise the categories Ll, Lm, Lo, Lt, Lu, Nd, Nl, No, Pc, Pd, Pe, Pf, Pi, Po, Ps, Sc, Sk, Sm, and So.

3. DOM Event Architecture

3.1 Event dispatch and DOM event flow

This section defines the event dispatch mechanism of the event model defined in this specification. Applications may dispatch event objects using the EventTarget.dispatchEvent() method, and implementations must dispatch event objects as if through this method. The behavior of this method depends on the event flow associated with the underlying object. An event flow describes how event objects propagate through a data structure. As an example, when an event object is dispatched to an element in an XML document, the object propagates through parts of the document, as determined by the DOM event flow which is defined at the end of this section.

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

Event objects are always dispatched to a node called the event target. At the beginning of the dispatch, implementations must first determine the event object's propagation path. The propagation path shall be an ordered list of event targets through which the object must pass. The last item in the list shall be the event target; the preceding items in the list are referred to as the target's ancestors, and the immediately preceding item as the target's parent. Once determined, the propagation path must not be changed, even if an element in the propagation path is moved within the DOM or removed from the DOM. As an example, in the DOM event flow event listeners might change the position of the target node in the document while the event object is being dispatched; such changes do not affect the propagation path.

As the next step, the event object must complete one or more event phases. This specification defines three event phases: capture phase; target phase; and bubble phase. Event objects complete these phases in the specified order using the partial propagation paths as defined below. A phase shall be skipped if it is not supported, or if the event object's propagation has been stopped. For example, if the Event.bubbles attribute is set to false, the bubble phase shall be skipped, and if Event.stopPropagation() has been called prior to the dispatch, all phases must be skipped.

  1. The capture phase: the event object must propagate through the target's ancestors from the defaultView to the target's parent. This phase is also known as the capturing phase. Event listeners registered for this phase must handle the event before it reaches its target.
  2. The target phase: the event object must arrive at the event's target. This phase is also known as the at-target phase. Event listeners registered for this phase must handle the event once it has reached its target. If the event type indicates that the event must not bubble, the event object must halt after completion of this phase.
  3. The bubble phase: the event object propagates through the target's ancestors in reverse order, starting with the target's parent and ending with the defaultView. This phase is also known as the bubbling phase. Event listeners registered for this phase shall handle the event after it has reached its target.

Implementations let event objects accomplish an event phase by applying the following steps while there are pending event targets in the partial propagation path for this phase and the event object's propagation has not been stopped through Event.stopPropagation().

First, the implementation must determine the current target. This shall be the next pending event target in the partial propagation path, starting with the first. From the perspective of an event listener this shall be the event target the listener has been registered on.

Next, the implementation must determine the current target's candidate event listeners. This shall be the list of all event listeners that have been registered on the current target in their order of registration. Once determined, the candidate event listeners cannot be changed; adding or removing listeners does not affect the current target's candidate event listeners.

Finally, the implementation must process all candidate event listeners in order and trigger each listener if all the following conditions are met:

An implementation shall trigger a listener by invoking the EventListener.handleEvent() method or an equivalent binding-specific mechanism.

As the final step of the event dispatch, for reasons of backwards compatibility, the implementation must reset the event object's internal-propagation and default-action-prevention states. This ensures that an event object may be properly dispatched multiple times while also allowing to prevent the event objects propagation or default actions prior to the event dispatch.

In the production of the propagation path, if the defaultView implements the EventTarget interface, the event propagates from defaultView to the document object during the capture phase, and from the document object to the defaultView during the bubble phase. Note that for legacy reasons, the load event does not bubble to the defaultView in HTML implementations.

The model defined above must be applied regardless of the specific event flow associated with an event target. Each event flow must define how the propagation path shall be determined and which event phases are supported. The DOM event flow is an application of this model: the propagation path for a Node object shall be determined by its Node.parentNode chain, and if applicable, the document's containing defaultView; all events accomplish the capture and target phases; whether an event accomplishes the bubble phase shall be defined individually for each event type. An alternate application of this model can be found in [DOM Level 3 Load and Save].

Implementations of the DOM event model must be reentrant. Event listeners may perform actions that cause additional events to be dispatched. Such events are handled in a synchronous manner, the event propagation that causes the event listener to be triggered must resume only after the event dispatch of the new event is completed.

3.2 Default actions and cancelable events

Event objects may have default actions associated with them. These are actions the implementation must perform in combination with the dispatch of the event object. An example is the [HTML 4.01] form element. When the user submits the form (e.g. by pressing on a submit button), the event submit shall be dispatched to the element and the default action for this event type shall be generally to send a request to a Web server with the parameters from the form.

Default actions should be performed after the event dispatch has been completed, but in exceptional cases also immediately before the event is dispatched.

@@ insert example here: <input type="checkbox">'s .checked handling comes to mind. .checked is changed just before 'click' event is dispatched, and if default action is prevented, .checked is set to its original value.

Some event objects are cancelable, meaning the default action can be prevented from occuring, or, if the default action is carried out before the dispatch, its effect may be reversed. Whether an event object is cancelable shall be indicated by the Event.cancelable attribute. Event listeners can cancel default actions of cancelable event objects by invoking the Event.preventDefault() method, and determine whether an event has been canceled through the Event.defaultPrevented attribute while the object is being dispatched, or from the return value of the EventTarget.dispatchEvent() method for event objects dispatched by the DOM application itself.

This specification does not offer features to programatically query if an event object has any default action associated with it, or to associate new default actions to an event object. Other specifications may define what default actions, if any, are associated with certain event objects. Further, implementations may associate default actions with events as necessary and appropriate for that implementation. As an example, one implementation may scroll a document view by a certain amount as default action of a mouse wheel event, while another implementation may instead zoom the document as its default action for a mouse wheel event.

3.3 Activation requests and behavior

(This section is currently being rewritten.)

Event targets may have associated activation behavior that implementations perform in response to an activation request. As an example, the typical activation behavior associated with hyperlinks is to follow the link. Activation requests are typically initiated by users through an input device.

In terms of this specification, the activation behavior of the event target shall be the default action of the event type DOMActivate. DOM applications should use this event type whenever they wish to make or react to an activation request.

Implementations must dispatch the DOMActivate event as the default action of a click event. This click event shall be either part of the activation request (e.g., a user requests activiation using a mouse), or synthesized by the implementation to accomodate legacy applications. Context information of such a click event is implementation dependent.

When implementations dispatch a synthesized click event, the expectation shall be that they do so as default action of another event type. For example, when a user activates a hyperlink using a keyboard, the click event would be dispatched as default action of the respective keyboard event.

Implementations are required to dispatch the synthesized click event as described above even if they do not dispatch such an event (e.g., when activation is requested by a voice command, since this specification does not address event types for voice input).

Note: The activation of an event target 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.

4. Basic Event Interfaces

The interfaces described in this section are fundamental to DOM Level 3 Events and must always be supported by the implementation. Together they define the feature Events 3.0.

The event types defined in this specification derive from these basic interfaces, and shall inherit all of the attributes, methods, and constants of the interfaces they derive from. Event types defined in other specifications may similarly inherit from these basic interfaces or other interfaces defined in this specification, or may define their own interfaces. The following chart describes the inheritance structure of interfaces defined in this specification.

graphical representation of the DOM3 Events interface inheritance

Figure: graphical representation of the DOM3 Events interface inheritance

4.1 Interface Event

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 shall be passed as the parameter to an EventListener. The object passed to the event listener may also implement derived interfaces that provide access to information directly relating to the type of event they represent.

To create an instance of the Event interface, use the DocumentEvent.createEvent("Event") method call.


IDL Definition
// Introduced in DOM Level 2:
interface Event {

  // PhaseType
  const unsigned short      CAPTURING_PHASE                = 1;
  const unsigned short      AT_TARGET                      = 2;
  const unsigned short      BUBBLING_PHASE                 = 3;

  readonly attribute DOMString       type;
  readonly attribute EventTarget     target;
  readonly attribute EventTarget     currentTarget;
  readonly attribute unsigned short  eventPhase;
  readonly attribute boolean         bubbles;
  readonly attribute boolean         cancelable;
  readonly attribute DOMTimeStamp    timeStamp;
  void               stopPropagation();
  void               preventDefault();
  void               initEvent(in DOMString eventTypeArg, 
                               in boolean canBubbleArg, 
                               in boolean cancelableArg);
  // Introduced in DOM Level 3:
  readonly attribute DOMString       namespaceURI;
  // Introduced in DOM Level 3:
  void               stopImmediatePropagation();
  // Introduced in DOM Level 3:
  readonly attribute boolean         defaultPrevented;
  // Introduced in DOM Level 3:
  void               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 Event dispatch and DOM event flow.

Defined Constants
AT_TARGET
The current event is in the target phase, i.e. it is being evaluated at the event target.
BUBBLING_PHASE
The current event phase is the bubbling phase.
CAPTURING_PHASE
The current event phase is the 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 shall be true, otherwise the value shall be false.
cancelable of type boolean, readonly
Used to indicate whether or not an event can have its default action prevented (see also Default actions and cancelable events). If the default action can be prevented the value shall be true, otherwise the value shall be false.
currentTarget of type EventTarget, readonly
Used to indicate the EventTarget whose EventListeners are currently being processed. This is particularly useful during the capture and bubbling phases. When used with the Event dispatch and DOM event flow, this attribute contains the target node or a target ancestor.
defaultPrevented of type boolean, readonly, introduced in DOM Level 3
Used to indicate whether Event.preventDefault() has been called for this event.
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 namespace URI associated with this event at initialization time, or null if it is unspecified.
DOM Level 2 Events initialization methods, such as Event.initEvent(), set the value to null.
target of type EventTarget, readonly
Used to indicate the event target. This attribute contains the target node when used with the Event dispatch and DOM event flow.
timeStamp of type DOMTimeStamp, readonly
Used to specify the time at which the event was created in milliseconds relative to 1970-01-01T00:00:00Z. 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, the value shall be 0.
type of type DOMString, readonly
The local name of the event type. The name must be an NCName as defined in [XML Namespaces 1.1] and must be case-sensitive.
Methods
initEvent
Initializes attributes of an Event created through the DocumentEvent.createEvent method. This method may only be called before the Event has been dispatched via the EventTarget.dispatchEvent() method. If the method is called several times before invoking 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 Event.type attribute to eventTypeArg, and Event.namespaceURI to null. To initialize an event with a namespace URI, use the Event.initEventNS() method.
Parameters
eventTypeArg of type DOMString
Specifies Event.type, the local name of the event type.
canBubbleArg of type boolean
Specifies Event.bubbles. This parameter overrides the intrinsic bubbling behavior of the event.
cancelableArg of type boolean
Specifies Event.cancelable. This parameter overrides the intrinsic cancelable behavior of the event.
No Return Value
No Exceptions
initEventNS introduced in DOM Level 3
Initializes attributes of an Event object. This method has the same behavior as Event.initEvent().
Parameters
namespaceURIArg of type DOMString
Specifies Event.namespaceURI, the namespace URI associated with this event, or null if no namespace.
eventTypeArg of type DOMString
Refer to the Event.initEvent() method for a description of this parameter.
canBubbleArg of type boolean
Refer to the Event.initEvent() method for a description of this parameter.
cancelableArg of type boolean
Refer to the Event.initEvent() method for a description of this parameter.
No Return Value
No Exceptions
preventDefault
Signifies that the event shall be to be canceled, meaning any default action normally taken by the implementation as a result of the event must not occur (see also Default actions and cancelable events). Calling this method for a non-cancelable event has no effect.

Note: This method does not stop the event propagation; use Event.stopPropagation() or Event.stopImmediatePropagation() for that effect.

No Parameters
No Return Value
No Exceptions
stopImmediatePropagation introduced in DOM Level 3
Prevents other event listeners from being triggered and, unlike Event.stopPropagation() its effect shall be immediate . Once it has been called, further calls to this method have no additional effect.

Note: This method does not prevent the default action from being invoked; use Event.preventDefault() for that effect.

No Parameters
No Return Value
No Exceptions
stopPropagation
Prevents other event listeners from being triggered but its effect shall be deferred until all event listeners attached on the Event.currentTarget have been triggered . Once it has been called, further calls to this method have no additional effect.

Note: This method does not prevent the default action from being invoked; use Event.preventDefault() for that effect.

No Parameters
No Return Value
No Exceptions

4.2 Interface CustomEvent

Interface CustomEvent (introduced in DOM Level 3)

The CustomEvent interface is the recommended interface for application-specific event types. Unlike the Event interface, it allows applications to provide contextual information about the event type. Application-specific event types should have an associated namespace to avoid clashes with future general-purpose event types.

To create an instance of the CustomEvent interface, use the DocumentEvent.createEvent("CustomEvent") method call.


IDL Definition
// Introduced in DOM Level 3:
interface CustomEvent : Event {
  readonly attribute DOMObject         detail;
  void               initCustomEvent(in DOMString typeArg, 
                                     in boolean canBubbleArg, 
                                     in boolean cancelableArg, 
                                     in DOMObject detailArg);
  void               initCustomEventNS(in DOMString namespaceURIArg, 
                                       in DOMString typeArg, 
                                       in boolean canBubbleArg, 
                                       in boolean cancelableArg, 
                                       in DOMObject detailArg);
};

Attributes
detail of type DOMObject, readonly
Specifies some detail information about the Event.
Methods
initCustomEvent
Initializes attributes of a CustomEvent object. This method has the same behavior as Event.initEvent().
Parameters
typeArg of type DOMString
Refer to the Event.initEvent() method for a description of this parameter.
canBubbleArg of type boolean
Refer to the Event.initEvent() method for a description of this parameter.
cancelableArg of type boolean
Refer to the Event.initEvent() method for a description of this parameter.
detailArg of type DOMObject
Specifies CustomEvent.detail. This value may be null.
No Return Value
No Exceptions
initCustomEventNS
Initializes attributes of a CustomEvent object. This method has the same behavior as Event.initEventNS().
Parameters
namespaceURIArg of type DOMString
Refer to the Event.initEventNS() method for a description of this parameter.
typeArg of type DOMString
Refer to the Event.initEventNS() method for a description of this parameter.
canBubbleArg of type boolean
Refer to the Event.initEventNS() method for a description of this parameter.
cancelableArg of type boolean
Refer to the Event.initEventNS() method for a description of this parameter.
detailArg of type DOMObject
Specifies CustomEvent.detail. This value may be null.
No Return Value
No Exceptions

4.3 Interface EventTarget

Interface EventTarget (introduced in DOM Level 2)

The EventTarget interface shall be implemented by all the objects which could be event targets in an implementation which supports an event flow. The interface allows registration and removal of event listeners, and dispatch of events to an event target.

When used with the DOM event flow, this interface must be implemented by all 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 repeatedly on the same EventTarget with the same values for the parameters namespaceURI, type, listener, and useCapture has no effect. Doing so does not cause the EventListener to be called more than once and does not cause a change in the triggering order.


IDL Definition
// Introduced in DOM Level 2:
interface EventTarget {
  void               addEventListener(in DOMString type, 
                                      in EventListener listener, 
                                      in boolean useCapture);
  void               removeEventListener(in DOMString type, 
                                         in EventListener listener, 
                                         in boolean useCapture);
  // Modified in DOM Level 3:
  boolean            dispatchEvent(in Event evt)
                                        raises(EventException, 
                                               DOMException);
  // Introduced in DOM Level 3:
  void               addEventListenerNS(in DOMString namespaceURI, 
                                        in DOMString type, 
                                        in EventListener listener, 
                                        in boolean useCapture);
  // Introduced in DOM Level 3:
  void               removeEventListenerNS(in DOMString namespaceURI, 
                                           in DOMString type, 
                                           in EventListener listener, 
                                           in boolean useCapture);
};

Methods
addEventListener
Registers an event listener, depending on the useCapture parameter, on the capture phase of the DOM event flow or its target and bubbling phases. Invoking this method shall be equivalent to invoking addEventListenerNS with the same values for the parameters type, listener, and useCapture, and the value null for the parameter namespaceURI. When this method is used to register an event listener, implementations may also dispatch events with the same type in other namespaces, for purposes of extensibility (e.g. this method may be used to dispatch foo event for the null namespace, or for a vendor-specific namespace); see Appendix A: Extending Events for more details.
Parameters
type of type DOMString
Specifies the Event.type associated with the event for which the user is registering.
listener of type EventListener
The listener parameter takes an object implemented by the user which implements the 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 capture phase only, i.e. this event listener will not be triggered during the target and bubbling phases. If false, the event listener must only be triggered during the target and bubbling phases.
No Return Value
No Exceptions
addEventListenerNS introduced in DOM Level 3
Registers an event listener, 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 Event.namespaceURI associated with the event for which the user is registering.
type of type DOMString
Refer to the EventTarget.addEventListener() method for a description of this parameter.
listener of type EventListener
Refer to the EventTarget.addEventListener() method for a description of this parameter.
useCapture of type boolean
Refer to the EventTarget.addEventListener() method for a description of this parameter.
No Return Value
No Exceptions
dispatchEvent modified in DOM Level 3
Dispatches an event into the implementation's event model. The event target of the event shall be the EventTarget object on which dispatchEvent is called.
Parameters
evt of type Event
The event to be dispatched.
Return Value

boolean

Indicates whether any of the listeners which handled the event called Event.preventDefault(). If Event.preventDefault() was called the returned value shall be false, else it shall be true.

Exceptions

EventException

UNSPECIFIED_EVENT_TYPE_ERR: Raised if the Event.type was not specified by initializing the event before dispatchEvent was called. Specification of the Event.type as null or an empty string must also trigger this exception.

DISPATCH_REQUEST_ERR: Raised if the Event object is already being dispatched.

DOMException

NOT_SUPPORTED_ERR: Raised if the Event object has not been created using DocumentEvent.createEvent().

INVALID_CHARACTER_ERR: Raised if Event.type is not an NCName as defined in [XML Namespaces 1.1].

removeEventListener
Removes an event listener. Calling removeEventListener with arguments which do not identify any currently registered EventListener on the EventTarget has no effect. The Event.namespaceURI for which the user registered the event listener is implied and shall be null.
Parameters
type of type DOMString
Specifies the Event.type for which the user registered the event listener.
listener of type EventListener
The EventListener to be removed.
useCapture of type boolean
Specifies whether the 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
Removes an event listener. Calling removeEventListenerNS with arguments which do not identify any currently registered EventListener on the EventTarget has no effect.
Parameters
namespaceURI of type DOMString
Specifies the Event.namespaceURI associated with the event for which the user registered the event listener.
type of type DOMString
Refer to the EventTarget.removeEventListener() method for a description of this parameter.
listener of type EventListener
Refer to the EventTarget.removeEventListener() method for a description of this parameter.
useCapture of type boolean
Refer to the EventTarget.removeEventListener() method for a description of this parameter.
No Return Value
No Exceptions

4.4 Interface EventListener

Interface EventListener (introduced in DOM Level 2)

The EventListener interface is the primary way for handling events. Users shall implement the EventListener interface and register their event listener on an EventTarget. The users should also remove their EventListener from its EventTarget after they have completed using the listener.

Copying a Node, with methods such as Node.cloneNode or Range.cloneContents, must 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, shall not affect the event listeners attached to it.


IDL Definition
// Introduced in DOM Level 2:
interface EventListener {
  void               handleEvent(in Event evt);
};

Methods
handleEvent
This method shall be called whenever an event occurs of the event type for which the EventListener interface was registered.
Parameters
evt of type Event
The Event contains contextual information about the event.
No Return Value
No Exceptions
Exception EventException introduced in DOM Level 2

Event operations may throw an EventException as specified in their method descriptions.


IDL Definition
// Introduced in DOM Level 2:
exception EventException {
  unsigned short   code;
};
// EventExceptionCode
const unsigned short      UNSPECIFIED_EVENT_TYPE_ERR     = 0;
// Introduced in DOM Level 3:
const unsigned short      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 Event object is already dispatched in the tree.
UNSPECIFIED_EVENT_TYPE_ERR
If the Event.type was not specified by initializing the event before the method was called. Specification of the Event.type as null or an empty string must also trigger this exception.

4.5 Interface DocumentEvent

Interface DocumentEvent (introduced in DOM Level 2)

The DocumentEvent interface provides a mechanism by which the user can create an 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 DocumentEvent {
  Event              createEvent(in DOMString eventType)
                                        raises(DOMException);
  // Introduced in DOM Level 3:
  boolean            canDispatch(in DOMString namespaceURI, 
                                 in DOMString type);
};

Methods
canDispatch introduced in DOM Level 3
Tests if the implementation can generate events of a specified type.
@@ what is the use case for this? Perhaps to test if an implementation supports a particular event, such as an event from an uncommon language, or a custom event?
@@ Or what does the "implementation can generate" mean? -Olli
Parameters
namespaceURI of type DOMString
Specifies the Event.namespaceURI of the event.
type of type DOMString
Specifies the Event.type of the event.
Return Value

boolean

true if the implementation can generate and dispatch this event type, false otherwise.

No Exceptions
createEvent
Creates an event object of the type specified.
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 Event is to be dispatched via the EventTarget.dispatchEvent() method the appropriate event initialization method must be called after creation in order to initialize the Event's values.

As an example, a user wishing to synthesize some kind of UIEvent would invoke DocumentEvent.createEvent("UIEvent"). The UIEvent.initUIEventNS() method could then be called on the newly created UIEvent object to set the specific type of user interface event to be dispatched, DOMActivate for example, and set its context information, e.g. UIEvent.detail in this example.

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", and the characters 'a'..'z' are considered equivalent to the characters 'A'..'Z'.

Return Value

Event

The newly created event object.

Exceptions

DOMException

NOT_SUPPORTED_ERR: Raised if the implementation does not support the Event interface requested.

4.5.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 Event objects and dispatch them using the DOM Events implementation.

Creating Event objects that are known to the DOM Events implementation is done using DocumentEvent.createEvent(). The application must then initialize the object by calling the appropriate initialization method before invoking EventTarget.dispatchEvent(). The Event objects created must be known by the DOM Events implementation; otherwise an event exception shall be thrown.

5. Events Module

5.1 Event Types

Each event shall be associated with a type, called event type and available as the type attribute on the event object. The event type shall be composed of a local name and a namespace URI as used in [DOM Level 3 Core]. All events defined in this specification are in the null namespace.

5.1.1 List of DOM3 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, or voice), these event types can be generated by the implementation. When used with an [XML 1.0] or [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. Refer to the specification defining the language used in order to find those restrictions or to find event types that are not defined in this document.

The following table provides a non-normative summary of the event types defined in this specification. All event types are in no namespace and this specification refers to them by their local name only. All events must accomplish the capture and target phases, but not all of them must accomplish the bubbling phase (see also Event dispatch and DOM event flow). Some events are not cancelable (see Default actions and cancelable events). Some events must only be dispatched to a specific set of possible targets in the DOM event flow, specified using node types. Contextual information related to the event type must be accessible using DOM interfaces.

type Bubbling phase Cancelable Target node types DOM interface
abort Yes No Element Event
blur No No Element UIEvent
change Yes No Element Event
click Yes Yes Element MouseEvent
compositionstart Yes Yes Element CompositionEvent
compositionupdate Yes Yes Element CompositionEvent
compositionend Yes Yes Element CompositionEvent
dblclick Yes Yes Element MouseEvent
DOMActivate Yes Yes Element UIEvent
DOMAttributeNameChanged Yes No Element MutationNameEvent
DOMAttrModified Yes No Element MutationEvent
DOMCharacterDataModified Yes No Text, Comment, CDATASection, ProcessingInstruction MutationEvent
DOMElementNameChanged Yes No Element MutationNameEvent
DOMFocusIn Yes No Element UIEvent
DOMFocusOut Yes No Element UIEvent
DOMNodeInserted Yes No Element, Attr, Text, Comment, CDATASection, DocumentType, EntityReference, ProcessingInstruction MutationEvent
DOMNodeInsertedIntoDocument No No Element, Attr, Text, Comment, CDATASection, DocumentType, EntityReference, ProcessingInstruction MutationEvent
DOMNodeRemoved Yes No Element, Attr, Text, Comment, CDATASection, DocumentType, EntityReference, ProcessingInstruction MutationEvent
DOMNodeRemovedFromDocument No No Element, Attr, Text, Comment, CDATASection, DocumentType, EntityReference, ProcessingInstruction MutationEvent
DOMSubtreeModified Yes No Document, DocumentFragment, Element, Attr MutationEvent
error Yes No Element Event
focus No No Element UIEvent
focusin Yes No Element UIEvent
focusout Yes No Element UIEvent
keydown Yes Yes Element KeyboardEvent
keypress Yes Yes Element KeyboardEvent
keyup Yes Yes Element KeyboardEvent
load No No Document, Element Event
mousedown Yes Yes Element MouseEvent
mouseenter No Yes Element MouseEvent
mouseleave No Yes Element MouseEvent
mousemove Yes Yes Element MouseEvent
mouseout Yes Yes Element MouseEvent
mouseover Yes Yes Element MouseEvent
mouseup Yes Yes Element MouseEvent
mousewheel Yes Yes Document, Element MouseWheelEvent
reset Yes Yes Element Event
resize Yes No Document, Element UIEvent
scroll No No Document, Element UIEvent
select Yes No Element Event
submit Yes Yes Element Event
textInput Yes Yes Element TextEvent
unload No No Document, Element Event
wheel Yes Yes Document, Element WheelEvent

As an example, the event load must 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 Document or Element nodes, or if it is attached to the bubbling phase only, this event listener must not 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.

5.2 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. This document does 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.

5.2.1 User Interface Event Types

This module defines the feature UIEvents 3.0 and depends on the features Events 3.0 and Views 2.0.

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 DocumentEvent.createEvent("UIEvent") method call.


IDL Definition
    // Introduced in DOM Level 2:
    interface UIEvent : Event {
      readonly attribute views::AbstractView view;
      readonly attribute long            detail;
      void               initUIEvent(in DOMString typeArg, 
                                     in boolean canBubbleArg, 
                                     in boolean cancelableArg, 
                                     in views::AbstractView viewArg, 
                                     in long detailArg);
      // Introduced in DOM Level 3:
      void               initUIEventNS(in DOMString namespaceURIArg, 
                                       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 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
Initializes attributes of an UIEvent object. This method has the same behavior as Event.initEvent().
Parameters
typeArg of type DOMString
Refer to the Event.initEvent() method for a description of this parameter.
canBubbleArg of type boolean
Refer to the Event.initEvent() method for a description of this parameter.
cancelableArg of type boolean
Refer to the Event.initEvent() method for a description of this parameter.
viewArg of type views::AbstractView
Specifies UIEvent.view. This value may be null.
detailArg of type long
Specifies UIEvent.detail.
No Return Value
No Exceptions
initUIEventNS introduced in DOM Level 3
Initializes attributes of an UIEvent object. This method has the same behavior as Event.initEventNS().
Parameters
namespaceURIArg of type DOMString
Refer to the Event.initEventNS() method for a description of this parameter.
typeArg of type DOMString
Refer to the Event.initEventNS() method for a description of this parameter.
canBubbleArg of type boolean
Refer to the Event.initEventNS() method for a description of this parameter.
cancelableArg of type boolean
Refer to the Event.initEventNS() method for a description of this parameter.
viewArg of type views::AbstractView
Refer to the UIEvent.initUIEvent() method for a description of this parameter.
detailArg of type long
Refer to the UIEvent.initUIEvent() method for a description of this parameter.
No Return Value
No Exceptions

The User Interface event types are listed below.

DOMActivate
TypeDOMActivate
NamespaceNone
InterfaceUIEvent
CancelableYes
BubblesYes
TargetElement
Context infoUIEvent.view is in use.
Refer to Activation requests and behavior.
DOMFocusIn
TypeDOMFocusIn
NamespaceNone
InterfaceUIEvent
CancelableNo
BubblesYes
TargetElement
Context infoUIEvent.view is in use.
An event target receives focus. The focus shall be given to the element before the dispatch of this event type. This event type shall be dispatched after the event type focus. This event type is deprecated in favor of the equivalent event type focusin.
DOMFocusOut
TypeDOMFocusOut
NamespaceNone
InterfaceUIEvent
CancelableNo
BubblesYes
TargetElement
Context infoUIEvent.view is in use.
An event target loses focus. The focus shall be taken from the element before the dispatch of this event type. This event type shall be dispatched after the event type blur. This event type is deprecated in favor of the equivalent event type focusout.
focus
Typefocus
NamespaceNone
InterfaceUIEvent
CancelableNo
BubblesNo
TargetElement
Context infoUIEvent.view is in use.
An event target receives focus. The focus shall be given to the element before the dispatch of this event type.
focusin
TypeDOMFocusIn
NamespaceNone
InterfaceUIEvent
CancelableNo
BubblesYes
TargetElement
Context infoUIEvent.view is in use.
An event target receives focus. The focus shall be given to the element before the dispatch of this event type. This event type shall be dispatched after the event type focus. This event type is similar to focus, but it must include the bubbling phase.
focusout
TypeDOMFocusOut
NamespaceNone
InterfaceUIEvent
CancelableNo
BubblesYes
TargetElement
Context infoUIEvent.view is in use.
An event target loses focus. The focus shall be taken from the element before the dispatch of this event type. This event type shall be dispatched after the event type blur. This event type is similar to blur, but it must include the bubbling phase.
blur
Typeblur
NamespaceNone
InterfaceUIEvent
CancelableNo
BubblesNo
TargetElement
Context infoUIEvent.view is in use.
An event target loses focus. The focus shall be taken from the element before the dispatch of this event type.

5.2.2 Basic Event Types

This event module contains basic event types associated with document manipulation. It defines the feature BasicEvents 3.0 and depends on the feature Events 3.0. The basic event types are listed below.

load
Typeload
NamespaceNone
InterfaceUIEvent if generated from a user interface, Event otherwise.
CancelableNo
BubblesNo
TargetDocument, Element
Context infoUIEvent.view may be in use.
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 must 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
Typeunload
NamespaceNone
InterfaceUIEvent if generated from a user interface, Event otherwise.
CancelableNo
BubblesNo
TargetDocument, Element
Context infoUIEvent.view may be in use.
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 shall be 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
Typeabort
NamespaceNone
InterfaceUIEvent if generated from a user interface, Event otherwise.
CancelableNo
BubblesYes
TargetElement
Context infoUIEvent.view may be in use.
Loading of a resource has been aborted.
error
Typeerror
NamespaceNone
InterfaceUIEvent if generated from a user interface, Event otherwise.
CancelableNo
BubblesYes
TargetElement
Context infoUIEvent.view may be in use.
A resource failed to load, or has been loaded but cannot be interpreted according to its semantics such as an invalid image, a script execution error, or non-well-formed XML.
select
Typeselect
NamespaceNone
InterfaceUIEvent if generated from a user interface, Event otherwise.
CancelableNo
BubblesYes
TargetElement
Context infoUIEvent.view may be in use.
A user selects some text. DOM Level 3 Events does not provide contextual information to access the selected text. The selection occurred before the dispatch of this event type.
change
Typechange
NamespaceNone
InterfaceUIEvent if generated from a user interface, Event otherwise.
CancelableNo
BubblesYes
TargetElement
Context infoUIEvent.view may be in use.
A control loses the input focus and its value has been modified since gaining focus. This event type shall be dispatched before the event type blur.
submit
Typesubmit
NamespaceNone
InterfaceUIEvent if generated from a user interface, Event otherwise.
CancelableYes
BubblesYes
TargetElement
Context infoUIEvent.view may be in use.
A form, such as a [HTML 4.01] or [XHTML 1.0] form, is submitted.
reset
Typereset
NamespaceNone
InterfaceUIEvent if generated from a user interface, Event otherwise.
CancelableYes
BubblesYes
TargetElement
Context infoUIEvent.view may be in use.
A form, such as a [HTML 4.01] or [XHTML 1.0] form, is reset.
resize
Typeresize
NamespaceNone
InterfaceUIEvent
CancelableNo
BubblesYes
TargetDocument, Element
Context infoUIEvent.view is in use.
A document view or an element has been resized. The resize occurred before the dispatch of this event type.
scroll
Typescroll
NamespaceNone
InterfaceUIEvent
CancelableNo
BubblesNo
TargetDocument, Element
Context infoUIEvent.view is in use.
A document view or an element has been scrolled. The scroll occurred before the dispatch of this event type.

5.2.3 Mouse Event Types

This module defines the feature MouseEvents 3.0 and depends on the feature UIEvents 3.0.

The Mouse event module originates from the [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 their descendent elements.

To create an instance of the MouseEvent interface, use the 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 DOM Level 0 implementations).


IDL Definition
  // Introduced in DOM Level 2:
  interface MouseEvent : UIEvent {
  readonly attribute long            screenX;
  readonly attribute long            screenY;
  readonly attribute long            clientX;
  readonly attribute long            clientY;
  readonly attribute boolean         ctrlKey;
  readonly attribute boolean         shiftKey;
  readonly attribute boolean         altKey;
  readonly attribute boolean         metaKey;
  readonly attribute unsigned short  button;
  readonly attribute EventTarget     relatedTarget;
  void               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 EventTarget relatedTargetArg);
  // Introduced in DOM Level 3:
  boolean            getModifierState(in DOMString keyIdentifierArg);
  // Introduced in DOM Level 3:
  void               initMouseEventNS(in DOMString namespaceURIArg, 
                                  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 EventTarget relatedTargetArg, 
                                  in DOMString modifiersListArg);
  };
  

Attributes
altKey of type boolean, readonly
Refer to the KeyboardEvent.altKey attribute.
button of type unsigned short, readonly
During mouse events caused by the depression or release of a mouse button, button shall be 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 viewport associated with the event.
clientY of type long, readonly
The vertical coordinate at which the event occurred relative to the viewport associated with the event.
ctrlKey of type boolean, readonly
Refer to the KeyboardEvent.ctrlKey attribute.
metaKey of type boolean, readonly
Refer to the KeyboardEvent.metaKey attribute.
relatedTarget of type EventTarget, readonly
Used to identify a secondary EventTarget related to a UI event, depending on the type of event.
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
Refer to the KeyboardEvent.shiftKey attribute.
Methods
getModifierState introduced in DOM Level 3
Queries the state of a modifier using a key identifier. See also Modifier keys.
Parameters
keyIdentifierArg of type DOMString
Refer to the KeyboardEvent.getModifierState() method for a description of this parameter.
Return Value

boolean

true if it is a modifier key and the modifier is activated, false otherwise.

No Exceptions
initMouseEvent
Initializes attributes of a MouseEvent object. This method has the same behavior as UIEvent.initUIEvent().
Parameters
typeArg of type DOMString
Refer to the UIEvent.initUIEvent() method for a description of this parameter.
canBubbleArg of type boolean
Refer to the UIEvent.initUIEvent() method for a description of this parameter.
cancelableArg of type boolean
Refer to the UIEvent.initUIEvent() method for a description of this parameter.
viewArg of type views::AbstractView
Refer to the UIEvent.initUIEvent() method for a description of this parameter.
detailArg of type long
Refer to the UIEvent.initUIEvent() method for a description of this parameter.
screenXArg of type long
Specifies MouseEvent.screenX.
screenYArg of type long
Specifies MouseEvent.screenY.
clientXArg of type long
Specifies MouseEvent.clientX.
clientYArg of type long
Specifies MouseEvent.clientY.
ctrlKeyArg of type boolean
Specifies MouseEvent.ctrlKey.
altKeyArg of type boolean
Specifies MouseEvent.altKey.
shiftKeyArg of type boolean
Specifies MouseEvent.shiftKey.
metaKeyArg of type boolean
Specifies MouseEvent.metaKey.
buttonArg of type unsigned short
Specifies MouseEvent.button.
relatedTargetArg of type EventTarget
Specifies MouseEvent.relatedTarget. This value may be null.
No Return Value
No Exceptions
initMouseEventNS introduced in DOM Level 3
Initializes attributes of a MouseEvent object. This method has the same behavior as UIEvent.initUIEventNS().
Parameters
namespaceURIArg of type DOMString
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
typeArg of type DOMString
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
canBubbleArg of type boolean
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
cancelableArg of type boolean
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
viewArg of type views::AbstractView
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
detailArg of type long
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
screenXArg of type long
Refer to the MouseEvent.initMouseEvent() method for a description of this parameter.
screenYArg of type long
Refer to the MouseEvent.initMouseEvent() method for a description of this parameter.
clientXArg of type long
Refer to the MouseEvent.initMouseEvent() method for a description of this parameter.
clientYArg of type long
Refer to the MouseEvent.initMouseEvent() method for a description of this parameter.
buttonArg of type unsigned short
Refer to the MouseEvent.initMouseEvent() method for a description of this parameter.
relatedTargetArg of type EventTarget
Refer to the MouseEvent.initMouseEvent() method for a description of this parameter.
modifiersListArg of type DOMString
Refer to the KeyboardEvent.initKeyboardEventNS() method for a description of this parameter.
No Return Value
No Exceptions

The Mouse event types are listed below. 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.

Implementations must maintain the current click count when generating mouse events. This shall be a non-negative integer indicating the number of consecutive clicks of a pointing device button during a user action. The notion of consecutive clicks depends on the environment configuration. For example, a dblclick event type might not happen if there is a long delay between the two clicks. Note: The value of UIEvent.detail for a number of clicks greater than 2 is platform-dependent. For example, on the Windows OS, the click-count series seems to be 1, 2, 3, 2, 3, while on MacOS, the click-count series seems to be 1, 2, 3, 4, 5, ....

click

Typeclick
NamespaceNone
InterfaceMouseEvent
CancelableYes
BubblesYes
TargetElement
Context infoMouseEvent.screenX, MouseEvent.screenY, MouseEvent.clientX, MouseEvent.clientY, MouseEvent.altKey, MouseEvent.ctrlKey, MouseEvent.shiftKey, MouseEvent.metaKey, MouseEvent.button, and UIEvent.view are in use. The UIEvent.detail attribute indicates the current click count. The attribute value shall be 1 when the user begins this action and increments by 1 for each click.
The click event must be dispatched on the topmost event target indicated by the pointer, when the user presses down and releases the pointer button, or otherwise activates the pointer in a manner that simulates such an action. Activation of the button may depend upon the pointer device and the environment configuration, e.g. it may depend on the screen location or the delay between the press and release of the pointing device button. The click event may be preceded by the mousedown and mouseup events on the same element. Depending upon the environment configuration, the click event may be dispatched if one or more of the event types mouseover, mousemove, and mouseout occur between the press and release of the pointing device button. The click event may also be followed by the dblclick event. The click event type must be dispatched as described in Activation requests and behavior.
dblclick
Typedblclick
NamespaceNone
InterfaceMouseEvent
CancelableYes
BubblesYes
TargetElement
Context infoMouseEvent.screenX, MouseEvent.screenY, MouseEvent.clientX, MouseEvent.clientY, MouseEvent.altKey, MouseEvent.ctrlKey, MouseEvent.shiftKey, MouseEvent.metaKey, MouseEvent.button, and UIEvent.view are in use. The UIEvent.detail attribute indicates the current click count.
A pointing device button is clicked twice over an element. The definition of a double click depends on the environment configuration, except that the event target must be the same between mousedown, mouseup, and dblclick. This event type must be dispatched after the event type click if a click and double click occur simultaneously, and after the event type mouseup otherwise.

Note: Canceling the click event must not not affect the firing of a dblclick event.

mousedown
Typemousedown
NamespaceNone
InterfaceMouseEvent
CancelableYes
BubblesYes
TargetElement
Context infoMouseEvent.screenX, MouseEvent.screenY, MouseEvent.clientX, MouseEvent.clientY, MouseEvent.altKey, MouseEvent.ctrlKey, MouseEvent.shiftKey, MouseEvent.metaKey, MouseEvent.button, and UIEvent.view are in use. The UIEvent.detail attribute indicates the current click count incremented by one. For example, if no click happened before the mousedown, UIEvent.detail must contain the value 1.
A pointing device button must be pressed over an element.
mouseenter
Typemouseenter
NamespaceNone
InterfaceMouseEvent
CancelableYes
BubblesNo
TargetElement
Context infoMouseEvent.screenX, MouseEvent.screenY, MouseEvent.clientX, MouseEvent.clientY, MouseEvent.altKey, MouseEvent.ctrlKey, MouseEvent.shiftKey, MouseEvent.metaKey, and UIEvent.view are in use. MouseEvent.relatedTarget indicates the event target a pointing device is exiting, if any.
A pointing device is moved onto an element. This event type is similar to mouseover, but for mouseenter, the propagation path must end at the event target element, and must not include the target element's child nodes as event targets.

Note: This is the event type equivalent of the CSS :hover pseudo-class[CSS2]. This matches the mouseleave event type in its propagation path behavior.

mouseleave
Typemouseout
NamespaceNone
InterfaceMouseEvent
CancelableYes
BubblesNo
TargetElement
Context infoMouseEvent.screenX, MouseEvent.screenY, MouseEvent.clientX, MouseEvent.clientY, MouseEvent.altKey, MouseEvent.ctrlKey, MouseEvent.shiftKey, MouseEvent.metaKey, and UIEvent.view are in use. MouseEvent.relatedTarget indicates the event target a pointing device is entering, if any.
A pointing device is moved away from an element. This event type is similar to mouseout, but for mouseleave, the propagation path must end at the event target element, and must not include the target element's child nodes as event targets.

Note: This matches the mouseenter event type in its propagation path behavior.

mousemove
Typemousemove
NamespaceNone
InterfaceMouseEvent
CancelableYes
BubblesYes
TargetElement
Context infoMouseEvent.screenX, MouseEvent.screenY, MouseEvent.clientX, MouseEvent.clientY, MouseEvent.altKey, MouseEvent.ctrlKey, MouseEvent.shiftKey, MouseEvent.metaKey, and UIEvent.view are in use.
A pointing device is moved while it is over an element.
mouseout
Typemouseout
NamespaceNone
InterfaceMouseEvent
CancelableYes
BubblesYes
TargetElement
Context infoMouseEvent.screenX, MouseEvent.screenY, MouseEvent.clientX, MouseEvent.clientY, MouseEvent.altKey, MouseEvent.ctrlKey, MouseEvent.shiftKey, MouseEvent.metaKey, and UIEvent.view are in use. MouseEvent.relatedTarget indicates the event target a pointing device is entering, if any.
A pointing device is moved away from an element. This event type is similar to mouseleave, but for mouseout, the propagation path must include the target element's child nodes as event targets. The mouseout event type matches the mouseover event type in its propagation path behavior.
mouseover
Typemouseover
NamespaceNone
InterfaceMouseEvent
CancelableYes
BubblesYes
TargetElement
Context infoMouseEvent.screenX, MouseEvent.screenY, MouseEvent.clientX, MouseEvent.clientY, MouseEvent.altKey, MouseEvent.ctrlKey, MouseEvent.shiftKey, MouseEvent.metaKey, and UIEvent.view are in use. MouseEvent.relatedTarget indicates the event target a pointing device is exiting, if any.
A pointing device is moved onto an element. This event type is similar to mouseenter, but for mouseover, the propagation path must include the target element's child nodes as event targets. The mouseover event type matches the mouseout event type in its propagation path behavior.
mouseup
Typemouseup
NamespaceNone
InterfaceMouseEvent
CancelableYes
BubblesYes
TargetElement
Context infoMouseEvent.screenX, MouseEvent.screenY, MouseEvent.clientX, MouseEvent.clientY, MouseEvent.altKey, MouseEvent.ctrlKey, MouseEvent.shiftKey, MouseEvent.metaKey, MouseEvent.button, and UIEvent.view are in use. The UIEvent.detail attribute indicates the current click count incremented by one.
A pointing device button is released over an element.

5.2.4 Mouse Wheel Event Types

This module defines the feature MouseWheelEvents 3.0 and depends on the feature MouseEvents 3.0.

Mouse wheel events are included for specification of legacy support, but are deprecated. Authors are encouraged to use Wheel event types instead.

Interface MouseWheelEvent (introduced in DOM Level 3)

The MouseWheelEvent interface provides specific contextual information associated with mouse wheel events.

To create an instance of the MouseWheelEvent interface, use the DocumentEvent.createEvent("MouseWheelEvent") method call.


IDL Definition
        // Introduced in DOM Level 3:
        interface MouseWheelEvent : MouseEvent {
        readonly attribute long            wheelDelta;
        void               initMouseWheelEvent(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 EventTarget relatedTargetArg, 
                                             in DOMString modifiersListArg, 
                                             in long wheelDeltaArg);
        void               initMouseWheelEventNS(in DOMString namespaceURIArg, 
                                             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 EventTarget relatedTargetArg, 
                                             in DOMString modifiersListArg, 
                                             in long wheelDeltaArg);
        };
        

Attributes
wheelDelta of type long, readonly
The distance the wheel has rotated around the y-axis. Because this is a legacy event type, the units or number of these units in wheelDelta are implementation-specific.
Methods
initMouseWheelEvent introduced in DOM Level 3
Initializes attributes of a MouseWheelEvent object. This method has the same behavior as MouseEvent.initMouseEventNS().
Parameters
typeArg of type DOMString
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
canBubbleArg of type boolean
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
cancelableArg of type boolean
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
viewArg of type views::AbstractView
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
detailArg of type long
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
screenXArg of type long
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
screenYArg of type long
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
clientXArg of type long
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
clientYArg of type long
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
buttonArg of type unsigned short
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
relatedTargetArg of type EventTarget
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
modifiersListArg of type DOMString
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
wheelDeltaArg of type long
Specifies MouseWheelEvent.wheelDelta.
No Return Value
No Exceptions
initMouseWheelEventNS introduced in DOM Level 3
Initializes attributes of a MouseWheelEvent object. This method has the same behavior as MouseEvent.initMouseEventNS().
Parameters
namespaceURIArg of type DOMString
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
typeArg of type DOMString
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
canBubbleArg of type boolean
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
cancelableArg of type boolean
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
viewArg of type views::AbstractView
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
detailArg of type long
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
screenXArg of type long
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
screenYArg of type long
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
clientXArg of type long
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
clientYArg of type long
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
buttonArg of type unsigned short
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
relatedTargetArg of type EventTarget
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
modifiersListArg of type DOMString
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
wheelDeltaArg of type long
Specifies MouseWheelEvent.wheelDelta.
No Return Value
No Exceptions
mousewheel
Typemousewheel
NamespaceNone
InterfaceMouseWheelEvent
CancelableYes
BubblesYes
TargetDocument, Element
Context infoMouseWheelEvent.wheelDelta, MouseEvent.altKey, MouseEvent.ctrlKey, MouseEvent.shiftKey, MouseEvent.metaKey, and UIEvent.view are in use. MouseEvent.screenX, MouseEvent.screenY, MouseEvent.clientX, MouseEvent.clientY, and MouseEvent.button are in use if the wheel is associated to a pointing device. MouseEvent.relatedTarget indicates the event target the pointing device is pointing at, if any. UIEvent.detail is not in use.
A mouse wheel has been rotated around the y-axis.

5.2.5 Wheel Event Types

This module defines the feature WheelEvents 3.0 and depends on the feature MouseEvents 3.0.

Wheels are devices that can be rotated in one or more spatial dimensions, and which may or may not be associated with a pointer device. The coordinate system depends on the environment configuration. As an example, the environment may be configured to associate vertical scrolling with rotation along the y-axis, horizontal scrolling with rotation along the x-axis, and zooming with rotation along the z-axis. The deltax, deltaY, and deltaX attributes of WheelEvent objects indicate the distance of the rotation, as specified in the delta definition.

delta

The distance the wheel has rotated around the its axis.

The value of a delta shall be a integer indicating a distance, measured as the number of rolls the wheel has been rotated. A positive value shall indicate that the wheel has been rotated away from the user on vertically-aligned devices or in a left-hand manner on horizontally aligned devices, and a negative value shall indicate that the wheel has been rotated towards the user on vertically-aligned devices or in a right-hand manner on horizontally-aligned devices. The default value of a delta attribute shall be 0.

roll
A unit of rotation for a device using the WheelEvent interface. On some devices this may be a finite physical step. On devices with smooth rotation, a roll becomes the smallest reported amount of rotation.
rotation
An indication of incremental change. On some devices this may be a literal rotation of a wheel, while on others, it may be movement along a flat surface, or pressure on a particular button.
Interface WheelEvent (introduced in DOM Level 3)

The WheelEvent interface provides specific contextual information associated with omnidirectional mouse wheel events.

To create an instance of the WheelEvent interface, use the DocumentEvent.createEvent("WheelEvent") method call.


IDL Definition
        // Introduced in DOM Level 3:
        interface WheelEvent : MouseEvent {

        // DeltaModeCode
        const unsigned long       DOM_DELTA_PIXEL       = 0x00;
        const unsigned long       DOM_DELTA_LINE        = 0x01;
        const unsigned long       DOM_DELTA_PAGE        = 0x02;

        readonly attribute long            deltaX;
        readonly attribute long            deltaY;
        readonly attribute long            deltaZ;
        readonly attribute unsigned long   deltaMode;    
        void               initWheelEvent(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 EventTarget relatedTargetArg, 
                                                  in DOMString modifiersListArg, 
                                                  in long deltaXArg, 
                                                  in long deltaYArg, 
                                                  in long deltaZArg, 
                                                  in unsigned long deltaMode);
        void               initWheelEventNS(in DOMString namespaceURIArg, 
                                                  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 EventTarget relatedTargetArg, 
                                                  in DOMString modifiersListArg, 
                                                  in long deltaXArg, 
                                                  in long deltaYArg, 
                                                  in long deltaZArg, 
                                                  in unsigned long deltaMode);
        };
        

Definition group DeltaModeCode

This set of constants shall be used to indicate the units of measurement for the delta values. The precise measurement is specific to device, operating system, and application configurations.

Defined Constants
DOM_DELTA_PIXEL
The units of measurement for the delta shall be pixels. This is the most typical case in most operating system and implementation configurations.
DOM_DELTA_LINE
The units of measurement for the delta shall be individual lines of text. This is the case for many form controls.
DOM_DELTA_PAGE
The units of measurement for the delta shall be pages, either defined as a single screen or as a demarcated page.
Attributes
deltaX of type long, readonly
The distance the wheel has rotated around the x-axis.
deltaY of type long, readonly
The distance the wheel has rotated around the y-axis.
deltaZ of type long, readonly
The distance the wheel has rotated around the z-axis.
deltaMode of type unsigned long, readonly
The deltaMode attribute contains an indication of to indicate the units of measurement for the delta values. The default value is DOM_DELTA_PIXEL (pixels). The value of deltaMode may be different for each of deltaX, deltaY, and deltaZ, based on system configuration.

@@ deltaMode is the proposed solution for ISSUE-9.

Methods
initWheelEvent introduced in DOM Level 3
Initializes attributes of a WheelEvent object. This method has the same behavior as MouseEvent.initMouseEventNS().
Parameters
typeArg of type DOMString
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
canBubbleArg of type boolean
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
cancelableArg of type boolean
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
viewArg of type views::AbstractView
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
detailArg of type long
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
screenXArg of type long
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
screenYArg of type long
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
clientXArg of type long
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
clientYArg of type long
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
buttonArg of type unsigned short
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
relatedTargetArg of type EventTarget
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
modifiersListArg of type DOMString
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
deltaXArg of type long
Specifies WheelEvent.deltaX.
deltaYArg of type long
Specifies WheelEvent.deltaY.
deltaZArg of type long
Specifies WheelEvent.deltaZ.
deltaModeArg of type unsigned long
Specifies WheelEvent.deltaMode.
No Return Value
No Exceptions
initWheelEventNS introduced in DOM Level 3
Initializes attributes of a WheelEvent object. This method has the same behavior as MouseEvent.initMouseEventNS().
Parameters
namespaceURIArg of type DOMString
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
typeArg of type DOMString
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
canBubbleArg of type boolean
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
cancelableArg of type boolean
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
viewArg of type views::AbstractView
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
detailArg of type long
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
screenXArg of type long
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
screenYArg of type long
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
clientXArg of type long
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
clientYArg of type long
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
buttonArg of type unsigned short
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
relatedTargetArg of type EventTarget
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
modifiersListArg of type DOMString
Refer to the MouseEvent.initMouseEventNS() method for a description of this parameter.
deltaXArg of type long
Specifies WheelEvent.deltaX.
deltaYArg of type long
Specifies WheelEvent.deltaY.
deltaZArg of type long
Specifies WheelEvent.deltaZ.
deltaModeArg of type unsigned long
Specifies WheelEvent.deltaMode.
No Return Value
No Exceptions
wheel
Typewheel
NamespaceNone
InterfaceWheelEvent
CancelableYes
BubblesYes
TargetDocument, Element
Context infoWheelEvent.deltaX, WheelEvent.deltaY, WheelEvent.deltaZ, MouseEvent.altKey, MouseEvent.ctrlKey, MouseEvent.shiftKey, MouseEvent.metaKey, and UIEvent.view are in use. MouseEvent.screenX, MouseEvent.screenY, MouseEvent.clientX, MouseEvent.clientY, and MouseEvent.button are in use if the wheel is associated to a pointing device. MouseEvent.relatedTarget indicates the event target the pointing device is pointing at, if any. UIEvent.detail is not in use.
A mouse wheel has been rotated. A default action of user agent generated event objects of this type causes implementations to dispatch a mousewheel event iff it supports that event type and WheelEvent.deltaY is non-zero.

5.2.6 Text Events Types

This module defines the feature TextEvents 3.0 and depends on the feature UIEvents 3.0.

The text event module originates from the [HTML 4.01] onkeypress attribute. Unlike this attribute, the event type textInput applies only to characters and is designed for use with any text input devices, not just keyboards. Refer to 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 DocumentEvent.createEvent("TextEvent") method call.


IDL Definition
// Introduced in DOM Level 3:
interface TextEvent : UIEvent {

// InputModeCode
const unsigned long       DOM_INPUT_METHOD_UNKNOWN       = 0x00;
const unsigned long       DOM_INPUT_METHOD_KEYBOARD      = 0x01;
const unsigned long       DOM_INPUT_METHOD_PASTE         = 0x02;
const unsigned long       DOM_INPUT_METHOD_DROP          = 0x03;
const unsigned long       DOM_INPUT_METHOD_IME           = 0x04;
const unsigned long       DOM_INPUT_METHOD_OPTION        = 0x05;
const unsigned long       DOM_INPUT_METHOD_HANDWRITING   = 0x06;
const unsigned long       DOM_INPUT_METHOD_VOICE         = 0x07;
const unsigned long       DOM_INPUT_METHOD_MULTIMODAL    = 0x08;
const unsigned long       DOM_INPUT_METHOD_SCRIPT        = 0x09;

readonly attribute DOMString       data;
readonly attribute unsigned long   inputMode;
void               initTextEvent(in DOMString typeArg, 
                                 in boolean canBubbleArg, 
                                 in boolean cancelableArg, 
                                 in views::AbstractView viewArg, 
                                 in DOMString dataArg, 
                                 in unsigned long inputMode);
void               initTextEventNS(in DOMString namespaceURIArg, 
                                   in DOMString typeArg, 
                                   in boolean canBubbleArg, 
                                   in boolean cancelableArg, 
                                   in views::AbstractView viewArg, 
                                   in DOMString dataArg, 
                                   in unsigned long inputMode);
};

Definition group InputModeCode

This set of constants shall be used to indicate the origin of the text input. 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_INPUT_METHOD_UNKNOWN
The text string was input by an unknown means.
DOM_INPUT_METHOD_KEYBOARD
The text string was input through a keyboard. This may be associated with one or more of keypress, keydown, or keyup events.
DOM_INPUT_METHOD_PASTE
The text string was pasted in from a clipboard. This may be associated with a paste event, specified elsewhere.
DOM_INPUT_METHOD_DROP
The text string was inserted as part of a drag-and-drop operation. This may be associated with a drop event, specified elsewhere.
DOM_INPUT_METHOD_IME
The text string was entered through an Input Method Editor. This may be associated with a compositionend event.
DOM_INPUT_METHOD_OPTION
The text string was selected from a set of options presented, such as from a form. This may be associated with various other events, specified elsewhere.
DOM_INPUT_METHOD_HANDWRITING
The text string was input through a pen/tablet device and processed by handwriting recognition software. This may be associated with a specific event defined elsewhere.
DOM_INPUT_METHOD_VOICE
The text string was input by a voice device and interpreted by speech recognition software. This may be associated with a specific event defined elsewhere.
DOM_INPUT_METHOD_MULTIMODAL
The text string was inserted as part of an operation involving multiple input modalities in combination, such as pointer-enhanced speech. This may be associated with various other events, specified elsewhere.
DOM_INPUT_METHOD_SCRIPT
The text string was inserted via a script operation on the DOM. This may be associated with one or more mutation events.
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 [Unicode]. Characters should be normalized as defined by the Unicode normalization form NFC, defined in [UAX #15]. This attribute cannot be null or contain the empty string.
inputMode of type unsigned long, readonly
The inputMode attribute contains an indication of the origin of the text input, as described in InputModeCode.
Methods
initTextEvent
Initializes attributes of a TextEvent object. This method has the same behavior as UIEvent.initUIEvent(). The value of UIEvent.detail remains undefined.
Parameters
typeArg of type DOMString
Refer to the UIEvent.initUIEvent() method for a description of this parameter.
canBubbleArg of type boolean
Refer to the UIEvent.initUIEvent() method for a description of this parameter.
cancelableArg of type boolean
Refer to the UIEvent.initUIEvent() method for a description of this parameter.
viewArg of type views::AbstractView
Refer to the UIEvent.initUIEvent() method for a description of this parameter.
dataArg of type DOMString
Specifies TextEvent.data.
inputModeArg of type unsigned long
Specifies TextEvent.inputMode.
No Return Value
No Exceptions
initTextEventNS
Initializes attributes of a TextEvent object. This method has the same behavior as UIEvent.initUIEventNS(). The value of UIEvent.detail remains undefined.
Parameters
namespaceURIArg of type DOMString
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
typeArg of type DOMString
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
canBubbleArg of type boolean
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
cancelableArg of type boolean
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
viewArg of type views::AbstractView
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
dataArg of type DOMString
Refer to the TextEvent.initTextEvent() method for a description of this parameter.
inputModeArg of type unsigned long
Specifies TextEvent.inputMode.
No Return Value
No Exceptions

The text event type is listed below.

textInput
TypetextInput
NamespaceNone
InterfaceTextEvent
CancelableYes
BubblesYes
TargetElement
Context infoUIEvent.view, TextEvent.data, and TextEvent.inputMode are in use.
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 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.

5.2.7 Keyboard Event Types

This module defines the feature KeyboardEvents 3.0 and depends on the feature UIEvents 3.0.

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 Text events types when dealing with character input. Refer to Keyboard events and key identifiers for more details, including examples on how Keyboard Events are used in combination with Composition Events.

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: KeyboardEvent.ctrlKey, KeyboardEvent.shiftKey, KeyboardEvent.altKey, KeyboardEvent.metaKey. These attributes are equivalent to using the method KeyboardEvent.getModifierState(keyIdentifierArg) with 'Control', 'Shift', 'Alt', or 'Meta' respectively.

To create an instance of the KeyboardEvent interface, use the DocumentEvent.createEvent("KeyboardEvent") method call.


IDL Definition
  // Introduced in DOM Level 3:
  interface KeyboardEvent : UIEvent {

  // KeyLocationCode
  const unsigned long       DOM_KEY_LOCATION_STANDARD      = 0x00;
  const unsigned long       DOM_KEY_LOCATION_LEFT          = 0x01;
  const unsigned long       DOM_KEY_LOCATION_RIGHT         = 0x02;
  const unsigned long       DOM_KEY_LOCATION_NUMPAD        = 0x03;
  const unsigned long       DOM_KEY_LOCATION_MOBILE        = 0x04;
  const unsigned long       DOM_KEY_LOCATION_JOYSTICK      = 0x05;

  readonly attribute DOMString       keyIdentifier;                
  readonly attribute unsigned long   keyLocation;
  readonly attribute boolean         ctrlKey;
  readonly attribute boolean         shiftKey;
  readonly attribute boolean         altKey;
  readonly attribute boolean         metaKey;
  readonly attribute boolean         repeat;
  boolean            getModifierState(in DOMString keyIdentifierArg);
  void               initKeyboardEvent(in DOMString typeArg, 
                                     in boolean canBubbleArg, 
                                     in boolean cancelableArg, 
                                     in views::AbstractView viewArg, 
                                     in DOMString keyIdentifierArg, 
                                     in unsigned long keyLocationArg, 
                                     in DOMString modifiersListArg,
                                     in boolean repeat);
  void               initKeyboardEventNS(in DOMString namespaceURIArg, 
                                       in DOMString typeArg, 
                                       in boolean canBubbleArg, 
                                       in boolean cancelableArg, 
                                       in views::AbstractView viewArg, 
                                       in DOMString keyIdentifierArg, 
                                       in unsigned long keyLocationArg, 
                                       in DOMString modifiersListArg,
                                       in boolean repeat);
  };
  

Definition group KeyLocationCode

This set of constants shall be 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 shall be in the left key location (there is more than one possible location for this key). Example: the left 'Control' 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 shall be 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 shall not be 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.
DOM_KEY_LOCATION_MOBILE
The key activation originated on a mobile device, either on a physical keypad or a virtual keyboard. Example: the '#' key or softkey on a mobile device.
DOM_KEY_LOCATION_JOYSTICK
The key activation originated on a game controller or a joystick on a mobile device. Example: the 'DownLeft' key on a game controller.
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 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 the key on the device, as described in 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.
repeat of type boolean, readonly
true if the key has been pressed in a sustained manner. Depending on the system configuration, holding down a key results may result in multiple consecutive keydown events, keypress events, and textInput events, for appropriate keys. For mobile devices which have long-key-press behavior, the first key event with a repeat attribute value of 'true' shall serve as an indication of a long-key-press. The length of time that the key must be pressed in order to begin repeating is configuration-dependent.
Methods
getModifierState
Queries the state of a modifier using a key identifier. See also 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 KeyboardEvent.keyLocation.

Return Value

boolean

true if it is a modifier key and the modifier is activated, false otherwise.

No Exceptions
initKeyboardEvent
Initializes attributes of a KeyboardEvent object. This method has the same behavior as UIEvent.initUIEvent(). The value of UIEvent.detail remains undefined.
Parameters
typeArg of type DOMString
Refer to the UIEvent.initUIEvent() method for a description of this parameter.
canBubbleArg of type boolean
Refer to the UIEvent.initUIEvent() method for a description of this parameter.
cancelableArg of type boolean
Refer to the UIEvent.initUIEvent() method for a description of this parameter.
viewArg of type views::AbstractView
Refer to the UIEvent.initUIEvent() method for a description of this parameter.
keyIdentifierArg of type DOMString
Specifies KeyboardEvent.keyIdentifier.
keyLocationArg of type unsigned long
Specifies KeyboardEvent.keyLocation.
modifiersListArg of type DOMString
A white space separated list of modifier key identifiers to be activated on this object. As an example, "Control Alt" must mark the control and alt modifiers as activated.
No Return Value
No Exceptions
initKeyboardEventNS
Initializes attributes of a KeyboardEvent object. This method has the same behavior as UIEvent.initUIEventNS(). The value of UIEvent.detail remains undefined.
Parameters
namespaceURIArg of type DOMString
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
typeArg of type DOMString
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
canBubbleArg of type boolean
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
cancelableArg of type boolean
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
viewArg of type views::AbstractView
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
keyIdentifierArg of type DOMString
Refer to the KeyboardEvent.initKeyboardEvent() method for a description of this parameter.
keyLocationArg of type unsigned long
Refer to the KeyboardEvent.initKeyboardEvent() method for a description of this parameter.
modifiersListArg of type DOMString
Refer to the KeyboardEvent.initKeyboardEvent() method for a description of this parameter.
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.

keydown
Typekeydown
NamespaceNone
InterfaceKeyboardEvent
CancelableYes
BubblesYes
TargetElement
Context infoUIEvent.view, KeyboardEvent.keyIdentifier, KeyboardEvent.keyLocation, KeyboardEvent.altKey, KeyboardEvent.shiftKey, KeyboardEvent.ctrlKey, KeyboardEvent.metaKey, and KeyboardEvent.repeat are in use.
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 shall be generated after the keyboard mapping but before the processing of an input method editor. This event should logically happen before the event keyup is produced. Whether a keydown contributes or not to the generation of a text event is implementation dependent.

Note: the keydown and keyup events are traditionally associated with detecting a physical key rather than a character value.

keypress
Typekeypress
NamespaceNone
InterfaceKeyboardEvent
CancelableYes
BubblesYes
TargetElement
Context infoUIEvent.view, KeyboardEvent.keyIdentifier, KeyboardEvent.keyLocation, KeyboardEvent.altKey, KeyboardEvent.shiftKey, KeyboardEvent.ctrlKey, KeyboardEvent.metaKey, and KeyboardEvent.repeat are in use.
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 shall be generated after the keyboard mapping but before the processing of an input method editor. This event should logically happen before the event keyup is produced. Whether a keypress contributes or not to the generation of a text event is implementation dependent.

Note: the keypress event is traditionally associated with detecting a character value rather than a physical key, and may not be available on all keys in some configurations.

Warning: the keypress event type is defined in this specification for reference and completeness, but this specification deprecates the use of this event type.

keyup
Typekeyup
NamespaceNone
InterfaceKeyboardEvent
CancelableYes
BubblesYes
TargetElement
Context infoUIEvent.view, KeyboardEvent.keyIdentifier, and KeyboardEvent.keyLocation are in use. KeyboardEvent.altKey, KeyboardEvent.shiftKey, KeyboardEvent.ctrlKey, and KeyboardEvent.metaKey are in use unless the KeyboardEvent.keyIdentifier corresponds to the key modifier itself.
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 shall be generated after the keyboard mapping but before the processing of an input method editor. This event should logically happen after the event keydown shall be produced. Whether a keyup contributes or not to the generation of a text event is implementation dependent.

Note: the keydown and keyup events are traditionally associated with detecting a physical key rather than a character value.

5.2.8 Composition Events Types

This module defines the feature CompositionEvents 3.0 and depends on the feature UIEvents 3.0.

Composition Events provide a means for inputing text in a supplementary or alternate manner than by Keyboard Events, in order to allow the use of characters that may not be commonly available on keyboard. For examples, Composition events may be used to add accents to characters despite their absence from standard US keyboards, to build up logograms of many Asian languages from their base components or categories, to select word choices from a combination of key presses on a mobile device keyboard, or to convert voice commands into text using a speech recognition processor. Refer to Keyboard events and key identifiers for examples on how Composition Events are used in combination with keyboard events.

Conceptually, a composition session consists of one compositionstart event, one or more compositionupdate events, and one compositionend event, with the value of the data attribute persisting between each "stage" of this event chain during each session.

Not all IME systems or devices expose the necessary data to the DOM, so the active composition string (the "Reading Window" or "candidate selection menu option") may not be available through this interface, in which case the selection may be represented by the empty string.

Interface CompositionEvent (introduced in DOM Level 3)

The CompositionEvent interface provides specific contextual information associated with Composition Events.

To create an instance of the CompositionEvent interface, use the DocumentEvent.createEvent("CompositionEvent") method call.


IDL Definition
      // Introduced in DOM Level 3:
      interface CompositionEvent : UIEvent {

      readonly attribute DOMString       data;
      void               initCompositionEvent(in DOMString typeArg, 
                                 in boolean canBubbleArg, 
                                 in boolean cancelableArg, 
                                 in views::AbstractView viewArg, 
                                 in DOMString dataArg);
      void               initCompositionEventNS(in DOMString namespaceURIArg, 
                                   in DOMString typeArg, 
                                   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 an input method. This may be a single Unicode character or a non-empty sequence of Unicode characters [Unicode]. Characters should be normalized as defined by the Unicode normalization form NFC, defined in [UAX #15]. This attribute may be null or contain the empty string.
Methods
initCompositionEvent
Initializes attributes of a CompositionEvent object. This method has the same behavior as UIEvent.initUIEvent(). The value of UIEvent.detail remains undefined.
Parameters
typeArg of type DOMString
Refer to the UIEvent.initUIEvent() method for a description of this parameter.
canBubbleArg of type boolean
Refer to the UIEvent.initUIEvent() method for a description of this parameter.
cancelableArg of type boolean
Refer to the UIEvent.initUIEvent() method for a description of this parameter.
viewArg of type views::AbstractView
Refer to the UIEvent.initUIEvent() method for a description of this parameter.
dataArg of type DOMString
Specifies CompositionEvent.data.
No Return Value
No Exceptions
initCompositionEventNS
Initializes attributes of a CompositionEvent object. This method has the same behavior as UIEvent.initUIEventNS(). The value of UIEvent.detail remains undefined.
Parameters
namespaceURIArg of type DOMString
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
typeArg of type DOMString
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
canBubbleArg of type boolean
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
cancelableArg of type boolean
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
viewArg of type views::AbstractView
Refer to the UIEvent.initUIEventNS() method for a description of this parameter.
dataArg of type DOMString
Refer to the CompositionEvent.initCompositionEvent() method for a description of this parameter.
No Return Value
No Exceptions

The composition event types are listed below.

compositionstart
Typecompositionstart
NamespaceNone
InterfaceCompositionEvent
CancelableYes
BubblesYes
TargetElement
Context infoUIEvent.view, and CompositionEvent.data.
A text composition system begins composing a passage of text. This event type is device-dependent, and may rely upon the capabilities of the text conversion system and how it is mapped into the operating system. When a keyboard is used to feed an input method editor, this event type is generated after a keydown event, but speech or handwriting recognition systems may send this event type without keyboard events. Some implemenations may populate the data attribute of the compositionstart event with the text currently selected in the document (for editing and replacement); otherwise, the value of the data attribute shall be null. (@@ see Extra notes on composition events for more details.)
compositionupdate
Typecompositionupdate
NamespaceNone
InterfaceCompositionEvent
CancelableYes
BubblesYes
TargetElement
Context infoUIEvent.view, and CompositionEvent.data.
A text composition system updates its active text passage with a new character, which is added to the string in CompositionEvent.data. Note that some text composition systems may not expose this information to the DOM, in which case this event will not fire during the composition process. If the composition process is canceled, this event will be fired immediately before the compositionend event, and the CompositionEvent.data attribute will be set to null(@@ "null" or "empty string"? What's the distinction?).
compositionend
Typecompositionend
NamespaceNone
InterfaceCompositionEvent
CancelableYes
BubblesYes
TargetElement
Context infoUIEvent.view, and CompositionEvent.data.
A text composition system completes the composition of its active text passage, or cancels the composition process. If the result of the text composition system is not null and does not contain the empty string, this event type will be followed by a textInput event type with the appropriate inputMode value, such as DOM_INPUT_METHOD_IME, DOM_INPUT_METHOD_HANDWRITING, DOM_INPUT_METHOD_VOICE, or DOM_INPUT_METHOD_MULTIMODAL.

@@ original text: A text composition system completes the composition of its active text passage. This event type is similar to a TextInput event but is also sent when an input method cancels composing a text.

5.2.8.1 Handwriting Recognition Systems

The following example describes a possible sequence of events when composing a text passage "text" with a handwriting recognition system, such as on a pen tablet, as modeled using Composition Events.

@@ needs more investigation, particularly with regard to pen-tablet events.

  1. "compositionstart": ''
  2. "compositionupdate": 'test'@@ what's going on here? is there a "reject" option that's being exemplified?
  3. "compositionupdate": 'text'
  4. "compositionend": 'text'
  5. "textInput": 'text' ("inputMode": 'DOM_INPUT_METHOD_HANDWRITING')

5.2.9 Mutation Events

This module defines the feature MutationEvents 3.0 and depends on the feature Events 3.0.

Note: The MutationEvent interface was introduced in DOM Level 2 Events, but has not yet been completely and interoperably implemented across user agents. In addition, there have been critiques that the interface, as designed, introduces a performance and implementation challenge. A new specification is under development with the aim of addressing the use cases that mutation events solves, but in more performant manner. Thus, this specification describes mutation events for completeness, but deprecates the use of both the MutationEvent interface and the MutationNameEvent interface.

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 DocumentEvent.createEvent("MutationEvent") method call.


IDL Definition
    // Introduced in DOM Level 2:
    interface MutationEvent : Event {

      // attrChangeType
      const unsigned short      MODIFICATION                   = 1;
      const unsigned short      ADDITION                       = 2;
      const unsigned short      REMOVAL                        = 3;

      readonly attribute Node            relatedNode;
      readonly attribute DOMString       prevValue;
      readonly attribute DOMString       newValue;
      readonly attribute DOMString       attrName;
      readonly attribute unsigned short  attrChange;
      void               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               initMutationEventNS(in DOMString namespaceURIArg, 
                                             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 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 DOMAttrModified event.
newValue of type DOMString, readonly
newValue indicates the new value of the Attr node in DOMAttrModified events, and of the CharacterData node in DOMCharacterDataModified events.
prevValue of type DOMString, readonly
prevValue indicates the previous value of the Attr node in DOMAttrModified events, and of the CharacterData node in DOMCharacterDataModified events.
relatedNode of type Node, readonly
relatedNode shall be used to identify a secondary node related to a mutation event. For example, if a mutation event is dispatched to a node indicating that its parent has changed, the relatedNode shall be the changed parent. If an event is instead dispatched to a subtree indicating a node was changed within it, the relatedNode shall be the changed node. In the case of the DOMAttrModified event it indicates the Attr node which was modified, added, or removed.
Methods
initMutationEvent
Initializes attributes of a MutationEvent object. This method has the same behavior as Event.initEvent().
Parameters
typeArg of type DOMString
Refer to the Event.initEvent() method for a description of this parameter.
canBubbleArg of type boolean
Refer to the Event.initEvent() method for a description of this parameter.
cancelableArg of type boolean
Refer to the Event.initEvent() method for a description of this parameter.
relatedNodeArg of type Node
Specifies MutationEvent.relatedNode.
prevValueArg of type DOMString
Specifies MutationEvent.prevValue. This value may be null.
newValueArg of type DOMString
Specifies 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 MutationEvent.attrChange. This value may be null.
No Return Value
No Exceptions
initMutationEventNS introduced in DOM Level 3
Initializes attributes of a MutationEvent object. This method has the same behavior as Event.initEventNS().
Parameters
namespaceURIArg of type DOMString
Refer to the Event.initEventNS() method for a description of this parameter.
typeArg of type DOMString
Refer to the Event.initEventNS() method for a description of this parameter.
canBubbleArg of type boolean
Refer to the Event.initEventNS() method for a description of this parameter.
cancelableArg of type boolean
Refer to the Event.initEventNS() method for a description of this parameter.
relatedNodeArg of type Node
Refer to the MutationEvent.initMutationEvent() method for a description of this parameter.
prevValueArg of type DOMString
Refer to the MutationEvent.initMutationEvent() method for a description of this parameter.
newValueArg of type DOMString
Refer to the MutationEvent.initMutationEvent() method for a description of this parameter.
attrNameArg of type DOMString
Refer to the MutationEvent.initMutationEvent() method for a description of this parameter.
attrChangeArg of type unsigned short
Refer to the MutationEvent.initMutationEvent() method for a description of this parameter.
No Return Value
No Exceptions

The mutation event types are listed below.

DOMSubtreeModified
TypeDOMSubtreeModified
NamespaceNone
InterfaceMutationEvent
CancelableNo
BubblesYes
TargetDocument, DocumentFragment, Element, Attr
Context infoNone
This is a general event for notification of all changes to the document. It can be used instead of the more specific mutation and mutation name events 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 shall be the lowest common parent of the changes which have taken place. This event shall be dispatched after any other events caused by the mutation(s) have occurred.
DOMNodeInserted
TypeDOMNodeInserted
NamespaceNone
InterfaceMutationEvent
CancelableNo
BubblesYes
TargetElement, Attr, Text, Comment, CDATASection, DocumentType, EntityReference, ProcessingInstruction
Context infoMutationEvent.relatedNode holds the parent node of the node that has been inserted or, in case of Attr nodes, the ownerElement of the Attr node.
A node has been added as a child of another node or, in case of Attr nodes, has been added to an Element. This event shall be dispatched after the insertion has taken place. The target node of this event shall be the node being inserted.
DOMNodeRemoved
TypeDOMNodeRemoved
NamespaceNone
InterfaceMutationEvent
CancelableNo
BubblesYes
TargetElement, Attr, Text, Comment, CDATASection, DocumentType, EntityReference, ProcessingInstruction
Context infoMutationEvent.relatedNode holds the parent node of the node being removed or, in case of Attr nodes, the ownerElement of the Attr node.
A node is being removed from its parent node or, in case of Attr nodes, removed from its ownerElement. This event shall be dispatched before the removal takes place. The target node of this event shall be the node being removed.
DOMNodeRemovedFromDocument
TypeDOMNodeRemovedFromDocument
NamespaceNone
InterfaceMutationEvent
CancelableNo
BubblesNo
TargetElement, Attr, Text, Comment, CDATASection, DocumentType, EntityReference, ProcessingInstruction
Context infoNone
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; Attr nodes are considered part of an Element's subtree. This event shall be dispatched before the removal takes place. The target node of this event type shall be the node being removed. If the node is being directly removed, the event type DOMNodeRemoved must occur before this event type.
DOMNodeInsertedIntoDocument
TypeDOMNodeInsertedIntoDocument
NamespaceNone
InterfaceMutationEvent
CancelableNo
BubblesNo
TargetElement, Attr, Text, Comment, CDATASection, DocumentType, EntityReference, ProcessingInstruction
Context infoNone
A node has been inserted into a document, either through direct insertion of the node or insertion of a subtree in which it is contained; Attr nodes are considered part of an Element's subtree. This event shall be dispatched after the insertion has taken place. The target node of this event shall be the node being inserted. If the node is being directly inserted, the event type DOMNodeInserted must occur before this event type.
DOMAttrModified
TypeDOMAttrModified
NamespaceNone
InterfaceMutationEvent
CancelableNo
BubblesYes
TargetElement
Context infoMutationEvent.attrName and MutationEvent.attrChange are in use. The value of MutationEvent.relatedNode indicates the Attr node that has been modified, added, or removed. If the Attr node has been added, MutationEvent.newValue shall be in use. If the Attr node has been removed, MutationEvent.prevValue shall be in use. If the Attr node has been modified, MutationEvent.newValue and MutationEvent.prevValue are in use.
Occurs after Attr.value has been modified and after an Attr node has been added to or removed from an Element. The target node of this event shall be the Element node where the change occurred. It is implementation dependent whether this event type occurs when the children of the Attr node are changed in ways that do not affect the value of Attr.value.
DOMCharacterDataModified
TypeDOMCharacterDataModified
NamespaceNone
InterfaceMutationEvent
CancelableNo
BubblesYes
TargetText, Comment, CDATASection, ProcessingInstruction
Context infoMutationEvent.prevValue, and MutationEvent.newValue are in use.
Occurs after CharacterData.data or ProcessingInstruction.data have been modified but the node itself has not been inserted or deleted. The target node of this event shall be the CharacterData node or the ProcessingInstruction node.

5.2.10 Mutation Name Event Types

This module defines the feature MutationNameEvents 3.0 and depends on the features MutationEvents 3.0 and Core 3.0.

Note: The MutationNameEvents interface, introduced in an earlier draft of this specification, derives from the MutationEvent interface, which is deprecated in this specification. Thus, this specification describes the mutation name event types for completeness, but deprecates their use.

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 MutationNameEvent : MutationEvent {
      readonly attribute DOMString       prevNamespaceURI;
      readonly attribute DOMString       prevNodeName;
      // Introduced in DOM Level 3:
      void               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               initMutationNameEventNS(in DOMString namespaceURIArg, 
                                                 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
Initializes attributes of a MutationNameEvent object. This method has the same behavior as MutationEvent.initMutationEvent().
Parameters
typeArg of type DOMString
Refer to the MutationEvent.initMutationEvent() method for a description of this parameter.
canBubbleArg of type boolean
Refer to the MutationEvent.initMutationEvent() method for a description of this parameter.
cancelableArg of type boolean
Refer to the MutationEvent.initMutationEvent() method for a description of this parameter.
relatedNodeArg of type Node
Refer to the MutationEvent.initMutationEvent() method for a description of this parameter.
prevNamespaceURIArg of type DOMString
Specifies MutationNameEvent.prevNamespaceURI. This value may be null.
prevNodeNameArg of type DOMString
Specifies MutationNameEvent.prevNodeName.
No Return Value
No Exceptions
initMutationNameEventNS introduced in DOM Level 3
Initializes attributes of a MutationNameEvent object. This method has the same behavior as MutationEvent.initMutationEventNS().
Parameters
namespaceURIArg of type DOMString
Refer to the MutationEvent.initMutationEventNS() method for a description of this parameter.
typeArg of type DOMString
Refer to the MutationEvent.initMutationEventNS() method for a description of this parameter.
canBubbleArg of type boolean
Refer to the MutationEvent.initMutationEventNS() method for a description of this parameter.
cancelableArg of type boolean
Refer to the MutationEvent.initMutationEventNS() method for a description of this parameter.
relatedNodeArg of type Node
Refer to the MutationEvent.initMutationEventNS() method for a description of this parameter.
prevNamespaceURIArg of type DOMString
Refer to the MutationEvent.initMutationEvent() method for a description of this parameter.
prevNodeNameArg of type DOMString
Refer to the MutationEvent.initMutationEvent() method for a description of this parameter.
No Return Value
No Exceptions

The mutation name event types are listed below.

DOMElementNameChanged
TypeDOMElementNameChanged
NamespaceNone
InterfaceMutationNameEvent
CancelableNo
BubblesYes
TargetElement
Context infoMutationNameEvent.prevNamespaceURI, and MutationNameEvent.prevNodeName are in use.
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 node of this event shall be the renamed Element node.
DOMAttributeNameChanged
TypeDOMAttributeNameChanged
NamespaceNone
InterfaceMutationNameEvent
CancelableNo
BubblesYes
TargetElement
Context infoMutationNameEvent.prevNamespaceURI, and MutationNameEvent.prevNodeName are in use. The value of MutationEvent.relatedNode contains the renamed Attr node.
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 node of this event shall be the Element node whose Attr has been renamed.

6. Keyboard events and key identifiers

This section contains necessary information regarding keyboard events:

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.

6.1 Keyboard Input

The relationship of each key to the complete keyboard has three separate aspects, each of which vary among different models and configurations of keyboards, particularly for locale-specific reasons:

This specification only defines the functional mapping, in terms of key identifiers. The visual marking has no bearing on the digital representation of the keys, and in many configurations may be completely inaccurate.

6.1.1 Keyboard Layout

As with the key labels, the physical layout of the keys on the keyboard does not not affect the digital identifier for any given key. It is outside the scope of this specification to provide key identifiers based on keyboard layout, particularly since there are so many possible layouts for a keyboard, and since users can change the mapping of keys in their operating system, e.g. selecting a Dvorak key mapping.

However, the physical layout of the keys may be of interest to authors developing games or other applications wherein the location of the keys has an ergonomic relationship as the desired user interface controls, with little or no attention paid to the representational value of the key itself. For example, many games may use the keys 'A', 'S', 'D', and 'W' for 'left', 'down', 'right', and 'up' respectively. Authors should provide a means for the user to assign the controller keys to a custom setting appropriate to their keyboard configurations.

6.1.1.1 Desktop and Laptop Keyboards

In the case where an author wishes to rely on the mechanical layout of a desktop or laptop keyboard, this specification suggests the keyboard configuration specified in ISO/IEC 9995-3-FCD:2009A [ISO-9995-3] as a common layout appropriate to some international uses.

Note: This keyboard layout is still, in essence, a QWERTY keyboard, and will not match the keyboards or configurations of many users. Authors cannot rely upon any particular configuration, and should create content in an internationalized and localizable manner.

A graphical depiction of an ISO standard defining layouts of computer keyboards, ISO/IEC 9995-3:2009A

Figure: A graphical depiction of an ISO standard defining layouts of computer keyboards, ISO/IEC 9995-3:2009A

6.1.1.2 Mobile Keypads

In the case where an author wishes to rely on the mechanical layout of a mobile keypad, this specification suggests the keyboard configuration specified in ISO/IEC 9995-8:2006 [ISO-9995-8] as a common layout appropriate to some international uses.

Note: This keypad layout, and in particular the distribution of letters is for Western devices, and will not match the keypads or configurations of many users. Authors cannot rely upon any particular configuration, and should create content in an internationalized and localizable manner.

A graphical depiction of an ISO standard defining layouts of numeric keypads, with distribution of letters on the keys, ISO/IEC 9995-8:2006

Figure: A graphical depiction of an ISO standard defining layouts of numeric keypads, with distribution of letters on the keys, ISO/IEC 9995-8:2006

6.2 Compositional Keyboard Input

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:

Key identifiers are strings used for uniquely addressing keyboard buttons, and intended for use in two primary scenarios: as attributes for a keyboard event; or as string values for markup attributes, such as so-called "hotkeys" (or keyboard shortcuts). As attributes on an event, the key identifier shall be a single canonical value. As author-generated content, the key identifier may be one of three equivalent string values, which all evaluate to the same key identifier; the string may be a character string (a single character, such as a letter or symbol), a key name (a multi-character string, such as enter or tab, for control or dead keys, or certain symbols), or a Unicode codepoint ("U+" followed by a hexadecimal character index). The event attribute must always be the most author-friendly of these, in the following order: character string, key name, or Unicode codepoint.

There are several use cases for keyboard events. The first use case is to retrieve the value of the key itself, in whichever mode that key currently represents (i.e. the value of a key as an upper- or lower-case letter, or a symbol or number, depending upon the current modifier keys, or as a key name); this may be used for monitoring particular input strings, or for modifier key input, or for author-generated virtual keyboards, and does not not depend upon the location of the key in the physical layout of the device, which may be mapped to different configurations based on user or system preference. The second use case is for keyboard shortcuts, where the string itself may be of secondary importance, and where they key used should default to the most appropriate key for the function, language, operating system, device, and other environmental factors (such as ctrl+c for copy operations). The final use case is completely independent of the value of the key identifier, and relies solely on the physical layout of the input device itself (such as for game controls); this is highly variable device-dependent functionality, and is not within the scope of this specification. Implementations should provide an option for users to establish their own preferential mapping for keyboard layout, and may rely upon ISO 9995-3, which defines a common layout for primary and secondary key mappings on a typical alphanumeric keyboard, or on ISO 9995-8, which defines a numeric keypad layout and secondary assignment of Unicode characters in the range U+0061..U+007A to the number keys 2 through 9.

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" ([DWW95]) given that most keyboard layouts will provide keys for those.

'U+0000', 'U+0001', ..., 'U+10FFFF' are Unicode based key identifiers ([Unicode]). When a key cannot be mapped to Unicode, a specific identifier shall be used (see also 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 Guidelines for defining key identifiers, the 'Q' key shall be mapped to the Latin Capital Letter Q key).

The keystroke 'U+0051' (Latin Capital Letter Q key) must 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. "keydown": 'U+0051' (Latin Capital Letter Q key)
  2. "textInput": 'q'
  3. "keyup": 'U+0051'

If the keyboard layout mapping is switched to a french mapping, pressing the same key must produce:

  1. "keydown": 'U+0041' (Latin Capital Letter A key)
  2. "textInput": 'a'
  3. "keyup": 'U+0041'

If the keyboard layout mapping is switched to a serbian (cyrillic) mapping, pressing the same key must produce:

  1. "keydown": 'U+0409' (Cyrillic Capital Letter LJE)
  2. "textInput": 'љ'
  3. "keyup": 'U+0409'

Note: The order between the text event and keyboard events may differ depending on the keyboard devices.

6.2.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 KeyboardEvent interface provides convenient attributes for some common modifiers keys: KeyboardEvent.ctrlKey, KeyboardEvent.shiftKey, KeyboardEvent.altKey, 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. "keydown": 'Shift', shiftKey
  2. "keydown": 'U+0051' (Latin Capital Letter Q key), shiftKey
  3. "textInput": 'Q'
  4. "keyup": 'U+0051', shiftKey
  5. "keyup": 'Shift'

The following example describes a possible sequence of keys that does not generate a Unicode character (using the same configuration):

  1. "keydown": 'Control', ctrlKey
  2. "keydown": 'U+0056' (Latin Capital Letter V key), ctrlKey
  3. "keyup": 'U+0056', ctrlKey
  4. "keyup": 'Control'

In some cases, modifier keys change the key identifier value for a key event. For example, on some MacOS keyboards, the key labeled 'delete' functions the same as the 'Backspace' key on the Windows OS when unmodified, but when modified by the 'Fn' key, acts as the 'Del' key, and the value of the key identifier must match the most appropriate function of the key in its current modified state.

6.2.2 Dead keys

Some 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. (NOTE: the MacOS and Linux operating systems use input methods to process dead keys.)

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. "keydown": 'U+0302' (Combining Circumflex Accent key)
  2. "compositionstart": ''
  3. "compositionupdate": '' @@ (value undefined - to be discussed)
  4. "keyup": 'U+0302'
  5. "keydown": 'U+0045' (Latin Capital Letter E key)
  6. "compositionend": 'é' @@ should compositionend come before or after textInput
  7. "textInput": 'é' ("inputMode": 'DOM_INPUT_METHOD_IME')
  8. "keyup": 'U+0045'

This process may be aborted when a user types an unsupported base character (that is, a base character for which the which the active diacritical mark is not available) after pressing a dead key:

  1. "keydown": 'U+0302' (Combining Circumflex Accent key)
  2. "compositionstart": ''
  3. "compositionupdate": '' @@ (undefined - to be discussed)
  4. "keyup": 'U+0302'
  5. "keydown": 'U+0051' (Latin Capital Letter Q key)
  6. "compositionend": ''
  7. "textInput": 'q' ("inputMode": 'DOM_INPUT_METHOD_KEYBOARD')
  8. "keyup": 'U+0051'

6.2.3 Input Method Editors

This specification includes a model for input method editors (IMEs), through the CompositionEvent interface and events. However, composition events and keyboard events do not necessarily map as a one-to-one relationship. 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, but indicates only that a keystroke happened, disconnected from the IME Accept functionality (which would normally result in a "compositionend" event in most IME systems). Keyboard events cannot be used to determine the current state of the input method editor, which should be obtained through the data attribute of the CompositionEvent interface. Additionally, IME systems and devices vary in their functionality, and in which keys are used for activating that functionality, such that the 'Convert' and 'Accept' keys may be represented by other available keys.

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. "keydown": 'U+0053' (Latin Capital Letter S key)
  2. "compositionstart": ''
  3. "keyup": 'U+0053' (Latin Capital Letter S key)
  4. "keydown": 'U+0049' (Latin Capital Letter I key)
  5. "keyup": 'U+0049' (Latin Capital Letter I key)
  6. "keydown": 'Convert'
  7. "compositionupdate": '詩'
  8. "keyup": 'Convert'
  9. "keydown": 'Convert'
  10. "compositionupdate": '市'
  11. "keyup": 'Convert'
  12. "keydown": 'Accept'
  13. "compositionend": '市'
  14. "textInput": '市' ("inputMode": 'DOM_INPUT_METHOD_IME')
  15. "keyup": 'Accept'

IME composition may also be canceled as in the following example, with conditions identical to the previous example. The key "Cancel" may also be replaced by others depending on the input device in use and the configuration of the IME, e.g. it could be "U+001B" (Escape key).

  1. "keydown": 'U+0053' (Latin Capital Letter S key)
  2. "compositionstart": ''
  3. "keyup": 'U+0053' (Latin Capital Letter S key)
  4. "keydown": 'U+0049' (Latin Capital Letter I key)
  5. "keyup": 'U+0049' (Latin Capital Letter I key)
  6. "keydown": 'Convert'
  7. "compositionupdate": '詩'
  8. "keyup": 'Convert'
  9. "keydown": 'Convert'
  10. "compositionupdate": '市'
  11. "keyup": 'Convert'
  12. "keydown": 'Cancel'
  13. "compositionupdate": ''
  14. "compositionend": ''
  15. "keyup": 'Cancel'

NOTE: Some input method editors (such as on the MacOS operating system) may set an empty string to the composition data attribute before canceling a composition.

6.2.3.1 Input Method Editor mode keys

Some keys on certain devices are intended to activate input method editor functionality, or to change the mode of an active input method editor. Custom keys for this purpose may be defined for different devices or language modes; the keys defined in this specification for this purpose are: Alphanumeric, CodeInput, FinalMode, HangulMode, HanjaMode, Hiragana, JapaneseHiragana, JapaneseKatakana, JapaneseRomaji, JunjaMode, KanaMode, KanjiMode, Katakana, and RomanCharacters. When one of these keys is pressed, and no IME is currently active, the appropriate IME, shall be activated in the mode indicated by the key (if available); if an IME is already active when the key is pressed, the active IME may change to the indicated mode, or a different IME may be launched, or the key may be ignored, on a device- and application-specific basis.

This specification also defines other keys which are intended for operation specifically with input method editors: Accept, AllCandidates, Cancel, Convert, Compose, FullWidth, HalfWidth, NextCandidate, Nonconvert, and PreviousCandidate. The functions of these keys are not defined in this specification; refer to other resources for details on input method editor functionality.

Note that keys with input method editor functions are note restricted to that purpose, and may have other device- or implementation-specific purposes, as well.

6.2.4 Default actions and cancelable keyboard events

Canceling the default action of a keydown event does not affect its respective keyup event; it must however prevent the respective textInput event from being generated. 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. "keydown": 'U+0051' (Latin Capital Letter Q key), shiftKey
    the default action of the keydown event is prevented, e.g. by invoking Event.preventDefault() during the dispatch of the keydown event object.
  2. No "textInput" shall be generated.
  3. "keyup": 'U+0051', shiftKey

If the key is a modifier key, the keystroke shall be taken into account for the modifiers states. 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. "keydown": 'Shift', shiftKey
    the default action of the keydown event shall be prevented.
  2. "keydown": 'U+0051' (Latin Capital Letter Q key), shiftKey
  3. "textInput": 'Q'
  4. "keyup": 'U+0051', shiftKey
  5. "keyup": 'Shift'

If the key is part of a sequence of several keystrokes, whether it is a dead key or it is contributing to an Input Method Editor sequence, the keystroke shall be ignored (not taken into account) only if the default action is canceled on the keydown event. Canceling a dead key on a keyup event has not effect on textInput events. The following example uses the keystrokes 'U+0302' (Combining Circumflex Accent key) and 'U+0045' (Latin Capital Letter E key) (on a PC/AT french keyboard using a french mapping and without any modifier activated):

  1. "keydown": 'U+0302' (Combining Circumflex Accent key)
    the default action of the keydown event shall be prevented
  2. "keyup": 'U+0302'
  3. "keydown": 'U+0045' (Latin Capital Letter E key)
  4. "textInput": 'a'
  5. "keyup": 'U+0045'

6.3 Key Identifiers

6.3.1 Guidelines for defining key identifiers

Note: This section is normative.

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. Consider the primary function of the key (i.e., without modifiers), taking into consideration the keyboard layout mapping in use, to determine if a corresponding Unicode character exists from which a key identifier may be derived. If multiple Unicode characters exist which correspond to the primary function of the key, the Unicode character with the lowest codepoint must be used.
    1. If the primary function of the key is to generate a character, and that character is in one of the Unicode character categories, then the key identifier shall be a string consisting of just that character. If the primary function of the key is to generate a character in class Ll for which there exists an equivalent, single character in class Lu, the uppercase character should be used instead.
      Is this necessary? Why can't we simply allow lowercase letters as well? If a script author wishes to do a comparison, they can cast the output to upper or lower case as needed. See ISSUE-23.
    2. If the primary function of the key is to generate a character that is not in one of the above general categories, or if the primary function of the key is a function for which there exists a corresponding Unicode character that is not in one of the above general categories, then:
      1. If there exists an appropriate key identifier in the key identifiers set, and that key identifier does not have a Unicode codepoint, that key identifier must be used.
      2. If there exists an appropriate key identifier in the key identifiers set, and that key identifier has a Unicode codepoint, and that key identifier is in one of the Unicode character categories, then the character value itself for that key identifier must be used.
      3. If there is no appropriate key identifier in the key identifiers set, then the key identifier is a string beginning with "U+" and followed by the Unicode codepoint of the character in hexadecimal, using at least four digits. Leading zeroes must be omitted unless they are required to make the codepoint use at least four digits.
  2. For keys with no corresponding Unicode character, a key identifier can be devised. The key identifier should be as human friendly as possible and must not contain whitespace. The identifier must be composed only of characters in the ranges U+0030..U+0039, U+0041..U+005A, or U+0061..U+007A, and must begin with a character in the range U+0041..U+005A.
    Why should we not allow names in other ranges (Chinese, for example)?

Examples:

Future versions of this specification may include key identifiers not included here, which have become common since the publication of this specification.

6.3.2 Key Identifiers Set

Note: The keycodes 'NumPad0', 'NumPad1', 'NumPad2', 'NumPad3', 'NumPad4', 'NumPad5', 'NumPad6', 'NumPad7', 'NumPad8', and 'NumPad9' are not part of this set. Use KeyboardEvent.keyLocation to know if a key originated from the numeric keypad.

'Accept'
The Accept (Commit, OK) key.
'Add'
The Add 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.
'Decimal'
The Decimal key.
'Divide'
The Divide key.
'Down'
The Down Arrow key.
'DownLeft'
The diagonal Down-Left Arrow key.
'DownRight'
The diagonal Down-Right Arrow key.
'End'
The End key.
'Enter'
The Enter key. Note: This key identifier shall be also used for the Return (Macintosh numpad) key.
'EraseEof'
The Erase EOF key.
'Execute'
The Execute key.
'Exsel'
The Exsel key.
'Fn'
The Function switch 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.
'Menu'
The Menu 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 Stop key.
'ModeChange'
The Mode Change key.
'Multiply'
The Multiply key.
'NextCandidate'
The Next Candidate function key.
'Nonconvert'
The Nonconvert (Don't Convert) key.
'NumLock'
The Number 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.
'Separator'
The Separator key.
'Shift'
The Shift key.
'Soft1'
The Soft1 key.
'Soft2'
The Soft2 key.
'Soft3'
The Soft3 key.
'Soft4'
The Soft4 key.
'Stop'
The Stop key.
'Subtract'
The Subtract key.
'Up'
The Up Arrow key.
'UpLeft'
The diagonal Up-Left Arrow key.
'UpRight'
The diagonal Up-Right 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.
'Backspace'
'U+0008'
The Backspace (Back) key. Note: This key identifier shall be also used for the key labeled 'delete' MacOS keyboards when not modified by the 'Fn' key.
'Tab'
'U+0009'
The Horizontal Tabulation (Tab) key.
'Cancel'
'U+0018'
The Cancel key.
'Esc'
'U+001B'
The Escape (Esc) key.
'Spacebar'
'U+0020'
The Space (Spacebar) key.
'!'
'Exclamation'
'U+0021'
The Exclamation Mark (Factorial, Bang) key (!).
'DoubleQuote'
'U+0022'
The Quotation Mark (Quote Double) key (").
'#'
'Hash'
'U+0023'
The Number Sign (Pound Sign, Hash, Crosshatch, Octothorpe) key (#).
'$'
'Dollar'
'U+0024'
The Dollar Sign (milreis, escudo) key ($).
'&'
'Ampersand'
'U+0026'
The Ampersand key (&).
'Apostrophe'
'U+0027'
The Apostrophe (Apostrophe-Quote, APL Quote) key (').
'('
'LeftParen'
'U+0028'
The Left Parenthesis (Opening Parenthesis) key (().
')'
'RightParen'
'U+0029'
The Right Parenthesis (Closing Parenthesis) key ()).
'*'
'Asterisk'
'U+002A'
The Asterisk (Star) key (*).
'+'
'Plus'
'U+002B'
The Plus Sign (Plus) key (+).
'%'
'Percent'
'U+0025'
The Percent Sign (Percent) key (+).
','
'Comma'
'U+002C'
The Comma (decimal separator) sign key (,).
'-'
'HyphenMinus'
'U+002D'
The Hyphen-minus (hyphen or minus sign) key (-).
'.'
'Period'
'U+002E'
The Full Stop (period, dot, decimal point) key (.).
'/'
'Solidus'
'U+002F'
The Solidus (slash, virgule, shilling) key (/).
'0'
'U+0030'
The Digit Zero key (0).
'1'
'U+0031'
The Digit One key (1).
'2'
'U+0032'
The Digit Two key (2).
'3'
'U+0033'
The Digit Three key (3).
'4'
'U+0034'
The Digit Four key (4).
'5'
'U+0035'
The Digit Five key (5).
'6'
'U+0036'
The Digit Six key (6).
'7'
'U+0037'
The Digit Seven key (7).
'8'
'U+0038'
The Digit Eight key (8).
'9'
'U+0039'
The Digit Nine key (9).
':'
'Colon'
'U+003A'
The Colon key (:).
';'
'Semicolon'
'U+003B'
The Semicolon key (;).
'LessThan'
'U+003C'
The Less-Than Sign key (<).
'='
'Equals'
'U+003D'
The Equals Sign key (=).
'GreaterThan'
'U+003E'
The Greater-Than Sign key (>).
'?'
'QuestionMark'
'U+003F'
The Question Mark key (?).
'@'
'At'
'U+0040'
The Commercial At (@) key.
'A'
'U+0041'
The Latin Capital Letter A key (A).
'B'
'U+0042'
The Latin Capital Letter B key (B).
'C'
'U+0043'
The Latin Capital Letter C key (C).
'D'
'U+0044'
The Latin Capital Letter D key (D).
'E'
'U+0045'
The Latin Capital Letter E key (E).
'F'
'U+0046'
The Latin Capital Letter F key (F).
'G'
'U+0047'
The Latin Capital Letter G key (G).
'H'
'U+0048'
The Latin Capital Letter H key (H).
'I'
'U+0049'
The Latin Capital Letter I key (I).
'J'
'U+004A'
The Latin Capital Letter J key (J).
'K'
'U+004B'
The Latin Capital Letter K key (K).
'L'
'U+004C'
The Latin Capital Letter L key (L).
'M'
'U+004D'
The Latin Capital Letter M key (M).
'N'
'U+004E'
The Latin Capital Letter N key (N).
'O'
'U+004F'
The Latin Capital Letter O key (O).
'P'
'U+0050'
The Latin Capital Letter P key (P).
'Q'
'U+0051'
The Latin Capital Letter Q key (Q).
'R'
'U+0052'
The Latin Capital Letter R key (R).
'S'
'U+0053'
The Latin Capital Letter S key (S).
'T'
'U+0054'
The Latin Capital Letter T key (T).
'U'
'U+0055'
The Latin Capital Letter U key (U).
'V'
'U+0056'
The Latin Capital Letter V key (V).
'W'
'U+0057'
The Latin Capital Letter W key (W).
'X'
'U+0058'
The Latin Capital Letter X key (X).
'Y'
'U+0059'
The Latin Capital Letter Y key (Y).
'Z'
'U+005A'
The Latin Capital Letter Z key (Z).
'['
'LeftSquareBracket'
'U+005B'
The Left Square Bracket (Opening Square Bracket) key ([).
'\'
'Backslash'
'U+005C'
The Reverse Solidus (Backslash) key (\).
']'
'RightSquareBracket'
'U+005D'
The Right Square Bracket (Closing Square Bracket) key (]).
'^'
'Circumflex'
'U+005E'
The Circumflex Accent key (^).
'_'
'Underscore'
'U+005F'
The Low Sign (Spacing Underscore, Underscore) key (_).
'`'
'Grave'
'U+0060'
The Grave Accent (Back Quote) key (`).
'{'
'LeftCurlyBracket'
'U+007B'
The Left Curly Bracket (Opening Curly Bracket, Opening Brace, Brace Left) key ({).
'|'
'Pipe'
'U+007C'
The Vertical Line (Vertical Bar, Pipe) key (|).
'}'
'RightCurlyBracket'
'U+007D'
The Right Curly Bracket (Closing Curly Bracket, Closing Brace, Brace Right) key (}).
'Del'
'U+007F'
The Delete (Del) Key. Note: This key identifier shall be also used for the key labeled 'delete' MacOS keyboards when modified by the 'Fn' key.
'¡'
'InvertedExclamation'
'U+00A1'
The Inverted Exclamation Mark key (¡).
'DeadGrave'
'U+0300'
The Combining Grave Accent (Greek Varia, Dead Grave) key.
'DeadEacute'
'U+0301'
The Combining Acute Accent (Stress Mark, Greek Oxia, Tonos, Dead Eacute) key.
'DeadCircumflex'
'U+0302'
The Combining Circumflex Accent (Hat, Dead Circumflex) key.
'DeadTilde'
'U+0303'
The Combining Tilde (Dead Tilde) key.
'DeadMacron'
'U+0304'
The Combining Macron (Long, Dead Macron) key.
'DeadBreve'
'U+0306'
The Combining Breve (Short, Dead Breve) key.
'DeadAboveDot'
'U+0307'
The Combining Dot Above (Derivative, Dead Above Dot) key.
'DeadUmlaut'
'U+0308'
The Combining Diaeresis (Double Dot Abode, Umlaut, Greek Dialytika, Double Derivative, Dead Diaeresis) key.
'DeadAboveRing'
'U+030A'
The Combining Ring Above (Dead Above Ring) key.
'DeadDoubleacute'
'U+030B'
The Combining Double Acute Accent (Dead Doubleacute) key.
'DeadCaron'
'U+030C'
The Combining Caron (Hacek, V Above, Dead Caron) key.
'DeadCedilla'
'U+0327'
The Combining Cedilla (Dead Cedilla) key.
'DeadOgonek'
'U+0328'
The Combining Ogonek (Nasal Hook, Dead Ogonek) key.
'DeadIota'
'U+0345'
The Combining Greek Ypogegrammeni (Greek Non-Spacing Iota Below, Iota Subscript, Dead Iota) key.
'€'
'Euro'
'U+20AC'
The Euro Currency Sign key (€).
'DeadVoicedSound'
'U+3099'
The Combining Katakana-Hiragana Voiced Sound Mark (Dead Voiced Sound) key.
'DeadSemivoicedSound'
'U+309A'
The Combining Katakana-Hiragana Semi-Voiced Sound Mark (Dead Semivoiced Sound) key.

6.3.3 Key identifiers, keyCode, and charCode

Note: This section is non-normative.

Browser support for keyboards has traditionally relied on two ad-hoc attributes, keyCode, and charCode. The values for these attributes, and the availability of the attribute, is inconsistent across platforms, keyboard languages and layouts, User Agents, versions, and even event types. A significant amount of legacy content, including script libraries, relies upon detecting the User Agent and acting accordingly, and any changes to keyCode, or charCode risk breaking as much content as they fix or enable. Additionally, these attributes are not suitable for international usage, or accessibility concerns. Therefore, this specification does not normatively define the keyCode, and charCode attributes, relying instead only on the more robust key identifiers, which can be used safely and consistently in any User Agent which conforms to this specification. However, for the purpose of documenting the current state of these attributes and their relation to equivalent key identifiers, this specification contains the following table, which is to be used as an informative reference only, and does not document the full range of values for keyCode, and charCode.

Key Identifiers Set with keyCode and charCode Equivalents for Major Browsers
(keycode labeled key, charcode labeled char)
Character String Key Name Unicode Codepoint Description Internet Explorer 7 Firefox 3 Safari 3.1 Opera 9.5
keydown keypress keyup keydown keypress keyup keydown keypress keyup keydown keypress keyup
keycharkeycharkeycharkeycharkeycharkeycharkeycharkeycharkeycharkeycharkeycharkeychar
'Accept' The Accept (Commit, OK) key.
'Add' The Add key.107-107-107-107-0107107-107-107107107-107-107-107-
'Again' The Again key.
'AllCandidates' The All Candidates key.
'Alphanumeric' The Alphanumeric key.
'Alt' The Alt (Menu) key.18---18-18---18-18---18-18-18---
'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.36---36-36-36-36-36---36-36-36-36-
'BrowserRefresh' The Browser Refresh key.
'BrowserSearch' The Browser Search key.
'BrowserStop' The Browser Stop key.
'CapsLock' The Caps Lock (Capital) key.20---20-20---20-20---20-20---20-
'Clear' The Clear key.
'CodeInput' The Code Input key.
'Compose' The Compose key.
'Control' The Control (Ctrl) key.17---17-17---17-17---17-17-17-17-
'Crsel' The Crsel key.
'Convert' The Convert key.
'Copy' The Copy key.
'Cut' The Cut key.
'Decimal' The Decimal key.110-110-110-110-0110110-110-110110110-110-110-110-
'Divide' The Divide key.111-111-111-111-0111111-111-111111111-111-111-111-
'Down' The Down Arrow key.
'DownLeft' The diagonal Down-Left Arrow key.
'DownRight' The diagonal Down-Right Arrow key.
'End' The End key.35---35-35-35-35-35---35-35-35-35-
'Enter' The Enter key. Note: This key identifier shall be also used for the Return (Macintosh numpad) key.13-13-13-13-13-13-13-131313-13-13-13-
'EraseEof' The Erase EOF key.
'Execute' The Execute key.
'Exsel' The Exsel key.
'Fn' The Function switch key.------------------------
'F1' The F1 key.112---112-112-112-112-112---112-112-112-112-
'F2' The F2 key.113---113-113-113-113-113---113-113-113-113-
'F3' The F3 key.114---114-114-114-114-114---114-114-114-114-
'F4' The F4 key.115---115-115-115-115-115---115-115-115-115-
'F5' The F5 key.116---116-116-116-116-116---116-116-116-116-
'F6' The F6 key.117---117-117-117-117-117---117-117-117-117-
'F7' The F7 key.118---118-118-118-118-118---118-118-118-118-
'F8' The F8 key.119---119-119-119-119-119---119-119-119-119-
'F9' The F9 key.120---120-120-120-120-120---120-120-120-120-
'F10' The F10 key.121---121-121-121-121-121---121-121-121-121-
'F11' The F11 key.122---122-122-122-122-122---122-122-122-122-
'F12' The F12 key.123---123-123-123-123-123---123-123-123-123-
'F13' The F13 key.124---124-124-124-124-124---124-124-124-124-
'F14' The F14 key.125---125-125-125-125-125---125-125-125-125-
'F15' The F15 key.126---126-126-126-126-126---126-126-126-126-
'F16' The F16 key.127---127-127-127-127-127---127-127-127-127-
'F17' The F17 key.128---128-128-128-128-128---128-128-128-128-
'F18' The F18 key.129---129-129-129-129-129---129-129-129-129-
'F19' The F19 key.130---130-130-130-130-130---130-130-130-130-
'F20' The F20 key.131---131-131-131-131-131---131-131-131-131-
'F21' The F21 key.132---132-132-132-132-132---132-132-132-132-
'F22' The F22 key.133---133-133-133-133-133---133-133-133-133-
'F23' The F23 key.134---134-134-134-134-134---134-134-134-134-
'F24' The F24 key.135---135-135-135-135-135---135-135-135-135-
'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.45---45-45-45-45-45---45-45-45-45-
'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.
'Menu' The Menu 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 Stop key.
'ModeChange' The Mode Change key.
'Multiply' The Multiply key.106-106-106-106-0106106-106-106106106-106-106-106-
'NextCandidate' The Next Candidate function key.
'Nonconvert' The Nonconvert (Don't Convert) key.
'NumLock' The Number Lock key.
'PageDown' The Page Down (Next) key.
'PageUp' The Page Up key.33---33-33-33-33-33---33-33-33-33-
'Paste' The Paste key.
'Pause' The Pause key.19---19-19-19-19-19---19-19-19-19-
'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.
'Separator' The Separator key.108-108-108-108-0108108-108-108108108-108-108-108-
'Shift' The Shift key.17---17-17---17-17---17-17-17-17-
'Soft1' The Soft1 key.
'Soft2' The Soft2 key.
'Soft3' The Soft3 key.
'Soft4' The Soft4 key.
'Stop' The Stop key.
'Subtract' The Subtract key.109-109-109-109-0109109-109-109109109-109-109-109-
'Up' The Up Arrow key.
'UpLeft' The diagonal Up-Left Arrow key.
'UpRight' The diagonal Up-Right 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.
'Backspace' 'U+0008' The Backspace (Back) key.8---8-8-8-8-8---8-8-8-8-
'Tab' 'U+0009' The Horizontal Tabulation (Tab) key.9-----9-9---9-----9-9---
'Cancel' 'U+0018' The Cancel key.
'Esc' 'U+001B' The Escape (Esc) key.27-27-27-27-27-27-27---27-27-27-27-
'Spacebar' 'U+0020' The Space (Spacebar) key.32-32-32-32-03232-32-323232-32-32-32-
'!' 'Exclamation' 'U+0021' The Exclamation Mark (Factorial, Bang) key.49-33-49-49-03349-49-333349-49-33-49-
" 'DoubleQuote' 'U+0022' The Quotation Mark (Quote Double) key. Note: May need to be escaped as an attribute value.50-34-50-50-03450-50-343450-50-34-50-
'#' 'Hash' 'U+0023' The Number Sign (Pound Sign, Hash, Crosshatch, Octothorpe) key.51-35-51-51-03551-51-353551-51-35-51-
'$' 'Dollar' 'U+0024' The Dollar Sign (milreis, escudo) key.52-36-52-52-03652-52-363652-52-36-52-
'&' 'Ampersand' 'U+0026' The Ampersand key.54-38-54-54-03854-54-383854-54-38-54-
' 'Apostrophe' 'U+0027' The Apostrophe (Apostrophe-Quote, APL Quote) key. Note: May need to be escaped as an attribute value.191-39-191-191-039191-191-3939191-222-39-222-
'(' 'LeftParen' 'U+0028' The Left Parenthesis (Opening Parenthesis) key.56-40-56-56-04056-56-404056-56-40-56-
')' 'RightParen' 'U+0029' The Right Parenthesis (Closing Parenthesis) key.57-41-57-57-04157-57-414157-57-41-57-
'*' 'Asterisk' 'U+002A' The Asterisk (Star) key (in number pad).106-42-106-106-042106-106-4242106-42-42-42-
'+' 'Plus' 'U+002B' The Plus Sign (Plus) key.
'+' 'Percent' 'U+0025' The Percent key.53-37-53-53-03753-53-373753-53-37-53-
',' 'Comma' 'U+002C' The Comma (decimal separator) sign key.188-44-188-188-044188-188-4444188-188-44-188-
'-' 'HyphenMinus' 'U+002D' The Hyphen-minus (hyphen or minus sign) key.
'.' 'Period' 'U+002E' The Full Stop (period, dot, decimal point) key.190-46-190-190-046190-190-4646190-190-46-190-
'/' 'Solidus' 'U+002F' The Solidus (slash, virgule, shilling) key.55-47-55-55-04755-55-474755-55-47-55-
'0' 'U+0030' The Digit Zero key.48484848484848-04848-48-484848-48-48-48-
'1' 'U+0031' The Digit One key.49494949494949-04949-49-494949-49-49-49-
'2' 'U+0032' The Digit Two key.50505050505050-05050-50-505050-50-50-50-
'3' 'U+0033' The Digit Three key.51515151515151-05151-51-515151-51-51-51-
'4' 'U+0034' The Digit Four key.52525252525252-05252-52-525252-52-52-52-
'5' 'U+0035' The Digit Five key.53535353535353-05353-53-535353-53-53-53-
'6' 'U+0036' The Digit Six key.54545454545454-05454-54-545454-54-54-54-
'7' 'U+0037' The Digit Seven key.55555555555555-05555-55-555555-55-55-55-
'8' 'U+0038' The Digit Eight key.56565656565656-05656-56-565656-56-56-56-
'9' 'U+0039' The Digit Nine key.57575757575757-05757-57-575757-57-57-57-
':' 'Colon' 'U+003A' The Colon key.190-58-190-190-058190-190-5858190-190-58-190-
';' 'Semicolon' 'U+003B' The Semicolon key.188-59-188-188-059188-188-5959188-188-59-188-
'<' 'LessThan' 'U+003C' The Less-Than Sign key (<).188-60-188-188-060188-188-6060188-188-60-188-
'=' 'Equals' 'U+003D' The Equals Sign key.48-61-48-48-06148-48-616148-48-61-48-
'>' 'GreaterThan' 'U+003E' The Greater-Than Sign key (>).226-62-226-226-062226-226-6262226-188-62-188-
'?' 'QuestionMark' 'U+003F' The Question Mark key.191-63-191-107-063107-191-6363191-61-63-61-
'@' 'At' 'U+0040' The Commercial At key.50-64-50-50-06450-50-646450-50-64-50-
'A' 'U+0041' The Latin Capital Letter A key.65656565656565-06565-65-656565-65-65-65-
'B' 'U+0042' The Latin Capital Letter B key.66666666666666-06666-66-666666-66-66-66-
'C' 'U+0043' The Latin Capital Letter C key.67676767676767-06767-67-676767-67-67-67-
'D' 'U+0044' The Latin Capital Letter D key.68686868686868-06868-68-686868-68-68-68-
'E' 'U+0045' The Latin Capital Letter E key.69696969696969-06969-69-696969-69-69-69-
'F' 'U+0046' The Latin Capital Letter F key.70707070707070-07070-70-707070-70-70-70-
'G' 'U+0047' The Latin Capital Letter G key.71717171717171-07171-71-717171-71-71-71-
'H' 'U+0048' The Latin Capital Letter H key.72727272727272-07272-72-727272-72-72-72-
'I' 'U+0049' The Latin Capital Letter I key.73737373737373-07373-73-737373-73-73-73-
'J' 'U+004A' The Latin Capital Letter J key.74747474747474-07474-74-747474-74-74-74-
'K' 'U+004B' The Latin Capital Letter K key.75757575757575-07575-75-757575-75-75-75-
'L' 'U+004C' The Latin Capital Letter L key.76767676767676-07676-76-767676-76-76-76-
'M' 'U+004D' The Latin Capital Letter M key.77777777777777-07777-77-777777-77-77-77-
'N' 'U+004E' The Latin Capital Letter N key.78787878787878-07878-78-787878-78-78-78-
'O' 'U+004F' The Latin Capital Letter O key.79797979797979-07979-79-797979-79-79-79-
'P' 'U+0050' The Latin Capital Letter P key.80808080808080-08080-80-808080-80-80-80-
'Q' 'U+0051' The Latin Capital Letter Q key.81818181818181-08181-81-818181-81-81-81-
'R' 'U+0052' The Latin Capital Letter R key.82828282828282-08282-82-828282-82-82-82-
'S' 'U+0053' The Latin Capital Letter S key.83838383838383-08383-83-838383-83-83-83-
'T' 'U+0054' The Latin Capital Letter T key.84848484848484-08484-84-848484-84-84-84-
'U' 'U+0055' The Latin Capital Letter U key.85858585858585-08585-85-858585-85-85-85-
'V' 'U+0056' The Latin Capital Letter V key.86868686868686-08686-86-868686-86-86-86-
'W' 'U+0057' The Latin Capital Letter W key.87878787878787-08787-87-878787-87-87-87-
'X' 'U+0058' The Latin Capital Letter X key.88888888888888-08888-88-888888-88-88-88-
'Y' 'U+0059' The Latin Capital Letter Y key.89898989898989-08989-89-898989-89-89-89-
'Z' 'U+005A' The Latin Capital Letter Z key.90909090909090-09090-90-909090-90-90-90-
'a' 'U+0061' The Latin Miniscule Letter a key.65656565656565-09765-65-979765-65-97-65-
'b' 'U+0062' The Latin Miniscule Letter b key.66666666666666-09866-66-989866-66-98-66-
'c' 'U+0063' The Latin Miniscule Letter c key.67676767676767-09967-67-999967-67-99-67-
'd' 'U+0064' The Latin Miniscule Letter d key.68686868686868-010068-68-10010068-68-100-68-
'e' 'U+0065' The Latin Miniscule Letter e key.69696969696969-010169-69-10110169-69-101-69-
'f' 'U+0066' The Latin Miniscule Letter f key.70707070707070-010270-70-10210270-70-102-70-
'g' 'U+0067' The Latin Miniscule Letter g key.71717171717171-010371-71-10310371-71-103-71-
'h' 'U+0068' The Latin Miniscule Letter h key.72727272727272-010472-72-10410472-72-104-72-
'i' 'U+0069' The Latin Miniscule Letter i key.73737373737373-010573-73-10510573-73-105-73-
'j' 'U+006A' The Latin Miniscule Letter j key.74747474747474-010674-74-10610674-74-106-74-
'k' 'U+006B' The Latin Miniscule Letter k key.75757575757575-010775-75-10710775-75-107-75-
'l' 'U+006C' The Latin Miniscule Letter l key.76767676767676-010876-76-10810876-76-108-76-
'm' 'U+006D' The Latin Miniscule Letter m key.77777777777777-010977-77-10910977-77-109-77-
'n' 'U+006E' The Latin Miniscule Letter n key.78787878787878-011078-78-11011078-78-110-78-
'o' 'U+006F' The Latin Miniscule Letter o key.79797979797979-011179-79-11111179-79-111-79-
'p' 'U+0070' The Latin Miniscule Letter p key.80808080808080-011280-80-11211280-80-112-80-
'q' 'U+0071' The Latin Miniscule Letter q key.81818181818181-011381-81-11311381-81-113-81-
'r' 'U+0072' The Latin Miniscule Letter r key.82828282828282-011482-82-11411482-82-114-82-
's' 'U+0073' The Latin Miniscule Letter s key.83838383838383-011583-83-11511583-83-115-83-
't' 'U+0074' The Latin Miniscule Letter t key.84848484848484-011684-84-11611684-84-116-84-
'u' 'U+0075' The Latin Miniscule Letter u key.85858585858585-011785-85-11711785-85-117-85-
'v' 'U+0076' The Latin Miniscule Letter v key.86868686868686-011886-86-11811886-86-118-86-
'w' 'U+0077' The Latin Miniscule Letter w key.87878787878787-011987-87-11911987-87-119-87-
'x' 'U+0078' The Latin Miniscule Letter x key.88888888888888-012088-88-12012088-88-120-88-
'y' 'U+0079' The Latin Miniscule Letter y key.89898989898989-012189-89-12112189-89-121-89-
'z' 'U+007A' The Latin Miniscule Letter z key.90909090909090-012290-90-12212290-90-122-90-
'[' 'LeftSquareBracket' 'U+005B' The Left Square Bracket (Opening Square Bracket) key.56-91-56-56-09156-56-919156-56-91-56-
'\' 'Backslash' 'U+005C' The Reverse Solidus (Backslash) key.187-92-187-107-92-107-187-9292187-161-92-161-
']' 'RightSquareBracket' 'U+005D' The Right Square Bracket (Closing Square Bracket) key.57-93-57-57-09357-57-939357-57-93-57-
'^' 'Circumflex' 'U+005E' The Circumflex Accent key.186-94-186-59-09459-186-9494186-168-94-168-
'_' 'Underscore' 'U+005F' The Low Sign (Spacing Underscore, Underscore) key.
'`' 'Grave' 'U+0060' The Grave Accent (Back Quote) key.
'{' 'LeftCurlyBracket' 'U+007B' The Left Curly Bracket (Opening Curly Bracket, Opening Brace, Brace Left) key.55-123-55-55-012355-55-12312355-55-123-55-
'|' 'Pipe' 'U+007C' The Vertical Line (Vertical Bar, Pipe) key.226-124-226-226-0124226-226-124124226-188-124-188-
'}' 'RightCurlyBracket' 'U+007D' The Right Curly Bracket (Closing Curly Bracket, Closing Brace, Brace Right) key.48-125-48-48-012548-48-12512548-48-125-48-
'Del' 'U+007F' The Delete (Del) Key.46---46-46-46-46-46---46-46-46-46-
'¡' 'InvertedExclamation' 'U+00A1' The Inverted Exclamation Mark key.
'DeadGrave' 'U+0300' The Combining Grave Accent (Greek Varia, Dead Grave) key.
'DeadEacute' 'U+0301' The Combining Acute Accent (Stress Mark, Greek Oxia, Tonos, Dead Eacute) key.
'DeadCircumflex' 'U+0302' The Combining Circumflex Accent (Hat, Dead Circumflex) key.
'DeadTilde' 'U+0303' The Combining Tilde (Dead Tilde) key.
'DeadMacron' 'U+0304' The Combining Macron (Long, Dead Macron) key.
'DeadBreve' 'U+0306' The Combining Breve (Short, Dead Breve) key.
'DeadAboveDot' 'U+0307' The Combining Dot Above (Derivative, Dead Above Dot) key.
'DeadUmlaut' 'U+0308' The Combining Diaeresis (Double Dot Abode, Umlaut, Greek Dialytika, Double Derivative, Dead Diaeresis) key.
'DeadAboveRing' 'U+030A' The Combining Ring Above (Dead Above Ring) key.
'DeadDoubleacute' 'U+030B' The Combining Double Acute Accent (Dead Doubleacute) key.
'DeadCaron' 'U+030C' The Combining Caron (Hacek, V Above, Dead Caron) key.
'DeadCedilla' 'U+0327' The Combining Cedilla (Dead Cedilla) key.
'DeadOgonek' 'U+0328' The Combining Ogonek (Nasal Hook, Dead Ogonek) key.
'DeadIota' 'U+0345' The Combining Greek Ypogegrammeni (Greek Non-Spacing Iota Below, Iota Subscript, Dead Iota) key.
'€' 'Euro' 'U+20AC' The Euro Currency Sign key (€).
'DeadVoicedSound' 'U+3099' The Combining Katakana-Hiragana Voiced Sound Mark (Dead Voiced Sound) key.
'DeadSemivoicedSound' 'U+309A' The Combining Katakana-Hiragana Semi-Voiced Sound Mark (Dead Semivoiced Sound) key.

Appendix A: Extending Events

This section is informative

A.1 Introduction

This specification defines several interfaces and many events; however, this is not an exhaustive set of events for all purposes. To allow authors and implementers to add desired functionality, this specification provides two mechanisms for extend this set of interfaces and events without creating conflicts: custom events and namespaced events

A.2 Custom Events

A script author may wish to define an application in terms of functional components, with event types that are meaningful to the application architecture. The author can use the CustomEvent interface to create their own events appropriate to the level of abstraction they are using.

As an example, an author may have created an application which features a dynamically generated bar chart. This bar chart is meant to be updated every 5 minutes, or when a feed shows new information, or when the user refreshes it manually by clicking a button. There are several handlers that have to be called when the chart needs to be updated: the application must fetch the most recent data, show an icon to the user that the event is being updated, and rebuild the chart. To manage this, the author can choose to create a custom "updateChart" event, which is fired whenever one of the trigger conditions is met:

          
    var chartData = ...;
    var evt = document.createEvent("CustomEvent");
    evt.initCustomEventNS("http://example.org/charts",
                          "updateChart",
                          true, false, { data: chartData });
    document.documentElement.dispatchEvent(evt);          
          
        

A.3 Namespaced Events

This specification introduces namespaces into the event model, in order to allow expansion of the set of events in a manner that doesn't introduce potential conflicts.

A.3.1 Legacy Events

An existing implementation which is being adapted to work with the W3C DOM Events specifications may have an existing framework and set of proprietary events. For backwards compatibility, it may be desirable that such an implementation keep these existing events, while providing the means for them to work within the DOM Events framework. In this case, the implementer can simply assign their own vendor-specific namespace to these proprietary events.

In some cases, these legacy events may conflict with other implementation-specific events with the same name, but different functionality. Using the namespace-aware method EventTarget.addEventListenerNS(), an author can target that event specifically, with no risk of clashes.

When there are no known conflicting events, or when such events have the same functionality, the author can simply use the non-namespace-aware method EventTarget.addEventListener(), which can register events without regard to the namespace.

As an example, a particular browser vendor, "FooCorp", may have an event, "skip", which was implemented long ago, and which also works with another FooCorp product. They need to keep this event for backwards compatibility with existing content for some of their clients, but since this event is very specific to their product lines, they don't anticipate that it will be of general use in competing browsers. This vendor implements "skip" in their browser, using their namespace, 'http://example.com/foo/browser/events/'. Their event continues to work using their existing event registration system, and also works with W3C DOM Events methods, both someElement.addEventListener( "skip", doSkip, false ) and someElement.addEventListenerNS( "http://example.com/foo/browser/events/", "skip", doSkip, false ). Other browsers simply ignore this event, and legacy content continues to work in the FooCorp browser.

A.3.2 Vendor Extensions

While a new event is being designed and prototyped, or when an event is intended for implementation-specific functionality, it is desirable to distinguish it from standardized events. In CSS, the mechanism for doing this is to provide vendor-specific keyword prefixes; however, this has the unfortunate side-effect of forcing authors to maintain code that may be identical between vendors, but which nevertheless must retain the prefix.

In DOM Events, by using namespaces for vendor-specific events, an author can choose either to target a particular snapshot of an implementation-specific event by using the namespace-aware method EventTarget.addEventListenerNS(), or to write code that assumes broader future implementation by using the non-namespace-aware method EventTarget.addEventListener().

As an example, a particular browser vendor, "FooCorp", may wish to introduce a new event, "jump". This vendor implements "jump" in their browser, using their namespace, 'http://example.com/foo/browser/events/'. Early adopters start experimenting with the event, using someElement.addEventListenerNS( "http://example.com/foo/browser/events/", "jump", doJump, false ), and provide feedback to FooCorp, who change the behavior of "jump" accordingly. After some time, another vendor, "BarOrg", decides they also want the functionality, but implement it slightly differently, so they use their own namespace, 'http://example.org/bar/browser/events/' but with the same event type, "jump". Authors experimenting with this version of "jump" register events with BarOrg's namespace. Authors who wish to write code that accounts for both browsers can either register each event type separately with specific handlers, or use the same handler and switch on the namespace of the event; thus, early experiments in different codebases do not conflict, and the easrly-adopter is able to write easily-maintained code for multiple implementations. Eventually, as the feature matures, the behavior of both browsers stabilizes and may converge due to author and user feedback or through formal standardization; as this stabilization occurs, and risk of conflicts decrease, authors can remove the forked code, and assume the "jump" event is in the null namespace (even before it is formally standardized), using the same event handler and the more generic registration method someElement.addEventListener( "jump", doJump, false ).

Appendix B: Security Considerations

This appendix discusses security considerations for DOM Level 3 Events implementations. The discussion is limited to security issues that arise directly from implementation of the event model, APIs and events defined in this specification. Implementations typically support other features like scripting languages, other APIs and additional events not defined in this document; these features constitute an unknown factor and are out of scope of this document. Implementers should consult the specifications of such features for their respective security considerations.

Many of the event types defined in this specification are dispatched in response to user actions. This allows malicious event listeners to gain access to information users would typically consider confidential, e.g., typos they might have made when filling out a form, if they reconsider their answer to a multiple choice question shortly before submitting a form, their typing rate or primary input mechanism. In the worst case, malicious event listeners are able to capture all user interactions and submit them to a third party through means, while not defined in DOM Level 3 Events, generally available in DOM implementations, such as the XMLHttpRequest interface.

In DOM implementations that support facilities to load external data, events like the error event can provide access to sensitive information about the environment of the computer system or network; an example would be a malicious HTML document that attempts to embed a resource on the local network or the localhost on different ports; an embedded DOM application could then listen for error and load events to determine which other computers in a network are accessible from the local system or which ports are open on the system to prepare further attacks.

An implementation of DOM Level 3 Events alone is generally insufficient to perform attacks of this kind and the security considerations of the facilities that possibly support such attacks apply. For conformance with this specification, DOM implementations may take reasonable steps to ensure that DOM applications do not get access to confidential or sensitive information, for example, they may choose to dispatch no load events to nodes that attempt to embed resources on the local network.

The DocumentEvent.canDispatch() method allows DOM applications to retrieve information about which event types the implementation supports, including event types not defined in this specification. Which event types a DOM Level 3 Events implementation supports can depend on configuration settings or on additional software modules available to the implementation.

Appendix C: Changes

C.1 Changes between DOM Level 2 Events and DOM Level 3 Events

Numerous clarifications to the interfaces and event types have been made. The HTMLEvents module is no longer defined in this document. The event types focus and blur have been added to the UIEvents module, the event type dblclick has been added to the MouseEvents module. This new specification provides a better separation between the DOM event flow, the event types, and the DOM interfaces.

This specification has been reordered significantly from the earlier W3C Note form, and from the structure of DOM2 Events, in order to clarify the material. New diagrams have been put in place to represent hierarchies and events flows more clearly.

C.1.1 Changes to DOM Level 2 event flow

This new specification introduced the following new concepts in the event flow:

  • ordering of event listeners: event listeners are now ordered while ordering was unspecified in DOM Level 2 Events.
  • the event flow now includes the defaultView (or window), to reflect existing implementations.

C.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.

In the most recent drafts of this specification, "MutationEvents" and "MutationNameEvents" have been deprecated.

C.1.3 Changes to DOM Level 2 Events interfaces

Interface Event
The Event interface has two new attributes Event.namespaceURI and Event.defaultPrevented, and two new methods: Event.stopImmediatePropagation(), Event.initEventNS().
Event.timeStamp is now a Number in the ECMAScript binding; a proposed correction to make the same change in [DOM Level 3 Core] is forthcoming.
DOM Level 3 Events considers the Event.type attribute to be case-sensitive, while DOM Level 2 Events considers Event.type to be case-insensitive.
Interface EventTarget
The EventTarget interface has two new methods: EventTarget.addEventListenerNS() and EventTarget.removeEventListenerNS(). The method EventTarget.dispatchEvent() was modified.
Interface DocumentEvent
The DocumentEvent interface has one new method: DocumentEvent.canDispatch().
Interface UIEvent
The UIEvent interface has a new method UIEvent.initUIEventNS().
Interface MouseEvent
The MouseEvent interface has two new methods MouseEvent.getModifierState() and MouseEvent.initMouseEventNS().
Interface MutationEvent
The MutationEvent interface has a new method MutationEvent.initMutationEventNS().
Exception EventException
The DISPATCH_REQUEST_ERR constant has been added.

C.1.4 New Interfaces

The interfaces CustomEvent, TextEvent, KeyboardEvent, CompositionEvent, MutationNameEvent, WheelEvent, and MouseWheelEvent were added to the Events module.

Appendix D: IDL Definitions

@@ Note that this section is out of date, and will be updated with the appropriate IDLs once the specification is more stable. Future drafts of this specification may use Web IDL instead of OMG IDL.

This appendix contains the complete OMG IDL [OMG IDL] for the Level 3 Document Object Model Events definitions.

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 EventException {
        unsigned short   code;
      };
      // EventExceptionCode
      const unsigned short      UNSPECIFIED_EVENT_TYPE_ERR     = 0;
      // Introduced in DOM Level 3:
      const unsigned short      DISPATCH_REQUEST_ERR           = 1;


      // Introduced in DOM Level 2:
      interface Event {

        // PhaseType
        const unsigned short      CAPTURING_PHASE                = 1;
        const unsigned short      AT_TARGET                      = 2;
        const unsigned short      BUBBLING_PHASE                 = 3;

        readonly attribute DOMString       type;
        readonly attribute EventTarget     target;
        readonly attribute EventTarget     currentTarget;
        readonly attribute unsigned short  eventPhase;
        readonly attribute boolean         bubbles;
        readonly attribute boolean         cancelable;
        readonly attribute DOMTimeStamp    timeStamp;
        void               stopPropagation();
        void               preventDefault();
        void               initEvent(in DOMString eventTypeArg, 
                                     in boolean canBubbleArg, 
                                     in boolean cancelableArg);
        // Introduced in DOM Level 3:
        readonly attribute DOMString       namespaceURI;
        // Introduced in DOM Level 3:
        void               stopImmediatePropagation();
        // Introduced in DOM Level 3:
        readonly attribute boolean         defaultPrevented;
        // Introduced in DOM Level 3:
        void               initEventNS(in DOMString namespaceURIArg, 
                                       in DOMString eventTypeArg, 
                                       in boolean canBubbleArg, 
                                       in boolean cancelableArg);
      };

      // Introduced in DOM Level 3:
      interface CustomEvent : Event {
        readonly attribute DOMObject       detail;
        void               initCustomEvent(in DOMString typeArg, 
                                           in boolean canBubbleArg, 
                                           in boolean cancelableArg, 
                                           in DOMObject detailArg);
        void               initCustomEventNS(in DOMString namespaceURIArg, 
                                             in DOMString typeArg, 
                                             in boolean canBubbleArg, 
                                             in boolean cancelableArg, 
                                             in DOMObject detailArg);
      };

      // Introduced in DOM Level 2:
      interface EventTarget {
        void               addEventListener(in DOMString type, 
                                            in EventListener listener, 
                                            in boolean useCapture);
        void               removeEventListener(in DOMString type, 
                                               in EventListener listener, 
                                               in boolean useCapture);
        // Modified in DOM Level 3:
        boolean            dispatchEvent(in Event evt)
                                            raises(EventException, 
                                                   dom::DOMException);
        // Introduced in DOM Level 3:
        void               addEventListenerNS(in DOMString namespaceURI, 
                                              in DOMString type, 
                                              in EventListener listener, 
                                              in boolean useCapture);
        // Introduced in DOM Level 3:
        void               removeEventListenerNS(in DOMString namespaceURI, 
                                                 in DOMString type, 
                                                 in EventListener listener, 
                                                 in boolean useCapture);
      };

      // Introduced in DOM Level 2:
      interface EventListener {
        void               handleEvent(in Event evt);
      };

      // Introduced in DOM Level 2:
      interface DocumentEvent {
        Event              createEvent(in DOMString eventType)
                                            raises(dom::DOMException);
        // Introduced in DOM Level 3:
        boolean            canDispatch(in DOMString namespaceURI, 
                                       in DOMString type);
      };

      // Introduced in DOM Level 2:
      interface UIEvent : Event {
        readonly attribute views::AbstractView view;
        readonly attribute long            detail;
        void               initUIEvent(in DOMString typeArg, 
                                       in boolean canBubbleArg, 
                                       in boolean cancelableArg, 
                                       in views::AbstractView viewArg, 
                                       in long detailArg);
        // Introduced in DOM Level 3:
        void               initUIEventNS(in DOMString namespaceURIArg, 
                                         in DOMString typeArg, 
                                         in boolean canBubbleArg, 
                                         in boolean cancelableArg, 
                                         in views::AbstractView viewArg, 
                                         in long detailArg);
      };

      // Introduced in DOM Level 3:
      interface TextEvent : UIEvent {
        readonly attribute DOMString       data;
        void               initTextEvent(in DOMString typeArg, 
                                         in boolean canBubbleArg, 
                                         in boolean cancelableArg, 
                                         in views::AbstractView viewArg, 
                                         in DOMString dataArg, 
                                         in unsigned long inputMode);
        void               initTextEventNS(in DOMString namespaceURIArg, 
                                           in DOMString typeArg, 
                                           in boolean canBubbleArg, 
                                           in boolean cancelableArg, 
                                           in views::AbstractView viewArg, 
                                           in DOMString dataArg, 
                                           in unsigned long inputMode);
      };

      // Introduced in DOM Level 3:
      interface KeyboardEvent : UIEvent {

        // KeyLocationCode
        const unsigned long       DOM_KEY_LOCATION_STANDARD      = 0x00;
        const unsigned long       DOM_KEY_LOCATION_LEFT          = 0x01;
        const unsigned long       DOM_KEY_LOCATION_RIGHT         = 0x02;
        const unsigned long       DOM_KEY_LOCATION_NUMPAD        = 0x03;
        const unsigned long       DOM_KEY_LOCATION_MOBILE        = 0x04;
        const unsigned long       DOM_KEY_LOCATION_JOYSTICK      = 0x05;

        readonly attribute DOMString       keyIdentifier;
        
        readonly attribute unsigned long   keyLocation;
        readonly attribute boolean         ctrlKey;
        readonly attribute boolean         shiftKey;
        readonly attribute boolean         altKey;
        readonly attribute boolean         metaKey;
        boolean            getModifierState(in DOMString keyIdentifierArg);
        void               initKeyboardEvent(in DOMString typeArg, 
                                             in boolean canBubbleArg, 
                                             in boolean cancelableArg, 
                                             in views::AbstractView viewArg, 
                                             in DOMString keyIdentifierArg, 
                                             in unsigned long keyLocationArg, 
                                             in DOMString modifiersListArg);
        void               initKeyboardEventNS(in DOMString namespaceURIArg, 
                                               in DOMString typeArg, 
                                               in boolean canBubbleArg, 
                                               in boolean cancelableArg, 
                                               in views::AbstractView viewArg, 
                                               in DOMString keyIdentifierArg, 
                                               in unsigned long keyLocationArg, 
                                               in DOMString modifiersListArg);
      };

      // Introduced in DOM Level 2:
      interface MouseEvent : UIEvent {
        readonly attribute long            screenX;
        readonly attribute long            screenY;
        readonly attribute long            clientX;
        readonly attribute long            clientY;
        readonly attribute boolean         ctrlKey;
        readonly attribute boolean         shiftKey;
        readonly attribute boolean         altKey;
        readonly attribute boolean         metaKey;
        readonly attribute unsigned short  button;
        readonly attribute EventTarget     relatedTarget;
        void               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 EventTarget relatedTargetArg);
        // Introduced in DOM Level 3:
        boolean            getModifierState(in DOMString keyIdentifierArg);
        // Introduced in DOM Level 3:
        void               initMouseEventNS(in DOMString namespaceURIArg, 
                                            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 EventTarget relatedTargetArg, 
                                            in DOMString modifiersListArg);
      };

      // Introduced in DOM Level 3:
      interface WheelEvent : MouseEvent {
        readonly attribute long            deltaX;
        readonly attribute long            deltaY;
        readonly attribute long            deltaZ;
        void               initWheelEventNS(in DOMString namespaceURIArg, 
                                                      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 EventTarget relatedTargetArg, 
                                                      in DOMString modifiersListArg, 
                                                      in long deltaXArg, 
                                                      in long deltaYArg, 
                                                      in long deltaZArg);
      };

      // Introduced in DOM Level 3:
      interface MouseWheelEvent : MouseEvent {
        readonly attribute long            wheelDelta;
        void               initMouseWheelEventNS(in DOMString namespaceURIArg, 
                                                 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 EventTarget relatedTargetArg, 
                                                 in DOMString modifiersListArg, 
                                                 in long wheelDeltaArg);
      };

      // Introduced in DOM Level 2:
      interface MutationEvent : Event {

        // attrChangeType
        const unsigned short      MODIFICATION                   = 1;
        const unsigned short      ADDITION                       = 2;
        const unsigned short      REMOVAL                        = 3;

        readonly attribute Node            relatedNode;
        readonly attribute DOMString       prevValue;
        readonly attribute DOMString       newValue;
        readonly attribute DOMString       attrName;
        readonly attribute unsigned short  attrChange;
        void               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               initMutationEventNS(in DOMString namespaceURIArg, 
                                               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 MutationNameEvent : MutationEvent {
        readonly attribute DOMString       prevNamespaceURI;
        readonly attribute DOMString       prevNodeName;
        // Introduced in DOM Level 3:
        void               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               initMutationNameEventNS(in DOMString namespaceURIArg, 
                                                   in DOMString typeArg, 
                                                   in boolean canBubbleArg, 
                                                   in boolean cancelableArg, 
                                                   in Node relatedNodeArg, 
                                                   in DOMString prevNamespaceURIArg, 
                                                   in DOMString prevNodeNameArg);
      };
    };

    #endif // _EVENTS_IDL_

    

Appendix E: Java Language Binding

@@ Note that this section is out of date, and will be updated with the appropriate IDLs once the specification is more stable. Future drafts of this specification may use Web IDL instead of OMG IDL.

This appendix contains the complete Java [Java] bindings for the Level 3 Document Object Model Events.

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 void stopImmediatePropagation();

        public boolean getDefaultPrevented();

        public void initEventNS(String namespaceURIArg, 
                                String eventTypeArg, 
                                boolean canBubbleArg, 
                                boolean cancelableArg);

    }
    

org\w3c\dom\events\CustomEvent.java:

    package org.w3c.dom.events;

    public interface CustomEvent extends Event {
        public Object getDetail();

        public void initCustomEventNS(String namespaceURIArg, 
                                      String typeArg, 
                                      boolean canBubbleArg, 
                                      boolean cancelableArg, 
                                      Object detailArg);

    }
    

org\w3c\dom\events\EventTarget.java:

    package org.w3c.dom.events;

    import org.w3c.dom.DOMException;

    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, DOMException;

        public void addEventListenerNS(String namespaceURI, 
                                       String type, 
                                       EventListener listener, 
                                       boolean useCapture);

        public void removeEventListenerNS(String namespaceURI, 
                                          String type, 
                                          EventListener listener, 
                                          boolean useCapture);

    }
    

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\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 namespaceURIArg, 
                                  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, 
                                  unsigned long inputMode);

        public void initTextEventNS(String namespaceURIArg, 
                                    String typeArg, 
                                    boolean canBubbleArg, 
                                    boolean cancelableArg, 
                                    AbstractView viewArg, 
                                    String dataArg, 
                                    unsigned long inputMode);

    }
    

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 modifiersListArg);

        public void initKeyboardEventNS(String namespaceURIArg, 
                                        String typeArg, 
                                        boolean canBubbleArg, 
                                        boolean cancelableArg, 
                                        AbstractView viewArg, 
                                        String keyIdentifierArg, 
                                        int keyLocationArg, 
                                        String modifiersListArg);

    }
    

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 namespaceURIArg, 
                                     String typeArg, 
                                     boolean canBubbleArg, 
                                     boolean cancelableArg, 
                                     AbstractView viewArg, 
                                     int detailArg, 
                                     int screenXArg, 
                                     int screenYArg, 
                                     int clientXArg, 
                                     int clientYArg, 
                                     short buttonArg, 
                                     EventTarget relatedTargetArg, 
                                     String modifiersListArg);

    }
    

org\w3c\dom\events\WheelEvent.java:

    package org.w3c.dom.events;

    import org.w3c.dom.views.AbstractView;

    public interface WheelEvent extends MouseEvent {
        public int getWheelDeltaX();

        public int getWheelDeltaY();

        public int getWheelDeltaZ();

        public void initWheelEventNS(String namespaceURIArg, 
                                               String typeArg, 
                                               boolean canBubbleArg, 
                                               boolean cancelableArg, 
                                               AbstractView viewArg, 
                                               int detailArg, 
                                               int screenXArg, 
                                               int screenYArg, 
                                               int clientXArg, 
                                               int clientYArg, 
                                               short buttonArg, 
                                               EventTarget relatedTargetArg, 
                                               String modifiersListArg, 
                                               int deltaXArg, 
                                               int deltaYArg, 
                                               int deltaZArg);

    }
    

org\w3c\dom\events\MouseWheelEvent.java:

    package org.w3c.dom.events;

    import org.w3c.dom.views.AbstractView;

    public interface MouseWheelEvent extends MouseEvent {
        public int getWheelDelta();

        public void initMouseWheelEventNS(String namespaceURIArg, 
                                          String typeArg, 
                                          boolean canBubbleArg, 
                                          boolean cancelableArg, 
                                          AbstractView viewArg, 
                                          int detailArg, 
                                          int screenXArg, 
                                          int screenYArg, 
                                          int clientXArg, 
                                          int clientYArg, 
                                          short buttonArg, 
                                          EventTarget relatedTargetArg, 
                                          String modifiersListArg, 
                                          int wheelDeltaArg);

    }
    

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 namespaceURIArg, 
                                        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 namespaceURIArg, 
                                            String typeArg, 
                                            boolean canBubbleArg, 
                                            boolean cancelableArg, 
                                            Node relatedNodeArg, 
                                            String prevNamespaceURIArg, 
                                            String prevNodeNameArg);

    }
    

Appendix F: ECMAScript Language Binding

@@ Note that this section is out of date, and will be updated with the appropriate IDLs once the specification is more stable. Future drafts of this specification may use Web IDL instead of OMG IDL.

This appendix contains the complete ECMAScript [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 shall be 1.
Event.AT_TARGET
The value of the constant Event.AT_TARGET shall be 2.
Event.BUBBLING_PHASE
The value of the constant Event.BUBBLING_PHASE shall be 3.
Objects that implement the Event interface:
Properties of objects that implement the Event interface:
type
This read-only property shall be a String.
target
This read-only property shall be an object that implements the EventTarget interface.
currentTarget
This read-only property shall be an object that implements the EventTarget interface.
eventPhase
This read-only property shall be a Number.
bubbles
This read-only property shall be a Boolean.
cancelable
This read-only property shall be a Boolean.
timeStamp
This read-only property shall be a Number.
namespaceURI
This read-only property shall be a String.
defaultPrevented
This read-only property shall be a Boolean.
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 shall be a String.
The canBubbleArg parameter shall be a Boolean.
The cancelableArg parameter shall be a Boolean.
stopImmediatePropagation()
This function has no return value.
initEventNS(namespaceURIArg, eventTypeArg, canBubbleArg, cancelableArg)
This function has no return value.
The namespaceURIArg parameter shall be a String.
The eventTypeArg parameter shall be a String.
The canBubbleArg parameter shall be a Boolean.
The cancelableArg parameter shall be a Boolean.
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.
Properties of objects that implement the CustomEvent interface:
detail
This read-only property shall be an object that implements the Object interface.
Functions of objects that implement the CustomEvent interface:
initCustomEventNS(namespaceURIArg, typeArg, canBubbleArg, cancelableArg, detailArg)
This function has no return value.
The namespaceURIArg parameter shall be a String.
The typeArg parameter shall be a String.
The canBubbleArg parameter shall be a Boolean.
The cancelableArg parameter shall be a Boolean.
The detailArg parameter shall be an object that implements the Object interface.
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 shall be a String.
The listener parameter shall be an object that implements the EventListener interface.
The useCapture parameter shall be a Boolean.
removeEventListener(type, listener, useCapture)
This function has no return value.
The type parameter shall be a String.
The listener parameter shall be an object that implements the EventListener interface.
The useCapture parameter shall be a Boolean.
dispatchEvent(evt)
This function returns a Boolean.
The evt parameter shall be an object that implements the Event interface.
This function can raise an object that implements the EventException interface or the DOMException interface.
addEventListenerNS(namespaceURI, type, listener, useCapture)
This function has no return value.
The namespaceURI parameter shall be a String.
The type parameter shall be a String.
The listener parameter shall be an object that implements the EventListener interface.
The useCapture parameter shall be a Boolean.
removeEventListenerNS(namespaceURI, type, listener, useCapture)
This function has no return value.
The namespaceURI parameter shall be a String.
The type parameter shall be a String.
The listener parameter shall be an object that implements the EventListener interface.
The useCapture parameter shall be a Boolean.
EventListener function:
This function has no return value. The parameter shall be 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 shall be 0.
EventException.DISPATCH_REQUEST_ERR
The value of the constant EventException.DISPATCH_REQUEST_ERR shall be 1.
Objects that implement the EventException interface:
Properties of objects that implement the EventException interface:
code
This property shall be 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 shall be a String.
This function can raise an object that implements the DOMException interface.
canDispatch(namespaceURI, type)
This function returns a Boolean.
The namespaceURI parameter shall be a String.
The type parameter shall be a String.
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 shall be an object that implements the AbstractView interface.
detail
This read-only property shall be 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 shall be a String.
The canBubbleArg parameter shall be a Boolean.
The cancelableArg parameter shall be a Boolean.
The viewArg parameter shall be an object that implements the AbstractView interface.
The detailArg parameter shall be a Number.
initUIEventNS(namespaceURIArg, typeArg, canBubbleArg, cancelableArg, viewArg, detailArg)
This function has no return value.
The namespaceURIArg parameter shall be a String.
The typeArg parameter shall be a String.
The canBubbleArg parameter shall be a Boolean.
The cancelableArg parameter shall be a Boolean.
The viewArg parameter shall be an object that implements the AbstractView interface.
The detailArg parameter shall be 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 shall be a String.
inputMode
This read-only property shall be an unsigned long.
Functions of objects that implement the TextEvent interface:
initTextEvent(typeArg, canBubbleArg, cancelableArg, viewArg, dataArg, inputModeArg)
This function has no return value.
The typeArg parameter shall be a String.
The canBubbleArg parameter shall be a Boolean.
The cancelableArg parameter shall be a Boolean.
The viewArg parameter shall be an object that implements the AbstractView interface.
The dataArg parameter shall be a String.
The inputModeArg parameter shall be an Unsigned Long.
initTextEventNS(namespaceURIArg, typeArg, canBubbleArg, cancelableArg, viewArg, dataArg, inputModeArg)
This function has no return value.
The namespaceURIArg parameter shall be a String.
The typeArg parameter shall be a String.
The canBubbleArg parameter shall be a Boolean.
The cancelableArg parameter shall be a Boolean.
The viewArg parameter shall be an object that implements the AbstractView interface.
The dataArg parameter shall be a String.
The inputModeArg parameter shall be an Unsigned Long.
Properties of the KeyboardEvent Constructor function:
KeyboardEvent.DOM_KEY_LOCATION_STANDARD
The value of the constant KeyboardEvent.DOM_KEY_LOCATION_STANDARD shall be 0x00.
KeyboardEvent.DOM_KEY_LOCATION_LEFT
The value of the constant KeyboardEvent.DOM_KEY_LOCATION_LEFT shall be 0x01.
KeyboardEvent.DOM_KEY_LOCATION_RIGHT
The value of the constant KeyboardEvent.DOM_KEY_LOCATION_RIGHT shall be 0x02.
KeyboardEvent.DOM_KEY_LOCATION_NUMPAD
The value of the constant KeyboardEvent.DOM_KEY_LOCATION_NUMPAD shall be 0x03.
KeyboardEvent.DOM_KEY_LOCATION_NUMPAD
The value of the constant KeyboardEvent.DOM_KEY_LOCATION_MOBILE shall be 0x04.
KeyboardEvent.DOM_KEY_LOCATION_NUMPAD
The value of the constant KeyboardEvent.DOM_KEY_LOCATION_JOYSTICK shall be 0x05.
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 shall be a String.
keyLocation
This read-only property shall be a Number.
ctrlKey
This read-only property shall be a Boolean.
shiftKey
This read-only property shall be a Boolean.
altKey
This read-only property shall be a Boolean.
metaKey
This read-only property shall be a Boolean.
Functions of objects that implement the KeyboardEvent interface:
getModifierState(keyIdentifierArg)
This function returns a Boolean.
The keyIdentifierArg parameter shall be a String.
initKeyboardEvent(typeArg, canBubbleArg, cancelableArg, viewArg, keyIdentifierArg, keyLocationArg, modifiersListArg)
This function has no return value.
The typeArg parameter shall be a String.
The canBubbleArg parameter shall be a Boolean.
The cancelableArg parameter shall be a Boolean.
The viewArg parameter shall be an object that implements the AbstractView interface.
The keyIdentifierArg parameter shall be a String.
The keyLocationArg parameter shall be a Number.
The modifiersListArg parameter shall be a String.
initKeyboardEventNS(namespaceURIArg, typeArg, canBubbleArg, cancelableArg, viewArg, keyIdentifierArg, keyLocationArg, modifiersListArg)
This function has no return value.
The namespaceURIArg parameter shall be a String.
The typeArg parameter shall be a String.
The canBubbleArg parameter shall be a Boolean.
The cancelableArg parameter shall be a Boolean.
The viewArg parameter shall be an object that implements the AbstractView interface.
The keyIdentifierArg parameter shall be a String.
The keyLocationArg parameter shall be a Number.
The modifiersListArg parameter shall be 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 shall be a Number.
screenY
This read-only property shall be a Number.
clientX
This read-only property shall be a Number.
clientY
This read-only property shall be a Number.
ctrlKey
This read-only property shall be a Boolean.
shiftKey
This read-only property shall be a Boolean.
altKey
This read-only property shall be a Boolean.
metaKey
This read-only property shall be a Boolean.
button
This read-only property shall be a Number.
relatedTarget
This read-only property shall be 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 shall be a String.
The canBubbleArg parameter shall be a Boolean.
The cancelableArg parameter shall be a Boolean.
The viewArg parameter shall be an object that implements the AbstractView interface.
The detailArg parameter shall be a Number.
The screenXArg parameter shall be a Number.
The screenYArg parameter shall be a Number.
The clientXArg parameter shall be a Number.
The clientYArg parameter shall be a Number.
The ctrlKeyArg parameter shall be a Boolean.
The altKeyArg parameter shall be a Boolean.
The shiftKeyArg parameter shall be a Boolean.
The metaKeyArg parameter shall be a Boolean.
The buttonArg parameter shall be a Number.
The relatedTargetArg parameter shall be an object that implements the EventTarget interface.
getModifierState(keyIdentifierArg)
This function returns a Boolean.
The keyIdentifierArg parameter shall be a String.
initMouseEventNS(namespaceURIArg, typeArg, canBubbleArg, cancelableArg, viewArg, detailArg, screenXArg, screenYArg, clientXArg, clientYArg, buttonArg, relatedTargetArg, modifiersListArg)
This function has no return value.
The namespaceURIArg parameter shall be a String.
The typeArg parameter shall be a String.
The canBubbleArg parameter shall be a Boolean.
The cancelableArg parameter shall be a Boolean.
The viewArg parameter shall be an object that implements the AbstractView interface.
The detailArg parameter shall be a Number.
The screenXArg parameter shall be a Number.
The screenYArg parameter shall be a Number.
The clientXArg parameter shall be a Number.
The clientYArg parameter shall be a Number.
The buttonArg parameter shall be a Number.
The relatedTargetArg parameter shall be an object that implements the EventTarget interface.
The modifiersListArg parameter shall be a String.
Objects that implement the WheelEvent interface:
Objects that implement the WheelEvent interface have all properties and functions of the MouseEvent interface as well as the properties and functions defined below.
Properties of objects that implement the WheelEvent interface:
deltaX
This read-only property shall be a Number.
deltaY
This read-only property shall be a Number.
deltaZ
This read-only property shall be a Number.
Functions of objects that implement the WheelEvent interface:
initWheelEventNS(namespaceURIArg, typeArg, canBubbleArg, cancelableArg, viewArg, detailArg, screenXArg, screenYArg, clientXArg, clientYArg, buttonArg, relatedTargetArg, modifiersListArg, deltaXArg, deltaYArg, deltaZArg)
This function has no return value.
The namespaceURIArg parameter shall be a String.
The typeArg parameter shall be a String.
The canBubbleArg parameter shall be a Boolean.
The cancelableArg parameter shall be a Boolean.
The viewArg parameter shall be an object that implements the AbstractView interface.
The detailArg parameter shall be a Number.
The screenXArg parameter shall be a Number.
The screenYArg parameter shall be a Number.
The clientXArg parameter shall be a Number.
The clientYArg parameter shall be a Number.
The buttonArg parameter shall be a Number.
The relatedTargetArg parameter shall be an object that implements the EventTarget interface.
The modifiersListArg parameter shall be a String.
The deltaXArg parameter shall be a Number.
The deltaYArg parameter shall be a Number.
The deltaZArg parameter shall be a Number.
Objects that implement the MouseWheelEvent interface:
Objects that implement the MouseWheelEvent interface have all properties and functions of the MouseEvent interface as well as the properties and functions defined below.
Properties of objects that implement the MouseWheelEvent interface:
wheelDelta
This read-only property shall be a Number.
Functions of objects that implement the MouseWheelEvent interface:
initMouseWheelEventNS(namespaceURIArg, typeArg, canBubbleArg, cancelableArg, viewArg, detailArg, screenXArg, screenYArg, clientXArg, clientYArg, buttonArg, relatedTargetArg, modifiersListArg, wheelDeltaArg)
This function has no return value.
The namespaceURIArg parameter shall be a String.
The typeArg parameter shall be a String.
The canBubbleArg parameter shall be a Boolean.
The cancelableArg parameter shall be a Boolean.
The viewArg parameter shall be an object that implements the AbstractView interface.
The detailArg parameter shall be a Number.
The screenXArg parameter shall be a Number.
The screenYArg parameter shall be a Number.
The clientXArg parameter shall be a Number.
The clientYArg parameter shall be a Number.
The buttonArg parameter shall be a Number.
The relatedTargetArg parameter shall be an object that implements the EventTarget interface.
The modifiersListArg parameter shall be a String.
The wheelDeltaArg parameter shall be a Number.
Properties of the MutationEvent Constructor function:
MutationEvent.MODIFICATION
The value of the constant MutationEvent.MODIFICATION shall be 1.
MutationEvent.ADDITION
The value of the constant MutationEvent.ADDITION shall be 2.
MutationEvent.REMOVAL
The value of the constant MutationEvent.REMOVAL shall be 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 shall be an object that implements the Node interface.
prevValue
This read-only property shall be a String.
newValue
This read-only property shall be a String.
attrName
This read-only property shall be a String.
attrChange
This read-only property shall be 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 shall be a String.
The canBubbleArg parameter shall be a Boolean.
The cancelableArg parameter shall be a Boolean.
The relatedNodeArg parameter shall be an object that implements the Node interface.
The prevValueArg parameter shall be a String.
The newValueArg parameter shall be a String.
The attrNameArg parameter shall be a String.
The attrChangeArg parameter shall be a Number.
initMutationEventNS(namespaceURIArg, typeArg, canBubbleArg, cancelableArg, relatedNodeArg, prevValueArg, newValueArg, attrNameArg, attrChangeArg)
This function has no return value.
The namespaceURIArg parameter shall be a String.
The typeArg parameter shall be a String.
The canBubbleArg parameter shall be a Boolean.
The cancelableArg parameter shall be a Boolean.
The relatedNodeArg parameter shall be an object that implements the Node interface.
The prevValueArg parameter shall be a String.
The newValueArg parameter shall be a String.
The attrNameArg parameter shall be a String.
The attrChangeArg parameter shall be 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 shall be a String.
prevNodeName
This read-only property shall be 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 shall be a String.
The canBubbleArg parameter shall be a Boolean.
The cancelableArg parameter shall be a Boolean.
The relatedNodeArg parameter shall be an object that implements the Node interface.
The prevNamespaceURIArg parameter shall be a String.
The prevNodeNameArg parameter shall be a String.
initMutationNameEventNS(namespaceURIArg, typeArg, canBubbleArg, cancelableArg, relatedNodeArg, prevNamespaceURIArg, prevNodeNameArg)
This function has no return value.
The namespaceURIArg parameter shall be a String.
The typeArg parameter shall be a String.
The canBubbleArg parameter shall be a Boolean.
The cancelableArg parameter shall be a Boolean.
The relatedNodeArg parameter shall be an object that implements the Node interface.
The prevNamespaceURIArg parameter shall be a String.
The prevNodeNameArg parameter shall be a String.

Appendix G: 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).

The following people made substantial material contribution to the glossary in earlier versions: Arnaud Le Hors (W3C) and Robert S. Sutor (IBM Research).

After publication of this document as Working Group Note in November 2003, the participants of the WebAPI Working Group resumed development of this document:

Anne van Kesteren (Opera Software), Arun Ranganathan (AOL), Björn Höhrmann, Charles McCathieNevile (Opera Software, Co-Chair), Christophe Jolif (ILOG), Dean Jackson (W3C, W3C Team Contact), Doug Schepers (Vectoreal), Gorm Haug Eriksen (Opera Software), Ian Davis (Talis Information Limited), Ian Hickson (Google), John Robinson (AOL), Jonas Sicking (Mozilla Foundation), Luca Mascaro (HTML Writers Guild), Maciej Stachowiak (Apple Computer), Marc Hadley (Sun Microsystems), Michael Shenfield (Research In Motion), Robin Berjon, (Expway, Co-Chair) , Scott Hayman (Research In Motion), Stéphane Sire (IntuiLab), T.V. Raman (Google)

In the WebApps Working Group, the following people were active participants in the process of refining and revising the DOM3 Events Specification:

Hironori Bono (Google), Daniel Danilatos (Google), Travis Leithead (Microsoft), Cameron McCormack (Invited Expert), Carmelo Montanez (NIST), Olli Pettay (Mozilla), Jacob Rossi (Microsoft), Hallvord R. M. Steen (Opera)

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, Ken Rehor, NAKANO Masayuki, and Cameron McCormack, for their review and comments of this document.

Special thanks to the 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.

G.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 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.

After DOM Level 1, we used Xerces as the basis DOM implementation and wish to thank the authors. Philippe Le Hégaret and Arnaud Le Hors wrote the Java programs which are the DOM application.

Thanks also to Jan Kärrman, author of html2ps, which we use in creating the PostScript version of the specification.

References

For the latest version of any W3C specification please consult the list of W3C Technical Reports available at http://www.w3.org/TR.

H.1 Normative References

[DOM Level 2 Core]
Document Object Model Level 2 Core Specification, A. Le Hors, et al., Editors. World Wide Web Consortium, November 2000. This version of the DOM Level 2 Core Recommendation is http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113. The latest version of DOM Level 2 Core is available at http://www.w3.org/TR/DOM-Level-2-Core.
[DOM Level 3 Core]
Document Object Model Level 3 Core Specification, A. Le Hors, et al., Editors. World Wide Web Consortium, April 2004. This version of the Document Object Model Level 3 Core Specification is http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407. The latest version of DOM Level 3 Core is available at http://www.w3.org/TR/DOM-Level-3-Core.
[DOM Level 2 Events]
Document Object Model Level 2 Events Specification, T. Pixley, Editor. World Wide Web Consortium, November 2000. This version of the Document Object Model Level 2 Events Specification is http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113. The latest version of Document Object Model Level 2 Events is available at http://www.w3.org/TR/DOM-Level-2-Events.
[ECMAScript]
ECMAScript Language Specification, Third Edition. European Computer Manufacturers Association, Standard ECMA-262, December 1999. This version of the ECMAScript Language is available from http://www.ecma-international.org/.
[Java]
The Java Language Specification, J. Gosling, B. Joy, and G. Steele, Authors. Addison-Wesley, September 1996. Available at http://java.sun.com/docs/books/jls
[OMG IDL]
"OMG IDL Syntax and Semantics" defined in The Common Object Request Broker: Architecture and Specification, version 2, Object Management Group. The latest version of CORBA version 2.0 is available at http://www.omg.org/technology/documents/formal/corba_2.htm.
[Unicode]
The Unicode Standard, Version 5.0, ISBN 0-321-48091-0, as updated from time to time by the publication of new versions. See also Versions of the Unicode Standard, available at http://www.unicode.org/unicode/standard/versions, for latest version and additional information on versions of the standard and of the Unicode Character Database.
[UAX #15]
Unicode Normalization Forms, The Unicode Standard Annex #15. The Unicode Consortium, 2006. The latest version of this annex is available at http://www.unicode.org/reports/tr15/.
[XML Namespaces 1.1]
Namespaces in XML 1.1, T. Bray, D. Hollander, A. Layman, and R. Tobin, Editors. World Wide Web Consortium, August 2006. This version of the Namespaces in XML 1.1 Specification is http://www.w3.org/TR/2006/REC-xml-names11-20060816. The latest version of Namespaces in XML 1.1 is available at http://www.w3.org/TR/xml-names11/.

I.2 Informative References

[CSS2]
Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification, B. Bos, T. Çelik, I. Hickson, H.W. Lie, Editors. World Wide Web Consortium, 23 April 2009, Work in Progress. This version of the CSS 2.1 Specification is http://www.w3.org/TR/2009/CR-CSS2-20090423. The latest version of CSS 2.1 is available at http://www.w3.org/TR/CSS2/.
[DOM Level 3 Load and Save]
Document Object Model Level 3 Load and Save Specification, J. Stenback, A. Heninger, Editors. World Wide Web Consortium, April 2004. This version of the DOM Level 3 Load and Save Specification is http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407. The latest version of DOM Level 3 Load and Save is available at http://www.w3.org/TR/DOM-Level-3-LS.
[DWW95]
Developing International Software for Windows 95 and Windows NT: A Handbook for International Software Design, N. Kano, Author. Microsoft Press, 1995. ISBN 1-55615-840-8.
[HTML 4.01]
HTML 4.01 Specification, D. Raggett, A. Le Hors, and I. Jacobs, Editors. World Wide Web Consortium, December 1999. This version of the HTML 4.01 Recommendation is http://www.w3.org/TR/1999/REC-html401-19991224. The latest version of HTML 4 is available at http://www.w3.org/TR/html4.
[ISO9995-3]
ISO/IEC 9995-3:2009A, Information technology -- Keyboard layouts for text and office systems -- Part 3: Complementary layouts of the alphanumeric zone of the alphanumeric section.
[ISO9995-8]
ISO/IEC 9995-8:2006, Information technology -- Keyboard layouts for text and office systems -- Part 8: Allocation of letters to the keys of a numeric keypad.
[KeyEvent for Java]
Java 2 SDK, Standard Edition Documentation, Version 1.4.2, Class java.awt.events.KeyEvent. Sun Microsystems. Available at http://java.sun.com/j2se/1.4.2/docs/api/java/awt/event/KeyEvent.html.
[Keys enumeration for .Net]
.NET Framework Class Library, Keys Enumeration. Microsoft. Available at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWindowsFormsKeysClassTopic.asp.
[XHTML 1.0]
XHTML 1.0: The Extensible HyperText Markup Language (Second Edition), S. Pemberton, et al., Authors. World Wide Web Consortium, August 2002. This version of the XHTML 1.0 Recommendation is http://www.w3.org/TR/2002/REC-xhtml1-20020801. The latest version of XHTML 1.0 is available at http://www.w3.org/TR/xhtml1.
[XML 1.0]
Extensible Markup Language (XML) 1.0, T. Bray, J. Paoli, C. M. Sperberg-McQueen, et. al, Editors. World Wide Web Consortium, August 2006. This version of the XML 1.0 Recommendation is http://www.w3.org/TR/2006/REC-xml-20060816. The latest version of XML 1.0 is available at http://www.w3.org/TR/xml.