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 |
executeEvent(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.Function 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, defineFunctionProperties, defineProperty, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getDomNodeOrDie, getDomNodeOrNull, getPrototype, getScriptableFor, getStartingScope, getTransformerScriptableFor, getWindow, getWindow, getWithPreemption, hasInstance, initParentScope, isReadOnlySettable, makeScriptableFor, setCaseSensitive, setClassName, setDomNode, setDomNode, setHtmlElement, setParentScope
applyDescriptorToAttributeBitset, 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, 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, size
public 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 capture#attachEvent(String, Function)
public EventListenersContainer getEventListenersContainer()
public ScriptResult executeEvent(Event event)
event
- the eventpublic ScriptResult fireEvent(Event event)
event
- the eventpublic boolean hasEventHandlers(String eventName)
eventName
- the event name (e.g. "onclick")public net.sourceforge.htmlunit.corejs.javascript.Function getEventHandler(String eventName)
eventName
- the event name (e.g. "onclick")protected Object getEventHandlerProp(String eventName)
eventName
- the event name (e.g. "onclick")public boolean dispatchEvent(Event event)
event
- the event to be dispatchedpublic void removeEventListener(String type, net.sourceforge.htmlunit.corejs.javascript.Function 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–2015 Gargoyle Software Inc.. All rights reserved.