c5169e0e
Renato De Donato
a new hope
|
1
|
define([
|
74249687
Luigi Serra
Cross browser con...
|
2
|
"./var/arr",
|
74249687
Luigi Serra
Cross browser con...
|
3
4
5
6
7
8
9
10
|
"./var/slice",
"./var/concat",
"./var/push",
"./var/indexOf",
"./var/class2type",
"./var/toString",
"./var/hasOwn",
"./var/support"
|
c5169e0e
Renato De Donato
a new hope
|
11
|
], function( arr, slice, concat, push, indexOf, class2type, toString, hasOwn, support ) {
|
74249687
Luigi Serra
Cross browser con...
|
12
13
|
var
|
c5169e0e
Renato De Donato
a new hope
|
14
15
16
|
// Use the correct document accordingly with window argument (sandbox)
document = window.document,
|
74249687
Luigi Serra
Cross browser con...
|
17
18
19
20
|
version = "@VERSION",
// Define a local copy of jQuery
jQuery = function( selector, context ) {
|
74249687
Luigi Serra
Cross browser con...
|
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// The jQuery object is actually just the init constructor 'enhanced'
// Need init if jQuery is called (just allow error to be thrown if not included)
return new jQuery.fn.init( selector, context );
},
// Support: Android<4.1
// Make sure we trim BOM and NBSP
rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
// Matches dashed string for camelizing
rmsPrefix = /^-ms-/,
rdashAlpha = /-([\da-z])/gi,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return letter.toUpperCase();
};
jQuery.fn = jQuery.prototype = {
|
74249687
Luigi Serra
Cross browser con...
|
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
// The current version of jQuery being used
jquery: version,
constructor: jQuery,
// Start with an empty selector
selector: "",
// The default length of a jQuery object is 0
length: 0,
toArray: function() {
return slice.call( this );
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
return num != null ?
// Return just the one element from the set
( num < 0 ? this[ num + this.length ] : this[ num ] ) :
// Return all the elements in a clean array
slice.call( this );
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems ) {
// Build a new jQuery matched element set
var ret = jQuery.merge( this.constructor(), elems );
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
|
c5169e0e
Renato De Donato
a new hope
|
83
84
85
86
|
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function( callback, args ) {
return jQuery.each( this, callback, args );
|
74249687
Luigi Serra
Cross browser con...
|
87
88
89
|
},
map: function( callback ) {
|
c5169e0e
Renato De Donato
a new hope
|
90
|
return this.pushStack( jQuery.map(this, function( elem, i ) {
|
74249687
Luigi Serra
Cross browser con...
|
91
|
return callback.call( elem, i, elem );
|
c5169e0e
Renato De Donato
a new hope
|
92
|
}));
|
74249687
Luigi Serra
Cross browser con...
|
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
},
slice: function() {
return this.pushStack( slice.apply( this, arguments ) );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
eq: function( i ) {
var len = this.length,
j = +i + ( i < 0 ? len : 0 );
|
c5169e0e
Renato De Donato
a new hope
|
110
|
return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
|
74249687
Luigi Serra
Cross browser con...
|
111
112
113
|
},
end: function() {
|
c5169e0e
Renato De Donato
a new hope
|
114
|
return this.prevObject || this.constructor(null);
|
74249687
Luigi Serra
Cross browser con...
|
115
116
117
118
119
120
121
122
123
124
125
|
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: push,
sort: arr.sort,
splice: arr.splice
};
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
|
c5169e0e
Renato De Donato
a new hope
|
126
|
target = arguments[0] || {},
|
74249687
Luigi Serra
Cross browser con...
|
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
// Skip the boolean and the target
target = arguments[ i ] || {};
i++;
}
// Handle case when target is a string or something (possible in deep copy)
|
c5169e0e
Renato De Donato
a new hope
|
141
|
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
|
74249687
Luigi Serra
Cross browser con...
|
142
143
144
145
146
147
148
149
150
151
|
target = {};
}
// Extend jQuery itself if only one argument is passed
if ( i === length ) {
target = this;
i--;
}
for ( ; i < length; i++ ) {
|
74249687
Luigi Serra
Cross browser con...
|
152
|
// Only deal with non-null/undefined values
|
c5169e0e
Renato De Donato
a new hope
|
153
|
if ( (options = arguments[ i ]) != null ) {
|
74249687
Luigi Serra
Cross browser con...
|
154
155
156
157
158
159
160
161
162
163
164
|
// Extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
// Prevent never-ending loop
if ( target === copy ) {
continue;
}
// Recurse if we're merging plain objects or arrays
|
c5169e0e
Renato De Donato
a new hope
|
165
|
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
|
74249687
Luigi Serra
Cross browser con...
|
166
167
|
if ( copyIsArray ) {
copyIsArray = false;
|
c5169e0e
Renato De Donato
a new hope
|
168
|
clone = src && jQuery.isArray(src) ? src : [];
|
74249687
Luigi Serra
Cross browser con...
|
169
170
|
} else {
|
c5169e0e
Renato De Donato
a new hope
|
171
|
clone = src && jQuery.isPlainObject(src) ? src : {};
|
74249687
Luigi Serra
Cross browser con...
|
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
}
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
// Don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// Return the modified object
return target;
};
|
c5169e0e
Renato De Donato
a new hope
|
189
|
jQuery.extend({
|
74249687
Luigi Serra
Cross browser con...
|
190
191
192
193
194
195
196
197
198
199
200
201
202
|
// Unique for each copy of jQuery on the page
expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
// Assume jQuery is ready without the ready module
isReady: true,
error: function( msg ) {
throw new Error( msg );
},
noop: function() {},
isFunction: function( obj ) {
|
c5169e0e
Renato De Donato
a new hope
|
203
|
return jQuery.type(obj) === "function";
|
74249687
Luigi Serra
Cross browser con...
|
204
205
206
207
208
209
210
211
212
|
},
isArray: Array.isArray,
isWindow: function( obj ) {
return obj != null && obj === obj.window;
},
isNumeric: function( obj ) {
|
74249687
Luigi Serra
Cross browser con...
|
213
214
215
216
|
// parseFloat NaNs numeric-cast false positives (null|true|false|"")
// ...but misinterprets leading-number strings, particularly hex literals ("0x...")
// subtraction forces infinities to NaN
// adding 1 corrects loss of precision from parseFloat (#15100)
|
c5169e0e
Renato De Donato
a new hope
|
217
|
return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0;
|
74249687
Luigi Serra
Cross browser con...
|
218
219
220
|
},
isPlainObject: function( obj ) {
|
74249687
Luigi Serra
Cross browser con...
|
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
|
// Not plain objects:
// - Any object or value whose internal [[Class]] property is not "[object Object]"
// - DOM nodes
// - window
if ( jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false;
}
if ( obj.constructor &&
!hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
return false;
}
// If the function hasn't returned already, we're confident that
// |obj| is a plain object, created by {} or constructed with new Object
return true;
},
isEmptyObject: function( obj ) {
var name;
for ( name in obj ) {
return false;
}
return true;
},
type: function( obj ) {
if ( obj == null ) {
return obj + "";
}
|
74249687
Luigi Serra
Cross browser con...
|
251
252
|
// Support: Android<4.0, iOS<6 (functionish RegExp)
return typeof obj === "object" || typeof obj === "function" ?
|
c5169e0e
Renato De Donato
a new hope
|
253
|
class2type[ toString.call(obj) ] || "object" :
|
74249687
Luigi Serra
Cross browser con...
|
254
255
256
257
258
259
260
261
262
263
264
|
typeof obj;
},
// Evaluates a script in a global context
globalEval: function( code ) {
var script,
indirect = eval;
code = jQuery.trim( code );
if ( code ) {
|
74249687
Luigi Serra
Cross browser con...
|
265
266
267
|
// If the code includes a valid, prologue position
// strict mode pragma, execute code by injecting a
// script tag into the document.
|
c5169e0e
Renato De Donato
a new hope
|
268
269
|
if ( code.indexOf("use strict") === 1 ) {
script = document.createElement("script");
|
74249687
Luigi Serra
Cross browser con...
|
270
271
272
|
script.text = code;
document.head.appendChild( script ).parentNode.removeChild( script );
} else {
|
c5169e0e
Renato De Donato
a new hope
|
273
274
|
// Otherwise, avoid the DOM node creation, insertion
// and removal by using an indirect global eval
|
74249687
Luigi Serra
Cross browser con...
|
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
|
indirect( code );
}
}
},
// Convert dashed to camelCase; used by the css and data modules
// Support: IE9-11+
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
},
|
c5169e0e
Renato De Donato
a new hope
|
291
292
293
294
295
296
|
// args is for internal usage only
each: function( obj, callback, args ) {
var value,
i = 0,
length = obj.length,
isArray = isArraylike( obj );
|
74249687
Luigi Serra
Cross browser con...
|
297
|
|
c5169e0e
Renato De Donato
a new hope
|
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
|
if ( args ) {
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.apply( obj[ i ], args );
if ( value === false ) {
break;
}
|
74249687
Luigi Serra
Cross browser con...
|
314
315
|
}
}
|
c5169e0e
Renato De Donato
a new hope
|
316
317
|
// A special, fast, case for the most common use of each
|
74249687
Luigi Serra
Cross browser con...
|
318
|
} else {
|
c5169e0e
Renato De Donato
a new hope
|
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
|
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback.call( obj[ i ], i, obj[ i ] );
if ( value === false ) {
break;
}
}
} else {
for ( i in obj ) {
value = callback.call( obj[ i ], i, obj[ i ] );
if ( value === false ) {
break;
}
|
74249687
Luigi Serra
Cross browser con...
|
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
|
}
}
}
return obj;
},
// Support: Android<4.1
trim: function( text ) {
return text == null ?
"" :
( text + "" ).replace( rtrim, "" );
},
// results is for internal usage only
makeArray: function( arr, results ) {
var ret = results || [];
if ( arr != null ) {
|
c5169e0e
Renato De Donato
a new hope
|
353
|
if ( isArraylike( Object(arr) ) ) {
|
74249687
Luigi Serra
Cross browser con...
|
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
|
jQuery.merge( ret,
typeof arr === "string" ?
[ arr ] : arr
);
} else {
push.call( ret, arr );
}
}
return ret;
},
inArray: function( elem, arr, i ) {
return arr == null ? -1 : indexOf.call( arr, elem, i );
},
merge: function( first, second ) {
var len = +second.length,
j = 0,
i = first.length;
for ( ; j < len; j++ ) {
first[ i++ ] = second[ j ];
}
first.length = i;
return first;
},
grep: function( elems, callback, invert ) {
var callbackInverse,
matches = [],
i = 0,
length = elems.length,
callbackExpect = !invert;
// Go through the array, only saving the items
// that pass the validator function
for ( ; i < length; i++ ) {
callbackInverse = !callback( elems[ i ], i );
if ( callbackInverse !== callbackExpect ) {
matches.push( elems[ i ] );
}
}
return matches;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
|
c5169e0e
Renato De Donato
a new hope
|
405
|
var value,
|
74249687
Luigi Serra
Cross browser con...
|
406
|
i = 0,
|
c5169e0e
Renato De Donato
a new hope
|
407
408
|
length = elems.length,
isArray = isArraylike( elems ),
|
74249687
Luigi Serra
Cross browser con...
|
409
410
411
|
ret = [];
// Go through the array, translating each of the items to their new values
|
c5169e0e
Renato De Donato
a new hope
|
412
|
if ( isArray ) {
|
74249687
Luigi Serra
Cross browser con...
|
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
|
for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret.push( value );
}
}
// Go through every key on the object,
} else {
for ( i in elems ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret.push( value );
}
}
}
// Flatten any nested arrays
return concat.apply( [], ret );
},
// A global GUID counter for objects
guid: 1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
var tmp, args, proxy;
if ( typeof context === "string" ) {
tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
}
// Simulated bind
args = slice.call( arguments, 2 );
proxy = function() {
return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || jQuery.guid++;
return proxy;
},
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
|
c5169e0e
Renato De Donato
a new hope
|
473
|
});
|
74249687
Luigi Serra
Cross browser con...
|
474
475
|
// Populate the class2type map
|
c5169e0e
Renato De Donato
a new hope
|
476
|
jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
|
74249687
Luigi Serra
Cross browser con...
|
477
|
class2type[ "[object " + name + "]" ] = name.toLowerCase();
|
c5169e0e
Renato De Donato
a new hope
|
478
|
});
|
74249687
Luigi Serra
Cross browser con...
|
479
|
|
c5169e0e
Renato De Donato
a new hope
|
480
|
function isArraylike( obj ) {
|
74249687
Luigi Serra
Cross browser con...
|
481
482
483
484
485
|
// Support: iOS 8.2 (not reproducible in simulator)
// `in` check used to prevent JIT error (gh-2145)
// hasOwn isn't used here due to false negatives
// regarding Nodelist length in IE
|
c5169e0e
Renato De Donato
a new hope
|
486
|
var length = "length" in obj && obj.length,
|
74249687
Luigi Serra
Cross browser con...
|
487
488
489
490
491
492
|
type = jQuery.type( obj );
if ( type === "function" || jQuery.isWindow( obj ) ) {
return false;
}
|
c5169e0e
Renato De Donato
a new hope
|
493
494
495
496
|
if ( obj.nodeType === 1 && length ) {
return true;
}
|
74249687
Luigi Serra
Cross browser con...
|
497
498
499
500
501
|
return type === "array" || length === 0 ||
typeof length === "number" && length > 0 && ( length - 1 ) in obj;
}
return jQuery;
|
c5169e0e
Renato De Donato
a new hope
|
502
|
});
|