11 ], function( deletedIds
, slice
, concat
, push
, indexOf
, class2type
, toString
, hasOwn
, support
) {
16 // Define a local copy of jQuery
17 jQuery = function( selector
, context
) {
18 // The jQuery object is actually just the init constructor 'enhanced'
19 // Need init if jQuery is called (just allow error to be thrown if not included)
20 return new jQuery
.fn
.init( selector
, context
);
23 // Support: Android<4.1, IE<9
24 // Make sure we trim BOM and NBSP
25 rtrim
= /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
27 // Matches dashed string for camelizing
29 rdashAlpha
= /-([\da-z])/gi,
31 // Used by jQuery.camelCase as callback to replace()
32 fcamelCase = function( all
, letter
) {
33 return letter
.toUpperCase();
36 jQuery
.fn
= jQuery
.prototype = {
37 // The current version of jQuery being used
42 // Start with an empty selector
45 // The default length of a jQuery object is 0
49 return slice
.call( this );
52 // Get the Nth element in the matched element set OR
53 // Get the whole matched element set as a clean array
54 get: function( num
) {
57 // Return just the one element from the set
58 ( num
< 0 ? this[ num
+ this.length
] : this[ num
] ) :
60 // Return all the elements in a clean array
64 // Take an array of elements and push it onto the stack
65 // (returning the new matched element set)
66 pushStack: function( elems
) {
68 // Build a new jQuery matched element set
69 var ret
= jQuery
.merge( this.constructor(), elems
);
71 // Add the old object onto the stack (as a reference)
72 ret
.prevObject
= this;
73 ret
.context
= this.context
;
75 // Return the newly-formed element set
79 // Execute a callback for every element in the matched set.
80 // (You can seed the arguments with an array of args, but this is
81 // only used internally.)
82 each: function( callback
, args
) {
83 return jQuery
.each( this, callback
, args
);
86 map: function( callback
) {
87 return this.pushStack( jQuery
.map(this, function( elem
, i
) {
88 return callback
.call( elem
, i
, elem
);
93 return this.pushStack( slice
.apply( this, arguments
) );
101 return this.eq( -1 );
105 var len
= this.length
,
106 j
= +i
+ ( i
< 0 ? len
: 0 );
107 return this.pushStack( j
>= 0 && j
< len
? [ this[j
] ] : [] );
111 return this.prevObject
|| this.constructor(null);
114 // For internal use only.
115 // Behaves like an Array's method, not like a jQuery method.
117 sort
: deletedIds
.sort
,
118 splice
: deletedIds
.splice
121 jQuery
.extend
= jQuery
.fn
.extend = function() {
122 var src
, copyIsArray
, copy
, name
, options
, clone
,
123 target
= arguments
[0] || {},
125 length
= arguments
.length
,
128 // Handle a deep copy situation
129 if ( typeof target
=== "boolean" ) {
132 // skip the boolean and the target
133 target
= arguments
[ i
] || {};
137 // Handle case when target is a string or something (possible in deep copy)
138 if ( typeof target
!== "object" && !jQuery
.isFunction(target
) ) {
142 // extend jQuery itself if only one argument is passed
143 if ( i
=== length
) {
148 for ( ; i
< length
; i
++ ) {
149 // Only deal with non-null/undefined values
150 if ( (options
= arguments
[ i
]) != null ) {
151 // Extend the base object
152 for ( name
in options
) {
153 src
= target
[ name
];
154 copy
= options
[ name
];
156 // Prevent never-ending loop
157 if ( target
=== copy
) {
161 // Recurse if we're merging plain objects or arrays
162 if ( deep
&& copy
&& ( jQuery
.isPlainObject(copy
) || (copyIsArray
= jQuery
.isArray(copy
)) ) ) {
165 clone
= src
&& jQuery
.isArray(src
) ? src
: [];
168 clone
= src
&& jQuery
.isPlainObject(src
) ? src
: {};
171 // Never move original objects, clone them
172 target
[ name
] = jQuery
.extend( deep
, clone
, copy
);
174 // Don't bring in undefined values
175 } else if ( copy
!== undefined ) {
176 target
[ name
] = copy
;
182 // Return the modified object
187 // Unique for each copy of jQuery on the page
188 expando
: "jQuery" + ( version
+ Math
.random() ).replace( /\D/g, "" ),
190 // Assume jQuery is ready without the ready module
193 error: function( msg
) {
194 throw new Error( msg
);
199 // See test/unit/core.js for details concerning isFunction.
200 // Since version 1.3, DOM methods and functions like alert
201 // aren't supported. They return false on IE (#2968).
202 isFunction: function( obj
) {
203 return jQuery
.type(obj
) === "function";
206 isArray
: Array
.isArray
|| function( obj
) {
207 return jQuery
.type(obj
) === "array";
210 isWindow: function( obj
) {
211 /* jshint eqeqeq: false */
212 return obj
!= null && obj
== obj
.window
;
215 isNumeric: function( obj
) {
216 // parseFloat NaNs numeric-cast false positives (null|true|false|"")
217 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
218 // subtraction forces infinities to NaN
219 // adding 1 corrects loss of precision from parseFloat (#15100)
220 return !jQuery
.isArray( obj
) && (obj
- parseFloat( obj
) + 1) >= 0;
223 isEmptyObject: function( obj
) {
225 for ( name
in obj
) {
231 isPlainObject: function( obj
) {
234 // Must be an Object.
235 // Because of IE, we also have to check the presence of the constructor property.
236 // Make sure that DOM nodes and window objects don't pass through, as well
237 if ( !obj
|| jQuery
.type(obj
) !== "object" || obj
.nodeType
|| jQuery
.isWindow( obj
) ) {
242 // Not own constructor property must be Object
243 if ( obj
.constructor &&
244 !hasOwn
.call(obj
, "constructor") &&
245 !hasOwn
.call(obj
.constructor.prototype, "isPrototypeOf") ) {
249 // IE8,9 Will throw exceptions on certain host objects #9897
254 // Handle iteration over inherited properties before own properties.
255 if ( support
.ownLast
) {
257 return hasOwn
.call( obj
, key
);
261 // Own properties are enumerated firstly, so to speed up,
262 // if last one is own, then all properties are own.
263 for ( key
in obj
) {}
265 return key
=== undefined || hasOwn
.call( obj
, key
);
268 type: function( obj
) {
272 return typeof obj
=== "object" || typeof obj
=== "function" ?
273 class2type
[ toString
.call(obj
) ] || "object" :
277 // Evaluates a script in a global context
278 // Workarounds based on findings by Jim Driscoll
279 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
280 globalEval: function( data
) {
281 if ( data
&& jQuery
.trim( data
) ) {
282 // We use execScript on Internet Explorer
283 // We use an anonymous function so that context is window
284 // rather than jQuery in Firefox
285 ( window
.execScript
|| function( data
) {
286 window
[ "eval" ].call( window
, data
);
291 // Convert dashed to camelCase; used by the css and data modules
292 // Microsoft forgot to hump their vendor prefix (#9572)
293 camelCase: function( string
) {
294 return string
.replace( rmsPrefix
, "ms-" ).replace( rdashAlpha
, fcamelCase
);
297 nodeName: function( elem
, name
) {
298 return elem
.nodeName
&& elem
.nodeName
.toLowerCase() === name
.toLowerCase();
301 // args is for internal usage only
302 each: function( obj
, callback
, args
) {
306 isArray
= isArraylike( obj
);
310 for ( ; i
< length
; i
++ ) {
311 value
= callback
.apply( obj
[ i
], args
);
313 if ( value
=== false ) {
319 value
= callback
.apply( obj
[ i
], args
);
321 if ( value
=== false ) {
327 // A special, fast, case for the most common use of each
330 for ( ; i
< length
; i
++ ) {
331 value
= callback
.call( obj
[ i
], i
, obj
[ i
] );
333 if ( value
=== false ) {
339 value
= callback
.call( obj
[ i
], i
, obj
[ i
] );
341 if ( value
=== false ) {
351 // Support: Android<4.1, IE<9
352 trim: function( text
) {
353 return text
== null ?
355 ( text
+ "" ).replace( rtrim
, "" );
358 // results is for internal usage only
359 makeArray: function( arr
, results
) {
360 var ret
= results
|| [];
363 if ( isArraylike( Object(arr
) ) ) {
365 typeof arr
=== "string" ?
369 push
.call( ret
, arr
);
376 inArray: function( elem
, arr
, i
) {
381 return indexOf
.call( arr
, elem
, i
);
385 i
= i
? i
< 0 ? Math
.max( 0, len
+ i
) : i
: 0;
387 for ( ; i
< len
; i
++ ) {
388 // Skip accessing in sparse arrays
389 if ( i
in arr
&& arr
[ i
] === elem
) {
398 merge: function( first
, second
) {
399 var len
= +second
.length
,
404 first
[ i
++ ] = second
[ j
++ ];
408 // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)
410 while ( second
[j
] !== undefined ) {
411 first
[ i
++ ] = second
[ j
++ ];
420 grep: function( elems
, callback
, invert
) {
424 length
= elems
.length
,
425 callbackExpect
= !invert
;
427 // Go through the array, only saving the items
428 // that pass the validator function
429 for ( ; i
< length
; i
++ ) {
430 callbackInverse
= !callback( elems
[ i
], i
);
431 if ( callbackInverse
!== callbackExpect
) {
432 matches
.push( elems
[ i
] );
439 // arg is for internal usage only
440 map: function( elems
, callback
, arg
) {
443 length
= elems
.length
,
444 isArray
= isArraylike( elems
),
447 // Go through the array, translating each of the items to their new values
449 for ( ; i
< length
; i
++ ) {
450 value
= callback( elems
[ i
], i
, arg
);
452 if ( value
!= null ) {
457 // Go through every key on the object,
460 value
= callback( elems
[ i
], i
, arg
);
462 if ( value
!= null ) {
468 // Flatten any nested arrays
469 return concat
.apply( [], ret
);
472 // A global GUID counter for objects
475 // Bind a function to a context, optionally partially applying any
477 proxy: function( fn
, context
) {
478 var args
, proxy
, tmp
;
480 if ( typeof context
=== "string" ) {
486 // Quick check to determine if target is callable, in the spec
487 // this throws a TypeError, but we will just return undefined.
488 if ( !jQuery
.isFunction( fn
) ) {
493 args
= slice
.call( arguments
, 2 );
495 return fn
.apply( context
|| this, args
.concat( slice
.call( arguments
) ) );
498 // Set the guid of unique handler to the same of original handler, so it can be removed
499 proxy
.guid
= fn
.guid
= fn
.guid
|| jQuery
.guid
++;
505 return +( new Date() );
508 // jQuery.support is not used in Core but other projects attach their
509 // properties to it so it needs to exist.
513 // Populate the class2type map
514 jQuery
.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i
, name
) {
515 class2type
[ "[object " + name
+ "]" ] = name
.toLowerCase();
518 function isArraylike( obj
) {
520 // Support: iOS 8.2 (not reproducible in simulator)
521 // `in` check used to prevent JIT error (gh-2145)
522 // hasOwn isn't used here due to false negatives
523 // regarding Nodelist length in IE
524 var length
= "length" in obj
&& obj
.length
,
525 type
= jQuery
.type( obj
);
527 if ( type
=== "function" || jQuery
.isWindow( obj
) ) {
531 if ( obj
.nodeType
=== 1 && length
) {
535 return type
=== "array" || length
=== 0 ||
536 typeof length
=== "number" && length
> 0 && ( length
- 1 ) in obj
;