Skip to content

Commit baafaff

Browse files
committed
update inline docs
1 parent 5da0081 commit baafaff

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/svelte/src/internal/client/dom/elements/events.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ export function create_event(event_name, dom, handler, options) {
6767
}
6868

6969
/**
70-
* Attaches a DOM event handler to an element and returns a function that detaches the event. The event handler
71-
* will be processed through Svelte's internal event delegation system and is the preferred way to imperatively
72-
* attach event handlers instead of using `addEventListener`.
70+
* Attaches an event handler to an element and returns a function that removes the handler. Using this
71+
* rather than `addEventListener` will preserve the correct order relative to handlers added declaratively
72+
* (with attributes like `onclick`), which use event delegation for performance reasons
7373
*
7474
* @param {Element} element
7575
* @param {string} type

packages/svelte/types/index.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2338,13 +2338,13 @@ declare module 'svelte/transition' {
23382338

23392339
declare module 'svelte/events' {
23402340
/**
2341-
* Attaches a DOM event handler to an element and returns a function that detaches the event. The event handler
2342-
* will be processed through Svelte's internal event delegation system and is the preferred way to imperatively
2343-
* attach event handlers instead of using `addEventListener`.
2341+
* Attaches an event handler to an element and returns a function that removes the handler. Using this
2342+
* rather than `addEventListener` will preserve the correct order relative to handlers added declaratively
2343+
* (with attributes like `onclick`), which use event delegation for performance reasons
23442344
*
23452345
*
23462346
*/
2347-
export function on(dom: Element, event_name: string, handler: EventListener, options?: AddEventListenerOptions | undefined): () => void;
2347+
export function on(element: Element, type: string, handler: EventListener, options?: AddEventListenerOptions | undefined): () => void;
23482348
}
23492349

23502350
declare module 'svelte/types/compiler/preprocess' {

0 commit comments

Comments
 (0)