diff --git a/packages/svelte/src/compiler/phases/3-transform/client/visitors/RegularElement.js b/packages/svelte/src/compiler/phases/3-transform/client/visitors/RegularElement.js index ce43d64d2d..e943059efa 100644 --- a/packages/svelte/src/compiler/phases/3-transform/client/visitors/RegularElement.js +++ b/packages/svelte/src/compiler/phases/3-transform/client/visitors/RegularElement.js @@ -468,12 +468,10 @@ function build_element_spread_attributes( for (const attribute of attributes) { if (attribute.type === 'Attribute') { - const name = get_attribute_name(element, attribute, context); - // TODO: handle has_call const { value } = build_attribute_value(attribute.value, context); if ( - name === 'is' && + attribute.name === 'is' && value.type === 'Literal' && context.state.metadata.namespace === 'html' ) { @@ -491,7 +489,7 @@ function build_element_spread_attributes( context.state.init.push(b.var(id, value)); values.push(b.init(attribute.name, b.id(id))); } else { - values.push(b.init(name, value)); + values.push(b.init(attribute.name, value)); } } else { values.push(b.spread(/** @type {Expression} */ (context.visit(attribute)))); diff --git a/packages/svelte/src/compiler/phases/3-transform/client/visitors/SvelteElement.js b/packages/svelte/src/compiler/phases/3-transform/client/visitors/SvelteElement.js index d0b09a962b..6e120d6d2c 100644 --- a/packages/svelte/src/compiler/phases/3-transform/client/visitors/SvelteElement.js +++ b/packages/svelte/src/compiler/phases/3-transform/client/visitors/SvelteElement.js @@ -187,18 +187,18 @@ function build_dynamic_element_attributes(element, attributes, context, element_ attribute.type === 'SpreadAttribute' && attribute.metadata.expression.has_call; } - if (needs_isolation || is_reactive) { - const id = context.state.scope.generate('attributes'); + if (is_reactive) { + const id = b.id(context.state.scope.generate('attributes')); context.state.init.push(b.let(id)); const update = b.stmt( b.assignment( '=', - b.id(id), + id, b.call( '$.set_attributes', element_id, - b.id(id), + id, b.object(values), context.state.analysis.css.hash !== '' && b.literal(context.state.analysis.css.hash), b.binary('!==', b.member(element_id, 'namespaceURI'), b.id('$.NAMESPACE_SVG')),