diff --git a/src/compiler/compile/render_dom/wrappers/Element/index.ts b/src/compiler/compile/render_dom/wrappers/Element/index.ts index 1744b5af12..3f1b411966 100644 --- a/src/compiler/compile/render_dom/wrappers/Element/index.ts +++ b/src/compiler/compile/render_dom/wrappers/Element/index.ts @@ -495,7 +495,10 @@ export default class ElementWrapper extends Wrapper { this.renderer.component.partly_hoisted.push(b` function ${handler}(${arg}) { ${group.bindings.map(b => b.handler.mutation)} - ${Array.from(dependencies).filter(dep => dep[0] !== '$').map(dep => b`${this.renderer.component.invalidate(dep)};`)} + ${Array.from(dependencies) + .filter(dep => dep[0] !== '$') + .filter(dep => !contextual_dependencies.has(dep)) + .map(dep => b`${this.renderer.component.invalidate(dep)};`)} } `); diff --git a/test/runtime/samples/each-block-scope-shadow-self/_config.js b/test/runtime/samples/each-block-scope-shadow-self/_config.js new file mode 100644 index 0000000000..1669dc5b6e --- /dev/null +++ b/test/runtime/samples/each-block-scope-shadow-self/_config.js @@ -0,0 +1,13 @@ +export default { + async test({ assert, component, target }) { + assert.equal(target.querySelectorAll('input').length, 3); + + const input = target.querySelector('input'); + input.value = 'svelte'; + await input.dispatchEvent(new window.Event('input')); + + assert.equal(target.querySelectorAll('input').length, 3); + assert.deepEqual(component.data, { a: 'svelte', b: 'B', c: 'C' }); + assert.deepEqual(component.x, ['a', 'b', 'c']); + }, +}; diff --git a/test/runtime/samples/each-block-scope-shadow-self/main.svelte b/test/runtime/samples/each-block-scope-shadow-self/main.svelte new file mode 100644 index 0000000000..e3643c524a --- /dev/null +++ b/test/runtime/samples/each-block-scope-shadow-self/main.svelte @@ -0,0 +1,15 @@ + + +{#each x as x} + +{/each} \ No newline at end of file