-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Inconsistent spacing between two copies of same code #6117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Curiously this only happens in the very last block. If you repeat it more than two times it's always the last block. And if you add anything after the each block the space disappears. I hope this helps. No spaces because of the "x" at the end: <script>
let name = 'Hello world';
</script>
{#each name as character}
<span>
{#if character == "l"}
A
{:else}
B
{/if}
</span>
{/each}
{#each name as character}
<span>
{#if character == "l"}
A
{:else}
B
{/if}
</span>
{/each}
{#each name as character}
<span>
{#if character == "l"}
A
{:else}
B
{/if}
</span>
{/each}
x |
Yea, I actually noticed that after filing but forgot to come back and add it in. It's super variable, (if of course not actually random). |
heh this space exists but not working inside Svelte runtime tests |
I found a REPL that actually identifies the same issue: https://svelte.dev/repl/b6c71bf8825f46028793d804facf5e08?version=3.5.1 |
@ezfe I think is different issue |
ok, I know why it's happens |
because the first \n (actually something more) between two Fragments (each) we can remove, but the last \n have no obvious reasons to remove. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Svelte 5 does whitespace trimming a bit differently, and therefore this issue is fixed |
Describe the bug
Spaces are added to the Svelte output causing the rendered text not to appear as expected (for example, looping over and outputting characters in a string).
To Reproduce
REPL: https://svelte.dev/repl/86aa94c8350845e794b27ea9f75624e9?version=3.35.0
Expected behavior
There should be no spaces in the output.
Safari 14.1
Edge 89.0.774.57
macOS 11
Svelte 3.35.0
Rollup, reproduced with Repl
Severity
How severe an issue is this bug to you? Is this annoying, blocking some users, blocking an upgrade or blocking your usage of Svelte entirely?
This bug is blocking a secondary feature of my website. I am building a preview of formatted text, and need to be able to loop over text and show each one in its own
<span>
. Only spaces in the source text should appear in the HTML.The text was updated successfully, but these errors were encountered: