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

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

            }
        });
    },

    pushStack: function(a,args) {
        var fn = args && args[args.length-1];
        var fn2 = args && args[args.length-2];

        if ( fn && fn.constructor != Function ) fn = null;
        if ( fn2 && fn2.constructor != Function ) fn2 = null;

        if ( !fn ) {
            if ( !this.stack ) this.stack = [];
            this.stack.push( this.get() );
            this.set( a );
        } else {
            var old = this.get();
            this.set( a );

            if ( fn2 && a.length || !fn2 )
                this.each( fn2 || fn ).set( old );
            else
                this.set( old ).each( fn );
        }

        return this;
    }
};


jQuery.extend = jQuery.fn.extend = function() {
    // copy reference to target object
    var target = arguments[0],
        a = 1;

    // extend jQuery itself if only one argument is passed
    if ( arguments.length == 1 ) {
        target = this;
        a = 0;
    }
    var prop;
    while (prop = arguments[a++])
        // Extend the base object