Last active
January 28, 2020 10:49
-
-
Save aimozg/c073eea5a55062e3dcd8f887a8567807 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const compiler = require('vue-template-compiler'); | |
const template = '<p>a b</p>'; | |
console.log('----','template'); | |
console.log(template); | |
for (let opt of ['preserve','condense',undefined]) { | |
let x = compiler.compile(template, {whitespace: opt}); | |
console.log('\n----','whitespace:',opt); | |
console.log(x.render); | |
console.log(x.render.indexOf('\xA0') >=0 ? 'NBSP FOUND': 'NBSP NOT FOUND'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---- template | |
<p>a b</p> | |
---- whitespace: preserve | |
with(this){return _c('p',[_v("a b")])} | |
NBSP FOUND | |
---- whitespace: condense | |
with(this){return _c('p',[_v("a b")])} | |
NBSP NOT FOUND | |
---- whitespace: undefined | |
with(this){return _c('p',[_v("a b")])} | |
NBSP FOUND |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment