2015-08-16 06:59:58 +00:00
|
|
|
define( [
|
2013-10-15 14:40:48 +00:00
|
|
|
"./var/arr",
|
2014-09-11 20:18:34 +00:00
|
|
|
"./var/document",
|
2016-03-14 20:46:51 +00:00
|
|
|
"./var/getProto",
|
2013-10-15 14:40:48 +00:00
|
|
|
"./var/slice",
|
|
|
|
"./var/concat",
|
|
|
|
"./var/push",
|
|
|
|
"./var/indexOf",
|
|
|
|
"./var/class2type",
|
|
|
|
"./var/toString",
|
|
|
|
"./var/hasOwn",
|
2016-03-14 20:46:51 +00:00
|
|
|
"./var/fnToString",
|
|
|
|
"./var/ObjectFunctionString",
|
2015-11-13 22:28:16 +00:00
|
|
|
"./var/support",
|
|
|
|
"./core/DOMEval"
|
2016-03-14 20:46:51 +00:00
|
|
|
], function( arr, document, getProto, slice, concat, push, indexOf,
|
|
|
|
class2type, toString, hasOwn, fnToString, ObjectFunctionString,
|
|
|
|
support, DOMEval ) {
|
2013-08-15 18:15:49 +00:00
|
|
|
|
2016-04-25 18:25:08 +00:00
|
|
|
"use strict";
|
|
|
|
|
2012-06-16 01:01:44 +00:00
|
|
|
var
|
2013-08-15 18:15:49 +00:00
|
|
|
version = "@VERSION",
|
2012-06-04 16:48:18 +00:00
|
|
|
|
|
|
|
// Define a local copy of jQuery
|
|
|
|
jQuery = function( selector, context ) {
|
2015-08-16 06:59:58 +00:00
|
|
|
|
2009-05-20 21:12:08 +00:00
|
|
|
// The jQuery object is actually just the init constructor 'enhanced'
|
2013-09-10 00:13:01 +00:00
|
|
|
// Need init if jQuery is called (just allow error to be thrown if not included)
|
|
|
|
return new jQuery.fn.init( selector, context );
|
2009-05-20 21:12:08 +00:00
|
|
|
},
|
2009-03-31 17:35:20 +00:00
|
|
|
|
2016-03-23 14:03:06 +00:00
|
|
|
// Support: Android <=4.0 only
|
2014-02-13 22:48:58 +00:00
|
|
|
// Make sure we trim BOM and NBSP
|
|
|
|
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
|
|
|
|
|
2011-05-25 19:10:49 +00:00
|
|
|
// Matches dashed string for camelizing
|
2011-08-17 21:30:31 +00:00
|
|
|
rmsPrefix = /^-ms-/,
|
2015-05-04 14:49:21 +00:00
|
|
|
rdashAlpha = /-([a-z])/g,
|
2011-05-25 19:10:49 +00:00
|
|
|
|
|
|
|
// Used by jQuery.camelCase as callback to replace()
|
|
|
|
fcamelCase = function( all, letter ) {
|
2012-11-26 08:20:43 +00:00
|
|
|
return letter.toUpperCase();
|
|
|
|
};
|
2009-03-31 17:35:20 +00:00
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
jQuery.fn = jQuery.prototype = {
|
2015-08-16 06:59:58 +00:00
|
|
|
|
2012-11-26 08:20:43 +00:00
|
|
|
// The current version of jQuery being used
|
2013-08-15 18:15:49 +00:00
|
|
|
jquery: version,
|
2012-11-26 08:20:43 +00:00
|
|
|
|
2010-10-10 00:32:54 +00:00
|
|
|
constructor: jQuery,
|
2013-08-15 18:15:49 +00:00
|
|
|
|
2009-07-17 01:47:26 +00:00
|
|
|
// The default length of a jQuery object is 0
|
|
|
|
length: 0,
|
|
|
|
|
2009-12-22 00:58:13 +00:00
|
|
|
toArray: function() {
|
2013-08-15 18:15:49 +00:00
|
|
|
return slice.call( this );
|
2009-07-23 13:22:55 +00:00
|
|
|
},
|
2009-07-16 07:31:32 +00:00
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
// Get the Nth element in the matched element set OR
|
|
|
|
// Get the whole matched element set as a clean array
|
|
|
|
get: function( num ) {
|
2013-09-28 15:57:46 +00:00
|
|
|
return num != null ?
|
2008-01-14 22:30:48 +00:00
|
|
|
|
2014-03-18 09:15:58 +00:00
|
|
|
// Return just the one element from the set
|
2013-09-28 15:57:46 +00:00
|
|
|
( num < 0 ? this[ num + this.length ] : this[ num ] ) :
|
2008-01-14 22:30:48 +00:00
|
|
|
|
2014-03-18 09:15:58 +00:00
|
|
|
// Return all the elements in a clean array
|
2013-09-28 15:57:46 +00:00
|
|
|
slice.call( this );
|
2008-01-14 22:30:48 +00:00
|
|
|
},
|
2008-05-13 01:45:58 +00:00
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
// Take an array of elements and push it onto the stack
|
|
|
|
// (returning the new matched element set)
|
2012-10-24 00:22:34 +00:00
|
|
|
pushStack: function( elems ) {
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2012-06-28 00:55:36 +00:00
|
|
|
// Build a new jQuery matched element set
|
|
|
|
var ret = jQuery.merge( this.constructor(), elems );
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
// Add the old object onto the stack (as a reference)
|
|
|
|
ret.prevObject = this;
|
2008-12-19 04:37:10 +00:00
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
// Return the newly-formed element set
|
|
|
|
return ret;
|
|
|
|
},
|
2008-05-13 01:45:58 +00:00
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
// Execute a callback for every element in the matched set.
|
2015-02-17 07:09:54 +00:00
|
|
|
each: function( callback ) {
|
|
|
|
return jQuery.each( this, callback );
|
2008-01-14 22:30:48 +00:00
|
|
|
},
|
2011-01-05 21:41:23 +00:00
|
|
|
|
2013-09-28 15:57:46 +00:00
|
|
|
map: function( callback ) {
|
2015-08-16 06:59:58 +00:00
|
|
|
return this.pushStack( jQuery.map( this, function( elem, i ) {
|
2013-09-28 15:57:46 +00:00
|
|
|
return callback.call( elem, i, elem );
|
2015-08-16 06:59:58 +00:00
|
|
|
} ) );
|
2013-09-28 15:57:46 +00:00
|
|
|
},
|
|
|
|
|
2012-10-19 21:08:50 +00:00
|
|
|
slice: function() {
|
2013-08-15 18:15:49 +00:00
|
|
|
return this.pushStack( slice.apply( this, arguments ) );
|
2009-12-10 17:25:25 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
first: function() {
|
|
|
|
return this.eq( 0 );
|
|
|
|
},
|
|
|
|
|
|
|
|
last: function() {
|
|
|
|
return this.eq( -1 );
|
|
|
|
},
|
|
|
|
|
2012-10-19 21:08:50 +00:00
|
|
|
eq: function( i ) {
|
|
|
|
var len = this.length,
|
|
|
|
j = +i + ( i < 0 ? len : 0 );
|
2015-08-16 06:59:58 +00:00
|
|
|
return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
|
2009-12-10 17:25:25 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
end: function() {
|
2015-07-02 06:33:38 +00:00
|
|
|
return this.prevObject || this.constructor();
|
2009-12-10 17:25:25 +00:00
|
|
|
},
|
2008-01-14 22:30:48 +00:00
|
|
|
|
2009-03-17 20:39:29 +00:00
|
|
|
// For internal use only.
|
|
|
|
// Behaves like an Array's method, not like a jQuery method.
|
2013-08-15 18:15:49 +00:00
|
|
|
push: push,
|
|
|
|
sort: arr.sort,
|
|
|
|
splice: arr.splice
|
2008-01-14 22:30:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
jQuery.extend = jQuery.fn.extend = function() {
|
2011-02-15 21:03:23 +00:00
|
|
|
var options, name, src, copy, copyIsArray, clone,
|
2015-08-16 06:59:58 +00:00
|
|
|
target = arguments[ 0 ] || {},
|
2010-11-09 16:09:07 +00:00
|
|
|
i = 1,
|
|
|
|
length = arguments.length,
|
|
|
|
deep = false;
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
// Handle a deep copy situation
|
2008-11-17 16:32:05 +00:00
|
|
|
if ( typeof target === "boolean" ) {
|
2008-01-14 22:30:48 +00:00
|
|
|
deep = target;
|
2013-09-28 15:57:46 +00:00
|
|
|
|
2014-04-25 22:26:36 +00:00
|
|
|
// Skip the boolean and the target
|
2013-09-28 15:57:46 +00:00
|
|
|
target = arguments[ i ] || {};
|
|
|
|
i++;
|
2008-01-14 22:30:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Handle case when target is a string or something (possible in deep copy)
|
2015-08-16 06:59:58 +00:00
|
|
|
if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
|
2008-01-14 22:30:48 +00:00
|
|
|
target = {};
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
|
2014-04-25 22:26:36 +00:00
|
|
|
// Extend jQuery itself if only one argument is passed
|
2013-09-28 15:57:46 +00:00
|
|
|
if ( i === length ) {
|
2008-01-14 22:30:48 +00:00
|
|
|
target = this;
|
2013-09-28 15:57:46 +00:00
|
|
|
i--;
|
2008-01-14 22:30:48 +00:00
|
|
|
}
|
|
|
|
|
2009-03-31 17:35:20 +00:00
|
|
|
for ( ; i < length; i++ ) {
|
2015-08-16 06:59:58 +00:00
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
// Only deal with non-null/undefined values
|
2015-08-16 06:59:58 +00:00
|
|
|
if ( ( options = arguments[ i ] ) != null ) {
|
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
// Extend the base object
|
2009-03-31 17:35:20 +00:00
|
|
|
for ( name in options ) {
|
|
|
|
src = target[ name ];
|
|
|
|
copy = options[ name ];
|
2008-05-13 01:45:58 +00:00
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
// Prevent never-ending loop
|
2009-03-31 17:35:20 +00:00
|
|
|
if ( target === copy ) {
|
2008-01-14 22:30:48 +00:00
|
|
|
continue;
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
|
2010-01-30 18:50:49 +00:00
|
|
|
// Recurse if we're merging plain objects or arrays
|
2015-08-16 06:59:58 +00:00
|
|
|
if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
|
|
|
|
( copyIsArray = jQuery.isArray( copy ) ) ) ) {
|
2014-07-17 17:25:59 +00:00
|
|
|
|
2010-01-30 18:50:49 +00:00
|
|
|
if ( copyIsArray ) {
|
|
|
|
copyIsArray = false;
|
2015-08-16 06:59:58 +00:00
|
|
|
clone = src && jQuery.isArray( src ) ? src : [];
|
2010-01-30 18:50:49 +00:00
|
|
|
|
|
|
|
} else {
|
2015-08-16 06:59:58 +00:00
|
|
|
clone = src && jQuery.isPlainObject( src ) ? src : {};
|
2010-01-30 18:50:49 +00:00
|
|
|
}
|
2009-07-16 07:32:03 +00:00
|
|
|
|
|
|
|
// Never move original objects, clone them
|
|
|
|
target[ name ] = jQuery.extend( deep, clone, copy );
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
// Don't bring in undefined values
|
2009-03-31 17:35:20 +00:00
|
|
|
} else if ( copy !== undefined ) {
|
2008-04-30 00:09:55 +00:00
|
|
|
target[ name ] = copy;
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
}
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
// Return the modified object
|
|
|
|
return target;
|
|
|
|
};
|
|
|
|
|
2015-08-16 06:59:58 +00:00
|
|
|
jQuery.extend( {
|
|
|
|
|
2013-02-25 20:48:22 +00:00
|
|
|
// Unique for each copy of jQuery on the page
|
2013-08-15 18:15:49 +00:00
|
|
|
expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
|
|
|
|
|
|
|
|
// Assume jQuery is ready without the ready module
|
|
|
|
isReady: true,
|
2013-02-25 20:48:22 +00:00
|
|
|
|
2013-09-28 15:57:46 +00:00
|
|
|
error: function( msg ) {
|
|
|
|
throw new Error( msg );
|
|
|
|
},
|
|
|
|
|
|
|
|
noop: function() {},
|
|
|
|
|
2008-11-17 16:32:05 +00:00
|
|
|
isFunction: function( obj ) {
|
2015-08-16 06:59:58 +00:00
|
|
|
return jQuery.type( obj ) === "function";
|
2008-01-14 22:30:48 +00:00
|
|
|
},
|
2008-11-17 16:32:05 +00:00
|
|
|
|
2012-12-17 22:09:30 +00:00
|
|
|
isArray: Array.isArray,
|
2010-08-25 16:57:34 +00:00
|
|
|
|
2010-09-22 20:41:51 +00:00
|
|
|
isWindow: function( obj ) {
|
2013-03-13 23:23:36 +00:00
|
|
|
return obj != null && obj === obj.window;
|
2010-09-22 20:41:51 +00:00
|
|
|
},
|
|
|
|
|
2011-10-12 01:04:22 +00:00
|
|
|
isNumeric: function( obj ) {
|
2015-08-16 06:59:58 +00:00
|
|
|
|
2015-10-18 19:50:43 +00:00
|
|
|
// As of jQuery 3.0, isNumeric is limited to
|
|
|
|
// strings and numbers (primitives or objects)
|
|
|
|
// that can be coerced to finite numbers (gh-2662)
|
|
|
|
var type = jQuery.type( obj );
|
|
|
|
return ( type === "number" || type === "string" ) &&
|
2016-01-14 09:22:15 +00:00
|
|
|
|
|
|
|
// parseFloat NaNs numeric-cast false positives ("")
|
|
|
|
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
|
|
|
|
// subtraction forces infinities to NaN
|
|
|
|
!isNaN( obj - parseFloat( obj ) );
|
2010-09-27 15:51:01 +00:00
|
|
|
},
|
|
|
|
|
2009-12-06 22:11:51 +00:00
|
|
|
isPlainObject: function( obj ) {
|
2016-03-14 20:46:51 +00:00
|
|
|
var proto, Ctor;
|
2015-08-16 06:59:58 +00:00
|
|
|
|
2016-03-14 20:46:51 +00:00
|
|
|
// Detect obvious negatives
|
|
|
|
// Use toString instead of jQuery.type to catch host objects
|
|
|
|
if ( !obj || toString.call( obj ) !== "[object Object]" ) {
|
2009-11-08 23:26:01 +00:00
|
|
|
return false;
|
|
|
|
}
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2016-03-14 20:46:51 +00:00
|
|
|
proto = getProto( obj );
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2016-03-14 20:46:51 +00:00
|
|
|
// Objects with no prototype (e.g., `Object.create( null )`) are plain
|
|
|
|
if ( !proto ) {
|
|
|
|
return true;
|
|
|
|
}
|
2016-03-03 23:29:45 +00:00
|
|
|
|
2016-03-14 20:46:51 +00:00
|
|
|
// Objects with prototype are plain iff they were constructed by a global Object function
|
|
|
|
Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
|
|
|
|
return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
|
2009-07-16 07:32:03 +00:00
|
|
|
},
|
|
|
|
|
2009-07-16 07:32:31 +00:00
|
|
|
isEmptyObject: function( obj ) {
|
2012-07-10 01:38:11 +00:00
|
|
|
var name;
|
|
|
|
for ( name in obj ) {
|
2009-07-16 15:16:44 +00:00
|
|
|
return false;
|
2009-07-19 19:55:21 +00:00
|
|
|
}
|
2009-07-16 15:16:44 +00:00
|
|
|
return true;
|
2009-07-16 07:32:31 +00:00
|
|
|
},
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2013-09-28 15:57:46 +00:00
|
|
|
type: function( obj ) {
|
|
|
|
if ( obj == null ) {
|
|
|
|
return obj + "";
|
|
|
|
}
|
2015-08-16 06:59:58 +00:00
|
|
|
|
2016-03-23 14:03:06 +00:00
|
|
|
// Support: Android <=2.3 only (functionish RegExp)
|
2013-09-28 15:57:46 +00:00
|
|
|
return typeof obj === "object" || typeof obj === "function" ?
|
2015-08-16 06:59:58 +00:00
|
|
|
class2type[ toString.call( obj ) ] || "object" :
|
2013-09-28 15:57:46 +00:00
|
|
|
typeof obj;
|
2010-01-23 21:48:47 +00:00
|
|
|
},
|
2010-12-30 06:34:48 +00:00
|
|
|
|
2011-04-07 04:47:15 +00:00
|
|
|
// Evaluates a script in a global context
|
2015-11-13 22:28:16 +00:00
|
|
|
globalEval: function( code ) {
|
|
|
|
DOMEval( code );
|
2008-01-14 22:30:48 +00:00
|
|
|
},
|
|
|
|
|
2011-08-17 21:30:31 +00:00
|
|
|
// Convert dashed to camelCase; used by the css and data modules
|
2016-03-23 14:02:26 +00:00
|
|
|
// Support: IE <=9 - 11, Edge 12 - 13
|
2011-08-17 21:30:31 +00:00
|
|
|
// Microsoft forgot to hump their vendor prefix (#9572)
|
2011-05-25 19:10:49 +00:00
|
|
|
camelCase: function( string ) {
|
2011-08-17 21:30:31 +00:00
|
|
|
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
|
2011-05-25 19:10:49 +00:00
|
|
|
},
|
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
nodeName: function( elem, name ) {
|
2012-09-18 21:39:44 +00:00
|
|
|
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
|
2008-01-14 22:30:48 +00:00
|
|
|
},
|
2008-05-13 01:45:58 +00:00
|
|
|
|
2015-02-17 07:09:54 +00:00
|
|
|
each: function( obj, callback ) {
|
2015-06-25 04:18:04 +00:00
|
|
|
var length, i = 0;
|
2008-05-13 01:45:58 +00:00
|
|
|
|
2015-06-25 04:18:04 +00:00
|
|
|
if ( isArrayLike( obj ) ) {
|
|
|
|
length = obj.length;
|
2015-02-17 07:09:54 +00:00
|
|
|
for ( ; i < length; i++ ) {
|
|
|
|
if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
|
|
|
|
break;
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
} else {
|
2015-02-17 07:09:54 +00:00
|
|
|
for ( i in obj ) {
|
|
|
|
if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
|
|
|
|
break;
|
2011-03-30 17:17:48 +00:00
|
|
|
}
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
}
|
|
|
|
|
2012-06-29 01:39:58 +00:00
|
|
|
return obj;
|
2008-01-14 22:30:48 +00:00
|
|
|
},
|
2008-05-13 01:45:58 +00:00
|
|
|
|
2016-03-23 14:03:06 +00:00
|
|
|
// Support: Android <=4.0 only
|
2014-03-04 22:08:35 +00:00
|
|
|
trim: function( text ) {
|
|
|
|
return text == null ?
|
|
|
|
"" :
|
|
|
|
( text + "" ).replace( rtrim, "" );
|
|
|
|
},
|
2008-01-14 22:30:48 +00:00
|
|
|
|
2009-11-18 02:26:42 +00:00
|
|
|
// results is for internal usage only
|
2012-06-29 01:39:58 +00:00
|
|
|
makeArray: function( arr, results ) {
|
2012-12-10 18:52:02 +00:00
|
|
|
var ret = results || [];
|
2008-01-14 22:30:48 +00:00
|
|
|
|
2012-06-29 01:39:58 +00:00
|
|
|
if ( arr != null ) {
|
2015-06-25 04:18:04 +00:00
|
|
|
if ( isArrayLike( Object( arr ) ) ) {
|
2012-12-10 18:52:02 +00:00
|
|
|
jQuery.merge( ret,
|
|
|
|
typeof arr === "string" ?
|
|
|
|
[ arr ] : arr
|
|
|
|
);
|
2009-03-31 17:35:20 +00:00
|
|
|
} else {
|
2013-08-15 18:15:49 +00:00
|
|
|
push.call( ret, arr );
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
2008-04-25 03:48:07 +00:00
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
},
|
|
|
|
|
2012-06-29 01:39:58 +00:00
|
|
|
inArray: function( elem, arr, i ) {
|
2013-08-15 18:15:49 +00:00
|
|
|
return arr == null ? -1 : indexOf.call( arr, elem, i );
|
2008-01-14 22:30:48 +00:00
|
|
|
},
|
|
|
|
|
2016-03-23 14:03:06 +00:00
|
|
|
// Support: Android <=4.0 only, PhantomJS 1 only
|
2014-10-27 17:36:07 +00:00
|
|
|
// push.apply(_, arraylike) throws on ancient WebKit
|
2008-01-14 22:30:48 +00:00
|
|
|
merge: function( first, second ) {
|
2013-09-03 05:24:01 +00:00
|
|
|
var len = +second.length,
|
|
|
|
j = 0,
|
|
|
|
i = first.length;
|
2009-05-02 19:22:55 +00:00
|
|
|
|
2013-09-03 05:24:01 +00:00
|
|
|
for ( ; j < len; j++ ) {
|
|
|
|
first[ i++ ] = second[ j ];
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
|
2009-12-10 05:43:20 +00:00
|
|
|
first.length = i;
|
|
|
|
|
2008-01-14 22:30:48 +00:00
|
|
|
return first;
|
|
|
|
},
|
|
|
|
|
2013-09-28 15:57:46 +00:00
|
|
|
grep: function( elems, callback, invert ) {
|
|
|
|
var callbackInverse,
|
|
|
|
matches = [],
|
2012-07-10 01:38:11 +00:00
|
|
|
i = 0,
|
2013-09-28 15:57:46 +00:00
|
|
|
length = elems.length,
|
|
|
|
callbackExpect = !invert;
|
2008-01-14 22:30:48 +00:00
|
|
|
|
|
|
|
// Go through the array, only saving the items
|
|
|
|
// that pass the validator function
|
2012-07-10 01:38:11 +00:00
|
|
|
for ( ; i < length; i++ ) {
|
2013-09-28 15:57:46 +00:00
|
|
|
callbackInverse = !callback( elems[ i ], i );
|
|
|
|
if ( callbackInverse !== callbackExpect ) {
|
|
|
|
matches.push( elems[ i ] );
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
|
2013-09-28 15:57:46 +00:00
|
|
|
return matches;
|
2008-01-14 22:30:48 +00:00
|
|
|
},
|
|
|
|
|
2009-12-04 17:28:47 +00:00
|
|
|
// arg is for internal usage only
|
|
|
|
map: function( elems, callback, arg ) {
|
2015-06-25 04:18:04 +00:00
|
|
|
var length, value,
|
2011-04-05 06:59:54 +00:00
|
|
|
i = 0,
|
2012-12-10 18:52:02 +00:00
|
|
|
ret = [];
|
2008-01-14 22:30:48 +00:00
|
|
|
|
2013-09-22 08:19:28 +00:00
|
|
|
// Go through the array, translating each of the items to their new values
|
2015-06-25 04:18:04 +00:00
|
|
|
if ( isArrayLike( elems ) ) {
|
|
|
|
length = elems.length;
|
2011-03-21 19:12:31 +00:00
|
|
|
for ( ; i < length; i++ ) {
|
|
|
|
value = callback( elems[ i ], i, arg );
|
|
|
|
|
2011-02-27 18:47:35 +00:00
|
|
|
if ( value != null ) {
|
2013-09-28 15:57:46 +00:00
|
|
|
ret.push( value );
|
2011-02-27 18:47:35 +00:00
|
|
|
}
|
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
|
2011-04-22 01:51:23 +00:00
|
|
|
// Go through every key on the object,
|
2011-04-05 06:59:54 +00:00
|
|
|
} else {
|
2012-12-10 18:52:02 +00:00
|
|
|
for ( i in elems ) {
|
|
|
|
value = callback( elems[ i ], i, arg );
|
2011-03-21 19:12:31 +00:00
|
|
|
|
|
|
|
if ( value != null ) {
|
2013-09-28 15:57:46 +00:00
|
|
|
ret.push( value );
|
2011-03-21 19:12:31 +00:00
|
|
|
}
|
2009-03-31 17:35:20 +00:00
|
|
|
}
|
2008-01-14 22:30:48 +00:00
|
|
|
}
|
|
|
|
|
2010-11-27 22:15:33 +00:00
|
|
|
// Flatten any nested arrays
|
2013-08-15 18:15:49 +00:00
|
|
|
return concat.apply( [], ret );
|
2009-03-31 17:35:20 +00:00
|
|
|
},
|
|
|
|
|
2009-12-31 20:06:45 +00:00
|
|
|
// A global GUID counter for objects
|
|
|
|
guid: 1,
|
|
|
|
|
2010-12-15 02:53:04 +00:00
|
|
|
// Bind a function to a context, optionally partially applying any
|
|
|
|
// arguments.
|
|
|
|
proxy: function( fn, context ) {
|
2012-07-10 01:38:11 +00:00
|
|
|
var tmp, args, proxy;
|
|
|
|
|
2011-01-21 15:33:50 +00:00
|
|
|
if ( typeof context === "string" ) {
|
2012-07-10 01:38:11 +00:00
|
|
|
tmp = fn[ context ];
|
2011-04-17 21:11:40 +00:00
|
|
|
context = fn;
|
|
|
|
fn = tmp;
|
2009-12-31 20:06:45 +00:00
|
|
|
}
|
|
|
|
|
2010-12-15 02:53:04 +00:00
|
|
|
// Quick check to determine if target is callable, in the spec
|
|
|
|
// this throws a TypeError, but we will just return undefined.
|
2011-04-17 21:11:40 +00:00
|
|
|
if ( !jQuery.isFunction( fn ) ) {
|
2010-12-15 02:53:04 +00:00
|
|
|
return undefined;
|
2009-12-31 20:17:52 +00:00
|
|
|
}
|
2009-12-31 20:06:45 +00:00
|
|
|
|
2011-04-17 21:11:40 +00:00
|
|
|
// Simulated bind
|
2013-08-15 18:15:49 +00:00
|
|
|
args = slice.call( arguments, 2 );
|
2012-07-10 01:38:11 +00:00
|
|
|
proxy = function() {
|
2013-08-15 18:15:49 +00:00
|
|
|
return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
|
2012-07-10 01:38:11 +00:00
|
|
|
};
|
2009-12-31 20:06:45 +00:00
|
|
|
|
|
|
|
// Set the guid of unique handler to the same of original handler, so it can be removed
|
2012-09-18 21:39:44 +00:00
|
|
|
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
|
2009-12-31 20:06:45 +00:00
|
|
|
|
|
|
|
return proxy;
|
|
|
|
},
|
|
|
|
|
2013-08-26 22:54:13 +00:00
|
|
|
now: Date.now,
|
|
|
|
|
|
|
|
// jQuery.support is not used in Core but other projects attach their
|
|
|
|
// properties to it so it needs to exist.
|
|
|
|
support: support
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2008-01-14 22:30:48 +00:00
|
|
|
|
2015-06-01 21:25:38 +00:00
|
|
|
// JSHint would error on this code due to the Symbol not being defined in ES5.
|
|
|
|
// Defining this global in .jshintrc would create a danger of using the global
|
|
|
|
// unguarded in another place, it seems safer to just disable JSHint for these
|
|
|
|
// three lines.
|
|
|
|
/* jshint ignore: start */
|
|
|
|
if ( typeof Symbol === "function" ) {
|
|
|
|
jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
|
|
|
|
}
|
|
|
|
/* jshint ignore: end */
|
|
|
|
|
2010-08-27 23:14:59 +00:00
|
|
|
// Populate the class2type map
|
2015-10-02 22:28:34 +00:00
|
|
|
jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
|
2015-08-16 06:59:58 +00:00
|
|
|
function( i, name ) {
|
2010-08-27 23:14:59 +00:00
|
|
|
class2type[ "[object " + name + "]" ] = name.toLowerCase();
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|
2010-08-27 23:14:59 +00:00
|
|
|
|
2015-06-25 04:18:04 +00:00
|
|
|
function isArrayLike( obj ) {
|
2015-04-04 19:34:07 +00:00
|
|
|
|
2016-03-23 14:03:06 +00:00
|
|
|
// Support: real iOS 8.2 only (not reproducible in simulator)
|
2015-04-04 19:34:07 +00:00
|
|
|
// `in` check used to prevent JIT error (gh-2145)
|
|
|
|
// hasOwn isn't used here due to false negatives
|
|
|
|
// regarding Nodelist length in IE
|
2015-06-25 04:18:04 +00:00
|
|
|
var length = !!obj && "length" in obj && obj.length,
|
2012-12-10 18:52:02 +00:00
|
|
|
type = jQuery.type( obj );
|
|
|
|
|
2013-09-28 15:57:46 +00:00
|
|
|
if ( type === "function" || jQuery.isWindow( obj ) ) {
|
2012-12-10 18:52:02 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-09-28 15:57:46 +00:00
|
|
|
return type === "array" || length === 0 ||
|
|
|
|
typeof length === "number" && length > 0 && ( length - 1 ) in obj;
|
2012-12-10 18:52:02 +00:00
|
|
|
}
|
|
|
|
|
2013-08-15 18:15:49 +00:00
|
|
|
return jQuery;
|
2015-08-16 06:59:58 +00:00
|
|
|
} );
|