on
Adds a delegated event listener, as Obsidian does: it is called only for events whose target, or an ancestor of it up to this element, matches selector, with that matching element as delegateTarget. The registration is kept in _EVENTS.
Import:
import 'obsidian-test-mocks/setup';Signature:
function on(this: HTMLElement, type: string, selector: string, listener: DelegatedListener<HTMLElement>, options: boolean | AddEventListenerOptions | undefined): voidParameters:
| Parameter | Type | Description |
|---|---|---|
this |
HTMLElement | |
type |
string | The event type to listen for. |
selector |
string | The CSS selector events are filtered by. |
listener |
DelegatedListener<HTMLElement> | The listener to call, with the element as this. |
options |
boolean | AddEventListenerOptions | undefined | Standard addEventListener options. |
Returns: void