-
Notifications
You must be signed in to change notification settings - Fork 396
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
Ractive strips whitespace in HTML too aggressively #3330
Comments
This one is a little tricky, and I vaguely remember that it's been discussed a time or two before. On one hand, you have situations like this where some whitespace is desired, and on the other, you have situations where allowing the whitespace causes unwanted wrapping unless you format your blocks all on one line. I believe there is precedent in other templating languages to have a sigil in the opening block tag to specify how it handles whitespace e.g. Any thoughts on how to reconcile this? |
Well, I see the point, that a change here might break exiting apps. But the way it's handled right now is just not right and I can not remember any template system (server or front end side) that just removes all spaces between html tags. If I, as a app author, don't want any spaces between tags than I just must not enter them in my template. As from the discussion in #3165 on this example: But regarding to the examples in the issue above I could not figure out a way to force the spaces to be there. So in the current state the author does not have a choice. Any Ideas for e workaround until any decision was made on how to handle this issue? Update: Just found a workaround by putting a space and an empty mustache or template comment to where I want to have the space. |
In this case, it's only the space inside block tags that gets stripped. So As far as workaround, that will work, but there really should be a better way. I've used I see three long term solutions:
So far, I'm leaning toward 3, but I'm definitely open to suggestions. |
Description:
Necessary whitespace between HTML elements gets stripped in loops such as:
In this example all the elements get are placed right next to each other without any space between them, which makes them a single long line that won't break anywhere.
Versions affected:
1.3.11
Reproduction:
https://jsfiddle.net/lejared/yn8om1c9/14/
The text was updated successfully, but these errors were encountered: