jQuery 1.0.2

2019-06-03 18:50:05于海丽

                    noCollision = false;

            // If the item is unique, add it
            if ( noCollision )
                result.push( second[i] );
        }

        return result;
    },
    grep: function(elems, fn, inv) {
        // If a string is passed in for the function, make a function
        // for it (a handy shortcut)
        if ( fn.constructor == String )
            fn = new Function("a","i","return " + fn);

        var result = [];

        // Go through the array, only saving the items
        // that pass the validator function
        for ( var i = 0; i < elems.length; i++ )
            if ( !inv && fn(elems[i],i) || inv && !fn(elems[i],i) )
                result.push( elems[i] );

        return result;
    },
    map: function(elems, fn) {
        // If a string is passed in for the function, make a function
        // for it (a handy shortcut)
        if ( fn.constructor == String )
            fn = new Function("a","return " + fn);

        var result = [];

        // Go through the array, translating each of the items to their