Do not allow numeric values for Item#name.

Closes #298.
This commit is contained in:
Jürg Lehni 2013-10-08 20:38:16 +02:00
parent 921a68e4a2
commit 367aa8ea28

View file

@ -319,6 +319,10 @@ var Item = Base.extend(Callback, /** @lends Item# */{
// parent's children object:
if (this._name)
this._removeNamed();
// See if the name is a simple number, which we cannot support due to
// the named lookup on the children array.
if (name === (+name) + '')
throw 'Names consisting only of numbers are not supported.'
if (name && this._parent) {
var children = this._parent._children,
namedChildren = this._parent._namedChildren,