Item#insertChild(): Only remove from parent if we're actually inserting the item in the new location.

This commit is contained in:
Jürg Lehni 2011-06-17 16:56:04 +01:00
parent 6f4a9d5c7b
commit 85c5e2a7eb

View file

@ -1413,8 +1413,8 @@ var Item = this.Item = Base.extend({
* @param {Item} item The item that will be appended as a child
*/
insertChild: function(index, item) {
item._removeFromParent();
if (this._children) {
item._removeFromParent();
Base.splice(this._children, [item], index, 0);
item._parent = this;
item._setProject(this._project);