From f562c31e824f573d9a3254a1eacb4981b29290eb Mon Sep 17 00:00:00 2001 From: SerenaFeng Date: Fri, 12 May 2017 01:49:57 +0800 Subject: add web portal framework for TestAPI Change-Id: I62cea8b59ffe6a6cde98051c130f4502c07d3557 Signed-off-by: SerenaFeng --- .../assets/lib/jquery/src/core/access.js | 70 ++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 utils/test/testapi/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/access.js (limited to 'utils/test/testapi/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/access.js') diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/access.js b/utils/test/testapi/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/access.js new file mode 100644 index 000000000..86cdbc7e6 --- /dev/null +++ b/utils/test/testapi/3rd_party/static/testapi-ui/assets/lib/jquery/src/core/access.js @@ -0,0 +1,70 @@ +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; + +} ); -- cgit 1.2.3-korg