From 1ae95999d5e111e6ec4f6d1c6f045934208a8068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sun, 24 Jan 2016 17:59:39 +0100 Subject: [PATCH] Fix CompoundPath#insertChildren() when passing children lists from otheer items. --- src/path/CompoundPath.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/path/CompoundPath.js b/src/path/CompoundPath.js index 962613bc..235fc513 100644 --- a/src/path/CompoundPath.js +++ b/src/path/CompoundPath.js @@ -108,10 +108,13 @@ var CompoundPath = PathItem.extend(/** @lends CompoundPath# */{ insertChildren: function insertChildren(index, items, _preserve) { // Convert CompoundPath items in the children list by adding their - // children to the list and removing their parent. + // children to the list, replacing their parent. for (var i = items.length - 1; i >= 0; i--) { var item = items[i]; if (item instanceof CompoundPath) { + // Clone the items array before modifying it, as it may be a + // passed children array from another item. + items = items.slice(); items.splice.apply(items, [i, 1].concat(item.removeChildren())); item.remove(); }