1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,10375 @@ |
1 |
+/** |
|
2 |
+ * Copyright (C) 2021 Double Bastion LLC |
|
3 |
+ * |
|
4 |
+ * This file is part of Roundpin, which is licensed under the |
|
5 |
+ * GNU Affero General Public License Version 3.0. The license terms |
|
6 |
+ * are detailed in the "LICENSE.txt" file located in the root directory. |
|
7 |
+ * |
|
8 |
+ * The file content from below is identical with that of the |
|
9 |
+ * original file "jquery-3.3.1.js". The copyright notice for the |
|
10 |
+ * original content follows: |
|
11 |
+ |
|
12 |
+/*! |
|
13 |
+ * jQuery JavaScript Library v3.3.1 |
|
14 |
+ * https://jquery.com/ |
|
15 |
+ * |
|
16 |
+ * Includes Sizzle.js |
|
17 |
+ * https://sizzlejs.com/ |
|
18 |
+ * |
|
19 |
+ * Copyright JS Foundation and other contributors |
|
20 |
+ * Released under the MIT license |
|
21 |
+ * https://jquery.org/license |
|
22 |
+ * |
|
23 |
+ * Date: 2018-01-20T17:24Z |
|
24 |
+ */ |
|
25 |
+( function( global, factory ) { |
|
26 |
+ |
|
27 |
+ "use strict"; |
|
28 |
+ |
|
29 |
+ if ( typeof module === "object" && typeof module.exports === "object" ) { |
|
30 |
+ |
|
31 |
+ // For CommonJS and CommonJS-like environments where a proper `window` |
|
32 |
+ // is present, execute the factory and get jQuery. |
|
33 |
+ // For environments that do not have a `window` with a `document` |
|
34 |
+ // (such as Node.js), expose a factory as module.exports. |
|
35 |
+ // This accentuates the need for the creation of a real `window`. |
|
36 |
+ // e.g. var jQuery = require("jquery")(window); |
|
37 |
+ // See ticket #14549 for more info. |
|
38 |
+ module.exports = global.document ? |
|
39 |
+ factory( global, true ) : |
|
40 |
+ function( w ) { |
|
41 |
+ if ( !w.document ) { |
|
42 |
+ throw new Error( "jQuery requires a window with a document" ); |
|
43 |
+ } |
|
44 |
+ return factory( w ); |
|
45 |
+ }; |
|
46 |
+ } else { |
|
47 |
+ factory( global ); |
|
48 |
+ } |
|
49 |
+ |
|
50 |
+// Pass this if window is not defined yet |
|
51 |
+} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { |
|
52 |
+ |
|
53 |
+// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 |
|
54 |
+// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode |
|
55 |
+// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common |
|
56 |
+// enough that all such attempts are guarded in a try block. |
|
57 |
+"use strict"; |
|
58 |
+ |
|
59 |
+var arr = []; |
|
60 |
+ |
|
61 |
+var document = window.document; |
|
62 |
+ |
|
63 |
+var getProto = Object.getPrototypeOf; |
|
64 |
+ |
|
65 |
+var slice = arr.slice; |
|
66 |
+ |
|
67 |
+var concat = arr.concat; |
|
68 |
+ |
|
69 |
+var push = arr.push; |
|
70 |
+ |
|
71 |
+var indexOf = arr.indexOf; |
|
72 |
+ |
|
73 |
+var class2type = {}; |
|
74 |
+ |
|
75 |
+var toString = class2type.toString; |
|
76 |
+ |
|
77 |
+var hasOwn = class2type.hasOwnProperty; |
|
78 |
+ |
|
79 |
+var fnToString = hasOwn.toString; |
|
80 |
+ |
|
81 |
+var ObjectFunctionString = fnToString.call( Object ); |
|
82 |
+ |
|
83 |
+var support = {}; |
|
84 |
+ |
|
85 |
+var isFunction = function isFunction( obj ) { |
|
86 |
+ |
|
87 |
+ // Support: Chrome <=57, Firefox <=52 |
|
88 |
+ // In some browsers, typeof returns "function" for HTML <object> elements |
|
89 |
+ // (i.e., `typeof document.createElement( "object" ) === "function"`). |
|
90 |
+ // We don't want to classify *any* DOM node as a function. |
|
91 |
+ return typeof obj === "function" && typeof obj.nodeType !== "number"; |
|
92 |
+ }; |
|
93 |
+ |
|
94 |
+ |
|
95 |
+var isWindow = function isWindow( obj ) { |
|
96 |
+ return obj != null && obj === obj.window; |
|
97 |
+ }; |
|
98 |
+ |
|
99 |
+ |
|
100 |
+ |
|
101 |
+ |
|
102 |
+ var preservedScriptAttributes = { |
|
103 |
+ type: true, |
|
104 |
+ src: true, |
|
105 |
+ noModule: true |
|
106 |
+ }; |
|
107 |
+ |
|
108 |
+ function DOMEval( code, doc, node ) { |
|
109 |
+ doc = doc || document; |
|
110 |
+ |
|
111 |
+ var i, |
|
112 |
+ script = doc.createElement( "script" ); |
|
113 |
+ |
|
114 |
+ script.text = code; |
|
115 |
+ if ( node ) { |
|
116 |
+ for ( i in preservedScriptAttributes ) { |
|
117 |
+ if ( node[ i ] ) { |
|
118 |
+ script[ i ] = node[ i ]; |
|
119 |
+ } |
|
120 |
+ } |
|
121 |
+ } |
|
122 |
+ doc.head.appendChild( script ).parentNode.removeChild( script ); |
|
123 |
+ } |
|
124 |
+ |
|
125 |
+ |
|
126 |
+function toType( obj ) { |
|
127 |
+ if ( obj == null ) { |
|
128 |
+ return obj + ""; |
|
129 |
+ } |
|
130 |
+ |
|
131 |
+ // Support: Android <=2.3 only (functionish RegExp) |
|
132 |
+ return typeof obj === "object" || typeof obj === "function" ? |
|
133 |
+ class2type[ toString.call( obj ) ] || "object" : |
|
134 |
+ typeof obj; |
|
135 |
+} |
|
136 |
+/* global Symbol */ |
|
137 |
+// Defining this global in .eslintrc.json would create a danger of using the global |
|
138 |
+// unguarded in another place, it seems safer to define global only for this module |
|
139 |
+ |
|
140 |
+ |
|
141 |
+ |
|
142 |
+var |
|
143 |
+ version = "3.3.1", |
|
144 |
+ |
|
145 |
+ // Define a local copy of jQuery |
|
146 |
+ jQuery = function( selector, context ) { |
|
147 |
+ |
|
148 |
+ // The jQuery object is actually just the init constructor 'enhanced' |
|
149 |
+ // Need init if jQuery is called (just allow error to be thrown if not included) |
|
150 |
+ return new jQuery.fn.init( selector, context ); |
|
151 |
+ }, |
|
152 |
+ |
|
153 |
+ // Support: Android <=4.0 only |
|
154 |
+ // Make sure we trim BOM and NBSP |
|
155 |
+ rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; |
|
156 |
+ |
|
157 |
+jQuery.fn = jQuery.prototype = { |
|
158 |
+ |
|
159 |
+ // The current version of jQuery being used |
|
160 |
+ jquery: version, |
|
161 |
+ |
|
162 |
+ constructor: jQuery, |
|
163 |
+ |
|
164 |
+ // The default length of a jQuery object is 0 |
|
165 |
+ length: 0, |
|
166 |
+ |
|
167 |
+ toArray: function() { |
|
168 |
+ return slice.call( this ); |
|
169 |
+ }, |
|
170 |
+ |
|
171 |
+ // Get the Nth element in the matched element set OR |
|
172 |
+ // Get the whole matched element set as a clean array |
|
173 |
+ get: function( num ) { |
|
174 |
+ |
|
175 |
+ // Return all the elements in a clean array |
|
176 |
+ if ( num == null ) { |
|
177 |
+ return slice.call( this ); |
|
178 |
+ } |
|
179 |
+ |
|
180 |
+ // Return just the one element from the set |
|
181 |
+ return num < 0 ? this[ num + this.length ] : this[ num ]; |
|
182 |
+ }, |
|
183 |
+ |
|
184 |
+ // Take an array of elements and push it onto the stack |
|
185 |
+ // (returning the new matched element set) |
|
186 |
+ pushStack: function( elems ) { |
|
187 |
+ |
|
188 |
+ // Build a new jQuery matched element set |
|
189 |
+ var ret = jQuery.merge( this.constructor(), elems ); |
|
190 |
+ |
|
191 |
+ // Add the old object onto the stack (as a reference) |
|
192 |
+ ret.prevObject = this; |
|
193 |
+ |
|
194 |
+ // Return the newly-formed element set |
|
195 |
+ return ret; |
|
196 |
+ }, |
|
197 |
+ |
|
198 |
+ // Execute a callback for every element in the matched set. |
|
199 |
+ each: function( callback ) { |
|
200 |
+ return jQuery.each( this, callback ); |
|
201 |
+ }, |
|
202 |
+ |
|
203 |
+ map: function( callback ) { |
|
204 |
+ return this.pushStack( jQuery.map( this, function( elem, i ) { |
|
205 |
+ return callback.call( elem, i, elem ); |
|
206 |
+ } ) ); |
|
207 |
+ }, |
|
208 |
+ |
|
209 |
+ slice: function() { |
|
210 |
+ return this.pushStack( slice.apply( this, arguments ) ); |
|
211 |
+ }, |
|
212 |
+ |
|
213 |
+ first: function() { |
|
214 |
+ return this.eq( 0 ); |
|
215 |
+ }, |
|
216 |
+ |
|
217 |
+ last: function() { |
|
218 |
+ return this.eq( -1 ); |
|
219 |
+ }, |
|
220 |
+ |
|
221 |
+ eq: function( i ) { |
|
222 |
+ var len = this.length, |
|
223 |
+ j = +i + ( i < 0 ? len : 0 ); |
|
224 |
+ return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); |
|
225 |
+ }, |
|
226 |
+ |
|
227 |
+ end: function() { |
|
228 |
+ return this.prevObject || this.constructor(); |
|
229 |
+ }, |
|
230 |
+ |
|
231 |
+ // For internal use only. |
|
232 |
+ // Behaves like an Array's method, not like a jQuery method. |
|
233 |
+ push: push, |
|
234 |
+ sort: arr.sort, |
|
235 |
+ splice: arr.splice |
|
236 |
+}; |
|
237 |
+ |
|
238 |
+jQuery.extend = jQuery.fn.extend = function() { |
|
239 |
+ var options, name, src, copy, copyIsArray, clone, |
|
240 |
+ target = arguments[ 0 ] || {}, |
|
241 |
+ i = 1, |
|
242 |
+ length = arguments.length, |
|
243 |
+ deep = false; |
|
244 |
+ |
|
245 |
+ // Handle a deep copy situation |
|
246 |
+ if ( typeof target === "boolean" ) { |
|
247 |
+ deep = target; |
|
248 |
+ |
|
249 |
+ // Skip the boolean and the target |
|
250 |
+ target = arguments[ i ] || {}; |
|
251 |
+ i++; |
|
252 |
+ } |
|
253 |
+ |
|
254 |
+ // Handle case when target is a string or something (possible in deep copy) |
|
255 |
+ if ( typeof target !== "object" && !isFunction( target ) ) { |
|
256 |
+ target = {}; |
|
257 |
+ } |
|
258 |
+ |
|
259 |
+ // Extend jQuery itself if only one argument is passed |
|
260 |
+ if ( i === length ) { |
|
261 |
+ target = this; |
|
262 |
+ i--; |
|
263 |
+ } |
|
264 |
+ |
|
265 |
+ for ( ; i < length; i++ ) { |
|
266 |
+ |
|
267 |
+ // Only deal with non-null/undefined values |
|
268 |
+ if ( ( options = arguments[ i ] ) != null ) { |
|
269 |
+ |
|
270 |
+ // Extend the base object |
|
271 |
+ for ( name in options ) { |
|
272 |
+ src = target[ name ]; |
|
273 |
+ copy = options[ name ]; |
|
274 |
+ |
|
275 |
+ // Prevent never-ending loop |
|
276 |
+ if ( target === copy ) { |
|
277 |
+ continue; |
|
278 |
+ } |
|
279 |
+ |
|
280 |
+ // Recurse if we're merging plain objects or arrays |
|
281 |
+ if ( deep && copy && ( jQuery.isPlainObject( copy ) || |
|
282 |
+ ( copyIsArray = Array.isArray( copy ) ) ) ) { |
|
283 |
+ |
|
284 |
+ if ( copyIsArray ) { |
|
285 |
+ copyIsArray = false; |
|
286 |
+ clone = src && Array.isArray( src ) ? src : []; |
|
287 |
+ |
|
288 |
+ } else { |
|
289 |
+ clone = src && jQuery.isPlainObject( src ) ? src : {}; |
|
290 |
+ } |
|
291 |
+ |
|
292 |
+ // Never move original objects, clone them |
|
293 |
+ target[ name ] = jQuery.extend( deep, clone, copy ); |
|
294 |
+ |
|
295 |
+ // Don't bring in undefined values |
|
296 |
+ } else if ( copy !== undefined ) { |
|
297 |
+ target[ name ] = copy; |
|
298 |
+ } |
|
299 |
+ } |
|
300 |
+ } |
|
301 |
+ } |
|
302 |
+ |
|
303 |
+ // Return the modified object |
|
304 |
+ return target; |
|
305 |
+}; |
|
306 |
+ |
|
307 |
+jQuery.extend( { |
|
308 |
+ |
|
309 |
+ // Unique for each copy of jQuery on the page |
|
310 |
+ expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), |
|
311 |
+ |
|
312 |
+ // Assume jQuery is ready without the ready module |
|
313 |
+ isReady: true, |
|
314 |
+ |
|
315 |
+ error: function( msg ) { |
|
316 |
+ throw new Error( msg ); |
|
317 |
+ }, |
|
318 |
+ |
|
319 |
+ noop: function() {}, |
|
320 |
+ |
|
321 |
+ isPlainObject: function( obj ) { |
|
322 |
+ var proto, Ctor; |
|
323 |
+ |
|
324 |
+ // Detect obvious negatives |
|
325 |
+ // Use toString instead of jQuery.type to catch host objects |
|
326 |
+ if ( !obj || toString.call( obj ) !== "[object Object]" ) { |
|
327 |
+ return false; |
|
328 |
+ } |
|
329 |
+ |
|
330 |
+ proto = getProto( obj ); |
|
331 |
+ |
|
332 |
+ // Objects with no prototype (e.g., `Object.create( null )`) are plain |
|
333 |
+ if ( !proto ) { |
|
334 |
+ return true; |
|
335 |
+ } |
|
336 |
+ |
|
337 |
+ // Objects with prototype are plain iff they were constructed by a global Object function |
|
338 |
+ Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; |
|
339 |
+ return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; |
|
340 |
+ }, |
|
341 |
+ |
|
342 |
+ isEmptyObject: function( obj ) { |
|
343 |
+ |
|
344 |
+ /* eslint-disable no-unused-vars */ |
|
345 |
+ // See https://github.com/eslint/eslint/issues/6125 |
|
346 |
+ var name; |
|
347 |
+ |
|
348 |
+ for ( name in obj ) { |
|
349 |
+ return false; |
|
350 |
+ } |
|
351 |
+ return true; |
|
352 |
+ }, |
|
353 |
+ |
|
354 |
+ // Evaluates a script in a global context |
|
355 |
+ globalEval: function( code ) { |
|
356 |
+ DOMEval( code ); |
|
357 |
+ }, |
|
358 |
+ |
|
359 |
+ each: function( obj, callback ) { |
|
360 |
+ var length, i = 0; |
|
361 |
+ |
|
362 |
+ if ( isArrayLike( obj ) ) { |
|
363 |
+ length = obj.length; |
|
364 |
+ for ( ; i < length; i++ ) { |
|
365 |
+ if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { |
|
366 |
+ break; |
|
367 |
+ } |
|
368 |
+ } |
|
369 |
+ } else { |
|
370 |
+ for ( i in obj ) { |
|
371 |
+ if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { |
|
372 |
+ break; |
|
373 |
+ } |
|
374 |
+ } |
|
375 |
+ } |
|
376 |
+ |
|
377 |
+ return obj; |
|
378 |
+ }, |
|
379 |
+ |
|
380 |
+ // Support: Android <=4.0 only |
|
381 |
+ trim: function( text ) { |
|
382 |
+ return text == null ? |
|
383 |
+ "" : |
|
384 |
+ ( text + "" ).replace( rtrim, "" ); |
|
385 |
+ }, |
|
386 |
+ |
|
387 |
+ // results is for internal usage only |
|
388 |
+ makeArray: function( arr, results ) { |
|
389 |
+ var ret = results || []; |
|
390 |
+ |
|
391 |
+ if ( arr != null ) { |
|
392 |
+ if ( isArrayLike( Object( arr ) ) ) { |
|
393 |
+ jQuery.merge( ret, |
|
394 |
+ typeof arr === "string" ? |
|
395 |
+ [ arr ] : arr |
|
396 |
+ ); |
|
397 |
+ } else { |
|
398 |
+ push.call( ret, arr ); |
|
399 |
+ } |
|
400 |
+ } |
|
401 |
+ |
|
402 |
+ return ret; |
|
403 |
+ }, |
|
404 |
+ |
|
405 |
+ inArray: function( elem, arr, i ) { |
|
406 |
+ return arr == null ? -1 : indexOf.call( arr, elem, i ); |
|
407 |
+ }, |
|
408 |
+ |
|
409 |
+ // Support: Android <=4.0 only, PhantomJS 1 only |
|
410 |
+ // push.apply(_, arraylike) throws on ancient WebKit |
|
411 |
+ merge: function( first, second ) { |
|
412 |
+ var len = +second.length, |
|
413 |
+ j = 0, |
|
414 |
+ i = first.length; |
|
415 |
+ |
|
416 |
+ for ( ; j < len; j++ ) { |
|
417 |
+ first[ i++ ] = second[ j ]; |
|
418 |
+ } |
|
419 |
+ |
|
420 |
+ first.length = i; |
|
421 |
+ |
|
422 |
+ return first; |
|
423 |
+ }, |
|
424 |
+ |
|
425 |
+ grep: function( elems, callback, invert ) { |
|
426 |
+ var callbackInverse, |
|
427 |
+ matches = [], |
|
428 |
+ i = 0, |
|
429 |
+ length = elems.length, |
|
430 |
+ callbackExpect = !invert; |
|
431 |
+ |
|
432 |
+ // Go through the array, only saving the items |
|
433 |
+ // that pass the validator function |
|
434 |
+ for ( ; i < length; i++ ) { |
|
435 |
+ callbackInverse = !callback( elems[ i ], i ); |
|
436 |
+ if ( callbackInverse !== callbackExpect ) { |
|
437 |
+ matches.push( elems[ i ] ); |
|
438 |
+ } |
|
439 |
+ } |
|
440 |
+ |
|
441 |
+ return matches; |
|
442 |
+ }, |
|
443 |
+ |
|
444 |
+ // arg is for internal usage only |
|
445 |
+ map: function( elems, callback, arg ) { |
|
446 |
+ var length, value, |
|
447 |
+ i = 0, |
|
448 |
+ ret = []; |
|
449 |
+ |
|
450 |
+ // Go through the array, translating each of the items to their new values |
|
451 |
+ if ( isArrayLike( elems ) ) { |
|
452 |
+ length = elems.length; |
|
453 |
+ for ( ; i < length; i++ ) { |
|
454 |
+ value = callback( elems[ i ], i, arg ); |
|
455 |
+ |
|
456 |
+ if ( value != null ) { |
|
457 |
+ ret.push( value ); |
|
458 |
+ } |
|
459 |
+ } |
|
460 |
+ |
|
461 |
+ // Go through every key on the object, |
|
462 |
+ } else { |
|
463 |
+ for ( i in elems ) { |
|
464 |
+ value = callback( elems[ i ], i, arg ); |
|
465 |
+ |
|
466 |
+ if ( value != null ) { |
|
467 |
+ ret.push( value ); |
|
468 |
+ } |
|
469 |
+ } |
|
470 |
+ } |
|
471 |
+ |
|
472 |
+ // Flatten any nested arrays |
|
473 |
+ return concat.apply( [], ret ); |
|
474 |
+ }, |
|
475 |
+ |
|
476 |
+ // A global GUID counter for objects |
|
477 |
+ guid: 1, |
|
478 |
+ |
|
479 |
+ // jQuery.support is not used in Core but other projects attach their |
|
480 |
+ // properties to it so it needs to exist. |
|
481 |
+ support: support |
|
482 |
+} ); |
|
483 |
+ |
|
484 |
+if ( typeof Symbol === "function" ) { |
|
485 |
+ jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; |
|
486 |
+} |
|
487 |
+ |
|
488 |
+// Populate the class2type map |
|
489 |
+jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), |
|
490 |
+function( i, name ) { |
|
491 |
+ class2type[ "[object " + name + "]" ] = name.toLowerCase(); |
|
492 |
+} ); |
|
493 |
+ |
|
494 |
+function isArrayLike( obj ) { |
|
495 |
+ |
|
496 |
+ // Support: real iOS 8.2 only (not reproducible in simulator) |
|
497 |
+ // `in` check used to prevent JIT error (gh-2145) |
|
498 |
+ // hasOwn isn't used here due to false negatives |
|
499 |
+ // regarding Nodelist length in IE |
|
500 |
+ var length = !!obj && "length" in obj && obj.length, |
|
501 |
+ type = toType( obj ); |
|
502 |
+ |
|
503 |
+ if ( isFunction( obj ) || isWindow( obj ) ) { |
|
504 |
+ return false; |
|
505 |
+ } |
|
506 |
+ |
|
507 |
+ return type === "array" || length === 0 || |
|
508 |
+ typeof length === "number" && length > 0 && ( length - 1 ) in obj; |
|
509 |
+} |
|
510 |
+var Sizzle = |
|
511 |
+/*! |
|
512 |
+ * Sizzle CSS Selector Engine v2.3.3 |
|
513 |
+ * https://sizzlejs.com/ |
|
514 |
+ * |
|
515 |
+ * Copyright jQuery Foundation and other contributors |
|
516 |
+ * Released under the MIT license |
|
517 |
+ * http://jquery.org/license |
|
518 |
+ * |
|
519 |
+ * Date: 2016-08-08 |
|
520 |
+ */ |
|
521 |
+(function( window ) { |
|
522 |
+ |
|
523 |
+var i, |
|
524 |
+ support, |
|
525 |
+ Expr, |
|
526 |
+ getText, |
|
527 |
+ isXML, |
|
528 |
+ tokenize, |
|
529 |
+ compile, |
|
530 |
+ select, |
|
531 |
+ outermostContext, |
|
532 |
+ sortInput, |
|
533 |
+ hasDuplicate, |
|
534 |
+ |
|
535 |
+ // Local document vars |
|
536 |
+ setDocument, |
|
537 |
+ document, |
|
538 |
+ docElem, |
|
539 |
+ documentIsHTML, |
|
540 |
+ rbuggyQSA, |
|
541 |
+ rbuggyMatches, |
|
542 |
+ matches, |
|
543 |
+ contains, |
|
544 |
+ |
|
545 |
+ // Instance-specific data |
|
546 |
+ expando = "sizzle" + 1 * new Date(), |
|
547 |
+ preferredDoc = window.document, |
|
548 |
+ dirruns = 0, |
|
549 |
+ done = 0, |
|
550 |
+ classCache = createCache(), |
|
551 |
+ tokenCache = createCache(), |
|
552 |
+ compilerCache = createCache(), |
|
553 |
+ sortOrder = function( a, b ) { |
|
554 |
+ if ( a === b ) { |
|
555 |
+ hasDuplicate = true; |
|
556 |
+ } |
|
557 |
+ return 0; |
|
558 |
+ }, |
|
559 |
+ |
|
560 |
+ // Instance methods |
|
561 |
+ hasOwn = ({}).hasOwnProperty, |
|
562 |
+ arr = [], |
|
563 |
+ pop = arr.pop, |
|
564 |
+ push_native = arr.push, |
|
565 |
+ push = arr.push, |
|
566 |
+ slice = arr.slice, |
|
567 |
+ // Use a stripped-down indexOf as it's faster than native |
|
568 |
+ // https://jsperf.com/thor-indexof-vs-for/5 |
|
569 |
+ indexOf = function( list, elem ) { |
|
570 |
+ var i = 0, |
|
571 |
+ len = list.length; |
|
572 |
+ for ( ; i < len; i++ ) { |
|
573 |
+ if ( list[i] === elem ) { |
|
574 |
+ return i; |
|
575 |
+ } |
|
576 |
+ } |
|
577 |
+ return -1; |
|
578 |
+ }, |
|
579 |
+ |
|
580 |
+ booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", |
|
581 |
+ |
|
582 |
+ // Regular expressions |
|
583 |
+ |
|
584 |
+ // http://www.w3.org/TR/css3-selectors/#whitespace |
|
585 |
+ whitespace = "[\\x20\\t\\r\\n\\f]", |
|
586 |
+ |
|
587 |
+ // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier |
|
588 |
+ identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", |
|
589 |
+ |
|
590 |
+ // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors |
|
591 |
+ attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + |
|
592 |
+ // Operator (capture 2) |
|
593 |
+ "*([*^$|!~]?=)" + whitespace + |
|
594 |
+ // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" |
|
595 |
+ "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + |
|
596 |
+ "*\\]", |
|
597 |
+ |
|
598 |
+ pseudos = ":(" + identifier + ")(?:\\((" + |
|
599 |
+ // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: |
|
600 |
+ // 1. quoted (capture 3; capture 4 or capture 5) |
|
601 |
+ "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + |
|
602 |
+ // 2. simple (capture 6) |
|
603 |
+ "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + |
|
604 |
+ // 3. anything else (capture 2) |
|
605 |
+ ".*" + |
|
606 |
+ ")\\)|)", |
|
607 |
+ |
|
608 |
+ // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter |
|
609 |
+ rwhitespace = new RegExp( whitespace + "+", "g" ), |
|
610 |
+ rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), |
|
611 |
+ |
|
612 |
+ rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), |
|
613 |
+ rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), |
|
614 |
+ |
|
615 |
+ rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), |
|
616 |
+ |
|
617 |
+ rpseudo = new RegExp( pseudos ), |
|
618 |
+ ridentifier = new RegExp( "^" + identifier + "$" ), |
|
619 |
+ |
|
620 |
+ matchExpr = { |
|
621 |
+ "ID": new RegExp( "^#(" + identifier + ")" ), |
|
622 |
+ "CLASS": new RegExp( "^\\.(" + identifier + ")" ), |
|
623 |
+ "TAG": new RegExp( "^(" + identifier + "|[*])" ), |
|
624 |
+ "ATTR": new RegExp( "^" + attributes ), |
|
625 |
+ "PSEUDO": new RegExp( "^" + pseudos ), |
|
626 |
+ "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + |
|
627 |
+ "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + |
|
628 |
+ "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), |
|
629 |
+ "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), |
|
630 |
+ // For use in libraries implementing .is() |
|
631 |
+ // We use this for POS matching in `select` |
|
632 |
+ "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + |
|
633 |
+ whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) |
|
634 |
+ }, |
|
635 |
+ |
|
636 |
+ rinputs = /^(?:input|select|textarea|button)$/i, |
|
637 |
+ rheader = /^h\d$/i, |
|
638 |
+ |
|
639 |
+ rnative = /^[^{]+\{\s*\[native \w/, |
|
640 |
+ |
|
641 |
+ // Easily-parseable/retrievable ID or TAG or CLASS selectors |
|
642 |
+ rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, |
|
643 |
+ |
|
644 |
+ rsibling = /[+~]/, |
|
645 |
+ |
|
646 |
+ // CSS escapes |
|
647 |
+ // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters |
|
648 |
+ runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), |
|
649 |
+ funescape = function( _, escaped, escapedWhitespace ) { |
|
650 |
+ var high = "0x" + escaped - 0x10000; |
|
651 |
+ // NaN means non-codepoint |
|
652 |
+ // Support: Firefox<24 |
|
653 |
+ // Workaround erroneous numeric interpretation of +"0x" |
|
654 |
+ return high !== high || escapedWhitespace ? |
|
655 |
+ escaped : |
|
656 |
+ high < 0 ? |
|
657 |
+ // BMP codepoint |
|
658 |
+ String.fromCharCode( high + 0x10000 ) : |
|
659 |
+ // Supplemental Plane codepoint (surrogate pair) |
|
660 |
+ String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); |
|
661 |
+ }, |
|
662 |
+ |
|
663 |
+ // CSS string/identifier serialization |
|
664 |
+ // https://drafts.csswg.org/cssom/#common-serializing-idioms |
|
665 |
+ rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, |
|
666 |
+ fcssescape = function( ch, asCodePoint ) { |
|
667 |
+ if ( asCodePoint ) { |
|
668 |
+ |
|
669 |
+ // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER |
|
670 |
+ if ( ch === "\0" ) { |
|
671 |
+ return "\uFFFD"; |
|
672 |
+ } |
|
673 |
+ |
|
674 |
+ // Control characters and (dependent upon position) numbers get escaped as code points |
|
675 |
+ return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; |
|
676 |
+ } |
|
677 |
+ |
|
678 |
+ // Other potentially-special ASCII characters get backslash-escaped |
|
679 |
+ return "\\" + ch; |
|
680 |
+ }, |
|
681 |
+ |
|
682 |
+ // Used for iframes |
|
683 |
+ // See setDocument() |
|
684 |
+ // Removing the function wrapper causes a "Permission Denied" |
|
685 |
+ // error in IE |
|
686 |
+ unloadHandler = function() { |
|
687 |
+ setDocument(); |
|
688 |
+ }, |
|
689 |
+ |
|
690 |
+ disabledAncestor = addCombinator( |
|
691 |
+ function( elem ) { |
|
692 |
+ return elem.disabled === true && ("form" in elem || "label" in elem); |
|
693 |
+ }, |
|
694 |
+ { dir: "parentNode", next: "legend" } |
|
695 |
+ ); |
|
696 |
+ |
|
697 |
+// Optimize for push.apply( _, NodeList ) |
|
698 |
+try { |
|
699 |
+ push.apply( |
|
700 |
+ (arr = slice.call( preferredDoc.childNodes )), |
|
701 |
+ preferredDoc.childNodes |
|
702 |
+ ); |
|
703 |
+ // Support: Android<4.0 |
|
704 |
+ // Detect silently failing push.apply |
|
705 |
+ arr[ preferredDoc.childNodes.length ].nodeType; |
|
706 |
+} catch ( e ) { |
|
707 |
+ push = { apply: arr.length ? |
|
708 |
+ |
|
709 |
+ // Leverage slice if possible |
|
710 |
+ function( target, els ) { |
|
711 |
+ push_native.apply( target, slice.call(els) ); |
|
712 |
+ } : |
|
713 |
+ |
|
714 |
+ // Support: IE<9 |
|
715 |
+ // Otherwise append directly |
|
716 |
+ function( target, els ) { |
|
717 |
+ var j = target.length, |
|
718 |
+ i = 0; |
|
719 |
+ // Can't trust NodeList.length |
|
720 |
+ while ( (target[j++] = els[i++]) ) {} |
|
721 |
+ target.length = j - 1; |
|
722 |
+ } |
|
723 |
+ }; |
|
724 |
+} |
|
725 |
+ |
|
726 |
+function Sizzle( selector, context, results, seed ) { |
|
727 |
+ var m, i, elem, nid, match, groups, newSelector, |
|
728 |
+ newContext = context && context.ownerDocument, |
|
729 |
+ |
|
730 |
+ // nodeType defaults to 9, since context defaults to document |
|
731 |
+ nodeType = context ? context.nodeType : 9; |
|
732 |
+ |
|
733 |
+ results = results || []; |
|
734 |
+ |
|
735 |
+ // Return early from calls with invalid selector or context |
|
736 |
+ if ( typeof selector !== "string" || !selector || |
|
737 |
+ nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { |
|
738 |
+ |
|
739 |
+ return results; |
|
740 |
+ } |
|
741 |
+ |
|
742 |
+ // Try to shortcut find operations (as opposed to filters) in HTML documents |
|
743 |
+ if ( !seed ) { |
|
744 |
+ |
|
745 |
+ if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { |
|
746 |
+ setDocument( context ); |
|
747 |
+ } |
|
748 |
+ context = context || document; |
|
749 |
+ |
|
750 |
+ if ( documentIsHTML ) { |
|
751 |
+ |
|
752 |
+ // If the selector is sufficiently simple, try using a "get*By*" DOM method |
|
753 |
+ // (excepting DocumentFragment context, where the methods don't exist) |
|
754 |
+ if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { |
|
755 |
+ |
|
756 |
+ // ID selector |
|
757 |
+ if ( (m = match[1]) ) { |
|
758 |
+ |
|
759 |
+ // Document context |
|
760 |
+ if ( nodeType === 9 ) { |
|
761 |
+ if ( (elem = context.getElementById( m )) ) { |
|
762 |
+ |
|
763 |
+ // Support: IE, Opera, Webkit |
|
764 |
+ // TODO: identify versions |
|
765 |
+ // getElementById can match elements by name instead of ID |
|
766 |
+ if ( elem.id === m ) { |
|
767 |
+ results.push( elem ); |
|
768 |
+ return results; |
|
769 |
+ } |
|
770 |
+ } else { |
|
771 |
+ return results; |
|
772 |
+ } |
|
773 |
+ |
|
774 |
+ // Element context |
|
775 |
+ } else { |
|
776 |
+ |
|
777 |
+ // Support: IE, Opera, Webkit |
|
778 |
+ // TODO: identify versions |
|
779 |
+ // getElementById can match elements by name instead of ID |
|
780 |
+ if ( newContext && (elem = newContext.getElementById( m )) && |
|
781 |
+ contains( context, elem ) && |
|
782 |
+ elem.id === m ) { |
|
783 |
+ |
|
784 |
+ results.push( elem ); |
|
785 |
+ return results; |
|
786 |
+ } |
|
787 |
+ } |
|
788 |
+ |
|
789 |
+ // Type selector |
|
790 |
+ } else if ( match[2] ) { |
|
791 |
+ push.apply( results, context.getElementsByTagName( selector ) ); |
|
792 |
+ return results; |
|
793 |
+ |
|
794 |
+ // Class selector |
|
795 |
+ } else if ( (m = match[3]) && support.getElementsByClassName && |
|
796 |
+ context.getElementsByClassName ) { |
|
797 |
+ |
|
798 |
+ push.apply( results, context.getElementsByClassName( m ) ); |
|
799 |
+ return results; |
|
800 |
+ } |
|
801 |
+ } |
|
802 |
+ |
|
803 |
+ // Take advantage of querySelectorAll |
|
804 |
+ if ( support.qsa && |
|
805 |
+ !compilerCache[ selector + " " ] && |
|
806 |
+ (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { |
|
807 |
+ |
|
808 |
+ if ( nodeType !== 1 ) { |
|
809 |
+ newContext = context; |
|
810 |
+ newSelector = selector; |
|
811 |
+ |
|
812 |
+ // qSA looks outside Element context, which is not what we want |
|
813 |
+ // Thanks to Andrew Dupont for this workaround technique |
|
814 |
+ // Support: IE <=8 |
|
815 |
+ // Exclude object elements |
|
816 |
+ } else if ( context.nodeName.toLowerCase() !== "object" ) { |
|
817 |
+ |
|
818 |
+ // Capture the context ID, setting it first if necessary |
|
819 |
+ if ( (nid = context.getAttribute( "id" )) ) { |
|
820 |
+ nid = nid.replace( rcssescape, fcssescape ); |
|
821 |
+ } else { |
|
822 |
+ context.setAttribute( "id", (nid = expando) ); |
|
823 |
+ } |
|
824 |
+ |
|
825 |
+ // Prefix every selector in the list |
|
826 |
+ groups = tokenize( selector ); |
|
827 |
+ i = groups.length; |
|
828 |
+ while ( i-- ) { |
|
829 |
+ groups[i] = "#" + nid + " " + toSelector( groups[i] ); |
|
830 |
+ } |
|
831 |
+ newSelector = groups.join( "," ); |
|
832 |
+ |
|
833 |
+ // Expand context for sibling selectors |
|
834 |
+ newContext = rsibling.test( selector ) && testContext( context.parentNode ) || |
|
835 |
+ context; |
|
836 |
+ } |
|
837 |
+ |
|
838 |
+ if ( newSelector ) { |
|
839 |
+ try { |
|
840 |
+ push.apply( results, |
|
841 |
+ newContext.querySelectorAll( newSelector ) |
|
842 |
+ ); |
|
843 |
+ return results; |
|
844 |
+ } catch ( qsaError ) { |
|
845 |
+ } finally { |
|
846 |
+ if ( nid === expando ) { |
|
847 |
+ context.removeAttribute( "id" ); |
|
848 |
+ } |
|
849 |
+ } |
|
850 |
+ } |
|
851 |
+ } |
|
852 |
+ } |
|
853 |
+ } |
|
854 |
+ |
|
855 |
+ // All others |
|
856 |
+ return select( selector.replace( rtrim, "$1" ), context, results, seed ); |
|
857 |
+} |
|
858 |
+ |
|
859 |
+/** |
|
860 |
+ * Create key-value caches of limited size |
|
861 |
+ * @returns {function(string, object)} Returns the Object data after storing it on itself with |
|
862 |
+ * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) |
|
863 |
+ * deleting the oldest entry |
|
864 |
+ */ |
|
865 |
+function createCache() { |
|
866 |
+ var keys = []; |
|
867 |
+ |
|
868 |
+ function cache( key, value ) { |
|
869 |
+ // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) |
|
870 |
+ if ( keys.push( key + " " ) > Expr.cacheLength ) { |
|
871 |
+ // Only keep the most recent entries |
|
872 |
+ delete cache[ keys.shift() ]; |
|
873 |
+ } |
|
874 |
+ return (cache[ key + " " ] = value); |
|
875 |
+ } |
|
876 |
+ return cache; |
|
877 |
+} |
|
878 |
+ |
|
879 |
+/** |
|
880 |
+ * Mark a function for special use by Sizzle |
|
881 |
+ * @param {Function} fn The function to mark |
|
882 |
+ */ |
|
883 |
+function markFunction( fn ) { |
|
884 |
+ fn[ expando ] = true; |
|
885 |
+ return fn; |
|
886 |
+} |
|
887 |
+ |
|
888 |
+/** |
|
889 |
+ * Support testing using an element |
|
890 |
+ * @param {Function} fn Passed the created element and returns a boolean result |
|
891 |
+ */ |
|
892 |
+function assert( fn ) { |
|
893 |
+ var el = document.createElement("fieldset"); |
|
894 |
+ |
|
895 |
+ try { |
|
896 |
+ return !!fn( el ); |
|
897 |
+ } catch (e) { |
|
898 |
+ return false; |
|
899 |
+ } finally { |
|
900 |
+ // Remove from its parent by default |
|
901 |
+ if ( el.parentNode ) { |
|
902 |
+ el.parentNode.removeChild( el ); |
|
903 |
+ } |
|
904 |
+ // release memory in IE |
|
905 |
+ el = null; |
|
906 |
+ } |
|
907 |
+} |
|
908 |
+ |
|
909 |
+/** |
|
910 |
+ * Adds the same handler for all of the specified attrs |
|
911 |
+ * @param {String} attrs Pipe-separated list of attributes |
|
912 |
+ * @param {Function} handler The method that will be applied |
|
913 |
+ */ |
|
914 |
+function addHandle( attrs, handler ) { |
|
915 |
+ var arr = attrs.split("|"), |
|
916 |
+ i = arr.length; |
|
917 |
+ |
|
918 |
+ while ( i-- ) { |
|
919 |
+ Expr.attrHandle[ arr[i] ] = handler; |
|
920 |
+ } |
|
921 |
+} |
|
922 |
+ |
|
923 |
+/** |
|
924 |
+ * Checks document order of two siblings |
|
925 |
+ * @param {Element} a |
|
926 |
+ * @param {Element} b |
|
927 |
+ * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b |
|
928 |
+ */ |
|
929 |
+function siblingCheck( a, b ) { |
|
930 |
+ var cur = b && a, |
|
931 |
+ diff = cur && a.nodeType === 1 && b.nodeType === 1 && |
|
932 |
+ a.sourceIndex - b.sourceIndex; |
|
933 |
+ |
|
934 |
+ // Use IE sourceIndex if available on both nodes |
|
935 |
+ if ( diff ) { |
|
936 |
+ return diff; |
|
937 |
+ } |
|
938 |
+ |
|
939 |
+ // Check if b follows a |
|
940 |
+ if ( cur ) { |
|
941 |
+ while ( (cur = cur.nextSibling) ) { |
|
942 |
+ if ( cur === b ) { |
|
943 |
+ return -1; |
|
944 |
+ } |
|
945 |
+ } |
|
946 |
+ } |
|
947 |
+ |
|
948 |
+ return a ? 1 : -1; |
|
949 |
+} |
|
950 |
+ |
|
951 |
+/** |
|
952 |
+ * Returns a function to use in pseudos for input types |
|
953 |
+ * @param {String} type |
|
954 |
+ */ |
|
955 |
+function createInputPseudo( type ) { |
|
956 |
+ return function( elem ) { |
|
957 |
+ var name = elem.nodeName.toLowerCase(); |
|
958 |
+ return name === "input" && elem.type === type; |
|
959 |
+ }; |
|
960 |
+} |
|
961 |
+ |
|
962 |
+/** |
|
963 |
+ * Returns a function to use in pseudos for buttons |
|
964 |
+ * @param {String} type |
|
965 |
+ */ |
|
966 |
+function createButtonPseudo( type ) { |
|
967 |
+ return function( elem ) { |
|
968 |
+ var name = elem.nodeName.toLowerCase(); |
|
969 |
+ return (name === "input" || name === "button") && elem.type === type; |
|
970 |
+ }; |
|
971 |
+} |
|
972 |
+ |
|
973 |
+/** |
|
974 |
+ * Returns a function to use in pseudos for :enabled/:disabled |
|
975 |
+ * @param {Boolean} disabled true for :disabled; false for :enabled |
|
976 |
+ */ |
|
977 |
+function createDisabledPseudo( disabled ) { |
|
978 |
+ |
|
979 |
+ // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable |
|
980 |
+ return function( elem ) { |
|
981 |
+ |
|
982 |
+ // Only certain elements can match :enabled or :disabled |
|
983 |
+ // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled |
|
984 |
+ // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled |
|
985 |
+ if ( "form" in elem ) { |
|
986 |
+ |
|
987 |
+ // Check for inherited disabledness on relevant non-disabled elements: |
|
988 |
+ // * listed form-associated elements in a disabled fieldset |
|
989 |
+ // https://html.spec.whatwg.org/multipage/forms.html#category-listed |
|
990 |
+ // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled |
|
991 |
+ // * option elements in a disabled optgroup |
|
992 |
+ // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled |
|
993 |
+ // All such elements have a "form" property. |
|
994 |
+ if ( elem.parentNode && elem.disabled === false ) { |
|
995 |
+ |
|
996 |
+ // Option elements defer to a parent optgroup if present |
|
997 |
+ if ( "label" in elem ) { |
|
998 |
+ if ( "label" in elem.parentNode ) { |
|
999 |
+ return elem.parentNode.disabled === disabled; |
|
1000 |
+ } else { |
|
1001 |
+ return elem.disabled === disabled; |
|
1002 |
+ } |
|
1003 |
+ } |
|
1004 |
+ |
|
1005 |
+ // Support: IE 6 - 11 |
|
1006 |
+ // Use the isDisabled shortcut property to check for disabled fieldset ancestors |
|
1007 |
+ return elem.isDisabled === disabled || |
|
1008 |
+ |
|
1009 |
+ // Where there is no isDisabled, check manually |
|
1010 |
+ /* jshint -W018 */ |
|
1011 |
+ elem.isDisabled !== !disabled && |
|
1012 |
+ disabledAncestor( elem ) === disabled; |
|
1013 |
+ } |
|
1014 |
+ |
|
1015 |
+ return elem.disabled === disabled; |
|
1016 |
+ |
|
1017 |
+ // Try to winnow out elements that can't be disabled before trusting the disabled property. |
|
1018 |
+ // Some victims get caught in our net (label, legend, menu, track), but it shouldn't |
|
1019 |
+ // even exist on them, let alone have a boolean value. |
|
1020 |
+ } else if ( "label" in elem ) { |
|
1021 |
+ return elem.disabled === disabled; |
|
1022 |
+ } |
|
1023 |
+ |
|
1024 |
+ // Remaining elements are neither :enabled nor :disabled |
|
1025 |
+ return false; |
|
1026 |
+ }; |
|
1027 |
+} |
|
1028 |
+ |
|
1029 |
+/** |
|
1030 |
+ * Returns a function to use in pseudos for positionals |
|
1031 |
+ * @param {Function} fn |
|
1032 |
+ */ |
|
1033 |
+function createPositionalPseudo( fn ) { |
|
1034 |
+ return markFunction(function( argument ) { |
|
1035 |
+ argument = +argument; |
|
1036 |
+ return markFunction(function( seed, matches ) { |
|
1037 |
+ var j, |
|
1038 |
+ matchIndexes = fn( [], seed.length, argument ), |
|
1039 |
+ i = matchIndexes.length; |
|
1040 |
+ |
|
1041 |
+ // Match elements found at the specified indexes |
|
1042 |
+ while ( i-- ) { |
|
1043 |
+ if ( seed[ (j = matchIndexes[i]) ] ) { |
|
1044 |
+ seed[j] = !(matches[j] = seed[j]); |
|
1045 |
+ } |
|
1046 |
+ } |
|
1047 |
+ }); |
|
1048 |
+ }); |
|
1049 |
+} |
|
1050 |
+ |
|
1051 |
+/** |
|
1052 |
+ * Checks a node for validity as a Sizzle context |
|
1053 |
+ * @param {Element|Object=} context |
|
1054 |
+ * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value |
|
1055 |
+ */ |
|
1056 |
+function testContext( context ) { |
|
1057 |
+ return context && typeof context.getElementsByTagName !== "undefined" && context; |
|
1058 |
+} |
|
1059 |
+ |
|
1060 |
+// Expose support vars for convenience |
|
1061 |
+support = Sizzle.support = {}; |
|
1062 |
+ |
|
1063 |
+/** |
|
1064 |
+ * Detects XML nodes |
|
1065 |
+ * @param {Element|Object} elem An element or a document |
|
1066 |
+ * @returns {Boolean} True iff elem is a non-HTML XML node |
|
1067 |
+ */ |
|
1068 |
+isXML = Sizzle.isXML = function( elem ) { |
|
1069 |
+ // documentElement is verified for cases where it doesn't yet exist |
|
1070 |
+ // (such as loading iframes in IE - #4833) |
|
1071 |
+ var documentElement = elem && (elem.ownerDocument || elem).documentElement; |
|
1072 |
+ return documentElement ? documentElement.nodeName !== "HTML" : false; |
|
1073 |
+}; |
|
1074 |
+ |
|
1075 |
+/** |
|
1076 |
+ * Sets document-related variables once based on the current document |
|
1077 |
+ * @param {Element|Object} [doc] An element or document object to use to set the document |
|
1078 |
+ * @returns {Object} Returns the current document |
|
1079 |
+ */ |
|
1080 |
+setDocument = Sizzle.setDocument = function( node ) { |
|
1081 |
+ var hasCompare, subWindow, |
|
1082 |
+ doc = node ? node.ownerDocument || node : preferredDoc; |
|
1083 |
+ |
|
1084 |
+ // Return early if doc is invalid or already selected |
|
1085 |
+ if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { |
|
1086 |
+ return document; |
|
1087 |
+ } |
|
1088 |
+ |
|
1089 |
+ // Update global variables |
|
1090 |
+ document = doc; |
|
1091 |
+ docElem = document.documentElement; |
|
1092 |
+ documentIsHTML = !isXML( document ); |
|
1093 |
+ |
|
1094 |
+ // Support: IE 9-11, Edge |
|
1095 |
+ // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) |
|
1096 |
+ if ( preferredDoc !== document && |
|
1097 |
+ (subWindow = document.defaultView) && subWindow.top !== subWindow ) { |
|
1098 |
+ |
|
1099 |
+ // Support: IE 11, Edge |
|
1100 |
+ if ( subWindow.addEventListener ) { |
|
1101 |
+ subWindow.addEventListener( "unload", unloadHandler, false ); |
|
1102 |
+ |
|
1103 |
+ // Support: IE 9 - 10 only |
|
1104 |
+ } else if ( subWindow.attachEvent ) { |
|
1105 |
+ subWindow.attachEvent( "onunload", unloadHandler ); |
|
1106 |
+ } |
|
1107 |
+ } |
|
1108 |
+ |
|
1109 |
+ /* Attributes |
|
1110 |
+ ---------------------------------------------------------------------- */ |
|
1111 |
+ |
|
1112 |
+ // Support: IE<8 |
|
1113 |
+ // Verify that getAttribute really returns attributes and not properties |
|
1114 |
+ // (excepting IE8 booleans) |
|
1115 |
+ support.attributes = assert(function( el ) { |
|
1116 |
+ el.className = "i"; |
|
1117 |
+ return !el.getAttribute("className"); |
|
1118 |
+ }); |
|
1119 |
+ |
|
1120 |
+ /* getElement(s)By* |
|
1121 |
+ ---------------------------------------------------------------------- */ |
|
1122 |
+ |
|
1123 |
+ // Check if getElementsByTagName("*") returns only elements |
|
1124 |
+ support.getElementsByTagName = assert(function( el ) { |
|
1125 |
+ el.appendChild( document.createComment("") ); |
|
1126 |
+ return !el.getElementsByTagName("*").length; |
|
1127 |
+ }); |
|
1128 |
+ |
|
1129 |
+ // Support: IE<9 |
|
1130 |
+ support.getElementsByClassName = rnative.test( document.getElementsByClassName ); |
|
1131 |
+ |
|
1132 |
+ // Support: IE<10 |
|
1133 |
+ // Check if getElementById returns elements by name |
|
1134 |
+ // The broken getElementById methods don't pick up programmatically-set names, |
|
1135 |
+ // so use a roundabout getElementsByName test |
|
1136 |
+ support.getById = assert(function( el ) { |
|
1137 |
+ docElem.appendChild( el ).id = expando; |
|
1138 |
+ return !document.getElementsByName || !document.getElementsByName( expando ).length; |
|
1139 |
+ }); |
|
1140 |
+ |
|
1141 |
+ // ID filter and find |
|
1142 |
+ if ( support.getById ) { |
|
1143 |
+ Expr.filter["ID"] = function( id ) { |
|
1144 |
+ var attrId = id.replace( runescape, funescape ); |
|
1145 |
+ return function( elem ) { |
|
1146 |
+ return elem.getAttribute("id") === attrId; |
|
1147 |
+ }; |
|
1148 |
+ }; |
|
1149 |
+ Expr.find["ID"] = function( id, context ) { |
|
1150 |
+ if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { |
|
1151 |
+ var elem = context.getElementById( id ); |
|
1152 |
+ return elem ? [ elem ] : []; |
|
1153 |
+ } |
|
1154 |
+ }; |
|
1155 |
+ } else { |
|
1156 |
+ Expr.filter["ID"] = function( id ) { |
|
1157 |
+ var attrId = id.replace( runescape, funescape ); |
|
1158 |
+ return function( elem ) { |
|
1159 |
+ var node = typeof elem.getAttributeNode !== "undefined" && |
|
1160 |
+ elem.getAttributeNode("id"); |
|
1161 |
+ return node && node.value === attrId; |
|
1162 |
+ }; |
|
1163 |
+ }; |
|
1164 |
+ |
|
1165 |
+ // Support: IE 6 - 7 only |
|
1166 |
+ // getElementById is not reliable as a find shortcut |
|
1167 |
+ Expr.find["ID"] = function( id, context ) { |
|
1168 |
+ if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { |
|
1169 |
+ var node, i, elems, |
|
1170 |
+ elem = context.getElementById( id ); |
|
1171 |
+ |
|
1172 |
+ if ( elem ) { |
|
1173 |
+ |
|
1174 |
+ // Verify the id attribute |
|
1175 |
+ node = elem.getAttributeNode("id"); |
|
1176 |
+ if ( node && node.value === id ) { |
|
1177 |
+ return [ elem ]; |
|
1178 |
+ } |
|
1179 |
+ |
|
1180 |
+ // Fall back on getElementsByName |
|
1181 |
+ elems = context.getElementsByName( id ); |
|
1182 |
+ i = 0; |
|
1183 |
+ while ( (elem = elems[i++]) ) { |
|
1184 |
+ node = elem.getAttributeNode("id"); |
|
1185 |
+ if ( node && node.value === id ) { |
|
1186 |
+ return [ elem ]; |
|
1187 |
+ } |
|
1188 |
+ } |
|
1189 |
+ } |
|
1190 |
+ |
|
1191 |
+ return []; |
|
1192 |
+ } |
|
1193 |
+ }; |
|
1194 |
+ } |
|
1195 |
+ |
|
1196 |
+ // Tag |
|
1197 |
+ Expr.find["TAG"] = support.getElementsByTagName ? |
|
1198 |
+ function( tag, context ) { |
|
1199 |
+ if ( typeof context.getElementsByTagName !== "undefined" ) { |
|
1200 |
+ return context.getElementsByTagName( tag ); |
|
1201 |
+ |
|
1202 |
+ // DocumentFragment nodes don't have gEBTN |
|
1203 |
+ } else if ( support.qsa ) { |
|
1204 |
+ return context.querySelectorAll( tag ); |
|
1205 |
+ } |
|
1206 |
+ } : |
|
1207 |
+ |
|
1208 |
+ function( tag, context ) { |
|
1209 |
+ var elem, |
|
1210 |
+ tmp = [], |
|
1211 |
+ i = 0, |
|
1212 |
+ // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too |
|
1213 |
+ results = context.getElementsByTagName( tag ); |
|
1214 |
+ |
|
1215 |
+ // Filter out possible comments |
|
1216 |
+ if ( tag === "*" ) { |
|
1217 |
+ while ( (elem = results[i++]) ) { |
|
1218 |
+ if ( elem.nodeType === 1 ) { |
|
1219 |
+ tmp.push( elem ); |
|
1220 |
+ } |
|
1221 |
+ } |
|
1222 |
+ |
|
1223 |
+ return tmp; |
|
1224 |
+ } |
|
1225 |
+ return results; |
|
1226 |
+ }; |
|
1227 |
+ |
|
1228 |
+ // Class |
|
1229 |
+ Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { |
|
1230 |
+ if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { |
|
1231 |
+ return context.getElementsByClassName( className ); |
|
1232 |
+ } |
|
1233 |
+ }; |
|
1234 |
+ |
|
1235 |
+ /* QSA/matchesSelector |
|
1236 |
+ ---------------------------------------------------------------------- */ |
|
1237 |
+ |
|
1238 |
+ // QSA and matchesSelector support |
|
1239 |
+ |
|
1240 |
+ // matchesSelector(:active) reports false when true (IE9/Opera 11.5) |
|
1241 |
+ rbuggyMatches = []; |
|
1242 |
+ |
|
1243 |
+ // qSa(:focus) reports false when true (Chrome 21) |
|
1244 |
+ // We allow this because of a bug in IE8/9 that throws an error |
|
1245 |
+ // whenever `document.activeElement` is accessed on an iframe |
|
1246 |
+ // So, we allow :focus to pass through QSA all the time to avoid the IE error |
|
1247 |
+ // See https://bugs.jquery.com/ticket/13378 |
|
1248 |
+ rbuggyQSA = []; |
|
1249 |
+ |
|
1250 |
+ if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { |
|
1251 |
+ // Build QSA regex |
|
1252 |
+ // Regex strategy adopted from Diego Perini |
|
1253 |
+ assert(function( el ) { |
|
1254 |
+ // Select is set to empty string on purpose |
|
1255 |
+ // This is to test IE's treatment of not explicitly |
|
1256 |
+ // setting a boolean content attribute, |
|
1257 |
+ // since its presence should be enough |
|
1258 |
+ // https://bugs.jquery.com/ticket/12359 |
|
1259 |
+ docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + |
|
1260 |
+ "<select id='" + expando + "-\r\\' msallowcapture=''>" + |
|
1261 |
+ "<option selected=''></option></select>"; |
|
1262 |
+ |
|
1263 |
+ // Support: IE8, Opera 11-12.16 |
|
1264 |
+ // Nothing should be selected when empty strings follow ^= or $= or *= |
|
1265 |
+ // The test attribute must be unknown in Opera but "safe" for WinRT |
|
1266 |
+ // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section |
|
1267 |
+ if ( el.querySelectorAll("[msallowcapture^='']").length ) { |
|
1268 |
+ rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); |
|
1269 |
+ } |
|
1270 |
+ |
|
1271 |
+ // Support: IE8 |
|
1272 |
+ // Boolean attributes and "value" are not treated correctly |
|
1273 |
+ if ( !el.querySelectorAll("[selected]").length ) { |
|
1274 |
+ rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); |
|
1275 |
+ } |
|
1276 |
+ |
|
1277 |
+ // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ |
|
1278 |
+ if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { |
|
1279 |
+ rbuggyQSA.push("~="); |
|
1280 |
+ } |
|
1281 |
+ |
|
1282 |
+ // Webkit/Opera - :checked should return selected option elements |
|
1283 |
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
|
1284 |
+ // IE8 throws error here and will not see later tests |
|
1285 |
+ if ( !el.querySelectorAll(":checked").length ) { |
|
1286 |
+ rbuggyQSA.push(":checked"); |
|
1287 |
+ } |
|
1288 |
+ |
|
1289 |
+ // Support: Safari 8+, iOS 8+ |
|
1290 |
+ // https://bugs.webkit.org/show_bug.cgi?id=136851 |
|
1291 |
+ // In-page `selector#id sibling-combinator selector` fails |
|
1292 |
+ if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { |
|
1293 |
+ rbuggyQSA.push(".#.+[+~]"); |
|
1294 |
+ } |
|
1295 |
+ }); |
|
1296 |
+ |
|
1297 |
+ assert(function( el ) { |
|
1298 |
+ el.innerHTML = "<a href='' disabled='disabled'></a>" + |
|
1299 |
+ "<select disabled='disabled'><option/></select>"; |
|
1300 |
+ |
|
1301 |
+ // Support: Windows 8 Native Apps |
|
1302 |
+ // The type and name attributes are restricted during .innerHTML assignment |
|
1303 |
+ var input = document.createElement("input"); |
|
1304 |
+ input.setAttribute( "type", "hidden" ); |
|
1305 |
+ el.appendChild( input ).setAttribute( "name", "D" ); |
|
1306 |
+ |
|
1307 |
+ // Support: IE8 |
|
1308 |
+ // Enforce case-sensitivity of name attribute |
|
1309 |
+ if ( el.querySelectorAll("[name=d]").length ) { |
|
1310 |
+ rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); |
|
1311 |
+ } |
|
1312 |
+ |
|
1313 |
+ // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) |
|
1314 |
+ // IE8 throws error here and will not see later tests |
|
1315 |
+ if ( el.querySelectorAll(":enabled").length !== 2 ) { |
|
1316 |
+ rbuggyQSA.push( ":enabled", ":disabled" ); |
|
1317 |
+ } |
|
1318 |
+ |
|
1319 |
+ // Support: IE9-11+ |
|
1320 |
+ // IE's :disabled selector does not pick up the children of disabled fieldsets |
|
1321 |
+ docElem.appendChild( el ).disabled = true; |
|
1322 |
+ if ( el.querySelectorAll(":disabled").length !== 2 ) { |
|
1323 |
+ rbuggyQSA.push( ":enabled", ":disabled" ); |
|
1324 |
+ } |
|
1325 |
+ |
|
1326 |
+ // Opera 10-11 does not throw on post-comma invalid pseudos |
|
1327 |
+ el.querySelectorAll("*,:x"); |
|
1328 |
+ rbuggyQSA.push(",.*:"); |
|
1329 |
+ }); |
|
1330 |
+ } |
|
1331 |
+ |
|
1332 |
+ if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || |
|
1333 |
+ docElem.webkitMatchesSelector || |
|
1334 |
+ docElem.mozMatchesSelector || |
|
1335 |
+ docElem.oMatchesSelector || |
|
1336 |
+ docElem.msMatchesSelector) )) ) { |
|
1337 |
+ |
|
1338 |
+ assert(function( el ) { |
|
1339 |
+ // Check to see if it's possible to do matchesSelector |
|
1340 |
+ // on a disconnected node (IE 9) |
|
1341 |
+ support.disconnectedMatch = matches.call( el, "*" ); |
|
1342 |
+ |
|
1343 |
+ // This should fail with an exception |
|
1344 |
+ // Gecko does not error, returns false instead |
|
1345 |
+ matches.call( el, "[s!='']:x" ); |
|
1346 |
+ rbuggyMatches.push( "!=", pseudos ); |
|
1347 |
+ }); |
|
1348 |
+ } |
|
1349 |
+ |
|
1350 |
+ rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); |
|
1351 |
+ rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); |
|
1352 |
+ |
|
1353 |
+ /* Contains |
|
1354 |
+ ---------------------------------------------------------------------- */ |
|
1355 |
+ hasCompare = rnative.test( docElem.compareDocumentPosition ); |
|
1356 |
+ |
|
1357 |
+ // Element contains another |
|
1358 |
+ // Purposefully self-exclusive |
|
1359 |
+ // As in, an element does not contain itself |
|
1360 |
+ contains = hasCompare || rnative.test( docElem.contains ) ? |
|
1361 |
+ function( a, b ) { |
|
1362 |
+ var adown = a.nodeType === 9 ? a.documentElement : a, |
|
1363 |
+ bup = b && b.parentNode; |
|
1364 |
+ return a === bup || !!( bup && bup.nodeType === 1 && ( |
|
1365 |
+ adown.contains ? |
|
1366 |
+ adown.contains( bup ) : |
|
1367 |
+ a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 |
|
1368 |
+ )); |
|
1369 |
+ } : |
|
1370 |
+ function( a, b ) { |
|
1371 |
+ if ( b ) { |
|
1372 |
+ while ( (b = b.parentNode) ) { |
|
1373 |
+ if ( b === a ) { |
|
1374 |
+ return true; |
|
1375 |
+ } |
|
1376 |
+ } |
|
1377 |
+ } |
|
1378 |
+ return false; |
|
1379 |
+ }; |
|
1380 |
+ |
|
1381 |
+ /* Sorting |
|
1382 |
+ ---------------------------------------------------------------------- */ |
|
1383 |
+ |
|
1384 |
+ // Document order sorting |
|
1385 |
+ sortOrder = hasCompare ? |
|
1386 |
+ function( a, b ) { |
|
1387 |
+ |
|
1388 |
+ // Flag for duplicate removal |
|
1389 |
+ if ( a === b ) { |
|
1390 |
+ hasDuplicate = true; |
|
1391 |
+ return 0; |
|
1392 |
+ } |
|
1393 |
+ |
|
1394 |
+ // Sort on method existence if only one input has compareDocumentPosition |
|
1395 |
+ var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; |
|
1396 |
+ if ( compare ) { |
|
1397 |
+ return compare; |
|
1398 |
+ } |
|
1399 |
+ |
|
1400 |
+ // Calculate position if both inputs belong to the same document |
|
1401 |
+ compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? |
|
1402 |
+ a.compareDocumentPosition( b ) : |
|
1403 |
+ |
|
1404 |
+ // Otherwise we know they are disconnected |
|
1405 |
+ 1; |
|
1406 |
+ |
|
1407 |
+ // Disconnected nodes |
|
1408 |
+ if ( compare & 1 || |
|
1409 |
+ (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { |
|
1410 |
+ |
|
1411 |
+ // Choose the first element that is related to our preferred document |
|
1412 |
+ if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { |
|
1413 |
+ return -1; |
|
1414 |
+ } |
|
1415 |
+ if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { |
|
1416 |
+ return 1; |
|
1417 |
+ } |
|
1418 |
+ |
|
1419 |
+ // Maintain original order |
|
1420 |
+ return sortInput ? |
|
1421 |
+ ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : |
|
1422 |
+ 0; |
|
1423 |
+ } |
|
1424 |
+ |
|
1425 |
+ return compare & 4 ? -1 : 1; |
|
1426 |
+ } : |
|
1427 |
+ function( a, b ) { |
|
1428 |
+ // Exit early if the nodes are identical |
|
1429 |
+ if ( a === b ) { |
|
1430 |
+ hasDuplicate = true; |
|
1431 |
+ return 0; |
|
1432 |
+ } |
|
1433 |
+ |
|
1434 |
+ var cur, |
|
1435 |
+ i = 0, |
|
1436 |
+ aup = a.parentNode, |
|
1437 |
+ bup = b.parentNode, |
|
1438 |
+ ap = [ a ], |
|
1439 |
+ bp = [ b ]; |
|
1440 |
+ |
|
1441 |
+ // Parentless nodes are either documents or disconnected |
|
1442 |
+ if ( !aup || !bup ) { |
|
1443 |
+ return a === document ? -1 : |
|
1444 |
+ b === document ? 1 : |
|
1445 |
+ aup ? -1 : |
|
1446 |
+ bup ? 1 : |
|
1447 |
+ sortInput ? |
|
1448 |
+ ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : |
|
1449 |
+ 0; |
|
1450 |
+ |
|
1451 |
+ // If the nodes are siblings, we can do a quick check |
|
1452 |
+ } else if ( aup === bup ) { |
|
1453 |
+ return siblingCheck( a, b ); |
|
1454 |
+ } |
|
1455 |
+ |
|
1456 |
+ // Otherwise we need full lists of their ancestors for comparison |
|
1457 |
+ cur = a; |
|
1458 |
+ while ( (cur = cur.parentNode) ) { |
|
1459 |
+ ap.unshift( cur ); |
|
1460 |
+ } |
|
1461 |
+ cur = b; |
|
1462 |
+ while ( (cur = cur.parentNode) ) { |
|
1463 |
+ bp.unshift( cur ); |
|
1464 |
+ } |
|
1465 |
+ |
|
1466 |
+ // Walk down the tree looking for a discrepancy |
|
1467 |
+ while ( ap[i] === bp[i] ) { |
|
1468 |
+ i++; |
|
1469 |
+ } |
|
1470 |
+ |
|
1471 |
+ return i ? |
|
1472 |
+ // Do a sibling check if the nodes have a common ancestor |
|
1473 |
+ siblingCheck( ap[i], bp[i] ) : |
|
1474 |
+ |
|
1475 |
+ // Otherwise nodes in our document sort first |
|
1476 |
+ ap[i] === preferredDoc ? -1 : |
|
1477 |
+ bp[i] === preferredDoc ? 1 : |
|
1478 |
+ 0; |
|
1479 |
+ }; |
|
1480 |
+ |
|
1481 |
+ return document; |
|
1482 |
+}; |
|
1483 |
+ |
|
1484 |
+Sizzle.matches = function( expr, elements ) { |
|
1485 |
+ return Sizzle( expr, null, null, elements ); |
|
1486 |
+}; |
|
1487 |
+ |
|
1488 |
+Sizzle.matchesSelector = function( elem, expr ) { |
|
1489 |
+ // Set document vars if needed |
|
1490 |
+ if ( ( elem.ownerDocument || elem ) !== document ) { |
|
1491 |
+ setDocument( elem ); |
|
1492 |
+ } |
|
1493 |
+ |
|
1494 |
+ // Make sure that attribute selectors are quoted |
|
1495 |
+ expr = expr.replace( rattributeQuotes, "='$1']" ); |
|
1496 |
+ |
|
1497 |
+ if ( support.matchesSelector && documentIsHTML && |
|
1498 |
+ !compilerCache[ expr + " " ] && |
|
1499 |
+ ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && |
|
1500 |
+ ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { |
|
1501 |
+ |
|
1502 |
+ try { |
|
1503 |
+ var ret = matches.call( elem, expr ); |
|
1504 |
+ |
|
1505 |
+ // IE 9's matchesSelector returns false on disconnected nodes |
|
1506 |
+ if ( ret || support.disconnectedMatch || |
|
1507 |
+ // As well, disconnected nodes are said to be in a document |
|
1508 |
+ // fragment in IE 9 |
|
1509 |
+ elem.document && elem.document.nodeType !== 11 ) { |
|
1510 |
+ return ret; |
|
1511 |
+ } |
|
1512 |
+ } catch (e) {} |
|
1513 |
+ } |
|
1514 |
+ |
|
1515 |
+ return Sizzle( expr, document, null, [ elem ] ).length > 0; |
|
1516 |
+}; |
|
1517 |
+ |
|
1518 |
+Sizzle.contains = function( context, elem ) { |
|
1519 |
+ // Set document vars if needed |
|
1520 |
+ if ( ( context.ownerDocument || context ) !== document ) { |
|
1521 |
+ setDocument( context ); |
|
1522 |
+ } |
|
1523 |
+ return contains( context, elem ); |
|
1524 |
+}; |
|
1525 |
+ |
|
1526 |
+Sizzle.attr = function( elem, name ) { |
|
1527 |
+ // Set document vars if needed |
|
1528 |
+ if ( ( elem.ownerDocument || elem ) !== document ) { |
|
1529 |
+ setDocument( elem ); |
|
1530 |
+ } |
|
1531 |
+ |
|
1532 |
+ var fn = Expr.attrHandle[ name.toLowerCase() ], |
|
1533 |
+ // Don't get fooled by Object.prototype properties (jQuery #13807) |
|
1534 |
+ val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? |
|
1535 |
+ fn( elem, name, !documentIsHTML ) : |
|
1536 |
+ undefined; |
|
1537 |
+ |
|
1538 |
+ return val !== undefined ? |
|
1539 |
+ val : |
|
1540 |
+ support.attributes || !documentIsHTML ? |
|
1541 |
+ elem.getAttribute( name ) : |
|
1542 |
+ (val = elem.getAttributeNode(name)) && val.specified ? |
|
1543 |
+ val.value : |
|
1544 |
+ null; |
|
1545 |
+}; |
|
1546 |
+ |
|
1547 |
+Sizzle.escape = function( sel ) { |
|
1548 |
+ return (sel + "").replace( rcssescape, fcssescape ); |
|
1549 |
+}; |
|
1550 |
+ |
|
1551 |
+Sizzle.error = function( msg ) { |
|
1552 |
+ throw new Error( "Syntax error, unrecognized expression: " + msg ); |
|
1553 |
+}; |
|
1554 |
+ |
|
1555 |
+/** |
|
1556 |
+ * Document sorting and removing duplicates |
|
1557 |
+ * @param {ArrayLike} results |
|
1558 |
+ */ |
|
1559 |
+Sizzle.uniqueSort = function( results ) { |
|
1560 |
+ var elem, |
|
1561 |
+ duplicates = [], |
|
1562 |
+ j = 0, |
|
1563 |
+ i = 0; |
|
1564 |
+ |
|
1565 |
+ // Unless we *know* we can detect duplicates, assume their presence |
|
1566 |
+ hasDuplicate = !support.detectDuplicates; |
|
1567 |
+ sortInput = !support.sortStable && results.slice( 0 ); |
|
1568 |
+ results.sort( sortOrder ); |
|
1569 |
+ |
|
1570 |
+ if ( hasDuplicate ) { |
|
1571 |
+ while ( (elem = results[i++]) ) { |
|
1572 |
+ if ( elem === results[ i ] ) { |
|
1573 |
+ j = duplicates.push( i ); |
|
1574 |
+ } |
|
1575 |
+ } |
|
1576 |
+ while ( j-- ) { |
|
1577 |
+ results.splice( duplicates[ j ], 1 ); |
|
1578 |
+ } |
|
1579 |
+ } |
|
1580 |
+ |
|
1581 |
+ // Clear input after sorting to release objects |
|
1582 |
+ // See https://github.com/jquery/sizzle/pull/225 |
|
1583 |
+ sortInput = null; |
|
1584 |
+ |
|
1585 |
+ return results; |
|
1586 |
+}; |
|
1587 |
+ |
|
1588 |
+/** |
|
1589 |
+ * Utility function for retrieving the text value of an array of DOM nodes |
|
1590 |
+ * @param {Array|Element} elem |
|
1591 |
+ */ |
|
1592 |
+getText = Sizzle.getText = function( elem ) { |
|
1593 |
+ var node, |
|
1594 |
+ ret = "", |
|
1595 |
+ i = 0, |
|
1596 |
+ nodeType = elem.nodeType; |
|
1597 |
+ |
|
1598 |
+ if ( !nodeType ) { |
|
1599 |
+ // If no nodeType, this is expected to be an array |
|
1600 |
+ while ( (node = elem[i++]) ) { |
|
1601 |
+ // Do not traverse comment nodes |
|
1602 |
+ ret += getText( node ); |
|
1603 |
+ } |
|
1604 |
+ } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { |
|
1605 |
+ // Use textContent for elements |
|
1606 |
+ // innerText usage removed for consistency of new lines (jQuery #11153) |
|
1607 |
+ if ( typeof elem.textContent === "string" ) { |
|
1608 |
+ return elem.textContent; |
|
1609 |
+ } else { |
|
1610 |
+ // Traverse its children |
|
1611 |
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
|
1612 |
+ ret += getText( elem ); |
|
1613 |
+ } |
|
1614 |
+ } |
|
1615 |
+ } else if ( nodeType === 3 || nodeType === 4 ) { |
|
1616 |
+ return elem.nodeValue; |
|
1617 |
+ } |
|
1618 |
+ // Do not include comment or processing instruction nodes |
|
1619 |
+ |
|
1620 |
+ return ret; |
|
1621 |
+}; |
|
1622 |
+ |
|
1623 |
+Expr = Sizzle.selectors = { |
|
1624 |
+ |
|
1625 |
+ // Can be adjusted by the user |
|
1626 |
+ cacheLength: 50, |
|
1627 |
+ |
|
1628 |
+ createPseudo: markFunction, |
|
1629 |
+ |
|
1630 |
+ match: matchExpr, |
|
1631 |
+ |
|
1632 |
+ attrHandle: {}, |
|
1633 |
+ |
|
1634 |
+ find: {}, |
|
1635 |
+ |
|
1636 |
+ relative: { |
|
1637 |
+ ">": { dir: "parentNode", first: true }, |
|
1638 |
+ " ": { dir: "parentNode" }, |
|
1639 |
+ "+": { dir: "previousSibling", first: true }, |
|
1640 |
+ "~": { dir: "previousSibling" } |
|
1641 |
+ }, |
|
1642 |
+ |
|
1643 |
+ preFilter: { |
|
1644 |
+ "ATTR": function( match ) { |
|
1645 |
+ match[1] = match[1].replace( runescape, funescape ); |
|
1646 |
+ |
|
1647 |
+ // Move the given value to match[3] whether quoted or unquoted |
|
1648 |
+ match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); |
|
1649 |
+ |
|
1650 |
+ if ( match[2] === "~=" ) { |
|
1651 |
+ match[3] = " " + match[3] + " "; |
|
1652 |
+ } |
|
1653 |
+ |
|
1654 |
+ return match.slice( 0, 4 ); |
|
1655 |
+ }, |
|
1656 |
+ |
|
1657 |
+ "CHILD": function( match ) { |
|
1658 |
+ /* matches from matchExpr["CHILD"] |
|
1659 |
+ 1 type (only|nth|...) |
|
1660 |
+ 2 what (child|of-type) |
|
1661 |
+ 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) |
|
1662 |
+ 4 xn-component of xn+y argument ([+-]?\d*n|) |
|
1663 |
+ 5 sign of xn-component |
|
1664 |
+ 6 x of xn-component |
|
1665 |
+ 7 sign of y-component |
|
1666 |
+ 8 y of y-component |
|
1667 |
+ */ |
|
1668 |
+ match[1] = match[1].toLowerCase(); |
|
1669 |
+ |
|
1670 |
+ if ( match[1].slice( 0, 3 ) === "nth" ) { |
|
1671 |
+ // nth-* requires argument |
|
1672 |
+ if ( !match[3] ) { |
|
1673 |
+ Sizzle.error( match[0] ); |
|
1674 |
+ } |
|
1675 |
+ |
|
1676 |
+ // numeric x and y parameters for Expr.filter.CHILD |
|
1677 |
+ // remember that false/true cast respectively to 0/1 |
|
1678 |
+ match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); |
|
1679 |
+ match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); |
|
1680 |
+ |
|
1681 |
+ // other types prohibit arguments |
|
1682 |
+ } else if ( match[3] ) { |
|
1683 |
+ Sizzle.error( match[0] ); |
|
1684 |
+ } |
|
1685 |
+ |
|
1686 |
+ return match; |
|
1687 |
+ }, |
|
1688 |
+ |
|
1689 |
+ "PSEUDO": function( match ) { |
|
1690 |
+ var excess, |
|
1691 |
+ unquoted = !match[6] && match[2]; |
|
1692 |
+ |
|
1693 |
+ if ( matchExpr["CHILD"].test( match[0] ) ) { |
|
1694 |
+ return null; |
|
1695 |
+ } |
|
1696 |
+ |
|
1697 |
+ // Accept quoted arguments as-is |
|
1698 |
+ if ( match[3] ) { |
|
1699 |
+ match[2] = match[4] || match[5] || ""; |
|
1700 |
+ |
|
1701 |
+ // Strip excess characters from unquoted arguments |
|
1702 |
+ } else if ( unquoted && rpseudo.test( unquoted ) && |
|
1703 |
+ // Get excess from tokenize (recursively) |
|
1704 |
+ (excess = tokenize( unquoted, true )) && |
|
1705 |
+ // advance to the next closing parenthesis |
|
1706 |
+ (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { |
|
1707 |
+ |
|
1708 |
+ // excess is a negative index |
|
1709 |
+ match[0] = match[0].slice( 0, excess ); |
|
1710 |
+ match[2] = unquoted.slice( 0, excess ); |
|
1711 |
+ } |
|
1712 |
+ |
|
1713 |
+ // Return only captures needed by the pseudo filter method (type and argument) |
|
1714 |
+ return match.slice( 0, 3 ); |
|
1715 |
+ } |
|
1716 |
+ }, |
|
1717 |
+ |
|
1718 |
+ filter: { |
|
1719 |
+ |
|
1720 |
+ "TAG": function( nodeNameSelector ) { |
|
1721 |
+ var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); |
|
1722 |
+ return nodeNameSelector === "*" ? |
|
1723 |
+ function() { return true; } : |
|
1724 |
+ function( elem ) { |
|
1725 |
+ return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; |
|
1726 |
+ }; |
|
1727 |
+ }, |
|
1728 |
+ |
|
1729 |
+ "CLASS": function( className ) { |
|
1730 |
+ var pattern = classCache[ className + " " ]; |
|
1731 |
+ |
|
1732 |
+ return pattern || |
|
1733 |
+ (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && |
|
1734 |
+ classCache( className, function( elem ) { |
|
1735 |
+ return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); |
|
1736 |
+ }); |
|
1737 |
+ }, |
|
1738 |
+ |
|
1739 |
+ "ATTR": function( name, operator, check ) { |
|
1740 |
+ return function( elem ) { |
|
1741 |
+ var result = Sizzle.attr( elem, name ); |
|
1742 |
+ |
|
1743 |
+ if ( result == null ) { |
|
1744 |
+ return operator === "!="; |
|
1745 |
+ } |
|
1746 |
+ if ( !operator ) { |
|
1747 |
+ return true; |
|
1748 |
+ } |
|
1749 |
+ |
|
1750 |
+ result += ""; |
|
1751 |
+ |
|
1752 |
+ return operator === "=" ? result === check : |
|
1753 |
+ operator === "!=" ? result !== check : |
|
1754 |
+ operator === "^=" ? check && result.indexOf( check ) === 0 : |
|
1755 |
+ operator === "*=" ? check && result.indexOf( check ) > -1 : |
|
1756 |
+ operator === "$=" ? check && result.slice( -check.length ) === check : |
|
1757 |
+ operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : |
|
1758 |
+ operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : |
|
1759 |
+ false; |
|
1760 |
+ }; |
|
1761 |
+ }, |
|
1762 |
+ |
|
1763 |
+ "CHILD": function( type, what, argument, first, last ) { |
|
1764 |
+ var simple = type.slice( 0, 3 ) !== "nth", |
|
1765 |
+ forward = type.slice( -4 ) !== "last", |
|
1766 |
+ ofType = what === "of-type"; |
|
1767 |
+ |
|
1768 |
+ return first === 1 && last === 0 ? |
|
1769 |
+ |
|
1770 |
+ // Shortcut for :nth-*(n) |
|
1771 |
+ function( elem ) { |
|
1772 |
+ return !!elem.parentNode; |
|
1773 |
+ } : |
|
1774 |
+ |
|
1775 |
+ function( elem, context, xml ) { |
|
1776 |
+ var cache, uniqueCache, outerCache, node, nodeIndex, start, |
|
1777 |
+ dir = simple !== forward ? "nextSibling" : "previousSibling", |
|
1778 |
+ parent = elem.parentNode, |
|
1779 |
+ name = ofType && elem.nodeName.toLowerCase(), |
|
1780 |
+ useCache = !xml && !ofType, |
|
1781 |
+ diff = false; |
|
1782 |
+ |
|
1783 |
+ if ( parent ) { |
|
1784 |
+ |
|
1785 |
+ // :(first|last|only)-(child|of-type) |
|
1786 |
+ if ( simple ) { |
|
1787 |
+ while ( dir ) { |
|
1788 |
+ node = elem; |
|
1789 |
+ while ( (node = node[ dir ]) ) { |
|
1790 |
+ if ( ofType ? |
|
1791 |
+ node.nodeName.toLowerCase() === name : |
|
1792 |
+ node.nodeType === 1 ) { |
|
1793 |
+ |
|
1794 |
+ return false; |
|
1795 |
+ } |
|
1796 |
+ } |
|
1797 |
+ // Reverse direction for :only-* (if we haven't yet done so) |
|
1798 |
+ start = dir = type === "only" && !start && "nextSibling"; |
|
1799 |
+ } |
|
1800 |
+ return true; |
|
1801 |
+ } |
|
1802 |
+ |
|
1803 |
+ start = [ forward ? parent.firstChild : parent.lastChild ]; |
|
1804 |
+ |
|
1805 |
+ // non-xml :nth-child(...) stores cache data on `parent` |
|
1806 |
+ if ( forward && useCache ) { |
|
1807 |
+ |
|
1808 |
+ // Seek `elem` from a previously-cached index |
|
1809 |
+ |
|
1810 |
+ // ...in a gzip-friendly way |
|
1811 |
+ node = parent; |
|
1812 |
+ outerCache = node[ expando ] || (node[ expando ] = {}); |
|
1813 |
+ |
|
1814 |
+ // Support: IE <9 only |
|
1815 |
+ // Defend against cloned attroperties (jQuery gh-1709) |
|
1816 |
+ uniqueCache = outerCache[ node.uniqueID ] || |
|
1817 |
+ (outerCache[ node.uniqueID ] = {}); |
|
1818 |
+ |
|
1819 |
+ cache = uniqueCache[ type ] || []; |
|
1820 |
+ nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
|
1821 |
+ diff = nodeIndex && cache[ 2 ]; |
|
1822 |
+ node = nodeIndex && parent.childNodes[ nodeIndex ]; |
|
1823 |
+ |
|
1824 |
+ while ( (node = ++nodeIndex && node && node[ dir ] || |
|
1825 |
+ |
|
1826 |
+ // Fallback to seeking `elem` from the start |
|
1827 |
+ (diff = nodeIndex = 0) || start.pop()) ) { |
|
1828 |
+ |
|
1829 |
+ // When found, cache indexes on `parent` and break |
|
1830 |
+ if ( node.nodeType === 1 && ++diff && node === elem ) { |
|
1831 |
+ uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; |
|
1832 |
+ break; |
|
1833 |
+ } |
|
1834 |
+ } |
|
1835 |
+ |
|
1836 |
+ } else { |
|
1837 |
+ // Use previously-cached element index if available |
|
1838 |
+ if ( useCache ) { |
|
1839 |
+ // ...in a gzip-friendly way |
|
1840 |
+ node = elem; |
|
1841 |
+ outerCache = node[ expando ] || (node[ expando ] = {}); |
|
1842 |
+ |
|
1843 |
+ // Support: IE <9 only |
|
1844 |
+ // Defend against cloned attroperties (jQuery gh-1709) |
|
1845 |
+ uniqueCache = outerCache[ node.uniqueID ] || |
|
1846 |
+ (outerCache[ node.uniqueID ] = {}); |
|
1847 |
+ |
|
1848 |
+ cache = uniqueCache[ type ] || []; |
|
1849 |
+ nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
|
1850 |
+ diff = nodeIndex; |
|
1851 |
+ } |
|
1852 |
+ |
|
1853 |
+ // xml :nth-child(...) |
|
1854 |
+ // or :nth-last-child(...) or :nth(-last)?-of-type(...) |
|
1855 |
+ if ( diff === false ) { |
|
1856 |
+ // Use the same loop as above to seek `elem` from the start |
|
1857 |
+ while ( (node = ++nodeIndex && node && node[ dir ] || |
|
1858 |
+ (diff = nodeIndex = 0) || start.pop()) ) { |
|
1859 |
+ |
|
1860 |
+ if ( ( ofType ? |
|
1861 |
+ node.nodeName.toLowerCase() === name : |
|
1862 |
+ node.nodeType === 1 ) && |
|
1863 |
+ ++diff ) { |
|
1864 |
+ |
|
1865 |
+ // Cache the index of each encountered element |
|
1866 |
+ if ( useCache ) { |
|
1867 |
+ outerCache = node[ expando ] || (node[ expando ] = {}); |
|
1868 |
+ |
|
1869 |
+ // Support: IE <9 only |
|
1870 |
+ // Defend against cloned attroperties (jQuery gh-1709) |
|
1871 |
+ uniqueCache = outerCache[ node.uniqueID ] || |
|
1872 |
+ (outerCache[ node.uniqueID ] = {}); |
|
1873 |
+ |
|
1874 |
+ uniqueCache[ type ] = [ dirruns, diff ]; |
|
1875 |
+ } |
|
1876 |
+ |
|
1877 |
+ if ( node === elem ) { |
|
1878 |
+ break; |
|
1879 |
+ } |
|
1880 |
+ } |
|
1881 |
+ } |
|
1882 |
+ } |
|
1883 |
+ } |
|
1884 |
+ |
|
1885 |
+ // Incorporate the offset, then check against cycle size |
|
1886 |
+ diff -= last; |
|
1887 |
+ return diff === first || ( diff % first === 0 && diff / first >= 0 ); |
|
1888 |
+ } |
|
1889 |
+ }; |
|
1890 |
+ }, |
|
1891 |
+ |
|
1892 |
+ "PSEUDO": function( pseudo, argument ) { |
|
1893 |
+ // pseudo-class names are case-insensitive |
|
1894 |
+ // http://www.w3.org/TR/selectors/#pseudo-classes |
|
1895 |
+ // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters |
|
1896 |
+ // Remember that setFilters inherits from pseudos |
|
1897 |
+ var args, |
|
1898 |
+ fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || |
|
1899 |
+ Sizzle.error( "unsupported pseudo: " + pseudo ); |
|
1900 |
+ |
|
1901 |
+ // The user may use createPseudo to indicate that |
|
1902 |
+ // arguments are needed to create the filter function |
|
1903 |
+ // just as Sizzle does |
|
1904 |
+ if ( fn[ expando ] ) { |
|
1905 |
+ return fn( argument ); |
|
1906 |
+ } |
|
1907 |
+ |
|
1908 |
+ // But maintain support for old signatures |
|
1909 |
+ if ( fn.length > 1 ) { |
|
1910 |
+ args = [ pseudo, pseudo, "", argument ]; |
|
1911 |
+ return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? |
|
1912 |
+ markFunction(function( seed, matches ) { |
|
1913 |
+ var idx, |
|
1914 |
+ matched = fn( seed, argument ), |
|
1915 |
+ i = matched.length; |
|
1916 |
+ while ( i-- ) { |
|
1917 |
+ idx = indexOf( seed, matched[i] ); |
|
1918 |
+ seed[ idx ] = !( matches[ idx ] = matched[i] ); |
|
1919 |
+ } |
|
1920 |
+ }) : |
|
1921 |
+ function( elem ) { |
|
1922 |
+ return fn( elem, 0, args ); |
|
1923 |
+ }; |
|
1924 |
+ } |
|
1925 |
+ |
|
1926 |
+ return fn; |
|
1927 |
+ } |
|
1928 |
+ }, |
|
1929 |
+ |
|
1930 |
+ pseudos: { |
|
1931 |
+ // Potentially complex pseudos |
|
1932 |
+ "not": markFunction(function( selector ) { |
|
1933 |
+ // Trim the selector passed to compile |
|
1934 |
+ // to avoid treating leading and trailing |
|
1935 |
+ // spaces as combinators |
|
1936 |
+ var input = [], |
|
1937 |
+ results = [], |
|
1938 |
+ matcher = compile( selector.replace( rtrim, "$1" ) ); |
|
1939 |
+ |
|
1940 |
+ return matcher[ expando ] ? |
|
1941 |
+ markFunction(function( seed, matches, context, xml ) { |
|
1942 |
+ var elem, |
|
1943 |
+ unmatched = matcher( seed, null, xml, [] ), |
|
1944 |
+ i = seed.length; |
|
1945 |
+ |
|
1946 |
+ // Match elements unmatched by `matcher` |
|
1947 |
+ while ( i-- ) { |
|
1948 |
+ if ( (elem = unmatched[i]) ) { |
|
1949 |
+ seed[i] = !(matches[i] = elem); |
|
1950 |
+ } |
|
1951 |
+ } |
|
1952 |
+ }) : |
|
1953 |
+ function( elem, context, xml ) { |
|
1954 |
+ input[0] = elem; |
|
1955 |
+ matcher( input, null, xml, results ); |
|
1956 |
+ // Don't keep the element (issue #299) |
|
1957 |
+ input[0] = null; |
|
1958 |
+ return !results.pop(); |
|
1959 |
+ }; |
|
1960 |
+ }), |
|
1961 |
+ |
|
1962 |
+ "has": markFunction(function( selector ) { |
|
1963 |
+ return function( elem ) { |
|
1964 |
+ return Sizzle( selector, elem ).length > 0; |
|
1965 |
+ }; |
|
1966 |
+ }), |
|
1967 |
+ |
|
1968 |
+ "contains": markFunction(function( text ) { |
|
1969 |
+ text = text.replace( runescape, funescape ); |
|
1970 |
+ return function( elem ) { |
|
1971 |
+ return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; |
|
1972 |
+ }; |
|
1973 |
+ }), |
|
1974 |
+ |
|
1975 |
+ // "Whether an element is represented by a :lang() selector |
|
1976 |
+ // is based solely on the element's language value |
|
1977 |
+ // being equal to the identifier C, |
|
1978 |
+ // or beginning with the identifier C immediately followed by "-". |
|
1979 |
+ // The matching of C against the element's language value is performed case-insensitively. |
|
1980 |
+ // The identifier C does not have to be a valid language name." |
|
1981 |
+ // http://www.w3.org/TR/selectors/#lang-pseudo |
|
1982 |
+ "lang": markFunction( function( lang ) { |
|
1983 |
+ // lang value must be a valid identifier |
|
1984 |
+ if ( !ridentifier.test(lang || "") ) { |
|
1985 |
+ Sizzle.error( "unsupported lang: " + lang ); |
|
1986 |
+ } |
|
1987 |
+ lang = lang.replace( runescape, funescape ).toLowerCase(); |
|
1988 |
+ return function( elem ) { |
|
1989 |
+ var elemLang; |
|
1990 |
+ do { |
|
1991 |
+ if ( (elemLang = documentIsHTML ? |
|
1992 |
+ elem.lang : |
|
1993 |
+ elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { |
|
1994 |
+ |
|
1995 |
+ elemLang = elemLang.toLowerCase(); |
|
1996 |
+ return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; |
|
1997 |
+ } |
|
1998 |
+ } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); |
|
1999 |
+ return false; |
|
2000 |
+ }; |
|
2001 |
+ }), |
|
2002 |
+ |
|
2003 |
+ // Miscellaneous |
|
2004 |
+ "target": function( elem ) { |
|
2005 |
+ var hash = window.location && window.location.hash; |
|
2006 |
+ return hash && hash.slice( 1 ) === elem.id; |
|
2007 |
+ }, |
|
2008 |
+ |
|
2009 |
+ "root": function( elem ) { |
|
2010 |
+ return elem === docElem; |
|
2011 |
+ }, |
|
2012 |
+ |
|
2013 |
+ "focus": function( elem ) { |
|
2014 |
+ return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); |
|
2015 |
+ }, |
|
2016 |
+ |
|
2017 |
+ // Boolean properties |
|
2018 |
+ "enabled": createDisabledPseudo( false ), |
|
2019 |
+ "disabled": createDisabledPseudo( true ), |
|
2020 |
+ |
|
2021 |
+ "checked": function( elem ) { |
|
2022 |
+ // In CSS3, :checked should return both checked and selected elements |
|
2023 |
+ // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
|
2024 |
+ var nodeName = elem.nodeName.toLowerCase(); |
|
2025 |
+ return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); |
|
2026 |
+ }, |
|
2027 |
+ |
|
2028 |
+ "selected": function( elem ) { |
|
2029 |
+ // Accessing this property makes selected-by-default |
|
2030 |
+ // options in Safari work properly |
|
2031 |
+ if ( elem.parentNode ) { |
|
2032 |
+ elem.parentNode.selectedIndex; |
|
2033 |
+ } |
|
2034 |
+ |
|
2035 |
+ return elem.selected === true; |
|
2036 |
+ }, |
|
2037 |
+ |
|
2038 |
+ // Contents |
|
2039 |
+ "empty": function( elem ) { |
|
2040 |
+ // http://www.w3.org/TR/selectors/#empty-pseudo |
|
2041 |
+ // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), |
|
2042 |
+ // but not by others (comment: 8; processing instruction: 7; etc.) |
|
2043 |
+ // nodeType < 6 works because attributes (2) do not appear as children |
|
2044 |
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
|
2045 |
+ if ( elem.nodeType < 6 ) { |
|
2046 |
+ return false; |
|
2047 |
+ } |
|
2048 |
+ } |
|
2049 |
+ return true; |
|
2050 |
+ }, |
|
2051 |
+ |
|
2052 |
+ "parent": function( elem ) { |
|
2053 |
+ return !Expr.pseudos["empty"]( elem ); |
|
2054 |
+ }, |
|
2055 |
+ |
|
2056 |
+ // Element/input types |
|
2057 |
+ "header": function( elem ) { |
|
2058 |
+ return rheader.test( elem.nodeName ); |
|
2059 |
+ }, |
|
2060 |
+ |
|
2061 |
+ "input": function( elem ) { |
|
2062 |
+ return rinputs.test( elem.nodeName ); |
|
2063 |
+ }, |
|
2064 |
+ |
|
2065 |
+ "button": function( elem ) { |
|
2066 |
+ var name = elem.nodeName.toLowerCase(); |
|
2067 |
+ return name === "input" && elem.type === "button" || name === "button"; |
|
2068 |
+ }, |
|
2069 |
+ |
|
2070 |
+ "text": function( elem ) { |
|
2071 |
+ var attr; |
|
2072 |
+ return elem.nodeName.toLowerCase() === "input" && |
|
2073 |
+ elem.type === "text" && |
|
2074 |
+ |
|
2075 |
+ // Support: IE<8 |
|
2076 |
+ // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" |
|
2077 |
+ ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); |
|
2078 |
+ }, |
|
2079 |
+ |
|
2080 |
+ // Position-in-collection |
|
2081 |
+ "first": createPositionalPseudo(function() { |
|
2082 |
+ return [ 0 ]; |
|
2083 |
+ }), |
|
2084 |
+ |
|
2085 |
+ "last": createPositionalPseudo(function( matchIndexes, length ) { |
|
2086 |
+ return [ length - 1 ]; |
|
2087 |
+ }), |
|
2088 |
+ |
|
2089 |
+ "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { |
|
2090 |
+ return [ argument < 0 ? argument + length : argument ]; |
|
2091 |
+ }), |
|
2092 |
+ |
|
2093 |
+ "even": createPositionalPseudo(function( matchIndexes, length ) { |
|
2094 |
+ var i = 0; |
|
2095 |
+ for ( ; i < length; i += 2 ) { |
|
2096 |
+ matchIndexes.push( i ); |
|
2097 |
+ } |
|
2098 |
+ return matchIndexes; |
|
2099 |
+ }), |
|
2100 |
+ |
|
2101 |
+ "odd": createPositionalPseudo(function( matchIndexes, length ) { |
|
2102 |
+ var i = 1; |
|
2103 |
+ for ( ; i < length; i += 2 ) { |
|
2104 |
+ matchIndexes.push( i ); |
|
2105 |
+ } |
|
2106 |
+ return matchIndexes; |
|
2107 |
+ }), |
|
2108 |
+ |
|
2109 |
+ "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { |
|
2110 |
+ var i = argument < 0 ? argument + length : argument; |
|
2111 |
+ for ( ; --i >= 0; ) { |
|
2112 |
+ matchIndexes.push( i ); |
|
2113 |
+ } |
|
2114 |
+ return matchIndexes; |
|
2115 |
+ }), |
|
2116 |
+ |
|
2117 |
+ "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { |
|
2118 |
+ var i = argument < 0 ? argument + length : argument; |
|
2119 |
+ for ( ; ++i < length; ) { |
|
2120 |
+ matchIndexes.push( i ); |
|
2121 |
+ } |
|
2122 |
+ return matchIndexes; |
|
2123 |
+ }) |
|
2124 |
+ } |
|
2125 |
+}; |
|
2126 |
+ |
|
2127 |
+Expr.pseudos["nth"] = Expr.pseudos["eq"]; |
|
2128 |
+ |
|
2129 |
+// Add button/input type pseudos |
|
2130 |
+for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { |
|
2131 |
+ Expr.pseudos[ i ] = createInputPseudo( i ); |
|
2132 |
+} |
|
2133 |
+for ( i in { submit: true, reset: true } ) { |
|
2134 |
+ Expr.pseudos[ i ] = createButtonPseudo( i ); |
|
2135 |
+} |
|
2136 |
+ |
|
2137 |
+// Easy API for creating new setFilters |
|
2138 |
+function setFilters() {} |
|
2139 |
+setFilters.prototype = Expr.filters = Expr.pseudos; |
|
2140 |
+Expr.setFilters = new setFilters(); |
|
2141 |
+ |
|
2142 |
+tokenize = Sizzle.tokenize = function( selector, parseOnly ) { |
|
2143 |
+ var matched, match, tokens, type, |
|
2144 |
+ soFar, groups, preFilters, |
|
2145 |
+ cached = tokenCache[ selector + " " ]; |
|
2146 |
+ |
|
2147 |
+ if ( cached ) { |
|
2148 |
+ return parseOnly ? 0 : cached.slice( 0 ); |
|
2149 |
+ } |
|
2150 |
+ |
|
2151 |
+ soFar = selector; |
|
2152 |
+ groups = []; |
|
2153 |
+ preFilters = Expr.preFilter; |
|
2154 |
+ |
|
2155 |
+ while ( soFar ) { |
|
2156 |
+ |
|
2157 |
+ // Comma and first run |
|
2158 |
+ if ( !matched || (match = rcomma.exec( soFar )) ) { |
|
2159 |
+ if ( match ) { |
|
2160 |
+ // Don't consume trailing commas as valid |
|
2161 |
+ soFar = soFar.slice( match[0].length ) || soFar; |
|
2162 |
+ } |
|
2163 |
+ groups.push( (tokens = []) ); |
|
2164 |
+ } |
|
2165 |
+ |
|
2166 |
+ matched = false; |
|
2167 |
+ |
|
2168 |
+ // Combinators |
|
2169 |
+ if ( (match = rcombinators.exec( soFar )) ) { |
|
2170 |
+ matched = match.shift(); |
|
2171 |
+ tokens.push({ |
|
2172 |
+ value: matched, |
|
2173 |
+ // Cast descendant combinators to space |
|
2174 |
+ type: match[0].replace( rtrim, " " ) |
|
2175 |
+ }); |
|
2176 |
+ soFar = soFar.slice( matched.length ); |
|
2177 |
+ } |
|
2178 |
+ |
|
2179 |
+ // Filters |
|
2180 |
+ for ( type in Expr.filter ) { |
|
2181 |
+ if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || |
|
2182 |
+ (match = preFilters[ type ]( match ))) ) { |
|
2183 |
+ matched = match.shift(); |
|
2184 |
+ tokens.push({ |
|
2185 |
+ value: matched, |
|
2186 |
+ type: type, |
|
2187 |
+ matches: match |
|
2188 |
+ }); |
|
2189 |
+ soFar = soFar.slice( matched.length ); |
|
2190 |
+ } |
|
2191 |
+ } |
|
2192 |
+ |
|
2193 |
+ if ( !matched ) { |
|
2194 |
+ break; |
|
2195 |
+ } |
|
2196 |
+ } |
|
2197 |
+ |
|
2198 |
+ // Return the length of the invalid excess |
|
2199 |
+ // if we're just parsing |
|
2200 |
+ // Otherwise, throw an error or return tokens |
|
2201 |
+ return parseOnly ? |
|
2202 |
+ soFar.length : |
|
2203 |
+ soFar ? |
|
2204 |
+ Sizzle.error( selector ) : |
|
2205 |
+ // Cache the tokens |
|
2206 |
+ tokenCache( selector, groups ).slice( 0 ); |
|
2207 |
+}; |
|
2208 |
+ |
|
2209 |
+function toSelector( tokens ) { |
|
2210 |
+ var i = 0, |
|
2211 |
+ len = tokens.length, |
|
2212 |
+ selector = ""; |
|
2213 |
+ for ( ; i < len; i++ ) { |
|
2214 |
+ selector += tokens[i].value; |
|
2215 |
+ } |
|
2216 |
+ return selector; |
|
2217 |
+} |
|
2218 |
+ |
|
2219 |
+function addCombinator( matcher, combinator, base ) { |
|
2220 |
+ var dir = combinator.dir, |
|
2221 |
+ skip = combinator.next, |
|
2222 |
+ key = skip || dir, |
|
2223 |
+ checkNonElements = base && key === "parentNode", |
|
2224 |
+ doneName = done++; |
|
2225 |
+ |
|
2226 |
+ return combinator.first ? |
|
2227 |
+ // Check against closest ancestor/preceding element |
|
2228 |
+ function( elem, context, xml ) { |
|
2229 |
+ while ( (elem = elem[ dir ]) ) { |
|
2230 |
+ if ( elem.nodeType === 1 || checkNonElements ) { |
|
2231 |
+ return matcher( elem, context, xml ); |
|
2232 |
+ } |
|
2233 |
+ } |
|
2234 |
+ return false; |
|
2235 |
+ } : |
|
2236 |
+ |
|
2237 |
+ // Check against all ancestor/preceding elements |
|
2238 |
+ function( elem, context, xml ) { |
|
2239 |
+ var oldCache, uniqueCache, outerCache, |
|
2240 |
+ newCache = [ dirruns, doneName ]; |
|
2241 |
+ |
|
2242 |
+ // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching |
|
2243 |
+ if ( xml ) { |
|
2244 |
+ while ( (elem = elem[ dir ]) ) { |
|
2245 |
+ if ( elem.nodeType === 1 || checkNonElements ) { |
|
2246 |
+ if ( matcher( elem, context, xml ) ) { |
|
2247 |
+ return true; |
|
2248 |
+ } |
|
2249 |
+ } |
|
2250 |
+ } |
|
2251 |
+ } else { |
|
2252 |
+ while ( (elem = elem[ dir ]) ) { |
|
2253 |
+ if ( elem.nodeType === 1 || checkNonElements ) { |
|
2254 |
+ outerCache = elem[ expando ] || (elem[ expando ] = {}); |
|
2255 |
+ |
|
2256 |
+ // Support: IE <9 only |
|
2257 |
+ // Defend against cloned attroperties (jQuery gh-1709) |
|
2258 |
+ uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); |
|
2259 |
+ |
|
2260 |
+ if ( skip && skip === elem.nodeName.toLowerCase() ) { |
|
2261 |
+ elem = elem[ dir ] || elem; |
|
2262 |
+ } else if ( (oldCache = uniqueCache[ key ]) && |
|
2263 |
+ oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { |
|
2264 |
+ |
|
2265 |
+ // Assign to newCache so results back-propagate to previous elements |
|
2266 |
+ return (newCache[ 2 ] = oldCache[ 2 ]); |
|
2267 |
+ } else { |
|
2268 |
+ // Reuse newcache so results back-propagate to previous elements |
|
2269 |
+ uniqueCache[ key ] = newCache; |
|
2270 |
+ |
|
2271 |
+ // A match means we're done; a fail means we have to keep checking |
|
2272 |
+ if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { |
|
2273 |
+ return true; |
|
2274 |
+ } |
|
2275 |
+ } |
|
2276 |
+ } |
|
2277 |
+ } |
|
2278 |
+ } |
|
2279 |
+ return false; |
|
2280 |
+ }; |
|
2281 |
+} |
|
2282 |
+ |
|
2283 |
+function elementMatcher( matchers ) { |
|
2284 |
+ return matchers.length > 1 ? |
|
2285 |
+ function( elem, context, xml ) { |
|
2286 |
+ var i = matchers.length; |
|
2287 |
+ while ( i-- ) { |
|
2288 |
+ if ( !matchers[i]( elem, context, xml ) ) { |
|
2289 |
+ return false; |
|
2290 |
+ } |
|
2291 |
+ } |
|
2292 |
+ return true; |
|
2293 |
+ } : |
|
2294 |
+ matchers[0]; |
|
2295 |
+} |
|
2296 |
+ |
|
2297 |
+function multipleContexts( selector, contexts, results ) { |
|
2298 |
+ var i = 0, |
|
2299 |
+ len = contexts.length; |
|
2300 |
+ for ( ; i < len; i++ ) { |
|
2301 |
+ Sizzle( selector, contexts[i], results ); |
|
2302 |
+ } |
|
2303 |
+ return results; |
|
2304 |
+} |
|
2305 |
+ |
|
2306 |
+function condense( unmatched, map, filter, context, xml ) { |
|
2307 |
+ var elem, |
|
2308 |
+ newUnmatched = [], |
|
2309 |
+ i = 0, |
|
2310 |
+ len = unmatched.length, |
|
2311 |
+ mapped = map != null; |
|
2312 |
+ |
|
2313 |
+ for ( ; i < len; i++ ) { |
|
2314 |
+ if ( (elem = unmatched[i]) ) { |
|
2315 |
+ if ( !filter || filter( elem, context, xml ) ) { |
|
2316 |
+ newUnmatched.push( elem ); |
|
2317 |
+ if ( mapped ) { |
|
2318 |
+ map.push( i ); |
|
2319 |
+ } |
|
2320 |
+ } |
|
2321 |
+ } |
|
2322 |
+ } |
|
2323 |
+ |
|
2324 |
+ return newUnmatched; |
|
2325 |
+} |
|
2326 |
+ |
|
2327 |
+function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { |
|
2328 |
+ if ( postFilter && !postFilter[ expando ] ) { |
|
2329 |
+ postFilter = setMatcher( postFilter ); |
|
2330 |
+ } |
|
2331 |
+ if ( postFinder && !postFinder[ expando ] ) { |
|
2332 |
+ postFinder = setMatcher( postFinder, postSelector ); |
|
2333 |
+ } |
|
2334 |
+ return markFunction(function( seed, results, context, xml ) { |
|
2335 |
+ var temp, i, elem, |
|
2336 |
+ preMap = [], |
|
2337 |
+ postMap = [], |
|
2338 |
+ preexisting = results.length, |
|
2339 |
+ |
|
2340 |
+ // Get initial elements from seed or context |
|
2341 |
+ elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), |
|
2342 |
+ |
|
2343 |
+ // Prefilter to get matcher input, preserving a map for seed-results synchronization |
|
2344 |
+ matcherIn = preFilter && ( seed || !selector ) ? |
|
2345 |
+ condense( elems, preMap, preFilter, context, xml ) : |
|
2346 |
+ elems, |
|
2347 |
+ |
|
2348 |
+ matcherOut = matcher ? |
|
2349 |
+ // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, |
|
2350 |
+ postFinder || ( seed ? preFilter : preexisting || postFilter ) ? |
|
2351 |
+ |
|
2352 |
+ // ...intermediate processing is necessary |
|
2353 |
+ [] : |
|
2354 |
+ |
|
2355 |
+ // ...otherwise use results directly |
|
2356 |
+ results : |
|
2357 |
+ matcherIn; |
|
2358 |
+ |
|
2359 |
+ // Find primary matches |
|
2360 |
+ if ( matcher ) { |
|
2361 |
+ matcher( matcherIn, matcherOut, context, xml ); |
|
2362 |
+ } |
|
2363 |
+ |
|
2364 |
+ // Apply postFilter |
|
2365 |
+ if ( postFilter ) { |
|
2366 |
+ temp = condense( matcherOut, postMap ); |
|
2367 |
+ postFilter( temp, [], context, xml ); |
|
2368 |
+ |
|
2369 |
+ // Un-match failing elements by moving them back to matcherIn |
|
2370 |
+ i = temp.length; |
|
2371 |
+ while ( i-- ) { |
|
2372 |
+ if ( (elem = temp[i]) ) { |
|
2373 |
+ matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); |
|
2374 |
+ } |
|
2375 |
+ } |
|
2376 |
+ } |
|
2377 |
+ |
|
2378 |
+ if ( seed ) { |
|
2379 |
+ if ( postFinder || preFilter ) { |
|
2380 |
+ if ( postFinder ) { |
|
2381 |
+ // Get the final matcherOut by condensing this intermediate into postFinder contexts |
|
2382 |
+ temp = []; |
|
2383 |
+ i = matcherOut.length; |
|
2384 |
+ while ( i-- ) { |
|
2385 |
+ if ( (elem = matcherOut[i]) ) { |
|
2386 |
+ // Restore matcherIn since elem is not yet a final match |
|
2387 |
+ temp.push( (matcherIn[i] = elem) ); |
|
2388 |
+ } |
|
2389 |
+ } |
|
2390 |
+ postFinder( null, (matcherOut = []), temp, xml ); |
|
2391 |
+ } |
|
2392 |
+ |
|
2393 |
+ // Move matched elements from seed to results to keep them synchronized |
|
2394 |
+ i = matcherOut.length; |
|
2395 |
+ while ( i-- ) { |
|
2396 |
+ if ( (elem = matcherOut[i]) && |
|
2397 |
+ (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { |
|
2398 |
+ |
|
2399 |
+ seed[temp] = !(results[temp] = elem); |
|
2400 |
+ } |
|
2401 |
+ } |
|
2402 |
+ } |
|
2403 |
+ |
|
2404 |
+ // Add elements to results, through postFinder if defined |
|
2405 |
+ } else { |
|
2406 |
+ matcherOut = condense( |
|
2407 |
+ matcherOut === results ? |
|
2408 |
+ matcherOut.splice( preexisting, matcherOut.length ) : |
|
2409 |
+ matcherOut |
|
2410 |
+ ); |
|
2411 |
+ if ( postFinder ) { |
|
2412 |
+ postFinder( null, results, matcherOut, xml ); |
|
2413 |
+ } else { |
|
2414 |
+ push.apply( results, matcherOut ); |
|
2415 |
+ } |
|
2416 |
+ } |
|
2417 |
+ }); |
|
2418 |
+} |
|
2419 |
+ |
|
2420 |
+function matcherFromTokens( tokens ) { |
|
2421 |
+ var checkContext, matcher, j, |
|
2422 |
+ len = tokens.length, |
|
2423 |
+ leadingRelative = Expr.relative[ tokens[0].type ], |
|
2424 |
+ implicitRelative = leadingRelative || Expr.relative[" "], |
|
2425 |
+ i = leadingRelative ? 1 : 0, |
|
2426 |
+ |
|
2427 |
+ // The foundational matcher ensures that elements are reachable from top-level context(s) |
|
2428 |
+ matchContext = addCombinator( function( elem ) { |
|
2429 |
+ return elem === checkContext; |
|
2430 |
+ }, implicitRelative, true ), |
|
2431 |
+ matchAnyContext = addCombinator( function( elem ) { |
|
2432 |
+ return indexOf( checkContext, elem ) > -1; |
|
2433 |
+ }, implicitRelative, true ), |
|
2434 |
+ matchers = [ function( elem, context, xml ) { |
|
2435 |
+ var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( |
|
2436 |
+ (checkContext = context).nodeType ? |
|
2437 |
+ matchContext( elem, context, xml ) : |
|
2438 |
+ matchAnyContext( elem, context, xml ) ); |
|
2439 |
+ // Avoid hanging onto element (issue #299) |
|
2440 |
+ checkContext = null; |
|
2441 |
+ return ret; |
|
2442 |
+ } ]; |
|
2443 |
+ |
|
2444 |
+ for ( ; i < len; i++ ) { |
|
2445 |
+ if ( (matcher = Expr.relative[ tokens[i].type ]) ) { |
|
2446 |
+ matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; |
|
2447 |
+ } else { |
|
2448 |
+ matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); |
|
2449 |
+ |
|
2450 |
+ // Return special upon seeing a positional matcher |
|
2451 |
+ if ( matcher[ expando ] ) { |
|
2452 |
+ // Find the next relative operator (if any) for proper handling |
|
2453 |
+ j = ++i; |
|
2454 |
+ for ( ; j < len; j++ ) { |
|
2455 |
+ if ( Expr.relative[ tokens[j].type ] ) { |
|
2456 |
+ break; |
|
2457 |
+ } |
|
2458 |
+ } |
|
2459 |
+ return setMatcher( |
|
2460 |
+ i > 1 && elementMatcher( matchers ), |
|
2461 |
+ i > 1 && toSelector( |
|
2462 |
+ // If the preceding token was a descendant combinator, insert an implicit any-element `*` |
|
2463 |
+ tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) |
|
2464 |
+ ).replace( rtrim, "$1" ), |
|
2465 |
+ matcher, |
|
2466 |
+ i < j && matcherFromTokens( tokens.slice( i, j ) ), |
|
2467 |
+ j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), |
|
2468 |
+ j < len && toSelector( tokens ) |
|
2469 |
+ ); |
|
2470 |
+ } |
|
2471 |
+ matchers.push( matcher ); |
|
2472 |
+ } |
|
2473 |
+ } |
|
2474 |
+ |
|
2475 |
+ return elementMatcher( matchers ); |
|
2476 |
+} |
|
2477 |
+ |
|
2478 |
+function matcherFromGroupMatchers( elementMatchers, setMatchers ) { |
|
2479 |
+ var bySet = setMatchers.length > 0, |
|
2480 |
+ byElement = elementMatchers.length > 0, |
|
2481 |
+ superMatcher = function( seed, context, xml, results, outermost ) { |
|
2482 |
+ var elem, j, matcher, |
|
2483 |
+ matchedCount = 0, |
|
2484 |
+ i = "0", |
|
2485 |
+ unmatched = seed && [], |
|
2486 |
+ setMatched = [], |
|
2487 |
+ contextBackup = outermostContext, |
|
2488 |
+ // We must always have either seed elements or outermost context |
|
2489 |
+ elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), |
|
2490 |
+ // Use integer dirruns iff this is the outermost matcher |
|
2491 |
+ dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), |
|
2492 |
+ len = elems.length; |
|
2493 |
+ |
|
2494 |
+ if ( outermost ) { |
|
2495 |
+ outermostContext = context === document || context || outermost; |
|
2496 |
+ } |
|
2497 |
+ |
|
2498 |
+ // Add elements passing elementMatchers directly to results |
|
2499 |
+ // Support: IE<9, Safari |
|
2500 |
+ // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id |
|
2501 |
+ for ( ; i !== len && (elem = elems[i]) != null; i++ ) { |
|
2502 |
+ if ( byElement && elem ) { |
|
2503 |
+ j = 0; |
|
2504 |
+ if ( !context && elem.ownerDocument !== document ) { |
|
2505 |
+ setDocument( elem ); |
|
2506 |
+ xml = !documentIsHTML; |
|
2507 |
+ } |
|
2508 |
+ while ( (matcher = elementMatchers[j++]) ) { |
|
2509 |
+ if ( matcher( elem, context || document, xml) ) { |
|
2510 |
+ results.push( elem ); |
|
2511 |
+ break; |
|
2512 |
+ } |
|
2513 |
+ } |
|
2514 |
+ if ( outermost ) { |
|
2515 |
+ dirruns = dirrunsUnique; |
|
2516 |
+ } |
|
2517 |
+ } |
|
2518 |
+ |
|
2519 |
+ // Track unmatched elements for set filters |
|
2520 |
+ if ( bySet ) { |
|
2521 |
+ // They will have gone through all possible matchers |
|
2522 |
+ if ( (elem = !matcher && elem) ) { |
|
2523 |
+ matchedCount--; |
|
2524 |
+ } |
|
2525 |
+ |
|
2526 |
+ // Lengthen the array for every element, matched or not |
|
2527 |
+ if ( seed ) { |
|
2528 |
+ unmatched.push( elem ); |
|
2529 |
+ } |
|
2530 |
+ } |
|
2531 |
+ } |
|
2532 |
+ |
|
2533 |
+ // `i` is now the count of elements visited above, and adding it to `matchedCount` |
|
2534 |
+ // makes the latter nonnegative. |
|
2535 |
+ matchedCount += i; |
|
2536 |
+ |
|
2537 |
+ // Apply set filters to unmatched elements |
|
2538 |
+ // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` |
|
2539 |
+ // equals `i`), unless we didn't visit _any_ elements in the above loop because we have |
|
2540 |
+ // no element matchers and no seed. |
|
2541 |
+ // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that |
|
2542 |
+ // case, which will result in a "00" `matchedCount` that differs from `i` but is also |
|
2543 |
+ // numerically zero. |
|
2544 |
+ if ( bySet && i !== matchedCount ) { |
|
2545 |
+ j = 0; |
|
2546 |
+ while ( (matcher = setMatchers[j++]) ) { |
|
2547 |
+ matcher( unmatched, setMatched, context, xml ); |
|
2548 |
+ } |
|
2549 |
+ |
|
2550 |
+ if ( seed ) { |
|
2551 |
+ // Reintegrate element matches to eliminate the need for sorting |
|
2552 |
+ if ( matchedCount > 0 ) { |
|
2553 |
+ while ( i-- ) { |
|
2554 |
+ if ( !(unmatched[i] || setMatched[i]) ) { |
|
2555 |
+ setMatched[i] = pop.call( results ); |
|
2556 |
+ } |
|
2557 |
+ } |
|
2558 |
+ } |
|
2559 |
+ |
|
2560 |
+ // Discard index placeholder values to get only actual matches |
|
2561 |
+ setMatched = condense( setMatched ); |
|
2562 |
+ } |
|
2563 |
+ |
|
2564 |
+ // Add matches to results |
|
2565 |
+ push.apply( results, setMatched ); |
|
2566 |
+ |
|
2567 |
+ // Seedless set matches succeeding multiple successful matchers stipulate sorting |
|
2568 |
+ if ( outermost && !seed && setMatched.length > 0 && |
|
2569 |
+ ( matchedCount + setMatchers.length ) > 1 ) { |
|
2570 |
+ |
|
2571 |
+ Sizzle.uniqueSort( results ); |
|
2572 |
+ } |
|
2573 |
+ } |
|
2574 |
+ |
|
2575 |
+ // Override manipulation of globals by nested matchers |
|
2576 |
+ if ( outermost ) { |
|
2577 |
+ dirruns = dirrunsUnique; |
|
2578 |
+ outermostContext = contextBackup; |
|
2579 |
+ } |
|
2580 |
+ |
|
2581 |
+ return unmatched; |
|
2582 |
+ }; |
|
2583 |
+ |
|
2584 |
+ return bySet ? |
|
2585 |
+ markFunction( superMatcher ) : |
|
2586 |
+ superMatcher; |
|
2587 |
+} |
|
2588 |
+ |
|
2589 |
+compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { |
|
2590 |
+ var i, |
|
2591 |
+ setMatchers = [], |
|
2592 |
+ elementMatchers = [], |
|
2593 |
+ cached = compilerCache[ selector + " " ]; |
|
2594 |
+ |
|
2595 |
+ if ( !cached ) { |
|
2596 |
+ // Generate a function of recursive functions that can be used to check each element |
|
2597 |
+ if ( !match ) { |
|
2598 |
+ match = tokenize( selector ); |
|
2599 |
+ } |
|
2600 |
+ i = match.length; |
|
2601 |
+ while ( i-- ) { |
|
2602 |
+ cached = matcherFromTokens( match[i] ); |
|
2603 |
+ if ( cached[ expando ] ) { |
|
2604 |
+ setMatchers.push( cached ); |
|
2605 |
+ } else { |
|
2606 |
+ elementMatchers.push( cached ); |
|
2607 |
+ } |
|
2608 |
+ } |
|
2609 |
+ |
|
2610 |
+ // Cache the compiled function |
|
2611 |
+ cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); |
|
2612 |
+ |
|
2613 |
+ // Save selector and tokenization |
|
2614 |
+ cached.selector = selector; |
|
2615 |
+ } |
|
2616 |
+ return cached; |
|
2617 |
+}; |
|
2618 |
+ |
|
2619 |
+/** |
|
2620 |
+ * A low-level selection function that works with Sizzle's compiled |
|
2621 |
+ * selector functions |
|
2622 |
+ * @param {String|Function} selector A selector or a pre-compiled |
|
2623 |
+ * selector function built with Sizzle.compile |
|
2624 |
+ * @param {Element} context |
|
2625 |
+ * @param {Array} [results] |
|
2626 |
+ * @param {Array} [seed] A set of elements to match against |
|
2627 |
+ */ |
|
2628 |
+select = Sizzle.select = function( selector, context, results, seed ) { |
|
2629 |
+ var i, tokens, token, type, find, |
|
2630 |
+ compiled = typeof selector === "function" && selector, |
|
2631 |
+ match = !seed && tokenize( (selector = compiled.selector || selector) ); |
|
2632 |
+ |
|
2633 |
+ results = results || []; |
|
2634 |
+ |
|
2635 |
+ // Try to minimize operations if there is only one selector in the list and no seed |
|
2636 |
+ // (the latter of which guarantees us context) |
|
2637 |
+ if ( match.length === 1 ) { |
|
2638 |
+ |
|
2639 |
+ // Reduce context if the leading compound selector is an ID |
|
2640 |
+ tokens = match[0] = match[0].slice( 0 ); |
|
2641 |
+ if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && |
|
2642 |
+ context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { |
|
2643 |
+ |
|
2644 |
+ context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; |
|
2645 |
+ if ( !context ) { |
|
2646 |
+ return results; |
|
2647 |
+ |
|
2648 |
+ // Precompiled matchers will still verify ancestry, so step up a level |
|
2649 |
+ } else if ( compiled ) { |
|
2650 |
+ context = context.parentNode; |
|
2651 |
+ } |
|
2652 |
+ |
|
2653 |
+ selector = selector.slice( tokens.shift().value.length ); |
|
2654 |
+ } |
|
2655 |
+ |
|
2656 |
+ // Fetch a seed set for right-to-left matching |
|
2657 |
+ i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; |
|
2658 |
+ while ( i-- ) { |
|
2659 |
+ token = tokens[i]; |
|
2660 |
+ |
|
2661 |
+ // Abort if we hit a combinator |
|
2662 |
+ if ( Expr.relative[ (type = token.type) ] ) { |
|
2663 |
+ break; |
|
2664 |
+ } |
|
2665 |
+ if ( (find = Expr.find[ type ]) ) { |
|
2666 |
+ // Search, expanding context for leading sibling combinators |
|
2667 |
+ if ( (seed = find( |
|
2668 |
+ token.matches[0].replace( runescape, funescape ), |
|
2669 |
+ rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context |
|
2670 |
+ )) ) { |
|
2671 |
+ |
|
2672 |
+ // If seed is empty or no tokens remain, we can return early |
|
2673 |
+ tokens.splice( i, 1 ); |
|
2674 |
+ selector = seed.length && toSelector( tokens ); |
|
2675 |
+ if ( !selector ) { |
|
2676 |
+ push.apply( results, seed ); |
|
2677 |
+ return results; |
|
2678 |
+ } |
|
2679 |
+ |
|
2680 |
+ break; |
|
2681 |
+ } |
|
2682 |
+ } |
|
2683 |
+ } |
|
2684 |
+ } |
|
2685 |
+ |
|
2686 |
+ // Compile and execute a filtering function if one is not provided |
|
2687 |
+ // Provide `match` to avoid retokenization if we modified the selector above |
|
2688 |
+ ( compiled || compile( selector, match ) )( |
|
2689 |
+ seed, |
|
2690 |
+ context, |
|
2691 |
+ !documentIsHTML, |
|
2692 |
+ results, |
|
2693 |
+ !context || rsibling.test( selector ) && testContext( context.parentNode ) || context |
|
2694 |
+ ); |
|
2695 |
+ return results; |
|
2696 |
+}; |
|
2697 |
+ |
|
2698 |
+// One-time assignments |
|
2699 |
+ |
|
2700 |
+// Sort stability |
|
2701 |
+support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; |
|
2702 |
+ |
|
2703 |
+// Support: Chrome 14-35+ |
|
2704 |
+// Always assume duplicates if they aren't passed to the comparison function |
|
2705 |
+support.detectDuplicates = !!hasDuplicate; |
|
2706 |
+ |
|
2707 |
+// Initialize against the default document |
|
2708 |
+setDocument(); |
|
2709 |
+ |
|
2710 |
+// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) |
|
2711 |
+// Detached nodes confoundingly follow *each other* |
|
2712 |
+support.sortDetached = assert(function( el ) { |
|
2713 |
+ // Should return 1, but returns 4 (following) |
|
2714 |
+ return el.compareDocumentPosition( document.createElement("fieldset") ) & 1; |
|
2715 |
+}); |
|
2716 |
+ |
|
2717 |
+// Support: IE<8 |
|
2718 |
+// Prevent attribute/property "interpolation" |
|
2719 |
+// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx |
|
2720 |
+if ( !assert(function( el ) { |
|
2721 |
+ el.innerHTML = "<a href='#'></a>"; |
|
2722 |
+ return el.firstChild.getAttribute("href") === "#" ; |
|
2723 |
+}) ) { |
|
2724 |
+ addHandle( "type|href|height|width", function( elem, name, isXML ) { |
|
2725 |
+ if ( !isXML ) { |
|
2726 |
+ return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); |
|
2727 |
+ } |
|
2728 |
+ }); |
|
2729 |
+} |
|
2730 |
+ |
|
2731 |
+// Support: IE<9 |
|
2732 |
+// Use defaultValue in place of getAttribute("value") |
|
2733 |
+if ( !support.attributes || !assert(function( el ) { |
|
2734 |
+ el.innerHTML = "<input/>"; |
|
2735 |
+ el.firstChild.setAttribute( "value", "" ); |
|
2736 |
+ return el.firstChild.getAttribute( "value" ) === ""; |
|
2737 |
+}) ) { |
|
2738 |
+ addHandle( "value", function( elem, name, isXML ) { |
|
2739 |
+ if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { |
|
2740 |
+ return elem.defaultValue; |
|
2741 |
+ } |
|
2742 |
+ }); |
|
2743 |
+} |
|
2744 |
+ |
|
2745 |
+// Support: IE<9 |
|
2746 |
+// Use getAttributeNode to fetch booleans when getAttribute lies |
|
2747 |
+if ( !assert(function( el ) { |
|
2748 |
+ return el.getAttribute("disabled") == null; |
|
2749 |
+}) ) { |
|
2750 |
+ addHandle( booleans, function( elem, name, isXML ) { |
|
2751 |
+ var val; |
|
2752 |
+ if ( !isXML ) { |
|
2753 |
+ return elem[ name ] === true ? name.toLowerCase() : |
|
2754 |
+ (val = elem.getAttributeNode( name )) && val.specified ? |
|
2755 |
+ val.value : |
|
2756 |
+ null; |
|
2757 |
+ } |
|
2758 |
+ }); |
|
2759 |
+} |
|
2760 |
+ |
|
2761 |
+return Sizzle; |
|
2762 |
+ |
|
2763 |
+})( window ); |
|
2764 |
+ |
|
2765 |
+ |
|
2766 |
+ |
|
2767 |
+jQuery.find = Sizzle; |
|
2768 |
+jQuery.expr = Sizzle.selectors; |
|
2769 |
+ |
|
2770 |
+// Deprecated |
|
2771 |
+jQuery.expr[ ":" ] = jQuery.expr.pseudos; |
|
2772 |
+jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; |
|
2773 |
+jQuery.text = Sizzle.getText; |
|
2774 |
+jQuery.isXMLDoc = Sizzle.isXML; |
|
2775 |
+jQuery.contains = Sizzle.contains; |
|
2776 |
+jQuery.escapeSelector = Sizzle.escape; |
|
2777 |
+ |
|
2778 |
+ |
|
2779 |
+ |
|
2780 |
+ |
|
2781 |
+var dir = function( elem, dir, until ) { |
|
2782 |
+ var matched = [], |
|
2783 |
+ truncate = until !== undefined; |
|
2784 |
+ |
|
2785 |
+ while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { |
|
2786 |
+ if ( elem.nodeType === 1 ) { |
|
2787 |
+ if ( truncate && jQuery( elem ).is( until ) ) { |
|
2788 |
+ break; |
|
2789 |
+ } |
|
2790 |
+ matched.push( elem ); |
|
2791 |
+ } |
|
2792 |
+ } |
|
2793 |
+ return matched; |
|
2794 |
+}; |
|
2795 |
+ |
|
2796 |
+ |
|
2797 |
+var siblings = function( n, elem ) { |
|
2798 |
+ var matched = []; |
|
2799 |
+ |
|
2800 |
+ for ( ; n; n = n.nextSibling ) { |
|
2801 |
+ if ( n.nodeType === 1 && n !== elem ) { |
|
2802 |
+ matched.push( n ); |
|
2803 |
+ } |
|
2804 |
+ } |
|
2805 |
+ |
|
2806 |
+ return matched; |
|
2807 |
+}; |
|
2808 |
+ |
|
2809 |
+ |
|
2810 |
+var rneedsContext = jQuery.expr.match.needsContext; |
|
2811 |
+ |
|
2812 |
+ |
|
2813 |
+ |
|
2814 |
+function nodeName( elem, name ) { |
|
2815 |
+ |
|
2816 |
+ return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); |
|
2817 |
+ |
|
2818 |
+}; |
|
2819 |
+var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); |
|
2820 |
+ |
|
2821 |
+ |
|
2822 |
+ |
|
2823 |
+// Implement the identical functionality for filter and not |
|
2824 |
+function winnow( elements, qualifier, not ) { |
|
2825 |
+ if ( isFunction( qualifier ) ) { |
|
2826 |
+ return jQuery.grep( elements, function( elem, i ) { |
|
2827 |
+ return !!qualifier.call( elem, i, elem ) !== not; |
|
2828 |
+ } ); |
|
2829 |
+ } |
|
2830 |
+ |
|
2831 |
+ // Single element |
|
2832 |
+ if ( qualifier.nodeType ) { |
|
2833 |
+ return jQuery.grep( elements, function( elem ) { |
|
2834 |
+ return ( elem === qualifier ) !== not; |
|
2835 |
+ } ); |
|
2836 |
+ } |
|
2837 |
+ |
|
2838 |
+ // Arraylike of elements (jQuery, arguments, Array) |
|
2839 |
+ if ( typeof qualifier !== "string" ) { |
|
2840 |
+ return jQuery.grep( elements, function( elem ) { |
|
2841 |
+ return ( indexOf.call( qualifier, elem ) > -1 ) !== not; |
|
2842 |
+ } ); |
|
2843 |
+ } |
|
2844 |
+ |
|
2845 |
+ // Filtered directly for both simple and complex selectors |
|
2846 |
+ return jQuery.filter( qualifier, elements, not ); |
|
2847 |
+} |
|
2848 |
+ |
|
2849 |
+jQuery.filter = function( expr, elems, not ) { |
|
2850 |
+ var elem = elems[ 0 ]; |
|
2851 |
+ |
|
2852 |
+ if ( not ) { |
|
2853 |
+ expr = ":not(" + expr + ")"; |
|
2854 |
+ } |
|
2855 |
+ |
|
2856 |
+ if ( elems.length === 1 && elem.nodeType === 1 ) { |
|
2857 |
+ return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; |
|
2858 |
+ } |
|
2859 |
+ |
|
2860 |
+ return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { |
|
2861 |
+ return elem.nodeType === 1; |
|
2862 |
+ } ) ); |
|
2863 |
+}; |
|
2864 |
+ |
|
2865 |
+jQuery.fn.extend( { |
|
2866 |
+ find: function( selector ) { |
|
2867 |
+ var i, ret, |
|
2868 |
+ len = this.length, |
|
2869 |
+ self = this; |
|
2870 |
+ |
|
2871 |
+ if ( typeof selector !== "string" ) { |
|
2872 |
+ return this.pushStack( jQuery( selector ).filter( function() { |
|
2873 |
+ for ( i = 0; i < len; i++ ) { |
|
2874 |
+ if ( jQuery.contains( self[ i ], this ) ) { |
|
2875 |
+ return true; |
|
2876 |
+ } |
|
2877 |
+ } |
|
2878 |
+ } ) ); |
|
2879 |
+ } |
|
2880 |
+ |
|
2881 |
+ ret = this.pushStack( [] ); |
|
2882 |
+ |
|
2883 |
+ for ( i = 0; i < len; i++ ) { |
|
2884 |
+ jQuery.find( selector, self[ i ], ret ); |
|
2885 |
+ } |
|
2886 |
+ |
|
2887 |
+ return len > 1 ? jQuery.uniqueSort( ret ) : ret; |
|
2888 |
+ }, |
|
2889 |
+ filter: function( selector ) { |
|
2890 |
+ return this.pushStack( winnow( this, selector || [], false ) ); |
|
2891 |
+ }, |
|
2892 |
+ not: function( selector ) { |
|
2893 |
+ return this.pushStack( winnow( this, selector || [], true ) ); |
|
2894 |
+ }, |
|
2895 |
+ is: function( selector ) { |
|
2896 |
+ return !!winnow( |
|
2897 |
+ this, |
|
2898 |
+ |
|
2899 |
+ // If this is a positional/relative selector, check membership in the returned set |
|
2900 |
+ // so $("p:first").is("p:last") won't return true for a doc with two "p". |
|
2901 |
+ typeof selector === "string" && rneedsContext.test( selector ) ? |
|
2902 |
+ jQuery( selector ) : |
|
2903 |
+ selector || [], |
|
2904 |
+ false |
|
2905 |
+ ).length; |
|
2906 |
+ } |
|
2907 |
+} ); |
|
2908 |
+ |
|
2909 |
+ |
|
2910 |
+// Initialize a jQuery object |
|
2911 |
+ |
|
2912 |
+ |
|
2913 |
+// A central reference to the root jQuery(document) |
|
2914 |
+var rootjQuery, |
|
2915 |
+ |
|
2916 |
+ // A simple way to check for HTML strings |
|
2917 |
+ // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) |
|
2918 |
+ // Strict HTML recognition (#11290: must start with <) |
|
2919 |
+ // Shortcut simple #id case for speed |
|
2920 |
+ rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, |
|
2921 |
+ |
|
2922 |
+ init = jQuery.fn.init = function( selector, context, root ) { |
|
2923 |
+ var match, elem; |
|
2924 |
+ |
|
2925 |
+ // HANDLE: $(""), $(null), $(undefined), $(false) |
|
2926 |
+ if ( !selector ) { |
|
2927 |
+ return this; |
|
2928 |
+ } |
|
2929 |
+ |
|
2930 |
+ // Method init() accepts an alternate rootjQuery |
|
2931 |
+ // so migrate can support jQuery.sub (gh-2101) |
|
2932 |
+ root = root || rootjQuery; |
|
2933 |
+ |
|
2934 |
+ // Handle HTML strings |
|
2935 |
+ if ( typeof selector === "string" ) { |
|
2936 |
+ if ( selector[ 0 ] === "<" && |
|
2937 |
+ selector[ selector.length - 1 ] === ">" && |
|
2938 |
+ selector.length >= 3 ) { |
|
2939 |
+ |
|
2940 |
+ // Assume that strings that start and end with <> are HTML and skip the regex check |
|
2941 |
+ match = [ null, selector, null ]; |
|
2942 |
+ |
|
2943 |
+ } else { |
|
2944 |
+ match = rquickExpr.exec( selector ); |
|
2945 |
+ } |
|
2946 |
+ |
|
2947 |
+ // Match html or make sure no context is specified for #id |
|
2948 |
+ if ( match && ( match[ 1 ] || !context ) ) { |
|
2949 |
+ |
|
2950 |
+ // HANDLE: $(html) -> $(array) |
|
2951 |
+ if ( match[ 1 ] ) { |
|
2952 |
+ context = context instanceof jQuery ? context[ 0 ] : context; |
|
2953 |
+ |
|
2954 |
+ // Option to run scripts is true for back-compat |
|
2955 |
+ // Intentionally let the error be thrown if parseHTML is not present |
|
2956 |
+ jQuery.merge( this, jQuery.parseHTML( |
|
2957 |
+ match[ 1 ], |
|
2958 |
+ context && context.nodeType ? context.ownerDocument || context : document, |
|
2959 |
+ true |
|
2960 |
+ ) ); |
|
2961 |
+ |
|
2962 |
+ // HANDLE: $(html, props) |
|
2963 |
+ if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { |
|
2964 |
+ for ( match in context ) { |
|
2965 |
+ |
|
2966 |
+ // Properties of context are called as methods if possible |
|
2967 |
+ if ( isFunction( this[ match ] ) ) { |
|
2968 |
+ this[ match ]( context[ match ] ); |
|
2969 |
+ |
|
2970 |
+ // ...and otherwise set as attributes |
|
2971 |
+ } else { |
|
2972 |
+ this.attr( match, context[ match ] ); |
|
2973 |
+ } |
|
2974 |
+ } |
|
2975 |
+ } |
|
2976 |
+ |
|
2977 |
+ return this; |
|
2978 |
+ |
|
2979 |
+ // HANDLE: $(#id) |
|
2980 |
+ } else { |
|
2981 |
+ elem = document.getElementById( match[ 2 ] ); |
|
2982 |
+ |
|
2983 |
+ if ( elem ) { |
|
2984 |
+ |
|
2985 |
+ // Inject the element directly into the jQuery object |
|
2986 |
+ this[ 0 ] = elem; |
|
2987 |
+ this.length = 1; |
|
2988 |
+ } |
|
2989 |
+ return this; |
|
2990 |
+ } |
|
2991 |
+ |
|
2992 |
+ // HANDLE: $(expr, $(...)) |
|
2993 |
+ } else if ( !context || context.jquery ) { |
|
2994 |
+ return ( context || root ).find( selector ); |
|
2995 |
+ |
|
2996 |
+ // HANDLE: $(expr, context) |
|
2997 |
+ // (which is just equivalent to: $(context).find(expr) |
|
2998 |
+ } else { |
|
2999 |
+ return this.constructor( context ).find( selector ); |
|
3000 |
+ } |
|
3001 |
+ |
|
3002 |
+ // HANDLE: $(DOMElement) |
|
3003 |
+ } else if ( selector.nodeType ) { |
|
3004 |
+ this[ 0 ] = selector; |
|
3005 |
+ this.length = 1; |
|
3006 |
+ return this; |
|
3007 |
+ |
|
3008 |
+ // HANDLE: $(function) |
|
3009 |
+ // Shortcut for document ready |
|
3010 |
+ } else if ( isFunction( selector ) ) { |
|
3011 |
+ return root.ready !== undefined ? |
|
3012 |
+ root.ready( selector ) : |
|
3013 |
+ |
|
3014 |
+ // Execute immediately if ready is not present |
|
3015 |
+ selector( jQuery ); |
|
3016 |
+ } |
|
3017 |
+ |
|
3018 |
+ return jQuery.makeArray( selector, this ); |
|
3019 |
+ }; |
|
3020 |
+ |
|
3021 |
+// Give the init function the jQuery prototype for later instantiation |
|
3022 |
+init.prototype = jQuery.fn; |
|
3023 |
+ |
|
3024 |
+// Initialize central reference |
|
3025 |
+rootjQuery = jQuery( document ); |
|
3026 |
+ |
|
3027 |
+ |
|
3028 |
+var rparentsprev = /^(?:parents|prev(?:Until|All))/, |
|
3029 |
+ |
|
3030 |
+ // Methods guaranteed to produce a unique set when starting from a unique set |
|
3031 |
+ guaranteedUnique = { |
|
3032 |
+ children: true, |
|
3033 |
+ contents: true, |
|
3034 |
+ next: true, |
|
3035 |
+ prev: true |
|
3036 |
+ }; |
|
3037 |
+ |
|
3038 |
+jQuery.fn.extend( { |
|
3039 |
+ has: function( target ) { |
|
3040 |
+ var targets = jQuery( target, this ), |
|
3041 |
+ l = targets.length; |
|
3042 |
+ |
|
3043 |
+ return this.filter( function() { |
|
3044 |
+ var i = 0; |
|
3045 |
+ for ( ; i < l; i++ ) { |
|
3046 |
+ if ( jQuery.contains( this, targets[ i ] ) ) { |
|
3047 |
+ return true; |
|
3048 |
+ } |
|
3049 |
+ } |
|
3050 |
+ } ); |
|
3051 |
+ }, |
|
3052 |
+ |
|
3053 |
+ closest: function( selectors, context ) { |
|
3054 |
+ var cur, |
|
3055 |
+ i = 0, |
|
3056 |
+ l = this.length, |
|
3057 |
+ matched = [], |
|
3058 |
+ targets = typeof selectors !== "string" && jQuery( selectors ); |
|
3059 |
+ |
|
3060 |
+ // Positional selectors never match, since there's no _selection_ context |
|
3061 |
+ if ( !rneedsContext.test( selectors ) ) { |
|
3062 |
+ for ( ; i < l; i++ ) { |
|
3063 |
+ for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { |
|
3064 |
+ |
|
3065 |
+ // Always skip document fragments |
|
3066 |
+ if ( cur.nodeType < 11 && ( targets ? |
|
3067 |
+ targets.index( cur ) > -1 : |
|
3068 |
+ |
|
3069 |
+ // Don't pass non-elements to Sizzle |
|
3070 |
+ cur.nodeType === 1 && |
|
3071 |
+ jQuery.find.matchesSelector( cur, selectors ) ) ) { |
|
3072 |
+ |
|
3073 |
+ matched.push( cur ); |
|
3074 |
+ break; |
|
3075 |
+ } |
|
3076 |
+ } |
|
3077 |
+ } |
|
3078 |
+ } |
|
3079 |
+ |
|
3080 |
+ return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); |
|
3081 |
+ }, |
|
3082 |
+ |
|
3083 |
+ // Determine the position of an element within the set |
|
3084 |
+ index: function( elem ) { |
|
3085 |
+ |
|
3086 |
+ // No argument, return index in parent |
|
3087 |
+ if ( !elem ) { |
|
3088 |
+ return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; |
|
3089 |
+ } |
|
3090 |
+ |
|
3091 |
+ // Index in selector |
|
3092 |
+ if ( typeof elem === "string" ) { |
|
3093 |
+ return indexOf.call( jQuery( elem ), this[ 0 ] ); |
|
3094 |
+ } |
|
3095 |
+ |
|
3096 |
+ // Locate the position of the desired element |
|
3097 |
+ return indexOf.call( this, |
|
3098 |
+ |
|
3099 |
+ // If it receives a jQuery object, the first element is used |
|
3100 |
+ elem.jquery ? elem[ 0 ] : elem |
|
3101 |
+ ); |
|
3102 |
+ }, |
|
3103 |
+ |
|
3104 |
+ add: function( selector, context ) { |
|
3105 |
+ return this.pushStack( |
|
3106 |
+ jQuery.uniqueSort( |
|
3107 |
+ jQuery.merge( this.get(), jQuery( selector, context ) ) |
|
3108 |
+ ) |
|
3109 |
+ ); |
|
3110 |
+ }, |
|
3111 |
+ |
|
3112 |
+ addBack: function( selector ) { |
|
3113 |
+ return this.add( selector == null ? |
|
3114 |
+ this.prevObject : this.prevObject.filter( selector ) |
|
3115 |
+ ); |
|
3116 |
+ } |
|
3117 |
+} ); |
|
3118 |
+ |
|
3119 |
+function sibling( cur, dir ) { |
|
3120 |
+ while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} |
|
3121 |
+ return cur; |
|
3122 |
+} |
|
3123 |
+ |
|
3124 |
+jQuery.each( { |
|
3125 |
+ parent: function( elem ) { |
|
3126 |
+ var parent = elem.parentNode; |
|
3127 |
+ return parent && parent.nodeType !== 11 ? parent : null; |
|
3128 |
+ }, |
|
3129 |
+ parents: function( elem ) { |
|
3130 |
+ return dir( elem, "parentNode" ); |
|
3131 |
+ }, |
|
3132 |
+ parentsUntil: function( elem, i, until ) { |
|
3133 |
+ return dir( elem, "parentNode", until ); |
|
3134 |
+ }, |
|
3135 |
+ next: function( elem ) { |
|
3136 |
+ return sibling( elem, "nextSibling" ); |
|
3137 |
+ }, |
|
3138 |
+ prev: function( elem ) { |
|
3139 |
+ return sibling( elem, "previousSibling" ); |
|
3140 |
+ }, |
|
3141 |
+ nextAll: function( elem ) { |
|
3142 |
+ return dir( elem, "nextSibling" ); |
|
3143 |
+ }, |
|
3144 |
+ prevAll: function( elem ) { |
|
3145 |
+ return dir( elem, "previousSibling" ); |
|
3146 |
+ }, |
|
3147 |
+ nextUntil: function( elem, i, until ) { |
|
3148 |
+ return dir( elem, "nextSibling", until ); |
|
3149 |
+ }, |
|
3150 |
+ prevUntil: function( elem, i, until ) { |
|
3151 |
+ return dir( elem, "previousSibling", until ); |
|
3152 |
+ }, |
|
3153 |
+ siblings: function( elem ) { |
|
3154 |
+ return siblings( ( elem.parentNode || {} ).firstChild, elem ); |
|
3155 |
+ }, |
|
3156 |
+ children: function( elem ) { |
|
3157 |
+ return siblings( elem.firstChild ); |
|
3158 |
+ }, |
|
3159 |
+ contents: function( elem ) { |
|
3160 |
+ if ( nodeName( elem, "iframe" ) ) { |
|
3161 |
+ return elem.contentDocument; |
|
3162 |
+ } |
|
3163 |
+ |
|
3164 |
+ // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only |
|
3165 |
+ // Treat the template element as a regular one in browsers that |
|
3166 |
+ // don't support it. |
|
3167 |
+ if ( nodeName( elem, "template" ) ) { |
|
3168 |
+ elem = elem.content || elem; |
|
3169 |
+ } |
|
3170 |
+ |
|
3171 |
+ return jQuery.merge( [], elem.childNodes ); |
|
3172 |
+ } |
|
3173 |
+}, function( name, fn ) { |
|
3174 |
+ jQuery.fn[ name ] = function( until, selector ) { |
|
3175 |
+ var matched = jQuery.map( this, fn, until ); |
|
3176 |
+ |
|
3177 |
+ if ( name.slice( -5 ) !== "Until" ) { |
|
3178 |
+ selector = until; |
|
3179 |
+ } |
|
3180 |
+ |
|
3181 |
+ if ( selector && typeof selector === "string" ) { |
|
3182 |
+ matched = jQuery.filter( selector, matched ); |
|
3183 |
+ } |
|
3184 |
+ |
|
3185 |
+ if ( this.length > 1 ) { |
|
3186 |
+ |
|
3187 |
+ // Remove duplicates |
|
3188 |
+ if ( !guaranteedUnique[ name ] ) { |
|
3189 |
+ jQuery.uniqueSort( matched ); |
|
3190 |
+ } |
|
3191 |
+ |
|
3192 |
+ // Reverse order for parents* and prev-derivatives |
|
3193 |
+ if ( rparentsprev.test( name ) ) { |
|
3194 |
+ matched.reverse(); |
|
3195 |
+ } |
|
3196 |
+ } |
|
3197 |
+ |
|
3198 |
+ return this.pushStack( matched ); |
|
3199 |
+ }; |
|
3200 |
+} ); |
|
3201 |
+var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); |
|
3202 |
+ |
|
3203 |
+ |
|
3204 |
+ |
|
3205 |
+// Convert String-formatted options into Object-formatted ones |
|
3206 |
+function createOptions( options ) { |
|
3207 |
+ var object = {}; |
|
3208 |
+ jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { |
|
3209 |
+ object[ flag ] = true; |
|
3210 |
+ } ); |
|
3211 |
+ return object; |
|
3212 |
+} |
|
3213 |
+ |
|
3214 |
+/* |
|
3215 |
+ * Create a callback list using the following parameters: |
|
3216 |
+ * |
|
3217 |
+ * options: an optional list of space-separated options that will change how |
|
3218 |
+ * the callback list behaves or a more traditional option object |
|
3219 |
+ * |
|
3220 |
+ * By default a callback list will act like an event callback list and can be |
|
3221 |
+ * "fired" multiple times. |
|
3222 |
+ * |
|
3223 |
+ * Possible options: |
|
3224 |
+ * |
|
3225 |
+ * once: will ensure the callback list can only be fired once (like a Deferred) |
|
3226 |
+ * |
|
3227 |
+ * memory: will keep track of previous values and will call any callback added |
|
3228 |
+ * after the list has been fired right away with the latest "memorized" |
|
3229 |
+ * values (like a Deferred) |
|
3230 |
+ * |
|
3231 |
+ * unique: will ensure a callback can only be added once (no duplicate in the list) |
|
3232 |
+ * |
|
3233 |
+ * stopOnFalse: interrupt callings when a callback returns false |
|
3234 |
+ * |
|
3235 |
+ */ |
|
3236 |
+jQuery.Callbacks = function( options ) { |
|
3237 |
+ |
|
3238 |
+ // Convert options from String-formatted to Object-formatted if needed |
|
3239 |
+ // (we check in cache first) |
|
3240 |
+ options = typeof options === "string" ? |
|
3241 |
+ createOptions( options ) : |
|
3242 |
+ jQuery.extend( {}, options ); |
|
3243 |
+ |
|
3244 |
+ var // Flag to know if list is currently firing |
|
3245 |
+ firing, |
|
3246 |
+ |
|
3247 |
+ // Last fire value for non-forgettable lists |
|
3248 |
+ memory, |
|
3249 |
+ |
|
3250 |
+ // Flag to know if list was already fired |
|
3251 |
+ fired, |
|
3252 |
+ |
|
3253 |
+ // Flag to prevent firing |
|
3254 |
+ locked, |
|
3255 |
+ |
|
3256 |
+ // Actual callback list |
|
3257 |
+ list = [], |
|
3258 |
+ |
|
3259 |
+ // Queue of execution data for repeatable lists |
|
3260 |
+ queue = [], |
|
3261 |
+ |
|
3262 |
+ // Index of currently firing callback (modified by add/remove as needed) |
|
3263 |
+ firingIndex = -1, |
|
3264 |
+ |
|
3265 |
+ // Fire callbacks |
|
3266 |
+ fire = function() { |
|
3267 |
+ |
|
3268 |
+ // Enforce single-firing |
|
3269 |
+ locked = locked || options.once; |
|
3270 |
+ |
|
3271 |
+ // Execute callbacks for all pending executions, |
|
3272 |
+ // respecting firingIndex overrides and runtime changes |
|
3273 |
+ fired = firing = true; |
|
3274 |
+ for ( ; queue.length; firingIndex = -1 ) { |
|
3275 |
+ memory = queue.shift(); |
|
3276 |
+ while ( ++firingIndex < list.length ) { |
|
3277 |
+ |
|
3278 |
+ // Run callback and check for early termination |
|
3279 |
+ if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && |
|
3280 |
+ options.stopOnFalse ) { |
|
3281 |
+ |
|
3282 |
+ // Jump to end and forget the data so .add doesn't re-fire |
|
3283 |
+ firingIndex = list.length; |
|
3284 |
+ memory = false; |
|
3285 |
+ } |
|
3286 |
+ } |
|
3287 |
+ } |
|
3288 |
+ |
|
3289 |
+ // Forget the data if we're done with it |
|
3290 |
+ if ( !options.memory ) { |
|
3291 |
+ memory = false; |
|
3292 |
+ } |
|
3293 |
+ |
|
3294 |
+ firing = false; |
|
3295 |
+ |
|
3296 |
+ // Clean up if we're done firing for good |
|
3297 |
+ if ( locked ) { |
|
3298 |
+ |
|
3299 |
+ // Keep an empty list if we have data for future add calls |
|
3300 |
+ if ( memory ) { |
|
3301 |
+ list = []; |
|
3302 |
+ |
|
3303 |
+ // Otherwise, this object is spent |
|
3304 |
+ } else { |
|
3305 |
+ list = ""; |
|
3306 |
+ } |
|
3307 |
+ } |
|
3308 |
+ }, |
|
3309 |
+ |
|
3310 |
+ // Actual Callbacks object |
|
3311 |
+ self = { |
|
3312 |
+ |
|
3313 |
+ // Add a callback or a collection of callbacks to the list |
|
3314 |
+ add: function() { |
|
3315 |
+ if ( list ) { |
|
3316 |
+ |
|
3317 |
+ // If we have memory from a past run, we should fire after adding |
|
3318 |
+ if ( memory && !firing ) { |
|
3319 |
+ firingIndex = list.length - 1; |
|
3320 |
+ queue.push( memory ); |
|
3321 |
+ } |
|
3322 |
+ |
|
3323 |
+ ( function add( args ) { |
|
3324 |
+ jQuery.each( args, function( _, arg ) { |
|
3325 |
+ if ( isFunction( arg ) ) { |
|
3326 |
+ if ( !options.unique || !self.has( arg ) ) { |
|
3327 |
+ list.push( arg ); |
|
3328 |
+ } |
|
3329 |
+ } else if ( arg && arg.length && toType( arg ) !== "string" ) { |
|
3330 |
+ |
|
3331 |
+ // Inspect recursively |
|
3332 |
+ add( arg ); |
|
3333 |
+ } |
|
3334 |
+ } ); |
|
3335 |
+ } )( arguments ); |
|
3336 |
+ |
|
3337 |
+ if ( memory && !firing ) { |
|
3338 |
+ fire(); |
|
3339 |
+ } |
|
3340 |
+ } |
|
3341 |
+ return this; |
|
3342 |
+ }, |
|
3343 |
+ |
|
3344 |
+ // Remove a callback from the list |
|
3345 |
+ remove: function() { |
|
3346 |
+ jQuery.each( arguments, function( _, arg ) { |
|
3347 |
+ var index; |
|
3348 |
+ while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { |
|
3349 |
+ list.splice( index, 1 ); |
|
3350 |
+ |
|
3351 |
+ // Handle firing indexes |
|
3352 |
+ if ( index <= firingIndex ) { |
|
3353 |
+ firingIndex--; |
|
3354 |
+ } |
|
3355 |
+ } |
|
3356 |
+ } ); |
|
3357 |
+ return this; |
|
3358 |
+ }, |
|
3359 |
+ |
|
3360 |
+ // Check if a given callback is in the list. |
|
3361 |
+ // If no argument is given, return whether or not list has callbacks attached. |
|
3362 |
+ has: function( fn ) { |
|
3363 |
+ return fn ? |
|
3364 |
+ jQuery.inArray( fn, list ) > -1 : |
|
3365 |
+ list.length > 0; |
|
3366 |
+ }, |
|
3367 |
+ |
|
3368 |
+ // Remove all callbacks from the list |
|
3369 |
+ empty: function() { |
|
3370 |
+ if ( list ) { |
|
3371 |
+ list = []; |
|
3372 |
+ } |
|
3373 |
+ return this; |
|
3374 |
+ }, |
|
3375 |
+ |
|
3376 |
+ // Disable .fire and .add |
|
3377 |
+ // Abort any current/pending executions |
|
3378 |
+ // Clear all callbacks and values |
|
3379 |
+ disable: function() { |
|
3380 |
+ locked = queue = []; |
|
3381 |
+ list = memory = ""; |
|
3382 |
+ return this; |
|
3383 |
+ }, |
|
3384 |
+ disabled: function() { |
|
3385 |
+ return !list; |
|
3386 |
+ }, |
|
3387 |
+ |
|
3388 |
+ // Disable .fire |
|
3389 |
+ // Also disable .add unless we have memory (since it would have no effect) |
|
3390 |
+ // Abort any pending executions |
|
3391 |
+ lock: function() { |
|
3392 |
+ locked = queue = []; |
|
3393 |
+ if ( !memory && !firing ) { |
|
3394 |
+ list = memory = ""; |
|
3395 |
+ } |
|
3396 |
+ return this; |
|
3397 |
+ }, |
|
3398 |
+ locked: function() { |
|
3399 |
+ return !!locked; |
|
3400 |
+ }, |
|
3401 |
+ |
|
3402 |
+ // Call all callbacks with the given context and arguments |
|
3403 |
+ fireWith: function( context, args ) { |
|
3404 |
+ if ( !locked ) { |
|
3405 |
+ args = args || []; |
|
3406 |
+ args = [ context, args.slice ? args.slice() : args ]; |
|
3407 |
+ queue.push( args ); |
|
3408 |
+ if ( !firing ) { |
|
3409 |
+ fire(); |
|
3410 |
+ } |
|
3411 |
+ } |
|
3412 |
+ return this; |
|
3413 |
+ }, |
|
3414 |
+ |
|
3415 |
+ // Call all the callbacks with the given arguments |
|
3416 |
+ fire: function() { |
|
3417 |
+ self.fireWith( this, arguments ); |
|
3418 |
+ return this; |
|
3419 |
+ }, |
|
3420 |
+ |
|
3421 |
+ // To know if the callbacks have already been called at least once |
|
3422 |
+ fired: function() { |
|
3423 |
+ return !!fired; |
|
3424 |
+ } |
|
3425 |
+ }; |
|
3426 |
+ |
|
3427 |
+ return self; |
|
3428 |
+}; |
|
3429 |
+ |
|
3430 |
+ |
|
3431 |
+function Identity( v ) { |
|
3432 |
+ return v; |
|
3433 |
+} |
|
3434 |
+function Thrower( ex ) { |
|
3435 |
+ throw ex; |
|
3436 |
+} |
|
3437 |
+ |
|
3438 |
+function adoptValue( value, resolve, reject, noValue ) { |
|
3439 |
+ var method; |
|
3440 |
+ |
|
3441 |
+ try { |
|
3442 |
+ |
|
3443 |
+ // Check for promise aspect first to privilege synchronous behavior |
|
3444 |
+ if ( value && isFunction( ( method = value.promise ) ) ) { |
|
3445 |
+ method.call( value ).done( resolve ).fail( reject ); |
|
3446 |
+ |
|
3447 |
+ // Other thenables |
|
3448 |
+ } else if ( value && isFunction( ( method = value.then ) ) ) { |
|
3449 |
+ method.call( value, resolve, reject ); |
|
3450 |
+ |
|
3451 |
+ // Other non-thenables |
|
3452 |
+ } else { |
|
3453 |
+ |
|
3454 |
+ // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: |
|
3455 |
+ // * false: [ value ].slice( 0 ) => resolve( value ) |
|
3456 |
+ // * true: [ value ].slice( 1 ) => resolve() |
|
3457 |
+ resolve.apply( undefined, [ value ].slice( noValue ) ); |
|
3458 |
+ } |
|
3459 |
+ |
|
3460 |
+ // For Promises/A+, convert exceptions into rejections |
|
3461 |
+ // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in |
|
3462 |
+ // Deferred#then to conditionally suppress rejection. |
|
3463 |
+ } catch ( value ) { |
|
3464 |
+ |
|
3465 |
+ // Support: Android 4.0 only |
|
3466 |
+ // Strict mode functions invoked without .call/.apply get global-object context |
|
3467 |
+ reject.apply( undefined, [ value ] ); |
|
3468 |
+ } |
|
3469 |
+} |
|
3470 |
+ |
|
3471 |
+jQuery.extend( { |
|
3472 |
+ |
|
3473 |
+ Deferred: function( func ) { |
|
3474 |
+ var tuples = [ |
|
3475 |
+ |
|
3476 |
+ // action, add listener, callbacks, |
|
3477 |
+ // ... .then handlers, argument index, [final state] |
|
3478 |
+ [ "notify", "progress", jQuery.Callbacks( "memory" ), |
|
3479 |
+ jQuery.Callbacks( "memory" ), 2 ], |
|
3480 |
+ [ "resolve", "done", jQuery.Callbacks( "once memory" ), |
|
3481 |
+ jQuery.Callbacks( "once memory" ), 0, "resolved" ], |
|
3482 |
+ [ "reject", "fail", jQuery.Callbacks( "once memory" ), |
|
3483 |
+ jQuery.Callbacks( "once memory" ), 1, "rejected" ] |
|
3484 |
+ ], |
|
3485 |
+ state = "pending", |
|
3486 |
+ promise = { |
|
3487 |
+ state: function() { |
|
3488 |
+ return state; |
|
3489 |
+ }, |
|
3490 |
+ always: function() { |
|
3491 |
+ deferred.done( arguments ).fail( arguments ); |
|
3492 |
+ return this; |
|
3493 |
+ }, |
|
3494 |
+ "catch": function( fn ) { |
|
3495 |
+ return promise.then( null, fn ); |
|
3496 |
+ }, |
|
3497 |
+ |
|
3498 |
+ // Keep pipe for back-compat |
|
3499 |
+ pipe: function( /* fnDone, fnFail, fnProgress */ ) { |
|
3500 |
+ var fns = arguments; |
|
3501 |
+ |
|
3502 |
+ return jQuery.Deferred( function( newDefer ) { |
|
3503 |
+ jQuery.each( tuples, function( i, tuple ) { |
|
3504 |
+ |
|
3505 |
+ // Map tuples (progress, done, fail) to arguments (done, fail, progress) |
|
3506 |
+ var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; |
|
3507 |
+ |
|
3508 |
+ // deferred.progress(function() { bind to newDefer or newDefer.notify }) |
|
3509 |
+ // deferred.done(function() { bind to newDefer or newDefer.resolve }) |
|
3510 |
+ // deferred.fail(function() { bind to newDefer or newDefer.reject }) |
|
3511 |
+ deferred[ tuple[ 1 ] ]( function() { |
|
3512 |
+ var returned = fn && fn.apply( this, arguments ); |
|
3513 |
+ if ( returned && isFunction( returned.promise ) ) { |
|
3514 |
+ returned.promise() |
|
3515 |
+ .progress( newDefer.notify ) |
|
3516 |
+ .done( newDefer.resolve ) |
|
3517 |
+ .fail( newDefer.reject ); |
|
3518 |
+ } else { |
|
3519 |
+ newDefer[ tuple[ 0 ] + "With" ]( |
|
3520 |
+ this, |
|
3521 |
+ fn ? [ returned ] : arguments |
|
3522 |
+ ); |
|
3523 |
+ } |
|
3524 |
+ } ); |
|
3525 |
+ } ); |
|
3526 |
+ fns = null; |
|
3527 |
+ } ).promise(); |
|
3528 |
+ }, |
|
3529 |
+ then: function( onFulfilled, onRejected, onProgress ) { |
|
3530 |
+ var maxDepth = 0; |
|
3531 |
+ function resolve( depth, deferred, handler, special ) { |
|
3532 |
+ return function() { |
|
3533 |
+ var that = this, |
|
3534 |
+ args = arguments, |
|
3535 |
+ mightThrow = function() { |
|
3536 |
+ var returned, then; |
|
3537 |
+ |
|
3538 |
+ // Support: Promises/A+ section 2.3.3.3.3 |
|
3539 |
+ // https://promisesaplus.com/#point-59 |
|
3540 |
+ // Ignore double-resolution attempts |
|
3541 |
+ if ( depth < maxDepth ) { |
|
3542 |
+ return; |
|
3543 |
+ } |
|
3544 |
+ |
|
3545 |
+ returned = handler.apply( that, args ); |
|
3546 |
+ |
|
3547 |
+ // Support: Promises/A+ section 2.3.1 |
|
3548 |
+ // https://promisesaplus.com/#point-48 |
|
3549 |
+ if ( returned === deferred.promise() ) { |
|
3550 |
+ throw new TypeError( "Thenable self-resolution" ); |
|
3551 |
+ } |
|
3552 |
+ |
|
3553 |
+ // Support: Promises/A+ sections 2.3.3.1, 3.5 |
|
3554 |
+ // https://promisesaplus.com/#point-54 |
|
3555 |
+ // https://promisesaplus.com/#point-75 |
|
3556 |
+ // Retrieve `then` only once |
|
3557 |
+ then = returned && |
|
3558 |
+ |
|
3559 |
+ // Support: Promises/A+ section 2.3.4 |
|
3560 |
+ // https://promisesaplus.com/#point-64 |
|
3561 |
+ // Only check objects and functions for thenability |
|
3562 |
+ ( typeof returned === "object" || |
|
3563 |
+ typeof returned === "function" ) && |
|
3564 |
+ returned.then; |
|
3565 |
+ |
|
3566 |
+ // Handle a returned thenable |
|
3567 |
+ if ( isFunction( then ) ) { |
|
3568 |
+ |
|
3569 |
+ // Special processors (notify) just wait for resolution |
|
3570 |
+ if ( special ) { |
|
3571 |
+ then.call( |
|
3572 |
+ returned, |
|
3573 |
+ resolve( maxDepth, deferred, Identity, special ), |
|
3574 |
+ resolve( maxDepth, deferred, Thrower, special ) |
|
3575 |
+ ); |
|
3576 |
+ |
|
3577 |
+ // Normal processors (resolve) also hook into progress |
|
3578 |
+ } else { |
|
3579 |
+ |
|
3580 |
+ // ...and disregard older resolution values |
|
3581 |
+ maxDepth++; |
|
3582 |
+ |
|
3583 |
+ then.call( |
|
3584 |
+ returned, |
|
3585 |
+ resolve( maxDepth, deferred, Identity, special ), |
|
3586 |
+ resolve( maxDepth, deferred, Thrower, special ), |
|
3587 |
+ resolve( maxDepth, deferred, Identity, |
|
3588 |
+ deferred.notifyWith ) |
|
3589 |
+ ); |
|
3590 |
+ } |
|
3591 |
+ |
|
3592 |
+ // Handle all other returned values |
|
3593 |
+ } else { |
|
3594 |
+ |
|
3595 |
+ // Only substitute handlers pass on context |
|
3596 |
+ // and multiple values (non-spec behavior) |
|
3597 |
+ if ( handler !== Identity ) { |
|
3598 |
+ that = undefined; |
|
3599 |
+ args = [ returned ]; |
|
3600 |
+ } |
|
3601 |
+ |
|
3602 |
+ // Process the value(s) |
|
3603 |
+ // Default process is resolve |
|
3604 |
+ ( special || deferred.resolveWith )( that, args ); |
|
3605 |
+ } |
|
3606 |
+ }, |
|
3607 |
+ |
|
3608 |
+ // Only normal processors (resolve) catch and reject exceptions |
|
3609 |
+ process = special ? |
|
3610 |
+ mightThrow : |
|
3611 |
+ function() { |
|
3612 |
+ try { |
|
3613 |
+ mightThrow(); |
|
3614 |
+ } catch ( e ) { |
|
3615 |
+ |
|
3616 |
+ if ( jQuery.Deferred.exceptionHook ) { |
|
3617 |
+ jQuery.Deferred.exceptionHook( e, |
|
3618 |
+ process.stackTrace ); |
|
3619 |
+ } |
|
3620 |
+ |
|
3621 |
+ // Support: Promises/A+ section 2.3.3.3.4.1 |
|
3622 |
+ // https://promisesaplus.com/#point-61 |
|
3623 |
+ // Ignore post-resolution exceptions |
|
3624 |
+ if ( depth + 1 >= maxDepth ) { |
|
3625 |
+ |
|
3626 |
+ // Only substitute handlers pass on context |
|
3627 |
+ // and multiple values (non-spec behavior) |
|
3628 |
+ if ( handler !== Thrower ) { |
|
3629 |
+ that = undefined; |
|
3630 |
+ args = [ e ]; |
|
3631 |
+ } |
|
3632 |
+ |
|
3633 |
+ deferred.rejectWith( that, args ); |
|
3634 |
+ } |
|
3635 |
+ } |
|
3636 |
+ }; |
|
3637 |
+ |
|
3638 |
+ // Support: Promises/A+ section 2.3.3.3.1 |
|
3639 |
+ // https://promisesaplus.com/#point-57 |
|
3640 |
+ // Re-resolve promises immediately to dodge false rejection from |
|
3641 |
+ // subsequent errors |
|
3642 |
+ if ( depth ) { |
|
3643 |
+ process(); |
|
3644 |
+ } else { |
|
3645 |
+ |
|
3646 |
+ // Call an optional hook to record the stack, in case of exception |
|
3647 |
+ // since it's otherwise lost when execution goes async |
|
3648 |
+ if ( jQuery.Deferred.getStackHook ) { |
|
3649 |
+ process.stackTrace = jQuery.Deferred.getStackHook(); |
|
3650 |
+ } |
|
3651 |
+ window.setTimeout( process ); |
|
3652 |
+ } |
|
3653 |
+ }; |
|
3654 |
+ } |
|
3655 |
+ |
|
3656 |
+ return jQuery.Deferred( function( newDefer ) { |
|
3657 |
+ |
|
3658 |
+ // progress_handlers.add( ... ) |
|
3659 |
+ tuples[ 0 ][ 3 ].add( |
|
3660 |
+ resolve( |
|
3661 |
+ 0, |
|
3662 |
+ newDefer, |
|
3663 |
+ isFunction( onProgress ) ? |
|
3664 |
+ onProgress : |
|
3665 |
+ Identity, |
|
3666 |
+ newDefer.notifyWith |
|
3667 |
+ ) |
|
3668 |
+ ); |
|
3669 |
+ |
|
3670 |
+ // fulfilled_handlers.add( ... ) |
|
3671 |
+ tuples[ 1 ][ 3 ].add( |
|
3672 |
+ resolve( |
|
3673 |
+ 0, |
|
3674 |
+ newDefer, |
|
3675 |
+ isFunction( onFulfilled ) ? |
|
3676 |
+ onFulfilled : |
|
3677 |
+ Identity |
|
3678 |
+ ) |
|
3679 |
+ ); |
|
3680 |
+ |
|
3681 |
+ // rejected_handlers.add( ... ) |
|
3682 |
+ tuples[ 2 ][ 3 ].add( |
|
3683 |
+ resolve( |
|
3684 |
+ 0, |
|
3685 |
+ newDefer, |
|
3686 |
+ isFunction( onRejected ) ? |
|
3687 |
+ onRejected : |
|
3688 |
+ Thrower |
|
3689 |
+ ) |
|
3690 |
+ ); |
|
3691 |
+ } ).promise(); |
|
3692 |
+ }, |
|
3693 |
+ |
|
3694 |
+ // Get a promise for this deferred |
|
3695 |
+ // If obj is provided, the promise aspect is added to the object |
|
3696 |
+ promise: function( obj ) { |
|
3697 |
+ return obj != null ? jQuery.extend( obj, promise ) : promise; |
|
3698 |
+ } |
|
3699 |
+ }, |
|
3700 |
+ deferred = {}; |
|
3701 |
+ |
|
3702 |
+ // Add list-specific methods |
|
3703 |
+ jQuery.each( tuples, function( i, tuple ) { |
|
3704 |
+ var list = tuple[ 2 ], |
|
3705 |
+ stateString = tuple[ 5 ]; |
|
3706 |
+ |
|
3707 |
+ // promise.progress = list.add |
|
3708 |
+ // promise.done = list.add |
|
3709 |
+ // promise.fail = list.add |
|
3710 |
+ promise[ tuple[ 1 ] ] = list.add; |
|
3711 |
+ |
|
3712 |
+ // Handle state |
|
3713 |
+ if ( stateString ) { |
|
3714 |
+ list.add( |
|
3715 |
+ function() { |
|
3716 |
+ |
|
3717 |
+ // state = "resolved" (i.e., fulfilled) |
|
3718 |
+ // state = "rejected" |
|
3719 |
+ state = stateString; |
|
3720 |
+ }, |
|
3721 |
+ |
|
3722 |
+ // rejected_callbacks.disable |
|
3723 |
+ // fulfilled_callbacks.disable |
|
3724 |
+ tuples[ 3 - i ][ 2 ].disable, |
|
3725 |
+ |
|
3726 |
+ // rejected_handlers.disable |
|
3727 |
+ // fulfilled_handlers.disable |
|
3728 |
+ tuples[ 3 - i ][ 3 ].disable, |
|
3729 |
+ |
|
3730 |
+ // progress_callbacks.lock |
|
3731 |
+ tuples[ 0 ][ 2 ].lock, |
|
3732 |
+ |
|
3733 |
+ // progress_handlers.lock |
|
3734 |
+ tuples[ 0 ][ 3 ].lock |
|
3735 |
+ ); |
|
3736 |
+ } |
|
3737 |
+ |
|
3738 |
+ // progress_handlers.fire |
|
3739 |
+ // fulfilled_handlers.fire |
|
3740 |
+ // rejected_handlers.fire |
|
3741 |
+ list.add( tuple[ 3 ].fire ); |
|
3742 |
+ |
|
3743 |
+ // deferred.notify = function() { deferred.notifyWith(...) } |
|
3744 |
+ // deferred.resolve = function() { deferred.resolveWith(...) } |
|
3745 |
+ // deferred.reject = function() { deferred.rejectWith(...) } |
|
3746 |
+ deferred[ tuple[ 0 ] ] = function() { |
|
3747 |
+ deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); |
|
3748 |
+ return this; |
|
3749 |
+ }; |
|
3750 |
+ |
|
3751 |
+ // deferred.notifyWith = list.fireWith |
|
3752 |
+ // deferred.resolveWith = list.fireWith |
|
3753 |
+ // deferred.rejectWith = list.fireWith |
|
3754 |
+ deferred[ tuple[ 0 ] + "With" ] = list.fireWith; |
|
3755 |
+ } ); |
|
3756 |
+ |
|
3757 |
+ // Make the deferred a promise |
|
3758 |
+ promise.promise( deferred ); |
|
3759 |
+ |
|
3760 |
+ // Call given func if any |
|
3761 |
+ if ( func ) { |
|
3762 |
+ func.call( deferred, deferred ); |
|
3763 |
+ } |
|
3764 |
+ |
|
3765 |
+ // All done! |
|
3766 |
+ return deferred; |
|
3767 |
+ }, |
|
3768 |
+ |
|
3769 |
+ // Deferred helper |
|
3770 |
+ when: function( singleValue ) { |
|
3771 |
+ var |
|
3772 |
+ |
|
3773 |
+ // count of uncompleted subordinates |
|
3774 |
+ remaining = arguments.length, |
|
3775 |
+ |
|
3776 |
+ // count of unprocessed arguments |
|
3777 |
+ i = remaining, |
|
3778 |
+ |
|
3779 |
+ // subordinate fulfillment data |
|
3780 |
+ resolveContexts = Array( i ), |
|
3781 |
+ resolveValues = slice.call( arguments ), |
|
3782 |
+ |
|
3783 |
+ // the master Deferred |
|
3784 |
+ master = jQuery.Deferred(), |
|
3785 |
+ |
|
3786 |
+ // subordinate callback factory |
|
3787 |
+ updateFunc = function( i ) { |
|
3788 |
+ return function( value ) { |
|
3789 |
+ resolveContexts[ i ] = this; |
|
3790 |
+ resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; |
|
3791 |
+ if ( !( --remaining ) ) { |
|
3792 |
+ master.resolveWith( resolveContexts, resolveValues ); |
|
3793 |
+ } |
|
3794 |
+ }; |
|
3795 |
+ }; |
|
3796 |
+ |
|
3797 |
+ // Single- and empty arguments are adopted like Promise.resolve |
|
3798 |
+ if ( remaining <= 1 ) { |
|
3799 |
+ adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, |
|
3800 |
+ !remaining ); |
|
3801 |
+ |
|
3802 |
+ // Use .then() to unwrap secondary thenables (cf. gh-3000) |
|
3803 |
+ if ( master.state() === "pending" || |
|
3804 |
+ isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { |
|
3805 |
+ |
|
3806 |
+ return master.then(); |
|
3807 |
+ } |
|
3808 |
+ } |
|
3809 |
+ |
|
3810 |
+ // Multiple arguments are aggregated like Promise.all array elements |
|
3811 |
+ while ( i-- ) { |
|
3812 |
+ adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); |
|
3813 |
+ } |
|
3814 |
+ |
|
3815 |
+ return master.promise(); |
|
3816 |
+ } |
|
3817 |
+} ); |
|
3818 |
+ |
|
3819 |
+ |
|
3820 |
+// These usually indicate a programmer mistake during development, |
|
3821 |
+// warn about them ASAP rather than swallowing them by default. |
|
3822 |
+var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; |
|
3823 |
+ |
|
3824 |
+jQuery.Deferred.exceptionHook = function( error, stack ) { |
|
3825 |
+ |
|
3826 |
+ // Support: IE 8 - 9 only |
|
3827 |
+ // Console exists when dev tools are open, which can happen at any time |
|
3828 |
+ if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { |
|
3829 |
+ window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); |
|
3830 |
+ } |
|
3831 |
+}; |
|
3832 |
+ |
|
3833 |
+ |
|
3834 |
+ |
|
3835 |
+ |
|
3836 |
+jQuery.readyException = function( error ) { |
|
3837 |
+ window.setTimeout( function() { |
|
3838 |
+ throw error; |
|
3839 |
+ } ); |
|
3840 |
+}; |
|
3841 |
+ |
|
3842 |
+ |
|
3843 |
+ |
|
3844 |
+ |
|
3845 |
+// The deferred used on DOM ready |
|
3846 |
+var readyList = jQuery.Deferred(); |
|
3847 |
+ |
|
3848 |
+jQuery.fn.ready = function( fn ) { |
|
3849 |
+ |
|
3850 |
+ readyList |
|
3851 |
+ .then( fn ) |
|
3852 |
+ |
|
3853 |
+ // Wrap jQuery.readyException in a function so that the lookup |
|
3854 |
+ // happens at the time of error handling instead of callback |
|
3855 |
+ // registration. |
|
3856 |
+ .catch( function( error ) { |
|
3857 |
+ jQuery.readyException( error ); |
|
3858 |
+ } ); |
|
3859 |
+ |
|
3860 |
+ return this; |
|
3861 |
+}; |
|
3862 |
+ |
|
3863 |
+jQuery.extend( { |
|
3864 |
+ |
|
3865 |
+ // Is the DOM ready to be used? Set to true once it occurs. |
|
3866 |
+ isReady: false, |
|
3867 |
+ |
|
3868 |
+ // A counter to track how many items to wait for before |
|
3869 |
+ // the ready event fires. See #6781 |
|
3870 |
+ readyWait: 1, |
|
3871 |
+ |
|
3872 |
+ // Handle when the DOM is ready |
|
3873 |
+ ready: function( wait ) { |
|
3874 |
+ |
|
3875 |
+ // Abort if there are pending holds or we're already ready |
|
3876 |
+ if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { |
|
3877 |
+ return; |
|
3878 |
+ } |
|
3879 |
+ |
|
3880 |
+ // Remember that the DOM is ready |
|
3881 |
+ jQuery.isReady = true; |
|
3882 |
+ |
|
3883 |
+ // If a normal DOM Ready event fired, decrement, and wait if need be |
|
3884 |
+ if ( wait !== true && --jQuery.readyWait > 0 ) { |
|
3885 |
+ return; |
|
3886 |
+ } |
|
3887 |
+ |
|
3888 |
+ // If there are functions bound, to execute |
|
3889 |
+ readyList.resolveWith( document, [ jQuery ] ); |
|
3890 |
+ } |
|
3891 |
+} ); |
|
3892 |
+ |
|
3893 |
+jQuery.ready.then = readyList.then; |
|
3894 |
+ |
|
3895 |
+// The ready event handler and self cleanup method |
|
3896 |
+function completed() { |
|
3897 |
+ document.removeEventListener( "DOMContentLoaded", completed ); |
|
3898 |
+ window.removeEventListener( "load", completed ); |
|
3899 |
+ jQuery.ready(); |
|
3900 |
+} |
|
3901 |
+ |
|
3902 |
+// Catch cases where $(document).ready() is called |
|
3903 |
+// after the browser event has already occurred. |
|
3904 |
+// Support: IE <=9 - 10 only |
|
3905 |
+// Older IE sometimes signals "interactive" too soon |
|
3906 |
+if ( document.readyState === "complete" || |
|
3907 |
+ ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { |
|
3908 |
+ |
|
3909 |
+ // Handle it asynchronously to allow scripts the opportunity to delay ready |
|
3910 |
+ window.setTimeout( jQuery.ready ); |
|
3911 |
+ |
|
3912 |
+} else { |
|
3913 |
+ |
|
3914 |
+ // Use the handy event callback |
|
3915 |
+ document.addEventListener( "DOMContentLoaded", completed ); |
|
3916 |
+ |
|
3917 |
+ // A fallback to window.onload, that will always work |
|
3918 |
+ window.addEventListener( "load", completed ); |
|
3919 |
+} |
|
3920 |
+ |
|
3921 |
+ |
|
3922 |
+ |
|
3923 |
+ |
|
3924 |
+// Multifunctional method to get and set values of a collection |
|
3925 |
+// The value/s can optionally be executed if it's a function |
|
3926 |
+var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { |
|
3927 |
+ var i = 0, |
|
3928 |
+ len = elems.length, |
|
3929 |
+ bulk = key == null; |
|
3930 |
+ |
|
3931 |
+ // Sets many values |
|
3932 |
+ if ( toType( key ) === "object" ) { |
|
3933 |
+ chainable = true; |
|
3934 |
+ for ( i in key ) { |
|
3935 |
+ access( elems, fn, i, key[ i ], true, emptyGet, raw ); |
|
3936 |
+ } |
|
3937 |
+ |
|
3938 |
+ // Sets one value |
|
3939 |
+ } else if ( value !== undefined ) { |
|
3940 |
+ chainable = true; |
|
3941 |
+ |
|
3942 |
+ if ( !isFunction( value ) ) { |
|
3943 |
+ raw = true; |
|
3944 |
+ } |
|
3945 |
+ |
|
3946 |
+ if ( bulk ) { |
|
3947 |
+ |
|
3948 |
+ // Bulk operations run against the entire set |
|
3949 |
+ if ( raw ) { |
|
3950 |
+ fn.call( elems, value ); |
|
3951 |
+ fn = null; |
|
3952 |
+ |
|
3953 |
+ // ...except when executing function values |
|
3954 |
+ } else { |
|
3955 |
+ bulk = fn; |
|
3956 |
+ fn = function( elem, key, value ) { |
|
3957 |
+ return bulk.call( jQuery( elem ), value ); |
|
3958 |
+ }; |
|
3959 |
+ } |
|
3960 |
+ } |
|
3961 |
+ |
|
3962 |
+ if ( fn ) { |
|
3963 |
+ for ( ; i < len; i++ ) { |
|
3964 |
+ fn( |
|
3965 |
+ elems[ i ], key, raw ? |
|
3966 |
+ value : |
|
3967 |
+ value.call( elems[ i ], i, fn( elems[ i ], key ) ) |
|
3968 |
+ ); |
|
3969 |
+ } |
|
3970 |
+ } |
|
3971 |
+ } |
|
3972 |
+ |
|
3973 |
+ if ( chainable ) { |
|
3974 |
+ return elems; |
|
3975 |
+ } |
|
3976 |
+ |
|
3977 |
+ // Gets |
|
3978 |
+ if ( bulk ) { |
|
3979 |
+ return fn.call( elems ); |
|
3980 |
+ } |
|
3981 |
+ |
|
3982 |
+ return len ? fn( elems[ 0 ], key ) : emptyGet; |
|
3983 |
+}; |
|
3984 |
+ |
|
3985 |
+ |
|
3986 |
+// Matches dashed string for camelizing |
|
3987 |
+var rmsPrefix = /^-ms-/, |
|
3988 |
+ rdashAlpha = /-([a-z])/g; |
|
3989 |
+ |
|
3990 |
+// Used by camelCase as callback to replace() |
|
3991 |
+function fcamelCase( all, letter ) { |
|
3992 |
+ return letter.toUpperCase(); |
|
3993 |
+} |
|
3994 |
+ |
|
3995 |
+// Convert dashed to camelCase; used by the css and data modules |
|
3996 |
+// Support: IE <=9 - 11, Edge 12 - 15 |
|
3997 |
+// Microsoft forgot to hump their vendor prefix (#9572) |
|
3998 |
+function camelCase( string ) { |
|
3999 |
+ return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); |
|
4000 |
+} |
|
4001 |
+var acceptData = function( owner ) { |
|
4002 |
+ |
|
4003 |
+ // Accepts only: |
|
4004 |
+ // - Node |
|
4005 |
+ // - Node.ELEMENT_NODE |
|
4006 |
+ // - Node.DOCUMENT_NODE |
|
4007 |
+ // - Object |
|
4008 |
+ // - Any |
|
4009 |
+ return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); |
|
4010 |
+}; |
|
4011 |
+ |
|
4012 |
+ |
|
4013 |
+ |
|
4014 |
+ |
|
4015 |
+function Data() { |
|
4016 |
+ this.expando = jQuery.expando + Data.uid++; |
|
4017 |
+} |
|
4018 |
+ |
|
4019 |
+Data.uid = 1; |
|
4020 |
+ |
|
4021 |
+Data.prototype = { |
|
4022 |
+ |
|
4023 |
+ cache: function( owner ) { |
|
4024 |
+ |
|
4025 |
+ // Check if the owner object already has a cache |
|
4026 |
+ var value = owner[ this.expando ]; |
|
4027 |
+ |
|
4028 |
+ // If not, create one |
|
4029 |
+ if ( !value ) { |
|
4030 |
+ value = {}; |
|
4031 |
+ |
|
4032 |
+ // We can accept data for non-element nodes in modern browsers, |
|
4033 |
+ // but we should not, see #8335. |
|
4034 |
+ // Always return an empty object. |
|
4035 |
+ if ( acceptData( owner ) ) { |
|
4036 |
+ |
|
4037 |
+ // If it is a node unlikely to be stringify-ed or looped over |
|
4038 |
+ // use plain assignment |
|
4039 |
+ if ( owner.nodeType ) { |
|
4040 |
+ owner[ this.expando ] = value; |
|
4041 |
+ |
|
4042 |
+ // Otherwise secure it in a non-enumerable property |
|
4043 |
+ // configurable must be true to allow the property to be |
|
4044 |
+ // deleted when data is removed |
|
4045 |
+ } else { |
|
4046 |
+ Object.defineProperty( owner, this.expando, { |
|
4047 |
+ value: value, |
|
4048 |
+ configurable: true |
|
4049 |
+ } ); |
|
4050 |
+ } |
|
4051 |
+ } |
|
4052 |
+ } |
|
4053 |
+ |
|
4054 |
+ return value; |
|
4055 |
+ }, |
|
4056 |
+ set: function( owner, data, value ) { |
|
4057 |
+ var prop, |
|
4058 |
+ cache = this.cache( owner ); |
|
4059 |
+ |
|
4060 |
+ // Handle: [ owner, key, value ] args |
|
4061 |
+ // Always use camelCase key (gh-2257) |
|
4062 |
+ if ( typeof data === "string" ) { |
|
4063 |
+ cache[ camelCase( data ) ] = value; |
|
4064 |
+ |
|
4065 |
+ // Handle: [ owner, { properties } ] args |
|
4066 |
+ } else { |
|
4067 |
+ |
|
4068 |
+ // Copy the properties one-by-one to the cache object |
|
4069 |
+ for ( prop in data ) { |
|
4070 |
+ cache[ camelCase( prop ) ] = data[ prop ]; |
|
4071 |
+ } |
|
4072 |
+ } |
|
4073 |
+ return cache; |
|
4074 |
+ }, |
|
4075 |
+ get: function( owner, key ) { |
|
4076 |
+ return key === undefined ? |
|
4077 |
+ this.cache( owner ) : |
|
4078 |
+ |
|
4079 |
+ // Always use camelCase key (gh-2257) |
|
4080 |
+ owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; |
|
4081 |
+ }, |
|
4082 |
+ access: function( owner, key, value ) { |
|
4083 |
+ |
|
4084 |
+ // In cases where either: |
|
4085 |
+ // |
|
4086 |
+ // 1. No key was specified |
|
4087 |
+ // 2. A string key was specified, but no value provided |
|
4088 |
+ // |
|
4089 |
+ // Take the "read" path and allow the get method to determine |
|
4090 |
+ // which value to return, respectively either: |
|
4091 |
+ // |
|
4092 |
+ // 1. The entire cache object |
|
4093 |
+ // 2. The data stored at the key |
|
4094 |
+ // |
|
4095 |
+ if ( key === undefined || |
|
4096 |
+ ( ( key && typeof key === "string" ) && value === undefined ) ) { |
|
4097 |
+ |
|
4098 |
+ return this.get( owner, key ); |
|
4099 |
+ } |
|
4100 |
+ |
|
4101 |
+ // When the key is not a string, or both a key and value |
|
4102 |
+ // are specified, set or extend (existing objects) with either: |
|
4103 |
+ // |
|
4104 |
+ // 1. An object of properties |
|
4105 |
+ // 2. A key and value |
|
4106 |
+ // |
|
4107 |
+ this.set( owner, key, value ); |
|
4108 |
+ |
|
4109 |
+ // Since the "set" path can have two possible entry points |
|
4110 |
+ // return the expected data based on which path was taken[*] |
|
4111 |
+ return value !== undefined ? value : key; |
|
4112 |
+ }, |
|
4113 |
+ remove: function( owner, key ) { |
|
4114 |
+ var i, |
|
4115 |
+ cache = owner[ this.expando ]; |
|
4116 |
+ |
|
4117 |
+ if ( cache === undefined ) { |
|
4118 |
+ return; |
|
4119 |
+ } |
|
4120 |
+ |
|
4121 |
+ if ( key !== undefined ) { |
|
4122 |
+ |
|
4123 |
+ // Support array or space separated string of keys |
|
4124 |
+ if ( Array.isArray( key ) ) { |
|
4125 |
+ |
|
4126 |
+ // If key is an array of keys... |
|
4127 |
+ // We always set camelCase keys, so remove that. |
|
4128 |
+ key = key.map( camelCase ); |
|
4129 |
+ } else { |
|
4130 |
+ key = camelCase( key ); |
|
4131 |
+ |
|
4132 |
+ // If a key with the spaces exists, use it. |
|
4133 |
+ // Otherwise, create an array by matching non-whitespace |
|
4134 |
+ key = key in cache ? |
|
4135 |
+ [ key ] : |
|
4136 |
+ ( key.match( rnothtmlwhite ) || [] ); |
|
4137 |
+ } |
|
4138 |
+ |
|
4139 |
+ i = key.length; |
|
4140 |
+ |
|
4141 |
+ while ( i-- ) { |
|
4142 |
+ delete cache[ key[ i ] ]; |
|
4143 |
+ } |
|
4144 |
+ } |
|
4145 |
+ |
|
4146 |
+ // Remove the expando if there's no more data |
|
4147 |
+ if ( key === undefined || jQuery.isEmptyObject( cache ) ) { |
|
4148 |
+ |
|
4149 |
+ // Support: Chrome <=35 - 45 |
|
4150 |
+ // Webkit & Blink performance suffers when deleting properties |
|
4151 |
+ // from DOM nodes, so set to undefined instead |
|
4152 |
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) |
|
4153 |
+ if ( owner.nodeType ) { |
|
4154 |
+ owner[ this.expando ] = undefined; |
|
4155 |
+ } else { |
|
4156 |
+ delete owner[ this.expando ]; |
|
4157 |
+ } |
|
4158 |
+ } |
|
4159 |
+ }, |
|
4160 |
+ hasData: function( owner ) { |
|
4161 |
+ var cache = owner[ this.expando ]; |
|
4162 |
+ return cache !== undefined && !jQuery.isEmptyObject( cache ); |
|
4163 |
+ } |
|
4164 |
+}; |
|
4165 |
+var dataPriv = new Data(); |
|
4166 |
+ |
|
4167 |
+var dataUser = new Data(); |
|
4168 |
+ |
|
4169 |
+ |
|
4170 |
+ |
|
4171 |
+// Implementation Summary |
|
4172 |
+// |
|
4173 |
+// 1. Enforce API surface and semantic compatibility with 1.9.x branch |
|
4174 |
+// 2. Improve the module's maintainability by reducing the storage |
|
4175 |
+// paths to a single mechanism. |
|
4176 |
+// 3. Use the same single mechanism to support "private" and "user" data. |
|
4177 |
+// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) |
|
4178 |
+// 5. Avoid exposing implementation details on user objects (eg. expando properties) |
|
4179 |
+// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 |
|
4180 |
+ |
|
4181 |
+var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, |
|
4182 |
+ rmultiDash = /[A-Z]/g; |
|
4183 |
+ |
|
4184 |
+function getData( data ) { |
|
4185 |
+ if ( data === "true" ) { |
|
4186 |
+ return true; |
|
4187 |
+ } |
|
4188 |
+ |
|
4189 |
+ if ( data === "false" ) { |
|
4190 |
+ return false; |
|
4191 |
+ } |
|
4192 |
+ |
|
4193 |
+ if ( data === "null" ) { |
|
4194 |
+ return null; |
|
4195 |
+ } |
|
4196 |
+ |
|
4197 |
+ // Only convert to a number if it doesn't change the string |
|
4198 |
+ if ( data === +data + "" ) { |
|
4199 |
+ return +data; |
|
4200 |
+ } |
|
4201 |
+ |
|
4202 |
+ if ( rbrace.test( data ) ) { |
|
4203 |
+ return JSON.parse( data ); |
|
4204 |
+ } |
|
4205 |
+ |
|
4206 |
+ return data; |
|
4207 |
+} |
|
4208 |
+ |
|
4209 |
+function dataAttr( elem, key, data ) { |
|
4210 |
+ var name; |
|
4211 |
+ |
|
4212 |
+ // If nothing was found internally, try to fetch any |
|
4213 |
+ // data from the HTML5 data-* attribute |
|
4214 |
+ if ( data === undefined && elem.nodeType === 1 ) { |
|
4215 |
+ name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); |
|
4216 |
+ data = elem.getAttribute( name ); |
|
4217 |
+ |
|
4218 |
+ if ( typeof data === "string" ) { |
|
4219 |
+ try { |
|
4220 |
+ data = getData( data ); |
|
4221 |
+ } catch ( e ) {} |
|
4222 |
+ |
|
4223 |
+ // Make sure we set the data so it isn't changed later |
|
4224 |
+ dataUser.set( elem, key, data ); |
|
4225 |
+ } else { |
|
4226 |
+ data = undefined; |
|
4227 |
+ } |
|
4228 |
+ } |
|
4229 |
+ return data; |
|
4230 |
+} |
|
4231 |
+ |
|
4232 |
+jQuery.extend( { |
|
4233 |
+ hasData: function( elem ) { |
|
4234 |
+ return dataUser.hasData( elem ) || dataPriv.hasData( elem ); |
|
4235 |
+ }, |
|
4236 |
+ |
|
4237 |
+ data: function( elem, name, data ) { |
|
4238 |
+ return dataUser.access( elem, name, data ); |
|
4239 |
+ }, |
|
4240 |
+ |
|
4241 |
+ removeData: function( elem, name ) { |
|
4242 |
+ dataUser.remove( elem, name ); |
|
4243 |
+ }, |
|
4244 |
+ |
|
4245 |
+ // TODO: Now that all calls to _data and _removeData have been replaced |
|
4246 |
+ // with direct calls to dataPriv methods, these can be deprecated. |
|
4247 |
+ _data: function( elem, name, data ) { |
|
4248 |
+ return dataPriv.access( elem, name, data ); |
|
4249 |
+ }, |
|
4250 |
+ |
|
4251 |
+ _removeData: function( elem, name ) { |
|
4252 |
+ dataPriv.remove( elem, name ); |
|
4253 |
+ } |
|
4254 |
+} ); |
|
4255 |
+ |
|
4256 |
+jQuery.fn.extend( { |
|
4257 |
+ data: function( key, value ) { |
|
4258 |
+ var i, name, data, |
|
4259 |
+ elem = this[ 0 ], |
|
4260 |
+ attrs = elem && elem.attributes; |
|
4261 |
+ |
|
4262 |
+ // Gets all values |
|
4263 |
+ if ( key === undefined ) { |
|
4264 |
+ if ( this.length ) { |
|
4265 |
+ data = dataUser.get( elem ); |
|
4266 |
+ |
|
4267 |
+ if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { |
|
4268 |
+ i = attrs.length; |
|
4269 |
+ while ( i-- ) { |
|
4270 |
+ |
|
4271 |
+ // Support: IE 11 only |
|
4272 |
+ // The attrs elements can be null (#14894) |
|
4273 |
+ if ( attrs[ i ] ) { |
|
4274 |
+ name = attrs[ i ].name; |
|
4275 |
+ if ( name.indexOf( "data-" ) === 0 ) { |
|
4276 |
+ name = camelCase( name.slice( 5 ) ); |
|
4277 |
+ dataAttr( elem, name, data[ name ] ); |
|
4278 |
+ } |
|
4279 |
+ } |
|
4280 |
+ } |
|
4281 |
+ dataPriv.set( elem, "hasDataAttrs", true ); |
|
4282 |
+ } |
|
4283 |
+ } |
|
4284 |
+ |
|
4285 |
+ return data; |
|
4286 |
+ } |
|
4287 |
+ |
|
4288 |
+ // Sets multiple values |
|
4289 |
+ if ( typeof key === "object" ) { |
|
4290 |
+ return this.each( function() { |
|
4291 |
+ dataUser.set( this, key ); |
|
4292 |
+ } ); |
|
4293 |
+ } |
|
4294 |
+ |
|
4295 |
+ return access( this, function( value ) { |
|
4296 |
+ var data; |
|
4297 |
+ |
|
4298 |
+ // The calling jQuery object (element matches) is not empty |
|
4299 |
+ // (and therefore has an element appears at this[ 0 ]) and the |
|
4300 |
+ // `value` parameter was not undefined. An empty jQuery object |
|
4301 |
+ // will result in `undefined` for elem = this[ 0 ] which will |
|
4302 |
+ // throw an exception if an attempt to read a data cache is made. |
|
4303 |
+ if ( elem && value === undefined ) { |
|
4304 |
+ |
|
4305 |
+ // Attempt to get data from the cache |
|
4306 |
+ // The key will always be camelCased in Data |
|
4307 |
+ data = dataUser.get( elem, key ); |
|
4308 |
+ if ( data !== undefined ) { |
|
4309 |
+ return data; |
|
4310 |
+ } |
|
4311 |
+ |
|
4312 |
+ // Attempt to "discover" the data in |
|
4313 |
+ // HTML5 custom data-* attrs |
|
4314 |
+ data = dataAttr( elem, key ); |
|
4315 |
+ if ( data !== undefined ) { |
|
4316 |
+ return data; |
|
4317 |
+ } |
|
4318 |
+ |
|
4319 |
+ // We tried really hard, but the data doesn't exist. |
|
4320 |
+ return; |
|
4321 |
+ } |
|
4322 |
+ |
|
4323 |
+ // Set the data... |
|
4324 |
+ this.each( function() { |
|
4325 |
+ |
|
4326 |
+ // We always store the camelCased key |
|
4327 |
+ dataUser.set( this, key, value ); |
|
4328 |
+ } ); |
|
4329 |
+ }, null, value, arguments.length > 1, null, true ); |
|
4330 |
+ }, |
|
4331 |
+ |
|
4332 |
+ removeData: function( key ) { |
|
4333 |
+ return this.each( function() { |
|
4334 |
+ dataUser.remove( this, key ); |
|
4335 |
+ } ); |
|
4336 |
+ } |
|
4337 |
+} ); |
|
4338 |
+ |
|
4339 |
+ |
|
4340 |
+jQuery.extend( { |
|
4341 |
+ queue: function( elem, type, data ) { |
|
4342 |
+ var queue; |
|
4343 |
+ |
|
4344 |
+ if ( elem ) { |
|
4345 |
+ type = ( type || "fx" ) + "queue"; |
|
4346 |
+ queue = dataPriv.get( elem, type ); |
|
4347 |
+ |
|
4348 |
+ // Speed up dequeue by getting out quickly if this is just a lookup |
|
4349 |
+ if ( data ) { |
|
4350 |
+ if ( !queue || Array.isArray( data ) ) { |
|
4351 |
+ queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); |
|
4352 |
+ } else { |
|
4353 |
+ queue.push( data ); |
|
4354 |
+ } |
|
4355 |
+ } |
|
4356 |
+ return queue || []; |
|
4357 |
+ } |
|
4358 |
+ }, |
|
4359 |
+ |
|
4360 |
+ dequeue: function( elem, type ) { |
|
4361 |
+ type = type || "fx"; |
|
4362 |
+ |
|
4363 |
+ var queue = jQuery.queue( elem, type ), |
|
4364 |
+ startLength = queue.length, |
|
4365 |
+ fn = queue.shift(), |
|
4366 |
+ hooks = jQuery._queueHooks( elem, type ), |
|
4367 |
+ next = function() { |
|
4368 |
+ jQuery.dequeue( elem, type ); |
|
4369 |
+ }; |
|
4370 |
+ |
|
4371 |
+ // If the fx queue is dequeued, always remove the progress sentinel |
|
4372 |
+ if ( fn === "inprogress" ) { |
|
4373 |
+ fn = queue.shift(); |
|
4374 |
+ startLength--; |
|
4375 |
+ } |
|
4376 |
+ |
|
4377 |
+ if ( fn ) { |
|
4378 |
+ |
|
4379 |
+ // Add a progress sentinel to prevent the fx queue from being |
|
4380 |
+ // automatically dequeued |
|
4381 |
+ if ( type === "fx" ) { |
|
4382 |
+ queue.unshift( "inprogress" ); |
|
4383 |
+ } |
|
4384 |
+ |
|
4385 |
+ // Clear up the last queue stop function |
|
4386 |
+ delete hooks.stop; |
|
4387 |
+ fn.call( elem, next, hooks ); |
|
4388 |
+ } |
|
4389 |
+ |
|
4390 |
+ if ( !startLength && hooks ) { |
|
4391 |
+ hooks.empty.fire(); |
|
4392 |
+ } |
|
4393 |
+ }, |
|
4394 |
+ |
|
4395 |
+ // Not public - generate a queueHooks object, or return the current one |
|
4396 |
+ _queueHooks: function( elem, type ) { |
|
4397 |
+ var key = type + "queueHooks"; |
|
4398 |
+ return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { |
|
4399 |
+ empty: jQuery.Callbacks( "once memory" ).add( function() { |
|
4400 |
+ dataPriv.remove( elem, [ type + "queue", key ] ); |
|
4401 |
+ } ) |
|
4402 |
+ } ); |
|
4403 |
+ } |
|
4404 |
+} ); |
|
4405 |
+ |
|
4406 |
+jQuery.fn.extend( { |
|
4407 |
+ queue: function( type, data ) { |
|
4408 |
+ var setter = 2; |
|
4409 |
+ |
|
4410 |
+ if ( typeof type !== "string" ) { |
|
4411 |
+ data = type; |
|
4412 |
+ type = "fx"; |
|
4413 |
+ setter--; |
|
4414 |
+ } |
|
4415 |
+ |
|
4416 |
+ if ( arguments.length < setter ) { |
|
4417 |
+ return jQuery.queue( this[ 0 ], type ); |
|
4418 |
+ } |
|
4419 |
+ |
|
4420 |
+ return data === undefined ? |
|
4421 |
+ this : |
|
4422 |
+ this.each( function() { |
|
4423 |
+ var queue = jQuery.queue( this, type, data ); |
|
4424 |
+ |
|
4425 |
+ // Ensure a hooks for this queue |
|
4426 |
+ jQuery._queueHooks( this, type ); |
|
4427 |
+ |
|
4428 |
+ if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { |
|
4429 |
+ jQuery.dequeue( this, type ); |
|
4430 |
+ } |
|
4431 |
+ } ); |
|
4432 |
+ }, |
|
4433 |
+ dequeue: function( type ) { |
|
4434 |
+ return this.each( function() { |
|
4435 |
+ jQuery.dequeue( this, type ); |
|
4436 |
+ } ); |
|
4437 |
+ }, |
|
4438 |
+ clearQueue: function( type ) { |
|
4439 |
+ return this.queue( type || "fx", [] ); |
|
4440 |
+ }, |
|
4441 |
+ |
|
4442 |
+ // Get a promise resolved when queues of a certain type |
|
4443 |
+ // are emptied (fx is the type by default) |
|
4444 |
+ promise: function( type, obj ) { |
|
4445 |
+ var tmp, |
|
4446 |
+ count = 1, |
|
4447 |
+ defer = jQuery.Deferred(), |
|
4448 |
+ elements = this, |
|
4449 |
+ i = this.length, |
|
4450 |
+ resolve = function() { |
|
4451 |
+ if ( !( --count ) ) { |
|
4452 |
+ defer.resolveWith( elements, [ elements ] ); |
|
4453 |
+ } |
|
4454 |
+ }; |
|
4455 |
+ |
|
4456 |
+ if ( typeof type !== "string" ) { |
|
4457 |
+ obj = type; |
|
4458 |
+ type = undefined; |
|
4459 |
+ } |
|
4460 |
+ type = type || "fx"; |
|
4461 |
+ |
|
4462 |
+ while ( i-- ) { |
|
4463 |
+ tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); |
|
4464 |
+ if ( tmp && tmp.empty ) { |
|
4465 |
+ count++; |
|
4466 |
+ tmp.empty.add( resolve ); |
|
4467 |
+ } |
|
4468 |
+ } |
|
4469 |
+ resolve(); |
|
4470 |
+ return defer.promise( obj ); |
|
4471 |
+ } |
|
4472 |
+} ); |
|
4473 |
+var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; |
|
4474 |
+ |
|
4475 |
+var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); |
|
4476 |
+ |
|
4477 |
+ |
|
4478 |
+var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; |
|
4479 |
+ |
|
4480 |
+var isHiddenWithinTree = function( elem, el ) { |
|
4481 |
+ |
|
4482 |
+ // isHiddenWithinTree might be called from jQuery#filter function; |
|
4483 |
+ // in that case, element will be second argument |
|
4484 |
+ elem = el || elem; |
|
4485 |
+ |
|
4486 |
+ // Inline style trumps all |
|
4487 |
+ return elem.style.display === "none" || |
|
4488 |
+ elem.style.display === "" && |
|
4489 |
+ |
|
4490 |
+ // Otherwise, check computed style |
|
4491 |
+ // Support: Firefox <=43 - 45 |
|
4492 |
+ // Disconnected elements can have computed display: none, so first confirm that elem is |
|
4493 |
+ // in the document. |
|
4494 |
+ jQuery.contains( elem.ownerDocument, elem ) && |
|
4495 |
+ |
|
4496 |
+ jQuery.css( elem, "display" ) === "none"; |
|
4497 |
+ }; |
|
4498 |
+ |
|
4499 |
+var swap = function( elem, options, callback, args ) { |
|
4500 |
+ var ret, name, |
|
4501 |
+ old = {}; |
|
4502 |
+ |
|
4503 |
+ // Remember the old values, and insert the new ones |
|
4504 |
+ for ( name in options ) { |
|
4505 |
+ old[ name ] = elem.style[ name ]; |
|
4506 |
+ elem.style[ name ] = options[ name ]; |
|
4507 |
+ } |
|
4508 |
+ |
|
4509 |
+ ret = callback.apply( elem, args || [] ); |
|
4510 |
+ |
|
4511 |
+ // Revert the old values |
|
4512 |
+ for ( name in options ) { |
|
4513 |
+ elem.style[ name ] = old[ name ]; |
|
4514 |
+ } |
|
4515 |
+ |
|
4516 |
+ return ret; |
|
4517 |
+}; |
|
4518 |
+ |
|
4519 |
+ |
|
4520 |
+ |
|
4521 |
+ |
|
4522 |
+function adjustCSS( elem, prop, valueParts, tween ) { |
|
4523 |
+ var adjusted, scale, |
|
4524 |
+ maxIterations = 20, |
|
4525 |
+ currentValue = tween ? |
|
4526 |
+ function() { |
|
4527 |
+ return tween.cur(); |
|
4528 |
+ } : |
|
4529 |
+ function() { |
|
4530 |
+ return jQuery.css( elem, prop, "" ); |
|
4531 |
+ }, |
|
4532 |
+ initial = currentValue(), |
|
4533 |
+ unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), |
|
4534 |
+ |
|
4535 |
+ // Starting value computation is required for potential unit mismatches |
|
4536 |
+ initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && |
|
4537 |
+ rcssNum.exec( jQuery.css( elem, prop ) ); |
|
4538 |
+ |
|
4539 |
+ if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { |
|
4540 |
+ |
|
4541 |
+ // Support: Firefox <=54 |
|
4542 |
+ // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) |
|
4543 |
+ initial = initial / 2; |
|
4544 |
+ |
|
4545 |
+ // Trust units reported by jQuery.css |
|
4546 |
+ unit = unit || initialInUnit[ 3 ]; |
|
4547 |
+ |
|
4548 |
+ // Iteratively approximate from a nonzero starting point |
|
4549 |
+ initialInUnit = +initial || 1; |
|
4550 |
+ |
|
4551 |
+ while ( maxIterations-- ) { |
|
4552 |
+ |
|
4553 |
+ // Evaluate and update our best guess (doubling guesses that zero out). |
|
4554 |
+ // Finish if the scale equals or crosses 1 (making the old*new product non-positive). |
|
4555 |
+ jQuery.style( elem, prop, initialInUnit + unit ); |
|
4556 |
+ if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { |
|
4557 |
+ maxIterations = 0; |
|
4558 |
+ } |
|
4559 |
+ initialInUnit = initialInUnit / scale; |
|
4560 |
+ |
|
4561 |
+ } |
|
4562 |
+ |
|
4563 |
+ initialInUnit = initialInUnit * 2; |
|
4564 |
+ jQuery.style( elem, prop, initialInUnit + unit ); |
|
4565 |
+ |
|
4566 |
+ // Make sure we update the tween properties later on |
|
4567 |
+ valueParts = valueParts || []; |
|
4568 |
+ } |
|
4569 |
+ |
|
4570 |
+ if ( valueParts ) { |
|
4571 |
+ initialInUnit = +initialInUnit || +initial || 0; |
|
4572 |
+ |
|
4573 |
+ // Apply relative offset (+=/-=) if specified |
|
4574 |
+ adjusted = valueParts[ 1 ] ? |
|
4575 |
+ initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : |
|
4576 |
+ +valueParts[ 2 ]; |
|
4577 |
+ if ( tween ) { |
|
4578 |
+ tween.unit = unit; |
|
4579 |
+ tween.start = initialInUnit; |
|
4580 |
+ tween.end = adjusted; |
|
4581 |
+ } |
|
4582 |
+ } |
|
4583 |
+ return adjusted; |
|
4584 |
+} |
|
4585 |
+ |
|
4586 |
+ |
|
4587 |
+var defaultDisplayMap = {}; |
|
4588 |
+ |
|
4589 |
+function getDefaultDisplay( elem ) { |
|
4590 |
+ var temp, |
|
4591 |
+ doc = elem.ownerDocument, |
|
4592 |
+ nodeName = elem.nodeName, |
|
4593 |
+ display = defaultDisplayMap[ nodeName ]; |
|
4594 |
+ |
|
4595 |
+ if ( display ) { |
|
4596 |
+ return display; |
|
4597 |
+ } |
|
4598 |
+ |
|
4599 |
+ temp = doc.body.appendChild( doc.createElement( nodeName ) ); |
|
4600 |
+ display = jQuery.css( temp, "display" ); |
|
4601 |
+ |
|
4602 |
+ temp.parentNode.removeChild( temp ); |
|
4603 |
+ |
|
4604 |
+ if ( display === "none" ) { |
|
4605 |
+ display = "block"; |
|
4606 |
+ } |
|
4607 |
+ defaultDisplayMap[ nodeName ] = display; |
|
4608 |
+ |
|
4609 |
+ return display; |
|
4610 |
+} |
|
4611 |
+ |
|
4612 |
+function showHide( elements, show ) { |
|
4613 |
+ var display, elem, |
|
4614 |
+ values = [], |
|
4615 |
+ index = 0, |
|
4616 |
+ length = elements.length; |
|
4617 |
+ |
|
4618 |
+ // Determine new display value for elements that need to change |
|
4619 |
+ for ( ; index < length; index++ ) { |
|
4620 |
+ elem = elements[ index ]; |
|
4621 |
+ if ( !elem.style ) { |
|
4622 |
+ continue; |
|
4623 |
+ } |
|
4624 |
+ |
|
4625 |
+ display = elem.style.display; |
|
4626 |
+ if ( show ) { |
|
4627 |
+ |
|
4628 |
+ // Since we force visibility upon cascade-hidden elements, an immediate (and slow) |
|
4629 |
+ // check is required in this first loop unless we have a nonempty display value (either |
|
4630 |
+ // inline or about-to-be-restored) |
|
4631 |
+ if ( display === "none" ) { |
|
4632 |
+ values[ index ] = dataPriv.get( elem, "display" ) || null; |
|
4633 |
+ if ( !values[ index ] ) { |
|
4634 |
+ elem.style.display = ""; |
|
4635 |
+ } |
|
4636 |
+ } |
|
4637 |
+ if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { |
|
4638 |
+ values[ index ] = getDefaultDisplay( elem ); |
|
4639 |
+ } |
|
4640 |
+ } else { |
|
4641 |
+ if ( display !== "none" ) { |
|
4642 |
+ values[ index ] = "none"; |
|
4643 |
+ |
|
4644 |
+ // Remember what we're overwriting |
|
4645 |
+ dataPriv.set( elem, "display", display ); |
|
4646 |
+ } |
|
4647 |
+ } |
|
4648 |
+ } |
|
4649 |
+ |
|
4650 |
+ // Set the display of the elements in a second loop to avoid constant reflow |
|
4651 |
+ for ( index = 0; index < length; index++ ) { |
|
4652 |
+ if ( values[ index ] != null ) { |
|
4653 |
+ elements[ index ].style.display = values[ index ]; |
|
4654 |
+ } |
|
4655 |
+ } |
|
4656 |
+ |
|
4657 |
+ return elements; |
|
4658 |
+} |
|
4659 |
+ |
|
4660 |
+jQuery.fn.extend( { |
|
4661 |
+ show: function() { |
|
4662 |
+ return showHide( this, true ); |
|
4663 |
+ }, |
|
4664 |
+ hide: function() { |
|
4665 |
+ return showHide( this ); |
|
4666 |
+ }, |
|
4667 |
+ toggle: function( state ) { |
|
4668 |
+ if ( typeof state === "boolean" ) { |
|
4669 |
+ return state ? this.show() : this.hide(); |
|
4670 |
+ } |
|
4671 |
+ |
|
4672 |
+ return this.each( function() { |
|
4673 |
+ if ( isHiddenWithinTree( this ) ) { |
|
4674 |
+ jQuery( this ).show(); |
|
4675 |
+ } else { |
|
4676 |
+ jQuery( this ).hide(); |
|
4677 |
+ } |
|
4678 |
+ } ); |
|
4679 |
+ } |
|
4680 |
+} ); |
|
4681 |
+var rcheckableType = ( /^(?:checkbox|radio)$/i ); |
|
4682 |
+ |
|
4683 |
+var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i ); |
|
4684 |
+ |
|
4685 |
+var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); |
|
4686 |
+ |
|
4687 |
+ |
|
4688 |
+ |
|
4689 |
+// We have to close these tags to support XHTML (#13200) |
|
4690 |
+var wrapMap = { |
|
4691 |
+ |
|
4692 |
+ // Support: IE <=9 only |
|
4693 |
+ option: [ 1, "<select multiple='multiple'>", "</select>" ], |
|
4694 |
+ |
|
4695 |
+ // XHTML parsers do not magically insert elements in the |
|
4696 |
+ // same way that tag soup parsers do. So we cannot shorten |
|
4697 |
+ // this by omitting <tbody> or other required elements. |
|
4698 |
+ thead: [ 1, "<table>", "</table>" ], |
|
4699 |
+ col: [ 2, "<table><colgroup>", "</colgroup></table>" ], |
|
4700 |
+ tr: [ 2, "<table><tbody>", "</tbody></table>" ], |
|
4701 |
+ td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], |
|
4702 |
+ |
|
4703 |
+ _default: [ 0, "", "" ] |
|
4704 |
+}; |
|
4705 |
+ |
|
4706 |
+// Support: IE <=9 only |
|
4707 |
+wrapMap.optgroup = wrapMap.option; |
|
4708 |
+ |
|
4709 |
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; |
|
4710 |
+wrapMap.th = wrapMap.td; |
|
4711 |
+ |
|
4712 |
+ |
|
4713 |
+function getAll( context, tag ) { |
|
4714 |
+ |
|
4715 |
+ // Support: IE <=9 - 11 only |
|
4716 |
+ // Use typeof to avoid zero-argument method invocation on host objects (#15151) |
|
4717 |
+ var ret; |
|
4718 |
+ |
|
4719 |
+ if ( typeof context.getElementsByTagName !== "undefined" ) { |
|
4720 |
+ ret = context.getElementsByTagName( tag || "*" ); |
|
4721 |
+ |
|
4722 |
+ } else if ( typeof context.querySelectorAll !== "undefined" ) { |
|
4723 |
+ ret = context.querySelectorAll( tag || "*" ); |
|
4724 |
+ |
|
4725 |
+ } else { |
|
4726 |
+ ret = []; |
|
4727 |
+ } |
|
4728 |
+ |
|
4729 |
+ if ( tag === undefined || tag && nodeName( context, tag ) ) { |
|
4730 |
+ return jQuery.merge( [ context ], ret ); |
|
4731 |
+ } |
|
4732 |
+ |
|
4733 |
+ return ret; |
|
4734 |
+} |
|
4735 |
+ |
|
4736 |
+ |
|
4737 |
+// Mark scripts as having already been evaluated |
|
4738 |
+function setGlobalEval( elems, refElements ) { |
|
4739 |
+ var i = 0, |
|
4740 |
+ l = elems.length; |
|
4741 |
+ |
|
4742 |
+ for ( ; i < l; i++ ) { |
|
4743 |
+ dataPriv.set( |
|
4744 |
+ elems[ i ], |
|
4745 |
+ "globalEval", |
|
4746 |
+ !refElements || dataPriv.get( refElements[ i ], "globalEval" ) |
|
4747 |
+ ); |
|
4748 |
+ } |
|
4749 |
+} |
|
4750 |
+ |
|
4751 |
+ |
|
4752 |
+var rhtml = /<|&#?\w+;/; |
|
4753 |
+ |
|
4754 |
+function buildFragment( elems, context, scripts, selection, ignored ) { |
|
4755 |
+ var elem, tmp, tag, wrap, contains, j, |
|
4756 |
+ fragment = context.createDocumentFragment(), |
|
4757 |
+ nodes = [], |
|
4758 |
+ i = 0, |
|
4759 |
+ l = elems.length; |
|
4760 |
+ |
|
4761 |
+ for ( ; i < l; i++ ) { |
|
4762 |
+ elem = elems[ i ]; |
|
4763 |
+ |
|
4764 |
+ if ( elem || elem === 0 ) { |
|
4765 |
+ |
|
4766 |
+ // Add nodes directly |
|
4767 |
+ if ( toType( elem ) === "object" ) { |
|
4768 |
+ |
|
4769 |
+ // Support: Android <=4.0 only, PhantomJS 1 only |
|
4770 |
+ // push.apply(_, arraylike) throws on ancient WebKit |
|
4771 |
+ jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); |
|
4772 |
+ |
|
4773 |
+ // Convert non-html into a text node |
|
4774 |
+ } else if ( !rhtml.test( elem ) ) { |
|
4775 |
+ nodes.push( context.createTextNode( elem ) ); |
|
4776 |
+ |
|
4777 |
+ // Convert html into DOM nodes |
|
4778 |
+ } else { |
|
4779 |
+ tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); |
|
4780 |
+ |
|
4781 |
+ // Deserialize a standard representation |
|
4782 |
+ tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); |
|
4783 |
+ wrap = wrapMap[ tag ] || wrapMap._default; |
|
4784 |
+ tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; |
|
4785 |
+ |
|
4786 |
+ // Descend through wrappers to the right content |
|
4787 |
+ j = wrap[ 0 ]; |
|
4788 |
+ while ( j-- ) { |
|
4789 |
+ tmp = tmp.lastChild; |
|
4790 |
+ } |
|
4791 |
+ |
|
4792 |
+ // Support: Android <=4.0 only, PhantomJS 1 only |
|
4793 |
+ // push.apply(_, arraylike) throws on ancient WebKit |
|
4794 |
+ jQuery.merge( nodes, tmp.childNodes ); |
|
4795 |
+ |
|
4796 |
+ // Remember the top-level container |
|
4797 |
+ tmp = fragment.firstChild; |
|
4798 |
+ |
|
4799 |
+ // Ensure the created nodes are orphaned (#12392) |
|
4800 |
+ tmp.textContent = ""; |
|
4801 |
+ } |
|
4802 |
+ } |
|
4803 |
+ } |
|
4804 |
+ |
|
4805 |
+ // Remove wrapper from fragment |
|
4806 |
+ fragment.textContent = ""; |
|
4807 |
+ |
|
4808 |
+ i = 0; |
|
4809 |
+ while ( ( elem = nodes[ i++ ] ) ) { |
|
4810 |
+ |
|
4811 |
+ // Skip elements already in the context collection (trac-4087) |
|
4812 |
+ if ( selection && jQuery.inArray( elem, selection ) > -1 ) { |
|
4813 |
+ if ( ignored ) { |
|
4814 |
+ ignored.push( elem ); |
|
4815 |
+ } |
|
4816 |
+ continue; |
|
4817 |
+ } |
|
4818 |
+ |
|
4819 |
+ contains = jQuery.contains( elem.ownerDocument, elem ); |
|
4820 |
+ |
|
4821 |
+ // Append to fragment |
|
4822 |
+ tmp = getAll( fragment.appendChild( elem ), "script" ); |
|
4823 |
+ |
|
4824 |
+ // Preserve script evaluation history |
|
4825 |
+ if ( contains ) { |
|
4826 |
+ setGlobalEval( tmp ); |
|
4827 |
+ } |
|
4828 |
+ |
|
4829 |
+ // Capture executables |
|
4830 |
+ if ( scripts ) { |
|
4831 |
+ j = 0; |
|
4832 |
+ while ( ( elem = tmp[ j++ ] ) ) { |
|
4833 |
+ if ( rscriptType.test( elem.type || "" ) ) { |
|
4834 |
+ scripts.push( elem ); |
|
4835 |
+ } |
|
4836 |
+ } |
|
4837 |
+ } |
|
4838 |
+ } |
|
4839 |
+ |
|
4840 |
+ return fragment; |
|
4841 |
+} |
|
4842 |
+ |
|
4843 |
+ |
|
4844 |
+( function() { |
|
4845 |
+ var fragment = document.createDocumentFragment(), |
|
4846 |
+ div = fragment.appendChild( document.createElement( "div" ) ), |
|
4847 |
+ input = document.createElement( "input" ); |
|
4848 |
+ |
|
4849 |
+ // Support: Android 4.0 - 4.3 only |
|
4850 |
+ // Check state lost if the name is set (#11217) |
|
4851 |
+ // Support: Windows Web Apps (WWA) |
|
4852 |
+ // `name` and `type` must use .setAttribute for WWA (#14901) |
|
4853 |
+ input.setAttribute( "type", "radio" ); |
|
4854 |
+ input.setAttribute( "checked", "checked" ); |
|
4855 |
+ input.setAttribute( "name", "t" ); |
|
4856 |
+ |
|
4857 |
+ div.appendChild( input ); |
|
4858 |
+ |
|
4859 |
+ // Support: Android <=4.1 only |
|
4860 |
+ // Older WebKit doesn't clone checked state correctly in fragments |
|
4861 |
+ support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; |
|
4862 |
+ |
|
4863 |
+ // Support: IE <=11 only |
|
4864 |
+ // Make sure textarea (and checkbox) defaultValue is properly cloned |
|
4865 |
+ div.innerHTML = "<textarea>x</textarea>"; |
|
4866 |
+ support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; |
|
4867 |
+} )(); |
|
4868 |
+var documentElement = document.documentElement; |
|
4869 |
+ |
|
4870 |
+ |
|
4871 |
+ |
|
4872 |
+var |
|
4873 |
+ rkeyEvent = /^key/, |
|
4874 |
+ rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, |
|
4875 |
+ rtypenamespace = /^([^.]*)(?:\.(.+)|)/; |
|
4876 |
+ |
|
4877 |
+function returnTrue() { |
|
4878 |
+ return true; |
|
4879 |
+} |
|
4880 |
+ |
|
4881 |
+function returnFalse() { |
|
4882 |
+ return false; |
|
4883 |
+} |
|
4884 |
+ |
|
4885 |
+// Support: IE <=9 only |
|
4886 |
+// See #13393 for more info |
|
4887 |
+function safeActiveElement() { |
|
4888 |
+ try { |
|
4889 |
+ return document.activeElement; |
|
4890 |
+ } catch ( err ) { } |
|
4891 |
+} |
|
4892 |
+ |
|
4893 |
+function on( elem, types, selector, data, fn, one ) { |
|
4894 |
+ var origFn, type; |
|
4895 |
+ |
|
4896 |
+ // Types can be a map of types/handlers |
|
4897 |
+ if ( typeof types === "object" ) { |
|
4898 |
+ |
|
4899 |
+ // ( types-Object, selector, data ) |
|
4900 |
+ if ( typeof selector !== "string" ) { |
|
4901 |
+ |
|
4902 |
+ // ( types-Object, data ) |
|
4903 |
+ data = data || selector; |
|
4904 |
+ selector = undefined; |
|
4905 |
+ } |
|
4906 |
+ for ( type in types ) { |
|
4907 |
+ on( elem, type, selector, data, types[ type ], one ); |
|
4908 |
+ } |
|
4909 |
+ return elem; |
|
4910 |
+ } |
|
4911 |
+ |
|
4912 |
+ if ( data == null && fn == null ) { |
|
4913 |
+ |
|
4914 |
+ // ( types, fn ) |
|
4915 |
+ fn = selector; |
|
4916 |
+ data = selector = undefined; |
|
4917 |
+ } else if ( fn == null ) { |
|
4918 |
+ if ( typeof selector === "string" ) { |
|
4919 |
+ |
|
4920 |
+ // ( types, selector, fn ) |
|
4921 |
+ fn = data; |
|
4922 |
+ data = undefined; |
|
4923 |
+ } else { |
|
4924 |
+ |
|
4925 |
+ // ( types, data, fn ) |
|
4926 |
+ fn = data; |
|
4927 |
+ data = selector; |
|
4928 |
+ selector = undefined; |
|
4929 |
+ } |
|
4930 |
+ } |
|
4931 |
+ if ( fn === false ) { |
|
4932 |
+ fn = returnFalse; |
|
4933 |
+ } else if ( !fn ) { |
|
4934 |
+ return elem; |
|
4935 |
+ } |
|
4936 |
+ |
|
4937 |
+ if ( one === 1 ) { |
|
4938 |
+ origFn = fn; |
|
4939 |
+ fn = function( event ) { |
|
4940 |
+ |
|
4941 |
+ // Can use an empty set, since event contains the info |
|
4942 |
+ jQuery().off( event ); |
|
4943 |
+ return origFn.apply( this, arguments ); |
|
4944 |
+ }; |
|
4945 |
+ |
|
4946 |
+ // Use same guid so caller can remove using origFn |
|
4947 |
+ fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); |
|
4948 |
+ } |
|
4949 |
+ return elem.each( function() { |
|
4950 |
+ jQuery.event.add( this, types, fn, data, selector ); |
|
4951 |
+ } ); |
|
4952 |
+} |
|
4953 |
+ |
|
4954 |
+/* |
|
4955 |
+ * Helper functions for managing events -- not part of the public interface. |
|
4956 |
+ * Props to Dean Edwards' addEvent library for many of the ideas. |
|
4957 |
+ */ |
|
4958 |
+jQuery.event = { |
|
4959 |
+ |
|
4960 |
+ global: {}, |
|
4961 |
+ |
|
4962 |
+ add: function( elem, types, handler, data, selector ) { |
|
4963 |
+ |
|
4964 |
+ var handleObjIn, eventHandle, tmp, |
|
4965 |
+ events, t, handleObj, |
|
4966 |
+ special, handlers, type, namespaces, origType, |
|
4967 |
+ elemData = dataPriv.get( elem ); |
|
4968 |
+ |
|
4969 |
+ // Don't attach events to noData or text/comment nodes (but allow plain objects) |
|
4970 |
+ if ( !elemData ) { |
|
4971 |
+ return; |
|
4972 |
+ } |
|
4973 |
+ |
|
4974 |
+ // Caller can pass in an object of custom data in lieu of the handler |
|
4975 |
+ if ( handler.handler ) { |
|
4976 |
+ handleObjIn = handler; |
|
4977 |
+ handler = handleObjIn.handler; |
|
4978 |
+ selector = handleObjIn.selector; |
|
4979 |
+ } |
|
4980 |
+ |
|
4981 |
+ // Ensure that invalid selectors throw exceptions at attach time |
|
4982 |
+ // Evaluate against documentElement in case elem is a non-element node (e.g., document) |
|
4983 |
+ if ( selector ) { |
|
4984 |
+ jQuery.find.matchesSelector( documentElement, selector ); |
|
4985 |
+ } |
|
4986 |
+ |
|
4987 |
+ // Make sure that the handler has a unique ID, used to find/remove it later |
|
4988 |
+ if ( !handler.guid ) { |
|
4989 |
+ handler.guid = jQuery.guid++; |
|
4990 |
+ } |
|
4991 |
+ |
|
4992 |
+ // Init the element's event structure and main handler, if this is the first |
|
4993 |
+ if ( !( events = elemData.events ) ) { |
|
4994 |
+ events = elemData.events = {}; |
|
4995 |
+ } |
|
4996 |
+ if ( !( eventHandle = elemData.handle ) ) { |
|
4997 |
+ eventHandle = elemData.handle = function( e ) { |
|
4998 |
+ |
|
4999 |
+ // Discard the second event of a jQuery.event.trigger() and |
|
5000 |
+ // when an event is called after a page has unloaded |
|
5001 |
+ return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? |
|
5002 |
+ jQuery.event.dispatch.apply( elem, arguments ) : undefined; |
|
5003 |
+ }; |
|
5004 |
+ } |
|
5005 |
+ |
|
5006 |
+ // Handle multiple events separated by a space |
|
5007 |
+ types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; |
|
5008 |
+ t = types.length; |
|
5009 |
+ while ( t-- ) { |
|
5010 |
+ tmp = rtypenamespace.exec( types[ t ] ) || []; |
|
5011 |
+ type = origType = tmp[ 1 ]; |
|
5012 |
+ namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); |
|
5013 |
+ |
|
5014 |
+ // There *must* be a type, no attaching namespace-only handlers |
|
5015 |
+ if ( !type ) { |
|
5016 |
+ continue; |
|
5017 |
+ } |
|
5018 |
+ |
|
5019 |
+ // If event changes its type, use the special event handlers for the changed type |
|
5020 |
+ special = jQuery.event.special[ type ] || {}; |
|
5021 |
+ |
|
5022 |
+ // If selector defined, determine special event api type, otherwise given type |
|
5023 |
+ type = ( selector ? special.delegateType : special.bindType ) || type; |
|
5024 |
+ |
|
5025 |
+ // Update special based on newly reset type |
|
5026 |
+ special = jQuery.event.special[ type ] || {}; |
|
5027 |
+ |
|
5028 |
+ // handleObj is passed to all event handlers |
|
5029 |
+ handleObj = jQuery.extend( { |
|
5030 |
+ type: type, |
|
5031 |
+ origType: origType, |
|
5032 |
+ data: data, |
|
5033 |
+ handler: handler, |
|
5034 |
+ guid: handler.guid, |
|
5035 |
+ selector: selector, |
|
5036 |
+ needsContext: selector && jQuery.expr.match.needsContext.test( selector ), |
|
5037 |
+ namespace: namespaces.join( "." ) |
|
5038 |
+ }, handleObjIn ); |
|
5039 |
+ |
|
5040 |
+ // Init the event handler queue if we're the first |
|
5041 |
+ if ( !( handlers = events[ type ] ) ) { |
|
5042 |
+ handlers = events[ type ] = []; |
|
5043 |
+ handlers.delegateCount = 0; |
|
5044 |
+ |
|
5045 |
+ // Only use addEventListener if the special events handler returns false |
|
5046 |
+ if ( !special.setup || |
|
5047 |
+ special.setup.call( elem, data, namespaces, eventHandle ) === false ) { |
|
5048 |
+ |
|
5049 |
+ if ( elem.addEventListener ) { |
|
5050 |
+ elem.addEventListener( type, eventHandle ); |
|
5051 |
+ } |
|
5052 |
+ } |
|
5053 |
+ } |
|
5054 |
+ |
|
5055 |
+ if ( special.add ) { |
|
5056 |
+ special.add.call( elem, handleObj ); |
|
5057 |
+ |
|
5058 |
+ if ( !handleObj.handler.guid ) { |
|
5059 |
+ handleObj.handler.guid = handler.guid; |
|
5060 |
+ } |
|
5061 |
+ } |
|
5062 |
+ |
|
5063 |
+ // Add to the element's handler list, delegates in front |
|
5064 |
+ if ( selector ) { |
|
5065 |
+ handlers.splice( handlers.delegateCount++, 0, handleObj ); |
|
5066 |
+ } else { |
|
5067 |
+ handlers.push( handleObj ); |
|
5068 |
+ } |
|
5069 |
+ |
|
5070 |
+ // Keep track of which events have ever been used, for event optimization |
|
5071 |
+ jQuery.event.global[ type ] = true; |
|
5072 |
+ } |
|
5073 |
+ |
|
5074 |
+ }, |
|
5075 |
+ |
|
5076 |
+ // Detach an event or set of events from an element |
|
5077 |
+ remove: function( elem, types, handler, selector, mappedTypes ) { |
|
5078 |
+ |
|
5079 |
+ var j, origCount, tmp, |
|
5080 |
+ events, t, handleObj, |
|
5081 |
+ special, handlers, type, namespaces, origType, |
|
5082 |
+ elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); |
|
5083 |
+ |
|
5084 |
+ if ( !elemData || !( events = elemData.events ) ) { |
|
5085 |
+ return; |
|
5086 |
+ } |
|
5087 |
+ |
|
5088 |
+ // Once for each type.namespace in types; type may be omitted |
|
5089 |
+ types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; |
|
5090 |
+ t = types.length; |
|
5091 |
+ while ( t-- ) { |
|
5092 |
+ tmp = rtypenamespace.exec( types[ t ] ) || []; |
|
5093 |
+ type = origType = tmp[ 1 ]; |
|
5094 |
+ namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); |
|
5095 |
+ |
|
5096 |
+ // Unbind all events (on this namespace, if provided) for the element |
|
5097 |
+ if ( !type ) { |
|
5098 |
+ for ( type in events ) { |
|
5099 |
+ jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); |
|
5100 |
+ } |
|
5101 |
+ continue; |
|
5102 |
+ } |
|
5103 |
+ |
|
5104 |
+ special = jQuery.event.special[ type ] || {}; |
|
5105 |
+ type = ( selector ? special.delegateType : special.bindType ) || type; |
|
5106 |
+ handlers = events[ type ] || []; |
|
5107 |
+ tmp = tmp[ 2 ] && |
|
5108 |
+ new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); |
|
5109 |
+ |
|
5110 |
+ // Remove matching events |
|
5111 |
+ origCount = j = handlers.length; |
|
5112 |
+ while ( j-- ) { |
|
5113 |
+ handleObj = handlers[ j ]; |
|
5114 |
+ |
|
5115 |
+ if ( ( mappedTypes || origType === handleObj.origType ) && |
|
5116 |
+ ( !handler || handler.guid === handleObj.guid ) && |
|
5117 |
+ ( !tmp || tmp.test( handleObj.namespace ) ) && |
|
5118 |
+ ( !selector || selector === handleObj.selector || |
|
5119 |
+ selector === "**" && handleObj.selector ) ) { |
|
5120 |
+ handlers.splice( j, 1 ); |
|
5121 |
+ |
|
5122 |
+ if ( handleObj.selector ) { |
|
5123 |
+ handlers.delegateCount--; |
|
5124 |
+ } |
|
5125 |
+ if ( special.remove ) { |
|
5126 |
+ special.remove.call( elem, handleObj ); |
|
5127 |
+ } |
|
5128 |
+ } |
|
5129 |
+ } |
|
5130 |
+ |
|
5131 |
+ // Remove generic event handler if we removed something and no more handlers exist |
|
5132 |
+ // (avoids potential for endless recursion during removal of special event handlers) |
|
5133 |
+ if ( origCount && !handlers.length ) { |
|
5134 |
+ if ( !special.teardown || |
|
5135 |
+ special.teardown.call( elem, namespaces, elemData.handle ) === false ) { |
|
5136 |
+ |
|
5137 |
+ jQuery.removeEvent( elem, type, elemData.handle ); |
|
5138 |
+ } |
|
5139 |
+ |
|
5140 |
+ delete events[ type ]; |
|
5141 |
+ } |
|
5142 |
+ } |
|
5143 |
+ |
|
5144 |
+ // Remove data and the expando if it's no longer used |
|
5145 |
+ if ( jQuery.isEmptyObject( events ) ) { |
|
5146 |
+ dataPriv.remove( elem, "handle events" ); |
|
5147 |
+ } |
|
5148 |
+ }, |
|
5149 |
+ |
|
5150 |
+ dispatch: function( nativeEvent ) { |
|
5151 |
+ |
|
5152 |
+ // Make a writable jQuery.Event from the native event object |
|
5153 |
+ var event = jQuery.event.fix( nativeEvent ); |
|
5154 |
+ |
|
5155 |
+ var i, j, ret, matched, handleObj, handlerQueue, |
|
5156 |
+ args = new Array( arguments.length ), |
|
5157 |
+ handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], |
|
5158 |
+ special = jQuery.event.special[ event.type ] || {}; |
|
5159 |
+ |
|
5160 |
+ // Use the fix-ed jQuery.Event rather than the (read-only) native event |
|
5161 |
+ args[ 0 ] = event; |
|
5162 |
+ |
|
5163 |
+ for ( i = 1; i < arguments.length; i++ ) { |
|
5164 |
+ args[ i ] = arguments[ i ]; |
|
5165 |
+ } |
|
5166 |
+ |
|
5167 |
+ event.delegateTarget = this; |
|
5168 |
+ |
|
5169 |
+ // Call the preDispatch hook for the mapped type, and let it bail if desired |
|
5170 |
+ if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { |
|
5171 |
+ return; |
|
5172 |
+ } |
|
5173 |
+ |
|
5174 |
+ // Determine handlers |
|
5175 |
+ handlerQueue = jQuery.event.handlers.call( this, event, handlers ); |
|
5176 |
+ |
|
5177 |
+ // Run delegates first; they may want to stop propagation beneath us |
|
5178 |
+ i = 0; |
|
5179 |
+ while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { |
|
5180 |
+ event.currentTarget = matched.elem; |
|
5181 |
+ |
|
5182 |
+ j = 0; |
|
5183 |
+ while ( ( handleObj = matched.handlers[ j++ ] ) && |
|
5184 |
+ !event.isImmediatePropagationStopped() ) { |
|
5185 |
+ |
|
5186 |
+ // Triggered event must either 1) have no namespace, or 2) have namespace(s) |
|
5187 |
+ // a subset or equal to those in the bound event (both can have no namespace). |
|
5188 |
+ if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { |
|
5189 |
+ |
|
5190 |
+ event.handleObj = handleObj; |
|
5191 |
+ event.data = handleObj.data; |
|
5192 |
+ |
|
5193 |
+ ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || |
|
5194 |
+ handleObj.handler ).apply( matched.elem, args ); |
|
5195 |
+ |
|
5196 |
+ if ( ret !== undefined ) { |
|
5197 |
+ if ( ( event.result = ret ) === false ) { |
|
5198 |
+ event.preventDefault(); |
|
5199 |
+ event.stopPropagation(); |
|
5200 |
+ } |
|
5201 |
+ } |
|
5202 |
+ } |
|
5203 |
+ } |
|
5204 |
+ } |
|
5205 |
+ |
|
5206 |
+ // Call the postDispatch hook for the mapped type |
|
5207 |
+ if ( special.postDispatch ) { |
|
5208 |
+ special.postDispatch.call( this, event ); |
|
5209 |
+ } |
|
5210 |
+ |
|
5211 |
+ return event.result; |
|
5212 |
+ }, |
|
5213 |
+ |
|
5214 |
+ handlers: function( event, handlers ) { |
|
5215 |
+ var i, handleObj, sel, matchedHandlers, matchedSelectors, |
|
5216 |
+ handlerQueue = [], |
|
5217 |
+ delegateCount = handlers.delegateCount, |
|
5218 |
+ cur = event.target; |
|
5219 |
+ |
|
5220 |
+ // Find delegate handlers |
|
5221 |
+ if ( delegateCount && |
|
5222 |
+ |
|
5223 |
+ // Support: IE <=9 |
|
5224 |
+ // Black-hole SVG <use> instance trees (trac-13180) |
|
5225 |
+ cur.nodeType && |
|
5226 |
+ |
|
5227 |
+ // Support: Firefox <=42 |
|
5228 |
+ // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) |
|
5229 |
+ // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click |
|
5230 |
+ // Support: IE 11 only |
|
5231 |
+ // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) |
|
5232 |
+ !( event.type === "click" && event.button >= 1 ) ) { |
|
5233 |
+ |
|
5234 |
+ for ( ; cur !== this; cur = cur.parentNode || this ) { |
|
5235 |
+ |
|
5236 |
+ // Don't check non-elements (#13208) |
|
5237 |
+ // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) |
|
5238 |
+ if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { |
|
5239 |
+ matchedHandlers = []; |
|
5240 |
+ matchedSelectors = {}; |
|
5241 |
+ for ( i = 0; i < delegateCount; i++ ) { |
|
5242 |
+ handleObj = handlers[ i ]; |
|
5243 |
+ |
|
5244 |
+ // Don't conflict with Object.prototype properties (#13203) |
|
5245 |
+ sel = handleObj.selector + " "; |
|
5246 |
+ |
|
5247 |
+ if ( matchedSelectors[ sel ] === undefined ) { |
|
5248 |
+ matchedSelectors[ sel ] = handleObj.needsContext ? |
|
5249 |
+ jQuery( sel, this ).index( cur ) > -1 : |
|
5250 |
+ jQuery.find( sel, this, null, [ cur ] ).length; |
|
5251 |
+ } |
|
5252 |
+ if ( matchedSelectors[ sel ] ) { |
|
5253 |
+ matchedHandlers.push( handleObj ); |
|
5254 |
+ } |
|
5255 |
+ } |
|
5256 |
+ if ( matchedHandlers.length ) { |
|
5257 |
+ handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); |
|
5258 |
+ } |
|
5259 |
+ } |
|
5260 |
+ } |
|
5261 |
+ } |
|
5262 |
+ |
|
5263 |
+ // Add the remaining (directly-bound) handlers |
|
5264 |
+ cur = this; |
|
5265 |
+ if ( delegateCount < handlers.length ) { |
|
5266 |
+ handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); |
|
5267 |
+ } |
|
5268 |
+ |
|
5269 |
+ return handlerQueue; |
|
5270 |
+ }, |
|
5271 |
+ |
|
5272 |
+ addProp: function( name, hook ) { |
|
5273 |
+ Object.defineProperty( jQuery.Event.prototype, name, { |
|
5274 |
+ enumerable: true, |
|
5275 |
+ configurable: true, |
|
5276 |
+ |
|
5277 |
+ get: isFunction( hook ) ? |
|
5278 |
+ function() { |
|
5279 |
+ if ( this.originalEvent ) { |
|
5280 |
+ return hook( this.originalEvent ); |
|
5281 |
+ } |
|
5282 |
+ } : |
|
5283 |
+ function() { |
|
5284 |
+ if ( this.originalEvent ) { |
|
5285 |
+ return this.originalEvent[ name ]; |
|
5286 |
+ } |
|
5287 |
+ }, |
|
5288 |
+ |
|
5289 |
+ set: function( value ) { |
|
5290 |
+ Object.defineProperty( this, name, { |
|
5291 |
+ enumerable: true, |
|
5292 |
+ configurable: true, |
|
5293 |
+ writable: true, |
|
5294 |
+ value: value |
|
5295 |
+ } ); |
|
5296 |
+ } |
|
5297 |
+ } ); |
|
5298 |
+ }, |
|
5299 |
+ |
|
5300 |
+ fix: function( originalEvent ) { |
|
5301 |
+ return originalEvent[ jQuery.expando ] ? |
|
5302 |
+ originalEvent : |
|
5303 |
+ new jQuery.Event( originalEvent ); |
|
5304 |
+ }, |
|
5305 |
+ |
|
5306 |
+ special: { |
|
5307 |
+ load: { |
|
5308 |
+ |
|
5309 |
+ // Prevent triggered image.load events from bubbling to window.load |
|
5310 |
+ noBubble: true |
|
5311 |
+ }, |
|
5312 |
+ focus: { |
|
5313 |
+ |
|
5314 |
+ // Fire native event if possible so blur/focus sequence is correct |
|
5315 |
+ trigger: function() { |
|
5316 |
+ if ( this !== safeActiveElement() && this.focus ) { |
|
5317 |
+ this.focus(); |
|
5318 |
+ return false; |
|
5319 |
+ } |
|
5320 |
+ }, |
|
5321 |
+ delegateType: "focusin" |
|
5322 |
+ }, |
|
5323 |
+ blur: { |
|
5324 |
+ trigger: function() { |
|
5325 |
+ if ( this === safeActiveElement() && this.blur ) { |
|
5326 |
+ this.blur(); |
|
5327 |
+ return false; |
|
5328 |
+ } |
|
5329 |
+ }, |
|
5330 |
+ delegateType: "focusout" |
|
5331 |
+ }, |
|
5332 |
+ click: { |
|
5333 |
+ |
|
5334 |
+ // For checkbox, fire native event so checked state will be right |
|
5335 |
+ trigger: function() { |
|
5336 |
+ if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) { |
|
5337 |
+ this.click(); |
|
5338 |
+ return false; |
|
5339 |
+ } |
|
5340 |
+ }, |
|
5341 |
+ |
|
5342 |
+ // For cross-browser consistency, don't fire native .click() on links |
|
5343 |
+ _default: function( event ) { |
|
5344 |
+ return nodeName( event.target, "a" ); |
|
5345 |
+ } |
|
5346 |
+ }, |
|
5347 |
+ |
|
5348 |
+ beforeunload: { |
|
5349 |
+ postDispatch: function( event ) { |
|
5350 |
+ |
|
5351 |
+ // Support: Firefox 20+ |
|
5352 |
+ // Firefox doesn't alert if the returnValue field is not set. |
|
5353 |
+ if ( event.result !== undefined && event.originalEvent ) { |
|
5354 |
+ event.originalEvent.returnValue = event.result; |
|
5355 |
+ } |
|
5356 |
+ } |
|
5357 |
+ } |
|
5358 |
+ } |
|
5359 |
+}; |
|
5360 |
+ |
|
5361 |
+jQuery.removeEvent = function( elem, type, handle ) { |
|
5362 |
+ |
|
5363 |
+ // This "if" is needed for plain objects |
|
5364 |
+ if ( elem.removeEventListener ) { |
|
5365 |
+ elem.removeEventListener( type, handle ); |
|
5366 |
+ } |
|
5367 |
+}; |
|
5368 |
+ |
|
5369 |
+jQuery.Event = function( src, props ) { |
|
5370 |
+ |
|
5371 |
+ // Allow instantiation without the 'new' keyword |
|
5372 |
+ if ( !( this instanceof jQuery.Event ) ) { |
|
5373 |
+ return new jQuery.Event( src, props ); |
|
5374 |
+ } |
|
5375 |
+ |
|
5376 |
+ // Event object |
|
5377 |
+ if ( src && src.type ) { |
|
5378 |
+ this.originalEvent = src; |
|
5379 |
+ this.type = src.type; |
|
5380 |
+ |
|
5381 |
+ // Events bubbling up the document may have been marked as prevented |
|
5382 |
+ // by a handler lower down the tree; reflect the correct value. |
|
5383 |
+ this.isDefaultPrevented = src.defaultPrevented || |
|
5384 |
+ src.defaultPrevented === undefined && |
|
5385 |
+ |
|
5386 |
+ // Support: Android <=2.3 only |
|
5387 |
+ src.returnValue === false ? |
|
5388 |
+ returnTrue : |
|
5389 |
+ returnFalse; |
|
5390 |
+ |
|
5391 |
+ // Create target properties |
|
5392 |
+ // Support: Safari <=6 - 7 only |
|
5393 |
+ // Target should not be a text node (#504, #13143) |
|
5394 |
+ this.target = ( src.target && src.target.nodeType === 3 ) ? |
|
5395 |
+ src.target.parentNode : |
|
5396 |
+ src.target; |
|
5397 |
+ |
|
5398 |
+ this.currentTarget = src.currentTarget; |
|
5399 |
+ this.relatedTarget = src.relatedTarget; |
|
5400 |
+ |
|
5401 |
+ // Event type |
|
5402 |
+ } else { |
|
5403 |
+ this.type = src; |
|
5404 |
+ } |
|
5405 |
+ |
|
5406 |
+ // Put explicitly provided properties onto the event object |
|
5407 |
+ if ( props ) { |
|
5408 |
+ jQuery.extend( this, props ); |
|
5409 |
+ } |
|
5410 |
+ |
|
5411 |
+ // Create a timestamp if incoming event doesn't have one |
|
5412 |
+ this.timeStamp = src && src.timeStamp || Date.now(); |
|
5413 |
+ |
|
5414 |
+ // Mark it as fixed |
|
5415 |
+ this[ jQuery.expando ] = true; |
|
5416 |
+}; |
|
5417 |
+ |
|
5418 |
+// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding |
|
5419 |
+// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html |
|
5420 |
+jQuery.Event.prototype = { |
|
5421 |
+ constructor: jQuery.Event, |
|
5422 |
+ isDefaultPrevented: returnFalse, |
|
5423 |
+ isPropagationStopped: returnFalse, |
|
5424 |
+ isImmediatePropagationStopped: returnFalse, |
|
5425 |
+ isSimulated: false, |
|
5426 |
+ |
|
5427 |
+ preventDefault: function() { |
|
5428 |
+ var e = this.originalEvent; |
|
5429 |
+ |
|
5430 |
+ this.isDefaultPrevented = returnTrue; |
|
5431 |
+ |
|
5432 |
+ if ( e && !this.isSimulated ) { |
|
5433 |
+ e.preventDefault(); |
|
5434 |
+ } |
|
5435 |
+ }, |
|
5436 |
+ stopPropagation: function() { |
|
5437 |
+ var e = this.originalEvent; |
|
5438 |
+ |
|
5439 |
+ this.isPropagationStopped = returnTrue; |
|
5440 |
+ |
|
5441 |
+ if ( e && !this.isSimulated ) { |
|
5442 |
+ e.stopPropagation(); |
|
5443 |
+ } |
|
5444 |
+ }, |
|
5445 |
+ stopImmediatePropagation: function() { |
|
5446 |
+ var e = this.originalEvent; |
|
5447 |
+ |
|
5448 |
+ this.isImmediatePropagationStopped = returnTrue; |
|
5449 |
+ |
|
5450 |
+ if ( e && !this.isSimulated ) { |
|
5451 |
+ e.stopImmediatePropagation(); |
|
5452 |
+ } |
|
5453 |
+ |
|
5454 |
+ this.stopPropagation(); |
|
5455 |
+ } |
|
5456 |
+}; |
|
5457 |
+ |
|
5458 |
+// Includes all common event props including KeyEvent and MouseEvent specific props |
|
5459 |
+jQuery.each( { |
|
5460 |
+ altKey: true, |
|
5461 |
+ bubbles: true, |
|
5462 |
+ cancelable: true, |
|
5463 |
+ changedTouches: true, |
|
5464 |
+ ctrlKey: true, |
|
5465 |
+ detail: true, |
|
5466 |
+ eventPhase: true, |
|
5467 |
+ metaKey: true, |
|
5468 |
+ pageX: true, |
|
5469 |
+ pageY: true, |
|
5470 |
+ shiftKey: true, |
|
5471 |
+ view: true, |
|
5472 |
+ "char": true, |
|
5473 |
+ charCode: true, |
|
5474 |
+ key: true, |
|
5475 |
+ keyCode: true, |
|
5476 |
+ button: true, |
|
5477 |
+ buttons: true, |
|
5478 |
+ clientX: true, |
|
5479 |
+ clientY: true, |
|
5480 |
+ offsetX: true, |
|
5481 |
+ offsetY: true, |
|
5482 |
+ pointerId: true, |
|
5483 |
+ pointerType: true, |
|
5484 |
+ screenX: true, |
|
5485 |
+ screenY: true, |
|
5486 |
+ targetTouches: true, |
|
5487 |
+ toElement: true, |
|
5488 |
+ touches: true, |
|
5489 |
+ |
|
5490 |
+ which: function( event ) { |
|
5491 |
+ var button = event.button; |
|
5492 |
+ |
|
5493 |
+ // Add which for key events |
|
5494 |
+ if ( event.which == null && rkeyEvent.test( event.type ) ) { |
|
5495 |
+ return event.charCode != null ? event.charCode : event.keyCode; |
|
5496 |
+ } |
|
5497 |
+ |
|
5498 |
+ // Add which for click: 1 === left; 2 === middle; 3 === right |
|
5499 |
+ if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { |
|
5500 |
+ if ( button & 1 ) { |
|
5501 |
+ return 1; |
|
5502 |
+ } |
|
5503 |
+ |
|
5504 |
+ if ( button & 2 ) { |
|
5505 |
+ return 3; |
|
5506 |
+ } |
|
5507 |
+ |
|
5508 |
+ if ( button & 4 ) { |
|
5509 |
+ return 2; |
|
5510 |
+ } |
|
5511 |
+ |
|
5512 |
+ return 0; |
|
5513 |
+ } |
|
5514 |
+ |
|
5515 |
+ return event.which; |
|
5516 |
+ } |
|
5517 |
+}, jQuery.event.addProp ); |
|
5518 |
+ |
|
5519 |
+// Create mouseenter/leave events using mouseover/out and event-time checks |
|
5520 |
+// so that event delegation works in jQuery. |
|
5521 |
+// Do the same for pointerenter/pointerleave and pointerover/pointerout |
|
5522 |
+// |
|
5523 |
+// Support: Safari 7 only |
|
5524 |
+// Safari sends mouseenter too often; see: |
|
5525 |
+// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 |
|
5526 |
+// for the description of the bug (it existed in older Chrome versions as well). |
|
5527 |
+jQuery.each( { |
|
5528 |
+ mouseenter: "mouseover", |
|
5529 |
+ mouseleave: "mouseout", |
|
5530 |
+ pointerenter: "pointerover", |
|
5531 |
+ pointerleave: "pointerout" |
|
5532 |
+}, function( orig, fix ) { |
|
5533 |
+ jQuery.event.special[ orig ] = { |
|
5534 |
+ delegateType: fix, |
|
5535 |
+ bindType: fix, |
|
5536 |
+ |
|
5537 |
+ handle: function( event ) { |
|
5538 |
+ var ret, |
|
5539 |
+ target = this, |
|
5540 |
+ related = event.relatedTarget, |
|
5541 |
+ handleObj = event.handleObj; |
|
5542 |
+ |
|
5543 |
+ // For mouseenter/leave call the handler if related is outside the target. |
|
5544 |
+ // NB: No relatedTarget if the mouse left/entered the browser window |
|
5545 |
+ if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { |
|
5546 |
+ event.type = handleObj.origType; |
|
5547 |
+ ret = handleObj.handler.apply( this, arguments ); |
|
5548 |
+ event.type = fix; |
|
5549 |
+ } |
|
5550 |
+ return ret; |
|
5551 |
+ } |
|
5552 |
+ }; |
|
5553 |
+} ); |
|
5554 |
+ |
|
5555 |
+jQuery.fn.extend( { |
|
5556 |
+ |
|
5557 |
+ on: function( types, selector, data, fn ) { |
|
5558 |
+ return on( this, types, selector, data, fn ); |
|
5559 |
+ }, |
|
5560 |
+ one: function( types, selector, data, fn ) { |
|
5561 |
+ return on( this, types, selector, data, fn, 1 ); |
|
5562 |
+ }, |
|
5563 |
+ off: function( types, selector, fn ) { |
|
5564 |
+ var handleObj, type; |
|
5565 |
+ if ( types && types.preventDefault && types.handleObj ) { |
|
5566 |
+ |
|
5567 |
+ // ( event ) dispatched jQuery.Event |
|
5568 |
+ handleObj = types.handleObj; |
|
5569 |
+ jQuery( types.delegateTarget ).off( |
|
5570 |
+ handleObj.namespace ? |
|
5571 |
+ handleObj.origType + "." + handleObj.namespace : |
|
5572 |
+ handleObj.origType, |
|
5573 |
+ handleObj.selector, |
|
5574 |
+ handleObj.handler |
|
5575 |
+ ); |
|
5576 |
+ return this; |
|
5577 |
+ } |
|
5578 |
+ if ( typeof types === "object" ) { |
|
5579 |
+ |
|
5580 |
+ // ( types-object [, selector] ) |
|
5581 |
+ for ( type in types ) { |
|
5582 |
+ this.off( type, selector, types[ type ] ); |
|
5583 |
+ } |
|
5584 |
+ return this; |
|
5585 |
+ } |
|
5586 |
+ if ( selector === false || typeof selector === "function" ) { |
|
5587 |
+ |
|
5588 |
+ // ( types [, fn] ) |
|
5589 |
+ fn = selector; |
|
5590 |
+ selector = undefined; |
|
5591 |
+ } |
|
5592 |
+ if ( fn === false ) { |
|
5593 |
+ fn = returnFalse; |
|
5594 |
+ } |
|
5595 |
+ return this.each( function() { |
|
5596 |
+ jQuery.event.remove( this, types, fn, selector ); |
|
5597 |
+ } ); |
|
5598 |
+ } |
|
5599 |
+} ); |
|
5600 |
+ |
|
5601 |
+ |
|
5602 |
+var |
|
5603 |
+ |
|
5604 |
+ /* eslint-disable max-len */ |
|
5605 |
+ |
|
5606 |
+ // See https://github.com/eslint/eslint/issues/3229 |
|
5607 |
+ rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, |
|
5608 |
+ |
|
5609 |
+ /* eslint-enable */ |
|
5610 |
+ |
|
5611 |
+ // Support: IE <=10 - 11, Edge 12 - 13 only |
|
5612 |
+ // In IE/Edge using regex groups here causes severe slowdowns. |
|
5613 |
+ // See https://connect.microsoft.com/IE/feedback/details/1736512/ |
|
5614 |
+ rnoInnerhtml = /<script|<style|<link/i, |
|
5615 |
+ |
|
5616 |
+ // checked="checked" or checked |
|
5617 |
+ rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, |
|
5618 |
+ rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; |
|
5619 |
+ |
|
5620 |
+// Prefer a tbody over its parent table for containing new rows |
|
5621 |
+function manipulationTarget( elem, content ) { |
|
5622 |
+ if ( nodeName( elem, "table" ) && |
|
5623 |
+ nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { |
|
5624 |
+ |
|
5625 |
+ return jQuery( elem ).children( "tbody" )[ 0 ] || elem; |
|
5626 |
+ } |
|
5627 |
+ |
|
5628 |
+ return elem; |
|
5629 |
+} |
|
5630 |
+ |
|
5631 |
+// Replace/restore the type attribute of script elements for safe DOM manipulation |
|
5632 |
+function disableScript( elem ) { |
|
5633 |
+ elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; |
|
5634 |
+ return elem; |
|
5635 |
+} |
|
5636 |
+function restoreScript( elem ) { |
|
5637 |
+ if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { |
|
5638 |
+ elem.type = elem.type.slice( 5 ); |
|
5639 |
+ } else { |
|
5640 |
+ elem.removeAttribute( "type" ); |
|
5641 |
+ } |
|
5642 |
+ |
|
5643 |
+ return elem; |
|
5644 |
+} |
|
5645 |
+ |
|
5646 |
+function cloneCopyEvent( src, dest ) { |
|
5647 |
+ var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; |
|
5648 |
+ |
|
5649 |
+ if ( dest.nodeType !== 1 ) { |
|
5650 |
+ return; |
|
5651 |
+ } |
|
5652 |
+ |
|
5653 |
+ // 1. Copy private data: events, handlers, etc. |
|
5654 |
+ if ( dataPriv.hasData( src ) ) { |
|
5655 |
+ pdataOld = dataPriv.access( src ); |
|
5656 |
+ pdataCur = dataPriv.set( dest, pdataOld ); |
|
5657 |
+ events = pdataOld.events; |
|
5658 |
+ |
|
5659 |
+ if ( events ) { |
|
5660 |
+ delete pdataCur.handle; |
|
5661 |
+ pdataCur.events = {}; |
|
5662 |
+ |
|
5663 |
+ for ( type in events ) { |
|
5664 |
+ for ( i = 0, l = events[ type ].length; i < l; i++ ) { |
|
5665 |
+ jQuery.event.add( dest, type, events[ type ][ i ] ); |
|
5666 |
+ } |
|
5667 |
+ } |
|
5668 |
+ } |
|
5669 |
+ } |
|
5670 |
+ |
|
5671 |
+ // 2. Copy user data |
|
5672 |
+ if ( dataUser.hasData( src ) ) { |
|
5673 |
+ udataOld = dataUser.access( src ); |
|
5674 |
+ udataCur = jQuery.extend( {}, udataOld ); |
|
5675 |
+ |
|
5676 |
+ dataUser.set( dest, udataCur ); |
|
5677 |
+ } |
|
5678 |
+} |
|
5679 |
+ |
|
5680 |
+// Fix IE bugs, see support tests |
|
5681 |
+function fixInput( src, dest ) { |
|
5682 |
+ var nodeName = dest.nodeName.toLowerCase(); |
|
5683 |
+ |
|
5684 |
+ // Fails to persist the checked state of a cloned checkbox or radio button. |
|
5685 |
+ if ( nodeName === "input" && rcheckableType.test( src.type ) ) { |
|
5686 |
+ dest.checked = src.checked; |
|
5687 |
+ |
|
5688 |
+ // Fails to return the selected option to the default selected state when cloning options |
|
5689 |
+ } else if ( nodeName === "input" || nodeName === "textarea" ) { |
|
5690 |
+ dest.defaultValue = src.defaultValue; |
|
5691 |
+ } |
|
5692 |
+} |
|
5693 |
+ |
|
5694 |
+function domManip( collection, args, callback, ignored ) { |
|
5695 |
+ |
|
5696 |
+ // Flatten any nested arrays |
|
5697 |
+ args = concat.apply( [], args ); |
|
5698 |
+ |
|
5699 |
+ var fragment, first, scripts, hasScripts, node, doc, |
|
5700 |
+ i = 0, |
|
5701 |
+ l = collection.length, |
|
5702 |
+ iNoClone = l - 1, |
|
5703 |
+ value = args[ 0 ], |
|
5704 |
+ valueIsFunction = isFunction( value ); |
|
5705 |
+ |
|
5706 |
+ // We can't cloneNode fragments that contain checked, in WebKit |
|
5707 |
+ if ( valueIsFunction || |
|
5708 |
+ ( l > 1 && typeof value === "string" && |
|
5709 |
+ !support.checkClone && rchecked.test( value ) ) ) { |
|
5710 |
+ return collection.each( function( index ) { |
|
5711 |
+ var self = collection.eq( index ); |
|
5712 |
+ if ( valueIsFunction ) { |
|
5713 |
+ args[ 0 ] = value.call( this, index, self.html() ); |
|
5714 |
+ } |
|
5715 |
+ domManip( self, args, callback, ignored ); |
|
5716 |
+ } ); |
|
5717 |
+ } |
|
5718 |
+ |
|
5719 |
+ if ( l ) { |
|
5720 |
+ fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); |
|
5721 |
+ first = fragment.firstChild; |
|
5722 |
+ |
|
5723 |
+ if ( fragment.childNodes.length === 1 ) { |
|
5724 |
+ fragment = first; |
|
5725 |
+ } |
|
5726 |
+ |
|
5727 |
+ // Require either new content or an interest in ignored elements to invoke the callback |
|
5728 |
+ if ( first || ignored ) { |
|
5729 |
+ scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); |
|
5730 |
+ hasScripts = scripts.length; |
|
5731 |
+ |
|
5732 |
+ // Use the original fragment for the last item |
|
5733 |
+ // instead of the first because it can end up |
|
5734 |
+ // being emptied incorrectly in certain situations (#8070). |
|
5735 |
+ for ( ; i < l; i++ ) { |
|
5736 |
+ node = fragment; |
|
5737 |
+ |
|
5738 |
+ if ( i !== iNoClone ) { |
|
5739 |
+ node = jQuery.clone( node, true, true ); |
|
5740 |
+ |
|
5741 |
+ // Keep references to cloned scripts for later restoration |
|
5742 |
+ if ( hasScripts ) { |
|
5743 |
+ |
|
5744 |
+ // Support: Android <=4.0 only, PhantomJS 1 only |
|
5745 |
+ // push.apply(_, arraylike) throws on ancient WebKit |
|
5746 |
+ jQuery.merge( scripts, getAll( node, "script" ) ); |
|
5747 |
+ } |
|
5748 |
+ } |
|
5749 |
+ |
|
5750 |
+ callback.call( collection[ i ], node, i ); |
|
5751 |
+ } |
|
5752 |
+ |
|
5753 |
+ if ( hasScripts ) { |
|
5754 |
+ doc = scripts[ scripts.length - 1 ].ownerDocument; |
|
5755 |
+ |
|
5756 |
+ // Reenable scripts |
|
5757 |
+ jQuery.map( scripts, restoreScript ); |
|
5758 |
+ |
|
5759 |
+ // Evaluate executable scripts on first document insertion |
|
5760 |
+ for ( i = 0; i < hasScripts; i++ ) { |
|
5761 |
+ node = scripts[ i ]; |
|
5762 |
+ if ( rscriptType.test( node.type || "" ) && |
|
5763 |
+ !dataPriv.access( node, "globalEval" ) && |
|
5764 |
+ jQuery.contains( doc, node ) ) { |
|
5765 |
+ |
|
5766 |
+ if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { |
|
5767 |
+ |
|
5768 |
+ // Optional AJAX dependency, but won't run scripts if not present |
|
5769 |
+ if ( jQuery._evalUrl ) { |
|
5770 |
+ jQuery._evalUrl( node.src ); |
|
5771 |
+ } |
|
5772 |
+ } else { |
|
5773 |
+ DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node ); |
|
5774 |
+ } |
|
5775 |
+ } |
|
5776 |
+ } |
|
5777 |
+ } |
|
5778 |
+ } |
|
5779 |
+ } |
|
5780 |
+ |
|
5781 |
+ return collection; |
|
5782 |
+} |
|
5783 |
+ |
|
5784 |
+function remove( elem, selector, keepData ) { |
|
5785 |
+ var node, |
|
5786 |
+ nodes = selector ? jQuery.filter( selector, elem ) : elem, |
|
5787 |
+ i = 0; |
|
5788 |
+ |
|
5789 |
+ for ( ; ( node = nodes[ i ] ) != null; i++ ) { |
|
5790 |
+ if ( !keepData && node.nodeType === 1 ) { |
|
5791 |
+ jQuery.cleanData( getAll( node ) ); |
|
5792 |
+ } |
|
5793 |
+ |
|
5794 |
+ if ( node.parentNode ) { |
|
5795 |
+ if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { |
|
5796 |
+ setGlobalEval( getAll( node, "script" ) ); |
|
5797 |
+ } |
|
5798 |
+ node.parentNode.removeChild( node ); |
|
5799 |
+ } |
|
5800 |
+ } |
|
5801 |
+ |
|
5802 |
+ return elem; |
|
5803 |
+} |
|
5804 |
+ |
|
5805 |
+jQuery.extend( { |
|
5806 |
+ htmlPrefilter: function( html ) { |
|
5807 |
+ return html.replace( rxhtmlTag, "<$1></$2>" ); |
|
5808 |
+ }, |
|
5809 |
+ |
|
5810 |
+ clone: function( elem, dataAndEvents, deepDataAndEvents ) { |
|
5811 |
+ var i, l, srcElements, destElements, |
|
5812 |
+ clone = elem.cloneNode( true ), |
|
5813 |
+ inPage = jQuery.contains( elem.ownerDocument, elem ); |
|
5814 |
+ |
|
5815 |
+ // Fix IE cloning issues |
|
5816 |
+ if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && |
|
5817 |
+ !jQuery.isXMLDoc( elem ) ) { |
|
5818 |
+ |
|
5819 |
+ // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 |
|
5820 |
+ destElements = getAll( clone ); |
|
5821 |
+ srcElements = getAll( elem ); |
|
5822 |
+ |
|
5823 |
+ for ( i = 0, l = srcElements.length; i < l; i++ ) { |
|
5824 |
+ fixInput( srcElements[ i ], destElements[ i ] ); |
|
5825 |
+ } |
|
5826 |
+ } |
|
5827 |
+ |
|
5828 |
+ // Copy the events from the original to the clone |
|
5829 |
+ if ( dataAndEvents ) { |
|
5830 |
+ if ( deepDataAndEvents ) { |
|
5831 |
+ srcElements = srcElements || getAll( elem ); |
|
5832 |
+ destElements = destElements || getAll( clone ); |
|
5833 |
+ |
|
5834 |
+ for ( i = 0, l = srcElements.length; i < l; i++ ) { |
|
5835 |
+ cloneCopyEvent( srcElements[ i ], destElements[ i ] ); |
|
5836 |
+ } |
|
5837 |
+ } else { |
|
5838 |
+ cloneCopyEvent( elem, clone ); |
|
5839 |
+ } |
|
5840 |
+ } |
|
5841 |
+ |
|
5842 |
+ // Preserve script evaluation history |
|
5843 |
+ destElements = getAll( clone, "script" ); |
|
5844 |
+ if ( destElements.length > 0 ) { |
|
5845 |
+ setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); |
|
5846 |
+ } |
|
5847 |
+ |
|
5848 |
+ // Return the cloned set |
|
5849 |
+ return clone; |
|
5850 |
+ }, |
|
5851 |
+ |
|
5852 |
+ cleanData: function( elems ) { |
|
5853 |
+ var data, elem, type, |
|
5854 |
+ special = jQuery.event.special, |
|
5855 |
+ i = 0; |
|
5856 |
+ |
|
5857 |
+ for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { |
|
5858 |
+ if ( acceptData( elem ) ) { |
|
5859 |
+ if ( ( data = elem[ dataPriv.expando ] ) ) { |
|
5860 |
+ if ( data.events ) { |
|
5861 |
+ for ( type in data.events ) { |
|
5862 |
+ if ( special[ type ] ) { |
|
5863 |
+ jQuery.event.remove( elem, type ); |
|
5864 |
+ |
|
5865 |
+ // This is a shortcut to avoid jQuery.event.remove's overhead |
|
5866 |
+ } else { |
|
5867 |
+ jQuery.removeEvent( elem, type, data.handle ); |
|
5868 |
+ } |
|
5869 |
+ } |
|
5870 |
+ } |
|
5871 |
+ |
|
5872 |
+ // Support: Chrome <=35 - 45+ |
|
5873 |
+ // Assign undefined instead of using delete, see Data#remove |
|
5874 |
+ elem[ dataPriv.expando ] = undefined; |
|
5875 |
+ } |
|
5876 |
+ if ( elem[ dataUser.expando ] ) { |
|
5877 |
+ |
|
5878 |
+ // Support: Chrome <=35 - 45+ |
|
5879 |
+ // Assign undefined instead of using delete, see Data#remove |
|
5880 |
+ elem[ dataUser.expando ] = undefined; |
|
5881 |
+ } |
|
5882 |
+ } |
|
5883 |
+ } |
|
5884 |
+ } |
|
5885 |
+} ); |
|
5886 |
+ |
|
5887 |
+jQuery.fn.extend( { |
|
5888 |
+ detach: function( selector ) { |
|
5889 |
+ return remove( this, selector, true ); |
|
5890 |
+ }, |
|
5891 |
+ |
|
5892 |
+ remove: function( selector ) { |
|
5893 |
+ return remove( this, selector ); |
|
5894 |
+ }, |
|
5895 |
+ |
|
5896 |
+ text: function( value ) { |
|
5897 |
+ return access( this, function( value ) { |
|
5898 |
+ return value === undefined ? |
|
5899 |
+ jQuery.text( this ) : |
|
5900 |
+ this.empty().each( function() { |
|
5901 |
+ if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { |
|
5902 |
+ this.textContent = value; |
|
5903 |
+ } |
|
5904 |
+ } ); |
|
5905 |
+ }, null, value, arguments.length ); |
|
5906 |
+ }, |
|
5907 |
+ |
|
5908 |
+ append: function() { |
|
5909 |
+ return domManip( this, arguments, function( elem ) { |
|
5910 |
+ if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { |
|
5911 |
+ var target = manipulationTarget( this, elem ); |
|
5912 |
+ target.appendChild( elem ); |
|
5913 |
+ } |
|
5914 |
+ } ); |
|
5915 |
+ }, |
|
5916 |
+ |
|
5917 |
+ prepend: function() { |
|
5918 |
+ return domManip( this, arguments, function( elem ) { |
|
5919 |
+ if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { |
|
5920 |
+ var target = manipulationTarget( this, elem ); |
|
5921 |
+ target.insertBefore( elem, target.firstChild ); |
|
5922 |
+ } |
|
5923 |
+ } ); |
|
5924 |
+ }, |
|
5925 |
+ |
|
5926 |
+ before: function() { |
|
5927 |
+ return domManip( this, arguments, function( elem ) { |
|
5928 |
+ if ( this.parentNode ) { |
|
5929 |
+ this.parentNode.insertBefore( elem, this ); |
|
5930 |
+ } |
|
5931 |
+ } ); |
|
5932 |
+ }, |
|
5933 |
+ |
|
5934 |
+ after: function() { |
|
5935 |
+ return domManip( this, arguments, function( elem ) { |
|
5936 |
+ if ( this.parentNode ) { |
|
5937 |
+ this.parentNode.insertBefore( elem, this.nextSibling ); |
|
5938 |
+ } |
|
5939 |
+ } ); |
|
5940 |
+ }, |
|
5941 |
+ |
|
5942 |
+ empty: function() { |
|
5943 |
+ var elem, |
|
5944 |
+ i = 0; |
|
5945 |
+ |
|
5946 |
+ for ( ; ( elem = this[ i ] ) != null; i++ ) { |
|
5947 |
+ if ( elem.nodeType === 1 ) { |
|
5948 |
+ |
|
5949 |
+ // Prevent memory leaks |
|
5950 |
+ jQuery.cleanData( getAll( elem, false ) ); |
|
5951 |
+ |
|
5952 |
+ // Remove any remaining nodes |
|
5953 |
+ elem.textContent = ""; |
|
5954 |
+ } |
|
5955 |
+ } |
|
5956 |
+ |
|
5957 |
+ return this; |
|
5958 |
+ }, |
|
5959 |
+ |
|
5960 |
+ clone: function( dataAndEvents, deepDataAndEvents ) { |
|
5961 |
+ dataAndEvents = dataAndEvents == null ? false : dataAndEvents; |
|
5962 |
+ deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; |
|
5963 |
+ |
|
5964 |
+ return this.map( function() { |
|
5965 |
+ return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); |
|
5966 |
+ } ); |
|
5967 |
+ }, |
|
5968 |
+ |
|
5969 |
+ html: function( value ) { |
|
5970 |
+ return access( this, function( value ) { |
|
5971 |
+ var elem = this[ 0 ] || {}, |
|
5972 |
+ i = 0, |
|
5973 |
+ l = this.length; |
|
5974 |
+ |
|
5975 |
+ if ( value === undefined && elem.nodeType === 1 ) { |
|
5976 |
+ return elem.innerHTML; |
|
5977 |
+ } |
|
5978 |
+ |
|
5979 |
+ // See if we can take a shortcut and just use innerHTML |
|
5980 |
+ if ( typeof value === "string" && !rnoInnerhtml.test( value ) && |
|
5981 |
+ !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { |
|
5982 |
+ |
|
5983 |
+ value = jQuery.htmlPrefilter( value ); |
|
5984 |
+ |
|
5985 |
+ try { |
|
5986 |
+ for ( ; i < l; i++ ) { |
|
5987 |
+ elem = this[ i ] || {}; |
|
5988 |
+ |
|
5989 |
+ // Remove element nodes and prevent memory leaks |
|
5990 |
+ if ( elem.nodeType === 1 ) { |
|
5991 |
+ jQuery.cleanData( getAll( elem, false ) ); |
|
5992 |
+ elem.innerHTML = value; |
|
5993 |
+ } |
|
5994 |
+ } |
|
5995 |
+ |
|
5996 |
+ elem = 0; |
|
5997 |
+ |
|
5998 |
+ // If using innerHTML throws an exception, use the fallback method |
|
5999 |
+ } catch ( e ) {} |
|
6000 |
+ } |
|
6001 |
+ |
|
6002 |
+ if ( elem ) { |
|
6003 |
+ this.empty().append( value ); |
|
6004 |
+ } |
|
6005 |
+ }, null, value, arguments.length ); |
|
6006 |
+ }, |
|
6007 |
+ |
|
6008 |
+ replaceWith: function() { |
|
6009 |
+ var ignored = []; |
|
6010 |
+ |
|
6011 |
+ // Make the changes, replacing each non-ignored context element with the new content |
|
6012 |
+ return domManip( this, arguments, function( elem ) { |
|
6013 |
+ var parent = this.parentNode; |
|
6014 |
+ |
|
6015 |
+ if ( jQuery.inArray( this, ignored ) < 0 ) { |
|
6016 |
+ jQuery.cleanData( getAll( this ) ); |
|
6017 |
+ if ( parent ) { |
|
6018 |
+ parent.replaceChild( elem, this ); |
|
6019 |
+ } |
|
6020 |
+ } |
|
6021 |
+ |
|
6022 |
+ // Force callback invocation |
|
6023 |
+ }, ignored ); |
|
6024 |
+ } |
|
6025 |
+} ); |
|
6026 |
+ |
|
6027 |
+jQuery.each( { |
|
6028 |
+ appendTo: "append", |
|
6029 |
+ prependTo: "prepend", |
|
6030 |
+ insertBefore: "before", |
|
6031 |
+ insertAfter: "after", |
|
6032 |
+ replaceAll: "replaceWith" |
|
6033 |
+}, function( name, original ) { |
|
6034 |
+ jQuery.fn[ name ] = function( selector ) { |
|
6035 |
+ var elems, |
|
6036 |
+ ret = [], |
|
6037 |
+ insert = jQuery( selector ), |
|
6038 |
+ last = insert.length - 1, |
|
6039 |
+ i = 0; |
|
6040 |
+ |
|
6041 |
+ for ( ; i <= last; i++ ) { |
|
6042 |
+ elems = i === last ? this : this.clone( true ); |
|
6043 |
+ jQuery( insert[ i ] )[ original ]( elems ); |
|
6044 |
+ |
|
6045 |
+ // Support: Android <=4.0 only, PhantomJS 1 only |
|
6046 |
+ // .get() because push.apply(_, arraylike) throws on ancient WebKit |
|
6047 |
+ push.apply( ret, elems.get() ); |
|
6048 |
+ } |
|
6049 |
+ |
|
6050 |
+ return this.pushStack( ret ); |
|
6051 |
+ }; |
|
6052 |
+} ); |
|
6053 |
+var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); |
|
6054 |
+ |
|
6055 |
+var getStyles = function( elem ) { |
|
6056 |
+ |
|
6057 |
+ // Support: IE <=11 only, Firefox <=30 (#15098, #14150) |
|
6058 |
+ // IE throws on elements created in popups |
|
6059 |
+ // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" |
|
6060 |
+ var view = elem.ownerDocument.defaultView; |
|
6061 |
+ |
|
6062 |
+ if ( !view || !view.opener ) { |
|
6063 |
+ view = window; |
|
6064 |
+ } |
|
6065 |
+ |
|
6066 |
+ return view.getComputedStyle( elem ); |
|
6067 |
+ }; |
|
6068 |
+ |
|
6069 |
+var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); |
|
6070 |
+ |
|
6071 |
+ |
|
6072 |
+ |
|
6073 |
+( function() { |
|
6074 |
+ |
|
6075 |
+ // Executing both pixelPosition & boxSizingReliable tests require only one layout |
|
6076 |
+ // so they're executed at the same time to save the second computation. |
|
6077 |
+ function computeStyleTests() { |
|
6078 |
+ |
|
6079 |
+ // This is a singleton, we need to execute it only once |
|
6080 |
+ if ( !div ) { |
|
6081 |
+ return; |
|
6082 |
+ } |
|
6083 |
+ |
|
6084 |
+ container.style.cssText = "position:absolute;left:-11111px;width:60px;" + |
|
6085 |
+ "margin-top:1px;padding:0;border:0"; |
|
6086 |
+ div.style.cssText = |
|
6087 |
+ "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + |
|
6088 |
+ "margin:auto;border:1px;padding:1px;" + |
|
6089 |
+ "width:60%;top:1%"; |
|
6090 |
+ documentElement.appendChild( container ).appendChild( div ); |
|
6091 |
+ |
|
6092 |
+ var divStyle = window.getComputedStyle( div ); |
|
6093 |
+ pixelPositionVal = divStyle.top !== "1%"; |
|
6094 |
+ |
|
6095 |
+ // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 |
|
6096 |
+ reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; |
|
6097 |
+ |
|
6098 |
+ // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 |
|
6099 |
+ // Some styles come back with percentage values, even though they shouldn't |
|
6100 |
+ div.style.right = "60%"; |
|
6101 |
+ pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; |
|
6102 |
+ |
|
6103 |
+ // Support: IE 9 - 11 only |
|
6104 |
+ // Detect misreporting of content dimensions for box-sizing:border-box elements |
|
6105 |
+ boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; |
|
6106 |
+ |
|
6107 |
+ // Support: IE 9 only |
|
6108 |
+ // Detect overflow:scroll screwiness (gh-3699) |
|
6109 |
+ div.style.position = "absolute"; |
|
6110 |
+ scrollboxSizeVal = div.offsetWidth === 36 || "absolute"; |
|
6111 |
+ |
|
6112 |
+ documentElement.removeChild( container ); |
|
6113 |
+ |
|
6114 |
+ // Nullify the div so it wouldn't be stored in the memory and |
|
6115 |
+ // it will also be a sign that checks already performed |
|
6116 |
+ div = null; |
|
6117 |
+ } |
|
6118 |
+ |
|
6119 |
+ function roundPixelMeasures( measure ) { |
|
6120 |
+ return Math.round( parseFloat( measure ) ); |
|
6121 |
+ } |
|
6122 |
+ |
|
6123 |
+ var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, |
|
6124 |
+ reliableMarginLeftVal, |
|
6125 |
+ container = document.createElement( "div" ), |
|
6126 |
+ div = document.createElement( "div" ); |
|
6127 |
+ |
|
6128 |
+ // Finish early in limited (non-browser) environments |
|
6129 |
+ if ( !div.style ) { |
|
6130 |
+ return; |
|
6131 |
+ } |
|
6132 |
+ |
|
6133 |
+ // Support: IE <=9 - 11 only |
|
6134 |
+ // Style of cloned element affects source element cloned (#8908) |
|
6135 |
+ div.style.backgroundClip = "content-box"; |
|
6136 |
+ div.cloneNode( true ).style.backgroundClip = ""; |
|
6137 |
+ support.clearCloneStyle = div.style.backgroundClip === "content-box"; |
|
6138 |
+ |
|
6139 |
+ jQuery.extend( support, { |
|
6140 |
+ boxSizingReliable: function() { |
|
6141 |
+ computeStyleTests(); |
|
6142 |
+ return boxSizingReliableVal; |
|
6143 |
+ }, |
|
6144 |
+ pixelBoxStyles: function() { |
|
6145 |
+ computeStyleTests(); |
|
6146 |
+ return pixelBoxStylesVal; |
|
6147 |
+ }, |
|
6148 |
+ pixelPosition: function() { |
|
6149 |
+ computeStyleTests(); |
|
6150 |
+ return pixelPositionVal; |
|
6151 |
+ }, |
|
6152 |
+ reliableMarginLeft: function() { |
|
6153 |
+ computeStyleTests(); |
|
6154 |
+ return reliableMarginLeftVal; |
|
6155 |
+ }, |
|
6156 |
+ scrollboxSize: function() { |
|
6157 |
+ computeStyleTests(); |
|
6158 |
+ return scrollboxSizeVal; |
|
6159 |
+ } |
|
6160 |
+ } ); |
|
6161 |
+} )(); |
|
6162 |
+ |
|
6163 |
+ |
|
6164 |
+function curCSS( elem, name, computed ) { |
|
6165 |
+ var width, minWidth, maxWidth, ret, |
|
6166 |
+ |
|
6167 |
+ // Support: Firefox 51+ |
|
6168 |
+ // Retrieving style before computed somehow |
|
6169 |
+ // fixes an issue with getting wrong values |
|
6170 |
+ // on detached elements |
|
6171 |
+ style = elem.style; |
|
6172 |
+ |
|
6173 |
+ computed = computed || getStyles( elem ); |
|
6174 |
+ |
|
6175 |
+ // getPropertyValue is needed for: |
|
6176 |
+ // .css('filter') (IE 9 only, #12537) |
|
6177 |
+ // .css('--customProperty) (#3144) |
|
6178 |
+ if ( computed ) { |
|
6179 |
+ ret = computed.getPropertyValue( name ) || computed[ name ]; |
|
6180 |
+ |
|
6181 |
+ if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { |
|
6182 |
+ ret = jQuery.style( elem, name ); |
|
6183 |
+ } |
|
6184 |
+ |
|
6185 |
+ // A tribute to the "awesome hack by Dean Edwards" |
|
6186 |
+ // Android Browser returns percentage for some values, |
|
6187 |
+ // but width seems to be reliably pixels. |
|
6188 |
+ // This is against the CSSOM draft spec: |
|
6189 |
+ // https://drafts.csswg.org/cssom/#resolved-values |
|
6190 |
+ if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { |
|
6191 |
+ |
|
6192 |
+ // Remember the original values |
|
6193 |
+ width = style.width; |
|
6194 |
+ minWidth = style.minWidth; |
|
6195 |
+ maxWidth = style.maxWidth; |
|
6196 |
+ |
|
6197 |
+ // Put in the new values to get a computed value out |
|
6198 |
+ style.minWidth = style.maxWidth = style.width = ret; |
|
6199 |
+ ret = computed.width; |
|
6200 |
+ |
|
6201 |
+ // Revert the changed values |
|
6202 |
+ style.width = width; |
|
6203 |
+ style.minWidth = minWidth; |
|
6204 |
+ style.maxWidth = maxWidth; |
|
6205 |
+ } |
|
6206 |
+ } |
|
6207 |
+ |
|
6208 |
+ return ret !== undefined ? |
|
6209 |
+ |
|
6210 |
+ // Support: IE <=9 - 11 only |
|
6211 |
+ // IE returns zIndex value as an integer. |
|
6212 |
+ ret + "" : |
|
6213 |
+ ret; |
|
6214 |
+} |
|
6215 |
+ |
|
6216 |
+ |
|
6217 |
+function addGetHookIf( conditionFn, hookFn ) { |
|
6218 |
+ |
|
6219 |
+ // Define the hook, we'll check on the first run if it's really needed. |
|
6220 |
+ return { |
|
6221 |
+ get: function() { |
|
6222 |
+ if ( conditionFn() ) { |
|
6223 |
+ |
|
6224 |
+ // Hook not needed (or it's not possible to use it due |
|
6225 |
+ // to missing dependency), remove it. |
|
6226 |
+ delete this.get; |
|
6227 |
+ return; |
|
6228 |
+ } |
|
6229 |
+ |
|
6230 |
+ // Hook needed; redefine it so that the support test is not executed again. |
|
6231 |
+ return ( this.get = hookFn ).apply( this, arguments ); |
|
6232 |
+ } |
|
6233 |
+ }; |
|
6234 |
+} |
|
6235 |
+ |
|
6236 |
+ |
|
6237 |
+var |
|
6238 |
+ |
|
6239 |
+ // Swappable if display is none or starts with table |
|
6240 |
+ // except "table", "table-cell", or "table-caption" |
|
6241 |
+ // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display |
|
6242 |
+ rdisplayswap = /^(none|table(?!-c[ea]).+)/, |
|
6243 |
+ rcustomProp = /^--/, |
|
6244 |
+ cssShow = { position: "absolute", visibility: "hidden", display: "block" }, |
|
6245 |
+ cssNormalTransform = { |
|
6246 |
+ letterSpacing: "0", |
|
6247 |
+ fontWeight: "400" |
|
6248 |
+ }, |
|
6249 |
+ |
|
6250 |
+ cssPrefixes = [ "Webkit", "Moz", "ms" ], |
|
6251 |
+ emptyStyle = document.createElement( "div" ).style; |
|
6252 |
+ |
|
6253 |
+// Return a css property mapped to a potentially vendor prefixed property |
|
6254 |
+function vendorPropName( name ) { |
|
6255 |
+ |
|
6256 |
+ // Shortcut for names that are not vendor prefixed |
|
6257 |
+ if ( name in emptyStyle ) { |
|
6258 |
+ return name; |
|
6259 |
+ } |
|
6260 |
+ |
|
6261 |
+ // Check for vendor prefixed names |
|
6262 |
+ var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), |
|
6263 |
+ i = cssPrefixes.length; |
|
6264 |
+ |
|
6265 |
+ while ( i-- ) { |
|
6266 |
+ name = cssPrefixes[ i ] + capName; |
|
6267 |
+ if ( name in emptyStyle ) { |
|
6268 |
+ return name; |
|
6269 |
+ } |
|
6270 |
+ } |
|
6271 |
+} |
|
6272 |
+ |
|
6273 |
+// Return a property mapped along what jQuery.cssProps suggests or to |
|
6274 |
+// a vendor prefixed property. |
|
6275 |
+function finalPropName( name ) { |
|
6276 |
+ var ret = jQuery.cssProps[ name ]; |
|
6277 |
+ if ( !ret ) { |
|
6278 |
+ ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name; |
|
6279 |
+ } |
|
6280 |
+ return ret; |
|
6281 |
+} |
|
6282 |
+ |
|
6283 |
+function setPositiveNumber( elem, value, subtract ) { |
|
6284 |
+ |
|
6285 |
+ // Any relative (+/-) values have already been |
|
6286 |
+ // normalized at this point |
|
6287 |
+ var matches = rcssNum.exec( value ); |
|
6288 |
+ return matches ? |
|
6289 |
+ |
|
6290 |
+ // Guard against undefined "subtract", e.g., when used as in cssHooks |
|
6291 |
+ Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : |
|
6292 |
+ value; |
|
6293 |
+} |
|
6294 |
+ |
|
6295 |
+function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { |
|
6296 |
+ var i = dimension === "width" ? 1 : 0, |
|
6297 |
+ extra = 0, |
|
6298 |
+ delta = 0; |
|
6299 |
+ |
|
6300 |
+ // Adjustment may not be necessary |
|
6301 |
+ if ( box === ( isBorderBox ? "border" : "content" ) ) { |
|
6302 |
+ return 0; |
|
6303 |
+ } |
|
6304 |
+ |
|
6305 |
+ for ( ; i < 4; i += 2 ) { |
|
6306 |
+ |
|
6307 |
+ // Both box models exclude margin |
|
6308 |
+ if ( box === "margin" ) { |
|
6309 |
+ delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); |
|
6310 |
+ } |
|
6311 |
+ |
|
6312 |
+ // If we get here with a content-box, we're seeking "padding" or "border" or "margin" |
|
6313 |
+ if ( !isBorderBox ) { |
|
6314 |
+ |
|
6315 |
+ // Add padding |
|
6316 |
+ delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); |
|
6317 |
+ |
|
6318 |
+ // For "border" or "margin", add border |
|
6319 |
+ if ( box !== "padding" ) { |
|
6320 |
+ delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); |
|
6321 |
+ |
|
6322 |
+ // But still keep track of it otherwise |
|
6323 |
+ } else { |
|
6324 |
+ extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); |
|
6325 |
+ } |
|
6326 |
+ |
|
6327 |
+ // If we get here with a border-box (content + padding + border), we're seeking "content" or |
|
6328 |
+ // "padding" or "margin" |
|
6329 |
+ } else { |
|
6330 |
+ |
|
6331 |
+ // For "content", subtract padding |
|
6332 |
+ if ( box === "content" ) { |
|
6333 |
+ delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); |
|
6334 |
+ } |
|
6335 |
+ |
|
6336 |
+ // For "content" or "padding", subtract border |
|
6337 |
+ if ( box !== "margin" ) { |
|
6338 |
+ delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); |
|
6339 |
+ } |
|
6340 |
+ } |
|
6341 |
+ } |
|
6342 |
+ |
|
6343 |
+ // Account for positive content-box scroll gutter when requested by providing computedVal |
|
6344 |
+ if ( !isBorderBox && computedVal >= 0 ) { |
|
6345 |
+ |
|
6346 |
+ // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border |
|
6347 |
+ // Assuming integer scroll gutter, subtract the rest and round down |
|
6348 |
+ delta += Math.max( 0, Math.ceil( |
|
6349 |
+ elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - |
|
6350 |
+ computedVal - |
|
6351 |
+ delta - |
|
6352 |
+ extra - |
|
6353 |
+ 0.5 |
|
6354 |
+ ) ); |
|
6355 |
+ } |
|
6356 |
+ |
|
6357 |
+ return delta; |
|
6358 |
+} |
|
6359 |
+ |
|
6360 |
+function getWidthOrHeight( elem, dimension, extra ) { |
|
6361 |
+ |
|
6362 |
+ // Start with computed style |
|
6363 |
+ var styles = getStyles( elem ), |
|
6364 |
+ val = curCSS( elem, dimension, styles ), |
|
6365 |
+ isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box", |
|
6366 |
+ valueIsBorderBox = isBorderBox; |
|
6367 |
+ |
|
6368 |
+ // Support: Firefox <=54 |
|
6369 |
+ // Return a confounding non-pixel value or feign ignorance, as appropriate. |
|
6370 |
+ if ( rnumnonpx.test( val ) ) { |
|
6371 |
+ if ( !extra ) { |
|
6372 |
+ return val; |
|
6373 |
+ } |
|
6374 |
+ val = "auto"; |
|
6375 |
+ } |
|
6376 |
+ |
|
6377 |
+ // Check for style in case a browser which returns unreliable values |
|
6378 |
+ // for getComputedStyle silently falls back to the reliable elem.style |
|
6379 |
+ valueIsBorderBox = valueIsBorderBox && |
|
6380 |
+ ( support.boxSizingReliable() || val === elem.style[ dimension ] ); |
|
6381 |
+ |
|
6382 |
+ // Fall back to offsetWidth/offsetHeight when value is "auto" |
|
6383 |
+ // This happens for inline elements with no explicit setting (gh-3571) |
|
6384 |
+ // Support: Android <=4.1 - 4.3 only |
|
6385 |
+ // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) |
|
6386 |
+ if ( val === "auto" || |
|
6387 |
+ !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) { |
|
6388 |
+ |
|
6389 |
+ val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ]; |
|
6390 |
+ |
|
6391 |
+ // offsetWidth/offsetHeight provide border-box values |
|
6392 |
+ valueIsBorderBox = true; |
|
6393 |
+ } |
|
6394 |
+ |
|
6395 |
+ // Normalize "" and auto |
|
6396 |
+ val = parseFloat( val ) || 0; |
|
6397 |
+ |
|
6398 |
+ // Adjust for the element's box model |
|
6399 |
+ return ( val + |
|
6400 |
+ boxModelAdjustment( |
|
6401 |
+ elem, |
|
6402 |
+ dimension, |
|
6403 |
+ extra || ( isBorderBox ? "border" : "content" ), |
|
6404 |
+ valueIsBorderBox, |
|
6405 |
+ styles, |
|
6406 |
+ |
|
6407 |
+ // Provide the current computed size to request scroll gutter calculation (gh-3589) |
|
6408 |
+ val |
|
6409 |
+ ) |
|
6410 |
+ ) + "px"; |
|
6411 |
+} |
|
6412 |
+ |
|
6413 |
+jQuery.extend( { |
|
6414 |
+ |
|
6415 |
+ // Add in style property hooks for overriding the default |
|
6416 |
+ // behavior of getting and setting a style property |
|
6417 |
+ cssHooks: { |
|
6418 |
+ opacity: { |
|
6419 |
+ get: function( elem, computed ) { |
|
6420 |
+ if ( computed ) { |
|
6421 |
+ |
|
6422 |
+ // We should always get a number back from opacity |
|
6423 |
+ var ret = curCSS( elem, "opacity" ); |
|
6424 |
+ return ret === "" ? "1" : ret; |
|
6425 |
+ } |
|
6426 |
+ } |
|
6427 |
+ } |
|
6428 |
+ }, |
|
6429 |
+ |
|
6430 |
+ // Don't automatically add "px" to these possibly-unitless properties |
|
6431 |
+ cssNumber: { |
|
6432 |
+ "animationIterationCount": true, |
|
6433 |
+ "columnCount": true, |
|
6434 |
+ "fillOpacity": true, |
|
6435 |
+ "flexGrow": true, |
|
6436 |
+ "flexShrink": true, |
|
6437 |
+ "fontWeight": true, |
|
6438 |
+ "lineHeight": true, |
|
6439 |
+ "opacity": true, |
|
6440 |
+ "order": true, |
|
6441 |
+ "orphans": true, |
|
6442 |
+ "widows": true, |
|
6443 |
+ "zIndex": true, |
|
6444 |
+ "zoom": true |
|
6445 |
+ }, |
|
6446 |
+ |
|
6447 |
+ // Add in properties whose names you wish to fix before |
|
6448 |
+ // setting or getting the value |
|
6449 |
+ cssProps: {}, |
|
6450 |
+ |
|
6451 |
+ // Get and set the style property on a DOM Node |
|
6452 |
+ style: function( elem, name, value, extra ) { |
|
6453 |
+ |
|
6454 |
+ // Don't set styles on text and comment nodes |
|
6455 |
+ if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { |
|
6456 |
+ return; |
|
6457 |
+ } |
|
6458 |
+ |
|
6459 |
+ // Make sure that we're working with the right name |
|
6460 |
+ var ret, type, hooks, |
|
6461 |
+ origName = camelCase( name ), |
|
6462 |
+ isCustomProp = rcustomProp.test( name ), |
|
6463 |
+ style = elem.style; |
|
6464 |
+ |
|
6465 |
+ // Make sure that we're working with the right name. We don't |
|
6466 |
+ // want to query the value if it is a CSS custom property |
|
6467 |
+ // since they are user-defined. |
|
6468 |
+ if ( !isCustomProp ) { |
|
6469 |
+ name = finalPropName( origName ); |
|
6470 |
+ } |
|
6471 |
+ |
|
6472 |
+ // Gets hook for the prefixed version, then unprefixed version |
|
6473 |
+ hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; |
|
6474 |
+ |
|
6475 |
+ // Check if we're setting a value |
|
6476 |
+ if ( value !== undefined ) { |
|
6477 |
+ type = typeof value; |
|
6478 |
+ |
|
6479 |
+ // Convert "+=" or "-=" to relative numbers (#7345) |
|
6480 |
+ if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { |
|
6481 |
+ value = adjustCSS( elem, name, ret ); |
|
6482 |
+ |
|
6483 |
+ // Fixes bug #9237 |
|
6484 |
+ type = "number"; |
|
6485 |
+ } |
|
6486 |
+ |
|
6487 |
+ // Make sure that null and NaN values aren't set (#7116) |
|
6488 |
+ if ( value == null || value !== value ) { |
|
6489 |
+ return; |
|
6490 |
+ } |
|
6491 |
+ |
|
6492 |
+ // If a number was passed in, add the unit (except for certain CSS properties) |
|
6493 |
+ if ( type === "number" ) { |
|
6494 |
+ value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); |
|
6495 |
+ } |
|
6496 |
+ |
|
6497 |
+ // background-* props affect original clone's values |
|
6498 |
+ if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { |
|
6499 |
+ style[ name ] = "inherit"; |
|
6500 |
+ } |
|
6501 |
+ |
|
6502 |
+ // If a hook was provided, use that value, otherwise just set the specified value |
|
6503 |
+ if ( !hooks || !( "set" in hooks ) || |
|
6504 |
+ ( value = hooks.set( elem, value, extra ) ) !== undefined ) { |
|
6505 |
+ |
|
6506 |
+ if ( isCustomProp ) { |
|
6507 |
+ style.setProperty( name, value ); |
|
6508 |
+ } else { |
|
6509 |
+ style[ name ] = value; |
|
6510 |
+ } |
|
6511 |
+ } |
|
6512 |
+ |
|
6513 |
+ } else { |
|
6514 |
+ |
|
6515 |
+ // If a hook was provided get the non-computed value from there |
|
6516 |
+ if ( hooks && "get" in hooks && |
|
6517 |
+ ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { |
|
6518 |
+ |
|
6519 |
+ return ret; |
|
6520 |
+ } |
|
6521 |
+ |
|
6522 |
+ // Otherwise just get the value from the style object |
|
6523 |
+ return style[ name ]; |
|
6524 |
+ } |
|
6525 |
+ }, |
|
6526 |
+ |
|
6527 |
+ css: function( elem, name, extra, styles ) { |
|
6528 |
+ var val, num, hooks, |
|
6529 |
+ origName = camelCase( name ), |
|
6530 |
+ isCustomProp = rcustomProp.test( name ); |
|
6531 |
+ |
|
6532 |
+ // Make sure that we're working with the right name. We don't |
|
6533 |
+ // want to modify the value if it is a CSS custom property |
|
6534 |
+ // since they are user-defined. |
|
6535 |
+ if ( !isCustomProp ) { |
|
6536 |
+ name = finalPropName( origName ); |
|
6537 |
+ } |
|
6538 |
+ |
|
6539 |
+ // Try prefixed name followed by the unprefixed name |
|
6540 |
+ hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; |
|
6541 |
+ |
|
6542 |
+ // If a hook was provided get the computed value from there |
|
6543 |
+ if ( hooks && "get" in hooks ) { |
|
6544 |
+ val = hooks.get( elem, true, extra ); |
|
6545 |
+ } |
|
6546 |
+ |
|
6547 |
+ // Otherwise, if a way to get the computed value exists, use that |
|
6548 |
+ if ( val === undefined ) { |
|
6549 |
+ val = curCSS( elem, name, styles ); |
|
6550 |
+ } |
|
6551 |
+ |
|
6552 |
+ // Convert "normal" to computed value |
|
6553 |
+ if ( val === "normal" && name in cssNormalTransform ) { |
|
6554 |
+ val = cssNormalTransform[ name ]; |
|
6555 |
+ } |
|
6556 |
+ |
|
6557 |
+ // Make numeric if forced or a qualifier was provided and val looks numeric |
|
6558 |
+ if ( extra === "" || extra ) { |
|
6559 |
+ num = parseFloat( val ); |
|
6560 |
+ return extra === true || isFinite( num ) ? num || 0 : val; |
|
6561 |
+ } |
|
6562 |
+ |
|
6563 |
+ return val; |
|
6564 |
+ } |
|
6565 |
+} ); |
|
6566 |
+ |
|
6567 |
+jQuery.each( [ "height", "width" ], function( i, dimension ) { |
|
6568 |
+ jQuery.cssHooks[ dimension ] = { |
|
6569 |
+ get: function( elem, computed, extra ) { |
|
6570 |
+ if ( computed ) { |
|
6571 |
+ |
|
6572 |
+ // Certain elements can have dimension info if we invisibly show them |
|
6573 |
+ // but it must have a current display style that would benefit |
|
6574 |
+ return rdisplayswap.test( jQuery.css( elem, "display" ) ) && |
|
6575 |
+ |
|
6576 |
+ // Support: Safari 8+ |
|
6577 |
+ // Table columns in Safari have non-zero offsetWidth & zero |
|
6578 |
+ // getBoundingClientRect().width unless display is changed. |
|
6579 |
+ // Support: IE <=11 only |
|
6580 |
+ // Running getBoundingClientRect on a disconnected node |
|
6581 |
+ // in IE throws an error. |
|
6582 |
+ ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? |
|
6583 |
+ swap( elem, cssShow, function() { |
|
6584 |
+ return getWidthOrHeight( elem, dimension, extra ); |
|
6585 |
+ } ) : |
|
6586 |
+ getWidthOrHeight( elem, dimension, extra ); |
|
6587 |
+ } |
|
6588 |
+ }, |
|
6589 |
+ |
|
6590 |
+ set: function( elem, value, extra ) { |
|
6591 |
+ var matches, |
|
6592 |
+ styles = getStyles( elem ), |
|
6593 |
+ isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box", |
|
6594 |
+ subtract = extra && boxModelAdjustment( |
|
6595 |
+ elem, |
|
6596 |
+ dimension, |
|
6597 |
+ extra, |
|
6598 |
+ isBorderBox, |
|
6599 |
+ styles |
|
6600 |
+ ); |
|
6601 |
+ |
|
6602 |
+ // Account for unreliable border-box dimensions by comparing offset* to computed and |
|
6603 |
+ // faking a content-box to get border and padding (gh-3699) |
|
6604 |
+ if ( isBorderBox && support.scrollboxSize() === styles.position ) { |
|
6605 |
+ subtract -= Math.ceil( |
|
6606 |
+ elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - |
|
6607 |
+ parseFloat( styles[ dimension ] ) - |
|
6608 |
+ boxModelAdjustment( elem, dimension, "border", false, styles ) - |
|
6609 |
+ 0.5 |
|
6610 |
+ ); |
|
6611 |
+ } |
|
6612 |
+ |
|
6613 |
+ // Convert to pixels if value adjustment is needed |
|
6614 |
+ if ( subtract && ( matches = rcssNum.exec( value ) ) && |
|
6615 |
+ ( matches[ 3 ] || "px" ) !== "px" ) { |
|
6616 |
+ |
|
6617 |
+ elem.style[ dimension ] = value; |
|
6618 |
+ value = jQuery.css( elem, dimension ); |
|
6619 |
+ } |
|
6620 |
+ |
|
6621 |
+ return setPositiveNumber( elem, value, subtract ); |
|
6622 |
+ } |
|
6623 |
+ }; |
|
6624 |
+} ); |
|
6625 |
+ |
|
6626 |
+jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, |
|
6627 |
+ function( elem, computed ) { |
|
6628 |
+ if ( computed ) { |
|
6629 |
+ return ( parseFloat( curCSS( elem, "marginLeft" ) ) || |
|
6630 |
+ elem.getBoundingClientRect().left - |
|
6631 |
+ swap( elem, { marginLeft: 0 }, function() { |
|
6632 |
+ return elem.getBoundingClientRect().left; |
|
6633 |
+ } ) |
|
6634 |
+ ) + "px"; |
|
6635 |
+ } |
|
6636 |
+ } |
|
6637 |
+); |
|
6638 |
+ |
|
6639 |
+// These hooks are used by animate to expand properties |
|
6640 |
+jQuery.each( { |
|
6641 |
+ margin: "", |
|
6642 |
+ padding: "", |
|
6643 |
+ border: "Width" |
|
6644 |
+}, function( prefix, suffix ) { |
|
6645 |
+ jQuery.cssHooks[ prefix + suffix ] = { |
|
6646 |
+ expand: function( value ) { |
|
6647 |
+ var i = 0, |
|
6648 |
+ expanded = {}, |
|
6649 |
+ |
|
6650 |
+ // Assumes a single number if not a string |
|
6651 |
+ parts = typeof value === "string" ? value.split( " " ) : [ value ]; |
|
6652 |
+ |
|
6653 |
+ for ( ; i < 4; i++ ) { |
|
6654 |
+ expanded[ prefix + cssExpand[ i ] + suffix ] = |
|
6655 |
+ parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; |
|
6656 |
+ } |
|
6657 |
+ |
|
6658 |
+ return expanded; |
|
6659 |
+ } |
|
6660 |
+ }; |
|
6661 |
+ |
|
6662 |
+ if ( prefix !== "margin" ) { |
|
6663 |
+ jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; |
|
6664 |
+ } |
|
6665 |
+} ); |
|
6666 |
+ |
|
6667 |
+jQuery.fn.extend( { |
|
6668 |
+ css: function( name, value ) { |
|
6669 |
+ return access( this, function( elem, name, value ) { |
|
6670 |
+ var styles, len, |
|
6671 |
+ map = {}, |
|
6672 |
+ i = 0; |
|
6673 |
+ |
|
6674 |
+ if ( Array.isArray( name ) ) { |
|
6675 |
+ styles = getStyles( elem ); |
|
6676 |
+ len = name.length; |
|
6677 |
+ |
|
6678 |
+ for ( ; i < len; i++ ) { |
|
6679 |
+ map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); |
|
6680 |
+ } |
|
6681 |
+ |
|
6682 |
+ return map; |
|
6683 |
+ } |
|
6684 |
+ |
|
6685 |
+ return value !== undefined ? |
|
6686 |
+ jQuery.style( elem, name, value ) : |
|
6687 |
+ jQuery.css( elem, name ); |
|
6688 |
+ }, name, value, arguments.length > 1 ); |
|
6689 |
+ } |
|
6690 |
+} ); |
|
6691 |
+ |
|
6692 |
+ |
|
6693 |
+function Tween( elem, options, prop, end, easing ) { |
|
6694 |
+ return new Tween.prototype.init( elem, options, prop, end, easing ); |
|
6695 |
+} |
|
6696 |
+jQuery.Tween = Tween; |
|
6697 |
+ |
|
6698 |
+Tween.prototype = { |
|
6699 |
+ constructor: Tween, |
|
6700 |
+ init: function( elem, options, prop, end, easing, unit ) { |
|
6701 |
+ this.elem = elem; |
|
6702 |
+ this.prop = prop; |
|
6703 |
+ this.easing = easing || jQuery.easing._default; |
|
6704 |
+ this.options = options; |
|
6705 |
+ this.start = this.now = this.cur(); |
|
6706 |
+ this.end = end; |
|
6707 |
+ this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); |
|
6708 |
+ }, |
|
6709 |
+ cur: function() { |
|
6710 |
+ var hooks = Tween.propHooks[ this.prop ]; |
|
6711 |
+ |
|
6712 |
+ return hooks && hooks.get ? |
|
6713 |
+ hooks.get( this ) : |
|
6714 |
+ Tween.propHooks._default.get( this ); |
|
6715 |
+ }, |
|
6716 |
+ run: function( percent ) { |
|
6717 |
+ var eased, |
|
6718 |
+ hooks = Tween.propHooks[ this.prop ]; |
|
6719 |
+ |
|
6720 |
+ if ( this.options.duration ) { |
|
6721 |
+ this.pos = eased = jQuery.easing[ this.easing ]( |
|
6722 |
+ percent, this.options.duration * percent, 0, 1, this.options.duration |
|
6723 |
+ ); |
|
6724 |
+ } else { |
|
6725 |
+ this.pos = eased = percent; |
|
6726 |
+ } |
|
6727 |
+ this.now = ( this.end - this.start ) * eased + this.start; |
|
6728 |
+ |
|
6729 |
+ if ( this.options.step ) { |
|
6730 |
+ this.options.step.call( this.elem, this.now, this ); |
|
6731 |
+ } |
|
6732 |
+ |
|
6733 |
+ if ( hooks && hooks.set ) { |
|
6734 |
+ hooks.set( this ); |
|
6735 |
+ } else { |
|
6736 |
+ Tween.propHooks._default.set( this ); |
|
6737 |
+ } |
|
6738 |
+ return this; |
|
6739 |
+ } |
|
6740 |
+}; |
|
6741 |
+ |
|
6742 |
+Tween.prototype.init.prototype = Tween.prototype; |
|
6743 |
+ |
|
6744 |
+Tween.propHooks = { |
|
6745 |
+ _default: { |
|
6746 |
+ get: function( tween ) { |
|
6747 |
+ var result; |
|
6748 |
+ |
|
6749 |
+ // Use a property on the element directly when it is not a DOM element, |
|
6750 |
+ // or when there is no matching style property that exists. |
|
6751 |
+ if ( tween.elem.nodeType !== 1 || |
|
6752 |
+ tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { |
|
6753 |
+ return tween.elem[ tween.prop ]; |
|
6754 |
+ } |
|
6755 |
+ |
|
6756 |
+ // Passing an empty string as a 3rd parameter to .css will automatically |
|
6757 |
+ // attempt a parseFloat and fallback to a string if the parse fails. |
|
6758 |
+ // Simple values such as "10px" are parsed to Float; |
|
6759 |
+ // complex values such as "rotate(1rad)" are returned as-is. |
|
6760 |
+ result = jQuery.css( tween.elem, tween.prop, "" ); |
|
6761 |
+ |
|
6762 |
+ // Empty strings, null, undefined and "auto" are converted to 0. |
|
6763 |
+ return !result || result === "auto" ? 0 : result; |
|
6764 |
+ }, |
|
6765 |
+ set: function( tween ) { |
|
6766 |
+ |
|
6767 |
+ // Use step hook for back compat. |
|
6768 |
+ // Use cssHook if its there. |
|
6769 |
+ // Use .style if available and use plain properties where available. |
|
6770 |
+ if ( jQuery.fx.step[ tween.prop ] ) { |
|
6771 |
+ jQuery.fx.step[ tween.prop ]( tween ); |
|
6772 |
+ } else if ( tween.elem.nodeType === 1 && |
|
6773 |
+ ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || |
|
6774 |
+ jQuery.cssHooks[ tween.prop ] ) ) { |
|
6775 |
+ jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); |
|
6776 |
+ } else { |
|
6777 |
+ tween.elem[ tween.prop ] = tween.now; |
|
6778 |
+ } |
|
6779 |
+ } |
|
6780 |
+ } |
|
6781 |
+}; |
|
6782 |
+ |
|
6783 |
+// Support: IE <=9 only |
|
6784 |
+// Panic based approach to setting things on disconnected nodes |
|
6785 |
+Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { |
|
6786 |
+ set: function( tween ) { |
|
6787 |
+ if ( tween.elem.nodeType && tween.elem.parentNode ) { |
|
6788 |
+ tween.elem[ tween.prop ] = tween.now; |
|
6789 |
+ } |
|
6790 |
+ } |
|
6791 |
+}; |
|
6792 |
+ |
|
6793 |
+jQuery.easing = { |
|
6794 |
+ linear: function( p ) { |
|
6795 |
+ return p; |
|
6796 |
+ }, |
|
6797 |
+ swing: function( p ) { |
|
6798 |
+ return 0.5 - Math.cos( p * Math.PI ) / 2; |
|
6799 |
+ }, |
|
6800 |
+ _default: "swing" |
|
6801 |
+}; |
|
6802 |
+ |
|
6803 |
+jQuery.fx = Tween.prototype.init; |
|
6804 |
+ |
|
6805 |
+// Back compat <1.8 extension point |
|
6806 |
+jQuery.fx.step = {}; |
|
6807 |
+ |
|
6808 |
+ |
|
6809 |
+ |
|
6810 |
+ |
|
6811 |
+var |
|
6812 |
+ fxNow, inProgress, |
|
6813 |
+ rfxtypes = /^(?:toggle|show|hide)$/, |
|
6814 |
+ rrun = /queueHooks$/; |
|
6815 |
+ |
|
6816 |
+function schedule() { |
|
6817 |
+ if ( inProgress ) { |
|
6818 |
+ if ( document.hidden === false && window.requestAnimationFrame ) { |
|
6819 |
+ window.requestAnimationFrame( schedule ); |
|
6820 |
+ } else { |
|
6821 |
+ window.setTimeout( schedule, jQuery.fx.interval ); |
|
6822 |
+ } |
|
6823 |
+ |
|
6824 |
+ jQuery.fx.tick(); |
|
6825 |
+ } |
|
6826 |
+} |
|
6827 |
+ |
|
6828 |
+// Animations created synchronously will run synchronously |
|
6829 |
+function createFxNow() { |
|
6830 |
+ window.setTimeout( function() { |
|
6831 |
+ fxNow = undefined; |
|
6832 |
+ } ); |
|
6833 |
+ return ( fxNow = Date.now() ); |
|
6834 |
+} |
|
6835 |
+ |
|
6836 |
+// Generate parameters to create a standard animation |
|
6837 |
+function genFx( type, includeWidth ) { |
|
6838 |
+ var which, |
|
6839 |
+ i = 0, |
|
6840 |
+ attrs = { height: type }; |
|
6841 |
+ |
|
6842 |
+ // If we include width, step value is 1 to do all cssExpand values, |
|
6843 |
+ // otherwise step value is 2 to skip over Left and Right |
|
6844 |
+ includeWidth = includeWidth ? 1 : 0; |
|
6845 |
+ for ( ; i < 4; i += 2 - includeWidth ) { |
|
6846 |
+ which = cssExpand[ i ]; |
|
6847 |
+ attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; |
|
6848 |
+ } |
|
6849 |
+ |
|
6850 |
+ if ( includeWidth ) { |
|
6851 |
+ attrs.opacity = attrs.width = type; |
|
6852 |
+ } |
|
6853 |
+ |
|
6854 |
+ return attrs; |
|
6855 |
+} |
|
6856 |
+ |
|
6857 |
+function createTween( value, prop, animation ) { |
|
6858 |
+ var tween, |
|
6859 |
+ collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), |
|
6860 |
+ index = 0, |
|
6861 |
+ length = collection.length; |
|
6862 |
+ for ( ; index < length; index++ ) { |
|
6863 |
+ if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { |
|
6864 |
+ |
|
6865 |
+ // We're done with this property |
|
6866 |
+ return tween; |
|
6867 |
+ } |
|
6868 |
+ } |
|
6869 |
+} |
|
6870 |
+ |
|
6871 |
+function defaultPrefilter( elem, props, opts ) { |
|
6872 |
+ var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, |
|
6873 |
+ isBox = "width" in props || "height" in props, |
|
6874 |
+ anim = this, |
|
6875 |
+ orig = {}, |
|
6876 |
+ style = elem.style, |
|
6877 |
+ hidden = elem.nodeType && isHiddenWithinTree( elem ), |
|
6878 |
+ dataShow = dataPriv.get( elem, "fxshow" ); |
|
6879 |
+ |
|
6880 |
+ // Queue-skipping animations hijack the fx hooks |
|
6881 |
+ if ( !opts.queue ) { |
|
6882 |
+ hooks = jQuery._queueHooks( elem, "fx" ); |
|
6883 |
+ if ( hooks.unqueued == null ) { |
|
6884 |
+ hooks.unqueued = 0; |
|
6885 |
+ oldfire = hooks.empty.fire; |
|
6886 |
+ hooks.empty.fire = function() { |
|
6887 |
+ if ( !hooks.unqueued ) { |
|
6888 |
+ oldfire(); |
|
6889 |
+ } |
|
6890 |
+ }; |
|
6891 |
+ } |
|
6892 |
+ hooks.unqueued++; |
|
6893 |
+ |
|
6894 |
+ anim.always( function() { |
|
6895 |
+ |
|
6896 |
+ // Ensure the complete handler is called before this completes |
|
6897 |
+ anim.always( function() { |
|
6898 |
+ hooks.unqueued--; |
|
6899 |
+ if ( !jQuery.queue( elem, "fx" ).length ) { |
|
6900 |
+ hooks.empty.fire(); |
|
6901 |
+ } |
|
6902 |
+ } ); |
|
6903 |
+ } ); |
|
6904 |
+ } |
|
6905 |
+ |
|
6906 |
+ // Detect show/hide animations |
|
6907 |
+ for ( prop in props ) { |
|
6908 |
+ value = props[ prop ]; |
|
6909 |
+ if ( rfxtypes.test( value ) ) { |
|
6910 |
+ delete props[ prop ]; |
|
6911 |
+ toggle = toggle || value === "toggle"; |
|
6912 |
+ if ( value === ( hidden ? "hide" : "show" ) ) { |
|
6913 |
+ |
|
6914 |
+ // Pretend to be hidden if this is a "show" and |
|
6915 |
+ // there is still data from a stopped show/hide |
|
6916 |
+ if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { |
|
6917 |
+ hidden = true; |
|
6918 |
+ |
|
6919 |
+ // Ignore all other no-op show/hide data |
|
6920 |
+ } else { |
|
6921 |
+ continue; |
|
6922 |
+ } |
|
6923 |
+ } |
|
6924 |
+ orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); |
|
6925 |
+ } |
|
6926 |
+ } |
|
6927 |
+ |
|
6928 |
+ // Bail out if this is a no-op like .hide().hide() |
|
6929 |
+ propTween = !jQuery.isEmptyObject( props ); |
|
6930 |
+ if ( !propTween && jQuery.isEmptyObject( orig ) ) { |
|
6931 |
+ return; |
|
6932 |
+ } |
|
6933 |
+ |
|
6934 |
+ // Restrict "overflow" and "display" styles during box animations |
|
6935 |
+ if ( isBox && elem.nodeType === 1 ) { |
|
6936 |
+ |
|
6937 |
+ // Support: IE <=9 - 11, Edge 12 - 15 |
|
6938 |
+ // Record all 3 overflow attributes because IE does not infer the shorthand |
|
6939 |
+ // from identically-valued overflowX and overflowY and Edge just mirrors |
|
6940 |
+ // the overflowX value there. |
|
6941 |
+ opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; |
|
6942 |
+ |
|
6943 |
+ // Identify a display type, preferring old show/hide data over the CSS cascade |
|
6944 |
+ restoreDisplay = dataShow && dataShow.display; |
|
6945 |
+ if ( restoreDisplay == null ) { |
|
6946 |
+ restoreDisplay = dataPriv.get( elem, "display" ); |
|
6947 |
+ } |
|
6948 |
+ display = jQuery.css( elem, "display" ); |
|
6949 |
+ if ( display === "none" ) { |
|
6950 |
+ if ( restoreDisplay ) { |
|
6951 |
+ display = restoreDisplay; |
|
6952 |
+ } else { |
|
6953 |
+ |
|
6954 |
+ // Get nonempty value(s) by temporarily forcing visibility |
|
6955 |
+ showHide( [ elem ], true ); |
|
6956 |
+ restoreDisplay = elem.style.display || restoreDisplay; |
|
6957 |
+ display = jQuery.css( elem, "display" ); |
|
6958 |
+ showHide( [ elem ] ); |
|
6959 |
+ } |
|
6960 |
+ } |
|
6961 |
+ |
|
6962 |
+ // Animate inline elements as inline-block |
|
6963 |
+ if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { |
|
6964 |
+ if ( jQuery.css( elem, "float" ) === "none" ) { |
|
6965 |
+ |
|
6966 |
+ // Restore the original display value at the end of pure show/hide animations |
|
6967 |
+ if ( !propTween ) { |
|
6968 |
+ anim.done( function() { |
|
6969 |
+ style.display = restoreDisplay; |
|
6970 |
+ } ); |
|
6971 |
+ if ( restoreDisplay == null ) { |
|
6972 |
+ display = style.display; |
|
6973 |
+ restoreDisplay = display === "none" ? "" : display; |
|
6974 |
+ } |
|
6975 |
+ } |
|
6976 |
+ style.display = "inline-block"; |
|
6977 |
+ } |
|
6978 |
+ } |
|
6979 |
+ } |
|
6980 |
+ |
|
6981 |
+ if ( opts.overflow ) { |
|
6982 |
+ style.overflow = "hidden"; |
|
6983 |
+ anim.always( function() { |
|
6984 |
+ style.overflow = opts.overflow[ 0 ]; |
|
6985 |
+ style.overflowX = opts.overflow[ 1 ]; |
|
6986 |
+ style.overflowY = opts.overflow[ 2 ]; |
|
6987 |
+ } ); |
|
6988 |
+ } |
|
6989 |
+ |
|
6990 |
+ // Implement show/hide animations |
|
6991 |
+ propTween = false; |
|
6992 |
+ for ( prop in orig ) { |
|
6993 |
+ |
|
6994 |
+ // General show/hide setup for this element animation |
|
6995 |
+ if ( !propTween ) { |
|
6996 |
+ if ( dataShow ) { |
|
6997 |
+ if ( "hidden" in dataShow ) { |
|
6998 |
+ hidden = dataShow.hidden; |
|
6999 |
+ } |
|
7000 |
+ } else { |
|
7001 |
+ dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); |
|
7002 |
+ } |
|
7003 |
+ |
|
7004 |
+ // Store hidden/visible for toggle so `.stop().toggle()` "reverses" |
|
7005 |
+ if ( toggle ) { |
|
7006 |
+ dataShow.hidden = !hidden; |
|
7007 |
+ } |
|
7008 |
+ |
|
7009 |
+ // Show elements before animating them |
|
7010 |
+ if ( hidden ) { |
|
7011 |
+ showHide( [ elem ], true ); |
|
7012 |
+ } |
|
7013 |
+ |
|
7014 |
+ /* eslint-disable no-loop-func */ |
|
7015 |
+ |
|
7016 |
+ anim.done( function() { |
|
7017 |
+ |
|
7018 |
+ /* eslint-enable no-loop-func */ |
|
7019 |
+ |
|
7020 |
+ // The final step of a "hide" animation is actually hiding the element |
|
7021 |
+ if ( !hidden ) { |
|
7022 |
+ showHide( [ elem ] ); |
|
7023 |
+ } |
|
7024 |
+ dataPriv.remove( elem, "fxshow" ); |
|
7025 |
+ for ( prop in orig ) { |
|
7026 |
+ jQuery.style( elem, prop, orig[ prop ] ); |
|
7027 |
+ } |
|
7028 |
+ } ); |
|
7029 |
+ } |
|
7030 |
+ |
|
7031 |
+ // Per-property setup |
|
7032 |
+ propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); |
|
7033 |
+ if ( !( prop in dataShow ) ) { |
|
7034 |
+ dataShow[ prop ] = propTween.start; |
|
7035 |
+ if ( hidden ) { |
|
7036 |
+ propTween.end = propTween.start; |
|
7037 |
+ propTween.start = 0; |
|
7038 |
+ } |
|
7039 |
+ } |
|
7040 |
+ } |
|
7041 |
+} |
|
7042 |
+ |
|
7043 |
+function propFilter( props, specialEasing ) { |
|
7044 |
+ var index, name, easing, value, hooks; |
|
7045 |
+ |
|
7046 |
+ // camelCase, specialEasing and expand cssHook pass |
|
7047 |
+ for ( index in props ) { |
|
7048 |
+ name = camelCase( index ); |
|
7049 |
+ easing = specialEasing[ name ]; |
|
7050 |
+ value = props[ index ]; |
|
7051 |
+ if ( Array.isArray( value ) ) { |
|
7052 |
+ easing = value[ 1 ]; |
|
7053 |
+ value = props[ index ] = value[ 0 ]; |
|
7054 |
+ } |
|
7055 |
+ |
|
7056 |
+ if ( index !== name ) { |
|
7057 |
+ props[ name ] = value; |
|
7058 |
+ delete props[ index ]; |
|
7059 |
+ } |
|
7060 |
+ |
|
7061 |
+ hooks = jQuery.cssHooks[ name ]; |
|
7062 |
+ if ( hooks && "expand" in hooks ) { |
|
7063 |
+ value = hooks.expand( value ); |
|
7064 |
+ delete props[ name ]; |
|
7065 |
+ |
|
7066 |
+ // Not quite $.extend, this won't overwrite existing keys. |
|
7067 |
+ // Reusing 'index' because we have the correct "name" |
|
7068 |
+ for ( index in value ) { |
|
7069 |
+ if ( !( index in props ) ) { |
|
7070 |
+ props[ index ] = value[ index ]; |
|
7071 |
+ specialEasing[ index ] = easing; |
|
7072 |
+ } |
|
7073 |
+ } |
|
7074 |
+ } else { |
|
7075 |
+ specialEasing[ name ] = easing; |
|
7076 |
+ } |
|
7077 |
+ } |
|
7078 |
+} |
|
7079 |
+ |
|
7080 |
+function Animation( elem, properties, options ) { |
|
7081 |
+ var result, |
|
7082 |
+ stopped, |
|
7083 |
+ index = 0, |
|
7084 |
+ length = Animation.prefilters.length, |
|
7085 |
+ deferred = jQuery.Deferred().always( function() { |
|
7086 |
+ |
|
7087 |
+ // Don't match elem in the :animated selector |
|
7088 |
+ delete tick.elem; |
|
7089 |
+ } ), |
|
7090 |
+ tick = function() { |
|
7091 |
+ if ( stopped ) { |
|
7092 |
+ return false; |
|
7093 |
+ } |
|
7094 |
+ var currentTime = fxNow || createFxNow(), |
|
7095 |
+ remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), |
|
7096 |
+ |
|
7097 |
+ // Support: Android 2.3 only |
|
7098 |
+ // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) |
|
7099 |
+ temp = remaining / animation.duration || 0, |
|
7100 |
+ percent = 1 - temp, |
|
7101 |
+ index = 0, |
|
7102 |
+ length = animation.tweens.length; |
|
7103 |
+ |
|
7104 |
+ for ( ; index < length; index++ ) { |
|
7105 |
+ animation.tweens[ index ].run( percent ); |
|
7106 |
+ } |
|
7107 |
+ |
|
7108 |
+ deferred.notifyWith( elem, [ animation, percent, remaining ] ); |
|
7109 |
+ |
|
7110 |
+ // If there's more to do, yield |
|
7111 |
+ if ( percent < 1 && length ) { |
|
7112 |
+ return remaining; |
|
7113 |
+ } |
|
7114 |
+ |
|
7115 |
+ // If this was an empty animation, synthesize a final progress notification |
|
7116 |
+ if ( !length ) { |
|
7117 |
+ deferred.notifyWith( elem, [ animation, 1, 0 ] ); |
|
7118 |
+ } |
|
7119 |
+ |
|
7120 |
+ // Resolve the animation and report its conclusion |
|
7121 |
+ deferred.resolveWith( elem, [ animation ] ); |
|
7122 |
+ return false; |
|
7123 |
+ }, |
|
7124 |
+ animation = deferred.promise( { |
|
7125 |
+ elem: elem, |
|
7126 |
+ props: jQuery.extend( {}, properties ), |
|
7127 |
+ opts: jQuery.extend( true, { |
|
7128 |
+ specialEasing: {}, |
|
7129 |
+ easing: jQuery.easing._default |
|
7130 |
+ }, options ), |
|
7131 |
+ originalProperties: properties, |
|
7132 |
+ originalOptions: options, |
|
7133 |
+ startTime: fxNow || createFxNow(), |
|
7134 |
+ duration: options.duration, |
|
7135 |
+ tweens: [], |
|
7136 |
+ createTween: function( prop, end ) { |
|
7137 |
+ var tween = jQuery.Tween( elem, animation.opts, prop, end, |
|
7138 |
+ animation.opts.specialEasing[ prop ] || animation.opts.easing ); |
|
7139 |
+ animation.tweens.push( tween ); |
|
7140 |
+ return tween; |
|
7141 |
+ }, |
|
7142 |
+ stop: function( gotoEnd ) { |
|
7143 |
+ var index = 0, |
|
7144 |
+ |
|
7145 |
+ // If we are going to the end, we want to run all the tweens |
|
7146 |
+ // otherwise we skip this part |
|
7147 |
+ length = gotoEnd ? animation.tweens.length : 0; |
|
7148 |
+ if ( stopped ) { |
|
7149 |
+ return this; |
|
7150 |
+ } |
|
7151 |
+ stopped = true; |
|
7152 |
+ for ( ; index < length; index++ ) { |
|
7153 |
+ animation.tweens[ index ].run( 1 ); |
|
7154 |
+ } |
|
7155 |
+ |
|
7156 |
+ // Resolve when we played the last frame; otherwise, reject |
|
7157 |
+ if ( gotoEnd ) { |
|
7158 |
+ deferred.notifyWith( elem, [ animation, 1, 0 ] ); |
|
7159 |
+ deferred.resolveWith( elem, [ animation, gotoEnd ] ); |
|
7160 |
+ } else { |
|
7161 |
+ deferred.rejectWith( elem, [ animation, gotoEnd ] ); |
|
7162 |
+ } |
|
7163 |
+ return this; |
|
7164 |
+ } |
|
7165 |
+ } ), |
|
7166 |
+ props = animation.props; |
|
7167 |
+ |
|
7168 |
+ propFilter( props, animation.opts.specialEasing ); |
|
7169 |
+ |
|
7170 |
+ for ( ; index < length; index++ ) { |
|
7171 |
+ result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); |
|
7172 |
+ if ( result ) { |
|
7173 |
+ if ( isFunction( result.stop ) ) { |
|
7174 |
+ jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = |
|
7175 |
+ result.stop.bind( result ); |
|
7176 |
+ } |
|
7177 |
+ return result; |
|
7178 |
+ } |
|
7179 |
+ } |
|
7180 |
+ |
|
7181 |
+ jQuery.map( props, createTween, animation ); |
|
7182 |
+ |
|
7183 |
+ if ( isFunction( animation.opts.start ) ) { |
|
7184 |
+ animation.opts.start.call( elem, animation ); |
|
7185 |
+ } |
|
7186 |
+ |
|
7187 |
+ // Attach callbacks from options |
|
7188 |
+ animation |
|
7189 |
+ .progress( animation.opts.progress ) |
|
7190 |
+ .done( animation.opts.done, animation.opts.complete ) |
|
7191 |
+ .fail( animation.opts.fail ) |
|
7192 |
+ .always( animation.opts.always ); |
|
7193 |
+ |
|
7194 |
+ jQuery.fx.timer( |
|
7195 |
+ jQuery.extend( tick, { |
|
7196 |
+ elem: elem, |
|
7197 |
+ anim: animation, |
|
7198 |
+ queue: animation.opts.queue |
|
7199 |
+ } ) |
|
7200 |
+ ); |
|
7201 |
+ |
|
7202 |
+ return animation; |
|
7203 |
+} |
|
7204 |
+ |
|
7205 |
+jQuery.Animation = jQuery.extend( Animation, { |
|
7206 |
+ |
|
7207 |
+ tweeners: { |
|
7208 |
+ "*": [ function( prop, value ) { |
|
7209 |
+ var tween = this.createTween( prop, value ); |
|
7210 |
+ adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); |
|
7211 |
+ return tween; |
|
7212 |
+ } ] |
|
7213 |
+ }, |
|
7214 |
+ |
|
7215 |
+ tweener: function( props, callback ) { |
|
7216 |
+ if ( isFunction( props ) ) { |
|
7217 |
+ callback = props; |
|
7218 |
+ props = [ "*" ]; |
|
7219 |
+ } else { |
|
7220 |
+ props = props.match( rnothtmlwhite ); |
|
7221 |
+ } |
|
7222 |
+ |
|
7223 |
+ var prop, |
|
7224 |
+ index = 0, |
|
7225 |
+ length = props.length; |
|
7226 |
+ |
|
7227 |
+ for ( ; index < length; index++ ) { |
|
7228 |
+ prop = props[ index ]; |
|
7229 |
+ Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; |
|
7230 |
+ Animation.tweeners[ prop ].unshift( callback ); |
|
7231 |
+ } |
|
7232 |
+ }, |
|
7233 |
+ |
|
7234 |
+ prefilters: [ defaultPrefilter ], |
|
7235 |
+ |
|
7236 |
+ prefilter: function( callback, prepend ) { |
|
7237 |
+ if ( prepend ) { |
|
7238 |
+ Animation.prefilters.unshift( callback ); |
|
7239 |
+ } else { |
|
7240 |
+ Animation.prefilters.push( callback ); |
|
7241 |
+ } |
|
7242 |
+ } |
|
7243 |
+} ); |
|
7244 |
+ |
|
7245 |
+jQuery.speed = function( speed, easing, fn ) { |
|
7246 |
+ var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { |
|
7247 |
+ complete: fn || !fn && easing || |
|
7248 |
+ isFunction( speed ) && speed, |
|
7249 |
+ duration: speed, |
|
7250 |
+ easing: fn && easing || easing && !isFunction( easing ) && easing |
|
7251 |
+ }; |
|
7252 |
+ |
|
7253 |
+ // Go to the end state if fx are off |
|
7254 |
+ if ( jQuery.fx.off ) { |
|
7255 |
+ opt.duration = 0; |
|
7256 |
+ |
|
7257 |
+ } else { |
|
7258 |
+ if ( typeof opt.duration !== "number" ) { |
|
7259 |
+ if ( opt.duration in jQuery.fx.speeds ) { |
|
7260 |
+ opt.duration = jQuery.fx.speeds[ opt.duration ]; |
|
7261 |
+ |
|
7262 |
+ } else { |
|
7263 |
+ opt.duration = jQuery.fx.speeds._default; |
|
7264 |
+ } |
|
7265 |
+ } |
|
7266 |
+ } |
|
7267 |
+ |
|
7268 |
+ // Normalize opt.queue - true/undefined/null -> "fx" |
|
7269 |
+ if ( opt.queue == null || opt.queue === true ) { |
|
7270 |
+ opt.queue = "fx"; |
|
7271 |
+ } |
|
7272 |
+ |
|
7273 |
+ // Queueing |
|
7274 |
+ opt.old = opt.complete; |
|
7275 |
+ |
|
7276 |
+ opt.complete = function() { |
|
7277 |
+ if ( isFunction( opt.old ) ) { |
|
7278 |
+ opt.old.call( this ); |
|
7279 |
+ } |
|
7280 |
+ |
|
7281 |
+ if ( opt.queue ) { |
|
7282 |
+ jQuery.dequeue( this, opt.queue ); |
|
7283 |
+ } |
|
7284 |
+ }; |
|
7285 |
+ |
|
7286 |
+ return opt; |
|
7287 |
+}; |
|
7288 |
+ |
|
7289 |
+jQuery.fn.extend( { |
|
7290 |
+ fadeTo: function( speed, to, easing, callback ) { |
|
7291 |
+ |
|
7292 |
+ // Show any hidden elements after setting opacity to 0 |
|
7293 |
+ return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() |
|
7294 |
+ |
|
7295 |
+ // Animate to the value specified |
|
7296 |
+ .end().animate( { opacity: to }, speed, easing, callback ); |
|
7297 |
+ }, |
|
7298 |
+ animate: function( prop, speed, easing, callback ) { |
|
7299 |
+ var empty = jQuery.isEmptyObject( prop ), |
|
7300 |
+ optall = jQuery.speed( speed, easing, callback ), |
|
7301 |
+ doAnimation = function() { |
|
7302 |
+ |
|
7303 |
+ // Operate on a copy of prop so per-property easing won't be lost |
|
7304 |
+ var anim = Animation( this, jQuery.extend( {}, prop ), optall ); |
|
7305 |
+ |
|
7306 |
+ // Empty animations, or finishing resolves immediately |
|
7307 |
+ if ( empty || dataPriv.get( this, "finish" ) ) { |
|
7308 |
+ anim.stop( true ); |
|
7309 |
+ } |
|
7310 |
+ }; |
|
7311 |
+ doAnimation.finish = doAnimation; |
|
7312 |
+ |
|
7313 |
+ return empty || optall.queue === false ? |
|
7314 |
+ this.each( doAnimation ) : |
|
7315 |
+ this.queue( optall.queue, doAnimation ); |
|
7316 |
+ }, |
|
7317 |
+ stop: function( type, clearQueue, gotoEnd ) { |
|
7318 |
+ var stopQueue = function( hooks ) { |
|
7319 |
+ var stop = hooks.stop; |
|
7320 |
+ delete hooks.stop; |
|
7321 |
+ stop( gotoEnd ); |
|
7322 |
+ }; |
|
7323 |
+ |
|
7324 |
+ if ( typeof type !== "string" ) { |
|
7325 |
+ gotoEnd = clearQueue; |
|
7326 |
+ clearQueue = type; |
|
7327 |
+ type = undefined; |
|
7328 |
+ } |
|
7329 |
+ if ( clearQueue && type !== false ) { |
|
7330 |
+ this.queue( type || "fx", [] ); |
|
7331 |
+ } |
|
7332 |
+ |
|
7333 |
+ return this.each( function() { |
|
7334 |
+ var dequeue = true, |
|
7335 |
+ index = type != null && type + "queueHooks", |
|
7336 |
+ timers = jQuery.timers, |
|
7337 |
+ data = dataPriv.get( this ); |
|
7338 |
+ |
|
7339 |
+ if ( index ) { |
|
7340 |
+ if ( data[ index ] && data[ index ].stop ) { |
|
7341 |
+ stopQueue( data[ index ] ); |
|
7342 |
+ } |
|
7343 |
+ } else { |
|
7344 |
+ for ( index in data ) { |
|
7345 |
+ if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { |
|
7346 |
+ stopQueue( data[ index ] ); |
|
7347 |
+ } |
|
7348 |
+ } |
|
7349 |
+ } |
|
7350 |
+ |
|
7351 |
+ for ( index = timers.length; index--; ) { |
|
7352 |
+ if ( timers[ index ].elem === this && |
|
7353 |
+ ( type == null || timers[ index ].queue === type ) ) { |
|
7354 |
+ |
|
7355 |
+ timers[ index ].anim.stop( gotoEnd ); |
|
7356 |
+ dequeue = false; |
|
7357 |
+ timers.splice( index, 1 ); |
|
7358 |
+ } |
|
7359 |
+ } |
|
7360 |
+ |
|
7361 |
+ // Start the next in the queue if the last step wasn't forced. |
|
7362 |
+ // Timers currently will call their complete callbacks, which |
|
7363 |
+ // will dequeue but only if they were gotoEnd. |
|
7364 |
+ if ( dequeue || !gotoEnd ) { |
|
7365 |
+ jQuery.dequeue( this, type ); |
|
7366 |
+ } |
|
7367 |
+ } ); |
|
7368 |
+ }, |
|
7369 |
+ finish: function( type ) { |
|
7370 |
+ if ( type !== false ) { |
|
7371 |
+ type = type || "fx"; |
|
7372 |
+ } |
|
7373 |
+ return this.each( function() { |
|
7374 |
+ var index, |
|
7375 |
+ data = dataPriv.get( this ), |
|
7376 |
+ queue = data[ type + "queue" ], |
|
7377 |
+ hooks = data[ type + "queueHooks" ], |
|
7378 |
+ timers = jQuery.timers, |
|
7379 |
+ length = queue ? queue.length : 0; |
|
7380 |
+ |
|
7381 |
+ // Enable finishing flag on private data |
|
7382 |
+ data.finish = true; |
|
7383 |
+ |
|
7384 |
+ // Empty the queue first |
|
7385 |
+ jQuery.queue( this, type, [] ); |
|
7386 |
+ |
|
7387 |
+ if ( hooks && hooks.stop ) { |
|
7388 |
+ hooks.stop.call( this, true ); |
|
7389 |
+ } |
|
7390 |
+ |
|
7391 |
+ // Look for any active animations, and finish them |
|
7392 |
+ for ( index = timers.length; index--; ) { |
|
7393 |
+ if ( timers[ index ].elem === this && timers[ index ].queue === type ) { |
|
7394 |
+ timers[ index ].anim.stop( true ); |
|
7395 |
+ timers.splice( index, 1 ); |
|
7396 |
+ } |
|
7397 |
+ } |
|
7398 |
+ |
|
7399 |
+ // Look for any animations in the old queue and finish them |
|
7400 |
+ for ( index = 0; index < length; index++ ) { |
|
7401 |
+ if ( queue[ index ] && queue[ index ].finish ) { |
|
7402 |
+ queue[ index ].finish.call( this ); |
|
7403 |
+ } |
|
7404 |
+ } |
|
7405 |
+ |
|
7406 |
+ // Turn off finishing flag |
|
7407 |
+ delete data.finish; |
|
7408 |
+ } ); |
|
7409 |
+ } |
|
7410 |
+} ); |
|
7411 |
+ |
|
7412 |
+jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { |
|
7413 |
+ var cssFn = jQuery.fn[ name ]; |
|
7414 |
+ jQuery.fn[ name ] = function( speed, easing, callback ) { |
|
7415 |
+ return speed == null || typeof speed === "boolean" ? |
|
7416 |
+ cssFn.apply( this, arguments ) : |
|
7417 |
+ this.animate( genFx( name, true ), speed, easing, callback ); |
|
7418 |
+ }; |
|
7419 |
+} ); |
|
7420 |
+ |
|
7421 |
+// Generate shortcuts for custom animations |
|
7422 |
+jQuery.each( { |
|
7423 |
+ slideDown: genFx( "show" ), |
|
7424 |
+ slideUp: genFx( "hide" ), |
|
7425 |
+ slideToggle: genFx( "toggle" ), |
|
7426 |
+ fadeIn: { opacity: "show" }, |
|
7427 |
+ fadeOut: { opacity: "hide" }, |
|
7428 |
+ fadeToggle: { opacity: "toggle" } |
|
7429 |
+}, function( name, props ) { |
|
7430 |
+ jQuery.fn[ name ] = function( speed, easing, callback ) { |
|
7431 |
+ return this.animate( props, speed, easing, callback ); |
|
7432 |
+ }; |
|
7433 |
+} ); |
|
7434 |
+ |
|
7435 |
+jQuery.timers = []; |
|
7436 |
+jQuery.fx.tick = function() { |
|
7437 |
+ var timer, |
|
7438 |
+ i = 0, |
|
7439 |
+ timers = jQuery.timers; |
|
7440 |
+ |
|
7441 |
+ fxNow = Date.now(); |
|
7442 |
+ |
|
7443 |
+ for ( ; i < timers.length; i++ ) { |
|
7444 |
+ timer = timers[ i ]; |
|
7445 |
+ |
|
7446 |
+ // Run the timer and safely remove it when done (allowing for external removal) |
|
7447 |
+ if ( !timer() && timers[ i ] === timer ) { |
|
7448 |
+ timers.splice( i--, 1 ); |
|
7449 |
+ } |
|
7450 |
+ } |
|
7451 |
+ |
|
7452 |
+ if ( !timers.length ) { |
|
7453 |
+ jQuery.fx.stop(); |
|
7454 |
+ } |
|
7455 |
+ fxNow = undefined; |
|
7456 |
+}; |
|
7457 |
+ |
|
7458 |
+jQuery.fx.timer = function( timer ) { |
|
7459 |
+ jQuery.timers.push( timer ); |
|
7460 |
+ jQuery.fx.start(); |
|
7461 |
+}; |
|
7462 |
+ |
|
7463 |
+jQuery.fx.interval = 13; |
|
7464 |
+jQuery.fx.start = function() { |
|
7465 |
+ if ( inProgress ) { |
|
7466 |
+ return; |
|
7467 |
+ } |
|
7468 |
+ |
|
7469 |
+ inProgress = true; |
|
7470 |
+ schedule(); |
|
7471 |
+}; |
|
7472 |
+ |
|
7473 |
+jQuery.fx.stop = function() { |
|
7474 |
+ inProgress = null; |
|
7475 |
+}; |
|
7476 |
+ |
|
7477 |
+jQuery.fx.speeds = { |
|
7478 |
+ slow: 600, |
|
7479 |
+ fast: 200, |
|
7480 |
+ |
|
7481 |
+ // Default speed |
|
7482 |
+ _default: 400 |
|
7483 |
+}; |
|
7484 |
+ |
|
7485 |
+ |
|
7486 |
+// Based off of the plugin by Clint Helfers, with permission. |
|
7487 |
+// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ |
|
7488 |
+jQuery.fn.delay = function( time, type ) { |
|
7489 |
+ time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; |
|
7490 |
+ type = type || "fx"; |
|
7491 |
+ |
|
7492 |
+ return this.queue( type, function( next, hooks ) { |
|
7493 |
+ var timeout = window.setTimeout( next, time ); |
|
7494 |
+ hooks.stop = function() { |
|
7495 |
+ window.clearTimeout( timeout ); |
|
7496 |
+ }; |
|
7497 |
+ } ); |
|
7498 |
+}; |
|
7499 |
+ |
|
7500 |
+ |
|
7501 |
+( function() { |
|
7502 |
+ var input = document.createElement( "input" ), |
|
7503 |
+ select = document.createElement( "select" ), |
|
7504 |
+ opt = select.appendChild( document.createElement( "option" ) ); |
|
7505 |
+ |
|
7506 |
+ input.type = "checkbox"; |
|
7507 |
+ |
|
7508 |
+ // Support: Android <=4.3 only |
|
7509 |
+ // Default value for a checkbox should be "on" |
|
7510 |
+ support.checkOn = input.value !== ""; |
|
7511 |
+ |
|
7512 |
+ // Support: IE <=11 only |
|
7513 |
+ // Must access selectedIndex to make default options select |
|
7514 |
+ support.optSelected = opt.selected; |
|
7515 |
+ |
|
7516 |
+ // Support: IE <=11 only |
|
7517 |
+ // An input loses its value after becoming a radio |
|
7518 |
+ input = document.createElement( "input" ); |
|
7519 |
+ input.value = "t"; |
|
7520 |
+ input.type = "radio"; |
|
7521 |
+ support.radioValue = input.value === "t"; |
|
7522 |
+} )(); |
|
7523 |
+ |
|
7524 |
+ |
|
7525 |
+var boolHook, |
|
7526 |
+ attrHandle = jQuery.expr.attrHandle; |
|
7527 |
+ |
|
7528 |
+jQuery.fn.extend( { |
|
7529 |
+ attr: function( name, value ) { |
|
7530 |
+ return access( this, jQuery.attr, name, value, arguments.length > 1 ); |
|
7531 |
+ }, |
|
7532 |
+ |
|
7533 |
+ removeAttr: function( name ) { |
|
7534 |
+ return this.each( function() { |
|
7535 |
+ jQuery.removeAttr( this, name ); |
|
7536 |
+ } ); |
|
7537 |
+ } |
|
7538 |
+} ); |
|
7539 |
+ |
|
7540 |
+jQuery.extend( { |
|
7541 |
+ attr: function( elem, name, value ) { |
|
7542 |
+ var ret, hooks, |
|
7543 |
+ nType = elem.nodeType; |
|
7544 |
+ |
|
7545 |
+ // Don't get/set attributes on text, comment and attribute nodes |
|
7546 |
+ if ( nType === 3 || nType === 8 || nType === 2 ) { |
|
7547 |
+ return; |
|
7548 |
+ } |
|
7549 |
+ |
|
7550 |
+ // Fallback to prop when attributes are not supported |
|
7551 |
+ if ( typeof elem.getAttribute === "undefined" ) { |
|
7552 |
+ return jQuery.prop( elem, name, value ); |
|
7553 |
+ } |
|
7554 |
+ |
|
7555 |
+ // Attribute hooks are determined by the lowercase version |
|
7556 |
+ // Grab necessary hook if one is defined |
|
7557 |
+ if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { |
|
7558 |
+ hooks = jQuery.attrHooks[ name.toLowerCase() ] || |
|
7559 |
+ ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); |
|
7560 |
+ } |
|
7561 |
+ |
|
7562 |
+ if ( value !== undefined ) { |
|
7563 |
+ if ( value === null ) { |
|
7564 |
+ jQuery.removeAttr( elem, name ); |
|
7565 |
+ return; |
|
7566 |
+ } |
|
7567 |
+ |
|
7568 |
+ if ( hooks && "set" in hooks && |
|
7569 |
+ ( ret = hooks.set( elem, value, name ) ) !== undefined ) { |
|
7570 |
+ return ret; |
|
7571 |
+ } |
|
7572 |
+ |
|
7573 |
+ elem.setAttribute( name, value + "" ); |
|
7574 |
+ return value; |
|
7575 |
+ } |
|
7576 |
+ |
|
7577 |
+ if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { |
|
7578 |
+ return ret; |
|
7579 |
+ } |
|
7580 |
+ |
|
7581 |
+ ret = jQuery.find.attr( elem, name ); |
|
7582 |
+ |
|
7583 |
+ // Non-existent attributes return null, we normalize to undefined |
|
7584 |
+ return ret == null ? undefined : ret; |
|
7585 |
+ }, |
|
7586 |
+ |
|
7587 |
+ attrHooks: { |
|
7588 |
+ type: { |
|
7589 |
+ set: function( elem, value ) { |
|
7590 |
+ if ( !support.radioValue && value === "radio" && |
|
7591 |
+ nodeName( elem, "input" ) ) { |
|
7592 |
+ var val = elem.value; |
|
7593 |
+ elem.setAttribute( "type", value ); |
|
7594 |
+ if ( val ) { |
|
7595 |
+ elem.value = val; |
|
7596 |
+ } |
|
7597 |
+ return value; |
|
7598 |
+ } |
|
7599 |
+ } |
|
7600 |
+ } |
|
7601 |
+ }, |
|
7602 |
+ |
|
7603 |
+ removeAttr: function( elem, value ) { |
|
7604 |
+ var name, |
|
7605 |
+ i = 0, |
|
7606 |
+ |
|
7607 |
+ // Attribute names can contain non-HTML whitespace characters |
|
7608 |
+ // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 |
|
7609 |
+ attrNames = value && value.match( rnothtmlwhite ); |
|
7610 |
+ |
|
7611 |
+ if ( attrNames && elem.nodeType === 1 ) { |
|
7612 |
+ while ( ( name = attrNames[ i++ ] ) ) { |
|
7613 |
+ elem.removeAttribute( name ); |
|
7614 |
+ } |
|
7615 |
+ } |
|
7616 |
+ } |
|
7617 |
+} ); |
|
7618 |
+ |
|
7619 |
+// Hooks for boolean attributes |
|
7620 |
+boolHook = { |
|
7621 |
+ set: function( elem, value, name ) { |
|
7622 |
+ if ( value === false ) { |
|
7623 |
+ |
|
7624 |
+ // Remove boolean attributes when set to false |
|
7625 |
+ jQuery.removeAttr( elem, name ); |
|
7626 |
+ } else { |
|
7627 |
+ elem.setAttribute( name, name ); |
|
7628 |
+ } |
|
7629 |
+ return name; |
|
7630 |
+ } |
|
7631 |
+}; |
|
7632 |
+ |
|
7633 |
+jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { |
|
7634 |
+ var getter = attrHandle[ name ] || jQuery.find.attr; |
|
7635 |
+ |
|
7636 |
+ attrHandle[ name ] = function( elem, name, isXML ) { |
|
7637 |
+ var ret, handle, |
|
7638 |
+ lowercaseName = name.toLowerCase(); |
|
7639 |
+ |
|
7640 |
+ if ( !isXML ) { |
|
7641 |
+ |
|
7642 |
+ // Avoid an infinite loop by temporarily removing this function from the getter |
|
7643 |
+ handle = attrHandle[ lowercaseName ]; |
|
7644 |
+ attrHandle[ lowercaseName ] = ret; |
|
7645 |
+ ret = getter( elem, name, isXML ) != null ? |
|
7646 |
+ lowercaseName : |
|
7647 |
+ null; |
|
7648 |
+ attrHandle[ lowercaseName ] = handle; |
|
7649 |
+ } |
|
7650 |
+ return ret; |
|
7651 |
+ }; |
|
7652 |
+} ); |
|
7653 |
+ |
|
7654 |
+ |
|
7655 |
+ |
|
7656 |
+ |
|
7657 |
+var rfocusable = /^(?:input|select|textarea|button)$/i, |
|
7658 |
+ rclickable = /^(?:a|area)$/i; |
|
7659 |
+ |
|
7660 |
+jQuery.fn.extend( { |
|
7661 |
+ prop: function( name, value ) { |
|
7662 |
+ return access( this, jQuery.prop, name, value, arguments.length > 1 ); |
|
7663 |
+ }, |
|
7664 |
+ |
|
7665 |
+ removeProp: function( name ) { |
|
7666 |
+ return this.each( function() { |
|
7667 |
+ delete this[ jQuery.propFix[ name ] || name ]; |
|
7668 |
+ } ); |
|
7669 |
+ } |
|
7670 |
+} ); |
|
7671 |
+ |
|
7672 |
+jQuery.extend( { |
|
7673 |
+ prop: function( elem, name, value ) { |
|
7674 |
+ var ret, hooks, |
|
7675 |
+ nType = elem.nodeType; |
|
7676 |
+ |
|
7677 |
+ // Don't get/set properties on text, comment and attribute nodes |
|
7678 |
+ if ( nType === 3 || nType === 8 || nType === 2 ) { |
|
7679 |
+ return; |
|
7680 |
+ } |
|
7681 |
+ |
|
7682 |
+ if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { |
|
7683 |
+ |
|
7684 |
+ // Fix name and attach hooks |
|
7685 |
+ name = jQuery.propFix[ name ] || name; |
|
7686 |
+ hooks = jQuery.propHooks[ name ]; |
|
7687 |
+ } |
|
7688 |
+ |
|
7689 |
+ if ( value !== undefined ) { |
|
7690 |
+ if ( hooks && "set" in hooks && |
|
7691 |
+ ( ret = hooks.set( elem, value, name ) ) !== undefined ) { |
|
7692 |
+ return ret; |
|
7693 |
+ } |
|
7694 |
+ |
|
7695 |
+ return ( elem[ name ] = value ); |
|
7696 |
+ } |
|
7697 |
+ |
|
7698 |
+ if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { |
|
7699 |
+ return ret; |
|
7700 |
+ } |
|
7701 |
+ |
|
7702 |
+ return elem[ name ]; |
|
7703 |
+ }, |
|
7704 |
+ |
|
7705 |
+ propHooks: { |
|
7706 |
+ tabIndex: { |
|
7707 |
+ get: function( elem ) { |
|
7708 |
+ |
|
7709 |
+ // Support: IE <=9 - 11 only |
|
7710 |
+ // elem.tabIndex doesn't always return the |
|
7711 |
+ // correct value when it hasn't been explicitly set |
|
7712 |
+ // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ |
|
7713 |
+ // Use proper attribute retrieval(#12072) |
|
7714 |
+ var tabindex = jQuery.find.attr( elem, "tabindex" ); |
|
7715 |
+ |
|
7716 |
+ if ( tabindex ) { |
|
7717 |
+ return parseInt( tabindex, 10 ); |
|
7718 |
+ } |
|
7719 |
+ |
|
7720 |
+ if ( |
|
7721 |
+ rfocusable.test( elem.nodeName ) || |
|
7722 |
+ rclickable.test( elem.nodeName ) && |
|
7723 |
+ elem.href |
|
7724 |
+ ) { |
|
7725 |
+ return 0; |
|
7726 |
+ } |
|
7727 |
+ |
|
7728 |
+ return -1; |
|
7729 |
+ } |
|
7730 |
+ } |
|
7731 |
+ }, |
|
7732 |
+ |
|
7733 |
+ propFix: { |
|
7734 |
+ "for": "htmlFor", |
|
7735 |
+ "class": "className" |
|
7736 |
+ } |
|
7737 |
+} ); |
|
7738 |
+ |
|
7739 |
+// Support: IE <=11 only |
|
7740 |
+// Accessing the selectedIndex property |
|
7741 |
+// forces the browser to respect setting selected |
|
7742 |
+// on the option |
|
7743 |
+// The getter ensures a default option is selected |
|
7744 |
+// when in an optgroup |
|
7745 |
+// eslint rule "no-unused-expressions" is disabled for this code |
|
7746 |
+// since it considers such accessions noop |
|
7747 |
+if ( !support.optSelected ) { |
|
7748 |
+ jQuery.propHooks.selected = { |
|
7749 |
+ get: function( elem ) { |
|
7750 |
+ |
|
7751 |
+ /* eslint no-unused-expressions: "off" */ |
|
7752 |
+ |
|
7753 |
+ var parent = elem.parentNode; |
|
7754 |
+ if ( parent && parent.parentNode ) { |
|
7755 |
+ parent.parentNode.selectedIndex; |
|
7756 |
+ } |
|
7757 |
+ return null; |
|
7758 |
+ }, |
|
7759 |
+ set: function( elem ) { |
|
7760 |
+ |
|
7761 |
+ /* eslint no-unused-expressions: "off" */ |
|
7762 |
+ |
|
7763 |
+ var parent = elem.parentNode; |
|
7764 |
+ if ( parent ) { |
|
7765 |
+ parent.selectedIndex; |
|
7766 |
+ |
|
7767 |
+ if ( parent.parentNode ) { |
|
7768 |
+ parent.parentNode.selectedIndex; |
|
7769 |
+ } |
|
7770 |
+ } |
|
7771 |
+ } |
|
7772 |
+ }; |
|
7773 |
+} |
|
7774 |
+ |
|
7775 |
+jQuery.each( [ |
|
7776 |
+ "tabIndex", |
|
7777 |
+ "readOnly", |
|
7778 |
+ "maxLength", |
|
7779 |
+ "cellSpacing", |
|
7780 |
+ "cellPadding", |
|
7781 |
+ "rowSpan", |
|
7782 |
+ "colSpan", |
|
7783 |
+ "useMap", |
|
7784 |
+ "frameBorder", |
|
7785 |
+ "contentEditable" |
|
7786 |
+], function() { |
|
7787 |
+ jQuery.propFix[ this.toLowerCase() ] = this; |
|
7788 |
+} ); |
|
7789 |
+ |
|
7790 |
+ |
|
7791 |
+ |
|
7792 |
+ |
|
7793 |
+ // Strip and collapse whitespace according to HTML spec |
|
7794 |
+ // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace |
|
7795 |
+ function stripAndCollapse( value ) { |
|
7796 |
+ var tokens = value.match( rnothtmlwhite ) || []; |
|
7797 |
+ return tokens.join( " " ); |
|
7798 |
+ } |
|
7799 |
+ |
|
7800 |
+ |
|
7801 |
+function getClass( elem ) { |
|
7802 |
+ return elem.getAttribute && elem.getAttribute( "class" ) || ""; |
|
7803 |
+} |
|
7804 |
+ |
|
7805 |
+function classesToArray( value ) { |
|
7806 |
+ if ( Array.isArray( value ) ) { |
|
7807 |
+ return value; |
|
7808 |
+ } |
|
7809 |
+ if ( typeof value === "string" ) { |
|
7810 |
+ return value.match( rnothtmlwhite ) || []; |
|
7811 |
+ } |
|
7812 |
+ return []; |
|
7813 |
+} |
|
7814 |
+ |
|
7815 |
+jQuery.fn.extend( { |
|
7816 |
+ addClass: function( value ) { |
|
7817 |
+ var classes, elem, cur, curValue, clazz, j, finalValue, |
|
7818 |
+ i = 0; |
|
7819 |
+ |
|
7820 |
+ if ( isFunction( value ) ) { |
|
7821 |
+ return this.each( function( j ) { |
|
7822 |
+ jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); |
|
7823 |
+ } ); |
|
7824 |
+ } |
|
7825 |
+ |
|
7826 |
+ classes = classesToArray( value ); |
|
7827 |
+ |
|
7828 |
+ if ( classes.length ) { |
|
7829 |
+ while ( ( elem = this[ i++ ] ) ) { |
|
7830 |
+ curValue = getClass( elem ); |
|
7831 |
+ cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); |
|
7832 |
+ |
|
7833 |
+ if ( cur ) { |
|
7834 |
+ j = 0; |
|
7835 |
+ while ( ( clazz = classes[ j++ ] ) ) { |
|
7836 |
+ if ( cur.indexOf( " " + clazz + " " ) < 0 ) { |
|
7837 |
+ cur += clazz + " "; |
|
7838 |
+ } |
|
7839 |
+ } |
|
7840 |
+ |
|
7841 |
+ // Only assign if different to avoid unneeded rendering. |
|
7842 |
+ finalValue = stripAndCollapse( cur ); |
|
7843 |
+ if ( curValue !== finalValue ) { |
|
7844 |
+ elem.setAttribute( "class", finalValue ); |
|
7845 |
+ } |
|
7846 |
+ } |
|
7847 |
+ } |
|
7848 |
+ } |
|
7849 |
+ |
|
7850 |
+ return this; |
|
7851 |
+ }, |
|
7852 |
+ |
|
7853 |
+ removeClass: function( value ) { |
|
7854 |
+ var classes, elem, cur, curValue, clazz, j, finalValue, |
|
7855 |
+ i = 0; |
|
7856 |
+ |
|
7857 |
+ if ( isFunction( value ) ) { |
|
7858 |
+ return this.each( function( j ) { |
|
7859 |
+ jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); |
|
7860 |
+ } ); |
|
7861 |
+ } |
|
7862 |
+ |
|
7863 |
+ if ( !arguments.length ) { |
|
7864 |
+ return this.attr( "class", "" ); |
|
7865 |
+ } |
|
7866 |
+ |
|
7867 |
+ classes = classesToArray( value ); |
|
7868 |
+ |
|
7869 |
+ if ( classes.length ) { |
|
7870 |
+ while ( ( elem = this[ i++ ] ) ) { |
|
7871 |
+ curValue = getClass( elem ); |
|
7872 |
+ |
|
7873 |
+ // This expression is here for better compressibility (see addClass) |
|
7874 |
+ cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); |
|
7875 |
+ |
|
7876 |
+ if ( cur ) { |
|
7877 |
+ j = 0; |
|
7878 |
+ while ( ( clazz = classes[ j++ ] ) ) { |
|
7879 |
+ |
|
7880 |
+ // Remove *all* instances |
|
7881 |
+ while ( cur.indexOf( " " + clazz + " " ) > -1 ) { |
|
7882 |
+ cur = cur.replace( " " + clazz + " ", " " ); |
|
7883 |
+ } |
|
7884 |
+ } |
|
7885 |
+ |
|
7886 |
+ // Only assign if different to avoid unneeded rendering. |
|
7887 |
+ finalValue = stripAndCollapse( cur ); |
|
7888 |
+ if ( curValue !== finalValue ) { |
|
7889 |
+ elem.setAttribute( "class", finalValue ); |
|
7890 |
+ } |
|
7891 |
+ } |
|
7892 |
+ } |
|
7893 |
+ } |
|
7894 |
+ |
|
7895 |
+ return this; |
|
7896 |
+ }, |
|
7897 |
+ |
|
7898 |
+ toggleClass: function( value, stateVal ) { |
|
7899 |
+ var type = typeof value, |
|
7900 |
+ isValidValue = type === "string" || Array.isArray( value ); |
|
7901 |
+ |
|
7902 |
+ if ( typeof stateVal === "boolean" && isValidValue ) { |
|
7903 |
+ return stateVal ? this.addClass( value ) : this.removeClass( value ); |
|
7904 |
+ } |
|
7905 |
+ |
|
7906 |
+ if ( isFunction( value ) ) { |
|
7907 |
+ return this.each( function( i ) { |
|
7908 |
+ jQuery( this ).toggleClass( |
|
7909 |
+ value.call( this, i, getClass( this ), stateVal ), |
|
7910 |
+ stateVal |
|
7911 |
+ ); |
|
7912 |
+ } ); |
|
7913 |
+ } |
|
7914 |
+ |
|
7915 |
+ return this.each( function() { |
|
7916 |
+ var className, i, self, classNames; |
|
7917 |
+ |
|
7918 |
+ if ( isValidValue ) { |
|
7919 |
+ |
|
7920 |
+ // Toggle individual class names |
|
7921 |
+ i = 0; |
|
7922 |
+ self = jQuery( this ); |
|
7923 |
+ classNames = classesToArray( value ); |
|
7924 |
+ |
|
7925 |
+ while ( ( className = classNames[ i++ ] ) ) { |
|
7926 |
+ |
|
7927 |
+ // Check each className given, space separated list |
|
7928 |
+ if ( self.hasClass( className ) ) { |
|
7929 |
+ self.removeClass( className ); |
|
7930 |
+ } else { |
|
7931 |
+ self.addClass( className ); |
|
7932 |
+ } |
|
7933 |
+ } |
|
7934 |
+ |
|
7935 |
+ // Toggle whole class name |
|
7936 |
+ } else if ( value === undefined || type === "boolean" ) { |
|
7937 |
+ className = getClass( this ); |
|
7938 |
+ if ( className ) { |
|
7939 |
+ |
|
7940 |
+ // Store className if set |
|
7941 |
+ dataPriv.set( this, "__className__", className ); |
|
7942 |
+ } |
|
7943 |
+ |
|
7944 |
+ // If the element has a class name or if we're passed `false`, |
|
7945 |
+ // then remove the whole classname (if there was one, the above saved it). |
|
7946 |
+ // Otherwise bring back whatever was previously saved (if anything), |
|
7947 |
+ // falling back to the empty string if nothing was stored. |
|
7948 |
+ if ( this.setAttribute ) { |
|
7949 |
+ this.setAttribute( "class", |
|
7950 |
+ className || value === false ? |
|
7951 |
+ "" : |
|
7952 |
+ dataPriv.get( this, "__className__" ) || "" |
|
7953 |
+ ); |
|
7954 |
+ } |
|
7955 |
+ } |
|
7956 |
+ } ); |
|
7957 |
+ }, |
|
7958 |
+ |
|
7959 |
+ hasClass: function( selector ) { |
|
7960 |
+ var className, elem, |
|
7961 |
+ i = 0; |
|
7962 |
+ |
|
7963 |
+ className = " " + selector + " "; |
|
7964 |
+ while ( ( elem = this[ i++ ] ) ) { |
|
7965 |
+ if ( elem.nodeType === 1 && |
|
7966 |
+ ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { |
|
7967 |
+ return true; |
|
7968 |
+ } |
|
7969 |
+ } |
|
7970 |
+ |
|
7971 |
+ return false; |
|
7972 |
+ } |
|
7973 |
+} ); |
|
7974 |
+ |
|
7975 |
+ |
|
7976 |
+ |
|
7977 |
+ |
|
7978 |
+var rreturn = /\r/g; |
|
7979 |
+ |
|
7980 |
+jQuery.fn.extend( { |
|
7981 |
+ val: function( value ) { |
|
7982 |
+ var hooks, ret, valueIsFunction, |
|
7983 |
+ elem = this[ 0 ]; |
|
7984 |
+ |
|
7985 |
+ if ( !arguments.length ) { |
|
7986 |
+ if ( elem ) { |
|
7987 |
+ hooks = jQuery.valHooks[ elem.type ] || |
|
7988 |
+ jQuery.valHooks[ elem.nodeName.toLowerCase() ]; |
|
7989 |
+ |
|
7990 |
+ if ( hooks && |
|
7991 |
+ "get" in hooks && |
|
7992 |
+ ( ret = hooks.get( elem, "value" ) ) !== undefined |
|
7993 |
+ ) { |
|
7994 |
+ return ret; |
|
7995 |
+ } |
|
7996 |
+ |
|
7997 |
+ ret = elem.value; |
|
7998 |
+ |
|
7999 |
+ // Handle most common string cases |
|
8000 |
+ if ( typeof ret === "string" ) { |
|
8001 |
+ return ret.replace( rreturn, "" ); |
|
8002 |
+ } |
|
8003 |
+ |
|
8004 |
+ // Handle cases where value is null/undef or number |
|
8005 |
+ return ret == null ? "" : ret; |
|
8006 |
+ } |
|
8007 |
+ |
|
8008 |
+ return; |
|
8009 |
+ } |
|
8010 |
+ |
|
8011 |
+ valueIsFunction = isFunction( value ); |
|
8012 |
+ |
|
8013 |
+ return this.each( function( i ) { |
|
8014 |
+ var val; |
|
8015 |
+ |
|
8016 |
+ if ( this.nodeType !== 1 ) { |
|
8017 |
+ return; |
|
8018 |
+ } |
|
8019 |
+ |
|
8020 |
+ if ( valueIsFunction ) { |
|
8021 |
+ val = value.call( this, i, jQuery( this ).val() ); |
|
8022 |
+ } else { |
|
8023 |
+ val = value; |
|
8024 |
+ } |
|
8025 |
+ |
|
8026 |
+ // Treat null/undefined as ""; convert numbers to string |
|
8027 |
+ if ( val == null ) { |
|
8028 |
+ val = ""; |
|
8029 |
+ |
|
8030 |
+ } else if ( typeof val === "number" ) { |
|
8031 |
+ val += ""; |
|
8032 |
+ |
|
8033 |
+ } else if ( Array.isArray( val ) ) { |
|
8034 |
+ val = jQuery.map( val, function( value ) { |
|
8035 |
+ return value == null ? "" : value + ""; |
|
8036 |
+ } ); |
|
8037 |
+ } |
|
8038 |
+ |
|
8039 |
+ hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; |
|
8040 |
+ |
|
8041 |
+ // If set returns undefined, fall back to normal setting |
|
8042 |
+ if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { |
|
8043 |
+ this.value = val; |
|
8044 |
+ } |
|
8045 |
+ } ); |
|
8046 |
+ } |
|
8047 |
+} ); |
|
8048 |
+ |
|
8049 |
+jQuery.extend( { |
|
8050 |
+ valHooks: { |
|
8051 |
+ option: { |
|
8052 |
+ get: function( elem ) { |
|
8053 |
+ |
|
8054 |
+ var val = jQuery.find.attr( elem, "value" ); |
|
8055 |
+ return val != null ? |
|
8056 |
+ val : |
|
8057 |
+ |
|
8058 |
+ // Support: IE <=10 - 11 only |
|
8059 |
+ // option.text throws exceptions (#14686, #14858) |
|
8060 |
+ // Strip and collapse whitespace |
|
8061 |
+ // https://html.spec.whatwg.org/#strip-and-collapse-whitespace |
|
8062 |
+ stripAndCollapse( jQuery.text( elem ) ); |
|
8063 |
+ } |
|
8064 |
+ }, |
|
8065 |
+ select: { |
|
8066 |
+ get: function( elem ) { |
|
8067 |
+ var value, option, i, |
|
8068 |
+ options = elem.options, |
|
8069 |
+ index = elem.selectedIndex, |
|
8070 |
+ one = elem.type === "select-one", |
|
8071 |
+ values = one ? null : [], |
|
8072 |
+ max = one ? index + 1 : options.length; |
|
8073 |
+ |
|
8074 |
+ if ( index < 0 ) { |
|
8075 |
+ i = max; |
|
8076 |
+ |
|
8077 |
+ } else { |
|
8078 |
+ i = one ? index : 0; |
|
8079 |
+ } |
|
8080 |
+ |
|
8081 |
+ // Loop through all the selected options |
|
8082 |
+ for ( ; i < max; i++ ) { |
|
8083 |
+ option = options[ i ]; |
|
8084 |
+ |
|
8085 |
+ // Support: IE <=9 only |
|
8086 |
+ // IE8-9 doesn't update selected after form reset (#2551) |
|
8087 |
+ if ( ( option.selected || i === index ) && |
|
8088 |
+ |
|
8089 |
+ // Don't return options that are disabled or in a disabled optgroup |
|
8090 |
+ !option.disabled && |
|
8091 |
+ ( !option.parentNode.disabled || |
|
8092 |
+ !nodeName( option.parentNode, "optgroup" ) ) ) { |
|
8093 |
+ |
|
8094 |
+ // Get the specific value for the option |
|
8095 |
+ value = jQuery( option ).val(); |
|
8096 |
+ |
|
8097 |
+ // We don't need an array for one selects |
|
8098 |
+ if ( one ) { |
|
8099 |
+ return value; |
|
8100 |
+ } |
|
8101 |
+ |
|
8102 |
+ // Multi-Selects return an array |
|
8103 |
+ values.push( value ); |
|
8104 |
+ } |
|
8105 |
+ } |
|
8106 |
+ |
|
8107 |
+ return values; |
|
8108 |
+ }, |
|
8109 |
+ |
|
8110 |
+ set: function( elem, value ) { |
|
8111 |
+ var optionSet, option, |
|
8112 |
+ options = elem.options, |
|
8113 |
+ values = jQuery.makeArray( value ), |
|
8114 |
+ i = options.length; |
|
8115 |
+ |
|
8116 |
+ while ( i-- ) { |
|
8117 |
+ option = options[ i ]; |
|
8118 |
+ |
|
8119 |
+ /* eslint-disable no-cond-assign */ |
|
8120 |
+ |
|
8121 |
+ if ( option.selected = |
|
8122 |
+ jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 |
|
8123 |
+ ) { |
|
8124 |
+ optionSet = true; |
|
8125 |
+ } |
|
8126 |
+ |
|
8127 |
+ /* eslint-enable no-cond-assign */ |
|
8128 |
+ } |
|
8129 |
+ |
|
8130 |
+ // Force browsers to behave consistently when non-matching value is set |
|
8131 |
+ if ( !optionSet ) { |
|
8132 |
+ elem.selectedIndex = -1; |
|
8133 |
+ } |
|
8134 |
+ return values; |
|
8135 |
+ } |
|
8136 |
+ } |
|
8137 |
+ } |
|
8138 |
+} ); |
|
8139 |
+ |
|
8140 |
+// Radios and checkboxes getter/setter |
|
8141 |
+jQuery.each( [ "radio", "checkbox" ], function() { |
|
8142 |
+ jQuery.valHooks[ this ] = { |
|
8143 |
+ set: function( elem, value ) { |
|
8144 |
+ if ( Array.isArray( value ) ) { |
|
8145 |
+ return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); |
|
8146 |
+ } |
|
8147 |
+ } |
|
8148 |
+ }; |
|
8149 |
+ if ( !support.checkOn ) { |
|
8150 |
+ jQuery.valHooks[ this ].get = function( elem ) { |
|
8151 |
+ return elem.getAttribute( "value" ) === null ? "on" : elem.value; |
|
8152 |
+ }; |
|
8153 |
+ } |
|
8154 |
+} ); |
|
8155 |
+ |
|
8156 |
+ |
|
8157 |
+ |
|
8158 |
+ |
|
8159 |
+// Return jQuery for attributes-only inclusion |
|
8160 |
+ |
|
8161 |
+ |
|
8162 |
+support.focusin = "onfocusin" in window; |
|
8163 |
+ |
|
8164 |
+ |
|
8165 |
+var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, |
|
8166 |
+ stopPropagationCallback = function( e ) { |
|
8167 |
+ e.stopPropagation(); |
|
8168 |
+ }; |
|
8169 |
+ |
|
8170 |
+jQuery.extend( jQuery.event, { |
|
8171 |
+ |
|
8172 |
+ trigger: function( event, data, elem, onlyHandlers ) { |
|
8173 |
+ |
|
8174 |
+ var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, |
|
8175 |
+ eventPath = [ elem || document ], |
|
8176 |
+ type = hasOwn.call( event, "type" ) ? event.type : event, |
|
8177 |
+ namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; |
|
8178 |
+ |
|
8179 |
+ cur = lastElement = tmp = elem = elem || document; |
|
8180 |
+ |
|
8181 |
+ // Don't do events on text and comment nodes |
|
8182 |
+ if ( elem.nodeType === 3 || elem.nodeType === 8 ) { |
|
8183 |
+ return; |
|
8184 |
+ } |
|
8185 |
+ |
|
8186 |
+ // focus/blur morphs to focusin/out; ensure we're not firing them right now |
|
8187 |
+ if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { |
|
8188 |
+ return; |
|
8189 |
+ } |
|
8190 |
+ |
|
8191 |
+ if ( type.indexOf( "." ) > -1 ) { |
|
8192 |
+ |
|
8193 |
+ // Namespaced trigger; create a regexp to match event type in handle() |
|
8194 |
+ namespaces = type.split( "." ); |
|
8195 |
+ type = namespaces.shift(); |
|
8196 |
+ namespaces.sort(); |
|
8197 |
+ } |
|
8198 |
+ ontype = type.indexOf( ":" ) < 0 && "on" + type; |
|
8199 |
+ |
|
8200 |
+ // Caller can pass in a jQuery.Event object, Object, or just an event type string |
|
8201 |
+ event = event[ jQuery.expando ] ? |
|
8202 |
+ event : |
|
8203 |
+ new jQuery.Event( type, typeof event === "object" && event ); |
|
8204 |
+ |
|
8205 |
+ // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) |
|
8206 |
+ event.isTrigger = onlyHandlers ? 2 : 3; |
|
8207 |
+ event.namespace = namespaces.join( "." ); |
|
8208 |
+ event.rnamespace = event.namespace ? |
|
8209 |
+ new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : |
|
8210 |
+ null; |
|
8211 |
+ |
|
8212 |
+ // Clean up the event in case it is being reused |
|
8213 |
+ event.result = undefined; |
|
8214 |
+ if ( !event.target ) { |
|
8215 |
+ event.target = elem; |
|
8216 |
+ } |
|
8217 |
+ |
|
8218 |
+ // Clone any incoming data and prepend the event, creating the handler arg list |
|
8219 |
+ data = data == null ? |
|
8220 |
+ [ event ] : |
|
8221 |
+ jQuery.makeArray( data, [ event ] ); |
|
8222 |
+ |
|
8223 |
+ // Allow special events to draw outside the lines |
|
8224 |
+ special = jQuery.event.special[ type ] || {}; |
|
8225 |
+ if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { |
|
8226 |
+ return; |
|
8227 |
+ } |
|
8228 |
+ |
|
8229 |
+ // Determine event propagation path in advance, per W3C events spec (#9951) |
|
8230 |
+ // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) |
|
8231 |
+ if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { |
|
8232 |
+ |
|
8233 |
+ bubbleType = special.delegateType || type; |
|
8234 |
+ if ( !rfocusMorph.test( bubbleType + type ) ) { |
|
8235 |
+ cur = cur.parentNode; |
|
8236 |
+ } |
|
8237 |
+ for ( ; cur; cur = cur.parentNode ) { |
|
8238 |
+ eventPath.push( cur ); |
|
8239 |
+ tmp = cur; |
|
8240 |
+ } |
|
8241 |
+ |
|
8242 |
+ // Only add window if we got to document (e.g., not plain obj or detached DOM) |
|
8243 |
+ if ( tmp === ( elem.ownerDocument || document ) ) { |
|
8244 |
+ eventPath.push( tmp.defaultView || tmp.parentWindow || window ); |
|
8245 |
+ } |
|
8246 |
+ } |
|
8247 |
+ |
|
8248 |
+ // Fire handlers on the event path |
|
8249 |
+ i = 0; |
|
8250 |
+ while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { |
|
8251 |
+ lastElement = cur; |
|
8252 |
+ event.type = i > 1 ? |
|
8253 |
+ bubbleType : |
|
8254 |
+ special.bindType || type; |
|
8255 |
+ |
|
8256 |
+ // jQuery handler |
|
8257 |
+ handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] && |
|
8258 |
+ dataPriv.get( cur, "handle" ); |
|
8259 |
+ if ( handle ) { |
|
8260 |
+ handle.apply( cur, data ); |
|
8261 |
+ } |
|
8262 |
+ |
|
8263 |
+ // Native handler |
|
8264 |
+ handle = ontype && cur[ ontype ]; |
|
8265 |
+ if ( handle && handle.apply && acceptData( cur ) ) { |
|
8266 |
+ event.result = handle.apply( cur, data ); |
|
8267 |
+ if ( event.result === false ) { |
|
8268 |
+ event.preventDefault(); |
|
8269 |
+ } |
|
8270 |
+ } |
|
8271 |
+ } |
|
8272 |
+ event.type = type; |
|
8273 |
+ |
|
8274 |
+ // If nobody prevented the default action, do it now |
|
8275 |
+ if ( !onlyHandlers && !event.isDefaultPrevented() ) { |
|
8276 |
+ |
|
8277 |
+ if ( ( !special._default || |
|
8278 |
+ special._default.apply( eventPath.pop(), data ) === false ) && |
|
8279 |
+ acceptData( elem ) ) { |
|
8280 |
+ |
|
8281 |
+ // Call a native DOM method on the target with the same name as the event. |
|
8282 |
+ // Don't do default actions on window, that's where global variables be (#6170) |
|
8283 |
+ if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { |
|
8284 |
+ |
|
8285 |
+ // Don't re-trigger an onFOO event when we call its FOO() method |
|
8286 |
+ tmp = elem[ ontype ]; |
|
8287 |
+ |
|
8288 |
+ if ( tmp ) { |
|
8289 |
+ elem[ ontype ] = null; |
|
8290 |
+ } |
|
8291 |
+ |
|
8292 |
+ // Prevent re-triggering of the same event, since we already bubbled it above |
|
8293 |
+ jQuery.event.triggered = type; |
|
8294 |
+ |
|
8295 |
+ if ( event.isPropagationStopped() ) { |
|
8296 |
+ lastElement.addEventListener( type, stopPropagationCallback ); |
|
8297 |
+ } |
|
8298 |
+ |
|
8299 |
+ elem[ type ](); |
|
8300 |
+ |
|
8301 |
+ if ( event.isPropagationStopped() ) { |
|
8302 |
+ lastElement.removeEventListener( type, stopPropagationCallback ); |
|
8303 |
+ } |
|
8304 |
+ |
|
8305 |
+ jQuery.event.triggered = undefined; |
|
8306 |
+ |
|
8307 |
+ if ( tmp ) { |
|
8308 |
+ elem[ ontype ] = tmp; |
|
8309 |
+ } |
|
8310 |
+ } |
|
8311 |
+ } |
|
8312 |
+ } |
|
8313 |
+ |
|
8314 |
+ return event.result; |
|
8315 |
+ }, |
|
8316 |
+ |
|
8317 |
+ // Piggyback on a donor event to simulate a different one |
|
8318 |
+ // Used only for `focus(in | out)` events |
|
8319 |
+ simulate: function( type, elem, event ) { |
|
8320 |
+ var e = jQuery.extend( |
|
8321 |
+ new jQuery.Event(), |
|
8322 |
+ event, |
|
8323 |
+ { |
|
8324 |
+ type: type, |
|
8325 |
+ isSimulated: true |
|
8326 |
+ } |
|
8327 |
+ ); |
|
8328 |
+ |
|
8329 |
+ jQuery.event.trigger( e, null, elem ); |
|
8330 |
+ } |
|
8331 |
+ |
|
8332 |
+} ); |
|
8333 |
+ |
|
8334 |
+jQuery.fn.extend( { |
|
8335 |
+ |
|
8336 |
+ trigger: function( type, data ) { |
|
8337 |
+ return this.each( function() { |
|
8338 |
+ jQuery.event.trigger( type, data, this ); |
|
8339 |
+ } ); |
|
8340 |
+ }, |
|
8341 |
+ triggerHandler: function( type, data ) { |
|
8342 |
+ var elem = this[ 0 ]; |
|
8343 |
+ if ( elem ) { |
|
8344 |
+ return jQuery.event.trigger( type, data, elem, true ); |
|
8345 |
+ } |
|
8346 |
+ } |
|
8347 |
+} ); |
|
8348 |
+ |
|
8349 |
+ |
|
8350 |
+// Support: Firefox <=44 |
|
8351 |
+// Firefox doesn't have focus(in | out) events |
|
8352 |
+// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 |
|
8353 |
+// |
|
8354 |
+// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 |
|
8355 |
+// focus(in | out) events fire after focus & blur events, |
|
8356 |
+// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order |
|
8357 |
+// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 |
|
8358 |
+if ( !support.focusin ) { |
|
8359 |
+ jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { |
|
8360 |
+ |
|
8361 |
+ // Attach a single capturing handler on the document while someone wants focusin/focusout |
|
8362 |
+ var handler = function( event ) { |
|
8363 |
+ jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); |
|
8364 |
+ }; |
|
8365 |
+ |
|
8366 |
+ jQuery.event.special[ fix ] = { |
|
8367 |
+ setup: function() { |
|
8368 |
+ var doc = this.ownerDocument || this, |
|
8369 |
+ attaches = dataPriv.access( doc, fix ); |
|
8370 |
+ |
|
8371 |
+ if ( !attaches ) { |
|
8372 |
+ doc.addEventListener( orig, handler, true ); |
|
8373 |
+ } |
|
8374 |
+ dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); |
|
8375 |
+ }, |
|
8376 |
+ teardown: function() { |
|
8377 |
+ var doc = this.ownerDocument || this, |
|
8378 |
+ attaches = dataPriv.access( doc, fix ) - 1; |
|
8379 |
+ |
|
8380 |
+ if ( !attaches ) { |
|
8381 |
+ doc.removeEventListener( orig, handler, true ); |
|
8382 |
+ dataPriv.remove( doc, fix ); |
|
8383 |
+ |
|
8384 |
+ } else { |
|
8385 |
+ dataPriv.access( doc, fix, attaches ); |
|
8386 |
+ } |
|
8387 |
+ } |
|
8388 |
+ }; |
|
8389 |
+ } ); |
|
8390 |
+} |
|
8391 |
+var location = window.location; |
|
8392 |
+ |
|
8393 |
+var nonce = Date.now(); |
|
8394 |
+ |
|
8395 |
+var rquery = ( /\?/ ); |
|
8396 |
+ |
|
8397 |
+ |
|
8398 |
+ |
|
8399 |
+// Cross-browser xml parsing |
|
8400 |
+jQuery.parseXML = function( data ) { |
|
8401 |
+ var xml; |
|
8402 |
+ if ( !data || typeof data !== "string" ) { |
|
8403 |
+ return null; |
|
8404 |
+ } |
|
8405 |
+ |
|
8406 |
+ // Support: IE 9 - 11 only |
|
8407 |
+ // IE throws on parseFromString with invalid input. |
|
8408 |
+ try { |
|
8409 |
+ xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); |
|
8410 |
+ } catch ( e ) { |
|
8411 |
+ xml = undefined; |
|
8412 |
+ } |
|
8413 |
+ |
|
8414 |
+ if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { |
|
8415 |
+ jQuery.error( "Invalid XML: " + data ); |
|
8416 |
+ } |
|
8417 |
+ return xml; |
|
8418 |
+}; |
|
8419 |
+ |
|
8420 |
+ |
|
8421 |
+var |
|
8422 |
+ rbracket = /\[\]$/, |
|
8423 |
+ rCRLF = /\r?\n/g, |
|
8424 |
+ rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, |
|
8425 |
+ rsubmittable = /^(?:input|select|textarea|keygen)/i; |
|
8426 |
+ |
|
8427 |
+function buildParams( prefix, obj, traditional, add ) { |
|
8428 |
+ var name; |
|
8429 |
+ |
|
8430 |
+ if ( Array.isArray( obj ) ) { |
|
8431 |
+ |
|
8432 |
+ // Serialize array item. |
|
8433 |
+ jQuery.each( obj, function( i, v ) { |
|
8434 |
+ if ( traditional || rbracket.test( prefix ) ) { |
|
8435 |
+ |
|
8436 |
+ // Treat each array item as a scalar. |
|
8437 |
+ add( prefix, v ); |
|
8438 |
+ |
|
8439 |
+ } else { |
|
8440 |
+ |
|
8441 |
+ // Item is non-scalar (array or object), encode its numeric index. |
|
8442 |
+ buildParams( |
|
8443 |
+ prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", |
|
8444 |
+ v, |
|
8445 |
+ traditional, |
|
8446 |
+ add |
|
8447 |
+ ); |
|
8448 |
+ } |
|
8449 |
+ } ); |
|
8450 |
+ |
|
8451 |
+ } else if ( !traditional && toType( obj ) === "object" ) { |
|
8452 |
+ |
|
8453 |
+ // Serialize object item. |
|
8454 |
+ for ( name in obj ) { |
|
8455 |
+ buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); |
|
8456 |
+ } |
|
8457 |
+ |
|
8458 |
+ } else { |
|
8459 |
+ |
|
8460 |
+ // Serialize scalar item. |
|
8461 |
+ add( prefix, obj ); |
|
8462 |
+ } |
|
8463 |
+} |
|
8464 |
+ |
|
8465 |
+// Serialize an array of form elements or a set of |
|
8466 |
+// key/values into a query string |
|
8467 |
+jQuery.param = function( a, traditional ) { |
|
8468 |
+ var prefix, |
|
8469 |
+ s = [], |
|
8470 |
+ add = function( key, valueOrFunction ) { |
|
8471 |
+ |
|
8472 |
+ // If value is a function, invoke it and use its return value |
|
8473 |
+ var value = isFunction( valueOrFunction ) ? |
|
8474 |
+ valueOrFunction() : |
|
8475 |
+ valueOrFunction; |
|
8476 |
+ |
|
8477 |
+ s[ s.length ] = encodeURIComponent( key ) + "=" + |
|
8478 |
+ encodeURIComponent( value == null ? "" : value ); |
|
8479 |
+ }; |
|
8480 |
+ |
|
8481 |
+ // If an array was passed in, assume that it is an array of form elements. |
|
8482 |
+ if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { |
|
8483 |
+ |
|
8484 |
+ // Serialize the form elements |
|
8485 |
+ jQuery.each( a, function() { |
|
8486 |
+ add( this.name, this.value ); |
|
8487 |
+ } ); |
|
8488 |
+ |
|
8489 |
+ } else { |
|
8490 |
+ |
|
8491 |
+ // If traditional, encode the "old" way (the way 1.3.2 or older |
|
8492 |
+ // did it), otherwise encode params recursively. |
|
8493 |
+ for ( prefix in a ) { |
|
8494 |
+ buildParams( prefix, a[ prefix ], traditional, add ); |
|
8495 |
+ } |
|
8496 |
+ } |
|
8497 |
+ |
|
8498 |
+ // Return the resulting serialization |
|
8499 |
+ return s.join( "&" ); |
|
8500 |
+}; |
|
8501 |
+ |
|
8502 |
+jQuery.fn.extend( { |
|
8503 |
+ serialize: function() { |
|
8504 |
+ return jQuery.param( this.serializeArray() ); |
|
8505 |
+ }, |
|
8506 |
+ serializeArray: function() { |
|
8507 |
+ return this.map( function() { |
|
8508 |
+ |
|
8509 |
+ // Can add propHook for "elements" to filter or add form elements |
|
8510 |
+ var elements = jQuery.prop( this, "elements" ); |
|
8511 |
+ return elements ? jQuery.makeArray( elements ) : this; |
|
8512 |
+ } ) |
|
8513 |
+ .filter( function() { |
|
8514 |
+ var type = this.type; |
|
8515 |
+ |
|
8516 |
+ // Use .is( ":disabled" ) so that fieldset[disabled] works |
|
8517 |
+ return this.name && !jQuery( this ).is( ":disabled" ) && |
|
8518 |
+ rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && |
|
8519 |
+ ( this.checked || !rcheckableType.test( type ) ); |
|
8520 |
+ } ) |
|
8521 |
+ .map( function( i, elem ) { |
|
8522 |
+ var val = jQuery( this ).val(); |
|
8523 |
+ |
|
8524 |
+ if ( val == null ) { |
|
8525 |
+ return null; |
|
8526 |
+ } |
|
8527 |
+ |
|
8528 |
+ if ( Array.isArray( val ) ) { |
|
8529 |
+ return jQuery.map( val, function( val ) { |
|
8530 |
+ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; |
|
8531 |
+ } ); |
|
8532 |
+ } |
|
8533 |
+ |
|
8534 |
+ return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; |
|
8535 |
+ } ).get(); |
|
8536 |
+ } |
|
8537 |
+} ); |
|
8538 |
+ |
|
8539 |
+ |
|
8540 |
+var |
|
8541 |
+ r20 = /%20/g, |
|
8542 |
+ rhash = /#.*$/, |
|
8543 |
+ rantiCache = /([?&])_=[^&]*/, |
|
8544 |
+ rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, |
|
8545 |
+ |
|
8546 |
+ // #7653, #8125, #8152: local protocol detection |
|
8547 |
+ rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, |
|
8548 |
+ rnoContent = /^(?:GET|HEAD)$/, |
|
8549 |
+ rprotocol = /^\/\//, |
|
8550 |
+ |
|
8551 |
+ /* Prefilters |
|
8552 |
+ * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) |
|
8553 |
+ * 2) These are called: |
|
8554 |
+ * - BEFORE asking for a transport |
|
8555 |
+ * - AFTER param serialization (s.data is a string if s.processData is true) |
|
8556 |
+ * 3) key is the dataType |
|
8557 |
+ * 4) the catchall symbol "*" can be used |
|
8558 |
+ * 5) execution will start with transport dataType and THEN continue down to "*" if needed |
|
8559 |
+ */ |
|
8560 |
+ prefilters = {}, |
|
8561 |
+ |
|
8562 |
+ /* Transports bindings |
|
8563 |
+ * 1) key is the dataType |
|
8564 |
+ * 2) the catchall symbol "*" can be used |
|
8565 |
+ * 3) selection will start with transport dataType and THEN go to "*" if needed |
|
8566 |
+ */ |
|
8567 |
+ transports = {}, |
|
8568 |
+ |
|
8569 |
+ // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression |
|
8570 |
+ allTypes = "*/".concat( "*" ), |
|
8571 |
+ |
|
8572 |
+ // Anchor tag for parsing the document origin |
|
8573 |
+ originAnchor = document.createElement( "a" ); |
|
8574 |
+ originAnchor.href = location.href; |
|
8575 |
+ |
|
8576 |
+// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport |
|
8577 |
+function addToPrefiltersOrTransports( structure ) { |
|
8578 |
+ |
|
8579 |
+ // dataTypeExpression is optional and defaults to "*" |
|
8580 |
+ return function( dataTypeExpression, func ) { |
|
8581 |
+ |
|
8582 |
+ if ( typeof dataTypeExpression !== "string" ) { |
|
8583 |
+ func = dataTypeExpression; |
|
8584 |
+ dataTypeExpression = "*"; |
|
8585 |
+ } |
|
8586 |
+ |
|
8587 |
+ var dataType, |
|
8588 |
+ i = 0, |
|
8589 |
+ dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; |
|
8590 |
+ |
|
8591 |
+ if ( isFunction( func ) ) { |
|
8592 |
+ |
|
8593 |
+ // For each dataType in the dataTypeExpression |
|
8594 |
+ while ( ( dataType = dataTypes[ i++ ] ) ) { |
|
8595 |
+ |
|
8596 |
+ // Prepend if requested |
|
8597 |
+ if ( dataType[ 0 ] === "+" ) { |
|
8598 |
+ dataType = dataType.slice( 1 ) || "*"; |
|
8599 |
+ ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); |
|
8600 |
+ |
|
8601 |
+ // Otherwise append |
|
8602 |
+ } else { |
|
8603 |
+ ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); |
|
8604 |
+ } |
|
8605 |
+ } |
|
8606 |
+ } |
|
8607 |
+ }; |
|
8608 |
+} |
|
8609 |
+ |
|
8610 |
+// Base inspection function for prefilters and transports |
|
8611 |
+function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { |
|
8612 |
+ |
|
8613 |
+ var inspected = {}, |
|
8614 |
+ seekingTransport = ( structure === transports ); |
|
8615 |
+ |
|
8616 |
+ function inspect( dataType ) { |
|
8617 |
+ var selected; |
|
8618 |
+ inspected[ dataType ] = true; |
|
8619 |
+ jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { |
|
8620 |
+ var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); |
|
8621 |
+ if ( typeof dataTypeOrTransport === "string" && |
|
8622 |
+ !seekingTransport && !inspected[ dataTypeOrTransport ] ) { |
|
8623 |
+ |
|
8624 |
+ options.dataTypes.unshift( dataTypeOrTransport ); |
|
8625 |
+ inspect( dataTypeOrTransport ); |
|
8626 |
+ return false; |
|
8627 |
+ } else if ( seekingTransport ) { |
|
8628 |
+ return !( selected = dataTypeOrTransport ); |
|
8629 |
+ } |
|
8630 |
+ } ); |
|
8631 |
+ return selected; |
|
8632 |
+ } |
|
8633 |
+ |
|
8634 |
+ return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); |
|
8635 |
+} |
|
8636 |
+ |
|
8637 |
+// A special extend for ajax options |
|
8638 |
+// that takes "flat" options (not to be deep extended) |
|
8639 |
+// Fixes #9887 |
|
8640 |
+function ajaxExtend( target, src ) { |
|
8641 |
+ var key, deep, |
|
8642 |
+ flatOptions = jQuery.ajaxSettings.flatOptions || {}; |
|
8643 |
+ |
|
8644 |
+ for ( key in src ) { |
|
8645 |
+ if ( src[ key ] !== undefined ) { |
|
8646 |
+ ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; |
|
8647 |
+ } |
|
8648 |
+ } |
|
8649 |
+ if ( deep ) { |
|
8650 |
+ jQuery.extend( true, target, deep ); |
|
8651 |
+ } |
|
8652 |
+ |
|
8653 |
+ return target; |
|
8654 |
+} |
|
8655 |
+ |
|
8656 |
+/* Handles responses to an ajax request: |
|
8657 |
+ * - finds the right dataType (mediates between content-type and expected dataType) |
|
8658 |
+ * - returns the corresponding response |
|
8659 |
+ */ |
|
8660 |
+function ajaxHandleResponses( s, jqXHR, responses ) { |
|
8661 |
+ |
|
8662 |
+ var ct, type, finalDataType, firstDataType, |
|
8663 |
+ contents = s.contents, |
|
8664 |
+ dataTypes = s.dataTypes; |
|
8665 |
+ |
|
8666 |
+ // Remove auto dataType and get content-type in the process |
|
8667 |
+ while ( dataTypes[ 0 ] === "*" ) { |
|
8668 |
+ dataTypes.shift(); |
|
8669 |
+ if ( ct === undefined ) { |
|
8670 |
+ ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); |
|
8671 |
+ } |
|
8672 |
+ } |
|
8673 |
+ |
|
8674 |
+ // Check if we're dealing with a known content-type |
|
8675 |
+ if ( ct ) { |
|
8676 |
+ for ( type in contents ) { |
|
8677 |
+ if ( contents[ type ] && contents[ type ].test( ct ) ) { |
|
8678 |
+ dataTypes.unshift( type ); |
|
8679 |
+ break; |
|
8680 |
+ } |
|
8681 |
+ } |
|
8682 |
+ } |
|
8683 |
+ |
|
8684 |
+ // Check to see if we have a response for the expected dataType |
|
8685 |
+ if ( dataTypes[ 0 ] in responses ) { |
|
8686 |
+ finalDataType = dataTypes[ 0 ]; |
|
8687 |
+ } else { |
|
8688 |
+ |
|
8689 |
+ // Try convertible dataTypes |
|
8690 |
+ for ( type in responses ) { |
|
8691 |
+ if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { |
|
8692 |
+ finalDataType = type; |
|
8693 |
+ break; |
|
8694 |
+ } |
|
8695 |
+ if ( !firstDataType ) { |
|
8696 |
+ firstDataType = type; |
|
8697 |
+ } |
|
8698 |
+ } |
|
8699 |
+ |
|
8700 |
+ // Or just use first one |
|
8701 |
+ finalDataType = finalDataType || firstDataType; |
|
8702 |
+ } |
|
8703 |
+ |
|
8704 |
+ // If we found a dataType |
|
8705 |
+ // We add the dataType to the list if needed |
|
8706 |
+ // and return the corresponding response |
|
8707 |
+ if ( finalDataType ) { |
|
8708 |
+ if ( finalDataType !== dataTypes[ 0 ] ) { |
|
8709 |
+ dataTypes.unshift( finalDataType ); |
|
8710 |
+ } |
|
8711 |
+ return responses[ finalDataType ]; |
|
8712 |
+ } |
|
8713 |
+} |
|
8714 |
+ |
|
8715 |
+/* Chain conversions given the request and the original response |
|
8716 |
+ * Also sets the responseXXX fields on the jqXHR instance |
|
8717 |
+ */ |
|
8718 |
+function ajaxConvert( s, response, jqXHR, isSuccess ) { |
|
8719 |
+ var conv2, current, conv, tmp, prev, |
|
8720 |
+ converters = {}, |
|
8721 |
+ |
|
8722 |
+ // Work with a copy of dataTypes in case we need to modify it for conversion |
|
8723 |
+ dataTypes = s.dataTypes.slice(); |
|
8724 |
+ |
|
8725 |
+ // Create converters map with lowercased keys |
|
8726 |
+ if ( dataTypes[ 1 ] ) { |
|
8727 |
+ for ( conv in s.converters ) { |
|
8728 |
+ converters[ conv.toLowerCase() ] = s.converters[ conv ]; |
|
8729 |
+ } |
|
8730 |
+ } |
|
8731 |
+ |
|
8732 |
+ current = dataTypes.shift(); |
|
8733 |
+ |
|
8734 |
+ // Convert to each sequential dataType |
|
8735 |
+ while ( current ) { |
|
8736 |
+ |
|
8737 |
+ if ( s.responseFields[ current ] ) { |
|
8738 |
+ jqXHR[ s.responseFields[ current ] ] = response; |
|
8739 |
+ } |
|
8740 |
+ |
|
8741 |
+ // Apply the dataFilter if provided |
|
8742 |
+ if ( !prev && isSuccess && s.dataFilter ) { |
|
8743 |
+ response = s.dataFilter( response, s.dataType ); |
|
8744 |
+ } |
|
8745 |
+ |
|
8746 |
+ prev = current; |
|
8747 |
+ current = dataTypes.shift(); |
|
8748 |
+ |
|
8749 |
+ if ( current ) { |
|
8750 |
+ |
|
8751 |
+ // There's only work to do if current dataType is non-auto |
|
8752 |
+ if ( current === "*" ) { |
|
8753 |
+ |
|
8754 |
+ current = prev; |
|
8755 |
+ |
|
8756 |
+ // Convert response if prev dataType is non-auto and differs from current |
|
8757 |
+ } else if ( prev !== "*" && prev !== current ) { |
|
8758 |
+ |
|
8759 |
+ // Seek a direct converter |
|
8760 |
+ conv = converters[ prev + " " + current ] || converters[ "* " + current ]; |
|
8761 |
+ |
|
8762 |
+ // If none found, seek a pair |
|
8763 |
+ if ( !conv ) { |
|
8764 |
+ for ( conv2 in converters ) { |
|
8765 |
+ |
|
8766 |
+ // If conv2 outputs current |
|
8767 |
+ tmp = conv2.split( " " ); |
|
8768 |
+ if ( tmp[ 1 ] === current ) { |
|
8769 |
+ |
|
8770 |
+ // If prev can be converted to accepted input |
|
8771 |
+ conv = converters[ prev + " " + tmp[ 0 ] ] || |
|
8772 |
+ converters[ "* " + tmp[ 0 ] ]; |
|
8773 |
+ if ( conv ) { |
|
8774 |
+ |
|
8775 |
+ // Condense equivalence converters |
|
8776 |
+ if ( conv === true ) { |
|
8777 |
+ conv = converters[ conv2 ]; |
|
8778 |
+ |
|
8779 |
+ // Otherwise, insert the intermediate dataType |
|
8780 |
+ } else if ( converters[ conv2 ] !== true ) { |
|
8781 |
+ current = tmp[ 0 ]; |
|
8782 |
+ dataTypes.unshift( tmp[ 1 ] ); |
|
8783 |
+ } |
|
8784 |
+ break; |
|
8785 |
+ } |
|
8786 |
+ } |
|
8787 |
+ } |
|
8788 |
+ } |
|
8789 |
+ |
|
8790 |
+ // Apply converter (if not an equivalence) |
|
8791 |
+ if ( conv !== true ) { |
|
8792 |
+ |
|
8793 |
+ // Unless errors are allowed to bubble, catch and return them |
|
8794 |
+ if ( conv && s.throws ) { |
|
8795 |
+ response = conv( response ); |
|
8796 |
+ } else { |
|
8797 |
+ try { |
|
8798 |
+ response = conv( response ); |
|
8799 |
+ } catch ( e ) { |
|
8800 |
+ return { |
|
8801 |
+ state: "parsererror", |
|
8802 |
+ error: conv ? e : "No conversion from " + prev + " to " + current |
|
8803 |
+ }; |
|
8804 |
+ } |
|
8805 |
+ } |
|
8806 |
+ } |
|
8807 |
+ } |
|
8808 |
+ } |
|
8809 |
+ } |
|
8810 |
+ |
|
8811 |
+ return { state: "success", data: response }; |
|
8812 |
+} |
|
8813 |
+ |
|
8814 |
+jQuery.extend( { |
|
8815 |
+ |
|
8816 |
+ // Counter for holding the number of active queries |
|
8817 |
+ active: 0, |
|
8818 |
+ |
|
8819 |
+ // Last-Modified header cache for next request |
|
8820 |
+ lastModified: {}, |
|
8821 |
+ etag: {}, |
|
8822 |
+ |
|
8823 |
+ ajaxSettings: { |
|
8824 |
+ url: location.href, |
|
8825 |
+ type: "GET", |
|
8826 |
+ isLocal: rlocalProtocol.test( location.protocol ), |
|
8827 |
+ global: true, |
|
8828 |
+ processData: true, |
|
8829 |
+ async: true, |
|
8830 |
+ contentType: "application/x-www-form-urlencoded; charset=UTF-8", |
|
8831 |
+ |
|
8832 |
+ /* |
|
8833 |
+ timeout: 0, |
|
8834 |
+ data: null, |
|
8835 |
+ dataType: null, |
|
8836 |
+ username: null, |
|
8837 |
+ password: null, |
|
8838 |
+ cache: null, |
|
8839 |
+ throws: false, |
|
8840 |
+ traditional: false, |
|
8841 |
+ headers: {}, |
|
8842 |
+ */ |
|
8843 |
+ |
|
8844 |
+ accepts: { |
|
8845 |
+ "*": allTypes, |
|
8846 |
+ text: "text/plain", |
|
8847 |
+ html: "text/html", |
|
8848 |
+ xml: "application/xml, text/xml", |
|
8849 |
+ json: "application/json, text/javascript" |
|
8850 |
+ }, |
|
8851 |
+ |
|
8852 |
+ contents: { |
|
8853 |
+ xml: /\bxml\b/, |
|
8854 |
+ html: /\bhtml/, |
|
8855 |
+ json: /\bjson\b/ |
|
8856 |
+ }, |
|
8857 |
+ |
|
8858 |
+ responseFields: { |
|
8859 |
+ xml: "responseXML", |
|
8860 |
+ text: "responseText", |
|
8861 |
+ json: "responseJSON" |
|
8862 |
+ }, |
|
8863 |
+ |
|
8864 |
+ // Data converters |
|
8865 |
+ // Keys separate source (or catchall "*") and destination types with a single space |
|
8866 |
+ converters: { |
|
8867 |
+ |
|
8868 |
+ // Convert anything to text |
|
8869 |
+ "* text": String, |
|
8870 |
+ |
|
8871 |
+ // Text to html (true = no transformation) |
|
8872 |
+ "text html": true, |
|
8873 |
+ |
|
8874 |
+ // Evaluate text as a json expression |
|
8875 |
+ "text json": JSON.parse, |
|
8876 |
+ |
|
8877 |
+ // Parse text as xml |
|
8878 |
+ "text xml": jQuery.parseXML |
|
8879 |
+ }, |
|
8880 |
+ |
|
8881 |
+ // For options that shouldn't be deep extended: |
|
8882 |
+ // you can add your own custom options here if |
|
8883 |
+ // and when you create one that shouldn't be |
|
8884 |
+ // deep extended (see ajaxExtend) |
|
8885 |
+ flatOptions: { |
|
8886 |
+ url: true, |
|
8887 |
+ context: true |
|
8888 |
+ } |
|
8889 |
+ }, |
|
8890 |
+ |
|
8891 |
+ // Creates a full fledged settings object into target |
|
8892 |
+ // with both ajaxSettings and settings fields. |
|
8893 |
+ // If target is omitted, writes into ajaxSettings. |
|
8894 |
+ ajaxSetup: function( target, settings ) { |
|
8895 |
+ return settings ? |
|
8896 |
+ |
|
8897 |
+ // Building a settings object |
|
8898 |
+ ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : |
|
8899 |
+ |
|
8900 |
+ // Extending ajaxSettings |
|
8901 |
+ ajaxExtend( jQuery.ajaxSettings, target ); |
|
8902 |
+ }, |
|
8903 |
+ |
|
8904 |
+ ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), |
|
8905 |
+ ajaxTransport: addToPrefiltersOrTransports( transports ), |
|
8906 |
+ |
|
8907 |
+ // Main method |
|
8908 |
+ ajax: function( url, options ) { |
|
8909 |
+ |
|
8910 |
+ // If url is an object, simulate pre-1.5 signature |
|
8911 |
+ if ( typeof url === "object" ) { |
|
8912 |
+ options = url; |
|
8913 |
+ url = undefined; |
|
8914 |
+ } |
|
8915 |
+ |
|
8916 |
+ // Force options to be an object |
|
8917 |
+ options = options || {}; |
|
8918 |
+ |
|
8919 |
+ var transport, |
|
8920 |
+ |
|
8921 |
+ // URL without anti-cache param |
|
8922 |
+ cacheURL, |
|
8923 |
+ |
|
8924 |
+ // Response headers |
|
8925 |
+ responseHeadersString, |
|
8926 |
+ responseHeaders, |
|
8927 |
+ |
|
8928 |
+ // timeout handle |
|
8929 |
+ timeoutTimer, |
|
8930 |
+ |
|
8931 |
+ // Url cleanup var |
|
8932 |
+ urlAnchor, |
|
8933 |
+ |
|
8934 |
+ // Request state (becomes false upon send and true upon completion) |
|
8935 |
+ completed, |
|
8936 |
+ |
|
8937 |
+ // To know if global events are to be dispatched |
|
8938 |
+ fireGlobals, |
|
8939 |
+ |
|
8940 |
+ // Loop variable |
|
8941 |
+ i, |
|
8942 |
+ |
|
8943 |
+ // uncached part of the url |
|
8944 |
+ uncached, |
|
8945 |
+ |
|
8946 |
+ // Create the final options object |
|
8947 |
+ s = jQuery.ajaxSetup( {}, options ), |
|
8948 |
+ |
|
8949 |
+ // Callbacks context |
|
8950 |
+ callbackContext = s.context || s, |
|
8951 |
+ |
|
8952 |
+ // Context for global events is callbackContext if it is a DOM node or jQuery collection |
|
8953 |
+ globalEventContext = s.context && |
|
8954 |
+ ( callbackContext.nodeType || callbackContext.jquery ) ? |
|
8955 |
+ jQuery( callbackContext ) : |
|
8956 |
+ jQuery.event, |
|
8957 |
+ |
|
8958 |
+ // Deferreds |
|
8959 |
+ deferred = jQuery.Deferred(), |
|
8960 |
+ completeDeferred = jQuery.Callbacks( "once memory" ), |
|
8961 |
+ |
|
8962 |
+ // Status-dependent callbacks |
|
8963 |
+ statusCode = s.statusCode || {}, |
|
8964 |
+ |
|
8965 |
+ // Headers (they are sent all at once) |
|
8966 |
+ requestHeaders = {}, |
|
8967 |
+ requestHeadersNames = {}, |
|
8968 |
+ |
|
8969 |
+ // Default abort message |
|
8970 |
+ strAbort = "canceled", |
|
8971 |
+ |
|
8972 |
+ // Fake xhr |
|
8973 |
+ jqXHR = { |
|
8974 |
+ readyState: 0, |
|
8975 |
+ |
|
8976 |
+ // Builds headers hashtable if needed |
|
8977 |
+ getResponseHeader: function( key ) { |
|
8978 |
+ var match; |
|
8979 |
+ if ( completed ) { |
|
8980 |
+ if ( !responseHeaders ) { |
|
8981 |
+ responseHeaders = {}; |
|
8982 |
+ while ( ( match = rheaders.exec( responseHeadersString ) ) ) { |
|
8983 |
+ responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; |
|
8984 |
+ } |
|
8985 |
+ } |
|
8986 |
+ match = responseHeaders[ key.toLowerCase() ]; |
|
8987 |
+ } |
|
8988 |
+ return match == null ? null : match; |
|
8989 |
+ }, |
|
8990 |
+ |
|
8991 |
+ // Raw string |
|
8992 |
+ getAllResponseHeaders: function() { |
|
8993 |
+ return completed ? responseHeadersString : null; |
|
8994 |
+ }, |
|
8995 |
+ |
|
8996 |
+ // Caches the header |
|
8997 |
+ setRequestHeader: function( name, value ) { |
|
8998 |
+ if ( completed == null ) { |
|
8999 |
+ name = requestHeadersNames[ name.toLowerCase() ] = |
|
9000 |
+ requestHeadersNames[ name.toLowerCase() ] || name; |
|
9001 |
+ requestHeaders[ name ] = value; |
|
9002 |
+ } |
|
9003 |
+ return this; |
|
9004 |
+ }, |
|
9005 |
+ |
|
9006 |
+ // Overrides response content-type header |
|
9007 |
+ overrideMimeType: function( type ) { |
|
9008 |
+ if ( completed == null ) { |
|
9009 |
+ s.mimeType = type; |
|
9010 |
+ } |
|
9011 |
+ return this; |
|
9012 |
+ }, |
|
9013 |
+ |
|
9014 |
+ // Status-dependent callbacks |
|
9015 |
+ statusCode: function( map ) { |
|
9016 |
+ var code; |
|
9017 |
+ if ( map ) { |
|
9018 |
+ if ( completed ) { |
|
9019 |
+ |
|
9020 |
+ // Execute the appropriate callbacks |
|
9021 |
+ jqXHR.always( map[ jqXHR.status ] ); |
|
9022 |
+ } else { |
|
9023 |
+ |
|
9024 |
+ // Lazy-add the new callbacks in a way that preserves old ones |
|
9025 |
+ for ( code in map ) { |
|
9026 |
+ statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; |
|
9027 |
+ } |
|
9028 |
+ } |
|
9029 |
+ } |
|
9030 |
+ return this; |
|
9031 |
+ }, |
|
9032 |
+ |
|
9033 |
+ // Cancel the request |
|
9034 |
+ abort: function( statusText ) { |
|
9035 |
+ var finalText = statusText || strAbort; |
|
9036 |
+ if ( transport ) { |
|
9037 |
+ transport.abort( finalText ); |
|
9038 |
+ } |
|
9039 |
+ done( 0, finalText ); |
|
9040 |
+ return this; |
|
9041 |
+ } |
|
9042 |
+ }; |
|
9043 |
+ |
|
9044 |
+ // Attach deferreds |
|
9045 |
+ deferred.promise( jqXHR ); |
|
9046 |
+ |
|
9047 |
+ // Add protocol if not provided (prefilters might expect it) |
|
9048 |
+ // Handle falsy url in the settings object (#10093: consistency with old signature) |
|
9049 |
+ // We also use the url parameter if available |
|
9050 |
+ s.url = ( ( url || s.url || location.href ) + "" ) |
|
9051 |
+ .replace( rprotocol, location.protocol + "//" ); |
|
9052 |
+ |
|
9053 |
+ // Alias method option to type as per ticket #12004 |
|
9054 |
+ s.type = options.method || options.type || s.method || s.type; |
|
9055 |
+ |
|
9056 |
+ // Extract dataTypes list |
|
9057 |
+ s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; |
|
9058 |
+ |
|
9059 |
+ // A cross-domain request is in order when the origin doesn't match the current origin. |
|
9060 |
+ if ( s.crossDomain == null ) { |
|
9061 |
+ urlAnchor = document.createElement( "a" ); |
|
9062 |
+ |
|
9063 |
+ // Support: IE <=8 - 11, Edge 12 - 15 |
|
9064 |
+ // IE throws exception on accessing the href property if url is malformed, |
|
9065 |
+ // e.g. http://example.com:80x/ |
|
9066 |
+ try { |
|
9067 |
+ urlAnchor.href = s.url; |
|
9068 |
+ |
|
9069 |
+ // Support: IE <=8 - 11 only |
|
9070 |
+ // Anchor's host property isn't correctly set when s.url is relative |
|
9071 |
+ urlAnchor.href = urlAnchor.href; |
|
9072 |
+ s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== |
|
9073 |
+ urlAnchor.protocol + "//" + urlAnchor.host; |
|
9074 |
+ } catch ( e ) { |
|
9075 |
+ |
|
9076 |
+ // If there is an error parsing the URL, assume it is crossDomain, |
|
9077 |
+ // it can be rejected by the transport if it is invalid |
|
9078 |
+ s.crossDomain = true; |
|
9079 |
+ } |
|
9080 |
+ } |
|
9081 |
+ |
|
9082 |
+ // Convert data if not already a string |
|
9083 |
+ if ( s.data && s.processData && typeof s.data !== "string" ) { |
|
9084 |
+ s.data = jQuery.param( s.data, s.traditional ); |
|
9085 |
+ } |
|
9086 |
+ |
|
9087 |
+ // Apply prefilters |
|
9088 |
+ inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); |
|
9089 |
+ |
|
9090 |
+ // If request was aborted inside a prefilter, stop there |
|
9091 |
+ if ( completed ) { |
|
9092 |
+ return jqXHR; |
|
9093 |
+ } |
|
9094 |
+ |
|
9095 |
+ // We can fire global events as of now if asked to |
|
9096 |
+ // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) |
|
9097 |
+ fireGlobals = jQuery.event && s.global; |
|
9098 |
+ |
|
9099 |
+ // Watch for a new set of requests |
|
9100 |
+ if ( fireGlobals && jQuery.active++ === 0 ) { |
|
9101 |
+ jQuery.event.trigger( "ajaxStart" ); |
|
9102 |
+ } |
|
9103 |
+ |
|
9104 |
+ // Uppercase the type |
|
9105 |
+ s.type = s.type.toUpperCase(); |
|
9106 |
+ |
|
9107 |
+ // Determine if request has content |
|
9108 |
+ s.hasContent = !rnoContent.test( s.type ); |
|
9109 |
+ |
|
9110 |
+ // Save the URL in case we're toying with the If-Modified-Since |
|
9111 |
+ // and/or If-None-Match header later on |
|
9112 |
+ // Remove hash to simplify url manipulation |
|
9113 |
+ cacheURL = s.url.replace( rhash, "" ); |
|
9114 |
+ |
|
9115 |
+ // More options handling for requests with no content |
|
9116 |
+ if ( !s.hasContent ) { |
|
9117 |
+ |
|
9118 |
+ // Remember the hash so we can put it back |
|
9119 |
+ uncached = s.url.slice( cacheURL.length ); |
|
9120 |
+ |
|
9121 |
+ // If data is available and should be processed, append data to url |
|
9122 |
+ if ( s.data && ( s.processData || typeof s.data === "string" ) ) { |
|
9123 |
+ cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; |
|
9124 |
+ |
|
9125 |
+ // #9682: remove data so that it's not used in an eventual retry |
|
9126 |
+ delete s.data; |
|
9127 |
+ } |
|
9128 |
+ |
|
9129 |
+ // Add or update anti-cache param if needed |
|
9130 |
+ if ( s.cache === false ) { |
|
9131 |
+ cacheURL = cacheURL.replace( rantiCache, "$1" ); |
|
9132 |
+ uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached; |
|
9133 |
+ } |
|
9134 |
+ |
|
9135 |
+ // Put hash and anti-cache on the URL that will be requested (gh-1732) |
|
9136 |
+ s.url = cacheURL + uncached; |
|
9137 |
+ |
|
9138 |
+ // Change '%20' to '+' if this is encoded form body content (gh-2658) |
|
9139 |
+ } else if ( s.data && s.processData && |
|
9140 |
+ ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { |
|
9141 |
+ s.data = s.data.replace( r20, "+" ); |
|
9142 |
+ } |
|
9143 |
+ |
|
9144 |
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
|
9145 |
+ if ( s.ifModified ) { |
|
9146 |
+ if ( jQuery.lastModified[ cacheURL ] ) { |
|
9147 |
+ jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); |
|
9148 |
+ } |
|
9149 |
+ if ( jQuery.etag[ cacheURL ] ) { |
|
9150 |
+ jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); |
|
9151 |
+ } |
|
9152 |
+ } |
|
9153 |
+ |
|
9154 |
+ // Set the correct header, if data is being sent |
|
9155 |
+ if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { |
|
9156 |
+ jqXHR.setRequestHeader( "Content-Type", s.contentType ); |
|
9157 |
+ } |
|
9158 |
+ |
|
9159 |
+ // Set the Accepts header for the server, depending on the dataType |
|
9160 |
+ jqXHR.setRequestHeader( |
|
9161 |
+ "Accept", |
|
9162 |
+ s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? |
|
9163 |
+ s.accepts[ s.dataTypes[ 0 ] ] + |
|
9164 |
+ ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : |
|
9165 |
+ s.accepts[ "*" ] |
|
9166 |
+ ); |
|
9167 |
+ |
|
9168 |
+ // Check for headers option |
|
9169 |
+ for ( i in s.headers ) { |
|
9170 |
+ jqXHR.setRequestHeader( i, s.headers[ i ] ); |
|
9171 |
+ } |
|
9172 |
+ |
|
9173 |
+ // Allow custom headers/mimetypes and early abort |
|
9174 |
+ if ( s.beforeSend && |
|
9175 |
+ ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { |
|
9176 |
+ |
|
9177 |
+ // Abort if not done already and return |
|
9178 |
+ return jqXHR.abort(); |
|
9179 |
+ } |
|
9180 |
+ |
|
9181 |
+ // Aborting is no longer a cancellation |
|
9182 |
+ strAbort = "abort"; |
|
9183 |
+ |
|
9184 |
+ // Install callbacks on deferreds |
|
9185 |
+ completeDeferred.add( s.complete ); |
|
9186 |
+ jqXHR.done( s.success ); |
|
9187 |
+ jqXHR.fail( s.error ); |
|
9188 |
+ |
|
9189 |
+ // Get transport |
|
9190 |
+ transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); |
|
9191 |
+ |
|
9192 |
+ // If no transport, we auto-abort |
|
9193 |
+ if ( !transport ) { |
|
9194 |
+ done( -1, "No Transport" ); |
|
9195 |
+ } else { |
|
9196 |
+ jqXHR.readyState = 1; |
|
9197 |
+ |
|
9198 |
+ // Send global event |
|
9199 |
+ if ( fireGlobals ) { |
|
9200 |
+ globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); |
|
9201 |
+ } |
|
9202 |
+ |
|
9203 |
+ // If request was aborted inside ajaxSend, stop there |
|
9204 |
+ if ( completed ) { |
|
9205 |
+ return jqXHR; |
|
9206 |
+ } |
|
9207 |
+ |
|
9208 |
+ // Timeout |
|
9209 |
+ if ( s.async && s.timeout > 0 ) { |
|
9210 |
+ timeoutTimer = window.setTimeout( function() { |
|
9211 |
+ jqXHR.abort( "timeout" ); |
|
9212 |
+ }, s.timeout ); |
|
9213 |
+ } |
|
9214 |
+ |
|
9215 |
+ try { |
|
9216 |
+ completed = false; |
|
9217 |
+ transport.send( requestHeaders, done ); |
|
9218 |
+ } catch ( e ) { |
|
9219 |
+ |
|
9220 |
+ // Rethrow post-completion exceptions |
|
9221 |
+ if ( completed ) { |
|
9222 |
+ throw e; |
|
9223 |
+ } |
|
9224 |
+ |
|
9225 |
+ // Propagate others as results |
|
9226 |
+ done( -1, e ); |
|
9227 |
+ } |
|
9228 |
+ } |
|
9229 |
+ |
|
9230 |
+ // Callback for when everything is done |
|
9231 |
+ function done( status, nativeStatusText, responses, headers ) { |
|
9232 |
+ var isSuccess, success, error, response, modified, |
|
9233 |
+ statusText = nativeStatusText; |
|
9234 |
+ |
|
9235 |
+ // Ignore repeat invocations |
|
9236 |
+ if ( completed ) { |
|
9237 |
+ return; |
|
9238 |
+ } |
|
9239 |
+ |
|
9240 |
+ completed = true; |
|
9241 |
+ |
|
9242 |
+ // Clear timeout if it exists |
|
9243 |
+ if ( timeoutTimer ) { |
|
9244 |
+ window.clearTimeout( timeoutTimer ); |
|
9245 |
+ } |
|
9246 |
+ |
|
9247 |
+ // Dereference transport for early garbage collection |
|
9248 |
+ // (no matter how long the jqXHR object will be used) |
|
9249 |
+ transport = undefined; |
|
9250 |
+ |
|
9251 |
+ // Cache response headers |
|
9252 |
+ responseHeadersString = headers || ""; |
|
9253 |
+ |
|
9254 |
+ // Set readyState |
|
9255 |
+ jqXHR.readyState = status > 0 ? 4 : 0; |
|
9256 |
+ |
|
9257 |
+ // Determine if successful |
|
9258 |
+ isSuccess = status >= 200 && status < 300 || status === 304; |
|
9259 |
+ |
|
9260 |
+ // Get response data |
|
9261 |
+ if ( responses ) { |
|
9262 |
+ response = ajaxHandleResponses( s, jqXHR, responses ); |
|
9263 |
+ } |
|
9264 |
+ |
|
9265 |
+ // Convert no matter what (that way responseXXX fields are always set) |
|
9266 |
+ response = ajaxConvert( s, response, jqXHR, isSuccess ); |
|
9267 |
+ |
|
9268 |
+ // If successful, handle type chaining |
|
9269 |
+ if ( isSuccess ) { |
|
9270 |
+ |
|
9271 |
+ // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
|
9272 |
+ if ( s.ifModified ) { |
|
9273 |
+ modified = jqXHR.getResponseHeader( "Last-Modified" ); |
|
9274 |
+ if ( modified ) { |
|
9275 |
+ jQuery.lastModified[ cacheURL ] = modified; |
|
9276 |
+ } |
|
9277 |
+ modified = jqXHR.getResponseHeader( "etag" ); |
|
9278 |
+ if ( modified ) { |
|
9279 |
+ jQuery.etag[ cacheURL ] = modified; |
|
9280 |
+ } |
|
9281 |
+ } |
|
9282 |
+ |
|
9283 |
+ // if no content |
|
9284 |
+ if ( status === 204 || s.type === "HEAD" ) { |
|
9285 |
+ statusText = "nocontent"; |
|
9286 |
+ |
|
9287 |
+ // if not modified |
|
9288 |
+ } else if ( status === 304 ) { |
|
9289 |
+ statusText = "notmodified"; |
|
9290 |
+ |
|
9291 |
+ // If we have data, let's convert it |
|
9292 |
+ } else { |
|
9293 |
+ statusText = response.state; |
|
9294 |
+ success = response.data; |
|
9295 |
+ error = response.error; |
|
9296 |
+ isSuccess = !error; |
|
9297 |
+ } |
|
9298 |
+ } else { |
|
9299 |
+ |
|
9300 |
+ // Extract error from statusText and normalize for non-aborts |
|
9301 |
+ error = statusText; |
|
9302 |
+ if ( status || !statusText ) { |
|
9303 |
+ statusText = "error"; |
|
9304 |
+ if ( status < 0 ) { |
|
9305 |
+ status = 0; |
|
9306 |
+ } |
|
9307 |
+ } |
|
9308 |
+ } |
|
9309 |
+ |
|
9310 |
+ // Set data for the fake xhr object |
|
9311 |
+ jqXHR.status = status; |
|
9312 |
+ jqXHR.statusText = ( nativeStatusText || statusText ) + ""; |
|
9313 |
+ |
|
9314 |
+ // Success/Error |
|
9315 |
+ if ( isSuccess ) { |
|
9316 |
+ deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); |
|
9317 |
+ } else { |
|
9318 |
+ deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); |
|
9319 |
+ } |
|
9320 |
+ |
|
9321 |
+ // Status-dependent callbacks |
|
9322 |
+ jqXHR.statusCode( statusCode ); |
|
9323 |
+ statusCode = undefined; |
|
9324 |
+ |
|
9325 |
+ if ( fireGlobals ) { |
|
9326 |
+ globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", |
|
9327 |
+ [ jqXHR, s, isSuccess ? success : error ] ); |
|
9328 |
+ } |
|
9329 |
+ |
|
9330 |
+ // Complete |
|
9331 |
+ completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); |
|
9332 |
+ |
|
9333 |
+ if ( fireGlobals ) { |
|
9334 |
+ globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); |
|
9335 |
+ |
|
9336 |
+ // Handle the global AJAX counter |
|
9337 |
+ if ( !( --jQuery.active ) ) { |
|
9338 |
+ jQuery.event.trigger( "ajaxStop" ); |
|
9339 |
+ } |
|
9340 |
+ } |
|
9341 |
+ } |
|
9342 |
+ |
|
9343 |
+ return jqXHR; |
|
9344 |
+ }, |
|
9345 |
+ |
|
9346 |
+ getJSON: function( url, data, callback ) { |
|
9347 |
+ return jQuery.get( url, data, callback, "json" ); |
|
9348 |
+ }, |
|
9349 |
+ |
|
9350 |
+ getScript: function( url, callback ) { |
|
9351 |
+ return jQuery.get( url, undefined, callback, "script" ); |
|
9352 |
+ } |
|
9353 |
+} ); |
|
9354 |
+ |
|
9355 |
+jQuery.each( [ "get", "post" ], function( i, method ) { |
|
9356 |
+ jQuery[ method ] = function( url, data, callback, type ) { |
|
9357 |
+ |
|
9358 |
+ // Shift arguments if data argument was omitted |
|
9359 |
+ if ( isFunction( data ) ) { |
|
9360 |
+ type = type || callback; |
|
9361 |
+ callback = data; |
|
9362 |
+ data = undefined; |
|
9363 |
+ } |
|
9364 |
+ |
|
9365 |
+ // The url can be an options object (which then must have .url) |
|
9366 |
+ return jQuery.ajax( jQuery.extend( { |
|
9367 |
+ url: url, |
|
9368 |
+ type: method, |
|
9369 |
+ dataType: type, |
|
9370 |
+ data: data, |
|
9371 |
+ success: callback |
|
9372 |
+ }, jQuery.isPlainObject( url ) && url ) ); |
|
9373 |
+ }; |
|
9374 |
+} ); |
|
9375 |
+ |
|
9376 |
+ |
|
9377 |
+jQuery._evalUrl = function( url ) { |
|
9378 |
+ return jQuery.ajax( { |
|
9379 |
+ url: url, |
|
9380 |
+ |
|
9381 |
+ // Make this explicit, since user can override this through ajaxSetup (#11264) |
|
9382 |
+ type: "GET", |
|
9383 |
+ dataType: "script", |
|
9384 |
+ cache: true, |
|
9385 |
+ async: false, |
|
9386 |
+ global: false, |
|
9387 |
+ "throws": true |
|
9388 |
+ } ); |
|
9389 |
+}; |
|
9390 |
+ |
|
9391 |
+ |
|
9392 |
+jQuery.fn.extend( { |
|
9393 |
+ wrapAll: function( html ) { |
|
9394 |
+ var wrap; |
|
9395 |
+ |
|
9396 |
+ if ( this[ 0 ] ) { |
|
9397 |
+ if ( isFunction( html ) ) { |
|
9398 |
+ html = html.call( this[ 0 ] ); |
|
9399 |
+ } |
|
9400 |
+ |
|
9401 |
+ // The elements to wrap the target around |
|
9402 |
+ wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); |
|
9403 |
+ |
|
9404 |
+ if ( this[ 0 ].parentNode ) { |
|
9405 |
+ wrap.insertBefore( this[ 0 ] ); |
|
9406 |
+ } |
|
9407 |
+ |
|
9408 |
+ wrap.map( function() { |
|
9409 |
+ var elem = this; |
|
9410 |
+ |
|
9411 |
+ while ( elem.firstElementChild ) { |
|
9412 |
+ elem = elem.firstElementChild; |
|
9413 |
+ } |
|
9414 |
+ |
|
9415 |
+ return elem; |
|
9416 |
+ } ).append( this ); |
|
9417 |
+ } |
|
9418 |
+ |
|
9419 |
+ return this; |
|
9420 |
+ }, |
|
9421 |
+ |
|
9422 |
+ wrapInner: function( html ) { |
|
9423 |
+ if ( isFunction( html ) ) { |
|
9424 |
+ return this.each( function( i ) { |
|
9425 |
+ jQuery( this ).wrapInner( html.call( this, i ) ); |
|
9426 |
+ } ); |
|
9427 |
+ } |
|
9428 |
+ |
|
9429 |
+ return this.each( function() { |
|
9430 |
+ var self = jQuery( this ), |
|
9431 |
+ contents = self.contents(); |
|
9432 |
+ |
|
9433 |
+ if ( contents.length ) { |
|
9434 |
+ contents.wrapAll( html ); |
|
9435 |
+ |
|
9436 |
+ } else { |
|
9437 |
+ self.append( html ); |
|
9438 |
+ } |
|
9439 |
+ } ); |
|
9440 |
+ }, |
|
9441 |
+ |
|
9442 |
+ wrap: function( html ) { |
|
9443 |
+ var htmlIsFunction = isFunction( html ); |
|
9444 |
+ |
|
9445 |
+ return this.each( function( i ) { |
|
9446 |
+ jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); |
|
9447 |
+ } ); |
|
9448 |
+ }, |
|
9449 |
+ |
|
9450 |
+ unwrap: function( selector ) { |
|
9451 |
+ this.parent( selector ).not( "body" ).each( function() { |
|
9452 |
+ jQuery( this ).replaceWith( this.childNodes ); |
|
9453 |
+ } ); |
|
9454 |
+ return this; |
|
9455 |
+ } |
|
9456 |
+} ); |
|
9457 |
+ |
|
9458 |
+ |
|
9459 |
+jQuery.expr.pseudos.hidden = function( elem ) { |
|
9460 |
+ return !jQuery.expr.pseudos.visible( elem ); |
|
9461 |
+}; |
|
9462 |
+jQuery.expr.pseudos.visible = function( elem ) { |
|
9463 |
+ return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); |
|
9464 |
+}; |
|
9465 |
+ |
|
9466 |
+ |
|
9467 |
+ |
|
9468 |
+ |
|
9469 |
+jQuery.ajaxSettings.xhr = function() { |
|
9470 |
+ try { |
|
9471 |
+ return new window.XMLHttpRequest(); |
|
9472 |
+ } catch ( e ) {} |
|
9473 |
+}; |
|
9474 |
+ |
|
9475 |
+var xhrSuccessStatus = { |
|
9476 |
+ |
|
9477 |
+ // File protocol always yields status code 0, assume 200 |
|
9478 |
+ 0: 200, |
|
9479 |
+ |
|
9480 |
+ // Support: IE <=9 only |
|
9481 |
+ // #1450: sometimes IE returns 1223 when it should be 204 |
|
9482 |
+ 1223: 204 |
|
9483 |
+ }, |
|
9484 |
+ xhrSupported = jQuery.ajaxSettings.xhr(); |
|
9485 |
+ |
|
9486 |
+support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); |
|
9487 |
+support.ajax = xhrSupported = !!xhrSupported; |
|
9488 |
+ |
|
9489 |
+jQuery.ajaxTransport( function( options ) { |
|
9490 |
+ var callback, errorCallback; |
|
9491 |
+ |
|
9492 |
+ // Cross domain only allowed if supported through XMLHttpRequest |
|
9493 |
+ if ( support.cors || xhrSupported && !options.crossDomain ) { |
|
9494 |
+ return { |
|
9495 |
+ send: function( headers, complete ) { |
|
9496 |
+ var i, |
|
9497 |
+ xhr = options.xhr(); |
|
9498 |
+ |
|
9499 |
+ xhr.open( |
|
9500 |
+ options.type, |
|
9501 |
+ options.url, |
|
9502 |
+ options.async, |
|
9503 |
+ options.username, |
|
9504 |
+ options.password |
|
9505 |
+ ); |
|
9506 |
+ |
|
9507 |
+ // Apply custom fields if provided |
|
9508 |
+ if ( options.xhrFields ) { |
|
9509 |
+ for ( i in options.xhrFields ) { |
|
9510 |
+ xhr[ i ] = options.xhrFields[ i ]; |
|
9511 |
+ } |
|
9512 |
+ } |
|
9513 |
+ |
|
9514 |
+ // Override mime type if needed |
|
9515 |
+ if ( options.mimeType && xhr.overrideMimeType ) { |
|
9516 |
+ xhr.overrideMimeType( options.mimeType ); |
|
9517 |
+ } |
|
9518 |
+ |
|
9519 |
+ // X-Requested-With header |
|
9520 |
+ // For cross-domain requests, seeing as conditions for a preflight are |
|
9521 |
+ // akin to a jigsaw puzzle, we simply never set it to be sure. |
|
9522 |
+ // (it can always be set on a per-request basis or even using ajaxSetup) |
|
9523 |
+ // For same-domain requests, won't change header if already provided. |
|
9524 |
+ if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { |
|
9525 |
+ headers[ "X-Requested-With" ] = "XMLHttpRequest"; |
|
9526 |
+ } |
|
9527 |
+ |
|
9528 |
+ // Set headers |
|
9529 |
+ for ( i in headers ) { |
|
9530 |
+ xhr.setRequestHeader( i, headers[ i ] ); |
|
9531 |
+ } |
|
9532 |
+ |
|
9533 |
+ // Callback |
|
9534 |
+ callback = function( type ) { |
|
9535 |
+ return function() { |
|
9536 |
+ if ( callback ) { |
|
9537 |
+ callback = errorCallback = xhr.onload = |
|
9538 |
+ xhr.onerror = xhr.onabort = xhr.ontimeout = |
|
9539 |
+ xhr.onreadystatechange = null; |
|
9540 |
+ |
|
9541 |
+ if ( type === "abort" ) { |
|
9542 |
+ xhr.abort(); |
|
9543 |
+ } else if ( type === "error" ) { |
|
9544 |
+ |
|
9545 |
+ // Support: IE <=9 only |
|
9546 |
+ // On a manual native abort, IE9 throws |
|
9547 |
+ // errors on any property access that is not readyState |
|
9548 |
+ if ( typeof xhr.status !== "number" ) { |
|
9549 |
+ complete( 0, "error" ); |
|
9550 |
+ } else { |
|
9551 |
+ complete( |
|
9552 |
+ |
|
9553 |
+ // File: protocol always yields status 0; see #8605, #14207 |
|
9554 |
+ xhr.status, |
|
9555 |
+ xhr.statusText |
|
9556 |
+ ); |
|
9557 |
+ } |
|
9558 |
+ } else { |
|
9559 |
+ complete( |
|
9560 |
+ xhrSuccessStatus[ xhr.status ] || xhr.status, |
|
9561 |
+ xhr.statusText, |
|
9562 |
+ |
|
9563 |
+ // Support: IE <=9 only |
|
9564 |
+ // IE9 has no XHR2 but throws on binary (trac-11426) |
|
9565 |
+ // For XHR2 non-text, let the caller handle it (gh-2498) |
|
9566 |
+ ( xhr.responseType || "text" ) !== "text" || |
|
9567 |
+ typeof xhr.responseText !== "string" ? |
|
9568 |
+ { binary: xhr.response } : |
|
9569 |
+ { text: xhr.responseText }, |
|
9570 |
+ xhr.getAllResponseHeaders() |
|
9571 |
+ ); |
|
9572 |
+ } |
|
9573 |
+ } |
|
9574 |
+ }; |
|
9575 |
+ }; |
|
9576 |
+ |
|
9577 |
+ // Listen to events |
|
9578 |
+ xhr.onload = callback(); |
|
9579 |
+ errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); |
|
9580 |
+ |
|
9581 |
+ // Support: IE 9 only |
|
9582 |
+ // Use onreadystatechange to replace onabort |
|
9583 |
+ // to handle uncaught aborts |
|
9584 |
+ if ( xhr.onabort !== undefined ) { |
|
9585 |
+ xhr.onabort = errorCallback; |
|
9586 |
+ } else { |
|
9587 |
+ xhr.onreadystatechange = function() { |
|
9588 |
+ |
|
9589 |
+ // Check readyState before timeout as it changes |
|
9590 |
+ if ( xhr.readyState === 4 ) { |
|
9591 |
+ |
|
9592 |
+ // Allow onerror to be called first, |
|
9593 |
+ // but that will not handle a native abort |
|
9594 |
+ // Also, save errorCallback to a variable |
|
9595 |
+ // as xhr.onerror cannot be accessed |
|
9596 |
+ window.setTimeout( function() { |
|
9597 |
+ if ( callback ) { |
|
9598 |
+ errorCallback(); |
|
9599 |
+ } |
|
9600 |
+ } ); |
|
9601 |
+ } |
|
9602 |
+ }; |
|
9603 |
+ } |
|
9604 |
+ |
|
9605 |
+ // Create the abort callback |
|
9606 |
+ callback = callback( "abort" ); |
|
9607 |
+ |
|
9608 |
+ try { |
|
9609 |
+ |
|
9610 |
+ // Do send the request (this may raise an exception) |
|
9611 |
+ xhr.send( options.hasContent && options.data || null ); |
|
9612 |
+ } catch ( e ) { |
|
9613 |
+ |
|
9614 |
+ // #14683: Only rethrow if this hasn't been notified as an error yet |
|
9615 |
+ if ( callback ) { |
|
9616 |
+ throw e; |
|
9617 |
+ } |
|
9618 |
+ } |
|
9619 |
+ }, |
|
9620 |
+ |
|
9621 |
+ abort: function() { |
|
9622 |
+ if ( callback ) { |
|
9623 |
+ callback(); |
|
9624 |
+ } |
|
9625 |
+ } |
|
9626 |
+ }; |
|
9627 |
+ } |
|
9628 |
+} ); |
|
9629 |
+ |
|
9630 |
+ |
|
9631 |
+ |
|
9632 |
+ |
|
9633 |
+// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) |
|
9634 |
+jQuery.ajaxPrefilter( function( s ) { |
|
9635 |
+ if ( s.crossDomain ) { |
|
9636 |
+ s.contents.script = false; |
|
9637 |
+ } |
|
9638 |
+} ); |
|
9639 |
+ |
|
9640 |
+// Install script dataType |
|
9641 |
+jQuery.ajaxSetup( { |
|
9642 |
+ accepts: { |
|
9643 |
+ script: "text/javascript, application/javascript, " + |
|
9644 |
+ "application/ecmascript, application/x-ecmascript" |
|
9645 |
+ }, |
|
9646 |
+ contents: { |
|
9647 |
+ script: /\b(?:java|ecma)script\b/ |
|
9648 |
+ }, |
|
9649 |
+ converters: { |
|
9650 |
+ "text script": function( text ) { |
|
9651 |
+ jQuery.globalEval( text ); |
|
9652 |
+ return text; |
|
9653 |
+ } |
|
9654 |
+ } |
|
9655 |
+} ); |
|
9656 |
+ |
|
9657 |
+// Handle cache's special case and crossDomain |
|
9658 |
+jQuery.ajaxPrefilter( "script", function( s ) { |
|
9659 |
+ if ( s.cache === undefined ) { |
|
9660 |
+ s.cache = false; |
|
9661 |
+ } |
|
9662 |
+ if ( s.crossDomain ) { |
|
9663 |
+ s.type = "GET"; |
|
9664 |
+ } |
|
9665 |
+} ); |
|
9666 |
+ |
|
9667 |
+// Bind script tag hack transport |
|
9668 |
+jQuery.ajaxTransport( "script", function( s ) { |
|
9669 |
+ |
|
9670 |
+ // This transport only deals with cross domain requests |
|
9671 |
+ if ( s.crossDomain ) { |
|
9672 |
+ var script, callback; |
|
9673 |
+ return { |
|
9674 |
+ send: function( _, complete ) { |
|
9675 |
+ script = jQuery( "<script>" ).prop( { |
|
9676 |
+ charset: s.scriptCharset, |
|
9677 |
+ src: s.url |
|
9678 |
+ } ).on( |
|
9679 |
+ "load error", |
|
9680 |
+ callback = function( evt ) { |
|
9681 |
+ script.remove(); |
|
9682 |
+ callback = null; |
|
9683 |
+ if ( evt ) { |
|
9684 |
+ complete( evt.type === "error" ? 404 : 200, evt.type ); |
|
9685 |
+ } |
|
9686 |
+ } |
|
9687 |
+ ); |
|
9688 |
+ |
|
9689 |
+ // Use native DOM manipulation to avoid our domManip AJAX trickery |
|
9690 |
+ document.head.appendChild( script[ 0 ] ); |
|
9691 |
+ }, |
|
9692 |
+ abort: function() { |
|
9693 |
+ if ( callback ) { |
|
9694 |
+ callback(); |
|
9695 |
+ } |
|
9696 |
+ } |
|
9697 |
+ }; |
|
9698 |
+ } |
|
9699 |
+} ); |
|
9700 |
+ |
|
9701 |
+ |
|
9702 |
+ |
|
9703 |
+ |
|
9704 |
+var oldCallbacks = [], |
|
9705 |
+ rjsonp = /(=)\?(?=&|$)|\?\?/; |
|
9706 |
+ |
|
9707 |
+// Default jsonp settings |
|
9708 |
+jQuery.ajaxSetup( { |
|
9709 |
+ jsonp: "callback", |
|
9710 |
+ jsonpCallback: function() { |
|
9711 |
+ var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); |
|
9712 |
+ this[ callback ] = true; |
|
9713 |
+ return callback; |
|
9714 |
+ } |
|
9715 |
+} ); |
|
9716 |
+ |
|
9717 |
+// Detect, normalize options and install callbacks for jsonp requests |
|
9718 |
+jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { |
|
9719 |
+ |
|
9720 |
+ var callbackName, overwritten, responseContainer, |
|
9721 |
+ jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? |
|
9722 |
+ "url" : |
|
9723 |
+ typeof s.data === "string" && |
|
9724 |
+ ( s.contentType || "" ) |
|
9725 |
+ .indexOf( "application/x-www-form-urlencoded" ) === 0 && |
|
9726 |
+ rjsonp.test( s.data ) && "data" |
|
9727 |
+ ); |
|
9728 |
+ |
|
9729 |
+ // Handle iff the expected data type is "jsonp" or we have a parameter to set |
|
9730 |
+ if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { |
|
9731 |
+ |
|
9732 |
+ // Get callback name, remembering preexisting value associated with it |
|
9733 |
+ callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? |
|
9734 |
+ s.jsonpCallback() : |
|
9735 |
+ s.jsonpCallback; |
|
9736 |
+ |
|
9737 |
+ // Insert callback into url or form data |
|
9738 |
+ if ( jsonProp ) { |
|
9739 |
+ s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); |
|
9740 |
+ } else if ( s.jsonp !== false ) { |
|
9741 |
+ s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; |
|
9742 |
+ } |
|
9743 |
+ |
|
9744 |
+ // Use data converter to retrieve json after script execution |
|
9745 |
+ s.converters[ "script json" ] = function() { |
|
9746 |
+ if ( !responseContainer ) { |
|
9747 |
+ jQuery.error( callbackName + " was not called" ); |
|
9748 |
+ } |
|
9749 |
+ return responseContainer[ 0 ]; |
|
9750 |
+ }; |
|
9751 |
+ |
|
9752 |
+ // Force json dataType |
|
9753 |
+ s.dataTypes[ 0 ] = "json"; |
|
9754 |
+ |
|
9755 |
+ // Install callback |
|
9756 |
+ overwritten = window[ callbackName ]; |
|
9757 |
+ window[ callbackName ] = function() { |
|
9758 |
+ responseContainer = arguments; |
|
9759 |
+ }; |
|
9760 |
+ |
|
9761 |
+ // Clean-up function (fires after converters) |
|
9762 |
+ jqXHR.always( function() { |
|
9763 |
+ |
|
9764 |
+ // If previous value didn't exist - remove it |
|
9765 |
+ if ( overwritten === undefined ) { |
|
9766 |
+ jQuery( window ).removeProp( callbackName ); |
|
9767 |
+ |
|
9768 |
+ // Otherwise restore preexisting value |
|
9769 |
+ } else { |
|
9770 |
+ window[ callbackName ] = overwritten; |
|
9771 |
+ } |
|
9772 |
+ |
|
9773 |
+ // Save back as free |
|
9774 |
+ if ( s[ callbackName ] ) { |
|
9775 |
+ |
|
9776 |
+ // Make sure that re-using the options doesn't screw things around |
|
9777 |
+ s.jsonpCallback = originalSettings.jsonpCallback; |
|
9778 |
+ |
|
9779 |
+ // Save the callback name for future use |
|
9780 |
+ oldCallbacks.push( callbackName ); |
|
9781 |
+ } |
|
9782 |
+ |
|
9783 |
+ // Call if it was a function and we have a response |
|
9784 |
+ if ( responseContainer && isFunction( overwritten ) ) { |
|
9785 |
+ overwritten( responseContainer[ 0 ] ); |
|
9786 |
+ } |
|
9787 |
+ |
|
9788 |
+ responseContainer = overwritten = undefined; |
|
9789 |
+ } ); |
|
9790 |
+ |
|
9791 |
+ // Delegate to script |
|
9792 |
+ return "script"; |
|
9793 |
+ } |
|
9794 |
+} ); |
|
9795 |
+ |
|
9796 |
+ |
|
9797 |
+ |
|
9798 |
+ |
|
9799 |
+// Support: Safari 8 only |
|
9800 |
+// In Safari 8 documents created via document.implementation.createHTMLDocument |
|
9801 |
+// collapse sibling forms: the second one becomes a child of the first one. |
|
9802 |
+// Because of that, this security measure has to be disabled in Safari 8. |
|
9803 |
+// https://bugs.webkit.org/show_bug.cgi?id=137337 |
|
9804 |
+support.createHTMLDocument = ( function() { |
|
9805 |
+ var body = document.implementation.createHTMLDocument( "" ).body; |
|
9806 |
+ body.innerHTML = "<form></form><form></form>"; |
|
9807 |
+ return body.childNodes.length === 2; |
|
9808 |
+} )(); |
|
9809 |
+ |
|
9810 |
+ |
|
9811 |
+// Argument "data" should be string of html |
|
9812 |
+// context (optional): If specified, the fragment will be created in this context, |
|
9813 |
+// defaults to document |
|
9814 |
+// keepScripts (optional): If true, will include scripts passed in the html string |
|
9815 |
+jQuery.parseHTML = function( data, context, keepScripts ) { |
|
9816 |
+ if ( typeof data !== "string" ) { |
|
9817 |
+ return []; |
|
9818 |
+ } |
|
9819 |
+ if ( typeof context === "boolean" ) { |
|
9820 |
+ keepScripts = context; |
|
9821 |
+ context = false; |
|
9822 |
+ } |
|
9823 |
+ |
|
9824 |
+ var base, parsed, scripts; |
|
9825 |
+ |
|
9826 |
+ if ( !context ) { |
|
9827 |
+ |
|
9828 |
+ // Stop scripts or inline event handlers from being executed immediately |
|
9829 |
+ // by using document.implementation |
|
9830 |
+ if ( support.createHTMLDocument ) { |
|
9831 |
+ context = document.implementation.createHTMLDocument( "" ); |
|
9832 |
+ |
|
9833 |
+ // Set the base href for the created document |
|
9834 |
+ // so any parsed elements with URLs |
|
9835 |
+ // are based on the document's URL (gh-2965) |
|
9836 |
+ base = context.createElement( "base" ); |
|
9837 |
+ base.href = document.location.href; |
|
9838 |
+ context.head.appendChild( base ); |
|
9839 |
+ } else { |
|
9840 |
+ context = document; |
|
9841 |
+ } |
|
9842 |
+ } |
|
9843 |
+ |
|
9844 |
+ parsed = rsingleTag.exec( data ); |
|
9845 |
+ scripts = !keepScripts && []; |
|
9846 |
+ |
|
9847 |
+ // Single tag |
|
9848 |
+ if ( parsed ) { |
|
9849 |
+ return [ context.createElement( parsed[ 1 ] ) ]; |
|
9850 |
+ } |
|
9851 |
+ |
|
9852 |
+ parsed = buildFragment( [ data ], context, scripts ); |
|
9853 |
+ |
|
9854 |
+ if ( scripts && scripts.length ) { |
|
9855 |
+ jQuery( scripts ).remove(); |
|
9856 |
+ } |
|
9857 |
+ |
|
9858 |
+ return jQuery.merge( [], parsed.childNodes ); |
|
9859 |
+}; |
|
9860 |
+ |
|
9861 |
+ |
|
9862 |
+/** |
|
9863 |
+ * Load a url into a page |
|
9864 |
+ */ |
|
9865 |
+jQuery.fn.load = function( url, params, callback ) { |
|
9866 |
+ var selector, type, response, |
|
9867 |
+ self = this, |
|
9868 |
+ off = url.indexOf( " " ); |
|
9869 |
+ |
|
9870 |
+ if ( off > -1 ) { |
|
9871 |
+ selector = stripAndCollapse( url.slice( off ) ); |
|
9872 |
+ url = url.slice( 0, off ); |
|
9873 |
+ } |
|
9874 |
+ |
|
9875 |
+ // If it's a function |
|
9876 |
+ if ( isFunction( params ) ) { |
|
9877 |
+ |
|
9878 |
+ // We assume that it's the callback |
|
9879 |
+ callback = params; |
|
9880 |
+ params = undefined; |
|
9881 |
+ |
|
9882 |
+ // Otherwise, build a param string |
|
9883 |
+ } else if ( params && typeof params === "object" ) { |
|
9884 |
+ type = "POST"; |
|
9885 |
+ } |
|
9886 |
+ |
|
9887 |
+ // If we have elements to modify, make the request |
|
9888 |
+ if ( self.length > 0 ) { |
|
9889 |
+ jQuery.ajax( { |
|
9890 |
+ url: url, |
|
9891 |
+ |
|
9892 |
+ // If "type" variable is undefined, then "GET" method will be used. |
|
9893 |
+ // Make value of this field explicit since |
|
9894 |
+ // user can override it through ajaxSetup method |
|
9895 |
+ type: type || "GET", |
|
9896 |
+ dataType: "html", |
|
9897 |
+ data: params |
|
9898 |
+ } ).done( function( responseText ) { |
|
9899 |
+ |
|
9900 |
+ // Save response for use in complete callback |
|
9901 |
+ response = arguments; |
|
9902 |
+ |
|
9903 |
+ self.html( selector ? |
|
9904 |
+ |
|
9905 |
+ // If a selector was specified, locate the right elements in a dummy div |
|
9906 |
+ // Exclude scripts to avoid IE 'Permission Denied' errors |
|
9907 |
+ jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : |
|
9908 |
+ |
|
9909 |
+ // Otherwise use the full result |
|
9910 |
+ responseText ); |
|
9911 |
+ |
|
9912 |
+ // If the request succeeds, this function gets "data", "status", "jqXHR" |
|
9913 |
+ // but they are ignored because response was set above. |
|
9914 |
+ // If it fails, this function gets "jqXHR", "status", "error" |
|
9915 |
+ } ).always( callback && function( jqXHR, status ) { |
|
9916 |
+ self.each( function() { |
|
9917 |
+ callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); |
|
9918 |
+ } ); |
|
9919 |
+ } ); |
|
9920 |
+ } |
|
9921 |
+ |
|
9922 |
+ return this; |
|
9923 |
+}; |
|
9924 |
+ |
|
9925 |
+ |
|
9926 |
+ |
|
9927 |
+ |
|
9928 |
+// Attach a bunch of functions for handling common AJAX events |
|
9929 |
+jQuery.each( [ |
|
9930 |
+ "ajaxStart", |
|
9931 |
+ "ajaxStop", |
|
9932 |
+ "ajaxComplete", |
|
9933 |
+ "ajaxError", |
|
9934 |
+ "ajaxSuccess", |
|
9935 |
+ "ajaxSend" |
|
9936 |
+], function( i, type ) { |
|
9937 |
+ jQuery.fn[ type ] = function( fn ) { |
|
9938 |
+ return this.on( type, fn ); |
|
9939 |
+ }; |
|
9940 |
+} ); |
|
9941 |
+ |
|
9942 |
+ |
|
9943 |
+ |
|
9944 |
+ |
|
9945 |
+jQuery.expr.pseudos.animated = function( elem ) { |
|
9946 |
+ return jQuery.grep( jQuery.timers, function( fn ) { |
|
9947 |
+ return elem === fn.elem; |
|
9948 |
+ } ).length; |
|
9949 |
+}; |
|
9950 |
+ |
|
9951 |
+ |
|
9952 |
+ |
|
9953 |
+ |
|
9954 |
+jQuery.offset = { |
|
9955 |
+ setOffset: function( elem, options, i ) { |
|
9956 |
+ var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, |
|
9957 |
+ position = jQuery.css( elem, "position" ), |
|
9958 |
+ curElem = jQuery( elem ), |
|
9959 |
+ props = {}; |
|
9960 |
+ |
|
9961 |
+ // Set position first, in-case top/left are set even on static elem |
|
9962 |
+ if ( position === "static" ) { |
|
9963 |
+ elem.style.position = "relative"; |
|
9964 |
+ } |
|
9965 |
+ |
|
9966 |
+ curOffset = curElem.offset(); |
|
9967 |
+ curCSSTop = jQuery.css( elem, "top" ); |
|
9968 |
+ curCSSLeft = jQuery.css( elem, "left" ); |
|
9969 |
+ calculatePosition = ( position === "absolute" || position === "fixed" ) && |
|
9970 |
+ ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; |
|
9971 |
+ |
|
9972 |
+ // Need to be able to calculate position if either |
|
9973 |
+ // top or left is auto and position is either absolute or fixed |
|
9974 |
+ if ( calculatePosition ) { |
|
9975 |
+ curPosition = curElem.position(); |
|
9976 |
+ curTop = curPosition.top; |
|
9977 |
+ curLeft = curPosition.left; |
|
9978 |
+ |
|
9979 |
+ } else { |
|
9980 |
+ curTop = parseFloat( curCSSTop ) || 0; |
|
9981 |
+ curLeft = parseFloat( curCSSLeft ) || 0; |
|
9982 |
+ } |
|
9983 |
+ |
|
9984 |
+ if ( isFunction( options ) ) { |
|
9985 |
+ |
|
9986 |
+ // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) |
|
9987 |
+ options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); |
|
9988 |
+ } |
|
9989 |
+ |
|
9990 |
+ if ( options.top != null ) { |
|
9991 |
+ props.top = ( options.top - curOffset.top ) + curTop; |
|
9992 |
+ } |
|
9993 |
+ if ( options.left != null ) { |
|
9994 |
+ props.left = ( options.left - curOffset.left ) + curLeft; |
|
9995 |
+ } |
|
9996 |
+ |
|
9997 |
+ if ( "using" in options ) { |
|
9998 |
+ options.using.call( elem, props ); |
|
9999 |
+ |
|
10000 |
+ } else { |
|
10001 |
+ curElem.css( props ); |
|
10002 |
+ } |
|
10003 |
+ } |
|
10004 |
+}; |
|
10005 |
+ |
|
10006 |
+jQuery.fn.extend( { |
|
10007 |
+ |
|
10008 |
+ // offset() relates an element's border box to the document origin |
|
10009 |
+ offset: function( options ) { |
|
10010 |
+ |
|
10011 |
+ // Preserve chaining for setter |
|
10012 |
+ if ( arguments.length ) { |
|
10013 |
+ return options === undefined ? |
|
10014 |
+ this : |
|
10015 |
+ this.each( function( i ) { |
|
10016 |
+ jQuery.offset.setOffset( this, options, i ); |
|
10017 |
+ } ); |
|
10018 |
+ } |
|
10019 |
+ |
|
10020 |
+ var rect, win, |
|
10021 |
+ elem = this[ 0 ]; |
|
10022 |
+ |
|
10023 |
+ if ( !elem ) { |
|
10024 |
+ return; |
|
10025 |
+ } |
|
10026 |
+ |
|
10027 |
+ // Return zeros for disconnected and hidden (display: none) elements (gh-2310) |
|
10028 |
+ // Support: IE <=11 only |
|
10029 |
+ // Running getBoundingClientRect on a |
|
10030 |
+ // disconnected node in IE throws an error |
|
10031 |
+ if ( !elem.getClientRects().length ) { |
|
10032 |
+ return { top: 0, left: 0 }; |
|
10033 |
+ } |
|
10034 |
+ |
|
10035 |
+ // Get document-relative position by adding viewport scroll to viewport-relative gBCR |
|
10036 |
+ rect = elem.getBoundingClientRect(); |
|
10037 |
+ win = elem.ownerDocument.defaultView; |
|
10038 |
+ return { |
|
10039 |
+ top: rect.top + win.pageYOffset, |
|
10040 |
+ left: rect.left + win.pageXOffset |
|
10041 |
+ }; |
|
10042 |
+ }, |
|
10043 |
+ |
|
10044 |
+ // position() relates an element's margin box to its offset parent's padding box |
|
10045 |
+ // This corresponds to the behavior of CSS absolute positioning |
|
10046 |
+ position: function() { |
|
10047 |
+ if ( !this[ 0 ] ) { |
|
10048 |
+ return; |
|
10049 |
+ } |
|
10050 |
+ |
|
10051 |
+ var offsetParent, offset, doc, |
|
10052 |
+ elem = this[ 0 ], |
|
10053 |
+ parentOffset = { top: 0, left: 0 }; |
|
10054 |
+ |
|
10055 |
+ // position:fixed elements are offset from the viewport, which itself always has zero offset |
|
10056 |
+ if ( jQuery.css( elem, "position" ) === "fixed" ) { |
|
10057 |
+ |
|
10058 |
+ // Assume position:fixed implies availability of getBoundingClientRect |
|
10059 |
+ offset = elem.getBoundingClientRect(); |
|
10060 |
+ |
|
10061 |
+ } else { |
|
10062 |
+ offset = this.offset(); |
|
10063 |
+ |
|
10064 |
+ // Account for the *real* offset parent, which can be the document or its root element |
|
10065 |
+ // when a statically positioned element is identified |
|
10066 |
+ doc = elem.ownerDocument; |
|
10067 |
+ offsetParent = elem.offsetParent || doc.documentElement; |
|
10068 |
+ while ( offsetParent && |
|
10069 |
+ ( offsetParent === doc.body || offsetParent === doc.documentElement ) && |
|
10070 |
+ jQuery.css( offsetParent, "position" ) === "static" ) { |
|
10071 |
+ |
|
10072 |
+ offsetParent = offsetParent.parentNode; |
|
10073 |
+ } |
|
10074 |
+ if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { |
|
10075 |
+ |
|
10076 |
+ // Incorporate borders into its offset, since they are outside its content origin |
|
10077 |
+ parentOffset = jQuery( offsetParent ).offset(); |
|
10078 |
+ parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); |
|
10079 |
+ parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); |
|
10080 |
+ } |
|
10081 |
+ } |
|
10082 |
+ |
|
10083 |
+ // Subtract parent offsets and element margins |
|
10084 |
+ return { |
|
10085 |
+ top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), |
|
10086 |
+ left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) |
|
10087 |
+ }; |
|
10088 |
+ }, |
|
10089 |
+ |
|
10090 |
+ // This method will return documentElement in the following cases: |
|
10091 |
+ // 1) For the element inside the iframe without offsetParent, this method will return |
|
10092 |
+ // documentElement of the parent window |
|
10093 |
+ // 2) For the hidden or detached element |
|
10094 |
+ // 3) For body or html element, i.e. in case of the html node - it will return itself |
|
10095 |
+ // |
|
10096 |
+ // but those exceptions were never presented as a real life use-cases |
|
10097 |
+ // and might be considered as more preferable results. |
|
10098 |
+ // |
|
10099 |
+ // This logic, however, is not guaranteed and can change at any point in the future |
|
10100 |
+ offsetParent: function() { |
|
10101 |
+ return this.map( function() { |
|
10102 |
+ var offsetParent = this.offsetParent; |
|
10103 |
+ |
|
10104 |
+ while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { |
|
10105 |
+ offsetParent = offsetParent.offsetParent; |
|
10106 |
+ } |
|
10107 |
+ |
|
10108 |
+ return offsetParent || documentElement; |
|
10109 |
+ } ); |
|
10110 |
+ } |
|
10111 |
+} ); |
|
10112 |
+ |
|
10113 |
+// Create scrollLeft and scrollTop methods |
|
10114 |
+jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { |
|
10115 |
+ var top = "pageYOffset" === prop; |
|
10116 |
+ |
|
10117 |
+ jQuery.fn[ method ] = function( val ) { |
|
10118 |
+ return access( this, function( elem, method, val ) { |
|
10119 |
+ |
|
10120 |
+ // Coalesce documents and windows |
|
10121 |
+ var win; |
|
10122 |
+ if ( isWindow( elem ) ) { |
|
10123 |
+ win = elem; |
|
10124 |
+ } else if ( elem.nodeType === 9 ) { |
|
10125 |
+ win = elem.defaultView; |
|
10126 |
+ } |
|
10127 |
+ |
|
10128 |
+ if ( val === undefined ) { |
|
10129 |
+ return win ? win[ prop ] : elem[ method ]; |
|
10130 |
+ } |
|
10131 |
+ |
|
10132 |
+ if ( win ) { |
|
10133 |
+ win.scrollTo( |
|
10134 |
+ !top ? val : win.pageXOffset, |
|
10135 |
+ top ? val : win.pageYOffset |
|
10136 |
+ ); |
|
10137 |
+ |
|
10138 |
+ } else { |
|
10139 |
+ elem[ method ] = val; |
|
10140 |
+ } |
|
10141 |
+ }, method, val, arguments.length ); |
|
10142 |
+ }; |
|
10143 |
+} ); |
|
10144 |
+ |
|
10145 |
+// Support: Safari <=7 - 9.1, Chrome <=37 - 49 |
|
10146 |
+// Add the top/left cssHooks using jQuery.fn.position |
|
10147 |
+// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 |
|
10148 |
+// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 |
|
10149 |
+// getComputedStyle returns percent when specified for top/left/bottom/right; |
|
10150 |
+// rather than make the css module depend on the offset module, just check for it here |
|
10151 |
+jQuery.each( [ "top", "left" ], function( i, prop ) { |
|
10152 |
+ jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, |
|
10153 |
+ function( elem, computed ) { |
|
10154 |
+ if ( computed ) { |
|
10155 |
+ computed = curCSS( elem, prop ); |
|
10156 |
+ |
|
10157 |
+ // If curCSS returns percentage, fallback to offset |
|
10158 |
+ return rnumnonpx.test( computed ) ? |
|
10159 |
+ jQuery( elem ).position()[ prop ] + "px" : |
|
10160 |
+ computed; |
|
10161 |
+ } |
|
10162 |
+ } |
|
10163 |
+ ); |
|
10164 |
+} ); |
|
10165 |
+ |
|
10166 |
+ |
|
10167 |
+// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods |
|
10168 |
+jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { |
|
10169 |
+ jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, |
|
10170 |
+ function( defaultExtra, funcName ) { |
|
10171 |
+ |
|
10172 |
+ // Margin is only for outerHeight, outerWidth |
|
10173 |
+ jQuery.fn[ funcName ] = function( margin, value ) { |
|
10174 |
+ var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), |
|
10175 |
+ extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); |
|
10176 |
+ |
|
10177 |
+ return access( this, function( elem, type, value ) { |
|
10178 |
+ var doc; |
|
10179 |
+ |
|
10180 |
+ if ( isWindow( elem ) ) { |
|
10181 |
+ |
|
10182 |
+ // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) |
|
10183 |
+ return funcName.indexOf( "outer" ) === 0 ? |
|
10184 |
+ elem[ "inner" + name ] : |
|
10185 |
+ elem.document.documentElement[ "client" + name ]; |
|
10186 |
+ } |
|
10187 |
+ |
|
10188 |
+ // Get document width or height |
|
10189 |
+ if ( elem.nodeType === 9 ) { |
|
10190 |
+ doc = elem.documentElement; |
|
10191 |
+ |
|
10192 |
+ // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], |
|
10193 |
+ // whichever is greatest |
|
10194 |
+ return Math.max( |
|
10195 |
+ elem.body[ "scroll" + name ], doc[ "scroll" + name ], |
|
10196 |
+ elem.body[ "offset" + name ], doc[ "offset" + name ], |
|
10197 |
+ doc[ "client" + name ] |
|
10198 |
+ ); |
|
10199 |
+ } |
|
10200 |
+ |
|
10201 |
+ return value === undefined ? |
|
10202 |
+ |
|
10203 |
+ // Get width or height on the element, requesting but not forcing parseFloat |
|
10204 |
+ jQuery.css( elem, type, extra ) : |
|
10205 |
+ |
|
10206 |
+ // Set width or height on the element |
|
10207 |
+ jQuery.style( elem, type, value, extra ); |
|
10208 |
+ }, type, chainable ? margin : undefined, chainable ); |
|
10209 |
+ }; |
|
10210 |
+ } ); |
|
10211 |
+} ); |
|
10212 |
+ |
|
10213 |
+ |
|
10214 |
+jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + |
|
10215 |
+ "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + |
|
10216 |
+ "change select submit keydown keypress keyup contextmenu" ).split( " " ), |
|
10217 |
+ function( i, name ) { |
|
10218 |
+ |
|
10219 |
+ // Handle event binding |
|
10220 |
+ jQuery.fn[ name ] = function( data, fn ) { |
|
10221 |
+ return arguments.length > 0 ? |
|
10222 |
+ this.on( name, null, data, fn ) : |
|
10223 |
+ this.trigger( name ); |
|
10224 |
+ }; |
|
10225 |
+} ); |
|
10226 |
+ |
|
10227 |
+jQuery.fn.extend( { |
|
10228 |
+ hover: function( fnOver, fnOut ) { |
|
10229 |
+ return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); |
|
10230 |
+ } |
|
10231 |
+} ); |
|
10232 |
+ |
|
10233 |
+ |
|
10234 |
+ |
|
10235 |
+ |
|
10236 |
+jQuery.fn.extend( { |
|
10237 |
+ |
|
10238 |
+ bind: function( types, data, fn ) { |
|
10239 |
+ return this.on( types, null, data, fn ); |
|
10240 |
+ }, |
|
10241 |
+ unbind: function( types, fn ) { |
|
10242 |
+ return this.off( types, null, fn ); |
|
10243 |
+ }, |
|
10244 |
+ |
|
10245 |
+ delegate: function( selector, types, data, fn ) { |
|
10246 |
+ return this.on( types, selector, data, fn ); |
|
10247 |
+ }, |
|
10248 |
+ undelegate: function( selector, types, fn ) { |
|
10249 |
+ |
|
10250 |
+ // ( namespace ) or ( selector, types [, fn] ) |
|
10251 |
+ return arguments.length === 1 ? |
|
10252 |
+ this.off( selector, "**" ) : |
|
10253 |
+ this.off( types, selector || "**", fn ); |
|
10254 |
+ } |
|
10255 |
+} ); |
|
10256 |
+ |
|
10257 |
+// Bind a function to a context, optionally partially applying any |
|
10258 |
+// arguments. |
|
10259 |
+// jQuery.proxy is deprecated to promote standards (specifically Function#bind) |
|
10260 |
+// However, it is not slated for removal any time soon |
|
10261 |
+jQuery.proxy = function( fn, context ) { |
|
10262 |
+ var tmp, args, proxy; |
|
10263 |
+ |
|
10264 |
+ if ( typeof context === "string" ) { |
|
10265 |
+ tmp = fn[ context ]; |
|
10266 |
+ context = fn; |
|
10267 |
+ fn = tmp; |
|
10268 |
+ } |
|
10269 |
+ |
|
10270 |
+ // Quick check to determine if target is callable, in the spec |
|
10271 |
+ // this throws a TypeError, but we will just return undefined. |
|
10272 |
+ if ( !isFunction( fn ) ) { |
|
10273 |
+ return undefined; |
|
10274 |
+ } |
|
10275 |
+ |
|
10276 |
+ // Simulated bind |
|
10277 |
+ args = slice.call( arguments, 2 ); |
|
10278 |
+ proxy = function() { |
|
10279 |
+ return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); |
|
10280 |
+ }; |
|
10281 |
+ |
|
10282 |
+ // Set the guid of unique handler to the same of original handler, so it can be removed |
|
10283 |
+ proxy.guid = fn.guid = fn.guid || jQuery.guid++; |
|
10284 |
+ |
|
10285 |
+ return proxy; |
|
10286 |
+}; |
|
10287 |
+ |
|
10288 |
+jQuery.holdReady = function( hold ) { |
|
10289 |
+ if ( hold ) { |
|
10290 |
+ jQuery.readyWait++; |
|
10291 |
+ } else { |
|
10292 |
+ jQuery.ready( true ); |
|
10293 |
+ } |
|
10294 |
+}; |
|
10295 |
+jQuery.isArray = Array.isArray; |
|
10296 |
+jQuery.parseJSON = JSON.parse; |
|
10297 |
+jQuery.nodeName = nodeName; |
|
10298 |
+jQuery.isFunction = isFunction; |
|
10299 |
+jQuery.isWindow = isWindow; |
|
10300 |
+jQuery.camelCase = camelCase; |
|
10301 |
+jQuery.type = toType; |
|
10302 |
+ |
|
10303 |
+jQuery.now = Date.now; |
|
10304 |
+ |
|
10305 |
+jQuery.isNumeric = function( obj ) { |
|
10306 |
+ |
|
10307 |
+ // As of jQuery 3.0, isNumeric is limited to |
|
10308 |
+ // strings and numbers (primitives or objects) |
|
10309 |
+ // that can be coerced to finite numbers (gh-2662) |
|
10310 |
+ var type = jQuery.type( obj ); |
|
10311 |
+ return ( type === "number" || type === "string" ) && |
|
10312 |
+ |
|
10313 |
+ // parseFloat NaNs numeric-cast false positives ("") |
|
10314 |
+ // ...but misinterprets leading-number strings, particularly hex literals ("0x...") |
|
10315 |
+ // subtraction forces infinities to NaN |
|
10316 |
+ !isNaN( obj - parseFloat( obj ) ); |
|
10317 |
+}; |
|
10318 |
+ |
|
10319 |
+ |
|
10320 |
+ |
|
10321 |
+ |
|
10322 |
+// Register as a named AMD module, since jQuery can be concatenated with other |
|
10323 |
+// files that may use define, but not via a proper concatenation script that |
|
10324 |
+// understands anonymous AMD modules. A named AMD is safest and most robust |
|
10325 |
+// way to register. Lowercase jquery is used because AMD module names are |
|
10326 |
+// derived from file names, and jQuery is normally delivered in a lowercase |
|
10327 |
+// file name. Do this after creating the global so that if an AMD module wants |
|
10328 |
+// to call noConflict to hide this version of jQuery, it will work. |
|
10329 |
+ |
|
10330 |
+// Note that for maximum portability, libraries that are not jQuery should |
|
10331 |
+// declare themselves as anonymous modules, and avoid setting a global if an |
|
10332 |
+// AMD loader is present. jQuery is a special case. For more information, see |
|
10333 |
+// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon |
|
10334 |
+ |
|
10335 |
+if ( typeof define === "function" && define.amd ) { |
|
10336 |
+ define( "jquery", [], function() { |
|
10337 |
+ return jQuery; |
|
10338 |
+ } ); |
|
10339 |
+} |
|
10340 |
+ |
|
10341 |
+ |
|
10342 |
+ |
|
10343 |
+ |
|
10344 |
+var |
|
10345 |
+ |
|
10346 |
+ // Map over jQuery in case of overwrite |
|
10347 |
+ _jQuery = window.jQuery, |
|
10348 |
+ |
|
10349 |
+ // Map over the $ in case of overwrite |
|
10350 |
+ _$ = window.$; |
|
10351 |
+ |
|
10352 |
+jQuery.noConflict = function( deep ) { |
|
10353 |
+ if ( window.$ === jQuery ) { |
|
10354 |
+ window.$ = _$; |
|
10355 |
+ } |
|
10356 |
+ |
|
10357 |
+ if ( deep && window.jQuery === jQuery ) { |
|
10358 |
+ window.jQuery = _jQuery; |
|
10359 |
+ } |
|
10360 |
+ |
|
10361 |
+ return jQuery; |
|
10362 |
+}; |
|
10363 |
+ |
|
10364 |
+// Expose jQuery and $ identifiers, even in AMD |
|
10365 |
+// (#7102#comment:10, https://github.com/jquery/jquery/pull/557) |
|
10366 |
+// and CommonJS for browser emulators (#13566) |
|
10367 |
+if ( !noGlobal ) { |
|
10368 |
+ window.jQuery = window.$ = jQuery; |
|
10369 |
+} |
|
10370 |
+ |
|
10371 |
+ |
|
10372 |
+ |
|
10373 |
+ |
|
10374 |
+return jQuery; |
|
10375 |
+} ); |