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
Event
interface is passed as the parameter to anEventListener
. - To create an instance of the Event interface, use the DocumentEvent.createEvent("Event") method call.
- The
defaultPrevented
attribute is used to indicate whether Event.preventDefault() has been called for this event. - The
namespaceURI
attribute indicates the associated with this event at initialization time. - The
initEventNS
method initializes the attributes of anEvent
object. - the
namespaceURIArg
of theinitEventNS
method specifies the namespace URI associated with this event. - If no namespace is available for the
namesapaceURIArg
, then it's value isnull
. - The
stopImmediatePropagation
method prevents other event listeners from being triggered. - The effects of the
stopImmediatePropagation
method are immediate. - The
stopImmediatePropagation
method does not prevent the default action from being invoked.
CustomEvent
- The
CustomEvent
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 theDocumentEvent.createEvent("CustomEvent")
method call. - The
initCustomEventNS
method initializes attributes of a CustomEvent object.
EventTarget
- The
addEventListenerNS
method registers an event listener, depending on the useCapture parameter. - The
namespaceURI
of theaddEventListenerNS
method specifies the Event.namespaceURI associated with the event for which the user is registering. - The
type
parameter of theaddEventListenerNS
method specifies the Event type associated with the event for which the user is registering. - The
listener
parameter of theaddEventListenerNS
method 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
useCapture
parameter of theaddEventListenerNS
method set to "true" indicates that the user wishes to add the event listener for the capture phase only. - If the
useCapture
parameter of theaddEventListenerNS
method set to "false" indicates that the event will be triggered during the target and bubbling phases. - The
dispatchEvent
method 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
dispatchEvent
method raises an UNSPECIFIED_EVENT_TYPE_ERR exception if the Event.type was not specified by initializing the event before dispatchEvent was called. - The
dispatchEvent
method raises an EventException if the Event.type was set tonull
- The
dispatchEvent
method raises a DISPATCH_REQUEST_ERR exception if the Event object is already being dispatched. - The
dispatchEvent
method raises an NOT_SUPPORTED_ERR exception if the Event object has not been created using DocumentEvent.createEvent(). - The
dispatchEvent
method raises an INVALID_CHARACTER_ERR exception if Event.type is not an NCName as defined in [XML Namespaces 1.1]. - The
removeEventListenerNS
method removes an event listener. - Calling
removeEventListenerNS
with arguments which do not identify any currently registered EventListener on the EventTarget has no effect. - The
namespaceURI
of theremoveEventListenerNS
method Specifies the Event.namespaceURI associated with the event for which the user registered the event listener. - The
type
parameter of theremoveEventListenerNS
method specifies the Event.type associated with the event for which the user is registering. - The
listener
parameter of theremoveEventListenerNS
method takes an object implemented by the user which implements the EventListener interface and contains the method to be called when the event occurs. - The
removeEventListenerNS
method removes an event listener. - Calling
removeEventListenerNS
method with arguments which do not identify any currently registered EventListener on the EventTarget has no effect.
Event Creation
DocumentEvent
- The
canDispatch
method tests if the implementation can generate events of a specified type. - The
canDispatch
method returntrue
if the implementation can dispatch the event. - The
canDispatch
method returnfalse
if the implementation can not dispatch the event. - The
namespaceURI
parameter of thecanDispatch
method specifies the Event.namespaceURI of the event. - The
type
parameter of thecanDispatch
method specifies the Event.type of the event.
User Interface event types
UIEvent
- The
initUIEventNS
method initializes attributes of an UIEvent object. - The
initUIEventNS
method has the same behavior as Event.initEventNS(). - The
namespaceURI
parameter of theinitUIEventNS
method specifies Event.namespaceURI, the namespace URI associated with this event, or null if no namespace. - The
typeArg
parameter of theinitUIEventNS
method specifies Event.type, the local name of the event type. - The
canBubbleArg
parameter of theinitUIEventNS
method specifies Event.bubbles. This parameter overrides the intrinsic bubbling behavior of the event. - The
cancelableArg
parameter of theinitUIEventNS
method specifies Event.cancelable. This parameter overrides the intrinsic cancelable behavior of the event. - The
viewArg
parameter of theinitUIEventNS
method specifies UIEvent.view. - The
viewArg
parameter of theinitUIEventNS
method can benull
- The
detailArg
parameter of theinitUIEventNS
method specifies UIEvent.detail.
Text events types
TextEvent
- 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. - The
data
attribute holds the value of the characters generated by the character device. - The
data
attribute may be a single Unicode character or a non-empty sequence of Unicode characters. - The
data
attribute cannot be null or contain the empty string. - The
initTextEvent
method initializes attributes of a TextEvent object. - Invoking the
initTextEvent
method has the same behavior as UIEvent.initUIEvent(). - The value of UIEvent.detail remains undefined.
- The
typeArg
parameter of theinitTextEvent
method specifies Event.type, the local name of the event type. - The
canBubbleArg
parameter of theinitTextEvent
method specifies Event.bubbles. This parameter overrides the intrinsic bubbling behavior of the event. - The
cancelableArg
parameter of theinitTextEvent
method specifies Event.cancelable. This parameter overrides the intrinsic cancelable behavior of the event. - The
viewArg
parameter of theinitTextEvent
method specifies UIEvent.view. - The
viewArg
parameter of theinitTextEvent
method may be null. - The
dataArg
parameter of theinitTextEvent
method specifies TextEvent.data. - The
initTextEventNS
method initializes attributes of a TextEvent object. - Invoking the
initTextEventNS
method has the same behavior as UIEvent.initUIEventNS(). - The value of UIEvent.detail remains undefined.
- The
namespaceURIArg
parameter of theinitTextEventNS
method specifies Event.namespaceURI, the namespace URI associated with this event. - The
namespaceURIArg
parameter value of theinitTextEventNS
method may be null if no namespace. - The
typeArg
parameter of theinitTextEventNS
method specifies Event.type, the local name of the event type. - The
canBubbleArg
parameter of theinitTextEventNS
method specifies Event.bubbles. This parameter overrides the intrinsic bubbling behavior of the event. - The
cancelableArg
parameter of theinitTextEventNS
method specifies Event.cancelable. This parameter overrides the intrinsic cancelable behavior of the event. - The
viewArg
parameter of theinitTextEventNS
method specifies UIEvent.view. - The
viewArg
parameter value of theinitTextEventNS
method may be null. - The
dataArg
parameter of theinitTextEventNS
method specifies TextEvent.data.
Keyboard Event Types
KeyboardEvent
- The
KeyboardEvent
interface 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
KeyboardEvent
interface, use the DocumentEvent.createEvent("KeyboardEvent") method call. - The constants:
DOM_KEY_LOCATION LEFT
,DOM_KEY_LOCATION_NUMPAD
,DOM_KEY_LOCATION_RIGHT
andDOM_KEY_LOCATION_STANDARD
are 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_LEFT
constant 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_NUMPAD
constant 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_RIGHT
constant indicates The key activation is in the right key location (there is more than one possible location for this key). - The
DOM_KEY_LOCATION_STANDARD
constant 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
altKey
attribute is “true” if the alternative (Alt) key modifier is activated, otherwise the attribute will be “false”. - The
ctrlKey
attribute is “true” if the control (Ctrl) key modifier is activated, otherwise the attribute will be “false”. - The
keyIdentifier
attribute holds the identifier of the key. - The
keyIdentifier
attribute that is unable to identify a key must use the key identifier "Unidentified". - The
keyLocation
attribute contains an indication of the location of the key on the device. - The
metaKey
attribute is “true” if the meta (Meta) key modifier is activated, otherwise the attribute will be “false”. - The
shiftKey
attribute is “true” if the shift (Shift) key modifier is activated, otherwise the attribute will be “false”. - The
getModifierState
method queries the state of a modifier using a key identifier. - The
getModifierState
method will return true if it is a modifier key and the modifier is activated. - The
getModifierState
method will return false if it is not a modifier key or if the modifier is not activated. - The
keyIdentifierArg
parameter of thegetModifierState
method is a modifier key identifier. Common modifier keys are "Alt", "AltGraph", "CapsLock", "Control", "Meta", "NumLock", "Scroll", or "Shift". - The
initKeyboardEvent
method initializes attributes of aKeyboardEvent
object. - The
typeArg
parameter of theinitKeyboardEvent
method specifies Event.type, the local name of the event type. - The
canBubbleArg
parameter of theinitKeyboardEvent
method specifies Event.bubbles. - The
canBubbleArg
parameter of theinitKeyboardEvent
method overrides the intrinsic bubbling behavior of the event. - The
cancelableArg
parameter of theinitKeyboardEvent
method specifies Event.cancelable. - The
cancelableArg
parameter of theinitKeyboardEvent
method also overrides the intrinsic cancelable behavior of the event. - The
viewArg
parameter of theinitKeyboardEvent
method specifies UIEvent.view. - The
viewArg
parameter value of theinitKeyboardEvent
method may be null. - The
keyIdentifierArg
parameter of theinitKeyboardEvent
method specifies KeyboardEvent.keyIdentifier. - The
keyLocationArg
parameter of theinitKeyboardEvent
method specifies KeyboardEvent.keyLocation. - The
modifiersListArg
is a white space separated list of modifier key identifiers to be activated on this object. - The
initKeyboardEventNS
initializes attributes of aKeyboardEvent
object. - The
namespaceURIArg
parameter of theinitKeyboardEventNS
method specifies Event.namespaceURI, the namespace URI associated with this event. - The
namespaceURIArg
parameter value of theinitKeyboardEventNS
method may be null if no namespace. - The
typeArg
parameter of theinitKeyboardEventNS
method specifies Event.type, the local name of the event type. - The
canBubbleArg
parameter of theinitKeyboardEventNS
method specifies Event.bubbles. This parameter overrides the intrinsic bubbling behavior of the event. - The
cancelableArg
parameter of theinitKeyboardEventNS
method specifies Event.cancelable. This parameter overrides the intrinsic cancelable behavior of the event. - The
viewArg
parameter of theinitKeyboardEventNS
method specifies UIEvent.view. - The
viewArg
parameter value of theinitKeyboardEventNS
method may be null. - The
keyIdentifierArg
parameter value of theinitKeyboardEventNS
method specifies KeyboardEvent.keyIdentifier. - The
keyLocationArg
parameter value of theinitKeyboardEventNS
method specifies KeyboardEvent.keyLocation - The
modifiersListArg
parameter value of theinitKeyboardEventNS
method is a white space separated list of modifier key identifiers to be activated on this object.
Mouse Event Types
MouseEvent
- The
MouseEvent
interface provides specific contextual information associated with Mouse events. - To create an instance of the
MouseEvent
interface, use the DocumentEvent.createEvent("MouseEvent") method call. - The
getModifierState
method queries the state of a modifier using a key identifier. - The
getModifierState
method returns “true” if it is a modifier key and the modifier is activated. - The
getModifierState
method returns “false” if it is not a modifier key or the modifier is not activated. - The
keyIdentifierArg
parameter of thegetModifierState
method is a modifier key identifier. Common modifier keys are "Alt", "AltGraph", "CapsLock", "Control", "Meta", "NumLock", "Scroll", or "Shift". - The
initMouseEventNS
method initializes attributes of a MouseEvent object. - The
namespaceURIArg
parameter of theinitMouseEventNS
method specifies Event.namespaceURI, the namespace URI associated with this event, or null if no namespace. - The
typeArg
parameter of theinitMouseEventNS
method specifies Event.type, the local name of the event type. - The
canBubbleArg
parameter of theinitMouseEventNS
method specifies Event.bubbles. - The
canBubbleArg
parameter of theinitMouseEventNS
method also overrides the intrinsic bubbling behavior of the event. - The
cancelableArg
parameter of theinitMouseEventNS
method specifies Event.cancelable. This parameter overrides the intrinsic cancelable behavior of the event. - The
viewArg
parameter of theinitMouseEventNS
method specifies UIEvent.view. - The
viewArg
parameter value of theinitMouseEventNS
method may be null. - The
detailArg
parameter of theinitMouseEventNS
method specifies UIEvent.detail. - The
screenXArg
parameter of theinitMouseEventNS
method specifies MouseEvent.screenX. - The
screenYArg
parameter of theinitMouseEventNS
method specifies MouseEvent.screenY. - The
clientXArg
parameter of theinitMouseEventNS
method specifies MouseEvent.clientX. - The
clientYArg
parameter of theinitMouseEventNS
method specifies MouseEvent.clientY. - The
buttonArg
parameter of theinitMouseEventNS
method specifies MouseEvent.button. - The
relatedTargetArg
parameter of theinitMouseEventNS
method specifies MouseEvent.relatedTarget. - The
relatedTargetArg
parameter value of theinitMouseEventNS
method may also be null. - The
modifiersListArg
parameter of theinitMouseEventNS
method is a white space separated list of modifier key identifiers to be activated on this object.
Mouse Wheel Event Types
MouseWheelEvent
- 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. - The
wheelDelta
attribute represents the distance the wheel has rotated around the y-axis. - The
initMouseWheelNS
method initializes attributes of aMouseWheelEvent
object. - The
namespaceURIArg
parameter of theinitMouseWheelNS
method specifies Event.namespaceURI, the namespace URI associated with this event. - The
namespaceURIArg
parameter of theinitMouseWheelNS
method may be null if no namespace is associated with this event. - The
typeArg
parameter of theinitMouseWheelNS
method specifies Event.type, the local name of the event type. - The
canBubbleArg
parameter of theinitMouseWheelNS
method specifies Event.bubbles. - The
canBubbleArg
parameter of theinitMouseWheelNS
method overrides the intrinsic bubbling behavior of the event. - The
cancelableArg
parameter of theinitMouseWheelNS
method specifies Event.cancelable. - The
cancelableArg
parameter of theinitMouseWheelNS
method overrides the intrinsic cancelable behavior of the event. - The
viewArg
parameter of theinitMouseWheelNS
method specifies UIEvent.view. - The
viewArg
parameter value of theinitMouseWheelNS
method may be null. - The
detailArg
parameter of theinitMouseWheelNS
method specifies UIEvent.detail. - The
screenXArg
parameter of theinitMouseWheelNS
method specifies MouseEvent.screenX. - The
screenYArg
parameter of theinitMouseWheelNS
method specifies MouseEvent.screenY. - The
clientXArg
parameter of theinitMouseWheelNS
method specifies MouseEvent.clientX. - The
clientYArg
parameter of theinitMouseWheelNS
method specifies MouseEvent.clientY. - The
buttonArg
parameter of theinitMouseWheelNS
method specifies MouseEvent.button. - The
relatedTargetArg
parameter of theinitMouseWheelNS
method specifies MouseEvent.relatedTarget. - The
relatedTargetArg
parameter value of theinitMouseWheelNS
method may be null. - The
modifiersArg
parameter of theinitMouseWheelNS
method is a white space separated list of modifier key identifiers to be activated on this object. - The
wheelDeltaArg
parameter of theinitMouseWheelNS
method specifies MouseWheelEvent.wheelDelta.
Wheel Event Types
Wheel Event
- 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. - The attribute
deltaX
represents the distance the wheel has rotated around the x-axis. - The attribute
deltaY
represents the distance the wheel has rotated around the y-axis. - The attribute
deltaZ
represents the distance the wheel has rotated around the z-axis. - The
initWheelEventNS
method initializes attributes of aWheelEvent
object. - The
namespaceURIArg
parameter of theinitWheelEventNS
method specifies Event.namespaceURI, the namespace URI associated with this event, or null if no namespace. - The
typeArg
parameter of theinitWheelEventNS
method specifies Event.type, the local name of the event type. - The
canBubbleArg
parameter of theinitWheelEventNS
method specifies Event.bubbles. - The
cancelableArg
parameter of theinitWheelEventNS
method specifies Event.cancelable. - The
viewArg
parameter of theinitWheelEventNS
method specifies UIEvent.view. - The
viewArg
parameter value of theinitWheelEventNS
method may be null. - The
detailArg
parameter of theinitWheelEventNS
method specifies UIEvent.detail. - The
screenXArg
parameter of theinitWheelEventNS
method specifies MouseEvent.screenX. - The
screenYArg
parameter of theinitWheelEventNS
method specifies MouseEvent.screenY. - The
clientXArg
parameter of theinitWheelEventNS
method specifies MouseEvent.clientX. - The
clientYArg
parameter of theinitWheelEventNS
method specifies MouseEvent.clientY. - The
buttonArg
parameter of theinitWheelEventNS
method specifies MouseEvent.button. - The
relatedTargetArg
parameter of theinitWheelEventNS
method specifies MouseEvent.relatedTarget. - The
relatedTargetArg
parameter value of theinitWheelEventNS
method may be null. - The
modifiersListArg
parameter of theinitWheelEventNS
method is a white space separated list of modifier key identifiers to be activated on this object. - The
deltaXArg
parameter of theinitWheelEventNS
method specifies WheelEvent.deltaX. - The
deltaYArg
parameter of theinitWheelEventNS
method specifies WheelEvent.deltaY. - The
deltaZArg
parameter of theinitWheelEventNS
method specifies WheelEvent.deltaZ.
Mutation Event Types
MutationEvent
- 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. - The
initMutationEventNS
method initializes attributes of aMutationEvent
object. - The
namespaceURIArg
parameter of theinitMutationEventNS
method specifies Event.namespaceURI, the namespace URI associated with this event. - The
namespaceURIArg
parameter value of theinitMutationEventNS
method may be null if no namespace. - The
typeArg
parameter of theinitMutationEventNS
method specifies Event.type, the local name of the event type. - The
canBubbleArg
parameter of theinitMutationEventNS
method specifies Event.bubbles. - The
cancelableArg
parameter of theinitMutationEventNS
method specifies Event.cancelable. - The
relatedNodeArg
parameter of theinitMutationEventNS
method specifies MutationEvent.relatedNode. - The
prevValueArg
parameter of theinitMutationEventNS
method specifies MutationEvent.prevValue. - The
prevValueArg
parameter value of theinitMutationEventNS
method may be null. - The
newValueArg
parameter of theinitMutationEventNS
method specifies MutationEvent.newValue. - The
newValueArg
parameter value of theinitMutationEventNS
method may be null. - The
attrNameArg
parameter of theinitMutationEventNS
method specifies MutationEvent.attrName. - The
attrNameArg
parameter value of theinitMutationEventNS
method may be null. - The
attrChangeArg
parameter of theinitMutationEventNS
method specifies MutationEvent.attrChange. - The
attrChangeArg
parameter value of theinitMutationEventNS
method may be null.
Mutation Name Event Types
MutationNameEvent
- 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. - The attribute
prevNamespaceURI
is the previous value of the relatedNode's namespaceURI. - The attribute
prevNodeName
represents the previous value of the relatedNode's nodeName. - The
initMutationNameEvent
method initializes attributes of aMutationNameEvent
object. - The
typeArg
parameter of theinitMutationNameEvent
method specifies Event.type, the local name of the event type. - The
typeArg
parameter of theinitMutationNameEvent
method specifies Event.type, the local name of the event type. - The
canBubbleArg
parameter of theinitMutationNameEvent
method specifies Event.bubbles. - The
cancelableArg
parameter of theinitMutationNameEvent
method specifies Event.cancelable. - The
relatedNodeArg
parameter of theinitMutationNameEvent
method specifies MutationEvent.relatedNode. - The
prevNamespaceURI
parameter of theinitMutationNameEvent
method specifies MutationNameEvent.prevNamespaceURI. - The
prevNamespaceURI
parameter value of theinitMutationNameEvent
method may be null. - The
prevNodeName
parameter of theinitMutationNameEvent
method specifies MutationNameEvent.prevNodeName. - The
initMutationNameEventNS
method initializes attributes of aMutationNameEvent
object. - The
namespaceURIArg
parameter of theinitMutationNameEventNS
method specifies Event.namespaceURI, the namespace URI associated with this event. - The
namespaceURIArg
parameter value of theinitMutationNameEventNS
method may be null if no namespace. - The
typeArg
parameter of theinitMutationNameEventNS
method specifies Event.type, the local name of the event type. - The
canBubbleArg
parameter of theinitMutationNameEventNS
method specifies Event.bubbles. This parameter overrides the intrinsic bubbling behavior of the event. - The
cancelableArg
parameter of theinitMutationNameEventNS
method specifies Event.cancelable. This parameter overrides the intrinsic cancelable behavior of the event. - The
relatedNodeArg
parameter of theinitMutationNameEventNS
method specifies MutationEvent.relatedNode. - The
prevNamespaceURIArg
parameter of theinitMutationNameEventNS
method specifies MutationEvent.prevValue. - The
prevNamespaceURIArg
parameter value of theinitMutationNameEventNS
method may be null. - The
prevNodeNameArg
parameter of theinitMutationNameEventNS
method specifies MutationEvent.newValue. - The
prevNodeNameArg
parameter value of theinitMutationNameEventNS
method may be null.