aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2012-11-06 09:53:00 -0500
committerRichard Gibson <richard.gibson@gmail.com>2012-11-06 09:53:00 -0500
commit0ee94159023bebe1992c5281d0f4778b4f75ff0d (patch)
tree7c97a1e3806bda1ec269903090293998477bb193 /src
parent81b094b2c180d490c093dafe53a69f59e1f8afe7 (diff)
downloadjquery-0ee94159023bebe1992c5281d0f4778b4f75ff0d.tar.gz
jquery-0ee94159023bebe1992c5281d0f4778b4f75ff0d.zip
Restore jQuery.access parameter mistakenly removed in 80d45a69
Diffstat (limited to 'src')
-rw-r--r--src/core.js31
-rw-r--r--src/data.js2
2 files changed, 18 insertions, 15 deletions
diff --git a/src/core.js b/src/core.js
index f34d72c25..53b844d59 100644
--- a/src/core.js
+++ b/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 ) ) );
}
}
}
diff --git a/src/data.js b/src/data.js
index af5f7c16f..a61042709 100644
--- a/src/data.js
+++ b/src/data.js
@@ -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 ) {