簡體   English   中英

使用EJS模板作為“文本/模板”元素的HTML驗證

[英]HTML validation with EJS templates as “text/template” elements

使用Backbone或Meteor之類的框架並從EJS模板在客戶端中構建視圖時,HTML驗證的最新思路是什么?

問題似乎是該name不是<script>標記的正式屬性。

我的代碼如下:

<div id="templates">
<script name="template_name" type="text/template">
  <p class="summary">
    <img src="<%= this.model.image() %>"/>
    <br/>
    <%= this.model.summary() %>
  </p>
  <div>
    <%= this.model.content() %>
  </div>
</script>
<!-- etc... -->
</div>

驗證錯誤是

Attribute name not allowed on element script at this point.
<script name='hover_grid' type='text/template'>
Attributes for element script:
Global attributes
src
async
defer
type
charset

我是否在等待這種支持並捍衛這種方法,還是有辦法使此標記有效?

我認為這個name實際上是id

<script id="template_name" type="text/template"> 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM