PDA

View Full Version : [CLOSED][3.x/2.x] Ext.each() should use Ext.isArray() check



mystix
13 May 2009, 2:20 AM
Ext.each() should use the Ext.isArray() check instead of relying on an unsafe length property check.


Ext.apply(Ext, {
each: function(array, fn, scope){
if(Ext.isEmpty(array, true)){
return;
}
if(!Ext.isArray(array) /* typeof array.length == "undefined" */ || Ext.isPrimitive(array)){
array = [array];
}
for(var i = 0, len = array.length; i < len; i++){
if(fn.call(scope || array[i], array[i], i, array) === false){
return i;
};
}
}
});

it should be possible to remove the isPrimitive() check too
(i can't remember why the isPrimitive() check was put in in the first place -- anyone?)

Condor
13 May 2009, 2:28 AM
Definately NOT! (you should reread your own comment (https://extjs.com/forum/showthread.php?p=308223#post308223)).

mystix
13 May 2009, 2:30 AM
uuuggghhhh... nevermind. :">

was trying to find my previous bug report but failed. oh well. my bad. again.