this.fireEvent("add", this.length-1, o, key);
return o;
},
-
+
/**
* MixedCollection has a generic way to fetch keys if you implement getKey.
<pre><code>
indexOf : function(o){
if(!this.items.indexOf){
for(var i = 0, len = this.items.length; i < len; i++){
- if(this.items[i] == o) return i;
+ if(this.items[i] == o) {
+ return i;
+ }
}
return -1;
}else{
indexOfKey : function(key){
if(!this.keys.indexOf){
for(var i = 0, len = this.keys.length; i < len; i++){
- if(this.keys[i] == key) return i;
+ if(this.keys[i] == key) {
+ return i;
+ }
}
return -1;
}else{
* @return {Object} The item associated with the passed key.
*/
item : function(key){
+ if (key === 'length') {
+ return null;
+ }
var item = typeof this.map[key] != "undefined" ? this.map[key] : this.items[key];
return typeof item != 'function' || this.allowFunctions ? item : null; // for prototype!
},