- 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".
1.5 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.
1.6 Basic interfaces
- Event
- An object which implements the
Event interface is passed as the parameter to an EventListener.
- 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 an Event object.
- the
namespaceURIArg of the initEventNS method specifies the namespace URI associated with this event.
- If no namespace is available for the
namesapaceURIArg, then it's value is null.
- 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 the DocumentEvent.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 the addEventListenerNS method specifies Specifies the Event.namespaceURI associated with the event for which the user is registering.
- The
type parameter of the addEventListenerNS method specifies the Event type associated with the event for which the user is registering.
- The
listener parameter of the addEventListenerNS 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 the addEventListenerNS method set to "true" indicates that the user wishes to add the event listener for the capture phase only.
- If the
useCapture parameter of the addEventListenerNS 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 to null
- 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 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 the removeEventListenerNS method Specifies the Event.namespaceURI associated with the event for which the user registered the event listener.
- The
type parameter of the removeEventListenerNS method specifies the Event.type associated with the event for which the user is registering.
- The
listener parameter of the removeEventListenerNS 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
useCapture parameter of the removeEventListenerNS method removes an event listener.
- Calling the
useCapture parameter of the removeEventListenerNS method with arguments which do not identify any currently registered EventListener on the EventTarget has no effect.
1.6.1 Event Creation
- DocumentEvent
- The
canDispatch method tests if the implementation can generate events of a specified type.
- The
canDispatch method return true if the implementation can dispatch the event.
- The
canDispatch method return false if the implementation can not dispatch the event.
- The
namespaceURI parameter of the canDispatch method specifies the Event.namespaceURI of the event.
- The
type parameter of the canDispatch method specifies the Event.type of the event.
1.7.1 User Interface event types
- initUIEventNS
- The
canDispatch method initializes attributes of an UIEvent object.
- The
canDispatch method has the same behavior as Event.initEventNS().
- The
namespaceURI parameter of the initUIEventNS method Specifies Event.namespaceURI, the namespace URI associated with this event, or null if no namespace.
- The
typeArg parameter of the initUIEventNS method specifies Event.type, the local name of the event type.
- The
canBubbleArg parameter of the initUIEventNS method specifies Event.bubbles. This parameter overrides the intrinsic bubbling behavior of the event.
- The
cancelableArg parameter of the initUIEventNS method specifies Event.cancelable. This parameter overrides the intrinsic cancelable behavior of the event.
- The
viewArg parameter of the initUIEventNS method specifies UIEvent.view.
- The
viewArg parameter of the initUIEventNS method can be null
- The
detailArg parameter of the initUIEventNS method specifies UIEvent.detail.
1.7.2 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.