无法将样式应用于动态创建的节点

Can't apply styles to dynamically created nodes

我创建了一个自定义元素,我从它的 <content> 中获取 html,在 created 上我使用 Polymer.dom(this.root).appendChild(paperItem)paperItem 是通过迭代创建的HTML 我从 <content>) 收到了将其插入到本地 DOM。好吧,无论我做什么,我都无法从模板的 <style> 标签中设置 <paper-item> 样式。即使 Polymer.updateStyles(); 也无济于事。我弄错了什么?

Here 解释如何将样式应用于 分布式子节点

<dom-module id="my-element">
  <template>
    <style>
  :host {
    display: block;
    border: 1px solid red;
  }
  #child-element {
    background: yellow;
  }
  /* styling elements distributed to content (via ::content) requires */
  /* selecting the parent of the <content> element for compatibility with */
  /* shady DOM . This can be :host or a wrapper element. */
  .content-wrapper > ::content .special {
    background: orange;
  }
</style>

<div id="child-element">In local DOM!</div>
<div class="content-wrapper"><content></content></div>

 </template>

  <script>

      Polymer({
          is: 'my-element'
      });

  </script>

</dom-module>

  <my-element>
    <div class="special">Here will have a different css </div>
 </my-element>