在Ruby部分内部注入DOM中的意外字符 [英] Unexpected characters injected in DOM inside Ruby partial

查看:84
本文介绍了在Ruby部分内部注入DOM中的意外字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Ruby部分控制列表。它具有图标,标签和超链接的属性。图标生成是有问题的部分:

 < i class =材料图标><%=链接[:图标]%GT;< / I> 

我称之为:

  {:icon => 链接,:超链接=> http://www.facebook.com/,:link_label => Beau} 

在上述情况下(对于图标),预期的HTML输出应为:

 < i class =material-icons>连结< / i> 

但是,一些随机字符被插入到DOM中,导致图标中断:

 < i class =material-icon& zwnj;& 8203; s> link< / i> 

我不知道是什么导致了这种情况。任何帮助,将不胜感激:)谢谢!

解决方案

非常感谢。重新解决了这个问题。当我复制其他人帮助我的解决方案时,必定会出现一些奇怪的间距或空白区域。谢谢! :)

I have a Ruby partial controlling lists. It takes an attribute for an icon, label, and hyperlink. The icon generation is the part in question:

<i class="material-icons"><%=link[:icon]%></i>

I'm calling it as such:

{ :icon => "link", :hyperlink => "http://www.facebook.com/", :link_label => "Beau" }

The expected HTML output, in the above case (for the icon) should be:

<i class="material-icons">link</i>

However, some random characters are being inserted in the DOM which causes the icon to break:

<i class="material-icon&zwnj;&#8203;s">link</i>

I have no idea what's causing this. Any help would be appreciated :) thanks!

解决方案

Great - thanks guys. A re-type solved the issue. Must have been some odd spacing or white space from when I copied the solution someone else helped me with. Thanks! :)

这篇关于在Ruby部分内部注入DOM中的意外字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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