jQuery 1.0.4 - New Wave Javascript(js源文件)

2019-06-03 09:49:42刘景俊

    },

    merge: function(first, second) {
        var result = [];

        // Move b over to the new array (this helps to avoid
        // StaticNodeList instances)
        for ( var k = 0; k < first.length; k++ )
            result[k] = first[k];

        // Now check for duplicates between a and b and only
        // add the unique items
        for ( var i = 0; i < second.length; i++ ) {
            var noCollision = true;

            // The collision-checking process
            for ( var j = 0; j < first.length; j++ )
                if ( second[i] == first[j] )
                    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 ( typeof fn == "string" )
            fn = new Function("a","i","return " + fn);

        var result = [];