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:
are you sure the error is not semantical ?
prints the content in-line
where
if I didn’t understand please explain.
im not sure what shoud be collapsed, also there is no white space between be and collapsed
Thanks for your reply. I try to be more precisely:
vs
The line break between “be” and “collapsed” usually results in a blank space, only within slots it seems to be removed completely.
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:
Interesting, we have this in our custom element content compilation: https://github.com/aurelia/templating/blob/aacb53449aed97b48b3ca55b51d169ebf921f5ef/src/html-behavior.js#L273
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
<my-element>
</my-element>
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