attr
attr: function( name, value, type ) {
// <summary>
// Set a single property to a computed value, on all matched elements.
// Instead of a value, a function is provided, that computes the value.
// Part of DOM/Attributes
// </summary>
// <returns type="jQuery" />
// <param name="name" type="String">
// The name of the property to set.
// </param>
// <param name="value" type="Function">
// A function returning the value to set.
// </param>
var options = name;
// Look for the case where we're accessing a style value
if ( typeof name === "string" )
if ( value === undefined )
return this[0] && jQuery[ type || "attr" ]( this[0], name );
else {
options = {};
options[ name ] = value;
}
// Check to see if we're setting style values
return this.each(function(i){
// Set all the styles
for ( name in options )
jQuery.attr(
type ?
this.style :
this,
name, jQuery.prop( this, options[ name ], type, i, name )
);
});
},