diff --git a/src/compiler/compile/render_dom/wrappers/Element/StyleAttribute.ts b/src/compiler/compile/render_dom/wrappers/Element/StyleAttribute.ts index 7f9dd2ee95..5483d194e6 100644 --- a/src/compiler/compile/render_dom/wrappers/Element/StyleAttribute.ts +++ b/src/compiler/compile/render_dom/wrappers/Element/StyleAttribute.ts @@ -35,8 +35,7 @@ export default class StyleAttributeWrapper extends AttributeWrapper { } else { const snippet = chunk.render(); - add_to_set(prop_dependencies, chunk.dependencies); - + add_to_set(prop_dependencies, chunk.dynamic_dependencies()); return chunk.get_precedence() <= 13 ? `(${snippet})` : snippet; } }) diff --git a/test/js/samples/inline-style-without-updates/expected.js b/test/js/samples/inline-style-without-updates/expected.js new file mode 100644 index 0000000000..73995c4755 --- /dev/null +++ b/test/js/samples/inline-style-without-updates/expected.js @@ -0,0 +1,47 @@ +/* generated by Svelte vX.Y.Z */ +import { + SvelteComponent, + detach, + element, + init, + insert, + noop, + safe_not_equal, + set_style +} from "svelte/internal"; + +function create_fragment(ctx) { + var div; + + return { + c() { + div = element("div"); + set_style(div, "color", color); + }, + + m(target, anchor) { + insert(target, div, anchor); + }, + + p: noop, + i: noop, + o: noop, + + d(detaching) { + if (detaching) { + detach(div); + } + } + }; +} + +let color = 'red'; + +class Component extends SvelteComponent { + constructor(options) { + super(); + init(this, options, null, create_fragment, safe_not_equal, []); + } +} + +export default Component; \ No newline at end of file diff --git a/test/js/samples/inline-style-without-updates/input.svelte b/test/js/samples/inline-style-without-updates/input.svelte new file mode 100644 index 0000000000..6f9fc90f84 --- /dev/null +++ b/test/js/samples/inline-style-without-updates/input.svelte @@ -0,0 +1,5 @@ + + +