Sha256: 1fe4e32b5d4686b590ca3706943144e2c140a388e6203de2c173569020413282

Contents?: true

Size: 1.23 KB

Versions: 75

Compression:

Stored size: 1.23 KB

Contents

define( [
	"../core"
], function( jQuery ) {

"use strict";

// Multifunctional method to get and set values of a collection
// The value/s can optionally be executed if it's a function
var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
	var i = 0,
		len = elems.length,
		bulk = key == null;

	// Sets many values
	if ( jQuery.type( key ) === "object" ) {
		chainable = true;
		for ( i in key ) {
			access( elems, fn, i, key[ i ], true, emptyGet, raw );
		}

	// Sets one value
	} else if ( value !== undefined ) {
		chainable = true;

		if ( !jQuery.isFunction( value ) ) {
			raw = true;
		}

		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 < len; i++ ) {
				fn(
					elems[ i ], key, raw ?
					value :
					value.call( elems[ i ], i, fn( elems[ i ], key ) )
				);
			}
		}
	}

	if ( chainable ) {
		return elems;
	}

	// Gets
	if ( bulk ) {
		return fn.call( elems );
	}

	return len ? fn( elems[ 0 ], key ) : emptyGet;
};

return access;

} );

Version data entries

75 entries across 65 versions & 13 rubygems

Version Path
trusty-cms-3.3.7 spec/dummy/node_modules/jquery/src/core/access.js
sample_filter-0.1.4 spec/dummy/node_modules/jquery/src/core/access.js
trusty-cms-3.3.6 spec/dummy/node_modules/jquery/src/core/access.js
sample_filter-0.1.3 spec/dummy/node_modules/jquery/src/core/access.js
trusty-cms-3.3.5 spec/dummy/node_modules/jquery/src/core/access.js
optimacms-0.3.35 spec/dummy/node_modules/jquery/src/core/access.js
optimacms-0.3.35 node_modules/jquery/src/core/access.js
optimacms-0.3.34 spec/dummy/node_modules/jquery/src/core/access.js
optimacms-0.3.34 node_modules/jquery/src/core/access.js
trusty-cms-3.3.3 spec/dummy/node_modules/jquery/src/core/access.js
trusty-cms-3.3.2 spec/dummy/node_modules/jquery/src/core/access.js
trusty-cms-3.3.1 spec/dummy/node_modules/jquery/src/core/access.js
trusty-cms-3.2.1 spec/dummy/node_modules/jquery/src/core/access.js
loco-rails-3.0.3 test/dummy/node_modules/jquery/src/core/access.js
trusty-cms-3.3.0 spec/dummy/node_modules/jquery/src/core/access.js
optimacms-0.3.30 spec/dummy/node_modules/jquery/src/core/access.js
trusty-cms-3.2.0 spec/dummy/node_modules/jquery/src/core/access.js
optimacms-0.3.29 spec/dummy/node_modules/jquery/src/core/access.js
optimacms-0.3.23 spec/dummy/node_modules/jquery/src/core/access.js
trusty-cms-3.1.11 spec/dummy/node_modules/jquery/src/core/access.js