mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Polymer.dom: when adding a node, only remove the node from its existing location if it's not a fragment and has a parent.
This commit is contained in:
parent
5033fdb29c
commit
9915627e30
@ -55,12 +55,19 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
throw Error('The ref_node to be inserted before is not a child ' +
|
||||
'of this node');
|
||||
}
|
||||
// notify existing parent that this node is being removed.
|
||||
var parent = TreeApi.Logical.getParentNode(node);
|
||||
if (parent && DomApi.hasApi(parent)) {
|
||||
dom(parent).notifyObserver();
|
||||
// remove node from its current position iff it's in a tree.
|
||||
if (node.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) {
|
||||
var parent = TreeApi.Logical.getParentNode(node);
|
||||
// notify existing parent that this node is being removed.
|
||||
if (parent) {
|
||||
if (DomApi.hasApi(parent)) {
|
||||
dom(parent).notifyObserver();
|
||||
}
|
||||
this._removeNode(node);
|
||||
} else {
|
||||
this._removeOwnerShadyRoot(node);
|
||||
}
|
||||
}
|
||||
this._removeNode(node);
|
||||
if (!this._addNode(node, ref_node)) {
|
||||
if (ref_node) {
|
||||
// if ref_node is <content> replace with first distributed node
|
||||
|
Loading…
Reference in New Issue
Block a user