Warning:
This wiki has been archived and is now read-only.
DOM3 Events Semantic Requirements
From WEBAPPS
WebApps ⇨ DOM3Events ⇨ DOM3 Events Semantic Requirements
Contents
Conformance
- A DOM application may use the hasFeature(feature, version) method of the DOMImplementation interface with parameter values "Events" and "3.0" (respectively).
- An implementation that returns true for "Events" and "3.0" will also return true for the parameters "Events" and "2.0".
Event Types
- Each event is associated with a type, called event type.
- The event type is composed of a local name and a namespace URI.
- All events defined in this specification are in no namespace.
Basic interfaces
Event
- An object which implements the
Eventinterface is passed as the parameter to anEventListener. - To create an instance of the Event interface, use the DocumentEvent.createEvent("Event") method call.
- The
defaultPreventedattribute is used to indicate whether Event.preventDefault() has been called for this event. - The
namespaceURIattribute indicates the associated with this event at initialization time. - The
initEventNSmethod initializes the attributes of anEventobject. - the
namespaceURIArgof theinitEventNSmethod specifies the namespace URI associated with this event. - If no namespace is available for the
namesapaceURIArg, then it's value isnull. - The
stopImmediatePropagationmethod prevents other event listeners from being triggered. - The effects of the
stopImmediatePropagationmethod are immediate. - The
stopImmediatePropagationmethod does not prevent the default action from being invoked.
CustomEvent
- The
CustomEventallows 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 theDocumentEvent.createEvent("CustomEvent")method call. - The
initCustomEventNSmethod initializes attributes of a CustomEvent object.
EventTarget
- The
addEventListenerNSmethod registers an event listener, depending on the useCapture parameter. - The
namespaceURIof theaddEventListenerNSmethod specifies the Event.namespaceURI associated with the event for which the user is registering. - The
typeparameter of theaddEventListenerNSmethod specifies the Event type associated with the event for which the user is registering. - The
listenerparameter of theaddEventListenerNSmethod takes an object implemented by the user which implements the EventListener interface and contains the method to be called when the event occurs. - If the
useCaptureparameter of theaddEventListenerNSmethod set to "true" indicates that the user wishes to add the event listener for the capture phase only. - If the
useCaptureparameter of theaddEventListenerNSmethod set to "false" indicates that the event will be triggered during the target and bubbling phases. - The
dispatchEventmethod dispatches an event into the implementation's event model. - The event target of the event is the EventTarget object on which dispatchEvent is called (dispatchEvent method).
- The
dispatchEventmethod raises an UNSPECIFIED_EVENT_TYPE_ERR exception if the Event.type was not specified by initializing the event before dispatchEvent was called. - The
dispatchEventmethod raises an EventException if the Event.type was set tonull - The
dispatchEventmethod raises a DISPATCH_REQUEST_ERR exception if the Event object is already being dispatched. - The
dispatchEventmethod raises an NOT_SUPPORTED_ERR exception if the Event object has not been created using DocumentEvent.createEvent(). - The
dispatchEventmethod raises an INVALID_CHARACTER_ERR exception if Event.type is not an NCName as defined in [XML Namespaces 1.1]. - The
removeEventListenerNSmethod removes an event listener. - Calling
removeEventListenerNSwith arguments which do not identify any currently registered EventListener on the EventTarget has no effect. - The
namespaceURIof theremoveEventListenerNSmethod Specifies the Event.namespaceURI associated with the event for which the user registered the event listener. - The
typeparameter of theremoveEventListenerNSmethod specifies the Event.type associated with the event for which the user is registering. - The
listenerparameter of theremoveEventListenerNSmethod takes an object implemented by the user which implements the EventListener interface and contains the method to be called when the event occurs. - The
removeEventListenerNSmethod removes an event listener. - Calling
removeEventListenerNSmethod with arguments which do not identify any currently registered EventListener on the EventTarget has no effect.
Event Creation
DocumentEvent
- The
canDispatchmethod tests if the implementation can generate events of a specified type. - The
canDispatchmethod returntrueif the implementation can dispatch the event. - The
canDispatchmethod returnfalseif the implementation can not dispatch the event. - The
namespaceURIparameter of thecanDispatchmethod specifies the Event.namespaceURI of the event. - The
typeparameter of thecanDispatchmethod specifies the Event.type of the event.
User Interface event types
UIEvent
- The
initUIEventNSmethod initializes attributes of an UIEvent object. - The
initUIEventNSmethod has the same behavior as Event.initEventNS(). - The
namespaceURIparameter of theinitUIEventNSmethod specifies Event.namespaceURI, the namespace URI associated with this event, or null if no namespace. - The
typeArgparameter of theinitUIEventNSmethod specifies Event.type, the local name of the event type. - The
canBubbleArgparameter of theinitUIEventNSmethod specifies Event.bubbles. This parameter overrides the intrinsic bubbling behavior of the event. - The
cancelableArgparameter of theinitUIEventNSmethod specifies Event.cancelable. This parameter overrides the intrinsic cancelable behavior of the event. - The
viewArgparameter of theinitUIEventNSmethod specifies UIEvent.view. - The
viewArgparameter of theinitUIEventNSmethod can benull - The
detailArgparameter of theinitUIEventNSmethod specifies UIEvent.detail.
Text events types
TextEvent
- The
TextEventinterface provides specific contextual information associated with Text Events. - To create an instance of the
TextEventinterface, use the DocumentEvent.createEvent("TextEvent") method call. - The
dataattribute holds the value of the characters generated by the character device. - The
dataattribute may be a single Unicode character or a non-empty sequence of Unicode characters. - The
dataattribute cannot be null or contain the empty string. - The
initTextEventmethod initializes attributes of a TextEvent object. - Invoking the
initTextEventmethod has the same behavior as UIEvent.initUIEvent(). - The value of UIEvent.detail remains undefined.
- The
typeArgparameter of theinitTextEventmethod specifies Event.type, the local name of the event type. - The
canBubbleArgparameter of theinitTextEventmethod specifies Event.bubbles. This parameter overrides the intrinsic bubbling behavior of the event. - The
cancelableArgparameter of theinitTextEventmethod specifies Event.cancelable. This parameter overrides the intrinsic cancelable behavior of the event. - The
viewArgparameter of theinitTextEventmethod specifies UIEvent.view. - The
viewArgparameter of theinitTextEventmethod may be null. - The
dataArgparameter of theinitTextEventmethod specifies TextEvent.data. - The
initTextEventNSmethod initializes attributes of a TextEvent object. - Invoking the
initTextEventNSmethod has the same behavior as UIEvent.initUIEventNS(). - The value of UIEvent.detail remains undefined.
- The
namespaceURIArgparameter of theinitTextEventNSmethod specifies Event.namespaceURI, the namespace URI associated with this event. - The
namespaceURIArgparameter value of theinitTextEventNSmethod may be null if no namespace. - The
typeArgparameter of theinitTextEventNSmethod specifies Event.type, the local name of the event type. - The
canBubbleArgparameter of theinitTextEventNSmethod specifies Event.bubbles. This parameter overrides the intrinsic bubbling behavior of the event. - The
cancelableArgparameter of theinitTextEventNSmethod specifies Event.cancelable. This parameter overrides the intrinsic cancelable behavior of the event. - The
viewArgparameter of theinitTextEventNSmethod specifies UIEvent.view. - The
viewArgparameter value of theinitTextEventNSmethod may be null. - The
dataArgparameter of theinitTextEventNSmethod specifies TextEvent.data.
Keyboard Event Types
KeyboardEvent
- The
KeyboardEventinterface provides specific contextual information associated with keyboard devices. - This interface provides convenient attributes for some common modifiers keys: KeyboardEvent.ctrlKey, KeyboardEvent.shiftKey, KeyboardEvent.altKey, KeyboardEvent.metaKey.
- The attributes mentioned above are equivalent to using the method KeyboardEvent.getModifierState(keyIdentifierArg) with "Control", "Shift", "Alt", or "Meta" respectively.
- To create an instance of the
KeyboardEventinterface, use the DocumentEvent.createEvent("KeyboardEvent") method call. - The constants:
DOM_KEY_LOCATION LEFT,DOM_KEY_LOCATION_NUMPAD,DOM_KEY_LOCATION_RIGHTandDOM_KEY_LOCATION_STANDARDare used to indicate the location of a key on the device. - Different constant values must be used in case a DOM implementation wishes to provide new location information.
- The
DOM_KEY_LOCATION_LEFTconstant value indicates that the key activated is in the left key location (there is more than one possible location for this key). - The
DOM_KEY_LOCATION_NUMPADconstant value indicates that the key activation originated on the numeric keypad or with a virtual key corresponding to the numeric keypad. - The
DOM_KEY_LOCATION_RIGHTconstant indicates The key activation is in the right key location (there is more than one possible location for this key). - The
DOM_KEY_LOCATION_STANDARDconstant indicates that the key activation is not distinguished as the left or right version of the key, and did not originate from the numeric keypad (or did not originate with a virtual key corresponding to the numeric keypad). - The
altKeyattribute is “true” if the alternative (Alt) key modifier is activated, otherwise the attribute will be “false”. - The
ctrlKeyattribute is “true” if the control (Ctrl) key modifier is activated, otherwise the attribute will be “false”. - The
keyIdentifierattribute holds the identifier of the key. - The
keyIdentifierattribute that is unable to identify a key must use the key identifier "Unidentified". - The
keyLocationattribute contains an indication of the location of the key on the device. - The
metaKeyattribute is “true” if the meta (Meta) key modifier is activated, otherwise the attribute will be “false”. - The
shiftKeyattribute is “true” if the shift (Shift) key modifier is activated, otherwise the attribute will be “false”. - The
getModifierStatemethod queries the state of a modifier using a key identifier. - The
getModifierStatemethod will return true if it is a modifier key and the modifier is activated. - The
getModifierStatemethod will return false if it is not a modifier key or if the modifier is not activated. - The
keyIdentifierArgparameter of thegetModifierStatemethod is a modifier key identifier. Common modifier keys are "Alt", "AltGraph", "CapsLock", "Control", "Meta", "NumLock", "Scroll", or "Shift". - The
initKeyboardEventmethod initializes attributes of aKeyboardEventobject. - The
typeArgparameter of theinitKeyboardEventmethod specifies Event.type, the local name of the event type. - The
canBubbleArgparameter of theinitKeyboardEventmethod specifies Event.bubbles. - The
canBubbleArgparameter of theinitKeyboardEventmethod overrides the intrinsic bubbling behavior of the event. - The
cancelableArgparameter of theinitKeyboardEventmethod specifies Event.cancelable. - The
cancelableArgparameter of theinitKeyboardEventmethod also overrides the intrinsic cancelable behavior of the event. - The
viewArgparameter of theinitKeyboardEventmethod specifies UIEvent.view. - The
viewArgparameter value of theinitKeyboardEventmethod may be null. - The
keyIdentifierArgparameter of theinitKeyboardEventmethod specifies KeyboardEvent.keyIdentifier. - The
keyLocationArgparameter of theinitKeyboardEventmethod specifies KeyboardEvent.keyLocation. - The
modifiersListArgis a white space separated list of modifier key identifiers to be activated on this object. - The
initKeyboardEventNSinitializes attributes of aKeyboardEventobject. - The
namespaceURIArgparameter of theinitKeyboardEventNSmethod specifies Event.namespaceURI, the namespace URI associated with this event. - The
namespaceURIArgparameter value of theinitKeyboardEventNSmethod may be null if no namespace. - The
typeArgparameter of theinitKeyboardEventNSmethod specifies Event.type, the local name of the event type. - The
canBubbleArgparameter of theinitKeyboardEventNSmethod specifies Event.bubbles. This parameter overrides the intrinsic bubbling behavior of the event. - The
cancelableArgparameter of theinitKeyboardEventNSmethod specifies Event.cancelable. This parameter overrides the intrinsic cancelable behavior of the event. - The
viewArgparameter of theinitKeyboardEventNSmethod specifies UIEvent.view. - The
viewArgparameter value of theinitKeyboardEventNSmethod may be null. - The
keyIdentifierArgparameter value of theinitKeyboardEventNSmethod specifies KeyboardEvent.keyIdentifier. - The
keyLocationArgparameter value of theinitKeyboardEventNSmethod specifies KeyboardEvent.keyLocation - The
modifiersListArgparameter value of theinitKeyboardEventNSmethod is a white space separated list of modifier key identifiers to be activated on this object.
Mouse Event Types
MouseEvent
- The
MouseEventinterface provides specific contextual information associated with Mouse events. - To create an instance of the
MouseEventinterface, use the DocumentEvent.createEvent("MouseEvent") method call. - The
getModifierStatemethod queries the state of a modifier using a key identifier. - The
getModifierStatemethod returns “true” if it is a modifier key and the modifier is activated. - The
getModifierStatemethod returns “false” if it is not a modifier key or the modifier is not activated. - The
keyIdentifierArgparameter of thegetModifierStatemethod is a modifier key identifier. Common modifier keys are "Alt", "AltGraph", "CapsLock", "Control", "Meta", "NumLock", "Scroll", or "Shift". - The
initMouseEventNSmethod initializes attributes of a MouseEvent object. - The
namespaceURIArgparameter of theinitMouseEventNSmethod specifies Event.namespaceURI, the namespace URI associated with this event, or null if no namespace. - The
typeArgparameter of theinitMouseEventNSmethod specifies Event.type, the local name of the event type. - The
canBubbleArgparameter of theinitMouseEventNSmethod specifies Event.bubbles. - The
canBubbleArgparameter of theinitMouseEventNSmethod also overrides the intrinsic bubbling behavior of the event. - The
cancelableArgparameter of theinitMouseEventNSmethod specifies Event.cancelable. This parameter overrides the intrinsic cancelable behavior of the event. - The
viewArgparameter of theinitMouseEventNSmethod specifies UIEvent.view. - The
viewArgparameter value of theinitMouseEventNSmethod may be null. - The
detailArgparameter of theinitMouseEventNSmethod specifies UIEvent.detail. - The
screenXArgparameter of theinitMouseEventNSmethod specifies MouseEvent.screenX. - The
screenYArgparameter of theinitMouseEventNSmethod specifies MouseEvent.screenY. - The
clientXArgparameter of theinitMouseEventNSmethod specifies MouseEvent.clientX. - The
clientYArgparameter of theinitMouseEventNSmethod specifies MouseEvent.clientY. - The
buttonArgparameter of theinitMouseEventNSmethod specifies MouseEvent.button. - The
relatedTargetArgparameter of theinitMouseEventNSmethod specifies MouseEvent.relatedTarget. - The
relatedTargetArgparameter value of theinitMouseEventNSmethod may also be null. - The
modifiersListArgparameter of theinitMouseEventNSmethod is a white space separated list of modifier key identifiers to be activated on this object.
Mouse Wheel Event Types
MouseWheelEvent
- The
MouseWheelEventinterface provides specific contextual information associated with mouse wheel events. - To create an instance of the
MouseWheelEventinterface, use the DocumentEvent.createEvent("MouseWheelEvent") method call. - The
wheelDeltaattribute represents the distance the wheel has rotated around the y-axis. - The
initMouseWheelNSmethod initializes attributes of aMouseWheelEventobject. - The
namespaceURIArgparameter of theinitMouseWheelNSmethod specifies Event.namespaceURI, the namespace URI associated with this event. - The
namespaceURIArgparameter of theinitMouseWheelNSmethod may be null if no namespace is associated with this event. - The
typeArgparameter of theinitMouseWheelNSmethod specifies Event.type, the local name of the event type. - The
canBubbleArgparameter of theinitMouseWheelNSmethod specifies Event.bubbles. - The
canBubbleArgparameter of theinitMouseWheelNSmethod overrides the intrinsic bubbling behavior of the event. - The
cancelableArgparameter of theinitMouseWheelNSmethod specifies Event.cancelable. - The
cancelableArgparameter of theinitMouseWheelNSmethod overrides the intrinsic cancelable behavior of the event. - The
viewArgparameter of theinitMouseWheelNSmethod specifies UIEvent.view. - The
viewArgparameter value of theinitMouseWheelNSmethod may be null. - The
detailArgparameter of theinitMouseWheelNSmethod specifies UIEvent.detail. - The
screenXArgparameter of theinitMouseWheelNSmethod specifies MouseEvent.screenX. - The
screenYArgparameter of theinitMouseWheelNSmethod specifies MouseEvent.screenY. - The
clientXArgparameter of theinitMouseWheelNSmethod specifies MouseEvent.clientX. - The
clientYArgparameter of theinitMouseWheelNSmethod specifies MouseEvent.clientY. - The
buttonArgparameter of theinitMouseWheelNSmethod specifies MouseEvent.button. - The
relatedTargetArgparameter of theinitMouseWheelNSmethod specifies MouseEvent.relatedTarget. - The
relatedTargetArgparameter value of theinitMouseWheelNSmethod may be null. - The
modifiersArgparameter of theinitMouseWheelNSmethod is a white space separated list of modifier key identifiers to be activated on this object. - The
wheelDeltaArgparameter of theinitMouseWheelNSmethod specifies MouseWheelEvent.wheelDelta.
Wheel Event Types
Wheel Event
- The
WheelEventinterface provides specific contextual information associated with omnidirectional mouse wheel events. - To create an instance of the
WheelEventinterface, use the DocumentEvent.createEvent("WheelEvent") method call. - The attribute
deltaXrepresents the distance the wheel has rotated around the x-axis. - The attribute
deltaYrepresents the distance the wheel has rotated around the y-axis. - The attribute
deltaZrepresents the distance the wheel has rotated around the z-axis. - The
initWheelEventNSmethod initializes attributes of aWheelEventobject. - The
namespaceURIArgparameter of theinitWheelEventNSmethod specifies Event.namespaceURI, the namespace URI associated with this event, or null if no namespace. - The
typeArgparameter of theinitWheelEventNSmethod specifies Event.type, the local name of the event type. - The
canBubbleArgparameter of theinitWheelEventNSmethod specifies Event.bubbles. - The
cancelableArgparameter of theinitWheelEventNSmethod specifies Event.cancelable. - The
viewArgparameter of theinitWheelEventNSmethod specifies UIEvent.view. - The
viewArgparameter value of theinitWheelEventNSmethod may be null. - The
detailArgparameter of theinitWheelEventNSmethod specifies UIEvent.detail. - The
screenXArgparameter of theinitWheelEventNSmethod specifies MouseEvent.screenX. - The
screenYArgparameter of theinitWheelEventNSmethod specifies MouseEvent.screenY. - The
clientXArgparameter of theinitWheelEventNSmethod specifies MouseEvent.clientX. - The
clientYArgparameter of theinitWheelEventNSmethod specifies MouseEvent.clientY. - The
buttonArgparameter of theinitWheelEventNSmethod specifies MouseEvent.button. - The
relatedTargetArgparameter of theinitWheelEventNSmethod specifies MouseEvent.relatedTarget. - The
relatedTargetArgparameter value of theinitWheelEventNSmethod may be null. - The
modifiersListArgparameter of theinitWheelEventNSmethod is a white space separated list of modifier key identifiers to be activated on this object. - The
deltaXArgparameter of theinitWheelEventNSmethod specifies WheelEvent.deltaX. - The
deltaYArgparameter of theinitWheelEventNSmethod specifies WheelEvent.deltaY. - The
deltaZArgparameter of theinitWheelEventNSmethod specifies WheelEvent.deltaZ.
Mutation Event Types
MutationEvent
- The
MutationEventinterface provides specific contextual information associated with Mutation events. - To create an instance of the
MutationEventinterface, use the DocumentEvent.createEvent("MutationEvent") method call. - The
initMutationEventNSmethod initializes attributes of aMutationEventobject. - The
namespaceURIArgparameter of theinitMutationEventNSmethod specifies Event.namespaceURI, the namespace URI associated with this event. - The
namespaceURIArgparameter value of theinitMutationEventNSmethod may be null if no namespace. - The
typeArgparameter of theinitMutationEventNSmethod specifies Event.type, the local name of the event type. - The
canBubbleArgparameter of theinitMutationEventNSmethod specifies Event.bubbles. - The
cancelableArgparameter of theinitMutationEventNSmethod specifies Event.cancelable. - The
relatedNodeArgparameter of theinitMutationEventNSmethod specifies MutationEvent.relatedNode. - The
prevValueArgparameter of theinitMutationEventNSmethod specifies MutationEvent.prevValue. - The
prevValueArgparameter value of theinitMutationEventNSmethod may be null. - The
newValueArgparameter of theinitMutationEventNSmethod specifies MutationEvent.newValue. - The
newValueArgparameter value of theinitMutationEventNSmethod may be null. - The
attrNameArgparameter of theinitMutationEventNSmethod specifies MutationEvent.attrName. - The
attrNameArgparameter value of theinitMutationEventNSmethod may be null. - The
attrChangeArgparameter of theinitMutationEventNSmethod specifies MutationEvent.attrChange. - The
attrChangeArgparameter value of theinitMutationEventNSmethod may be null.
Mutation Name Event Types
MutationNameEvent
- The
MutationNameEventinterface provides specific contextual information associated with Mutation name event types. - To create an instance of the
MutationNameEventinterface, use the Document.createEvent("MutationNameEvent") method call. - The attribute
prevNamespaceURIis the previous value of the relatedNode's namespaceURI. - The attribute
prevNodeNamerepresents the previous value of the relatedNode's nodeName. - The
initMutationNameEventmethod initializes attributes of aMutationNameEventobject. - The
typeArgparameter of theinitMutationNameEventmethod specifies Event.type, the local name of the event type. - The
typeArgparameter of theinitMutationNameEventmethod specifies Event.type, the local name of the event type. - The
canBubbleArgparameter of theinitMutationNameEventmethod specifies Event.bubbles. - The
cancelableArgparameter of theinitMutationNameEventmethod specifies Event.cancelable. - The
relatedNodeArgparameter of theinitMutationNameEventmethod specifies MutationEvent.relatedNode. - The
prevNamespaceURIparameter of theinitMutationNameEventmethod specifies MutationNameEvent.prevNamespaceURI. - The
prevNamespaceURIparameter value of theinitMutationNameEventmethod may be null. - The
prevNodeNameparameter of theinitMutationNameEventmethod specifies MutationNameEvent.prevNodeName. - The
initMutationNameEventNSmethod initializes attributes of aMutationNameEventobject. - The
namespaceURIArgparameter of theinitMutationNameEventNSmethod specifies Event.namespaceURI, the namespace URI associated with this event. - The
namespaceURIArgparameter value of theinitMutationNameEventNSmethod may be null if no namespace. - The
typeArgparameter of theinitMutationNameEventNSmethod specifies Event.type, the local name of the event type. - The
canBubbleArgparameter of theinitMutationNameEventNSmethod specifies Event.bubbles. This parameter overrides the intrinsic bubbling behavior of the event. - The
cancelableArgparameter of theinitMutationNameEventNSmethod specifies Event.cancelable. This parameter overrides the intrinsic cancelable behavior of the event. - The
relatedNodeArgparameter of theinitMutationNameEventNSmethod specifies MutationEvent.relatedNode. - The
prevNamespaceURIArgparameter of theinitMutationNameEventNSmethod specifies MutationEvent.prevValue. - The
prevNamespaceURIArgparameter value of theinitMutationNameEventNSmethod may be null. - The
prevNodeNameArgparameter of theinitMutationNameEventNSmethod specifies MutationEvent.newValue. - The
prevNodeNameArgparameter value of theinitMutationNameEventNSmethod may be null.