public interface DOMEventTarget
DOMElement
that supports DOM event model.
Modifier and Type | Method and Description |
---|---|
void |
addEventListener(DOMEventType eventType, DOMEventListener listener, boolean useCapture)
This method allows the registration of event listeners on the event target.
此方法允许在事件目标上注册事件侦听器。 |
boolean |
dispatchEvent(DOMEvent event)
Dispatches the given
在当前DOMEventTarget上调度给定事件。 event at the current
DOMEventTarget .
|
java.util.List<DOMEventListener> |
getEventListeners(DOMEventType eventType)
Returns a list of registered
返回特定事件类型的已注册DOMEventListener的列表。 DOMEventListener 's for specific
eventType .
|
void |
removeEventListener(DOMEventType eventType, DOMEventListener listener, boolean useCapture)
This method allows the removal of event listeners from the event target.
此方法允许从事件目标中删除事件侦听器。 |
void addEventListener(DOMEventType eventType, DOMEventListener listener, boolean useCapture)
DOMEventListener
is added to an
DOMEventTarget
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.
DOMEventListener
s are registered on the same
DOMEventTarget
with the same parameters the duplicate instances are discarded. They do not cause the
DOMEventListener
to be called twice and since they are discarded they do not need to be removed with the
removeEventListener
method.
eventType
- the event type for which the user is registering.
-用户正在为其注册的事件类型。
listener
- the
listener
parameter 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
DOMEventListener
before being dispatched to any
DOMEventTarget
beneath them in the tree. Events which are bubbling upward through the tree will not trigger an
DOMEventListener
designated to use capture.
-如果为true,则表示用户希望启动捕获。启动捕获后,所有指定类型的事件都将分派给已注册的事件,然后才分派给树中它们下面的任何事件。在树中向上冒泡的事件不会触发指定使用捕获。
void removeEventListener(DOMEventType eventType, DOMEventListener listener, boolean useCapture)
DOMEventListener
is removed from an
DOMEventTarget
while it is processing an event, it will not be triggered by the current actions.
DOMEventListener
s can never be invoked after being removed.
removeEventListener
with arguments which do not identify any currently registered
DOMEventListener
on the
DOMEventTarget
has no effect.
eventType
- specifies the event type of the
DOMEventListener
being removed.
-指定要删除的事件的类型。
listener
- the
DOMEventListener
parameter indicates the
DOMEventListener
to be removed.
-参数指示要删除的。
useCapture
- specifies whether the
DOMEventListener
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.
-指定要删除的对象是否已注册为捕获侦听器。如果一个侦听器被注册了两次,一个被捕获,一个被捕获,则必须分别删除。删除捕获的侦听器不会影响同一侦听器的非捕获版本,反之亦然。
java.util.List<DOMEventListener> getEventListeners(DOMEventType eventType)
DOMEventListener
's for specific
eventType
.
eventType
- specifies the event type of the
DOMEventListener
.
-指定的事件类型。
DOMEventListener
's for specific
eventType
.
具体的注册清单。
boolean dispatchEvent(DOMEvent event)
event
at the current
DOMEventTarget
. The event can be created using one of the
DOMDocument.create*Event()
methods.
event
- the
DOMEvent
object to be dispatched. Cannot be
null
.
-要调度的对象。不可能是 。
false
if event is cancelable and at least one of the event handlers which handled this event called
DOMEvent.preventDefault()
. Otherwise it returns
true
.
如果事件是可以取消的,至少处理这个事件的事件处理程序之一被称为。否则返回。
java.lang.IllegalArgumentException
- when
event
parameter is
null
.