Changeset 12798

Show
Ignore:
Timestamp:
02/29/08 21:16:48 (9 months ago)
Author:
alex
Message:

lastIndexOf() was totally borked. This fixes, rolling back changes from r10203. Refs #3961. !strict

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dojo/trunk/_base/array.js

    r12701 r12798  
    2424                        //                      http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:indexOf 
    2525 
    26                         var step = 1, end = array.length, i = 0; 
     26                        var step = 1, end = array.length, i = (fromIndex||0); 
    2727                        if(findLast){ 
    28                                 i = end - 1; 
    29                                 step = end = -1; 
     28                                step = -1, i = (fromIndex||array.length - 1), end = -1; 
    3029                        } 
    31                         for(i = fromIndex || i; i < end; i += step){ 
     30                        for(; i!=end; i+=step){ 
    3231                                if(array[i] == value){ return i; } 
    3332                        }