【发布时间】:2014-10-31 07:43:42
【问题描述】:
这个使用 Polymer 的 HTML 适用于 Chrome、IE 11 和 Firefox:
<polymer-element name="greeting-tag">
<template>
<template repeat="{{s in salutations}}">
{{s.what}},{{s.who}}
</template>
</template>
<script>
Polymer('greeting-tag', {
ready: function() {
this.salutations = [
{what: 'Hello', who: 'World'},
{what: 'GoodBye', who: 'DOM APIs'},
{what: 'Hello', who: 'Declarative'},
{what: 'GoodBye', who: 'Imperative'}
];
}
});
</script>
</polymer-element>
但是当模板重复被替换为呈现 HTML 表格的代码时:
<polymer-element name="greeting-tag">
<template>
<table>
<template repeat="{{s in salutations}}">
<tr>
<td>{{s.what}}</td>
<td>{{s.who}}</td>
</tr>
</template>
</table>
</template>
<script>
Polymer('greeting-tag', {
ready: function() {
this.salutations = [
{what: 'Hello', who: 'World'},
{what: 'GoodBye', who: 'DOM APIs'},
{what: 'Hello', who: 'Declarative'},
{what: 'GoodBye', who: 'Imperative'}
];
}
});
</script>
</polymer-element>
它在 Chrome 和 Firefox 中有效,但它在 IE 11 中无效(根本不渲染元素)。有什么线索吗?
【问题讨论】: