DOM

DOM

Source

The CustomEvent interface can be used as starting point.
However, do not introduce any init*Event() methods as they are redundant with constructors. Interfaces that inherit
from the Event interface that have such a method only have it
for historical reasons.

EventTarget

In all current engines.

Firefox1+Safari1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE6+ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+ Node.js14.5.0+

EventListener/handleEvent

In all current engines.

Firefox1+Safari1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+

EventListener

In all current engines.

Firefox1+Safari1+Chrome1+ Opera7+Edge79+ Edge (Legacy)12+IE9+ Firefox for Android4+iOS Safari1+Chrome for Android18+Android WebView1+Samsung Internet1.0+Opera Mobile10.1+


[Exposed=(Window,Worker,AudioWorklet)]
interface EventTarget { , , optional ( = {}); );
}; callback interface EventListener { ();
}; dictionary EventListenerOptions { boolean capture = false;
}; dictionary AddEventListenerOptions : EventListenerOptions { boolean passive = false; boolean once = false; AbortSignal signal;
};

An EventTarget object represents a target to which an event can be dispatched when something has occurred.

Each EventTarget object has an associated event listener list (a list of zero or more event listeners). It is initially the empty list.

An event listener can be used to observe a specific event and consists of:

  • type (a string)
  • callback (null or an EventListener object)
  • capture (a boolean, initially false)
  • passive (a boolean, initially false)
  • once (a boolean, initially false)
  • signal (null or an AbortSignal object)
  • (a boolean for bookkeeping purposes, initially false)

Although callback is an EventListener object, an event listener is a broader concept as can be seen above.

Each EventTarget object also has an associated get the parent algorithm,
which takes an event event, and returns an EventTarget object. Unless
specified otherwise it returns null.



Read Next page

Report Page