handle_event_propagation breaks due to fact that delegate is an array
Opened this issue · 2 comments
Describe the bug
Hi,
the change in this commit
Breaks i a use case where
the event is added inside of a web component created with svelte >= v5.42.3
and also from another bundle which renders the webcomponent with svelte < 5.42.3 (propbably).
so something like this:
<my-element onclick={()=>console.log("hi")}>Where "my-element" is a web-component created with svelte
In this case the call to
delegate.call()breaks with error "delegate.call is not a function"
Reproduction
Create a webcomponent with latest svelte, which also binds a "click" event to its "host" element, and bundle it.
Create a svelte app which uses the webcomponent and use onclick to bind the event on the custom-element.
Click on the element
Error arises.
Logs
System Info
Latest Chrome, Edge, Firefox, SafariSeverity
blocking an upgrade
Generally we don't support when things are compiled with multiple versions but this is exempt from that because it's compiled as a custom element.
I guess we need to make it a) backwards compatible somehow at least for Svelte 5 b) somehow mark delegated events of web components such that they don't partake in that delegation, or don't use event delegation at all in custom element builds
We will definetely upgrade the version across all apps, but it takes time, so it would be cool, if the handling of event list could be returned for next 2-3 versions