在 IE mustache 中认为模板标签是 eq(0)

in IE mustache thinks the template tag is eq(0)

我正在尝试查询 .eq(N),但它在 IE 中全部关闭,因为 IE 认为 <template> 标记是 eq(0)

如何在忽略模板标签的情况下获得预期输出,因此 $('h1').eq(0).attr("id") 是#output 中第一个生成的元素,而不是 <template> 标签中的元素?

例如

JSON:

   var myJSON = {"id" : 80,"name" : "Frank"};

HTML:

<template style='display:none' id='myTemplate'>
  <h1 id='header{{id}}'>Hello {{name}}</h1>
</template>
<div id='output'></div>

JS:

$('#output').append( Mustache.render($('#myTemplate').html(), myJSON));

在 IE 中:

console.log($('h1').eq(0).attr("id")); //header{{id}}

其他地方:

console.log($('h1').eq(0).attr("id")); //header80

我使用 <script type='x-tmpl-mustache' id='myTemplate'> 而不是 <template style='display:none' id='myTemplate'>。 IE http://caniuse.com/#search=template 不支持模板标签。感谢@Jonathan Sampson 的提醒,我也投了票。