不使用eval / new函数的JavaScript模板库 [英] JavaScript template library that does't use eval/new Function

查看:152
本文介绍了不使用eval / new函数的JavaScript模板库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 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屋!

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