length as a mixedcollection key confuses things...
[roojs1] / Roo / util / MixedCollection.js
index d1fe2cb..2a251ee 100644 (file)
@@ -289,7 +289,9 @@ mc.add(otherEl);
     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{
@@ -305,7 +307,9 @@ mc.add(otherEl);
     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{
@@ -319,6 +323,9 @@ mc.add(otherEl);
  * @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!
     },
@@ -486,13 +493,9 @@ mc.add(otherEl);
      * @return {MixedCollection} The new filtered collection
      */
     filterBy : function(fn, scope){
-        Roo.log(fn);
         var r = new Roo.util.MixedCollection();
-        Roo.log(r);
         r.getKey = this.getKey;
-        Roo.log(r.getKey);
         var k = this.keys, it = this.items;
-        Roo.log([k, it]);
         for(var i = 0, len = it.length; i < len; i++){
             if(fn.call(scope||this, it[i], k[i])){
                                r.add(k[i], it[i]);