-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<ToolTip/> throws HTMLElement is not defined #414
Comments
Hi lovasoa, this might be related to the Kai |
No, it always throws an error, even if all properties are defined correctly. The component tries to reference objects that are not defined during server-side rendering. |
Acording to https://svelte.dev/blog/whats-new-in-svelte-september-2021 HTMLElement is supported starting from svelte 3.42.2. Sveltestrap uses 3.38.2. Would upgrading svelte solve the issue? |
The changelog may be a little confusing. Svelte added HTMLElement as a known global during compilation so as not to trigger errors. But is doesn't actually define it, it expects it to be defined by the browser. In SvelteKit, components can be rendered on the server side, where HTMLElement is not defined. You can reproduce this bug with the latest SvelteKit |
Some days ago I reproduced the issue with an older svelte kit application. Just some minutes ago I tried to reproduce the issue with an uptodate svelte kit application (sveltekit next227, svelte 3.46.1) and the issue has vanished. Would you mind doublechecking on your side? |
Yes, I can confirm the bug is present with the latest sveltekit. The bug is going to be present as long as sveltestrap tries to reference undefined variables on the server side. The bug is in this repo, not in sveltekit. I was introduced in #396 |
Here is a simple reproduction you can paste into a default sveltekit project initialized with <script>
import { Tooltip } from 'sveltestrap'
</script>
<Tooltip target='xxx'>bug</Tooltip>
<h1 id='xxx'>hello</h1> |
Thanks for the fix, will release this weekend. |
Hello,
It looks like since the latest update the
<ToolTip/>
element is broken and throwsHTMLElement is not defined
when server-side rendered.Initially reported in lovasoa/sanipasse#145
The text was updated successfully, but these errors were encountered: