Merge pull request #567 from VladimirTechMan/master

When removing a child, set key "parent" to null, don't delete it
This commit is contained in:
Anton Lavrenov 2019-02-04 09:13:22 -05:00 committed by GitHub
commit 075431cc2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -66,7 +66,7 @@ export abstract class Container extends Node {
for (var i = 0; i < children.length; i++) {
child = children[i];
// reset parent to prevent many _setChildrenIndices calls
delete child.parent;
child.parent = null;
child.index = 0;
child.remove();
}
@ -85,7 +85,7 @@ export abstract class Container extends Node {
for (var i = 0; i < children.length; i++) {
child = children[i];
// reset parent to prevent many _setChildrenIndices calls
delete child.parent;
child.parent = null;
child.index = 0;
child.destroy();
}

View File

@ -719,7 +719,7 @@ export abstract class Node {
if (parent && parent.children) {
parent.children.splice(this.index, 1);
parent._setChildrenIndices();
delete this.parent;
this.parent = null;
}
// every cached attr that is calculated via node tree