From fec67617e13115d8e59db14b364082b8c85fcd12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 26 Dec 2015 23:15:03 +0100 Subject: [PATCH] Merge pull request #846 from iconexperience/reduce-fix Make sure reduced item has no parent if original item had no parent. Fix for #835 --- src/item/Item.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/item/Item.js b/src/item/Item.js index 69778538..fa73b2cf 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -2325,7 +2325,12 @@ var Item = Base.extend(Emitter, /** @lends Item# */{ reduce: function() { if (this._children && this._children.length === 1) { var child = this._children[0].reduce(); - child.insertAbove(this); + // make sure that reduced item has same parent as original + if (this.parent) { + child.insertAbove(this); + } else { + child.remove(); + } child.copyAttributes(this); this.remove(); return child;