nibuen
nibuen

Reputation: 763

Polymer remove parent

When trying to remove a the parent element I have been able to use this line for most cases:

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

Yet in some cases I get this error:

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

I have verified the child is there and the objects look correct, but I think I am probably missing a Polymer.dom() somewhere?

Upvotes: 1

Views: 338

Answers (1)

nibuen
nibuen

Reputation: 763

I have been able to solve it for all cases that I need by doing this:

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

Upvotes: 1

Related Questions