gh-13270
Rich Harris 2 months ago
parent e7639a54db
commit bdbe19da61

@ -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))));

@ -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')),

Loading…
Cancel
Save