You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After all, in a vanilla DOM, usually most events auto-propagate and bubble, unless scripter's explicit preventDefault/stopPropagation (the latter is enough, IIRC).
So if you were to re-create the Svelte example in non-Svelte, manually-scripted vanilla "Web Components"/"Custom Elements", not only would you not have to "event-forward" (whether via auto-generated or manually-written dispatchEvent code) — but also, if you did so, event consumers would just receive both the dispatched and the bubbled/auto-propagated click event (ie. 2x for a single click) — unless script code is written in-component to stopPropagation.
So my question is, what is Svelte doing to suppress that standard eventing behavior of the DOM — does it generate (or import+call) stopPropagation handlers for all or most documented event types, per component? I kinda like knowing what's happening "under the hood", but even the unminified Svelte-generated JS I usually just cannot really decipher/grok tbh.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
After all, in a vanilla DOM, usually most events auto-propagate and bubble, unless scripter's explicit
preventDefault
/stopPropagation
(the latter is enough, IIRC).So if you were to re-create the Svelte example in non-Svelte, manually-scripted vanilla "Web Components"/"Custom Elements", not only would you not have to "event-forward" (whether via auto-generated or manually-written
dispatchEvent
code) — but also, if you did so, event consumers would just receive both the dispatched and the bubbled/auto-propagated click event (ie. 2x for a single click) — unless script code is written in-component tostopPropagation
.So my question is, what is Svelte doing to suppress that standard eventing behavior of the DOM — does it generate (or import+call)
stopPropagation
handlers for all or most documented event types, per component? I kinda like knowing what's happening "under the hood", but even the unminified Svelte-generated JS I usually just cannot really decipher/grok tbh.Beta Was this translation helpful? Give feedback.
All reactions