Node handlebars add additional Node text before the rendered view

I have the following problem: When rendering a view in a layout with rudders, the engine adds an extra text node before the rendered view body

<nav></nav>
{{{body}}}
<footer></footer>

      

leads to

<nav></nav>
"
[empty text node here]
                      "
<rendered view>
<footer></footer>

      

This empty text node has its own height and breaks my CSS margins and paddings. Please note, if I put the HTML view directly into the layout without using rudder templates, the text node is missing and everything is fine.

Any ideas why this is happening and how to solve it?

+3


source to share


2 answers


I think I found the reason, please check your partial view file if there is a BOM in the database, some editors paste it in the file with UTF-8, UTF-16 and UTF-32 formats. so if you are using UTF-8 just removing the BOM would be fine.



+2


source


@ leoyoo's answer is correct. I was about to post the same question and found this.

In Chrome, the source shows that the space character is as below (red dot): enter image description here

... and emphasizes &#65279;

I'm in Visual Studio and this is the default when saving files: enter image description here



When I change it to UTF-8 unsigned (as seen below) the whitespace disappears.

enter image description here

In Visual Studio, you do: File>>Save fileName.ext As

and then the dropdown next to the Save button. enter image description here

+3


source







All Articles