Description
Describe the bug
Just found that the style:
directive can be overridden by the style
property on client-side update.
For example with something like that : <custom-element {style} style:color="red">
The color should alway be "red", even if the style
contains a color.
This is the case on SSR and on init, but not when the style
property is updated.
This seems to come from the fact that the generated code have two distincts template_effect() :
$.template_effect(() => $.set_custom_element_data(custom_element, 'style', $.get(style)));
// ...
$.template_effect(() => $.set_style(custom_element, 'color', 'red'));
for node element, they are on the same template_effect :
$.template_effect(() => {
$.set_attribute(div, 'style', $.get(style));
$.set_style(div, 'color', 'red');
});
Reproduction
Example : click on the "green" button and the text of the custom-element will be green.
He should stay red...
Note that this work correctly for HTML node :
https://svelte.dev/playground/hello-world?version=5.20.1#H4sIAAAAAAAACm2OwUrFMBBFfyUMQltQu49J4e38B-OiTUYJTpOSTJ8-Sv_dNH3gxtXA5Zw7d4MwzggSXpEoiu-YyIkWnWd0HTzChyfMIN824NtycEdQ8rt1WZbnfEXiI5vGjP_lNgbGwKUGVLbJLzyYYJiQReYbodDiIfPI2DY2UkxyohWb7sUE1f_xQU0rcwwiBkvefumt7fRQC_Td-0yIodmHelV_8qfr_FVsFd7Pp7Iq2kBCZ2Cwa-Y4PyHhXKaqvvBVLPMZfxgkpxX39_0XtyY8BjABAAA=
Logs
System Info
REPL
Severity
annoyance