在 Polymer 中,为什么使用 `<input is="iron-input">` 而不是 `<iron-input>`?
In Polymer, why use `<input is="iron-input">` instead of `<iron-input>`?
在Polymer文档(https://elements.polymer-project.org/elements/iron-input)中,我发现:
<input is="iron-input" bind-value="{{myValue}}">
而在另一个官方文档(https://www.polymer-project.org/1.0/docs/devguide/registering-elements.html#type-extension)中,我发现:
<dom-module id="main-document-element">
<template>
<p>
Hi! I'm a Polymer element that was defined in the
main document!
</p>
</template>
<script>
HTMLImports.whenReady(function () {
Polymer({
is: 'main-document-element'
});
});
</script>
</dom-module>
<main-document-element></main-document-element>
我只是想知道为什么第一个<input is="iron-input" bind-value="{{myValue}}">
不能写成<iron-input bind-value="{{myValue}}">
。
是为了兼容性,更容易polyfill吗?
iron-input
元素的源代码中不包含任何 HTML。这意味着做:
<iron-input bind-value="{{myValue}}">
不会在页面上产生实际的输入供用户交互。 iron-input
元素实际上是可以应用于标准 HTML 输入的行为集合。
在Polymer文档(https://elements.polymer-project.org/elements/iron-input)中,我发现:
<input is="iron-input" bind-value="{{myValue}}">
而在另一个官方文档(https://www.polymer-project.org/1.0/docs/devguide/registering-elements.html#type-extension)中,我发现:
<dom-module id="main-document-element">
<template>
<p>
Hi! I'm a Polymer element that was defined in the
main document!
</p>
</template>
<script>
HTMLImports.whenReady(function () {
Polymer({
is: 'main-document-element'
});
});
</script>
</dom-module>
<main-document-element></main-document-element>
我只是想知道为什么第一个<input is="iron-input" bind-value="{{myValue}}">
不能写成<iron-input bind-value="{{myValue}}">
。
是为了兼容性,更容易polyfill吗?
iron-input
元素的源代码中不包含任何 HTML。这意味着做:
<iron-input bind-value="{{myValue}}">
不会在页面上产生实际的输入供用户交互。 iron-input
元素实际上是可以应用于标准 HTML 输入的行为集合。