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

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

    },

    index: function( obj ) {
        var pos = -1;
        this.each(function(i){
            if ( this == obj ) pos = i;
        });
        return pos;
    },


    attr: function( key, value, type ) {
        // Check to see if we're setting style values
        return key.constructor != String || value != undefined ?
            this.each(function(){
                // See if we're setting a hash of styles
                if ( value == undefined )
                    // Set all the styles
                    for ( var prop in key )
                        jQuery.attr(
                            type ? this.style : this,
                            prop, key[prop]
                        );

                // See if we're setting a single key/value style
                else
                    jQuery.attr(
                        type ? this.style : this,