Dee*_*ons 3 javascript c# asp.net iis templates
我正在研究John Resig的微模板框架,它非常精巧,小巧,符合我的要求.唯一的问题是语法混淆了ASP.NET框架.这是因为任何东西放在里面
<%=id%>
<%=(i % 2 == 1 ? " even" : "")%>
Run Code Online (Sandbox Code Playgroud)
使用服务器变量评估表达式语法.是否有人攻击/更改了代码以使用ASP.NET?
只要改变<%并%>在解析功能<#和#>分别.我已经看到它完成了,它的效果很好.
// Convert the template into pure JavaScript
str
.replace(/[\r\t\n]/g, " ")
.split("<#").join("\t")
.replace(/((^|\#>)[^\t]*)'/g, "$1\r") //note the extra \ here
.replace(/\t=(.*?)\#>/g, "',$1,'") //and here
.split("\t").join("');")
.split("#>").join("p.push('")
.split("\r").join("\\'")
Run Code Online (Sandbox Code Playgroud)
...等等.