Dom-events

DOM Events (non-browser subset) Represents an occurrence of something that happens in the system, carrying type, target, propagation phase, and cancellation state for use with EventTarget dispatch.

Module: whatwg.dom-events Support: Experimental Since: 1.1.0 Docs: WHATWG Docs

Interface Event

Represents an occurrence of something that happens in the system, carrying type, target, propagation phase, and cancellation state for use with EventTarget dispatch.

Since: 1.1.0 Docs: WHATWG Docs

20 members: 20 undocumented

Constructors

⚪ constructor(type, eventInitDict)
string, EventInit

Methods

⚪ composedPath()
Returns the invocation target objects of the event's path.
⚪ stopPropagation()
Prevents the event from propagating further through capture or bubble phases.
⚪ stopImmediatePropagation()
Prevents other listeners on the same target from being called, then stops propagation.
⚪ preventDefault()
Cancels the event's default action if `cancelable` is true.

Properties

⚪ type
→ string
⚪ target
The object to which the event was dispatched.
⚪ currentTarget
The object whose event listener is currently being invoked.
⚪ eventPhase
The current dispatch phase (NONE, CAPTURING_PHASE, AT_TARGET, or BUBBLING_PHASE).
⚪ bubbles
Prevents other listeners on the same target from being called, then stops propagation.
⚪ cancelable
True if the event's default action can be prevented.
⚪ defaultPrevented
True if `preventDefault()` has been called.
⚪ composed
True if the event can propagate across shadow DOM boundaries.
⚪ isTrusted
True if the event was dispatched by the platform (not by script).
⚪ timeStamp
The time the event was created, in milliseconds since the time origin.
⚪ cancelBubble
Historical alias for stopPropagation(). Setting to true calls stopPropagation().

Constants

⚪ NONE
Event has not been dispatched.
⚪ CAPTURING_PHASE
Event is propagating through ancestors before reaching the target.
⚪ AT_TARGET
Event is at the target.
⚪ BUBBLING_PHASE
Event is propagating through ancestors after leaving the target.

---

Dictionary EventInit

3 members: 3 undocumented

Properties

⚪ bubbles
Prevents other listeners on the same target from being called, then stops propagation.
⚪ cancelable
True if the event's default action can be prevented.
⚪ composed
True if the event can propagate across shadow DOM boundaries.

---

Interface CustomEvent

An event that carries arbitrary application-defined data in its detail attribute.

Extends: Event Since: 1.1.0 Docs: WHATWG Docs

2 members: 2 undocumented

Constructors

⚪ constructor(type, eventInitDict)
string, CustomEventInit

Properties

⚪ detail
Application-defined data associated with the event.

---

Dictionary CustomEventInit

Extends: EventInit

1 members: 1 undocumented

Properties

⚪ detail
Application-defined data associated with the event.

---

Callback EventListener

A callback function invoked when a matching event is dispatched to an EventTarget.

Since: 1.1.0 Docs: WHATWG Docs

---

Dictionary EventListenerOptions

Options for removing an event listener, specifying which phase the listener was registered in.

Since: 1.1.0 Docs: WHATWG Docs

1 members: 1 undocumented

Properties

⚪ capture
Returns the invocation target objects of the event's path.

---

Dictionary AddEventListenerOptions

Extended options for adding an event listener, including passive mode, one-shot invocation, and automatic removal via an AbortSignal.

Extends: EventListenerOptions Since: 1.1.0 Docs: WHATWG Docs

3 members: 3 undocumented

Properties

⚪ passive
If true, the listener will not call `preventDefault()`.
⚪ once
If true, the listener is automatically removed after the first invocation.
⚪ signal
If true, the listener is automatically removed after the first invocation.

---

Interface EventTarget

The object to which the event was dispatched.

4 members: 4 undocumented

Constructors

⚪ constructor()
Not documented

Methods

⚪ addEventListener(type, callback, options)
string, EventListener?, (AddEventListenerOptions or boolean)
⚪ removeEventListener(type, callback, options)
string, EventListener?, (EventListenerOptions or boolean)
⚪ dispatchEvent(event)
→ boolean

---