diff --git a/packages/svelte/src/compiler/phases/3-transform/server/visitors/shared/element.js b/packages/svelte/src/compiler/phases/3-transform/server/visitors/shared/element.js index e612cb831c3f..789df5919625 100644 --- a/packages/svelte/src/compiler/phases/3-transform/server/visitors/shared/element.js +++ b/packages/svelte/src/compiler/phases/3-transform/server/visitors/shared/element.js @@ -86,6 +86,7 @@ export function build_element_attributes(node, context) { } else if (attribute.name !== 'defaultValue' && attribute.name !== 'defaultChecked') { if (attribute.name === 'class') { class_index = attributes.length; + if (attribute.metadata.is_dynamic_class) { attributes.push({ ...attribute, @@ -98,11 +99,14 @@ export function build_element_attributes(node, context) { ) } }); + } else { + attributes.push(attribute); } } else { if (attribute.name === 'style') { style_index = attributes.length; } + attributes.push(attribute); } }