Fix the way multiple children with the same name are handled.

This commit is contained in:
Jürg Lehni 2016-01-08 16:42:41 +01:00
parent c064cb6c43
commit 93ba42259b

View file

@ -328,7 +328,9 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
var children = parent._children, var children = parent._children,
namedChildren = parent._namedChildren; namedChildren = parent._namedChildren;
(namedChildren[name] = namedChildren[name] || []).push(this); (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._name = name || undefined;
this._changed(/*#=*/ChangeFlag.ATTRIBUTE); this._changed(/*#=*/ChangeFlag.ATTRIBUTE);