diff --git a/documentation/docs/02-template-syntax/02-basic-markup.md b/documentation/docs/02-template-syntax/02-basic-markup.md index 9a002bf5a7..a97f8b84e6 100644 --- a/documentation/docs/02-template-syntax/02-basic-markup.md +++ b/documentation/docs/02-template-syntax/02-basic-markup.md @@ -110,14 +110,16 @@ Because events are just attributes, the same rules as for attributes apply: - you can spread them: `` - component events are just (callback) properties and don't need a separate concept +Timing-wise, event attributes always fire after events from bindings (e.g. `oninput` always fires after an update to `bind:value`). Under the hood, events are either listened to directly through `addEventListener`, or the event is delegated. + ### Event delegation To reduce the memory footprint and increase performance, Svelte uses a technique called event delegation. This means that certain events are only listened to once at the application root, invoking a handler that then traverses the event call path and invokes listeners along the way. There are a few gotchas you need to be aware of when it comes to event delegation: -- when you dispatch events manually, make sure to set the `{ bubbles: true }` option -- when listening to events programmatically (i.e. not through `