From 9b3341378a8b314885b78ce36be01efc09453af0 Mon Sep 17 00:00:00 2001 From: Simon H <5968653+dummdidumm@users.noreply.github.com> Date: Mon, 20 Nov 2023 15:20:34 +0100 Subject: [PATCH] fix: handle spreads within static strings (#9554) Previously, if a part of the template was determined be be optimizable using innerHTML, it would error if there's a spread on an attribute --- .changeset/gentle-spies-cover.md | 5 ++++ .../render_dom/wrappers/Element/index.js | 16 ++++++++-- packages/svelte/src/runtime/internal/dom.js | 30 +++++++++++++++++++ .../samples/spread-from-import/_config.js | 11 +++++++ .../samples/spread-from-import/main.svelte | 14 +++++++++ .../samples/spread-from-import/spread.js | 6 ++++ 6 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 .changeset/gentle-spies-cover.md create mode 100644 packages/svelte/test/runtime/samples/spread-from-import/_config.js create mode 100644 packages/svelte/test/runtime/samples/spread-from-import/main.svelte create mode 100644 packages/svelte/test/runtime/samples/spread-from-import/spread.js diff --git a/.changeset/gentle-spies-cover.md b/.changeset/gentle-spies-cover.md new file mode 100644 index 000000000000..d793211734dc --- /dev/null +++ b/.changeset/gentle-spies-cover.md @@ -0,0 +1,5 @@ +--- +'svelte': patch +--- + +fix: handle spreads within static strings diff --git a/packages/svelte/src/compiler/compile/render_dom/wrappers/Element/index.js b/packages/svelte/src/compiler/compile/render_dom/wrappers/Element/index.js index 9c54884807ee..134a51a1a27b 100644 --- a/packages/svelte/src/compiler/compile/render_dom/wrappers/Element/index.js +++ b/packages/svelte/src/compiler/compile/render_dom/wrappers/Element/index.js @@ -1312,9 +1312,19 @@ function to_html(wrappers, block, literal, state, can_use_raw_text) { // The value attribute of