diff --git a/src/compiler/compile/render_dom/wrappers/Element/index.ts b/src/compiler/compile/render_dom/wrappers/Element/index.ts index ef5aa8a18e..e9d9fc8f4b 100644 --- a/src/compiler/compile/render_dom/wrappers/Element/index.ts +++ b/src/compiler/compile/render_dom/wrappers/Element/index.ts @@ -298,6 +298,7 @@ export default class ElementWrapper extends Wrapper { ${this.var}.d(1); ${this.var} = ${this.child_dynamic_element_block.name}(#ctx); ${this.var}.c(); + @transition_in(${this.var}); this.m(${this.get_update_mount_node(anchor)}, ${anchor}); } else { ${this.var}.p(#ctx, #dirty); diff --git a/test/runtime/samples/dynamic-element-transition-css-change-tag/_config.js b/test/runtime/samples/dynamic-element-transition-css-change-tag/_config.js new file mode 100644 index 0000000000..256d83af4e --- /dev/null +++ b/test/runtime/samples/dynamic-element-transition-css-change-tag/_config.js @@ -0,0 +1,14 @@ +export default { + test({ assert, component, target, raf }) { + component.visible = true; + const h1 = target.querySelector('h1'); + + assert.equal(h1.style.animation, '__svelte_3809512021_0 100ms linear 0ms 1 both'); + + raf.tick(50); + component.tag = 'h2'; + const h2 = target.querySelector('h2'); + assert.equal(h1.style.animation, '__svelte_3809512021_0 100ms linear 0ms 1 both'); + assert.equal(h2.style.animation, '__svelte_3809512021_0 100ms linear 0ms 1 both'); + } +}; diff --git a/test/runtime/samples/dynamic-element-transition-css-change-tag/main.svelte b/test/runtime/samples/dynamic-element-transition-css-change-tag/main.svelte new file mode 100644 index 0000000000..b0f24c8dec --- /dev/null +++ b/test/runtime/samples/dynamic-element-transition-css-change-tag/main.svelte @@ -0,0 +1,17 @@ + + +{#if visible} + +{/if}