PureJSTemplate 介绍
Works in IE, Firefox and Webkit browsers.
Most templating languages suck
Ok, if your like me then you hate all templating langauges- they suck, they
really suck. I hate them because I hate the rules they enforce upon me, they
are slow, and they slow me down. Because of this, usually I end up making code
that looks like this:
UGLY:
`function display(data) {
var output = “
element.innerHTML=output;
}`
How horrible is that? That’s probably worse than using a bad templating
langauge.
Well, after disappointments with other jQuery templating plugins, I decided to
make my own:
The Solution: PureJstemplate
With PureJstemplate you use old fashioned javascript in your template. You
simply surround the javascript in special tags. Here’s an example of what you
can do:
<#for(var i=0; i<10; i++) { #> <#=i#> <#}#> That will output the numbers 0 through 9. Easy, isn't it?
Using it:
You simply surround your template code with a textarea tag:
and call it from javascript like so:
$(“#output”).pureJstemplate(
{
id:”tpl”,
data:{}
});
That’s it.
Get The Code
Visit a demo/benchmark page
here. Get
the js here.
PureJSTemplate 官网
http://plugins.jquery.com/project/puresjstemplate
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。