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:
Eric Rowell
2012-11-24 23:19:16 -08:00
parent 60db1a2d43
commit 48e014fe01
4 changed files with 251 additions and 262 deletions

View File

@@ -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');

View File

@@ -171,6 +171,7 @@ Kinetic.Node = (function() {
while(this.children && this.children.length > 0) {
this.children[0].remove();
}
delete this.parent;
}
},
/**