Results 1 to 3 of 3

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

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
      0  

    Default [CLOSED][3.x/2.x] Ext.each() should use Ext.isArray() check

    Ext.each() should use the Ext.isArray() check instead of relying on an unsafe length property check.
    Code:
    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?)
    Last edited by mystix; 13 May 2009 at 2:23 AM. Reason: edit

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    128
      0  

    Default

    Definately NOT! (you should reread your own comment).

  3. #3
    Sencha User mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    5
      0  

    Default

    uuuggghhhh... nevermind.

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •