[W3C] Document Object Model (DOM) Level 3 Events Specification Version 1.0 W3C Working Draft 01 September, 2000 This version: http://www.w3.org/TR/2000/WD-DOM-Level-3-Events-20000901 ( PostScript file, PDF file, plain text, ZIP file) Latest version: http://www.w3.org/TR/DOM-Level-3-Events Editors: Philippe Le Hégaret, W3C, team contact Tom Pixley, Netscape Communications Corporation Copyright © 2000 W3C® (MIT, INRIA, Keio), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply. ---------------------------------------------------------------------------- Abstract This specification defines the Document Object Model Events Level 3, a platform- and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure and style of documents. The Document Object Model Events Level 3 builds on the Document Object Model Events Level 2. Status of this document This document is a preliminary version of the Level 3 API. It is a W3C Working Draft for review by W3C members and other interested parties and acts as a starting point for the future DOM Working Group, should it be approved or not by the W3C Members. It is a draft document and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use W3C Working Drafts as reference material or to cite them as other than "work in progress". Comments on this document are invited and are to be sent to the public mailing list www-dom@w3.org. An archive is available at http://lists.w3.org/Archives/Public/www-dom/. This document has been produced as part of the W3C DOM Activity. The authors of this document are the DOM WG members. Different modules of the Document Object Model have different editors. A list of current W3C Recommendations and other technical documents can be found at http://www.w3.org/TR. Table of contents * Expanded Table of Contents * Copyright Notice * 1. Document Object Model Events * Appendix A: IDL Definitions * Appendix B: Java Language Binding * Appendix C: ECMA Script Language Binding * References * Index 01 September, 2000 Expanded Table of Contents * Expanded Table of Contents * Copyright Notice o W3C Document Copyright Notice and License o W3C Software Copyright Notice and License * 1. Document Object Model Events o 1.1. Level 3 Events Overview o 1.2. Level 3 Events Interfaces + 1.2.1. Key events + 1.2.2. EventListener Grouping o 1.3. Issues * Appendix A: IDL Definitions * Appendix B: Java Language Binding * Appendix C: ECMA Script Language Binding * References o 1. Normative references * Index 01 September, 2000 Copyright Notice Copyright © 2000 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. This document is published under the W3C Document Copyright Notice and License. The bindings within this document are published under the W3C Software Copyright Notice and License. The software license requires "Notice of any changes or modifications to the W3C files, including the date changes were made." Consequently, modified versions of the DOM bindings must document that they do not conform to the W3C standard; in the case of the IDL binding, the pragma prefix can no longer be 'w3c.org'; in the case of the Java binding, the package names can no longer be in the 'org.w3c' package. W3C Document Copyright Notice and License Note: This section is a copy of the W3C Document Notice and License and could be found at http://www.w3.org/Consortium/Legal/copyright-documents-19990405. Copyright © 1994-2000 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/ Public documents on the W3C site are provided by the copyright holders under the following license. The software or Document Type Definitions (DTDs) associated with W3C specifications are governed by the Software Notice. By using and/or copying this document, or the W3C document from which this statement is linked, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions: Permission to use, copy, and distribute the contents of this document, or the W3C document from which this statement is linked, in any medium for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the document, or portions thereof, that you use: 1. A link or URL to the original W3C document. 2. The pre-existing copyright notice of the original author, or if it doesn't exist, a notice of the form: "Copyright © [$date-of-document] World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/" (Hypertext is preferred, but a textual representation is permitted.) 3. If it exists, the STATUS of the W3C document. When space permits, inclusion of the full text of this NOTICE should be provided. We request that authorship attribution be provided in any software, documents, or other items or products that you create pursuant to the implementation of the contents of this document, or any portion thereof. No right to create modifications or derivatives of W3C documents is granted pursuant to this license. However, if additional requirements (documented in the Copyright FAQ) are satisfied, the right to create modifications or derivatives is sometimes granted by the W3C to individuals complying with those requirements. THIS DOCUMENT IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE SUITABLE FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF. The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to this document or its contents without specific, written prior permission. Title to copyright in this document will at all times remain with copyright holders. W3C Software Copyright Notice and License Note: This section is a copy of the W3C Software Copyright Notice and License and could be found at http://www.w3.org/Consortium/Legal/copyright-software-19980720 Copyright © 1994-2000 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/ This W3C work (including software, documents, or other related items) is being provided by the copyright holders under the following license. By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions: Permission to use, copy, and modify this software and its documentation, with or without modification, for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications, that you make: 1. The full text of this NOTICE in a location viewable to users of the redistributed or derivative work. 2. Any pre-existing intellectual property disclaimers. If none exist, then a notice of the following form: "Copyright © [$date-of-software] World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/." 3. Notice of any changes or modifications to the W3C files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.) THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION. The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders. 01 September, 2000 1. Document Object Model Events Editors Tom Pixley, Netscape Communications Corporation Table of contents * 1.1. Level 3 Events Overview * 1.2. Level 3 Events Interfaces o 1.2.1. Key events + KeyEvent o 1.2.2. EventListener Grouping + EventGroup, EventTargetGroup, EventGrouped, DocumentEventGroup * 1.3. Issues 1.1. Level 3 Events Overview The goal of the DOM Level 3 Events specification is to expand upon the functionality specified in the DOM Level 2 Event Specification. The specification does this by adding new interfaces which are complimentary to the interfaces defined in the DOM Level 2 Event Specification as well as adding new event sets to those already defined. This specification requires the previously designed interfaces in order to be functional. It is not designed to be standalone. These interfaces are not designed to supercede the interfaces already provided but instead to add to the functionality contained within them. 1.2. Level 3 Events Interfaces 1.2.1. Key events A DOM consumer can use the hasFeature of the DOMImplementation interface to determine whether the Key event set has been implemented by a DOM implementation. The feature string for this event set is "KeyEvents". This string is also used with the createEvent method. Interface KeyEvent (introduced in DOM Level 3) The KeyEvent interface provides specific contextual information associated with Key Events. The detail attribute inherited from UIEvent is used to indicated the number of keypresses which have occurred during key repetition. If this information is not available this value should be 0. IDL Definition // Introduced in DOM Level 3: interface KeyEvent : UIEvent { // VirtualKeyCode const unsigned long DOM_VK_UNDEFINED = 0x0; const unsigned long DOM_VK_RIGHT_ALT = 0x12; const unsigned long DOM_VK_LEFT_ALT = 0x12; const unsigned long DOM_VK_LEFT_CONTROL = 0x11; const unsigned long DOM_VK_RIGHT_CONTROL = 0x11; const unsigned long DOM_VK_LEFT_SHIFT = 0x10; const unsigned long DOM_VK_RIGHT_SHIFT = 0x10; const unsigned long DOM_VK_META = 0x9D; const unsigned long DOM_VK_BACK_SPACE = 0x08; const unsigned long DOM_VK_CAPS_LOCK = 0x14; const unsigned long DOM_VK_DELETE = 0x7F; const unsigned long DOM_VK_END = 0x23; const unsigned long DOM_VK_ENTER = 0x0D; const unsigned long DOM_VK_ESCAPE = 0x1B; const unsigned long DOM_VK_HOME = 0x24; const unsigned long DOM_VK_NUM_LOCK = 0x90; const unsigned long DOM_VK_PAUSE = 0x13; const unsigned long DOM_VK_PRINTSCREEN = 0x9A; const unsigned long DOM_VK_SCROLL_LOCK = 0x91; const unsigned long DOM_VK_SPACE = 0x20; const unsigned long DOM_VK_TAB = 0x09; const unsigned long DOM_VK_LEFT = 0x25; const unsigned long DOM_VK_RIGHT = 0x27; const unsigned long DOM_VK_UP = 0x26; const unsigned long DOM_VK_DOWN = 0x28; const unsigned long DOM_VK_PAGE_DOWN = 0x22; const unsigned long DOM_VK_PAGE_UP = 0x21; const unsigned long DOM_VK_F1 = 0x70; const unsigned long DOM_VK_F2 = 0x71; const unsigned long DOM_VK_F3 = 0x72; const unsigned long DOM_VK_F4 = 0x73; const unsigned long DOM_VK_F5 = 0x74; const unsigned long DOM_VK_F6 = 0x75; const unsigned long DOM_VK_F7 = 0x76; const unsigned long DOM_VK_F8 = 0x77; const unsigned long DOM_VK_F9 = 0x78; const unsigned long DOM_VK_F10 = 0x79; const unsigned long DOM_VK_F11 = 0x7A; const unsigned long DOM_VK_F12 = 0x7B; const unsigned long DOM_VK_F13 = 0xF000; const unsigned long DOM_VK_F14 = 0xF001; const unsigned long DOM_VK_F15 = 0xF002; const unsigned long DOM_VK_F16 = 0xF003; const unsigned long DOM_VK_F17 = 0xF004; const unsigned long DOM_VK_F18 = 0xF005; const unsigned long DOM_VK_F19 = 0xF006; const unsigned long DOM_VK_F20 = 0xF007; const unsigned long DOM_VK_F21 = 0xF008; const unsigned long DOM_VK_F22 = 0xF009; const unsigned long DOM_VK_F23 = 0xF00A; const unsigned long DOM_VK_F24 = 0xF00B; attribute DOMString outputString; attribute unsigned long keyVal; attribute unsigned long virtKeyVal; attribute boolean inputGenerated; attribute boolean numPad; boolean GetModifier(in unsigned long modifer); void initKeyEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in views::AbstractView viewArg, in unsigned short detailArg, in DOMString outputStringArg, in unsigned long keyValArg, in unsigned long virtKeyValArg, in boolean inputGeneratedArg, in boolean numPadArg); }; Definition group VirtualKeyCode An integer indicating which key was pressed. Defined Constants DOM_VK_BACK_SPACE DOM_VK_CAPS_LOCK DOM_VK_DELETE DOM_VK_DOWN DOM_VK_END DOM_VK_ENTER DOM_VK_ESCAPE DOM_VK_F1 Constant for the F1 function key. DOM_VK_F10 Constant for the F10 function key. DOM_VK_F11 Constant for the F11 function key. DOM_VK_F12 Constant for the F12 function key. DOM_VK_F13 Constant for the F13 function key. DOM_VK_F14 Constant for the F14 function key. DOM_VK_F15 Constant for the F15 function key. DOM_VK_F16 Constant for the F16 function key. DOM_VK_F17 Constant for the F17 function key. DOM_VK_F18 Constant for the F18 function key. DOM_VK_F19 Constant for the F19 function key. DOM_VK_F2 Constant for the F2 function key. DOM_VK_F20 Constant for the F20 function key. DOM_VK_F21 Constant for the F21 function key. DOM_VK_F22 Constant for the F22 function key. DOM_VK_F23 Constant for the F23 function key. DOM_VK_F24 Constant for the F24 function key. DOM_VK_F3 Constant for the F3 function key. DOM_VK_F4 Constant for the F4 function key. DOM_VK_F5 Constant for the F5 function key. DOM_VK_F6 Constant for the F6 function key. DOM_VK_F7 Constant for the F7 function key. DOM_VK_F8 Constant for the F8 function key. DOM_VK_F9 Constant for the F9 function key. DOM_VK_HOME DOM_VK_LEFT DOM_VK_LEFT_ALT This key is modifier key DOM_VK_LEFT_CONTROL This key is modifier key DOM_VK_LEFT_SHIFT This key is modifier key DOM_VK_META This key is modifier key DOM_VK_NUM_LOCK DOM_VK_PAGE_DOWN DOM_VK_PAGE_UP DOM_VK_PAUSE DOM_VK_PRINTSCREEN DOM_VK_RIGHT DOM_VK_RIGHT_ALT This key is modifier key DOM_VK_RIGHT_CONTROL This key is modifier key DOM_VK_RIGHT_SHIFT This key is modifier key DOM_VK_SCROLL_LOCK DOM_VK_SPACE DOM_VK_TAB DOM_VK_UNDEFINED Used for key events which do not have a virtual key code available. DOM_VK_UP Attributes inputGenerated of type boolean The inputGenerated attribute indicates whether the key event will normally cause visible output. If the key event does not generate any visible output, such as the use of a function key or the combination of certain modifier keys used in conjunction with another key, then the value will be false. If visible output is normally generated by the key event then the value will be true. The value of inputGenerated does not guarantee the creation of a character. If a key event causing visible output is cancelable it may be prevented from causing output. This attribute is intended primarily to differentiate between keys events which may or may not produce visible output depending on the system state. keyVal of type unsigned long The value of keyVal holds the value of the Unicode character associated with the depressed key. If the key has no Unicode representation or no Unicode character is available the value is 0.. numPad of type boolean The numPad attribute indicates whether or not the key event was generated on the number pad section of the keyboard. If the number pad was used to generate the key event the value is true, otherwise the value is false. outputString of type DOMString outputString holds the value of the output generated by the key event. This may be a single Unicode character or it may be a string. It may also be null in the case where no output was generated by the key event. virtKeyVal of type unsigned long When the key associated with a key event is not representable via a Unicode character virtKeyVale holds the virtual key code associated with the depressed key. If the key has a Unicode representation or no virtual code is available the value is DOM_VK_UNDEFINED. Methods GetModifier The GetModifier method is used to check the status of a single modifier key associated with a KeyEvent. The identifier of the modifier in question is passed into the GetModifier function. If the modifier is triggered it will return true. If not, it will return false. The list of keys below represents the allowable modifier paramaters for this method. + DOM_VK_LEFT_ALT + DOM_VK_RIGHT_ALT + DOM_VK_LEFT_CONTROL + DOM_VK_RIGHT_CONTROL + DOM_VK_LEFT_SHIFT + DOM_VK_RIGHT_SHIFT + DOM_VK_META Parameters modifer of type unsigned long The modifier which the user wishes to query Return Value boolean No Exceptions initKeyEvent Issue modifier: why no modifiers parameter to the initKeyEvent? Parameters typeArg of type DOMString Specifies the event type. canBubbleArg of type boolean Specifies whether or not the event can bubble. cancelableArg of type boolean Specifies whether or not the event's default action can be prevent. viewArg of type views::AbstractView Specifies the KeyEvent's AbstractView. detailArg of type unsigned short Specifies the number of repeated keypresses, if available. outputStringArg of type DOMString Specifies the KeyEvent's outputString attribute keyValArg of type unsigned long Specifies the KeyEvent's keyValattribute virtKeyValArg of type unsigned long Specifies the KeyEvent's virtKeyValattribute inputGeneratedArg of type boolean Specifies the KeyEvent's inputGeneratedattribute numPadArg of type boolean Specifies the KeyEvent's numPadattribute No Return Value No Exceptions The different types of Key events that can occur are: keypress The keypress event occurs when a key is pressed. If the key remains depressed, multiple keypresses may be generated. This event maps not to the physical depression of the key but is instead the result of that action, often being the insertion of a character. o Bubbles: Yes o Cancelable: Yes keydown The keydown event occurs when a key is pressed down. o Bubbles: Yes o Cancelable: Yes keyup The keyup event occurs when a key is released. o Bubbles: Yes o Cancelable: Yes 1.2.2. EventListener Grouping EventListener grouping is intended to allow groups of EventListeners to be registered which will each have independent event flow within them which is not affected by changes to event flow in any other group. This may be used to control events separately in multiple views on a document. It may also be used to develop an application which uses events without the problem of possible interference by other applications running within the same document. The new interfaces added for EventListener grouping should now interfere with the interfaces established in the Level 2 DOM. Interface EventGroup The EventGroup interface is simply a placeholder for separating the event flows when there are multiple groups of listeners for a DOM tree. Event listeners can be registered without an EventGroup using the existing EventTarget interface, or with an associated EventGroup using the new EventTargetGroup interface. When an event is dispatched, it is dispatched independently to each EventGroup. In particular, thestopPropagation method of the Event interface only stops propagation for event listeners without an associated EventGroup. Correspondingly, the stopPropagation method of EventGrouped only stops propagatation for event listeners within the specified EventGroup. IDL Definition interface EventGroup { }; Interface EventTargetGroup The EventTargetGroup interface is implemented by the same set of objects that implement the EventTarget interface, namely all EventTargets in in implementation which supports the Event model and the EventGroup extension. IDL Definition interface EventTargetGroup { void addEventListener(in DOMString type, in EventListener listener, in boolean useCapture, in EventGroup eventGroup); void removeEventListener(in DOMString type, in EventListener listener, in boolean useCapture, in EventGroup eventGroup); }; Methods addEventListener This method is equivalent to the addEventListener method of the EventTarget interface, with the exception of the added eventGroup parameter. The listener is registered with this EventGroup associated. Parameters type of type DOMString listener of type EventListener useCapture of type boolean eventGroup of type EventGroup The EventGroup to associate with the listener. No Return Value No Exceptions removeEventListener This method is equivalent to the removeEventListener method of the EventTarget interface, with the exception of the added eventGroup parameter. The listener registered with this EventGroup associated is removed. Parameters type of type DOMString listener of type EventListener useCapture of type boolean eventGroup of type EventGroup The EventGroup to associate with the listener. No Return Value No Exceptions Interface EventGrouped The EventGrouped interface is implemented by all Event objects. IDL Definition interface EventGrouped { void stopPropagation(in EventGroup eventGroup); }; Methods stopPropagation The stopPropagation method is used prevent further propagation of an event during event flow within an EventGroup. If this method is called by any EventListener the event will cease propagating through the tree within the specified EventGroup. The event will complete dispatch to all listeners on the current EventTarget before event flow stops. This method may be used during any stage of event flow. Event propagation for other EventGroups, or listeners not associated with any EventGroup, is not affected. Parameters eventGroup of type EventGroup The EventGroup in which to stop event propagation. No Return Value No Exceptions Interface DocumentEventGroup The DocumentEventGroup interface provides a mechanism by which the user can create an EventGroup of a type supported by the implementation. It is expected that the DocumentEvent interface will be implemented on the same object which implements the Documentinterface in an implementation which supports the EventGroupextension. IDL Definition interface DocumentEventGroup { EventGroup createEventGroup(); }; Methods createEventGroup This method creates a new EventGroup for use in the addEventListener and removeEventListener methods of the EventTargetGroup interface. Return Value EventGroup The newly created EventGroup. No Parameters No Exceptions 1.3. Issues Issue getModifier: Why is modifier state exposed through a method rather than an attribute? Issue ISO-IEC-9995: Upon what do you base the set of virtual keycodes as well as their values? Have you coordinated this set with that defined by ISO/IEC 9995 which addresses various Keyboard symbol issues. Issue ISO-IEC-14755: Review ISO/IEC 14755 "Input methods to enter characters from the repertoire of ISO/IEC 10646 with a keyboard or other input device" to insure that the treatment of input state is consistent with that expected by current practice when it comes to platforms which support input methods. Issue offsets: (This issue is related with mouse events and Views?) it would be useful if MouseEvent class had a property that would enable listners to learn about coordinates of the event within the element's own coordinate system. 01 September, 2000 Appendix A: IDL Definitions This appendix contains the complete OMG IDL [OMGIDL] for the Level 3 Document Object Model Events definitions. The IDL files are also available as: http://www.w3.org/TR/2000/WD-DOM-Level-3-Events-20000901/idl.zip 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::EventListener EventListener; typedef dom::UIEvent UIEvent; interface EventGroup { }; interface EventTargetGroup { void addEventListener(in DOMString type, in EventListener listener, in boolean useCapture, in EventGroup eventGroup); void removeEventListener(in DOMString type, in EventListener listener, in boolean useCapture, in EventGroup eventGroup); }; interface EventGrouped { void stopPropagation(in EventGroup eventGroup); }; interface DocumentEventGroup { EventGroup createEventGroup(); }; // Introduced in DOM Level 3: interface KeyEvent : UIEvent { // VirtualKeyCode const unsigned long DOM_VK_UNDEFINED = 0x0; const unsigned long DOM_VK_RIGHT_ALT = 0x12; const unsigned long DOM_VK_LEFT_ALT = 0x12; const unsigned long DOM_VK_LEFT_CONTROL = 0x11; const unsigned long DOM_VK_RIGHT_CONTROL = 0x11; const unsigned long DOM_VK_LEFT_SHIFT = 0x10; const unsigned long DOM_VK_RIGHT_SHIFT = 0x10; const unsigned long DOM_VK_META = 0x9D; const unsigned long DOM_VK_BACK_SPACE = 0x08; const unsigned long DOM_VK_CAPS_LOCK = 0x14; const unsigned long DOM_VK_DELETE = 0x7F; const unsigned long DOM_VK_END = 0x23; const unsigned long DOM_VK_ENTER = 0x0D; const unsigned long DOM_VK_ESCAPE = 0x1B; const unsigned long DOM_VK_HOME = 0x24; const unsigned long DOM_VK_NUM_LOCK = 0x90; const unsigned long DOM_VK_PAUSE = 0x13; const unsigned long DOM_VK_PRINTSCREEN = 0x9A; const unsigned long DOM_VK_SCROLL_LOCK = 0x91; const unsigned long DOM_VK_SPACE = 0x20; const unsigned long DOM_VK_TAB = 0x09; const unsigned long DOM_VK_LEFT = 0x25; const unsigned long DOM_VK_RIGHT = 0x27; const unsigned long DOM_VK_UP = 0x26; const unsigned long DOM_VK_DOWN = 0x28; const unsigned long DOM_VK_PAGE_DOWN = 0x22; const unsigned long DOM_VK_PAGE_UP = 0x21; const unsigned long DOM_VK_F1 = 0x70; const unsigned long DOM_VK_F2 = 0x71; const unsigned long DOM_VK_F3 = 0x72; const unsigned long DOM_VK_F4 = 0x73; const unsigned long DOM_VK_F5 = 0x74; const unsigned long DOM_VK_F6 = 0x75; const unsigned long DOM_VK_F7 = 0x76; const unsigned long DOM_VK_F8 = 0x77; const unsigned long DOM_VK_F9 = 0x78; const unsigned long DOM_VK_F10 = 0x79; const unsigned long DOM_VK_F11 = 0x7A; const unsigned long DOM_VK_F12 = 0x7B; const unsigned long DOM_VK_F13 = 0xF000; const unsigned long DOM_VK_F14 = 0xF001; const unsigned long DOM_VK_F15 = 0xF002; const unsigned long DOM_VK_F16 = 0xF003; const unsigned long DOM_VK_F17 = 0xF004; const unsigned long DOM_VK_F18 = 0xF005; const unsigned long DOM_VK_F19 = 0xF006; const unsigned long DOM_VK_F20 = 0xF007; const unsigned long DOM_VK_F21 = 0xF008; const unsigned long DOM_VK_F22 = 0xF009; const unsigned long DOM_VK_F23 = 0xF00A; const unsigned long DOM_VK_F24 = 0xF00B; attribute DOMString outputString; attribute unsigned long keyVal; attribute unsigned long virtKeyVal; attribute boolean inputGenerated; attribute boolean numPad; boolean GetModifier(in unsigned long modifer); void initKeyEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in views::AbstractView viewArg, in unsigned short detailArg, in DOMString outputStringArg, in unsigned long keyValArg, in unsigned long virtKeyValArg, in boolean inputGeneratedArg, in boolean numPadArg); }; }; #endif // _EVENTS_IDL_ 01 September, 2000 Appendix B: Java Language Binding This appendix contains the complete Java [Java] bindings for the Level 3 Document Object Model Events. The Java files are also available as http://www.w3.org/TR/2000/WD-DOM-Level-3-Events-20000901/java-binding.zip org/w3c/dom/events/KeyEvent.java: package org.w3c.dom.events; import org.w3c.dom.views.AbstractView; import org.w3c.dom.UIEvent; public interface KeyEvent extends UIEvent { // VirtualKeyCode public static final int DOM_VK_UNDEFINED = 0x0; public static final int DOM_VK_RIGHT_ALT = 0x12; public static final int DOM_VK_LEFT_ALT = 0x12; public static final int DOM_VK_LEFT_CONTROL = 0x11; public static final int DOM_VK_RIGHT_CONTROL = 0x11; public static final int DOM_VK_LEFT_SHIFT = 0x10; public static final int DOM_VK_RIGHT_SHIFT = 0x10; public static final int DOM_VK_META = 0x9D; public static final int DOM_VK_BACK_SPACE = 0x08; public static final int DOM_VK_CAPS_LOCK = 0x14; public static final int DOM_VK_DELETE = 0x7F; public static final int DOM_VK_END = 0x23; public static final int DOM_VK_ENTER = 0x0D; public static final int DOM_VK_ESCAPE = 0x1B; public static final int DOM_VK_HOME = 0x24; public static final int DOM_VK_NUM_LOCK = 0x90; public static final int DOM_VK_PAUSE = 0x13; public static final int DOM_VK_PRINTSCREEN = 0x9A; public static final int DOM_VK_SCROLL_LOCK = 0x91; public static final int DOM_VK_SPACE = 0x20; public static final int DOM_VK_TAB = 0x09; public static final int DOM_VK_LEFT = 0x25; public static final int DOM_VK_RIGHT = 0x27; public static final int DOM_VK_UP = 0x26; public static final int DOM_VK_DOWN = 0x28; public static final int DOM_VK_PAGE_DOWN = 0x22; public static final int DOM_VK_PAGE_UP = 0x21; public static final int DOM_VK_F1 = 0x70; public static final int DOM_VK_F2 = 0x71; public static final int DOM_VK_F3 = 0x72; public static final int DOM_VK_F4 = 0x73; public static final int DOM_VK_F5 = 0x74; public static final int DOM_VK_F6 = 0x75; public static final int DOM_VK_F7 = 0x76; public static final int DOM_VK_F8 = 0x77; public static final int DOM_VK_F9 = 0x78; public static final int DOM_VK_F10 = 0x79; public static final int DOM_VK_F11 = 0x7A; public static final int DOM_VK_F12 = 0x7B; public static final int DOM_VK_F13 = 0xF000; public static final int DOM_VK_F14 = 0xF001; public static final int DOM_VK_F15 = 0xF002; public static final int DOM_VK_F16 = 0xF003; public static final int DOM_VK_F17 = 0xF004; public static final int DOM_VK_F18 = 0xF005; public static final int DOM_VK_F19 = 0xF006; public static final int DOM_VK_F20 = 0xF007; public static final int DOM_VK_F21 = 0xF008; public static final int DOM_VK_F22 = 0xF009; public static final int DOM_VK_F23 = 0xF00A; public static final int DOM_VK_F24 = 0xF00B; public String getOutputString(); public void setOutputString(String outputString); public int getKeyVal(); public void setKeyVal(int keyVal); public int getVirtKeyVal(); public void setVirtKeyVal(int virtKeyVal); public boolean getInputGenerated(); public void setInputGenerated(boolean inputGenerated); public boolean getNumPad(); public void setNumPad(boolean numPad); public boolean GetModifier(int modifer); public void initKeyEvent(String typeArg, boolean canBubbleArg, boolean cancelableArg, AbstractView viewArg, short detailArg, String outputStringArg, int keyValArg, int virtKeyValArg, boolean inputGeneratedArg, boolean numPadArg); } org/w3c/dom/events/EventGroup.java: package org.w3c.dom.events; public interface EventGroup { } org/w3c/dom/events/EventTargetGroup.java: package org.w3c.dom.events; import org.w3c.dom.EventListener; public interface EventTargetGroup { public void addEventListener(String type, EventListener listener, boolean useCapture, EventGroup eventGroup); public void removeEventListener(String type, EventListener listener, boolean useCapture, EventGroup eventGroup); } org/w3c/dom/events/EventGrouped.java: package org.w3c.dom.events; public interface EventGrouped { public void stopPropagation(EventGroup eventGroup); } org/w3c/dom/events/DocumentEventGroup.java: package org.w3c.dom.events; public interface DocumentEventGroup { public EventGroup createEventGroup(); } 01 September, 2000 Appendix C: ECMA Script Language Binding This appendix contains the complete ECMA Script [ECMAScript] binding for the Level 3 Document Object Model Events definitions. Class KeyEvent The KeyEvent class has the following constants: KeyEvent.DOM_VK_UNDEFINED This constant is of type int and its value is 0x0. KeyEvent.DOM_VK_RIGHT_ALT This constant is of type int and its value is 0x12. KeyEvent.DOM_VK_LEFT_ALT This constant is of type int and its value is 0x12. KeyEvent.DOM_VK_LEFT_CONTROL This constant is of type int and its value is 0x11. KeyEvent.DOM_VK_RIGHT_CONTROL This constant is of type int and its value is 0x11. KeyEvent.DOM_VK_LEFT_SHIFT This constant is of type int and its value is 0x10. KeyEvent.DOM_VK_RIGHT_SHIFT This constant is of type int and its value is 0x10. KeyEvent.DOM_VK_META This constant is of type int and its value is 0x9D. KeyEvent.DOM_VK_BACK_SPACE This constant is of type int and its value is 0x08. KeyEvent.DOM_VK_CAPS_LOCK This constant is of type int and its value is 0x14. KeyEvent.DOM_VK_DELETE This constant is of type int and its value is 0x7F. KeyEvent.DOM_VK_END This constant is of type int and its value is 0x23. KeyEvent.DOM_VK_ENTER This constant is of type int and its value is 0x0D. KeyEvent.DOM_VK_ESCAPE This constant is of type int and its value is 0x1B. KeyEvent.DOM_VK_HOME This constant is of type int and its value is 0x24. KeyEvent.DOM_VK_NUM_LOCK This constant is of type int and its value is 0x90. KeyEvent.DOM_VK_PAUSE This constant is of type int and its value is 0x13. KeyEvent.DOM_VK_PRINTSCREEN This constant is of type int and its value is 0x9A. KeyEvent.DOM_VK_SCROLL_LOCK This constant is of type int and its value is 0x91. KeyEvent.DOM_VK_SPACE This constant is of type int and its value is 0x20. KeyEvent.DOM_VK_TAB This constant is of type int and its value is 0x09. KeyEvent.DOM_VK_LEFT This constant is of type int and its value is 0x25. KeyEvent.DOM_VK_RIGHT This constant is of type int and its value is 0x27. KeyEvent.DOM_VK_UP This constant is of type int and its value is 0x26. KeyEvent.DOM_VK_DOWN This constant is of type int and its value is 0x28. KeyEvent.DOM_VK_PAGE_DOWN This constant is of type int and its value is 0x22. KeyEvent.DOM_VK_PAGE_UP This constant is of type int and its value is 0x21. KeyEvent.DOM_VK_F1 This constant is of type int and its value is 0x70. KeyEvent.DOM_VK_F2 This constant is of type int and its value is 0x71. KeyEvent.DOM_VK_F3 This constant is of type int and its value is 0x72. KeyEvent.DOM_VK_F4 This constant is of type int and its value is 0x73. KeyEvent.DOM_VK_F5 This constant is of type int and its value is 0x74. KeyEvent.DOM_VK_F6 This constant is of type int and its value is 0x75. KeyEvent.DOM_VK_F7 This constant is of type int and its value is 0x76. KeyEvent.DOM_VK_F8 This constant is of type int and its value is 0x77. KeyEvent.DOM_VK_F9 This constant is of type int and its value is 0x78. KeyEvent.DOM_VK_F10 This constant is of type int and its value is 0x79. KeyEvent.DOM_VK_F11 This constant is of type int and its value is 0x7A. KeyEvent.DOM_VK_F12 This constant is of type int and its value is 0x7B. KeyEvent.DOM_VK_F13 This constant is of type int and its value is 0xF000. KeyEvent.DOM_VK_F14 This constant is of type int and its value is 0xF001. KeyEvent.DOM_VK_F15 This constant is of type int and its value is 0xF002. KeyEvent.DOM_VK_F16 This constant is of type int and its value is 0xF003. KeyEvent.DOM_VK_F17 This constant is of type int and its value is 0xF004. KeyEvent.DOM_VK_F18 This constant is of type int and its value is 0xF005. KeyEvent.DOM_VK_F19 This constant is of type int and its value is 0xF006. KeyEvent.DOM_VK_F20 This constant is of type int and its value is 0xF007. KeyEvent.DOM_VK_F21 This constant is of type int and its value is 0xF008. KeyEvent.DOM_VK_F22 This constant is of type int and its value is 0xF009. KeyEvent.DOM_VK_F23 This constant is of type int and its value is 0xF00A. KeyEvent.DOM_VK_F24 This constant is of type int and its value is 0xF00B. Object KeyEvent KeyEvent has the all the properties and methods of UIEvent as well as the properties and methods defined below. The KeyEvent object has the following properties: outputString This property is of type String. keyVal This property is of type int. virtKeyVal This property is of type int. inputGenerated This property is of type boolean. numPad This property is of type boolean. The KeyEvent object has the following methods: GetModifier(modifer) This method returns a boolean. The modifer parameter is of type int. initKeyEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg, outputStringArg, keyValArg, virtKeyValArg, inputGeneratedArg, numPadArg) This method has no return value. The typeArg parameter is of type String. The canBubbleArg parameter is of type boolean. The cancelableArg parameter is of type boolean. The viewArg parameter is of type AbstractView. The detailArg parameter is of type short. The outputStringArg parameter is of type String. The keyValArg parameter is of type int. The virtKeyValArg parameter is of type int. The inputGeneratedArg parameter is of type boolean. The numPadArg parameter is of type boolean. Object EventGroup Object EventTargetGroup The EventTargetGroup object has the following methods: addEventListener(type, listener, useCapture, eventGroup) This method has no return value. The type parameter is of type String. The listener parameter is of type EventListener. The useCapture parameter is of type boolean. The eventGroup parameter is of type EventGroup. removeEventListener(type, listener, useCapture, eventGroup) This method has no return value. The type parameter is of type String. The listener parameter is of type EventListener. The useCapture parameter is of type boolean. The eventGroup parameter is of type EventGroup. Object EventGrouped The EventGrouped object has the following methods: stopPropagation(eventGroup) This method has no return value. The eventGroup parameter is of type EventGroup. Object DocumentEventGroup The DocumentEventGroup object has the following methods: createEventGroup() This method returns a EventGroup. 01 September, 2000 References For the latest version of any W3C specification please consult the list of W3C Technical Reports available at http://www.w3.org/TR. D.1: Normative references ECMAScript ECMA (European Computer Manufacturers Association) ECMAScript Language Specification. Available at http://www.ecma.ch/ecma1/STAND/ECMA-262.HTM Java Sun Microsystems Inc. The Java Language Specification, James Gosling, Bill Joy, and Guy Steele, September 1996. Available at http://java.sun.com/docs/books/jls OMGIDL OMG (Object Management Group) IDL (Interface Definition Language) defined in The Common Object Request Broker: Architecture and Specification, version 2.3.1, October 1999. Available at http://sisyphus.omg.org/technology/documents/formal/corba_2.htm 01 September, 2000 Index addEventListener createEventGroup DocumentEventGroup DOM_VK_BACK_SPACE DOM_VK_CAPS_LOCK DOM_VK_DELETE DOM_VK_DOWN DOM_VK_END DOM_VK_ENTER DOM_VK_ESCAPE DOM_VK_F1 DOM_VK_F10 DOM_VK_F11 DOM_VK_F12 DOM_VK_F13 DOM_VK_F14 DOM_VK_F15 DOM_VK_F16 DOM_VK_F17 DOM_VK_F18 DOM_VK_F19 DOM_VK_F2 DOM_VK_F20 DOM_VK_F21 DOM_VK_F22 DOM_VK_F23 DOM_VK_F24 DOM_VK_F3 DOM_VK_F4 DOM_VK_F5 DOM_VK_F6 DOM_VK_F7 DOM_VK_F8 DOM_VK_F9 DOM_VK_HOME DOM_VK_LEFT DOM_VK_LEFT_ALT DOM_VK_LEFT_CONTROL DOM_VK_LEFT_SHIFT DOM_VK_META DOM_VK_NUM_LOCK DOM_VK_PAGE_DOWN DOM_VK_PAGE_UP DOM_VK_PAUSE DOM_VK_PRINTSCREEN DOM_VK_RIGHT DOM_VK_RIGHT_ALT DOM_VK_RIGHT_CONTROLDOM_VK_RIGHT_SHIFT DOM_VK_SCROLL_LOCK DOM_VK_SPACE DOM_VK_TAB DOM_VK_UNDEFINED DOM_VK_UP ECMAScript EventGroup EventGrouped EventTargetGroup GetModifier initKeyEvent inputGenerated Java KeyEvent keyVal numPad OMGIDL outputString removeEventListener stopPropagation virtKeyVal