The mouseenter and mouseleave events are very useful, but don't seem to do anything when bound to window. Instead you have to bind them to document. Since we have a <svelte:window> element, I wonder if this...
<svelte:window on:mouseleave="handleMouseleave()"/>
...should translate to this:
document.addEventListener('mouseleave', () => {
component.handleMouseleave();
});
That would be a bit weird. Maybe it would make sense to have a <svelte:document> instead, if there were any other events worth binding…?
Recently I searched the docs for <svelte:document>, I ended up doing
oncreate() {
document.addEventListener('mouseenter', someHandler)
// ..
}
which seemed just fine.
Going with <svelte:document> was the right move — implemented in 2.15. Thanks
Most helpful comment
Going with
<svelte:document>was the right move — implemented in 2.15. Thanks