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
With the transition to callback props for event handlers instead of on:, I cannot tell from the docs whether an event handler for onclick overrides the actual onclick property or uses the core methods addEventListener("click") and removeEventListener("click"), especially given how the docs warn against assigning to the same event twice.
This is concerning to me since I must account for 3rd-party code outside of Svelte & my own code that may attempt to add handlers for the same events my Svelte components manipulate.
Describe the proposed solution
I assume that the underlying implementation uses the core methods to register events; if not, that in itself would be very concerning to me & deserving of its own GitHub issue. Otherwise...
I would like for the documentation about event handlers to be more explicit about...
How event handlers are registered (so people like me aren't confused).
When the add & remove calls are made in the component lifecycle.
How event handlers can safely be manipulated by third-party code.
Can client-side APIs directly use the core methods on components safely?
If not, does Svelte plan to expose a custom API for doing so?
Importance
would make my life easier
The text was updated successfully, but these errors were encountered:
We're using addEventListener under the hood, yes.
I'm not sure we need to get into that much detail in the docs, but we can certainly mention that it uses event delegation and/or addEventListener under the hood, and that event handlers are always applied after bindings event listeners (if present).
Point 3 is a bit confusing to me - I don't know what you mean by that?
Describe the problem
With the transition to callback props for event handlers instead of
on:
, I cannot tell from the docs whether an event handler foronclick
overrides the actualonclick
property or uses the core methodsaddEventListener("click")
andremoveEventListener("click")
, especially given how the docs warn against assigning to the same event twice.This is concerning to me since I must account for 3rd-party code outside of Svelte & my own code that may attempt to add handlers for the same events my Svelte components manipulate.
Describe the proposed solution
I assume that the underlying implementation uses the core methods to register events; if not, that in itself would be very concerning to me & deserving of its own GitHub issue. Otherwise...
I would like for the documentation about event handlers to be more explicit about...
Importance
would make my life easier
The text was updated successfully, but these errors were encountered: