Interface Event

All Known Subinterfaces:
AttributeMutateEvent, CustomEvent, InputEvent, MouseEvent, MutationEvent, TextChangeEvent

public interface Event
Event interface used to provide contextual information about an event.
  • Method Details

    • getType

      String getType()
      Gets the event type.
      Returns:
      Event type
      See Also:
    • getTarget

      @Nullable @Nullable Element getTarget()
      Gets the node this event was called on.

      Will return null on events fired from Document instances.

      Returns:
      Event target
    • getCurrentTarget

      EventTarget getCurrentTarget()
      Gets the event target currently executing this event
      Returns:
      Current event target
    • getDocument

      Document getDocument()
      Gets the document this event was fired in.
      Returns:
      Owning document
    • getPhase

      EventPhase getPhase()
      Gets the current event phase
      Returns:
      Event phase
    • isCancelled

      boolean isCancelled()
      Tests if the event has been cancelled
      Returns:
      true, if preventDefault() has been called at last once, false otherwise.
    • isBubbling

      boolean isBubbling()
      Tests if this event bubbles.

      Bubbling means the event will first be executed at its origin node, and then bubble up through the document tree until it reaches the root element (The body).

      Returns:
      true, if this event is set to bubble.
    • isPropagationStopped

      boolean isPropagationStopped()
      Tests if this event should no longer be dispatched to listeners
      Returns:
      true, if this event should no longer be dispatched to listeners, false otherwise.
    • isCancellable

      boolean isCancellable()
      Tests if this event can be cancelled
      Returns:
      true, if the event can be cancelled, false otherwise.
    • isComposed

      boolean isComposed()
      Tests if an internal initialization method has been called, if it has, then this event can be passed to EventTarget.dispatchEvent(Event) without issue.
      Returns:
      true, if the event has been initialized, false, otherwise.
    • stopPropagation

      void stopPropagation()
      Stops this event from being propagated to other listeners
    • preventDefault

      void preventDefault()
      Stops the 'default' behaviour.

      If isCancellable() return false, then this function does nothing.