Skip to content
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

  is stripped if siblings are dynamic #3014

Closed
larrikinventures opened this issue Jun 12, 2019 · 2 comments · Fixed by #3024
Closed

  is stripped if siblings are dynamic #3014

larrikinventures opened this issue Jun 12, 2019 · 2 comments · Fixed by #3024
Labels

Comments

@larrikinventures
Copy link

larrikinventures commented Jun 12, 2019

The   is treated like a normal space if it is next to dynamic content.

Good: <div>&nbsp;</div>
Good: <div>Static content&nbsp;</div>
Bad: <div>{name}&nbsp;</div>

https://svelte.dev/repl/30b9b4d5610f47459ed2dc06cecfd185?version=3.5.1 shows the various cases. Notice the height of the divs when empty - an &nbsp; holds the last two open, but the first two just have a normal space. The second div uses a variable which evaluates to just '' (I was checking in case the first render was somehow different/exempt, but it's not).

I could reproduce this in Firefox and Chrome both.

Interesting note - I have a Sapper app where the first instance of this problem is fine, but the rest hit the problem. E.g. if Case is {case}<div>{name}&nbsp;</div>, then in my app case one is fine, and only case two and three are borked.

<Case case="one" name="" />
<Case case="two" name="" />
<Case case="three" name="" />

I'm not sure what makes it work in that one spot....

@larrikinventures
Copy link
Author

A workaround if others hit this and don't want to put an explicit height on the div could be to put the nbsp into an ::after with CSS.

div::after {
    content: '\00A0'; /* &nbsp; */
}

@Conduitry Conduitry added the bug label Jun 12, 2019
@efeskucuk
Copy link
Contributor

I am working on this, but being still new, no guarantees, in case anyone else wants to get assigned to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants