public class EventTarget extends SimpleScriptable
EventTarget.| Constructor and Description |
|---|
EventTarget()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEventListener(String type,
net.sourceforge.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).
|
ScriptResult |
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.
|
net.sourceforge.htmlunit.corejs.javascript.Function |
getEventHandler(String eventName)
Returns the specified event handler.
|
protected Object |
getEventHandlerProp(String eventName)
Gets the property defined as event handler (not necessary a Function if something else has been set).
|
EventListenersContainer |
getEventListenersContainer()
Gets the container for event listeners.
|
boolean |
hasEventHandlers(String eventName)
Returns
true if there are any event handlers for the specified event. |
void |
removeEventListener(String type,
net.sourceforge.htmlunit.corejs.javascript.Scriptable listener,
boolean useCapture)
Allows the removal of event listeners on the event target.
|
void |
setEventHandler(String eventName,
net.sourceforge.htmlunit.corejs.javascript.Function eventHandler)
Defines an event handler.
|
protected void |
setEventHandlerProp(String eventName,
Object value)
Defines an event handler (or maybe any other object).
|
clone, equivalentValues, get, getBrowserVersion, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, getWithPreemption, has, hasInstance, initParentScope, isReadOnlySettable, makeScriptableFor, setCaseSensitive, setDomNode, setDomNode, setHtmlElementdefineFunctionProperties, defineProperty, getClassName, setClassName, setParentScopeapplyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getSlot, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setExternalArrayData, setGetterOrSetter, setPrototype, sizepublic void addEventListener(String type, net.sourceforge.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 EventListenersContainer getEventListenersContainer()
public ScriptResult 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 net.sourceforge.htmlunit.corejs.javascript.Function getEventHandler(String eventName)
eventName - the event name (e.g. "onclick")null if the property is null or not a functionprotected Object getEventHandlerProp(String eventName)
eventName - the event name (e.g. "onclick")public 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, net.sourceforge.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)protected void setEventHandlerProp(String eventName, Object value)
eventName - the event name (e.g. "onclick")value - the property (null to reset it)public void setEventHandler(String eventName, net.sourceforge.htmlunit.corejs.javascript.Function eventHandler)
eventName - the event name (e.g. "onclick")eventHandler - the handler (null to reset it)protected void clearEventListenersContainer()
Copyright © 2002–2016 Gargoyle Software Inc.. All rights reserved.