Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meteor helper variable removes duplicate adjacent spaces

I have problem with Meteor helper variable in template.

<div id="window"> {{ string }} </div>

CSS:

#window {
    height: 450px;
    overflow: auto;
    word-wrap: break-word;
    white-space: pre-wrap;
}

I am reading text from file.

If I set the helper variable in JavaScript like:

Template.oreo.helpers({
    string: function() {
        return 'Here is sentence.   After which is spaces that is being replaced by one.   '
    }
});

The multiple string will be replaced by one single space..

Bet when I set the text using JQuery:

$('#window').text('Here   is   multiple    spaces.');

This problem does not occur.

How can I fix this? It is really important to save the text in helper string or I will have to rewrite all of my script.

like image 290
R-J Avatar asked Feb 21 '26 19:02

R-J


1 Answers

Are you sure you aren't accidentally trimming the string before displaying it in browser?

like image 182
demiters Avatar answered Feb 24 '26 10:02

demiters



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!