Sha256: 7d5d0f211ff46a0f6b670132fcf2afc0eed5c01611552e0a49a6eb5e7d17a894

Contents?: true

Size: 1.21 KB

Versions: 35

Compression:

Stored size: 1.21 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 ) )
				);
			}
		}
	}

	return chainable ?
		elems :

		// Gets
		bulk ?
			fn.call( elems ) :
			len ? fn( elems[ 0 ], key ) : emptyGet;
};

return access;

} );

Version data entries

35 entries across 35 versions & 3 rubygems

Version Path
trusty-cms-3.1.6 app/assets/bower_components/jquery/src/core/access.js
trusty-cms-3.1.5 app/assets/bower_components/jquery/src/core/access.js
trusty-cms-3.1.3 app/assets/bower_components/jquery/src/core/access.js
trusty-cms-3.1.2 app/assets/bower_components/jquery/src/core/access.js
trusty-cms-3.0.11 app/assets/bower_components/jquery/src/core/access.js
trusty-cms-3.1.1 app/assets/bower_components/jquery/src/core/access.js
trusty-cms-3.0.10 app/assets/bower_components/jquery/src/core/access.js
trusty-cms-3.1.0 app/assets/bower_components/jquery/src/core/access.js
trusty-cms-3.0.9 app/assets/bower_components/jquery/src/core/access.js
trusty-cms-3.0.8 app/assets/bower_components/jquery/src/core/access.js
trusty-cms-3.0.7 app/assets/bower_components/jquery/src/core/access.js
trusty-cms-2.0.28 app/assets/bower_components/jquery/src/core/access.js
trusty-cms-3.0.6 app/assets/bower_components/jquery/src/core/access.js
trusty-cms-2.0.27 app/assets/bower_components/jquery/src/core/access.js
trusty-cms-3.0.4 app/assets/bower_components/jquery/src/core/access.js
trusty-cms-3.0.3 app/assets/bower_components/jquery/src/core/access.js
trusty-cms-3.0.2 app/assets/bower_components/jquery/src/core/access.js
trusty-cms-3.0.1 app/assets/bower_components/jquery/src/core/access.js
trusty-cms-3.0.0 app/assets/bower_components/jquery/src/core/access.js
trusty-cms-2.0.26 app/assets/bower_components/jquery/src/core/access.js