You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
A reactive assignment that looks like $: document.title = whatever; doesn't work, because the compiler (unhelpfully, in this case) auto-declares document for us, and - since that is now undefined - the assignment document.title = whatever; is a runtime error.
Logs TypeError: document is undefined
To Reproduce
<script>
$:document.title='foo';
</script>
Expected behavior
This should simply assign to the global document and not attempt to automatically declare it
Stacktraces
Information about your Svelte project:
Svelte 3.16.7 - independent of browser or bundler.
Severity
Moderate, probably. We do specifically mention this syntax in the docs, and it doesn't work.
Additional context
I believe this will simply be a matter of adjusting the logic here for when we bail out and decide we don't need to auto-declare the variable.
The text was updated successfully, but these errors were encountered:
Describe the bug
A reactive assignment that looks like
$: document.title = whatever;
doesn't work, because the compiler (unhelpfully, in this case) auto-declaresdocument
for us, and - since that is now undefined - the assignmentdocument.title = whatever;
is a runtime error.Logs
TypeError: document is undefined
To Reproduce
Expected behavior
This should simply assign to the global
document
and not attempt to automatically declare itStacktraces
Information about your Svelte project:
Svelte 3.16.7 - independent of browser or bundler.
Severity
Moderate, probably. We do specifically mention this syntax in the docs, and it doesn't work.
Additional context
I believe this will simply be a matter of adjusting the logic here for when we bail out and decide we don't need to auto-declare the variable.
The text was updated successfully, but these errors were encountered: