public class EventTarget extends HtmlUnitScriptable
EventTarget
.org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
NOT_FOUND
Constructor and Description |
---|
EventTarget() |
Modifier and Type | Method and Description |
---|---|
void |
addEventListener(String type,
org.htmlunit.corejs.javascript.Scriptable listener,
boolean useCapture)
Allows the registration of event listeners on the event target.
|
protected void |
clearEventListenersContainer()
Clears the event listener container.
|
boolean |
dispatchEvent(Event event)
Dispatches an event into the event system (standards-conformant browsers only).
|
void |
executeEventLocally(Event event)
Executes the event on this object only (needed for instance for onload on (i)frame tags).
|
ScriptResult |
fireEvent(Event event)
Fires the event on the node with capturing and bubbling phase.
|
org.htmlunit.corejs.javascript.Function |
getEventHandler(String eventType)
Returns the specified event handler.
|
EventListenersContainer |
getEventListenersContainer()
Gets the container for event listeners.
|
boolean |
hasEventHandlers(String eventName)
Returns
true if there are any event handlers for the specified event. |
protected boolean |
isEventHandlerOnWindow()
Is setting event handler property, at window-level.
|
void |
jsConstructor()
JavaScript constructor.
|
void |
removeEventListener(String type,
org.htmlunit.corejs.javascript.Scriptable listener,
boolean useCapture)
Allows the removal of event listeners on the event target.
|
void |
setEventHandler(String eventName,
Object value)
Defines an event handler (or maybe any other object).
|
clone, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getWindow, getWindow, getWindowFromTopCallScope, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setDomNode, setParentScope, setupPromise, setupRejectedPromise
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, get, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, size
public void jsConstructor()
public void addEventListener(String type, org.htmlunit.corejs.javascript.Scriptable listener, boolean useCapture)
type
- the event type to listen for (like "click")listener
- the event listeneruseCapture
- If true
, indicates that the user wishes to initiate capturepublic final EventListenersContainer getEventListenersContainer()
public void executeEventLocally(Event event)
event
- the eventfireEvent(Event)
public ScriptResult fireEvent(Event event)
event
- the eventpublic boolean hasEventHandlers(String eventName)
true
if there are any event handlers for the specified event.eventName
- the event name (e.g. "onclick")true
if there are any event handlers for the specified event, false
otherwisepublic org.htmlunit.corejs.javascript.Function getEventHandler(String eventType)
eventType
- the event type (e.g. "click")null
if the property is null or not a functionpublic boolean dispatchEvent(Event event)
event
- the event to be dispatchedfalse
if at least one of the event handlers which handled the event
called preventDefault
; true
otherwisepublic void removeEventListener(String type, org.htmlunit.corejs.javascript.Scriptable listener, boolean useCapture)
type
- the event type to listen for (like "click")listener
- the event listeneruseCapture
- If true
, indicates that the user wishes to initiate capture (not yet implemented)public void setEventHandler(String eventName, Object value)
eventName
- the event name (e.g. "click")value
- the property (null
to reset it)protected boolean isEventHandlerOnWindow()
protected void clearEventListenersContainer()
Copyright © 2002–2024 Gargoyle Software Inc.. All rights reserved.