Class Event

java.lang.Object
org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.javascript.HtmlUnitScriptable
org.htmlunit.javascript.host.event.Event
All Implemented Interfaces:
Serializable, Cloneable, org.htmlunit.corejs.javascript.ConstProperties, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable
Direct Known Subclasses:
AnimationEvent, AudioProcessingEvent, BeforeInstallPromptEvent, BeforeUnloadEvent, BlobEvent, ClipboardEvent, CloseEvent, CustomEvent, DeviceMotionEvent, DeviceOrientationEvent, ErrorEvent, GamepadEvent, HashChangeEvent, IDBVersionChangeEvent, MediaEncryptedEvent, MediaKeyError, MediaKeyMessageEvent, MediaQueryListEvent, MediaStreamEvent, MediaStreamTrackEvent, MessageEvent, MIDIConnectionEvent, MIDIMessageEvent, MutationEvent, OfflineAudioCompletionEvent, PageTransitionEvent, PopStateEvent, PresentationConnectionAvailableEvent, PresentationConnectionCloseEvent, ProgressEvent, PromiseRejectionEvent, RTCDataChannelEvent, RTCPeerConnectionIceEvent, SecurityPolicyViolationEvent, SpeechSynthesisEvent, StorageEvent, SubmitEvent, TimeEvent, TrackEvent, TransitionEvent, UIEvent, WebGLContextEvent, WebkitSpeechRecognitionError, WebkitSpeechRecognitionEvent

