内容元素是否在 Polymer 1.0 中使用?

Is the content element used in Polymer 1.0?

https://www.polymer-project.org/1.0/docs/devguide/local-dom#dom-distribution

在上面的link下面"Dom Distribution"它说:

To support composition of an element's light DOM with its local DOM, Polymer supports the <content> element. ...

只是想知道这是否过时了? Polymer 1.0 是否按照此处所述使用插槽?

https://developers.google.com/web/fundamentals/primers/shadowdom/?hl=en#composition_slot

它绝对可以在 Polymer 1.0 中运行,即使使用 Shadow DOM;我目前在使用 Polymer 1.6 的项目中使用它,但它在 Polymer 2.0 或更新版本中可能已过时。

@ebidel 确认他们会将插槽添加到 webcomponents.js,但目前没有人分配给它:https://github.com/webcomponents/webcomponentsjs/issues/430

更新

在 Polymer 1.7 中,他们引入了 <slot> 元素来准备升级到 2.0,应该很快就会发布。 2.0 将没有 <content> 元素,因为它们切换到 CustomElement v1 规范。我建议,如果您打算使用 <content> 元素,那么将其切换到插槽,以便将来您可以只升级聚合物库而无需进行大量迁移。

插槽的工作方式有点不同,插槽没有选择器:

<dom-module id="my-element">
    <template>
        <slot name="content"></slot>
    </template>
    <script>
    Polymer({
        is: 'my-element'
    });
    </script>
</dom-module>

<my-element>
    <div slot="content">My Content</div>
</my-element>