diff --git a/src/compiler/parse/state/tag.ts b/src/compiler/parse/state/tag.ts index b1e7282912..d3854a5c2a 100644 --- a/src/compiler/parse/state/tag.ts +++ b/src/compiler/parse/state/tag.ts @@ -189,9 +189,7 @@ export default function tag(parser: Parser) { } const definition = element.attributes.splice(index, 1)[0]; - if (definition.value === true - || definition.value.length !== 1 - || !['Text', 'MustacheTag', 'AttributeShorthand'].includes(definition.value[0].type)) { + if (definition.value === true || !['Text', 'MustacheTag', 'AttributeShorthand'].includes(definition.value[0].type)) { parser.error(parser_errors.invalid_element_definition, definition.start); } diff --git a/test/runtime/samples/dynamic-element-template-literals/_config.js b/test/runtime/samples/dynamic-element-template-literals/_config.js new file mode 100644 index 0000000000..d37164b4d8 --- /dev/null +++ b/test/runtime/samples/dynamic-element-template-literals/_config.js @@ -0,0 +1,21 @@ +export default { + props: { + size: 1 + }, + html: '

This is h1 tag

', + + test({ assert, component, target }) { + const h1 = target.firstChild; + component.size = 2; + + assert.htmlEqual( + target.innerHTML, + ` +

This is h2 tag

+ ` + ); + + const h2 = target.firstChild; + assert.notEqual(h1, h2); + } +}; diff --git a/test/runtime/samples/dynamic-element-template-literals/main.svelte b/test/runtime/samples/dynamic-element-template-literals/main.svelte new file mode 100644 index 0000000000..84b63dcca7 --- /dev/null +++ b/test/runtime/samples/dynamic-element-template-literals/main.svelte @@ -0,0 +1,5 @@ + + +This is h{size} tag