fix binding to module-level variables (#4352)

pull/4460/head
Conduitry 6 years ago committed by Jesse Skinner
parent 60c11067f7
commit af0e7aaf55

@ -2,6 +2,7 @@
## Unreleased
* Fix binding to module-level variables ([#4086](https://github.com/sveltejs/svelte/issues/4086))
* Disallow attribute/prop names from matching two-way-bound names or `{shorthand}` attribute/prop names ([#4325](https://github.com/sveltejs/svelte/issues/4325))
## 3.18.1

@ -161,11 +161,14 @@ export default class Renderer {
}
if (
variable &&
variable && (
variable.module || (
!variable.referenced &&
!variable.is_reactive_dependency &&
!variable.export_name &&
!name.startsWith('$$')
)
)
) {
return value || name;
}

@ -0,0 +1,4 @@
export default {
skip_if_ssr: true,
html: '<div>object</div>'
};

@ -0,0 +1,11 @@
<script context='module'>
let foo;
</script>
<script>
import { onMount } from 'svelte';
let bar;
onMount(() => bar = foo);
</script>
<div bind:this={foo}>{typeof bar}</div>
Loading…
Cancel
Save