fix: spread attributes not work as expected

pull/9112/head
teobgeno 3 years ago
parent 82fef6ca0d
commit 63519cd77b

@ -993,7 +993,7 @@ export default class ElementWrapper extends Wrapper {
if (attr instanceof SpreadAttributeWrapper) {
const { name } = flatten_reference(attr.node.expression.node);
const snippet = { type: 'SpreadElement', argument: attr.node.expression.manipulate(block) };
static_attributes.push(p`${name}: {${snippet}}`);
static_attributes.push(p`${snippet}`);
} else {
const name = attr.property_name || attr.name;
static_attributes.push(p`${name}: ${attr.get_value(block)}`);

@ -21,12 +21,7 @@ function create_dynamic_element_3(ctx) {
return {
c() {
svelte_element = element(static_value);
set_dynamic_element_data(static_value)(svelte_element, {
static_value,
static_obj: { .../*static_obj*/ ctx[2] }
});
set_dynamic_element_data(static_value)(svelte_element, { static_value, .../*static_obj*/ ctx[2] });
toggle_class(svelte_element, "foo", static_value);
},
m(target, anchor) {
@ -48,12 +43,7 @@ function create_dynamic_element_2(ctx) {
return {
c() {
svelte_element = element(/*dynamic_value*/ ctx[0]);
set_dynamic_element_data(/*dynamic_value*/ ctx[0])(svelte_element, {
static_value,
static_obj: { .../*static_obj*/ ctx[2] }
});
set_dynamic_element_data(/*dynamic_value*/ ctx[0])(svelte_element, { static_value, .../*static_obj*/ ctx[2] });
toggle_class(svelte_element, "foo", static_value);
},
m(target, anchor) {

Loading…
Cancel
Save