-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Description
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 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