mirror of
https://github.com/konvajs/konva.git
synced 2025-10-15 12:34:52 +08:00
bug fix #29 bug fix #143 when node.remove() is called, parent property is unset. Also migrated remove tests from containerTests to nodeTests.
This commit is contained in:
@@ -245,13 +245,14 @@ Kinetic.Layer.prototype = {
|
||||
* remove layer from stage
|
||||
*/
|
||||
remove: function() {
|
||||
var stage = this.getStage();
|
||||
Kinetic.Node.prototype.remove.call(this);
|
||||
/*
|
||||
* remove canvas DOM from the document if
|
||||
* it exists
|
||||
*/
|
||||
try {
|
||||
this.getStage().content.removeChild(this.canvas.element);
|
||||
stage.content.removeChild(this.canvas.element);
|
||||
}
|
||||
catch(e) {
|
||||
Kinetic.Global.warn('unable to remove layer scene canvas element from the document');
|
||||
|
@@ -171,6 +171,7 @@ Kinetic.Node = (function() {
|
||||
while(this.children && this.children.length > 0) {
|
||||
this.children[0].remove();
|
||||
}
|
||||
delete this.parent;
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
Reference in New Issue
Block a user