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.
Describe the bug
A reactive assignment that looks like
$: document.title = whatever;doesn't work, because the compiler (unhelpfully, in this case) auto-declaresdocumentfor us, and - since that is now undefined - the assignmentdocument.title = whatever;is a runtime error.Logs
TypeError: document is undefinedTo Reproduce
Expected behavior
This should simply assign to the global
documentand 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.