在IE & Edge中有使用<template>元素的解决办法吗?
我使用<template>元素的示例
<template id="template-comment">
<tr>
<td>
<input type="text" id="input-comment-{ID}-number" name="input-comment-{ID}-number">
</td>
<td>
<input type="text" id="input-comment-{ID}-text" name="input-comment-{ID}-text">
</td>
</tr>
</template>和JavaScript模板的使用
var i = 1;
function NewComment()
{
$("#tbody-comments").append(ReplaceAll($("#template-comment").html(), "{ID}", i++));
}
function ReplaceAll(string, find, replace) { ... }发布于 2016-04-06 09:24:45
一种没有多填充的解决方案:代替<template>,只需使用<script type="text/x-html-template"> --这甚至适用于移动设备的IE和Edge (这似乎与桌面上的边缘不同)。
发布于 2015-08-20 06:36:46
如果您只需要<template>,您可以从https://github.com/WebComponents/webcomponentsjs#releases下载webcomponents-lite.js。
模板元素是Microsoft中的正在开发中,并将包含在将来的更新中,因此从长远来看,边缘不需要此元素,特别是边缘是一个常绿的自动更新浏览器。
您可以在边缘博客:第1部分和第2部分上更多地了解我们的模板计划和其他web组件规范。
https://stackoverflow.com/questions/32056142
复制相似问题