MCPcopy Create free account
hub / github.com/OpenIntroStat/ims / access

Function access

libs/jquery-3.5.1/jquery-2.2.4.js:3590–3644  ·  view source on GitHub ↗
( elems, fn, key, value, chainable, emptyGet, raw )

Source from the content-addressed store, hash-verified

3588// Multifunctional method to get and set values of a collection
3589// The value/s can optionally be executed if it's a function
3590var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
3591 var i = 0,
3592 len = elems.length,
3593 bulk = key == null;
3594
3595 // Sets many values
3596 if ( jQuery.type( key ) === "object" ) {
3597 chainable = true;
3598 for ( i in key ) {
3599 access( elems, fn, i, key[ i ], true, emptyGet, raw );
3600 }
3601
3602 // Sets one value
3603 } else if ( value !== undefined ) {
3604 chainable = true;
3605
3606 if ( !jQuery.isFunction( value ) ) {
3607 raw = true;
3608 }
3609
3610 if ( bulk ) {
3611
3612 // Bulk operations run against the entire set
3613 if ( raw ) {
3614 fn.call( elems, value );
3615 fn = null;
3616
3617 // ...except when executing function values
3618 } else {
3619 bulk = fn;
3620 fn = function( elem, key, value ) {
3621 return bulk.call( jQuery( elem ), value );
3622 };
3623 }
3624 }
3625
3626 if ( fn ) {
3627 for ( ; i < len; i++ ) {
3628 fn(
3629 elems[ i ], key, raw ?
3630 value :
3631 value.call( elems[ i ], i, fn( elems[ i ], key ) )
3632 );
3633 }
3634 }
3635 }
3636
3637 return chainable ?
3638 elems :
3639
3640 // Gets
3641 bulk ?
3642 fn.call( elems ) :
3643 len ? fn( elems[ 0 ], key ) : emptyGet;
3644};
3645var acceptData = function( owner ) {
3646
3647 // Accepts only:

Callers 1

jquery-2.2.4.jsFile · 0.70

Calls 1

jQueryFunction · 0.70

Tested by

no test coverage detected