Polymer 聚合物去除母体

Polymer 聚合物去除母体,polymer,Polymer,在尝试删除父元素时,我可以在大多数情况下使用此行: Polymer.dom(Polymer.dom(this.node.domHost.parentNode).removeChild(Polymer.dom(this.node.domHost)) 但在某些情况下,我会出现以下错误: Uncaught Error: The node to be removed is not a child of this node: [object HTMLElement] 我已经验证了孩子在那里,并且对象看起

在尝试删除父元素时,我可以在大多数情况下使用此行:

Polymer.dom(Polymer.dom(this.node.domHost.parentNode).removeChild(Polymer.dom(this.node.domHost))

但在某些情况下,我会出现以下错误:

Uncaught Error: The node to be removed is not a child of this node: [object HTMLElement]

我已经验证了孩子在那里,并且对象看起来是正确的,但是我想我可能在某处丢失了一个Polymer.dom()。

通过这样做,我已经能够解决我需要的所有情况:

      var thisNode = Polymer.dom(this).node;
  Polymer.dom(Polymer.dom(thisNode.domHost).parentNode).removeChild(thisNode.domHost);

我希望它能工作
Polymer.dom(Polymer.dom(this.parentNode)).removeChild(Polymer.dom(this))我不能只使用parentNode,因为分层可能无法让我进入下一个元素。所以我需要做DOMMOST来得到下一个聚合物元素,我明白了。很久没用过这个了。