MCPcopy Create free account
hub / github.com/aspnet/AzureSignalR-samples / access

Function access

aspnet-samples/AspNetForm/Scripts/jquery-3.7.0.js:3871–3928  ·  view source on GitHub ↗
( elems, fn, key, value, chainable, emptyGet, raw )

Source from the content-addressed store, hash-verified

3869// Multifunctional method to get and set values of a collection
3870// The value/s can optionally be executed if it's a function
3871var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
3872 var i = 0,
3873 len = elems.length,
3874 bulk = key == null;
3875
3876 // Sets many values
3877 if ( toType( key ) === "object" ) {
3878 chainable = true;
3879 for ( i in key ) {
3880 access( elems, fn, i, key[ i ], true, emptyGet, raw );
3881 }
3882
3883 // Sets one value
3884 } else if ( value !== undefined ) {
3885 chainable = true;
3886
3887 if ( !isFunction( value ) ) {
3888 raw = true;
3889 }
3890
3891 if ( bulk ) {
3892
3893 // Bulk operations run against the entire set
3894 if ( raw ) {
3895 fn.call( elems, value );
3896 fn = null;
3897
3898 // ...except when executing function values
3899 } else {
3900 bulk = fn;
3901 fn = function( elem, _key, value ) {
3902 return bulk.call( jQuery( elem ), value );
3903 };
3904 }
3905 }
3906
3907 if ( fn ) {
3908 for ( ; i < len; i++ ) {
3909 fn(
3910 elems[ i ], key, raw ?
3911 value :
3912 value.call( elems[ i ], i, fn( elems[ i ], key ) )
3913 );
3914 }
3915 }
3916 }
3917
3918 if ( chainable ) {
3919 return elems;
3920 }
3921
3922 // Gets
3923 if ( bulk ) {
3924 return fn.call( elems );
3925 }
3926
3927 return len ? fn( elems[ 0 ], key ) : emptyGet;
3928};

Callers 1

jquery-3.7.0.jsFile · 0.70

Calls 3

toTypeFunction · 0.70
isFunctionFunction · 0.70
jQueryFunction · 0.70

Tested by

no test coverage detected