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 document, matches selector, with that matching element as delegateTarget. The registration is kept in _EVENTS.
Import:
import 'obsidian-test-mocks/setup';Signature:
function on(this: Document, type: string, selector: string, listener: DelegatedListener<Document>, options: boolean | AddEventListenerOptions | undefined): voidParameters:
| Parameter | Type | Description |
|---|---|---|
this |
Document | |
type |
string | The event type to listen for. |
selector |
string | The CSS selector events are filtered by. |
listener |
DelegatedListener<Document> | The listener to call, with the document as this. |
options |
boolean | AddEventListenerOptions | undefined | Standard addEventListener options. |
Returns: void