Aurelia slot removes white-spaces

Is it possible to prevent the white-space removal when using the aurelia slot feature? Have a look at the following gist to see what I mean:

1 Like

are you sure the error is not semantical ?

prints the content in-line

prints the content using display: block;

if I didn’t understand please explain.
im not sure what shoud be collapsed, also there is no white space between be and collapsed

1 Like

Thanks for your reply. I try to be more precisely:



The line break between “be” and “collapsed” usually results in a blank space, only within slots it seems to be removed completely.

1 Like

have you enabled a html minifier of some sort?
looks like the new line between the 2 spans are eliminated.


I use the standard aurelia dumber gist setup!

It’s only when using a slot, I updated the gist, have a look:

1 Like

Interesting, we have this in our custom element content compilation:

if (currentChild.nodeType === 3 && _isAllWhitespace(currentChild)) {
  DOM.removeNode(currentChild, parentNode);

I can guess that this is necessary because empty text node still counts as “has content”, and thus prevents the slot fallback view to render. This is a more common scenario:

There’s empty text node, but really, we don’t wanna count that as content


What it didn’t account for is the scenarios where there’s content with empty text node is in the middle of 2 elements like the gist you give.

PR is welcome, and for now, I’m afraid that you will have to use &nbsp; :grin: