From 93ba42259bb6e0bca4cb70f505d0e9b99e8874c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Fri, 8 Jan 2016 16:42:41 +0100 Subject: [PATCH] Fix the way multiple children with the same name are handled. --- src/item/Item.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/item/Item.js b/src/item/Item.js index a39d7e48..92e37f5f 100644 --- a/src/item/Item.js +++ b/src/item/Item.js @@ -328,7 +328,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{ var children = parent._children, namedChildren = parent._namedChildren; (namedChildren[name] = namedChildren[name] || []).push(this); - children[name] = this; + // Only set this item if there isn't one under the same name already + if (!(name in children)) + children[name] = this; } this._name = name || undefined; this._changed(/*#=*/ChangeFlag.ATTRIBUTE);