mirror of
https://github.com/jquery/jquery.git
synced 2026-02-06 19:49:11 -05:00
Restore jQuery.access parameter mistakenly removed in 80d45a69
This commit is contained in:
31
src/core.js
31
src/core.js
@@ -782,41 +782,44 @@ jQuery.extend({
|
||||
|
||||
// Multifunctional method to get and set values of a collection
|
||||
// The value/s can optionally be executed if it's a function
|
||||
access: function( elems, fn, key, value, chainable, emptyGet ) {
|
||||
access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
|
||||
var i = 0,
|
||||
length = elems.length,
|
||||
bulk = key == null,
|
||||
exec = value !== undefined && jQuery.isFunction( value );
|
||||
bulk = key == null;
|
||||
|
||||
// Sets many values
|
||||
if ( key && typeof key === "object" ) {
|
||||
chainable = true;
|
||||
for ( i in key ) {
|
||||
jQuery.access( elems, fn, i, key[i], true, emptyGet );
|
||||
jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
|
||||
}
|
||||
|
||||
// Sets one value
|
||||
} else if ( value !== undefined ) {
|
||||
chainable = true;
|
||||
|
||||
if ( bulk ) {
|
||||
// Bulk operations only iterate when executing function values
|
||||
if ( exec ) {
|
||||
exec = fn;
|
||||
fn = function( elem, key, value ) {
|
||||
return exec.call( jQuery( elem ), value );
|
||||
};
|
||||
if ( !jQuery.isFunction( value ) ) {
|
||||
raw = true;
|
||||
}
|
||||
|
||||
// Otherwise they run against the entire set
|
||||
} else {
|
||||
if ( bulk ) {
|
||||
// Bulk operations run against the entire set
|
||||
if ( raw ) {
|
||||
fn.call( elems, value );
|
||||
fn = null;
|
||||
|
||||
// ...except when executing function values
|
||||
} else {
|
||||
bulk = fn;
|
||||
fn = function( elem, key, value ) {
|
||||
return bulk.call( jQuery( elem ), value );
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if ( fn ) {
|
||||
for ( ; i < length; i++ ) {
|
||||
fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value );
|
||||
fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ jQuery.fn.extend({
|
||||
this.each(function() {
|
||||
jQuery.data( this, key, value );
|
||||
});
|
||||
}, null, value, arguments.length > 1, null, false );
|
||||
}, null, value, arguments.length > 1, null, true );
|
||||
},
|
||||
|
||||
removeData: function( key ) {
|
||||
|
||||
Reference in New Issue
Block a user