Open notramo opened 1 year ago
I have looked into it. It seems that the event handler registration is done on the pre-rendered document. It probably fires on the non-interactive pre-rendered document, before hydration. If the <img>
tag is only rendered in the hydrated version, then it fires correctly:
<img src={ typeof window === 'undefined' ? '' : source_url } on:load={ animate_loaded() }/>
Please leave this issue open as a reminder to mention it in the documentation.
on:load
handlers doesn't work with images (haven't tested other tags). Probably because the browser starts loading the file from the pre-rendered markup, which doesn't have JS support, and when the components are loaded, they are just swapped, without firing the event.