Class EventHandler

java.lang.Object
org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.corejs.javascript.IdScriptableObject
org.htmlunit.corejs.javascript.BaseFunction
org.htmlunit.javascript.host.event.EventHandler
All Implemented Interfaces:
Serializable, org.htmlunit.corejs.javascript.Callable, org.htmlunit.corejs.javascript.ConstProperties, org.htmlunit.corejs.javascript.Constructable, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.Function, org.htmlunit.corejs.javascript.IdFunctionCall, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable

public class EventHandler extends org.htmlunit.corejs.javascript.BaseFunction
Allows to wrap event handler code as Function object.
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final String
     
    private final String
     
    private final DomNode
     
    private org.htmlunit.corejs.javascript.Function
     

    Fields inherited from class org.htmlunit.corejs.javascript.BaseFunction

    Id_arguments, Id_arity, Id_length, Id_name, Id_prototype, MAX_INSTANCE_ID

    Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST

    Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable

    NOT_FOUND
  • Constructor Summary

    Constructors
    Constructor
    Description
    EventHandler(DomNode node, String eventName, String jsSnippet)
    Builds a function that will execute the JavaScript code provided.
  • Method Summary

    Modifier and Type
    Method
    Description
    call(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args)
    get(String name, org.htmlunit.corejs.javascript.Scriptable start)
    getDefaultValue(Class<?> typeHint)
     

    Methods inherited from class org.htmlunit.corejs.javascript.BaseFunction

    construct, createObject, execIdCall, fillConstructorProperties, findInstanceIdInfo, findPrototypeId, getArity, getClassName, getClassPrototype, getFunctionName, getInstanceIdName, getInstanceIdValue, getLength, getMaxInstanceId, getPrototypeProperty, getTypeOf, hasInstance, hasPrototypeProperty, initPrototypeId, isGeneratorFunction, setImmunePrototypeProperty, setInstanceIdAttributes, setInstanceIdValue, setPrototypeProperty, setPrototypePropertyAttributes, setStandardPropertyAttributes, setupDefaultPrototype

    Methods inherited from class org.htmlunit.corejs.javascript.IdScriptableObject

    activatePrototypeMap, addIdFunctionProperty, defaultGet, defaultHas, defaultPut, defineOwnProperty, delete, delete, ensureType, exportAsJSClass, findInstanceIdInfo, findPrototypeId, get, getAttributes, getAttributes, getOwnPropertyDescriptor, has, has, hasPrototypeMap, initPrototypeConstructor, initPrototypeMethod, initPrototypeMethod, initPrototypeMethod, initPrototypeValue, initPrototypeValue, instanceIdInfo, put, put, setAttributes

    Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject

    applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope, setPrototype, size

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.htmlunit.corejs.javascript.Scriptable

    delete, delete, get, getIds, getParentScope, getPrototype, has, has, put, put, setParentScope, setPrototype
  • Field Details

    • node_

      private final DomNode node_
    • eventName_

      private final String eventName_
    • jsSnippet_

      private final String jsSnippet_
    • realFunction_

      private org.htmlunit.corejs.javascript.Function realFunction_
  • Constructor Details

    • EventHandler

      public EventHandler(DomNode node, String eventName, String jsSnippet)
      Builds a function that will execute the JavaScript code provided.
      Parameters:
      node - the element for which the event is build
      eventName - the event for which this handler is created
      jsSnippet - the JavaScript code
  • Method Details

    • call

      public Object call(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, Object[] args) throws org.htmlunit.corejs.javascript.JavaScriptException
      Specified by:
      call in interface org.htmlunit.corejs.javascript.Callable
      Specified by:
      call in interface org.htmlunit.corejs.javascript.Function
      Overrides:
      call in class org.htmlunit.corejs.javascript.BaseFunction
      Throws:
      org.htmlunit.corejs.javascript.JavaScriptException
    • getDefaultValue

      public Object getDefaultValue(Class<?> typeHint)
      Specified by:
      getDefaultValue in interface org.htmlunit.corejs.javascript.Scriptable
      Overrides:
      getDefaultValue in class org.htmlunit.corejs.javascript.ScriptableObject
      Parameters:
      typeHint - the type hint
      Returns:
      the js code of the function declaration
      See Also:
      • ScriptableObject.getDefaultValue(java.lang.Class)
    • get

      public Object get(String name, org.htmlunit.corejs.javascript.Scriptable start)
      Specified by:
      get in interface org.htmlunit.corejs.javascript.Scriptable
      Overrides:
      get in class org.htmlunit.corejs.javascript.IdScriptableObject