Class EventHandler

  • All Implemented Interfaces:
    java.io.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:
    Serialized Form
    • 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 java.lang.String eventName_  
      private java.lang.String jsSnippet_  
      private DomNode node_  
      private org.htmlunit.corejs.javascript.Function realFunction_  
      • 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, java.lang.String eventName, java.lang.String jsSnippet)
      Builds a function that will execute the JavaScript code provided.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object call​(org.htmlunit.corejs.javascript.Context cx, org.htmlunit.corejs.javascript.Scriptable scope, org.htmlunit.corejs.javascript.Scriptable thisObj, java.lang.Object[] args)
      java.lang.Object get​(java.lang.String name, org.htmlunit.corejs.javascript.Scriptable start)
      java.lang.Object getDefaultValue​(java.lang.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 Detail

      • node_

        private final DomNode node_
      • eventName_

        private final java.lang.String eventName_
      • jsSnippet_

        private final java.lang.String jsSnippet_
      • realFunction_

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

      • EventHandler

        public EventHandler​(DomNode node,
                            java.lang.String eventName,
                            java.lang.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 Detail

      • call

        public java.lang.Object call​(org.htmlunit.corejs.javascript.Context cx,
                                     org.htmlunit.corejs.javascript.Scriptable scope,
                                     org.htmlunit.corejs.javascript.Scriptable thisObj,
                                     java.lang.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 java.lang.Object getDefaultValue​(java.lang.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 java.lang.Object get​(java.lang.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