Description
Describe the bug
I just found that spreading the style
attribute have a different result from setting it directly
These two lines are not equivalent on client-side (server-side is OK) :
<div {style}></div>
<div {...{style}}></div>
=> That's because the attribute style
is set via element.setAttribute()
, but with spreads it set via style.cssText
svelte/packages/svelte/src/internal/client/dom/elements/attributes.js
Lines 378 to 380 in c40392c
I think that this line could fix the problem :
} else if (key === 'style' && value != null) {
- element.style.cssText = value + '';
+ set_attribute(element, key, value);
} else if (key === 'autofocus') {
Reproduction
Logs
System Info
REPL
Severity
annoyance