Skip to content

Inconsistent spacing between two copies of same code #6117

Closed
@ezfe

Description

@ezfe

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

<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}

Screen Shot 2021-03-22 at 11 22 35 PM

Expected behavior
There should be no spaces in the output.

  • Your browser and the version: (e.x. Chrome 52.1, Firefox 48.0, IE 10)

Safari 14.1
Edge 89.0.774.57

  • Your operating system: (e.x. OS X 10, Ubuntu Linux 19.10, Windows XP, etc)

macOS 11

  • Svelte version (Please check you can reproduce the issue with the latest release!)

Svelte 3.35.0

  • Whether your project uses Webpack or Rollup

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions