Clear Item#_index when removing item and simplify #getIndex().

This commit is contained in:
Jürg Lehni 2011-05-14 17:56:56 +01:00
parent 25c2d68f37
commit de34f8c157

View file

@ -272,7 +272,7 @@ var Item = this.Item = Base.extend({
* The index of this item within the list of it's parent's children. * The index of this item within the list of it's parent's children.
*/ */
getIndex: function() { getIndex: function() {
return this._index !== undefined ? this._index : null; return this._index;
}, },
/** /**
@ -283,6 +283,7 @@ var Item = this.Item = Base.extend({
var ok = !!Base.splice(this._parent.children, null, var ok = !!Base.splice(this._parent.children, null,
this._index, 1).length; this._index, 1).length;
this._parent = null; this._parent = null;
this._index = null;
return ok; return ok;
} }
return false; return false;