不使用eval / new函数的JavaScript模板库 [英] JavaScript template library that does't use eval/new Function
问题描述
使用 manifest_version:2
的Google Chrome扩展程序不能使用 eval
或 new function
。我检查过的所有JavaScript模板库(mustachejs,underscorejs,jQuery模板,hoganjs等)都使用 new Function
。有没有相当成熟和支持,不使用?
事实证明,mustachejs已添加新功能
最近使用标记0.4.2 没有它。它的API与 Mustache.to_html
而不是 Mustache.render
略有不同,并且可能会降低一些性能。 / p>
我开了个问题可能会在未来版本中删除新功能
。
Google Chrome extensions using manifest_version: 2
are restricted from using eval
or new Function
. All of the JavaScript templating libraries I checked (mustachejs, underscorejs, jQuery template, hoganjs, etc) use new Function
. Are there any that are fairly mature and supported that don't use either?
Info about the security restrictions.
It turns out that mustachejs added new Function
recently and using tag 0.4.2 doesn't have it. It the API is slightly different with Mustache.to_html
instead of Mustache.render
and there are likely some performance reduction.
I opened an issue to potentially get new Function
removed in a future release.
这篇关于不使用eval / new函数的JavaScript模板库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!