The issue involves unexpected spacing behavior in Svelte's template logic that may be working as intended.
The issue reports unexpected spacing when an #if block follows an #each block in Svelte templates. The maintainer suggests this may be working as designed, but the reporter finds it counterintuitive. The fix would require understanding Svelte's whitespace handling in template blocks.
Having an #if block after an #each block seems to cause this weird rendering behaviour with inline elements (haven't gotten as far as testing with anything else).
The #if block, regardless of being truthy or falsy, creates some sort of unexpected spacing in the output.
I pasted an example below in the reproduction. You can see what happens if you comment out the #if block in Element.svelte.
https://svelte.dev/playground/28de6bf5d55840348727c1c66036551e?version=5.55.0
System:
OS: Linux 6.14 Linux Mint 22.2 (Zara)
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Memory: 16.92 GB / 31.25 GB
Container: Yes
Shell: 5.2.21 - /bin/bash
Binaries:
Node: 20.19.5 - /home/henry/.nvm/versions/node/v20.19.5/bin/node
npm: 10.8.2 - /home/henry/.nvm/versions/node/v20.19.5/bin/npm
pnpm: 10.22.0 - /home/henry/.nvm/versions/node/v20.19.5/bin/pnpm
Browsers:
Chrome: 145.0.7632.116
Firefox: 144.0.2
Firefox Developer Edition: 144.0.2
annoyance
Claim this issue to let others know you're working on it. You'll earn 15 points when you complete it!