Vue-cli: Non breaking spaces being stripped

Created on 7 Nov 2019  Â·  2Comments  Â·  Source: vuejs/vue-cli

Version

4.0.5

Environment info

no command :/ couldn't find anything about what vue info does so ¯\_(ツ)_/¯ 

Steps to reproduce

Add non breaking space characters. eg, in a component:

{{ text }}< template v-if="something">& nbsp ;< specialComponent />< /template>

they are stripped out by default and replaced with an ordinary space. (ignore the weird spaces. i needed some way to make those things appear in the form preview)

if i'm adding a non breaking space then there's a high chance i need it.
you can't even add a non breaking space with & nbsp ; but instead need to use {{ '\xa0' }}

What is expected?

non breaking spaces are preserved

What is actually happening?

non breaking spaces are removed and replaced with one ordinary space

non breaking spaces can only be added with what's pretty much an ugly hack

Most helpful comment

This is a bug. whitespace: condense should not remove &nbsp;, they are not whitespaces but non breaking spaces and there is a difference, if it is being added with an html entity vue should definitely not remove it or convert it to a normal space but currently that's not the case, they are being stripped down and converted to normal spaces

Since this issue is actually the most referenced in google for some reason, here are the active and open PR/Issues
https://github.com/vuejs/vue-cli/issues/5639
https://github.com/vuejs/vue/pull/11065

All 2 comments

If you are looking for a configuration option then here it is: https://github.com/vuejs/vue/tree/dev/packages/vue-template-compiler#options (whitespace or preserveWhitespace)

If not, please report to https://github.com/vuejs/vue with the required minimal reproduction link.

This is a bug. whitespace: condense should not remove &nbsp;, they are not whitespaces but non breaking spaces and there is a difference, if it is being added with an html entity vue should definitely not remove it or convert it to a normal space but currently that's not the case, they are being stripped down and converted to normal spaces

Since this issue is actually the most referenced in google for some reason, here are the active and open PR/Issues
https://github.com/vuejs/vue-cli/issues/5639
https://github.com/vuejs/vue/pull/11065

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chasegiunta picture chasegiunta  Â·  3Comments

miyamoto-san picture miyamoto-san  Â·  3Comments

DrSensor picture DrSensor  Â·  3Comments

BusyHe picture BusyHe  Â·  3Comments

sanderswang picture sanderswang  Â·  3Comments