节点句柄在渲染视图之前添加额外的文本节点 [英] Node handlebars adds extra text node before rendered view

查看:131
本文介绍了节点句柄在渲染视图之前添加额外的文本节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题:
在布局中使用句柄渲染视图时,引擎在渲染视图正文之前添加一个额外的文本节点

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

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

会导致

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

这个空文本节点有自己的高度,打破了我的CSS边距和paddings。注意,如果我直接在布局中的视图HTML而不使用句柄模板,没有文本节点,一切都很好。

That empty text node has its own height and breaks my CSS margins and paddings. Note that if I put the view HTML directly in the layout without using handlebars templating, there is no text node and everything is fine.

任何想法为什么是这种情况,要解决它吗?

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

推荐答案

我想我找到原因,请检查您的部分视图文件, ,一些编辑器将以UTF-8,UTF-16和UTF-32格式将其插入文件。所以如果你使用UTF-8,只要删除BOM就会好的。

I think I found the reason, please check your partial view file, whether there is BOM inserted in file, some editors will insert this in file with UTF-8, UTF-16 and UTF-32 format. so if you are using UTF-8, just remove the BOM will be good.

这篇关于节点句柄在渲染视图之前添加额外的文本节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