public class Event extends HtmlUnitScriptable
JavaScript object representing an event that is passed into event handlers when they are invoked. For general information on which properties and functions should be supported, see the mozilla docs, the W3C DOM Level 2 Event Documentation or IE's IHTMLEventObj interface.
See Also:
  • Field Details

    • KEY_CURRENT_EVENT

      protected static final String KEY_CURRENT_EVENT
      Key to place the event's target in the Context's scope during event processing to compute node coordinates compatible with those of the event.
      See Also:
    • TYPE_SUBMIT

      public static final String TYPE_SUBMIT
      The submit event type, triggered by onsubmit event handlers.
      See Also:
    • TYPE_CHANGE

      public static final String TYPE_CHANGE
      The change event type, triggered by onchange event handlers.
      See Also:
    • TYPE_LOAD

      public static final String TYPE_LOAD
      The load event type, triggered by onload event handlers.
      See Also:
    • TYPE_UNLOAD

      public static final String TYPE_UNLOAD
      The unload event type, triggered by onunload event handlers.
      See Also:
    • TYPE_POPSTATE

      public static final String TYPE_POPSTATE
      The popstate event type, triggered by onpopstate event handlers.
      See Also:
    • TYPE_FOCUS

      public static final String TYPE_FOCUS
      The focus event type, triggered by onfocus event handlers.
      See Also:
    • TYPE_FOCUS_IN

      public static final String TYPE_FOCUS_IN
      The focus in event type, triggered by onfocusin event handlers.
      See Also:
    • TYPE_FOCUS_OUT

      public static final String TYPE_FOCUS_OUT
      The focus out event type, triggered by onfocusout event handlers.
      See Also:
    • TYPE_BLUR

      public static final String TYPE_BLUR
      The blur event type, triggered by onblur event handlers.
      See Also:
    • TYPE_KEY_DOWN

      public static final String TYPE_KEY_DOWN
      The key down event type, triggered by onkeydown event handlers.
      See Also:
    • TYPE_KEY_PRESS

      public static final String TYPE_KEY_PRESS
      The key down event type, triggered by onkeypress event handlers.
      See Also:
    • TYPE_INPUT

      public static final String TYPE_INPUT
      The input event type, triggered by oninput event handlers.
      See Also:
    • TYPE_KEY_UP

      public static final String TYPE_KEY_UP
      The key down event type, triggered by onkeyup event handlers.
      See Also:
    • TYPE_RESET

      public static final String TYPE_RESET
      The submit event type, triggered by onreset event handlers.
      See Also:
    • TYPE_BEFORE_UNLOAD

      public static final String TYPE_BEFORE_UNLOAD
      The beforeunload event type, triggered by onbeforeunload event handlers.
      See Also:
    • TYPE_DOM_DOCUMENT_LOADED

      public static final String TYPE_DOM_DOCUMENT_LOADED
      Triggered after the DOM has loaded but before images etc.
      See Also:
    • TYPE_PROPERTY_CHANGE

      public static final String TYPE_PROPERTY_CHANGE
      The event type triggered by onpropertychange event handlers.
      See Also:
    • TYPE_HASH_CHANGE

      public static final String TYPE_HASH_CHANGE
      The event type triggered by onhashchange event handlers.
      See Also:
    • TYPE_READY_STATE_CHANGE

      public static final String TYPE_READY_STATE_CHANGE
      The event type triggered by onreadystatechange event handlers.
      See Also:
    • TYPE_ERROR

      public static final String TYPE_ERROR
      The event type triggered by onerror event handlers.
      See Also:
    • TYPE_MESSAGE

      public static final String TYPE_MESSAGE
      The message event type, triggered by postMessage.
      See Also:
    • TYPE_CLOSE

      public static final String TYPE_CLOSE
      The close event type, triggered by onclose event handlers.
      See Also:
    • TYPE_OPEN

      public static final String TYPE_OPEN
      The open event type, triggered by onopen event handlers.
      See Also:
    • TYPE_LOAD_START

      public static final String TYPE_LOAD_START
      The load start event type, triggered by onloadstart event handlers.
      See Also:
    • TYPE_LOAD_END

      public static final String TYPE_LOAD_END
      The load end event type, triggered by onloadend event handlers.
      See Also:
    • TYPE_PROGRESS

      public static final String TYPE_PROGRESS
      The progress event type, triggered by onprogress event handlers.
      See Also:
    • TYPE_ABORT

      public static final String TYPE_ABORT
      The abort event type, triggered by onabort event handlers.
      See Also:
    • TYPE_TIMEOUT

      public static final String TYPE_TIMEOUT
      The timeout event type, triggered by ontimeout event handlers.
      See Also:
    • TYPE_SCROLL

      public static final String TYPE_SCROLL
      The scroll event type, triggered by onscroll event handlers.
      See Also:
    • TYPE_SCROLLEND

      public static final String TYPE_SCROLLEND
      The scroll event type, triggered by onscrollend event handlers.
      See Also:
    • TYPE_DRAGEND

      public static final String TYPE_DRAGEND
      The dragend event type, triggered by dragend event handlers.
      See Also:
    • TYPE_INVALID

      public static final String TYPE_INVALID
      The invalid event type, triggered by invalid event handlers.
      See Also:
    • TYPE_POINTEROUT

      public static final String TYPE_POINTEROUT
      The pointerout event type, triggered by pointerout event handlers.
      See Also:
    • TYPE_RATECHANGE

      public static final String TYPE_RATECHANGE
      The ratechange event type, triggered by ratechange event handlers.
      See Also:
    • TYPE_ANIMATIONITERATION

      public static final String TYPE_ANIMATIONITERATION
      The animationiteration event type, triggered by animationiteration event handlers.
      See Also:
    • TYPE_CANPLAYTHROUGH

      public static final String TYPE_CANPLAYTHROUGH
      The canplaythrough event type, triggered by canplaythrough event handlers.
      See Also:
    • TYPE_CANCEL

      public static final String TYPE_CANCEL
      The cancel event type, triggered by cancel event handlers.
      See Also:
    • TYPE_POINTERENTER

      public static final String TYPE_POINTERENTER
      The pointerenter event type, triggered by pointerenter event handlers.
      See Also:
    • TYPE_SELECT

      public static final String TYPE_SELECT
      The select event type, triggered by select event handlers.
      See Also:
    • TYPE_AUXCLICK

      public static final String TYPE_AUXCLICK
      The auxclick event type, triggered by auxclick event handlers.
      See Also:
    • TYPE_WEBANIMATIONSTART

      public static final String TYPE_WEBANIMATIONSTART
      The webkitanimationstart event type, triggered by webkitanimationstart event handlers.
      See Also:
    • TYPE_DRAG

      public static final String TYPE_DRAG
      The drag event type, triggered by drag event handlers.
      See Also:
    • TYPE_SEEKED

      public static final String TYPE_SEEKED
      The seeked event type, triggered by seeked event handlers.
      See Also:
    • TYPE_OFFLINE

      public static final String TYPE_OFFLINE
      The offline event type, triggered by offline event handlers.
      See Also:
    • TYPE_DEVICEORIENTATION

      public static final String TYPE_DEVICEORIENTATION
      The deviceorientation event type, triggered by deviceorientation event handlers.
      See Also:
    • TYPE_TOGGLE

      public static final String TYPE_TOGGLE
      The toggle event type, triggered by toggle event handlers.
      See Also:
    • TYPE_PLAY

      public static final String TYPE_PLAY
      The play event type, triggered by play event handlers.
      See Also:
    • TYPE_LOADEDMETADATA

      public static final String TYPE_LOADEDMETADATA
      The loadedmetadata event type, triggered by loadedmetadata event handlers.
      See Also:
    • TYPE_POINTERMOVE

      public static final String TYPE_POINTERMOVE
      The pointermove event type, triggered by pointermove event handlers.
      See Also:
    • TYPE_LOSTPOINTERCAPTURE

      public static final String TYPE_LOSTPOINTERCAPTURE
      The lostpointercapture event type, triggered by lostpointercapture event handlers.
      See Also:
    • TYPE_POINTEROVER

      public static final String TYPE_POINTEROVER
      The pointerover event type, triggered by pointerover event handlers.
      See Also:
    • TYPE_ANIMATIONCANCEL

      public static final String TYPE_ANIMATIONCANCEL
      The animationcancel event type, triggered by animationcancel event handlers.
      See Also:
    • TYPE_ANIMATIONEND

      public static final String TYPE_ANIMATIONEND
      The animationend event type, triggered by animationend event handlers.
      See Also:
    • TYPE_DRAGENTER

      public static final String TYPE_DRAGENTER
      The dragenter event type, triggered by dragenter event handlers.
      See Also:
    • TYPE_AFTERPRINT

      public static final String TYPE_AFTERPRINT
      The afterprint event type, triggered by afterprint event handlers.
      See Also:
    • TYPE_MOZFULLSCREENERROR

      public static final String TYPE_MOZFULLSCREENERROR
      The mozfullscreenerror event type, triggered by mozfullscreenerror event handlers.
      See Also:
    • TYPE_MOUSELEAVE

      public static final String TYPE_MOUSELEAVE
      The mouseleave event type, triggered by mouseleave event handlers.
      See Also:
    • TYPE_MOUSEWHEEL

      public static final String TYPE_MOUSEWHEEL
      The mousewheel event type, triggered by mousewheel event handlers.
      See Also:
    • TYPE_SEEKING

      public static final String TYPE_SEEKING
      The seeking event type, triggered by seeking event handlers.
      See Also:
    • TYPE_CUECHANGE

      public static final String TYPE_CUECHANGE
      The cuechange event type, triggered by cuechange event handlers.
      See Also:
    • TYPE_PAGESHOW

      public static final String TYPE_PAGESHOW
      The pageshow event type, triggered by pageshow event handlers.
      See Also:
    • TYPE_MOZFULLSCREENCHANGE

      public static final String TYPE_MOZFULLSCREENCHANGE
      The mozfullscreenchange event type, triggered by mozfullscreenchange event handlers.
      See Also:
    • TYPE_DURATIONCHANGE

      public static final String TYPE_DURATIONCHANGE
      The durationchange event type, triggered by durationchange event handlers.
      See Also:
    • TYPE_PLAYING

      public static final String TYPE_PLAYING
      The playing event type, triggered by playing event handlers.
      See Also:
    • TYPE_ENDED

      public static final String TYPE_ENDED
      The ended event type, triggered by ended event handlers.
      See Also:
    • TYPE_LOADEDDATA

      public static final String TYPE_LOADEDDATA
      The loadeddata event type, triggered by loadeddata event handlers.
      See Also:
    • TYPE_UNHANDLEDREJECTION

      public static final String TYPE_UNHANDLEDREJECTION
      The unhandledrejection event type, triggered by unhandledrejection event handlers.
      See Also:
    • TYPE_SUSPEND

      public static final String TYPE_SUSPEND
      The suspend event type, triggered by suspend event handlers.
      See Also:
    • TYPE_WAITING

      public static final String TYPE_WAITING
      The waiting event type, triggered by waiting event handlers.
      See Also:
    • TYPE_CANPLAY

      public static final String TYPE_CANPLAY
      The canplay event type, triggered by canplay event handlers.
      See Also:
    • TYPE_LANGUAGECHANGE

      public static final String TYPE_LANGUAGECHANGE
      The languagechange event type, triggered by languagechange event handlers.
      See Also:
    • TYPE_EMPTIED

      public static final String TYPE_EMPTIED
      The emptied event type, triggered by emptied event handlers.
      See Also:
    • TYPE_REJECTIONHANDLED

      public static final String TYPE_REJECTIONHANDLED
      The rejectionhandled event type, triggered by rejectionhandled event handlers.
      See Also:
    • TYPE_POINTERCANCEL

      public static final String TYPE_POINTERCANCEL
      The pointercancel event type, triggered by pointercancel event handlers.
      See Also:
    • TYPE_RESIZE

      public static final String TYPE_RESIZE
      The resize event type, triggered by resize event handlers.
      See Also:
    • TYPE_PAUSE

      public static final String TYPE_PAUSE
      The pause event type, triggered by pause event handlers.
      See Also:
    • TYPE_POINTERUP

      public static final String TYPE_POINTERUP
      The pointerup event type, triggered by pointerup event handlers.
      See Also:
    • TYPE_WHEEL

      public static final String TYPE_WHEEL
      The wheel event type, triggered by wheel event handlers.
      See Also:
    • TYPE_POINTERLEAVE

      public static final String TYPE_POINTERLEAVE
      The pointerleave event type, triggered by pointerleave event handlers.
      See Also:
    • TYPE_BEFOREPRINT

      public static final String TYPE_BEFOREPRINT
      The beforeprint event type, triggered by beforeprint event handlers.
      See Also:
    • TYPE_STORAGE

      public static final String TYPE_STORAGE
      The storage event type, triggered by storage event handlers.
      See Also:
    • TYPE_ANIMATIONSTART

      public static final String TYPE_ANIMATIONSTART
      The animationstart event type, triggered by animationstart event handlers.
      See Also:
    • TYPE_TIMEUPDATE

      public static final String TYPE_TIMEUPDATE
      The timeupdate event type, triggered by timeupdate event handlers.
      See Also:
    • TYPE_PAGEHIDE

      public static final String TYPE_PAGEHIDE
      The pagehide event type, triggered by pagehide event handlers.
      See Also:
    • TYPE_WEBKITANIMATIONITERATION

      public static final String TYPE_WEBKITANIMATIONITERATION
      The webkitanimationiteration event type, triggered by webkitanimationiteration event handlers.
      See Also:
    • TYPE_DRAGOVER

      public static final String TYPE_DRAGOVER
      The dragover event type, triggered by dragover event handlers.
      See Also:
    • TYPE_ONLINE

      public static final String TYPE_ONLINE
      The online event type, triggered by online event handlers.
      See Also:
    • TYPE_VOLUMECHANGE

      public static final String TYPE_VOLUMECHANGE
      The volumechange event type, triggered by volumechange event handlers.
      See Also:
    • TYPE_GOTPOINTERCAPTURE

      public static final String TYPE_GOTPOINTERCAPTURE
      The gotpointercapture event type, triggered by gotpointercapture event handlers.
      See Also:
    • TYPE_WEBKITTRANSITIONEND

      public static final String TYPE_WEBKITTRANSITIONEND
      The webkittransitionend event type, triggered by webkittransitionend event handlers.
      See Also:
    • TYPE_WEBKITANIMATIONEND

      public static final String TYPE_WEBKITANIMATIONEND
      The webkitanimationend event type, triggered by webkitanimationend event handlers.
      See Also:
    • TYPE_DEVICEMOTION

      public static final String TYPE_DEVICEMOTION
      The devicemotion event type, triggered by devicemotion event handlers.
      See Also:
    • TYPE_STALLED

      public static final String TYPE_STALLED
      The stalled event type, triggered by stalled event handlers.
      See Also:
    • TYPE_MOUDEENTER

      public static final String TYPE_MOUDEENTER
      The mouseenter event type, triggered by mouseenter event handlers.
      See Also:
    • TYPE_DRAGLEAVE

      public static final String TYPE_DRAGLEAVE
      The dragleave event type, triggered by dragleave event handlers.
      See Also:
    • TYPE_POINTERDOWN

      public static final String TYPE_POINTERDOWN
      The pointerdown event type, triggered by pointerdown event handlers.
      See Also:
    • TYPE_DROP

      public static final String TYPE_DROP
      The drop event type, triggered by drop event handlers.
      See Also:
    • TYPE_DRAGSTART

      public static final String TYPE_DRAGSTART
      The dragstart event type, triggered by dragstart event handlers.
      See Also:
    • TYPE_TRANSITIONEND

      public static final String TYPE_TRANSITIONEND
      The transitionend event type, triggered by transitionend event handlers.
      See Also:
    • TYPE_DEVICEORIENTATIONABSOLUTE

      public static final String TYPE_DEVICEORIENTATIONABSOLUTE
      The deviceorientationabsolute event type, triggered by deviceorientationabsolute event handlers.
      See Also:
    • TYPE_BEFORECOPY

      public static final String TYPE_BEFORECOPY
      The beforecopy event type, triggered by beforecopy event handlers.
      See Also:
    • TYPE_BEFORECUT

      public static final String TYPE_BEFORECUT
      The beforecut event type, triggered by beforecut event handlers.
      See Also:
    • TYPE_BEFOREPASTE

      public static final String TYPE_BEFOREPASTE
      The beforepaste event type, triggered by beforepaste event handlers.
      See Also:
    • TYPE_SELECTSTART

      public static final String TYPE_SELECTSTART
      The selectstart event type, triggered by selectstart event handlers.
      See Also:
    • TYPE_WEBKITFULLSCREENCHANGE

      public static final String TYPE_WEBKITFULLSCREENCHANGE
      The webkitfullscreenchange event type, triggered by webkitfullscreenchange event handlers.
      See Also:
    • TYPE_WEBKITFULLSCREENERROR

      public static final String TYPE_WEBKITFULLSCREENERROR
      The webkitfullscreenerror event type, triggered by webkitfullscreenerror event handlers.
      See Also:
    • TYPE_COPY

      public static final String TYPE_COPY
      The copy event type, triggered by copy event handlers.
      See Also:
    • TYPE_CUT

      public static final String TYPE_CUT
      The cut event type, triggered by cut event handlers.
      See Also:
    • TYPE_PASTE

      public static final String TYPE_PASTE
      The paste event type, triggered by paste event handlers.
      See Also:
    • TYPE_ONMESSAGEERROR

      public static final String TYPE_ONMESSAGEERROR
      The onmessageerror event type, triggered by onmessageerror event handlers.
      See Also:
    • TYPE_POINTERLOCKCHANGE

      public static final String TYPE_POINTERLOCKCHANGE
      The pointerlockchange event type, triggered by pointerlockchange event handlers.
      See Also:
    • TYPE_POINTERLOCKERROR

      public static final String TYPE_POINTERLOCKERROR
      The pointerlockerror event type, triggered by pointerlockerror event handlers.
      See Also:
    • TYPE_SELECTIONCHANGE

      public static final String TYPE_SELECTIONCHANGE
      The selectionchange event type, triggered by selectionchange event handlers.
      See Also:
    • TYPE_AFTERSCRIPTEXECUTE

      public static final String TYPE_AFTERSCRIPTEXECUTE
      The afterscriptexecute event type, triggered by afterscriptexecute event handlers.
      See Also:
    • TYPE_BEFORESCRIPTEXECUTE

      public static final String TYPE_BEFORESCRIPTEXECUTE
      The beforescriptexecute event type, triggered by beforescriptexecute event handlers.
      See Also:
    • TYPE_ONTRANSITIONCANCEL

      public static final String TYPE_ONTRANSITIONCANCEL
      The ontransitioncancel event type, triggered by ontransitioncancel event handlers.
      See Also:
    • TYPE_ONTRANSITIONEND

      public static final String TYPE_ONTRANSITIONEND
      The ontransitionend event type, triggered by ontransitionend event handlers.
      See Also:
    • TYPE_ONTRANSITIONRUN

      public static final String TYPE_ONTRANSITIONRUN
      The ontransitionrun event type, triggered by ontransitionrun event handlers.
      See Also:
    • TYPE_ONTRANSITIONSTART

      public static final String TYPE_ONTRANSITIONSTART
      The ontransitionstart event type, triggered by ontransitionstart event handlers.
      See Also:
    • TYPE_GAMEPAD_CONNECTED

      public static final String TYPE_GAMEPAD_CONNECTED
      The ongamepadconnected event type, triggered by ongamepadconnected event handlers.
      See Also:
    • TYPE_GAMEPAD_DISCONNECTED

      public static final String TYPE_GAMEPAD_DISCONNECTED
      The ongamepaddisconnected event type, triggered by ongamepaddisconnected event handlers.
      See Also:
    • TYPE_MSSITEMODEJUMPLISTITEMREMOVED

      public static final String TYPE_MSSITEMODEJUMPLISTITEMREMOVED
      The mssitemodejumplistitemremoved event type, triggered by mssitemodejumplistitemremoved event handlers.
      See Also:
    • NONE

      public static final int NONE
      No event phase.
      See Also:
    • CAPTURING_PHASE

      public static final int CAPTURING_PHASE
      The first event phase: the capturing phase.
      See Also:
    • AT_TARGET

      public static final int AT_TARGET
      The second event phase: at the event target.
      See Also:
    • BUBBLING_PHASE

      public static final int BUBBLING_PHASE
      The third (and final) event phase: the bubbling phase.
      See Also:
    • ALT_MASK

      public static final int ALT_MASK
      Constant.
      See Also:
    • CONTROL_MASK

      public static final int CONTROL_MASK
      Constant.
      See Also:
    • SHIFT_MASK

      public static final int SHIFT_MASK
      Constant.
      See Also:
    • META_MASK

      public static final int META_MASK
      Constant.
      See Also:
    • srcElement_

      private Object srcElement_
    • target_

      private EventTarget target_
    • currentTarget_

      private org.htmlunit.corejs.javascript.Scriptable currentTarget_
    • type_

      private String type_
    • keyCode_

      private int keyCode_
    • shiftKey_

      private boolean shiftKey_
    • ctrlKey_

      private boolean ctrlKey_
    • altKey_

      private boolean altKey_
    • propertyName_

      private String propertyName_
    • stopPropagation_

      private boolean stopPropagation_
    • stopImmediatePropagation_

      private boolean stopImmediatePropagation_
    • preventDefault_

      private boolean preventDefault_
    • eventPhase_

      private int eventPhase_
      The current event phase. This is a W3C standard attribute. One of NONE, CAPTURING_PHASE, AT_TARGET or BUBBLING_PHASE.
    • bubbles_

      private boolean bubbles_
      Whether or not the event bubbles. The value of this attribute depends on the event type. To determine if a certain event type bubbles, see events Most event types do bubble, so this is true by default; event types which do not bubble should overwrite this value in their constructors.
    • cancelable_

      private boolean cancelable_
      Whether or not the event can be canceled. The value of this attribute depends on the event type. To determine if a certain event type can be canceled, see http://www.w3.org/TR/DOM-Level-2-Events/events.html The more common event types are cancelable, so this is true by default; event types which cannot be canceled should overwrite this value in their constructors.
    • timeStamp_

      private final long timeStamp_
      The time at which the event was created.
  • Constructor Details

    • Event

      public Event(DomNode domNode, String type)
      Creates a new event instance.
      Parameters:
      domNode - the DOM node that triggered the event
      type - the event type
    • Event

      public Event(EventTarget target, String type)
      Creates a new event instance.
      Parameters:
      target - the target
      type - the event type
    • Event

      public Event()
      Used to build the prototype.
  • Method Details

    • createPropertyChangeEvent

      public static Event createPropertyChangeEvent(DomNode domNode, String propertyName)
      Creates a new Event with TYPE_PROPERTY_CHANGE type.
      Parameters:
      domNode - the DOM node that triggered the event
      propertyName - the property name that was changed
      Returns:
      the new Event object
    • eventCreated

      public void eventCreated()
      Called whenever an event is created using Document.createEvent(..). This method is called after the parent scope was set so you are able to access the browser version.
    • jsConstructor

      public void jsConstructor(String type, org.htmlunit.corejs.javascript.ScriptableObject details)
      JavaScript constructor.
      Parameters:
      type - the event type
      details - the event details (optional)
    • startFire

      public void startFire()
      Called when the event starts being fired.
    • endFire

      public void endFire()
      Called when the event being fired ends.
    • getSrcElement

      public Object getSrcElement()
      Returns the object that fired the event.
      Returns:
      the object that fired the event
    • setSrcElement

      public void setSrcElement(Object srcElement)
      Sets the object that fired the event.
      Parameters:
      srcElement - the object that fired the event
    • getTarget

      public Object getTarget()
      Returns the event target to which the event was originally dispatched.
      Returns:
      the event target to which the event was originally dispatched
    • setTarget

      public void setTarget(EventTarget target)
      Sets the event target.
      Parameters:
      target - the event target
    • getCurrentTarget

      public org.htmlunit.corejs.javascript.Scriptable getCurrentTarget()
      Returns the event target whose event listeners are currently being processed. This is useful during event capturing and event bubbling.
      Returns:
      the current event target
    • setCurrentTarget

      public void setCurrentTarget(org.htmlunit.corejs.javascript.Scriptable target)
      Sets the current target.
      Parameters:
      target - the new value
    • getType

      public String getType()
      Returns the event type.
      Returns:
      the event type
    • setType

      public void setType(String type)
      Sets the event type.
      Parameters:
      type - the event type
    • setEventType

      public void setEventType(String eventType)
      Sets the event type.
      Parameters:
      eventType - the event type
    • getTimeStamp

      public long getTimeStamp()
      Returns the time at which this event was created.
      Returns:
      the time at which this event was created
    • setKeyCode

      protected void setKeyCode(int keyCode)
      Sets the key code.
      Parameters:
      keyCode - the virtual key code value of the key which was depressed, otherwise zero
    • getKeyCode

      public int getKeyCode()
      Returns the key code associated with the event.
      Returns:
      the key code associated with the event
    • isShiftKey

      public boolean isShiftKey()
      Returns whether SHIFT has been pressed during this event or not.
      Returns:
      whether SHIFT has been pressed during this event or not
    • setShiftKey

      protected void setShiftKey(boolean shiftKey)
      Sets whether SHIFT key is pressed on not.
      Parameters:
      shiftKey - whether SHIFT has been pressed during this event or not
    • isCtrlKey

      public boolean isCtrlKey()
      Returns whether CTRL has been pressed during this event or not.
      Returns:
      whether CTRL has been pressed during this event or not
    • setCtrlKey

      protected void setCtrlKey(boolean ctrlKey)
      Sets whether CTRL key is pressed on not.
      Parameters:
      ctrlKey - whether CTRL has been pressed during this event or not
    • isAltKey

      public boolean isAltKey()
      Returns whether ALT has been pressed during this event or not.
      Returns:
      whether ALT has been pressed during this event or not
    • setAltKey

      protected void setAltKey(boolean altKey)
      Sets whether ALT key is pressed on not.
      Parameters:
      altKey - whether ALT has been pressed during this event or not
    • getEventPhase

      public int getEventPhase()
      Returns the current event phase for the event.
      Returns:
      the current event phase for the event
    • setEventPhase

      public void setEventPhase(int phase)
      Sets the current event phase. Must be one of CAPTURING_PHASE, AT_TARGET or BUBBLING_PHASE.
      Parameters:
      phase - the phase the event is in
    • isBubbles

      public boolean isBubbles()
      Returns:
      whether or not this event bubbles
    • setBubbles

      protected void setBubbles(boolean bubbles)
      Parameters:
      bubbles - the bubbles to set
    • isCancelable

      public boolean isCancelable()
      Returns:
      whether or not this event can be canceled
    • setCancelable

      protected void setCancelable(boolean cancelable)
      Parameters:
      cancelable - the cancelable to set
    • isDefaultPrevented

      public boolean isDefaultPrevented()
      Returns true if both cancelable is true and preventDefault() has been called for this event. Otherwise this attribute must return false.
      Returns:
      true if this event has been cancelled or not
    • isCancelBubble

      public boolean isCancelBubble()
      Returns:
      indicates if event propagation is stopped
    • setCancelBubble

      public void setCancelBubble(boolean newValue)
      Parameters:
      newValue - indicates if event propagation is stopped
    • stopPropagation

      public void stopPropagation()
      Stops the event from propagating.
    • isPropagationStopped

      public boolean isPropagationStopped()
      Indicates if event propagation is stopped.
      Returns:
      the status
    • stopImmediatePropagation

      public void stopImmediatePropagation()
      Prevents other listeners of the same event from being called.
    • isImmediatePropagationStopped

      public boolean isImmediatePropagationStopped()
      Indicates if event immediate propagation is stopped.
      Returns:
      the status
    • handlePropertyHandlerReturnValue

      void handlePropertyHandlerReturnValue(Object returnValue)
      Handles the return values of property handlers.
      Parameters:
      returnValue - the return value returned by the property handler
    • getPropertyName

      public String getPropertyName()
      Returns the property name associated with the event.
      Returns:
      the property name associated with the event
    • initEvent

      public void initEvent(String type, boolean bubbles, boolean cancelable)
      Initializes this event.
      Parameters:
      type - the event type
      bubbles - whether or not the event should bubble
      cancelable - whether or not the event the event should be cancelable
    • preventDefault

      public void preventDefault()
      If, during any stage of event flow, this method is called the event is canceled. Any default action associated with the event will not occur. Calling this method for a non-cancelable event has no effect.
    • isAborted

      public boolean isAborted(ScriptResult result)
      Returns true if this event has been aborted via preventDefault() in standards-compliant browsers.
      Parameters:
      result - the event handler result (if false, the event is considered aborted)
      Returns:
      true if this event has been aborted
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • processLabelAfterBubbling

      public boolean processLabelAfterBubbling()
      INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
      If we click on a label, we have to simulate a click on the element referenced by the 'for' attribute also. To support this for special events we have this method here.
      Returns:
      false in this default impl
    • getReturnValue

      public Object getReturnValue()
      Returns:
      the return value property
    • setReturnValue

      public void setReturnValue(Object newValue)
      Parameters:
      newValue - the new return value
    • getComposed

      public Object getComposed()
      Returns:
      the return composed property
    • isMissingOrUndefined

      protected static boolean isMissingOrUndefined(Object value)
      Returns whether the given value indicates a missing or undefined property.
      Parameters:
      value - the new value
      Returns:
      whether the given value indicates a missing or undefined property