From 7a832d69fd42af6c811bfe1548f234a11bb06da1 Mon Sep 17 00:00:00 2001 From: baseballyama Date: Sun, 28 Nov 2021 18:03:29 +0900 Subject: [PATCH] stop to transform to normal element even if svelte:element's value of this is literal --- src/compiler/compile/nodes/Element.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/compiler/compile/nodes/Element.ts b/src/compiler/compile/nodes/Element.ts index afe8a512ae..7490f9e7d6 100644 --- a/src/compiler/compile/nodes/Element.ts +++ b/src/compiler/compile/nodes/Element.ts @@ -143,14 +143,14 @@ export default class Element extends Node { constructor(component: Component, parent: Node, scope: TemplateScope, info: TemplateNode) { super(component, parent, scope, info); - if (info.name === 'svelte:element' && typeof info.tag === 'string') { - this.name = info.tag; - } else { - this.name = info.name; - } + this.name = info.name; - if (info.name === 'svelte:element' && typeof info.tag !== 'string') { - this.tag_expr = new Expression(component, this, scope, info.tag); + if (info.name === 'svelte:element') { + if (typeof info.tag !== 'string') { + this.tag_expr = new Expression(component, this, scope, info.tag); + } else { + this.tag_expr = new Expression(component, this, scope, string_literal(info.tag) as Literal); + } } else { this.tag_expr = new Expression(component, this, scope, string_literal(this.name) as Literal); }