@DOMNoInterfaceObjectAttribute public interface IEventTarget
The EventTarget
interface is implemented by all Nodes in an implementation which supports the DOM Event Model.
Therefore, this interface can be obtained by using binding-specific casting methods on an instance of the Node interface.
The interface allows registration and removal of Event Listeners on an EventTarget
and dispatch of events to that IEventTarget
.
Modifier and Type | Method and Description |
---|---|
void |
addEventListener(String type,
IEventListener listener)
This method allows the registration of event listeners on the event target.
|
void |
addEventListener(String type,
IEventListener listener,
boolean useCapture)
This method allows the registration of event listeners on the event target.
|
boolean |
dispatchEvent(Event event)
This method allows the dispatch of events into the implementations event model.
|
void |
removeEventListener(String type,
IEventListener listener)
This method allows the removal of event listeners from the event target.
|
void |
removeEventListener(String type,
IEventListener listener,
boolean useCapture)
This method allows the removal of event listeners from the event target.
|
void addEventListener(String type, IEventListener listener)
This method allows the registration of event listeners on the event target.
type
- The event type for which the user is registeringlistener
- Takes an interface implemented by the user which contains the methods to be called when the event occurs.
If an IEventListener
is added to an EventTarget
while it is processing an event, it will not be triggered
by the current actions but may be triggered during a later stage of event flow, such as the bubbling phase.
If multiple identical Event Listeners are registered on the same EventTarget
with the same parameters the duplicate instances are discarded.
They do not cause the IEventListener
to be called twice and since they are discarded they do not need to be removed with the
removeEventListener(String, IEventListener)
method.
@DOMNameAttribute(name="addEventListener") void addEventListener(String type, @DOMNullableAttribute IEventListener listener, @DOMParameterAttribute(name="useCapture",optional=false) boolean useCapture)
This method allows the registration of event listeners on the event target.
type
- The event type for which the user is registeringlistener
- Takes an interface implemented by the user which contains the methods to be called when the event occurs.useCapture
- If true, useCapture indicates that the user wishes to initiate capture.
After initiating capture, all events of the specified type will be dispatched to the registered
IEventListener
before being dispatched to any Event Targets beneath them in the tree.
Events which are bubbling upward through the tree will not trigger an IEventListener
designated to use capture.
If an IEventListener
is added to an EventTarget
while it is processing an event, it will not be triggered
by the current actions but may be triggered during a later stage of event flow, such as the bubbling phase.
If multiple identical Event Listeners are registered on the same EventTarget
with the same parameters the duplicate instances are discarded.
They do not cause the IEventListener
to be called twice and since they are discarded they do not need to be removed with the
removeEventListener(String, IEventListener)
method.
void removeEventListener(String type, IEventListener listener)
This method allows the removal of event listeners from the event target.
If an IEventListener
is removed from an EventTarget
while it is processing an event, it will not be triggered by the current actions.
Event Listeners can never be invoked after being removed.
type
- Specifies the event type of the IEventListener
being removed.listener
- The IEventListener
parameter indicates the IEventListener
to be removed.@DOMNameAttribute(name="removeEventListener") void removeEventListener(String type, @DOMNullableAttribute IEventListener listener, @DOMParameterAttribute(name="useCapture",optional=false) boolean useCapture)
This method allows the removal of event listeners from the event target.
If an IEventListener
is removed from an EventTarget
while it is processing an event, it will not be triggered by the current actions.
Event Listeners can never be invoked after being removed.
type
- Specifies the event type of the IEventListener
being removed.listener
- The IEventListener
parameter indicates the IEventListener
to be removed.useCapture
- Specifies whether the EventListener being removed was registered as a capturing listener or not.
If a listener was registered twice, one with capture and one without, each must be removed separately.
Removal of a capturing listener does not affect a non-capturing version of the same listener, and vice versa.@DOMNameAttribute(name="dispatchEvent") boolean dispatchEvent(Event event)
This method allows the dispatch of events into the implementations event model.
event
- Specifies the event type, behavior, and contextual information to be used in processing the event.
EventTarget
on which EventTarget.dispatchEvent(com.aspose.html.dom.events.Event)
is called.
EventTarget.dispatchEvent(com.aspose.html.dom.events.Event)
indicates whether any of the listeners which handled the event called Event.PreventDefault
.
If Event.PreventDefault
was called the value is false, else the value is true.DOMException