JavaScript的语法包含<%..%> [英] Syntax of JavaScript contains <%..%>

查看:92
本文介绍了JavaScript的语法包含<%..%>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在其他开发人员编写的一些现有代码之上构建项目。这是一个构建Chrome扩展的JavaScript项目。其中一个HTML文件的代码格式如下:

I'm building a project on top of some existing code written by another developer. It's a JavaScript project to build a chrome extension. One of the HTML files has some code written in the following format:

<% $.each(this, function(index, value) { %>

<% var valPart = value.from_mail.split('<'); %>
<% var name = valPart[0]; %>
<% var ma_name= name; %>

的HTML标签包含如下元素:

And some of the HTML tags on the page contain elements like

<a class='view_name' title='<%= value.fileName %>' href='<%= getViewUrl(value.viewUrl) %>'><%= value.fileName %></a> 

getViewUrl 是一个在代码中定义的函数。 <%...%>

getViewUrl is a function defined in the code. My main query is with the code between the <%...%>

现在,我对嵌入式Ruby HTML文件使用<%...%> ; 用于在HTML文件中创建代码元素,我知道事实上Ruby没有被用在这个项目中,甚至没有ERB文件。 ?

Now, I have a fair idea that Embedded Ruby HTML files use <% ... %> for creating code elements inside the HTML file. I know for fact that Ruby isn't being used in this project or even ERB files for that matter. Any idea what this could be?

推荐答案

看起来像一个下划线模板: http://underscorejs.org/#template

Looks like an underscore template: http://underscorejs.org/#template

这篇关于JavaScript的语法包含&lt;%..%&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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