Skip to content
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

Bad error message on svelte:window #11673

Closed
ariel-salgado opened this issue May 17, 2024 · 0 comments · Fixed by #11676
Closed

Bad error message on svelte:window #11673

ariel-salgado opened this issue May 17, 2024 · 0 comments · Fixed by #11676
Labels
Milestone

Comments

@ariel-salgado
Copy link

Describe the bug

On Svelte 4 if i try to do something like this:

<script>
	let clientWidth;
</script>

<svelte:window bind:clientWidth />

It will throw the following error which is very descriptive:

'clientWidth' is not a valid binding on svelte:window — valid bindings are innerWidth, innerHeight, outerWidth, outerHeight, scrollX, scrollY, devicePixelRatio or online (5:15)

If I do the equivalent in Svelte 5:

<script>
	let clientWidth = $state();
</script>

<svelte:window bind:clientWidth />

It will throw the following error:

'Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element'

Reproduction

Svelte 4: REPL
Svelte 5: REPL

Logs

Svelte 4: 
'clientWidth' is not a valid binding on <svelte:window>; — valid bindings are innerWidth, innerHeight, outerWidth, outerHeight, scrollX, scrollY, devicePixelRatio or online (5:15)

Svelte 5:
Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element'. in App.svelte

System Info

Svelte 4 (REPL)
Svelte 5 (REPL)

Severity

annoyance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants