From 51c6aaff0b9dcf32f5e550f49e180c7bd201a0c3 Mon Sep 17 00:00:00 2001 From: pushkin Date: Thu, 23 Apr 2020 15:04:51 +0200 Subject: [PATCH] fix parent in slot wrapper (#4705) --- src/compiler/compile/render_dom/wrappers/Slot.ts | 2 +- .../samples/slot-if-block-update-no-anchor/_config.js | 7 +++++++ .../samples/slot-if-block-update-no-anchor/main.svelte | 9 +++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 test/runtime/samples/slot-if-block-update-no-anchor/_config.js create mode 100644 test/runtime/samples/slot-if-block-update-no-anchor/main.svelte diff --git a/src/compiler/compile/render_dom/wrappers/Slot.ts b/src/compiler/compile/render_dom/wrappers/Slot.ts index 1111a7cffe..492136303a 100644 --- a/src/compiler/compile/render_dom/wrappers/Slot.ts +++ b/src/compiler/compile/render_dom/wrappers/Slot.ts @@ -45,7 +45,7 @@ export default class SlotWrapper extends Wrapper { renderer, this.fallback, node.children, - parent, + this, strip_whitespace, next_sibling ); diff --git a/test/runtime/samples/slot-if-block-update-no-anchor/_config.js b/test/runtime/samples/slot-if-block-update-no-anchor/_config.js new file mode 100644 index 0000000000..060cbaa619 --- /dev/null +++ b/test/runtime/samples/slot-if-block-update-no-anchor/_config.js @@ -0,0 +1,7 @@ +export default { + test({ assert, target, component }) { + assert.htmlEqual(target.innerHTML, ``); + component.enabled = true; + assert.htmlEqual(target.innerHTML, `enabled`); + }, +}; diff --git a/test/runtime/samples/slot-if-block-update-no-anchor/main.svelte b/test/runtime/samples/slot-if-block-update-no-anchor/main.svelte new file mode 100644 index 0000000000..7960f35bc9 --- /dev/null +++ b/test/runtime/samples/slot-if-block-update-no-anchor/main.svelte @@ -0,0 +1,9 @@ + + + + + {#if enabled}enabled{/if} + +