· 7 years ago · Jan 15, 2019, 03:08 PM
1/*!
2 * jQuery JavaScript Library v3.3.2-pre
3 * https://jquery.com/
4 *
5 * Includes Sizzle.js
6 * https://sizzlejs.com/
7 *
8 * Copyright JS Foundation and other contributors
9 * Released under the MIT license
10 * https://jquery.org/license
11 *
12 * Date: 2019-01-15T14:58Z
13 */
14( function( global, factory ) {
15
16 "use strict";
17
18 if ( typeof module === "object" && typeof module.exports === "object" ) {
19
20 // For CommonJS and CommonJS-like environments where a proper `window`
21 // is present, execute the factory and get jQuery.
22 // For environments that do not have a `window` with a `document`
23 // (such as Node.js), expose a factory as module.exports.
24 // This accentuates the need for the creation of a real `window`.
25 // e.g. var jQuery = require("jquery")(window);
26 // See ticket #14549 for more info.
27 module.exports = global.document ?
28 factory( global, true ) :
29 function( w ) {
30 if ( !w.document ) {
31 throw new Error( "jQuery requires a window with a document" );
32 }
33 return factory( w );
34 };
35 } else {
36 factory( global );
37 }
38
39// Pass this if window is not defined yet
40} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
41
42// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
43// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
44// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
45// enough that all such attempts are guarded in a try block.
46"use strict";
47
48var arr = [];
49
50var document = window.document;
51
52var getProto = Object.getPrototypeOf;
53
54var slice = arr.slice;
55
56var concat = arr.concat;
57
58var push = arr.push;
59
60var indexOf = arr.indexOf;
61
62var class2type = {};
63
64var toString = class2type.toString;
65
66var hasOwn = class2type.hasOwnProperty;
67
68var fnToString = hasOwn.toString;
69
70var ObjectFunctionString = fnToString.call( Object );
71
72var support = {};
73
74var isFunction = function isFunction( obj ) {
75
76 // Support: Chrome <=57, Firefox <=52
77 // In some browsers, typeof returns "function" for HTML <object> elements
78 // (i.e., `typeof document.createElement( "object" ) === "function"`).
79 // We don't want to classify *any* DOM node as a function.
80 return typeof obj === "function" && typeof obj.nodeType !== "number";
81 };
82
83
84var isWindow = function isWindow( obj ) {
85 return obj != null && obj === obj.window;
86 };
87
88
89
90
91 var preservedScriptAttributes = {
92 type: true,
93 src: true,
94 nonce: true,
95 noModule: true
96 };
97
98 function DOMEval( code, doc, node ) {
99 doc = doc || document;
100
101 var i,
102 script = doc.createElement( "script" );
103
104 script.text = code;
105 if ( node ) {
106 for ( i in preservedScriptAttributes ) {
107 if ( node[ i ] ) {
108 script[ i ] = node[ i ];
109 } else if ( node.getAttribute( i ) ) {
110
111 // Support: Firefox 64+, Edge 18+
112 // Some browsers don't support the "nonce" property on scripts.
113 // On the other hand, just using `setAttribute` & `getAttribute`
114 // is not enough as `nonce` is no longer exposed as an attribute
115 // in the latest standard.
116 // See https://github.com/whatwg/html/issues/2369
117 script.setAttribute( i, node.getAttribute( i ) );
118 }
119 }
120 }
121 doc.head.appendChild( script ).parentNode.removeChild( script );
122 }
123
124
125function toType( obj ) {
126 if ( obj == null ) {
127 return obj + "";
128 }
129
130 // Support: Android <=2.3 only (functionish RegExp)
131 return typeof obj === "object" || typeof obj === "function" ?
132 class2type[ toString.call( obj ) ] || "object" :
133 typeof obj;
134}
135/* global Symbol */
136// Defining this global in .eslintrc.json would create a danger of using the global
137// unguarded in another place, it seems safer to define global only for this module
138
139
140
141var
142 version = "3.3.2-pre",
143
144 // Define a local copy of jQuery
145 jQuery = function( selector, context ) {
146
147 // The jQuery object is actually just the init constructor 'enhanced'
148 // Need init if jQuery is called (just allow error to be thrown if not included)
149 return new jQuery.fn.init( selector, context );
150 },
151
152 // Support: Android <=4.0 only
153 // Make sure we trim BOM and NBSP
154 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
155
156jQuery.fn = jQuery.prototype = {
157
158 // The current version of jQuery being used
159 jquery: version,
160
161 constructor: jQuery,
162
163 // The default length of a jQuery object is 0
164 length: 0,
165
166 toArray: function() {
167 return slice.call( this );
168 },
169
170 // Get the Nth element in the matched element set OR
171 // Get the whole matched element set as a clean array
172 get: function( num ) {
173
174 // Return all the elements in a clean array
175 if ( num == null ) {
176 return slice.call( this );
177 }
178
179 // Return just the one element from the set
180 return num < 0 ? this[ num + this.length ] : this[ num ];
181 },
182
183 // Take an array of elements and push it onto the stack
184 // (returning the new matched element set)
185 pushStack: function( elems ) {
186
187 // Build a new jQuery matched element set
188 var ret = jQuery.merge( this.constructor(), elems );
189
190 // Add the old object onto the stack (as a reference)
191 ret.prevObject = this;
192
193 // Return the newly-formed element set
194 return ret;
195 },
196
197 // Execute a callback for every element in the matched set.
198 each: function( callback ) {
199 return jQuery.each( this, callback );
200 },
201
202 map: function( callback ) {
203 return this.pushStack( jQuery.map( this, function( elem, i ) {
204 return callback.call( elem, i, elem );
205 } ) );
206 },
207
208 slice: function() {
209 return this.pushStack( slice.apply( this, arguments ) );
210 },
211
212 first: function() {
213 return this.eq( 0 );
214 },
215
216 last: function() {
217 return this.eq( -1 );
218 },
219
220 eq: function( i ) {
221 var len = this.length,
222 j = +i + ( i < 0 ? len : 0 );
223 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
224 },
225
226 end: function() {
227 return this.prevObject || this.constructor();
228 },
229
230 // For internal use only.
231 // Behaves like an Array's method, not like a jQuery method.
232 push: push,
233 sort: arr.sort,
234 splice: arr.splice
235};
236
237jQuery.extend = jQuery.fn.extend = function() {
238 var options, name, src, copy, copyIsArray, clone,
239 target = arguments[ 0 ] || {},
240 i = 1,
241 length = arguments.length,
242 deep = false;
243
244 // Handle a deep copy situation
245 if ( typeof target === "boolean" ) {
246 deep = target;
247
248 // Skip the boolean and the target
249 target = arguments[ i ] || {};
250 i++;
251 }
252
253 // Handle case when target is a string or something (possible in deep copy)
254 if ( typeof target !== "object" && !isFunction( target ) ) {
255 target = {};
256 }
257
258 // Extend jQuery itself if only one argument is passed
259 if ( i === length ) {
260 target = this;
261 i--;
262 }
263
264 for ( ; i < length; i++ ) {
265
266 // Only deal with non-null/undefined values
267 if ( ( options = arguments[ i ] ) != null ) {
268
269 // Extend the base object
270 for ( name in options ) {
271 copy = options[ name ];
272
273 // Prevent never-ending loop
274 if ( target === copy ) {
275 continue;
276 }
277
278 // Recurse if we're merging plain objects or arrays
279 if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
280 ( copyIsArray = Array.isArray( copy ) ) ) ) {
281 src = target[ name ];
282
283 // Ensure proper type for the source value
284 if ( copyIsArray && !Array.isArray( src ) ) {
285 clone = [];
286 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
287 clone = {};
288 } else {
289 clone = src;
290 }
291 copyIsArray = false;
292
293 // Never move original objects, clone them
294 target[ name ] = jQuery.extend( deep, clone, copy );
295
296 // Don't bring in undefined values
297 } else if ( copy !== undefined ) {
298 target[ name ] = copy;
299 }
300 }
301 }
302 }
303
304 // Return the modified object
305 return target;
306};
307
308jQuery.extend( {
309
310 // Unique for each copy of jQuery on the page
311 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
312
313 // Assume jQuery is ready without the ready module
314 isReady: true,
315
316 error: function( msg ) {
317 throw new Error( msg );
318 },
319
320 noop: function() {},
321
322 isPlainObject: function( obj ) {
323 var proto, Ctor;
324
325 // Detect obvious negatives
326 // Use toString instead of jQuery.type to catch host objects
327 if ( !obj || toString.call( obj ) !== "[object Object]" ) {
328 return false;
329 }
330
331 proto = getProto( obj );
332
333 // Objects with no prototype (e.g., `Object.create( null )`) are plain
334 if ( !proto ) {
335 return true;
336 }
337
338 // Objects with prototype are plain iff they were constructed by a global Object function
339 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
340 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
341 },
342
343 isEmptyObject: function( obj ) {
344 var name;
345
346 for ( name in obj ) {
347 return false;
348 }
349 return true;
350 },
351
352 // Evaluates a script in a global context
353 globalEval: function( code ) {
354 DOMEval( code );
355 },
356
357 each: function( obj, callback ) {
358 var length, i = 0;
359
360 if ( isArrayLike( obj ) ) {
361 length = obj.length;
362 for ( ; i < length; i++ ) {
363 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
364 break;
365 }
366 }
367 } else {
368 for ( i in obj ) {
369 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
370 break;
371 }
372 }
373 }
374
375 return obj;
376 },
377
378 // Support: Android <=4.0 only
379 trim: function( text ) {
380 return text == null ?
381 "" :
382 ( text + "" ).replace( rtrim, "" );
383 },
384
385 // results is for internal usage only
386 makeArray: function( arr, results ) {
387 var ret = results || [];
388
389 if ( arr != null ) {
390 if ( isArrayLike( Object( arr ) ) ) {
391 jQuery.merge( ret,
392 typeof arr === "string" ?
393 [ arr ] : arr
394 );
395 } else {
396 push.call( ret, arr );
397 }
398 }
399
400 return ret;
401 },
402
403 inArray: function( elem, arr, i ) {
404 return arr == null ? -1 : indexOf.call( arr, elem, i );
405 },
406
407 // Support: Android <=4.0 only, PhantomJS 1 only
408 // push.apply(_, arraylike) throws on ancient WebKit
409 merge: function( first, second ) {
410 var len = +second.length,
411 j = 0,
412 i = first.length;
413
414 for ( ; j < len; j++ ) {
415 first[ i++ ] = second[ j ];
416 }
417
418 first.length = i;
419
420 return first;
421 },
422
423 grep: function( elems, callback, invert ) {
424 var callbackInverse,
425 matches = [],
426 i = 0,
427 length = elems.length,
428 callbackExpect = !invert;
429
430 // Go through the array, only saving the items
431 // that pass the validator function
432 for ( ; i < length; i++ ) {
433 callbackInverse = !callback( elems[ i ], i );
434 if ( callbackInverse !== callbackExpect ) {
435 matches.push( elems[ i ] );
436 }
437 }
438
439 return matches;
440 },
441
442 // arg is for internal usage only
443 map: function( elems, callback, arg ) {
444 var length, value,
445 i = 0,
446 ret = [];
447
448 // Go through the array, translating each of the items to their new values
449 if ( isArrayLike( elems ) ) {
450 length = elems.length;
451 for ( ; i < length; i++ ) {
452 value = callback( elems[ i ], i, arg );
453
454 if ( value != null ) {
455 ret.push( value );
456 }
457 }
458
459 // Go through every key on the object,
460 } else {
461 for ( i in elems ) {
462 value = callback( elems[ i ], i, arg );
463
464 if ( value != null ) {
465 ret.push( value );
466 }
467 }
468 }
469
470 // Flatten any nested arrays
471 return concat.apply( [], ret );
472 },
473
474 // A global GUID counter for objects
475 guid: 1,
476
477 // jQuery.support is not used in Core but other projects attach their
478 // properties to it so it needs to exist.
479 support: support
480} );
481
482if ( typeof Symbol === "function" ) {
483 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
484}
485
486// Populate the class2type map
487jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
488function( i, name ) {
489 class2type[ "[object " + name + "]" ] = name.toLowerCase();
490} );
491
492function isArrayLike( obj ) {
493
494 // Support: real iOS 8.2 only (not reproducible in simulator)
495 // `in` check used to prevent JIT error (gh-2145)
496 // hasOwn isn't used here due to false negatives
497 // regarding Nodelist length in IE
498 var length = !!obj && "length" in obj && obj.length,
499 type = toType( obj );
500
501 if ( isFunction( obj ) || isWindow( obj ) ) {
502 return false;
503 }
504
505 return type === "array" || length === 0 ||
506 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
507}
508var Sizzle =
509/*!
510 * Sizzle CSS Selector Engine v2.3.3
511 * https://sizzlejs.com/
512 *
513 * Copyright jQuery Foundation and other contributors
514 * Released under the MIT license
515 * http://jquery.org/license
516 *
517 * Date: 2016-08-08
518 */
519(function( window ) {
520
521var i,
522 support,
523 Expr,
524 getText,
525 isXML,
526 tokenize,
527 compile,
528 select,
529 outermostContext,
530 sortInput,
531 hasDuplicate,
532
533 // Local document vars
534 setDocument,
535 document,
536 docElem,
537 documentIsHTML,
538 rbuggyQSA,
539 rbuggyMatches,
540 matches,
541 contains,
542
543 // Instance-specific data
544 expando = "sizzle" + 1 * new Date(),
545 preferredDoc = window.document,
546 dirruns = 0,
547 done = 0,
548 classCache = createCache(),
549 tokenCache = createCache(),
550 compilerCache = createCache(),
551 sortOrder = function( a, b ) {
552 if ( a === b ) {
553 hasDuplicate = true;
554 }
555 return 0;
556 },
557
558 // Instance methods
559 hasOwn = ({}).hasOwnProperty,
560 arr = [],
561 pop = arr.pop,
562 push_native = arr.push,
563 push = arr.push,
564 slice = arr.slice,
565 // Use a stripped-down indexOf as it's faster than native
566 // https://jsperf.com/thor-indexof-vs-for/5
567 indexOf = function( list, elem ) {
568 var i = 0,
569 len = list.length;
570 for ( ; i < len; i++ ) {
571 if ( list[i] === elem ) {
572 return i;
573 }
574 }
575 return -1;
576 },
577
578 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
579
580 // Regular expressions
581
582 // http://www.w3.org/TR/css3-selectors/#whitespace
583 whitespace = "[\\x20\\t\\r\\n\\f]",
584
585 // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
586 identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
587
588 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
589 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
590 // Operator (capture 2)
591 "*([*^$|!~]?=)" + whitespace +
592 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
593 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
594 "*\\]",
595
596 pseudos = ":(" + identifier + ")(?:\\((" +
597 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
598 // 1. quoted (capture 3; capture 4 or capture 5)
599 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
600 // 2. simple (capture 6)
601 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
602 // 3. anything else (capture 2)
603 ".*" +
604 ")\\)|)",
605
606 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
607 rwhitespace = new RegExp( whitespace + "+", "g" ),
608 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
609
610 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
611 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
612
613 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
614
615 rpseudo = new RegExp( pseudos ),
616 ridentifier = new RegExp( "^" + identifier + "$" ),
617
618 matchExpr = {
619 "ID": new RegExp( "^#(" + identifier + ")" ),
620 "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
621 "TAG": new RegExp( "^(" + identifier + "|[*])" ),
622 "ATTR": new RegExp( "^" + attributes ),
623 "PSEUDO": new RegExp( "^" + pseudos ),
624 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
625 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
626 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
627 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
628 // For use in libraries implementing .is()
629 // We use this for POS matching in `select`
630 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
631 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
632 },
633
634 rinputs = /^(?:input|select|textarea|button)$/i,
635 rheader = /^h\d$/i,
636
637 rnative = /^[^{]+\{\s*\[native \w/,
638
639 // Easily-parseable/retrievable ID or TAG or CLASS selectors
640 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
641
642 rsibling = /[+~]/,
643
644 // CSS escapes
645 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
646 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
647 funescape = function( _, escaped, escapedWhitespace ) {
648 var high = "0x" + escaped - 0x10000;
649 // NaN means non-codepoint
650 // Support: Firefox<24
651 // Workaround erroneous numeric interpretation of +"0x"
652 return high !== high || escapedWhitespace ?
653 escaped :
654 high < 0 ?
655 // BMP codepoint
656 String.fromCharCode( high + 0x10000 ) :
657 // Supplemental Plane codepoint (surrogate pair)
658 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
659 },
660
661 // CSS string/identifier serialization
662 // https://drafts.csswg.org/cssom/#common-serializing-idioms
663 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
664 fcssescape = function( ch, asCodePoint ) {
665 if ( asCodePoint ) {
666
667 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
668 if ( ch === "\0" ) {
669 return "\uFFFD";
670 }
671
672 // Control characters and (dependent upon position) numbers get escaped as code points
673 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
674 }
675
676 // Other potentially-special ASCII characters get backslash-escaped
677 return "\\" + ch;
678 },
679
680 // Used for iframes
681 // See setDocument()
682 // Removing the function wrapper causes a "Permission Denied"
683 // error in IE
684 unloadHandler = function() {
685 setDocument();
686 },
687
688 disabledAncestor = addCombinator(
689 function( elem ) {
690 return elem.disabled === true && ("form" in elem || "label" in elem);
691 },
692 { dir: "parentNode", next: "legend" }
693 );
694
695// Optimize for push.apply( _, NodeList )
696try {
697 push.apply(
698 (arr = slice.call( preferredDoc.childNodes )),
699 preferredDoc.childNodes
700 );
701 // Support: Android<4.0
702 // Detect silently failing push.apply
703 arr[ preferredDoc.childNodes.length ].nodeType;
704} catch ( e ) {
705 push = { apply: arr.length ?
706
707 // Leverage slice if possible
708 function( target, els ) {
709 push_native.apply( target, slice.call(els) );
710 } :
711
712 // Support: IE<9
713 // Otherwise append directly
714 function( target, els ) {
715 var j = target.length,
716 i = 0;
717 // Can't trust NodeList.length
718 while ( (target[j++] = els[i++]) ) {}
719 target.length = j - 1;
720 }
721 };
722}
723
724function Sizzle( selector, context, results, seed ) {
725 var m, i, elem, nid, match, groups, newSelector,
726 newContext = context && context.ownerDocument,
727
728 // nodeType defaults to 9, since context defaults to document
729 nodeType = context ? context.nodeType : 9;
730
731 results = results || [];
732
733 // Return early from calls with invalid selector or context
734 if ( typeof selector !== "string" || !selector ||
735 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
736
737 return results;
738 }
739
740 // Try to shortcut find operations (as opposed to filters) in HTML documents
741 if ( !seed ) {
742
743 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
744 setDocument( context );
745 }
746 context = context || document;
747
748 if ( documentIsHTML ) {
749
750 // If the selector is sufficiently simple, try using a "get*By*" DOM method
751 // (excepting DocumentFragment context, where the methods don't exist)
752 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
753
754 // ID selector
755 if ( (m = match[1]) ) {
756
757 // Document context
758 if ( nodeType === 9 ) {
759 if ( (elem = context.getElementById( m )) ) {
760
761 // Support: IE, Opera, Webkit
762 // TODO: identify versions
763 // getElementById can match elements by name instead of ID
764 if ( elem.id === m ) {
765 results.push( elem );
766 return results;
767 }
768 } else {
769 return results;
770 }
771
772 // Element context
773 } else {
774
775 // Support: IE, Opera, Webkit
776 // TODO: identify versions
777 // getElementById can match elements by name instead of ID
778 if ( newContext && (elem = newContext.getElementById( m )) &&
779 contains( context, elem ) &&
780 elem.id === m ) {
781
782 results.push( elem );
783 return results;
784 }
785 }
786
787 // Type selector
788 } else if ( match[2] ) {
789 push.apply( results, context.getElementsByTagName( selector ) );
790 return results;
791
792 // Class selector
793 } else if ( (m = match[3]) && support.getElementsByClassName &&
794 context.getElementsByClassName ) {
795
796 push.apply( results, context.getElementsByClassName( m ) );
797 return results;
798 }
799 }
800
801 // Take advantage of querySelectorAll
802 if ( support.qsa &&
803 !compilerCache[ selector + " " ] &&
804 (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
805
806 if ( nodeType !== 1 ) {
807 newContext = context;
808 newSelector = selector;
809
810 // qSA looks outside Element context, which is not what we want
811 // Thanks to Andrew Dupont for this workaround technique
812 // Support: IE <=8
813 // Exclude object elements
814 } else if ( context.nodeName.toLowerCase() !== "object" ) {
815
816 // Capture the context ID, setting it first if necessary
817 if ( (nid = context.getAttribute( "id" )) ) {
818 nid = nid.replace( rcssescape, fcssescape );
819 } else {
820 context.setAttribute( "id", (nid = expando) );
821 }
822
823 // Prefix every selector in the list
824 groups = tokenize( selector );
825 i = groups.length;
826 while ( i-- ) {
827 groups[i] = "#" + nid + " " + toSelector( groups[i] );
828 }
829 newSelector = groups.join( "," );
830
831 // Expand context for sibling selectors
832 newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
833 context;
834 }
835
836 if ( newSelector ) {
837 try {
838 push.apply( results,
839 newContext.querySelectorAll( newSelector )
840 );
841 return results;
842 } catch ( qsaError ) {
843 } finally {
844 if ( nid === expando ) {
845 context.removeAttribute( "id" );
846 }
847 }
848 }
849 }
850 }
851 }
852
853 // All others
854 return select( selector.replace( rtrim, "$1" ), context, results, seed );
855}
856
857/**
858 * Create key-value caches of limited size
859 * @returns {function(string, object)} Returns the Object data after storing it on itself with
860 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
861 * deleting the oldest entry
862 */
863function createCache() {
864 var keys = [];
865
866 function cache( key, value ) {
867 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
868 if ( keys.push( key + " " ) > Expr.cacheLength ) {
869 // Only keep the most recent entries
870 delete cache[ keys.shift() ];
871 }
872 return (cache[ key + " " ] = value);
873 }
874 return cache;
875}
876
877/**
878 * Mark a function for special use by Sizzle
879 * @param {Function} fn The function to mark
880 */
881function markFunction( fn ) {
882 fn[ expando ] = true;
883 return fn;
884}
885
886/**
887 * Support testing using an element
888 * @param {Function} fn Passed the created element and returns a boolean result
889 */
890function assert( fn ) {
891 var el = document.createElement("fieldset");
892
893 try {
894 return !!fn( el );
895 } catch (e) {
896 return false;
897 } finally {
898 // Remove from its parent by default
899 if ( el.parentNode ) {
900 el.parentNode.removeChild( el );
901 }
902 // release memory in IE
903 el = null;
904 }
905}
906
907/**
908 * Adds the same handler for all of the specified attrs
909 * @param {String} attrs Pipe-separated list of attributes
910 * @param {Function} handler The method that will be applied
911 */
912function addHandle( attrs, handler ) {
913 var arr = attrs.split("|"),
914 i = arr.length;
915
916 while ( i-- ) {
917 Expr.attrHandle[ arr[i] ] = handler;
918 }
919}
920
921/**
922 * Checks document order of two siblings
923 * @param {Element} a
924 * @param {Element} b
925 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
926 */
927function siblingCheck( a, b ) {
928 var cur = b && a,
929 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
930 a.sourceIndex - b.sourceIndex;
931
932 // Use IE sourceIndex if available on both nodes
933 if ( diff ) {
934 return diff;
935 }
936
937 // Check if b follows a
938 if ( cur ) {
939 while ( (cur = cur.nextSibling) ) {
940 if ( cur === b ) {
941 return -1;
942 }
943 }
944 }
945
946 return a ? 1 : -1;
947}
948
949/**
950 * Returns a function to use in pseudos for input types
951 * @param {String} type
952 */
953function createInputPseudo( type ) {
954 return function( elem ) {
955 var name = elem.nodeName.toLowerCase();
956 return name === "input" && elem.type === type;
957 };
958}
959
960/**
961 * Returns a function to use in pseudos for buttons
962 * @param {String} type
963 */
964function createButtonPseudo( type ) {
965 return function( elem ) {
966 var name = elem.nodeName.toLowerCase();
967 return (name === "input" || name === "button") && elem.type === type;
968 };
969}
970
971/**
972 * Returns a function to use in pseudos for :enabled/:disabled
973 * @param {Boolean} disabled true for :disabled; false for :enabled
974 */
975function createDisabledPseudo( disabled ) {
976
977 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
978 return function( elem ) {
979
980 // Only certain elements can match :enabled or :disabled
981 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
982 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
983 if ( "form" in elem ) {
984
985 // Check for inherited disabledness on relevant non-disabled elements:
986 // * listed form-associated elements in a disabled fieldset
987 // https://html.spec.whatwg.org/multipage/forms.html#category-listed
988 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
989 // * option elements in a disabled optgroup
990 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
991 // All such elements have a "form" property.
992 if ( elem.parentNode && elem.disabled === false ) {
993
994 // Option elements defer to a parent optgroup if present
995 if ( "label" in elem ) {
996 if ( "label" in elem.parentNode ) {
997 return elem.parentNode.disabled === disabled;
998 } else {
999 return elem.disabled === disabled;
1000 }
1001 }
1002
1003 // Support: IE 6 - 11
1004 // Use the isDisabled shortcut property to check for disabled fieldset ancestors
1005 return elem.isDisabled === disabled ||
1006
1007 // Where there is no isDisabled, check manually
1008 /* jshint -W018 */
1009 elem.isDisabled !== !disabled &&
1010 disabledAncestor( elem ) === disabled;
1011 }
1012
1013 return elem.disabled === disabled;
1014
1015 // Try to winnow out elements that can't be disabled before trusting the disabled property.
1016 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
1017 // even exist on them, let alone have a boolean value.
1018 } else if ( "label" in elem ) {
1019 return elem.disabled === disabled;
1020 }
1021
1022 // Remaining elements are neither :enabled nor :disabled
1023 return false;
1024 };
1025}
1026
1027/**
1028 * Returns a function to use in pseudos for positionals
1029 * @param {Function} fn
1030 */
1031function createPositionalPseudo( fn ) {
1032 return markFunction(function( argument ) {
1033 argument = +argument;
1034 return markFunction(function( seed, matches ) {
1035 var j,
1036 matchIndexes = fn( [], seed.length, argument ),
1037 i = matchIndexes.length;
1038
1039 // Match elements found at the specified indexes
1040 while ( i-- ) {
1041 if ( seed[ (j = matchIndexes[i]) ] ) {
1042 seed[j] = !(matches[j] = seed[j]);
1043 }
1044 }
1045 });
1046 });
1047}
1048
1049/**
1050 * Checks a node for validity as a Sizzle context
1051 * @param {Element|Object=} context
1052 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
1053 */
1054function testContext( context ) {
1055 return context && typeof context.getElementsByTagName !== "undefined" && context;
1056}
1057
1058// Expose support vars for convenience
1059support = Sizzle.support = {};
1060
1061/**
1062 * Detects XML nodes
1063 * @param {Element|Object} elem An element or a document
1064 * @returns {Boolean} True iff elem is a non-HTML XML node
1065 */
1066isXML = Sizzle.isXML = function( elem ) {
1067 // documentElement is verified for cases where it doesn't yet exist
1068 // (such as loading iframes in IE - #4833)
1069 var documentElement = elem && (elem.ownerDocument || elem).documentElement;
1070 return documentElement ? documentElement.nodeName !== "HTML" : false;
1071};
1072
1073/**
1074 * Sets document-related variables once based on the current document
1075 * @param {Element|Object} [doc] An element or document object to use to set the document
1076 * @returns {Object} Returns the current document
1077 */
1078setDocument = Sizzle.setDocument = function( node ) {
1079 var hasCompare, subWindow,
1080 doc = node ? node.ownerDocument || node : preferredDoc;
1081
1082 // Return early if doc is invalid or already selected
1083 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
1084 return document;
1085 }
1086
1087 // Update global variables
1088 document = doc;
1089 docElem = document.documentElement;
1090 documentIsHTML = !isXML( document );
1091
1092 // Support: IE 9-11, Edge
1093 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
1094 if ( preferredDoc !== document &&
1095 (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
1096
1097 // Support: IE 11, Edge
1098 if ( subWindow.addEventListener ) {
1099 subWindow.addEventListener( "unload", unloadHandler, false );
1100
1101 // Support: IE 9 - 10 only
1102 } else if ( subWindow.attachEvent ) {
1103 subWindow.attachEvent( "onunload", unloadHandler );
1104 }
1105 }
1106
1107 /* Attributes
1108 ---------------------------------------------------------------------- */
1109
1110 // Support: IE<8
1111 // Verify that getAttribute really returns attributes and not properties
1112 // (excepting IE8 booleans)
1113 support.attributes = assert(function( el ) {
1114 el.className = "i";
1115 return !el.getAttribute("className");
1116 });
1117
1118 /* getElement(s)By*
1119 ---------------------------------------------------------------------- */
1120
1121 // Check if getElementsByTagName("*") returns only elements
1122 support.getElementsByTagName = assert(function( el ) {
1123 el.appendChild( document.createComment("") );
1124 return !el.getElementsByTagName("*").length;
1125 });
1126
1127 // Support: IE<9
1128 support.getElementsByClassName = rnative.test( document.getElementsByClassName );
1129
1130 // Support: IE<10
1131 // Check if getElementById returns elements by name
1132 // The broken getElementById methods don't pick up programmatically-set names,
1133 // so use a roundabout getElementsByName test
1134 support.getById = assert(function( el ) {
1135 docElem.appendChild( el ).id = expando;
1136 return !document.getElementsByName || !document.getElementsByName( expando ).length;
1137 });
1138
1139 // ID filter and find
1140 if ( support.getById ) {
1141 Expr.filter["ID"] = function( id ) {
1142 var attrId = id.replace( runescape, funescape );
1143 return function( elem ) {
1144 return elem.getAttribute("id") === attrId;
1145 };
1146 };
1147 Expr.find["ID"] = function( id, context ) {
1148 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1149 var elem = context.getElementById( id );
1150 return elem ? [ elem ] : [];
1151 }
1152 };
1153 } else {
1154 Expr.filter["ID"] = function( id ) {
1155 var attrId = id.replace( runescape, funescape );
1156 return function( elem ) {
1157 var node = typeof elem.getAttributeNode !== "undefined" &&
1158 elem.getAttributeNode("id");
1159 return node && node.value === attrId;
1160 };
1161 };
1162
1163 // Support: IE 6 - 7 only
1164 // getElementById is not reliable as a find shortcut
1165 Expr.find["ID"] = function( id, context ) {
1166 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1167 var node, i, elems,
1168 elem = context.getElementById( id );
1169
1170 if ( elem ) {
1171
1172 // Verify the id attribute
1173 node = elem.getAttributeNode("id");
1174 if ( node && node.value === id ) {
1175 return [ elem ];
1176 }
1177
1178 // Fall back on getElementsByName
1179 elems = context.getElementsByName( id );
1180 i = 0;
1181 while ( (elem = elems[i++]) ) {
1182 node = elem.getAttributeNode("id");
1183 if ( node && node.value === id ) {
1184 return [ elem ];
1185 }
1186 }
1187 }
1188
1189 return [];
1190 }
1191 };
1192 }
1193
1194 // Tag
1195 Expr.find["TAG"] = support.getElementsByTagName ?
1196 function( tag, context ) {
1197 if ( typeof context.getElementsByTagName !== "undefined" ) {
1198 return context.getElementsByTagName( tag );
1199
1200 // DocumentFragment nodes don't have gEBTN
1201 } else if ( support.qsa ) {
1202 return context.querySelectorAll( tag );
1203 }
1204 } :
1205
1206 function( tag, context ) {
1207 var elem,
1208 tmp = [],
1209 i = 0,
1210 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
1211 results = context.getElementsByTagName( tag );
1212
1213 // Filter out possible comments
1214 if ( tag === "*" ) {
1215 while ( (elem = results[i++]) ) {
1216 if ( elem.nodeType === 1 ) {
1217 tmp.push( elem );
1218 }
1219 }
1220
1221 return tmp;
1222 }
1223 return results;
1224 };
1225
1226 // Class
1227 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
1228 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
1229 return context.getElementsByClassName( className );
1230 }
1231 };
1232
1233 /* QSA/matchesSelector
1234 ---------------------------------------------------------------------- */
1235
1236 // QSA and matchesSelector support
1237
1238 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
1239 rbuggyMatches = [];
1240
1241 // qSa(:focus) reports false when true (Chrome 21)
1242 // We allow this because of a bug in IE8/9 that throws an error
1243 // whenever `document.activeElement` is accessed on an iframe
1244 // So, we allow :focus to pass through QSA all the time to avoid the IE error
1245 // See https://bugs.jquery.com/ticket/13378
1246 rbuggyQSA = [];
1247
1248 if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
1249 // Build QSA regex
1250 // Regex strategy adopted from Diego Perini
1251 assert(function( el ) {
1252 // Select is set to empty string on purpose
1253 // This is to test IE's treatment of not explicitly
1254 // setting a boolean content attribute,
1255 // since its presence should be enough
1256 // https://bugs.jquery.com/ticket/12359
1257 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
1258 "<select id='" + expando + "-\r\\' msallowcapture=''>" +
1259 "<option selected=''></option></select>";
1260
1261 // Support: IE8, Opera 11-12.16
1262 // Nothing should be selected when empty strings follow ^= or $= or *=
1263 // The test attribute must be unknown in Opera but "safe" for WinRT
1264 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
1265 if ( el.querySelectorAll("[msallowcapture^='']").length ) {
1266 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
1267 }
1268
1269 // Support: IE8
1270 // Boolean attributes and "value" are not treated correctly
1271 if ( !el.querySelectorAll("[selected]").length ) {
1272 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1273 }
1274
1275 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
1276 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1277 rbuggyQSA.push("~=");
1278 }
1279
1280 // Webkit/Opera - :checked should return selected option elements
1281 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1282 // IE8 throws error here and will not see later tests
1283 if ( !el.querySelectorAll(":checked").length ) {
1284 rbuggyQSA.push(":checked");
1285 }
1286
1287 // Support: Safari 8+, iOS 8+
1288 // https://bugs.webkit.org/show_bug.cgi?id=136851
1289 // In-page `selector#id sibling-combinator selector` fails
1290 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
1291 rbuggyQSA.push(".#.+[+~]");
1292 }
1293 });
1294
1295 assert(function( el ) {
1296 el.innerHTML = "<a href='' disabled='disabled'></a>" +
1297 "<select disabled='disabled'><option/></select>";
1298
1299 // Support: Windows 8 Native Apps
1300 // The type and name attributes are restricted during .innerHTML assignment
1301 var input = document.createElement("input");
1302 input.setAttribute( "type", "hidden" );
1303 el.appendChild( input ).setAttribute( "name", "D" );
1304
1305 // Support: IE8
1306 // Enforce case-sensitivity of name attribute
1307 if ( el.querySelectorAll("[name=d]").length ) {
1308 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1309 }
1310
1311 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1312 // IE8 throws error here and will not see later tests
1313 if ( el.querySelectorAll(":enabled").length !== 2 ) {
1314 rbuggyQSA.push( ":enabled", ":disabled" );
1315 }
1316
1317 // Support: IE9-11+
1318 // IE's :disabled selector does not pick up the children of disabled fieldsets
1319 docElem.appendChild( el ).disabled = true;
1320 if ( el.querySelectorAll(":disabled").length !== 2 ) {
1321 rbuggyQSA.push( ":enabled", ":disabled" );
1322 }
1323
1324 // Opera 10-11 does not throw on post-comma invalid pseudos
1325 el.querySelectorAll("*,:x");
1326 rbuggyQSA.push(",.*:");
1327 });
1328 }
1329
1330 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
1331 docElem.webkitMatchesSelector ||
1332 docElem.mozMatchesSelector ||
1333 docElem.oMatchesSelector ||
1334 docElem.msMatchesSelector) )) ) {
1335
1336 assert(function( el ) {
1337 // Check to see if it's possible to do matchesSelector
1338 // on a disconnected node (IE 9)
1339 support.disconnectedMatch = matches.call( el, "*" );
1340
1341 // This should fail with an exception
1342 // Gecko does not error, returns false instead
1343 matches.call( el, "[s!='']:x" );
1344 rbuggyMatches.push( "!=", pseudos );
1345 });
1346 }
1347
1348 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
1349 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
1350
1351 /* Contains
1352 ---------------------------------------------------------------------- */
1353 hasCompare = rnative.test( docElem.compareDocumentPosition );
1354
1355 // Element contains another
1356 // Purposefully self-exclusive
1357 // As in, an element does not contain itself
1358 contains = hasCompare || rnative.test( docElem.contains ) ?
1359 function( a, b ) {
1360 var adown = a.nodeType === 9 ? a.documentElement : a,
1361 bup = b && b.parentNode;
1362 return a === bup || !!( bup && bup.nodeType === 1 && (
1363 adown.contains ?
1364 adown.contains( bup ) :
1365 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1366 ));
1367 } :
1368 function( a, b ) {
1369 if ( b ) {
1370 while ( (b = b.parentNode) ) {
1371 if ( b === a ) {
1372 return true;
1373 }
1374 }
1375 }
1376 return false;
1377 };
1378
1379 /* Sorting
1380 ---------------------------------------------------------------------- */
1381
1382 // Document order sorting
1383 sortOrder = hasCompare ?
1384 function( a, b ) {
1385
1386 // Flag for duplicate removal
1387 if ( a === b ) {
1388 hasDuplicate = true;
1389 return 0;
1390 }
1391
1392 // Sort on method existence if only one input has compareDocumentPosition
1393 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
1394 if ( compare ) {
1395 return compare;
1396 }
1397
1398 // Calculate position if both inputs belong to the same document
1399 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
1400 a.compareDocumentPosition( b ) :
1401
1402 // Otherwise we know they are disconnected
1403 1;
1404
1405 // Disconnected nodes
1406 if ( compare & 1 ||
1407 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
1408
1409 // Choose the first element that is related to our preferred document
1410 if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
1411 return -1;
1412 }
1413 if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
1414 return 1;
1415 }
1416
1417 // Maintain original order
1418 return sortInput ?
1419 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1420 0;
1421 }
1422
1423 return compare & 4 ? -1 : 1;
1424 } :
1425 function( a, b ) {
1426 // Exit early if the nodes are identical
1427 if ( a === b ) {
1428 hasDuplicate = true;
1429 return 0;
1430 }
1431
1432 var cur,
1433 i = 0,
1434 aup = a.parentNode,
1435 bup = b.parentNode,
1436 ap = [ a ],
1437 bp = [ b ];
1438
1439 // Parentless nodes are either documents or disconnected
1440 if ( !aup || !bup ) {
1441 return a === document ? -1 :
1442 b === document ? 1 :
1443 aup ? -1 :
1444 bup ? 1 :
1445 sortInput ?
1446 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1447 0;
1448
1449 // If the nodes are siblings, we can do a quick check
1450 } else if ( aup === bup ) {
1451 return siblingCheck( a, b );
1452 }
1453
1454 // Otherwise we need full lists of their ancestors for comparison
1455 cur = a;
1456 while ( (cur = cur.parentNode) ) {
1457 ap.unshift( cur );
1458 }
1459 cur = b;
1460 while ( (cur = cur.parentNode) ) {
1461 bp.unshift( cur );
1462 }
1463
1464 // Walk down the tree looking for a discrepancy
1465 while ( ap[i] === bp[i] ) {
1466 i++;
1467 }
1468
1469 return i ?
1470 // Do a sibling check if the nodes have a common ancestor
1471 siblingCheck( ap[i], bp[i] ) :
1472
1473 // Otherwise nodes in our document sort first
1474 ap[i] === preferredDoc ? -1 :
1475 bp[i] === preferredDoc ? 1 :
1476 0;
1477 };
1478
1479 return document;
1480};
1481
1482Sizzle.matches = function( expr, elements ) {
1483 return Sizzle( expr, null, null, elements );
1484};
1485
1486Sizzle.matchesSelector = function( elem, expr ) {
1487 // Set document vars if needed
1488 if ( ( elem.ownerDocument || elem ) !== document ) {
1489 setDocument( elem );
1490 }
1491
1492 // Make sure that attribute selectors are quoted
1493 expr = expr.replace( rattributeQuotes, "='$1']" );
1494
1495 if ( support.matchesSelector && documentIsHTML &&
1496 !compilerCache[ expr + " " ] &&
1497 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
1498 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
1499
1500 try {
1501 var ret = matches.call( elem, expr );
1502
1503 // IE 9's matchesSelector returns false on disconnected nodes
1504 if ( ret || support.disconnectedMatch ||
1505 // As well, disconnected nodes are said to be in a document
1506 // fragment in IE 9
1507 elem.document && elem.document.nodeType !== 11 ) {
1508 return ret;
1509 }
1510 } catch (e) {}
1511 }
1512
1513 return Sizzle( expr, document, null, [ elem ] ).length > 0;
1514};
1515
1516Sizzle.contains = function( context, elem ) {
1517 // Set document vars if needed
1518 if ( ( context.ownerDocument || context ) !== document ) {
1519 setDocument( context );
1520 }
1521 return contains( context, elem );
1522};
1523
1524Sizzle.attr = function( elem, name ) {
1525 // Set document vars if needed
1526 if ( ( elem.ownerDocument || elem ) !== document ) {
1527 setDocument( elem );
1528 }
1529
1530 var fn = Expr.attrHandle[ name.toLowerCase() ],
1531 // Don't get fooled by Object.prototype properties (jQuery #13807)
1532 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1533 fn( elem, name, !documentIsHTML ) :
1534 undefined;
1535
1536 return val !== undefined ?
1537 val :
1538 support.attributes || !documentIsHTML ?
1539 elem.getAttribute( name ) :
1540 (val = elem.getAttributeNode(name)) && val.specified ?
1541 val.value :
1542 null;
1543};
1544
1545Sizzle.escape = function( sel ) {
1546 return (sel + "").replace( rcssescape, fcssescape );
1547};
1548
1549Sizzle.error = function( msg ) {
1550 throw new Error( "Syntax error, unrecognized expression: " + msg );
1551};
1552
1553/**
1554 * Document sorting and removing duplicates
1555 * @param {ArrayLike} results
1556 */
1557Sizzle.uniqueSort = function( results ) {
1558 var elem,
1559 duplicates = [],
1560 j = 0,
1561 i = 0;
1562
1563 // Unless we *know* we can detect duplicates, assume their presence
1564 hasDuplicate = !support.detectDuplicates;
1565 sortInput = !support.sortStable && results.slice( 0 );
1566 results.sort( sortOrder );
1567
1568 if ( hasDuplicate ) {
1569 while ( (elem = results[i++]) ) {
1570 if ( elem === results[ i ] ) {
1571 j = duplicates.push( i );
1572 }
1573 }
1574 while ( j-- ) {
1575 results.splice( duplicates[ j ], 1 );
1576 }
1577 }
1578
1579 // Clear input after sorting to release objects
1580 // See https://github.com/jquery/sizzle/pull/225
1581 sortInput = null;
1582
1583 return results;
1584};
1585
1586/**
1587 * Utility function for retrieving the text value of an array of DOM nodes
1588 * @param {Array|Element} elem
1589 */
1590getText = Sizzle.getText = function( elem ) {
1591 var node,
1592 ret = "",
1593 i = 0,
1594 nodeType = elem.nodeType;
1595
1596 if ( !nodeType ) {
1597 // If no nodeType, this is expected to be an array
1598 while ( (node = elem[i++]) ) {
1599 // Do not traverse comment nodes
1600 ret += getText( node );
1601 }
1602 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1603 // Use textContent for elements
1604 // innerText usage removed for consistency of new lines (jQuery #11153)
1605 if ( typeof elem.textContent === "string" ) {
1606 return elem.textContent;
1607 } else {
1608 // Traverse its children
1609 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1610 ret += getText( elem );
1611 }
1612 }
1613 } else if ( nodeType === 3 || nodeType === 4 ) {
1614 return elem.nodeValue;
1615 }
1616 // Do not include comment or processing instruction nodes
1617
1618 return ret;
1619};
1620
1621Expr = Sizzle.selectors = {
1622
1623 // Can be adjusted by the user
1624 cacheLength: 50,
1625
1626 createPseudo: markFunction,
1627
1628 match: matchExpr,
1629
1630 attrHandle: {},
1631
1632 find: {},
1633
1634 relative: {
1635 ">": { dir: "parentNode", first: true },
1636 " ": { dir: "parentNode" },
1637 "+": { dir: "previousSibling", first: true },
1638 "~": { dir: "previousSibling" }
1639 },
1640
1641 preFilter: {
1642 "ATTR": function( match ) {
1643 match[1] = match[1].replace( runescape, funescape );
1644
1645 // Move the given value to match[3] whether quoted or unquoted
1646 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
1647
1648 if ( match[2] === "~=" ) {
1649 match[3] = " " + match[3] + " ";
1650 }
1651
1652 return match.slice( 0, 4 );
1653 },
1654
1655 "CHILD": function( match ) {
1656 /* matches from matchExpr["CHILD"]
1657 1 type (only|nth|...)
1658 2 what (child|of-type)
1659 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
1660 4 xn-component of xn+y argument ([+-]?\d*n|)
1661 5 sign of xn-component
1662 6 x of xn-component
1663 7 sign of y-component
1664 8 y of y-component
1665 */
1666 match[1] = match[1].toLowerCase();
1667
1668 if ( match[1].slice( 0, 3 ) === "nth" ) {
1669 // nth-* requires argument
1670 if ( !match[3] ) {
1671 Sizzle.error( match[0] );
1672 }
1673
1674 // numeric x and y parameters for Expr.filter.CHILD
1675 // remember that false/true cast respectively to 0/1
1676 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
1677 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
1678
1679 // other types prohibit arguments
1680 } else if ( match[3] ) {
1681 Sizzle.error( match[0] );
1682 }
1683
1684 return match;
1685 },
1686
1687 "PSEUDO": function( match ) {
1688 var excess,
1689 unquoted = !match[6] && match[2];
1690
1691 if ( matchExpr["CHILD"].test( match[0] ) ) {
1692 return null;
1693 }
1694
1695 // Accept quoted arguments as-is
1696 if ( match[3] ) {
1697 match[2] = match[4] || match[5] || "";
1698
1699 // Strip excess characters from unquoted arguments
1700 } else if ( unquoted && rpseudo.test( unquoted ) &&
1701 // Get excess from tokenize (recursively)
1702 (excess = tokenize( unquoted, true )) &&
1703 // advance to the next closing parenthesis
1704 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
1705
1706 // excess is a negative index
1707 match[0] = match[0].slice( 0, excess );
1708 match[2] = unquoted.slice( 0, excess );
1709 }
1710
1711 // Return only captures needed by the pseudo filter method (type and argument)
1712 return match.slice( 0, 3 );
1713 }
1714 },
1715
1716 filter: {
1717
1718 "TAG": function( nodeNameSelector ) {
1719 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1720 return nodeNameSelector === "*" ?
1721 function() { return true; } :
1722 function( elem ) {
1723 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1724 };
1725 },
1726
1727 "CLASS": function( className ) {
1728 var pattern = classCache[ className + " " ];
1729
1730 return pattern ||
1731 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
1732 classCache( className, function( elem ) {
1733 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
1734 });
1735 },
1736
1737 "ATTR": function( name, operator, check ) {
1738 return function( elem ) {
1739 var result = Sizzle.attr( elem, name );
1740
1741 if ( result == null ) {
1742 return operator === "!=";
1743 }
1744 if ( !operator ) {
1745 return true;
1746 }
1747
1748 result += "";
1749
1750 return operator === "=" ? result === check :
1751 operator === "!=" ? result !== check :
1752 operator === "^=" ? check && result.indexOf( check ) === 0 :
1753 operator === "*=" ? check && result.indexOf( check ) > -1 :
1754 operator === "$=" ? check && result.slice( -check.length ) === check :
1755 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
1756 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
1757 false;
1758 };
1759 },
1760
1761 "CHILD": function( type, what, argument, first, last ) {
1762 var simple = type.slice( 0, 3 ) !== "nth",
1763 forward = type.slice( -4 ) !== "last",
1764 ofType = what === "of-type";
1765
1766 return first === 1 && last === 0 ?
1767
1768 // Shortcut for :nth-*(n)
1769 function( elem ) {
1770 return !!elem.parentNode;
1771 } :
1772
1773 function( elem, context, xml ) {
1774 var cache, uniqueCache, outerCache, node, nodeIndex, start,
1775 dir = simple !== forward ? "nextSibling" : "previousSibling",
1776 parent = elem.parentNode,
1777 name = ofType && elem.nodeName.toLowerCase(),
1778 useCache = !xml && !ofType,
1779 diff = false;
1780
1781 if ( parent ) {
1782
1783 // :(first|last|only)-(child|of-type)
1784 if ( simple ) {
1785 while ( dir ) {
1786 node = elem;
1787 while ( (node = node[ dir ]) ) {
1788 if ( ofType ?
1789 node.nodeName.toLowerCase() === name :
1790 node.nodeType === 1 ) {
1791
1792 return false;
1793 }
1794 }
1795 // Reverse direction for :only-* (if we haven't yet done so)
1796 start = dir = type === "only" && !start && "nextSibling";
1797 }
1798 return true;
1799 }
1800
1801 start = [ forward ? parent.firstChild : parent.lastChild ];
1802
1803 // non-xml :nth-child(...) stores cache data on `parent`
1804 if ( forward && useCache ) {
1805
1806 // Seek `elem` from a previously-cached index
1807
1808 // ...in a gzip-friendly way
1809 node = parent;
1810 outerCache = node[ expando ] || (node[ expando ] = {});
1811
1812 // Support: IE <9 only
1813 // Defend against cloned attroperties (jQuery gh-1709)
1814 uniqueCache = outerCache[ node.uniqueID ] ||
1815 (outerCache[ node.uniqueID ] = {});
1816
1817 cache = uniqueCache[ type ] || [];
1818 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1819 diff = nodeIndex && cache[ 2 ];
1820 node = nodeIndex && parent.childNodes[ nodeIndex ];
1821
1822 while ( (node = ++nodeIndex && node && node[ dir ] ||
1823
1824 // Fallback to seeking `elem` from the start
1825 (diff = nodeIndex = 0) || start.pop()) ) {
1826
1827 // When found, cache indexes on `parent` and break
1828 if ( node.nodeType === 1 && ++diff && node === elem ) {
1829 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
1830 break;
1831 }
1832 }
1833
1834 } else {
1835 // Use previously-cached element index if available
1836 if ( useCache ) {
1837 // ...in a gzip-friendly way
1838 node = elem;
1839 outerCache = node[ expando ] || (node[ expando ] = {});
1840
1841 // Support: IE <9 only
1842 // Defend against cloned attroperties (jQuery gh-1709)
1843 uniqueCache = outerCache[ node.uniqueID ] ||
1844 (outerCache[ node.uniqueID ] = {});
1845
1846 cache = uniqueCache[ type ] || [];
1847 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1848 diff = nodeIndex;
1849 }
1850
1851 // xml :nth-child(...)
1852 // or :nth-last-child(...) or :nth(-last)?-of-type(...)
1853 if ( diff === false ) {
1854 // Use the same loop as above to seek `elem` from the start
1855 while ( (node = ++nodeIndex && node && node[ dir ] ||
1856 (diff = nodeIndex = 0) || start.pop()) ) {
1857
1858 if ( ( ofType ?
1859 node.nodeName.toLowerCase() === name :
1860 node.nodeType === 1 ) &&
1861 ++diff ) {
1862
1863 // Cache the index of each encountered element
1864 if ( useCache ) {
1865 outerCache = node[ expando ] || (node[ expando ] = {});
1866
1867 // Support: IE <9 only
1868 // Defend against cloned attroperties (jQuery gh-1709)
1869 uniqueCache = outerCache[ node.uniqueID ] ||
1870 (outerCache[ node.uniqueID ] = {});
1871
1872 uniqueCache[ type ] = [ dirruns, diff ];
1873 }
1874
1875 if ( node === elem ) {
1876 break;
1877 }
1878 }
1879 }
1880 }
1881 }
1882
1883 // Incorporate the offset, then check against cycle size
1884 diff -= last;
1885 return diff === first || ( diff % first === 0 && diff / first >= 0 );
1886 }
1887 };
1888 },
1889
1890 "PSEUDO": function( pseudo, argument ) {
1891 // pseudo-class names are case-insensitive
1892 // http://www.w3.org/TR/selectors/#pseudo-classes
1893 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
1894 // Remember that setFilters inherits from pseudos
1895 var args,
1896 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
1897 Sizzle.error( "unsupported pseudo: " + pseudo );
1898
1899 // The user may use createPseudo to indicate that
1900 // arguments are needed to create the filter function
1901 // just as Sizzle does
1902 if ( fn[ expando ] ) {
1903 return fn( argument );
1904 }
1905
1906 // But maintain support for old signatures
1907 if ( fn.length > 1 ) {
1908 args = [ pseudo, pseudo, "", argument ];
1909 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
1910 markFunction(function( seed, matches ) {
1911 var idx,
1912 matched = fn( seed, argument ),
1913 i = matched.length;
1914 while ( i-- ) {
1915 idx = indexOf( seed, matched[i] );
1916 seed[ idx ] = !( matches[ idx ] = matched[i] );
1917 }
1918 }) :
1919 function( elem ) {
1920 return fn( elem, 0, args );
1921 };
1922 }
1923
1924 return fn;
1925 }
1926 },
1927
1928 pseudos: {
1929 // Potentially complex pseudos
1930 "not": markFunction(function( selector ) {
1931 // Trim the selector passed to compile
1932 // to avoid treating leading and trailing
1933 // spaces as combinators
1934 var input = [],
1935 results = [],
1936 matcher = compile( selector.replace( rtrim, "$1" ) );
1937
1938 return matcher[ expando ] ?
1939 markFunction(function( seed, matches, context, xml ) {
1940 var elem,
1941 unmatched = matcher( seed, null, xml, [] ),
1942 i = seed.length;
1943
1944 // Match elements unmatched by `matcher`
1945 while ( i-- ) {
1946 if ( (elem = unmatched[i]) ) {
1947 seed[i] = !(matches[i] = elem);
1948 }
1949 }
1950 }) :
1951 function( elem, context, xml ) {
1952 input[0] = elem;
1953 matcher( input, null, xml, results );
1954 // Don't keep the element (issue #299)
1955 input[0] = null;
1956 return !results.pop();
1957 };
1958 }),
1959
1960 "has": markFunction(function( selector ) {
1961 return function( elem ) {
1962 return Sizzle( selector, elem ).length > 0;
1963 };
1964 }),
1965
1966 "contains": markFunction(function( text ) {
1967 text = text.replace( runescape, funescape );
1968 return function( elem ) {
1969 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
1970 };
1971 }),
1972
1973 // "Whether an element is represented by a :lang() selector
1974 // is based solely on the element's language value
1975 // being equal to the identifier C,
1976 // or beginning with the identifier C immediately followed by "-".
1977 // The matching of C against the element's language value is performed case-insensitively.
1978 // The identifier C does not have to be a valid language name."
1979 // http://www.w3.org/TR/selectors/#lang-pseudo
1980 "lang": markFunction( function( lang ) {
1981 // lang value must be a valid identifier
1982 if ( !ridentifier.test(lang || "") ) {
1983 Sizzle.error( "unsupported lang: " + lang );
1984 }
1985 lang = lang.replace( runescape, funescape ).toLowerCase();
1986 return function( elem ) {
1987 var elemLang;
1988 do {
1989 if ( (elemLang = documentIsHTML ?
1990 elem.lang :
1991 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
1992
1993 elemLang = elemLang.toLowerCase();
1994 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
1995 }
1996 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
1997 return false;
1998 };
1999 }),
2000
2001 // Miscellaneous
2002 "target": function( elem ) {
2003 var hash = window.location && window.location.hash;
2004 return hash && hash.slice( 1 ) === elem.id;
2005 },
2006
2007 "root": function( elem ) {
2008 return elem === docElem;
2009 },
2010
2011 "focus": function( elem ) {
2012 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
2013 },
2014
2015 // Boolean properties
2016 "enabled": createDisabledPseudo( false ),
2017 "disabled": createDisabledPseudo( true ),
2018
2019 "checked": function( elem ) {
2020 // In CSS3, :checked should return both checked and selected elements
2021 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
2022 var nodeName = elem.nodeName.toLowerCase();
2023 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
2024 },
2025
2026 "selected": function( elem ) {
2027 // Accessing this property makes selected-by-default
2028 // options in Safari work properly
2029 if ( elem.parentNode ) {
2030 elem.parentNode.selectedIndex;
2031 }
2032
2033 return elem.selected === true;
2034 },
2035
2036 // Contents
2037 "empty": function( elem ) {
2038 // http://www.w3.org/TR/selectors/#empty-pseudo
2039 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
2040 // but not by others (comment: 8; processing instruction: 7; etc.)
2041 // nodeType < 6 works because attributes (2) do not appear as children
2042 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
2043 if ( elem.nodeType < 6 ) {
2044 return false;
2045 }
2046 }
2047 return true;
2048 },
2049
2050 "parent": function( elem ) {
2051 return !Expr.pseudos["empty"]( elem );
2052 },
2053
2054 // Element/input types
2055 "header": function( elem ) {
2056 return rheader.test( elem.nodeName );
2057 },
2058
2059 "input": function( elem ) {
2060 return rinputs.test( elem.nodeName );
2061 },
2062
2063 "button": function( elem ) {
2064 var name = elem.nodeName.toLowerCase();
2065 return name === "input" && elem.type === "button" || name === "button";
2066 },
2067
2068 "text": function( elem ) {
2069 var attr;
2070 return elem.nodeName.toLowerCase() === "input" &&
2071 elem.type === "text" &&
2072
2073 // Support: IE<8
2074 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
2075 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
2076 },
2077
2078 // Position-in-collection
2079 "first": createPositionalPseudo(function() {
2080 return [ 0 ];
2081 }),
2082
2083 "last": createPositionalPseudo(function( matchIndexes, length ) {
2084 return [ length - 1 ];
2085 }),
2086
2087 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
2088 return [ argument < 0 ? argument + length : argument ];
2089 }),
2090
2091 "even": createPositionalPseudo(function( matchIndexes, length ) {
2092 var i = 0;
2093 for ( ; i < length; i += 2 ) {
2094 matchIndexes.push( i );
2095 }
2096 return matchIndexes;
2097 }),
2098
2099 "odd": createPositionalPseudo(function( matchIndexes, length ) {
2100 var i = 1;
2101 for ( ; i < length; i += 2 ) {
2102 matchIndexes.push( i );
2103 }
2104 return matchIndexes;
2105 }),
2106
2107 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2108 var i = argument < 0 ? argument + length : argument;
2109 for ( ; --i >= 0; ) {
2110 matchIndexes.push( i );
2111 }
2112 return matchIndexes;
2113 }),
2114
2115 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2116 var i = argument < 0 ? argument + length : argument;
2117 for ( ; ++i < length; ) {
2118 matchIndexes.push( i );
2119 }
2120 return matchIndexes;
2121 })
2122 }
2123};
2124
2125Expr.pseudos["nth"] = Expr.pseudos["eq"];
2126
2127// Add button/input type pseudos
2128for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
2129 Expr.pseudos[ i ] = createInputPseudo( i );
2130}
2131for ( i in { submit: true, reset: true } ) {
2132 Expr.pseudos[ i ] = createButtonPseudo( i );
2133}
2134
2135// Easy API for creating new setFilters
2136function setFilters() {}
2137setFilters.prototype = Expr.filters = Expr.pseudos;
2138Expr.setFilters = new setFilters();
2139
2140tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2141 var matched, match, tokens, type,
2142 soFar, groups, preFilters,
2143 cached = tokenCache[ selector + " " ];
2144
2145 if ( cached ) {
2146 return parseOnly ? 0 : cached.slice( 0 );
2147 }
2148
2149 soFar = selector;
2150 groups = [];
2151 preFilters = Expr.preFilter;
2152
2153 while ( soFar ) {
2154
2155 // Comma and first run
2156 if ( !matched || (match = rcomma.exec( soFar )) ) {
2157 if ( match ) {
2158 // Don't consume trailing commas as valid
2159 soFar = soFar.slice( match[0].length ) || soFar;
2160 }
2161 groups.push( (tokens = []) );
2162 }
2163
2164 matched = false;
2165
2166 // Combinators
2167 if ( (match = rcombinators.exec( soFar )) ) {
2168 matched = match.shift();
2169 tokens.push({
2170 value: matched,
2171 // Cast descendant combinators to space
2172 type: match[0].replace( rtrim, " " )
2173 });
2174 soFar = soFar.slice( matched.length );
2175 }
2176
2177 // Filters
2178 for ( type in Expr.filter ) {
2179 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
2180 (match = preFilters[ type ]( match ))) ) {
2181 matched = match.shift();
2182 tokens.push({
2183 value: matched,
2184 type: type,
2185 matches: match
2186 });
2187 soFar = soFar.slice( matched.length );
2188 }
2189 }
2190
2191 if ( !matched ) {
2192 break;
2193 }
2194 }
2195
2196 // Return the length of the invalid excess
2197 // if we're just parsing
2198 // Otherwise, throw an error or return tokens
2199 return parseOnly ?
2200 soFar.length :
2201 soFar ?
2202 Sizzle.error( selector ) :
2203 // Cache the tokens
2204 tokenCache( selector, groups ).slice( 0 );
2205};
2206
2207function toSelector( tokens ) {
2208 var i = 0,
2209 len = tokens.length,
2210 selector = "";
2211 for ( ; i < len; i++ ) {
2212 selector += tokens[i].value;
2213 }
2214 return selector;
2215}
2216
2217function addCombinator( matcher, combinator, base ) {
2218 var dir = combinator.dir,
2219 skip = combinator.next,
2220 key = skip || dir,
2221 checkNonElements = base && key === "parentNode",
2222 doneName = done++;
2223
2224 return combinator.first ?
2225 // Check against closest ancestor/preceding element
2226 function( elem, context, xml ) {
2227 while ( (elem = elem[ dir ]) ) {
2228 if ( elem.nodeType === 1 || checkNonElements ) {
2229 return matcher( elem, context, xml );
2230 }
2231 }
2232 return false;
2233 } :
2234
2235 // Check against all ancestor/preceding elements
2236 function( elem, context, xml ) {
2237 var oldCache, uniqueCache, outerCache,
2238 newCache = [ dirruns, doneName ];
2239
2240 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
2241 if ( xml ) {
2242 while ( (elem = elem[ dir ]) ) {
2243 if ( elem.nodeType === 1 || checkNonElements ) {
2244 if ( matcher( elem, context, xml ) ) {
2245 return true;
2246 }
2247 }
2248 }
2249 } else {
2250 while ( (elem = elem[ dir ]) ) {
2251 if ( elem.nodeType === 1 || checkNonElements ) {
2252 outerCache = elem[ expando ] || (elem[ expando ] = {});
2253
2254 // Support: IE <9 only
2255 // Defend against cloned attroperties (jQuery gh-1709)
2256 uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
2257
2258 if ( skip && skip === elem.nodeName.toLowerCase() ) {
2259 elem = elem[ dir ] || elem;
2260 } else if ( (oldCache = uniqueCache[ key ]) &&
2261 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2262
2263 // Assign to newCache so results back-propagate to previous elements
2264 return (newCache[ 2 ] = oldCache[ 2 ]);
2265 } else {
2266 // Reuse newcache so results back-propagate to previous elements
2267 uniqueCache[ key ] = newCache;
2268
2269 // A match means we're done; a fail means we have to keep checking
2270 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
2271 return true;
2272 }
2273 }
2274 }
2275 }
2276 }
2277 return false;
2278 };
2279}
2280
2281function elementMatcher( matchers ) {
2282 return matchers.length > 1 ?
2283 function( elem, context, xml ) {
2284 var i = matchers.length;
2285 while ( i-- ) {
2286 if ( !matchers[i]( elem, context, xml ) ) {
2287 return false;
2288 }
2289 }
2290 return true;
2291 } :
2292 matchers[0];
2293}
2294
2295function multipleContexts( selector, contexts, results ) {
2296 var i = 0,
2297 len = contexts.length;
2298 for ( ; i < len; i++ ) {
2299 Sizzle( selector, contexts[i], results );
2300 }
2301 return results;
2302}
2303
2304function condense( unmatched, map, filter, context, xml ) {
2305 var elem,
2306 newUnmatched = [],
2307 i = 0,
2308 len = unmatched.length,
2309 mapped = map != null;
2310
2311 for ( ; i < len; i++ ) {
2312 if ( (elem = unmatched[i]) ) {
2313 if ( !filter || filter( elem, context, xml ) ) {
2314 newUnmatched.push( elem );
2315 if ( mapped ) {
2316 map.push( i );
2317 }
2318 }
2319 }
2320 }
2321
2322 return newUnmatched;
2323}
2324
2325function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2326 if ( postFilter && !postFilter[ expando ] ) {
2327 postFilter = setMatcher( postFilter );
2328 }
2329 if ( postFinder && !postFinder[ expando ] ) {
2330 postFinder = setMatcher( postFinder, postSelector );
2331 }
2332 return markFunction(function( seed, results, context, xml ) {
2333 var temp, i, elem,
2334 preMap = [],
2335 postMap = [],
2336 preexisting = results.length,
2337
2338 // Get initial elements from seed or context
2339 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
2340
2341 // Prefilter to get matcher input, preserving a map for seed-results synchronization
2342 matcherIn = preFilter && ( seed || !selector ) ?
2343 condense( elems, preMap, preFilter, context, xml ) :
2344 elems,
2345
2346 matcherOut = matcher ?
2347 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2348 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2349
2350 // ...intermediate processing is necessary
2351 [] :
2352
2353 // ...otherwise use results directly
2354 results :
2355 matcherIn;
2356
2357 // Find primary matches
2358 if ( matcher ) {
2359 matcher( matcherIn, matcherOut, context, xml );
2360 }
2361
2362 // Apply postFilter
2363 if ( postFilter ) {
2364 temp = condense( matcherOut, postMap );
2365 postFilter( temp, [], context, xml );
2366
2367 // Un-match failing elements by moving them back to matcherIn
2368 i = temp.length;
2369 while ( i-- ) {
2370 if ( (elem = temp[i]) ) {
2371 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
2372 }
2373 }
2374 }
2375
2376 if ( seed ) {
2377 if ( postFinder || preFilter ) {
2378 if ( postFinder ) {
2379 // Get the final matcherOut by condensing this intermediate into postFinder contexts
2380 temp = [];
2381 i = matcherOut.length;
2382 while ( i-- ) {
2383 if ( (elem = matcherOut[i]) ) {
2384 // Restore matcherIn since elem is not yet a final match
2385 temp.push( (matcherIn[i] = elem) );
2386 }
2387 }
2388 postFinder( null, (matcherOut = []), temp, xml );
2389 }
2390
2391 // Move matched elements from seed to results to keep them synchronized
2392 i = matcherOut.length;
2393 while ( i-- ) {
2394 if ( (elem = matcherOut[i]) &&
2395 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
2396
2397 seed[temp] = !(results[temp] = elem);
2398 }
2399 }
2400 }
2401
2402 // Add elements to results, through postFinder if defined
2403 } else {
2404 matcherOut = condense(
2405 matcherOut === results ?
2406 matcherOut.splice( preexisting, matcherOut.length ) :
2407 matcherOut
2408 );
2409 if ( postFinder ) {
2410 postFinder( null, results, matcherOut, xml );
2411 } else {
2412 push.apply( results, matcherOut );
2413 }
2414 }
2415 });
2416}
2417
2418function matcherFromTokens( tokens ) {
2419 var checkContext, matcher, j,
2420 len = tokens.length,
2421 leadingRelative = Expr.relative[ tokens[0].type ],
2422 implicitRelative = leadingRelative || Expr.relative[" "],
2423 i = leadingRelative ? 1 : 0,
2424
2425 // The foundational matcher ensures that elements are reachable from top-level context(s)
2426 matchContext = addCombinator( function( elem ) {
2427 return elem === checkContext;
2428 }, implicitRelative, true ),
2429 matchAnyContext = addCombinator( function( elem ) {
2430 return indexOf( checkContext, elem ) > -1;
2431 }, implicitRelative, true ),
2432 matchers = [ function( elem, context, xml ) {
2433 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2434 (checkContext = context).nodeType ?
2435 matchContext( elem, context, xml ) :
2436 matchAnyContext( elem, context, xml ) );
2437 // Avoid hanging onto element (issue #299)
2438 checkContext = null;
2439 return ret;
2440 } ];
2441
2442 for ( ; i < len; i++ ) {
2443 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
2444 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
2445 } else {
2446 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
2447
2448 // Return special upon seeing a positional matcher
2449 if ( matcher[ expando ] ) {
2450 // Find the next relative operator (if any) for proper handling
2451 j = ++i;
2452 for ( ; j < len; j++ ) {
2453 if ( Expr.relative[ tokens[j].type ] ) {
2454 break;
2455 }
2456 }
2457 return setMatcher(
2458 i > 1 && elementMatcher( matchers ),
2459 i > 1 && toSelector(
2460 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2461 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
2462 ).replace( rtrim, "$1" ),
2463 matcher,
2464 i < j && matcherFromTokens( tokens.slice( i, j ) ),
2465 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
2466 j < len && toSelector( tokens )
2467 );
2468 }
2469 matchers.push( matcher );
2470 }
2471 }
2472
2473 return elementMatcher( matchers );
2474}
2475
2476function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2477 var bySet = setMatchers.length > 0,
2478 byElement = elementMatchers.length > 0,
2479 superMatcher = function( seed, context, xml, results, outermost ) {
2480 var elem, j, matcher,
2481 matchedCount = 0,
2482 i = "0",
2483 unmatched = seed && [],
2484 setMatched = [],
2485 contextBackup = outermostContext,
2486 // We must always have either seed elements or outermost context
2487 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
2488 // Use integer dirruns iff this is the outermost matcher
2489 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
2490 len = elems.length;
2491
2492 if ( outermost ) {
2493 outermostContext = context === document || context || outermost;
2494 }
2495
2496 // Add elements passing elementMatchers directly to results
2497 // Support: IE<9, Safari
2498 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
2499 for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
2500 if ( byElement && elem ) {
2501 j = 0;
2502 if ( !context && elem.ownerDocument !== document ) {
2503 setDocument( elem );
2504 xml = !documentIsHTML;
2505 }
2506 while ( (matcher = elementMatchers[j++]) ) {
2507 if ( matcher( elem, context || document, xml) ) {
2508 results.push( elem );
2509 break;
2510 }
2511 }
2512 if ( outermost ) {
2513 dirruns = dirrunsUnique;
2514 }
2515 }
2516
2517 // Track unmatched elements for set filters
2518 if ( bySet ) {
2519 // They will have gone through all possible matchers
2520 if ( (elem = !matcher && elem) ) {
2521 matchedCount--;
2522 }
2523
2524 // Lengthen the array for every element, matched or not
2525 if ( seed ) {
2526 unmatched.push( elem );
2527 }
2528 }
2529 }
2530
2531 // `i` is now the count of elements visited above, and adding it to `matchedCount`
2532 // makes the latter nonnegative.
2533 matchedCount += i;
2534
2535 // Apply set filters to unmatched elements
2536 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
2537 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
2538 // no element matchers and no seed.
2539 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
2540 // case, which will result in a "00" `matchedCount` that differs from `i` but is also
2541 // numerically zero.
2542 if ( bySet && i !== matchedCount ) {
2543 j = 0;
2544 while ( (matcher = setMatchers[j++]) ) {
2545 matcher( unmatched, setMatched, context, xml );
2546 }
2547
2548 if ( seed ) {
2549 // Reintegrate element matches to eliminate the need for sorting
2550 if ( matchedCount > 0 ) {
2551 while ( i-- ) {
2552 if ( !(unmatched[i] || setMatched[i]) ) {
2553 setMatched[i] = pop.call( results );
2554 }
2555 }
2556 }
2557
2558 // Discard index placeholder values to get only actual matches
2559 setMatched = condense( setMatched );
2560 }
2561
2562 // Add matches to results
2563 push.apply( results, setMatched );
2564
2565 // Seedless set matches succeeding multiple successful matchers stipulate sorting
2566 if ( outermost && !seed && setMatched.length > 0 &&
2567 ( matchedCount + setMatchers.length ) > 1 ) {
2568
2569 Sizzle.uniqueSort( results );
2570 }
2571 }
2572
2573 // Override manipulation of globals by nested matchers
2574 if ( outermost ) {
2575 dirruns = dirrunsUnique;
2576 outermostContext = contextBackup;
2577 }
2578
2579 return unmatched;
2580 };
2581
2582 return bySet ?
2583 markFunction( superMatcher ) :
2584 superMatcher;
2585}
2586
2587compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2588 var i,
2589 setMatchers = [],
2590 elementMatchers = [],
2591 cached = compilerCache[ selector + " " ];
2592
2593 if ( !cached ) {
2594 // Generate a function of recursive functions that can be used to check each element
2595 if ( !match ) {
2596 match = tokenize( selector );
2597 }
2598 i = match.length;
2599 while ( i-- ) {
2600 cached = matcherFromTokens( match[i] );
2601 if ( cached[ expando ] ) {
2602 setMatchers.push( cached );
2603 } else {
2604 elementMatchers.push( cached );
2605 }
2606 }
2607
2608 // Cache the compiled function
2609 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2610
2611 // Save selector and tokenization
2612 cached.selector = selector;
2613 }
2614 return cached;
2615};
2616
2617/**
2618 * A low-level selection function that works with Sizzle's compiled
2619 * selector functions
2620 * @param {String|Function} selector A selector or a pre-compiled
2621 * selector function built with Sizzle.compile
2622 * @param {Element} context
2623 * @param {Array} [results]
2624 * @param {Array} [seed] A set of elements to match against
2625 */
2626select = Sizzle.select = function( selector, context, results, seed ) {
2627 var i, tokens, token, type, find,
2628 compiled = typeof selector === "function" && selector,
2629 match = !seed && tokenize( (selector = compiled.selector || selector) );
2630
2631 results = results || [];
2632
2633 // Try to minimize operations if there is only one selector in the list and no seed
2634 // (the latter of which guarantees us context)
2635 if ( match.length === 1 ) {
2636
2637 // Reduce context if the leading compound selector is an ID
2638 tokens = match[0] = match[0].slice( 0 );
2639 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
2640 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
2641
2642 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
2643 if ( !context ) {
2644 return results;
2645
2646 // Precompiled matchers will still verify ancestry, so step up a level
2647 } else if ( compiled ) {
2648 context = context.parentNode;
2649 }
2650
2651 selector = selector.slice( tokens.shift().value.length );
2652 }
2653
2654 // Fetch a seed set for right-to-left matching
2655 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
2656 while ( i-- ) {
2657 token = tokens[i];
2658
2659 // Abort if we hit a combinator
2660 if ( Expr.relative[ (type = token.type) ] ) {
2661 break;
2662 }
2663 if ( (find = Expr.find[ type ]) ) {
2664 // Search, expanding context for leading sibling combinators
2665 if ( (seed = find(
2666 token.matches[0].replace( runescape, funescape ),
2667 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
2668 )) ) {
2669
2670 // If seed is empty or no tokens remain, we can return early
2671 tokens.splice( i, 1 );
2672 selector = seed.length && toSelector( tokens );
2673 if ( !selector ) {
2674 push.apply( results, seed );
2675 return results;
2676 }
2677
2678 break;
2679 }
2680 }
2681 }
2682 }
2683
2684 // Compile and execute a filtering function if one is not provided
2685 // Provide `match` to avoid retokenization if we modified the selector above
2686 ( compiled || compile( selector, match ) )(
2687 seed,
2688 context,
2689 !documentIsHTML,
2690 results,
2691 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
2692 );
2693 return results;
2694};
2695
2696// One-time assignments
2697
2698// Sort stability
2699support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
2700
2701// Support: Chrome 14-35+
2702// Always assume duplicates if they aren't passed to the comparison function
2703support.detectDuplicates = !!hasDuplicate;
2704
2705// Initialize against the default document
2706setDocument();
2707
2708// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
2709// Detached nodes confoundingly follow *each other*
2710support.sortDetached = assert(function( el ) {
2711 // Should return 1, but returns 4 (following)
2712 return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
2713});
2714
2715// Support: IE<8
2716// Prevent attribute/property "interpolation"
2717// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2718if ( !assert(function( el ) {
2719 el.innerHTML = "<a href='#'></a>";
2720 return el.firstChild.getAttribute("href") === "#" ;
2721}) ) {
2722 addHandle( "type|href|height|width", function( elem, name, isXML ) {
2723 if ( !isXML ) {
2724 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
2725 }
2726 });
2727}
2728
2729// Support: IE<9
2730// Use defaultValue in place of getAttribute("value")
2731if ( !support.attributes || !assert(function( el ) {
2732 el.innerHTML = "<input/>";
2733 el.firstChild.setAttribute( "value", "" );
2734 return el.firstChild.getAttribute( "value" ) === "";
2735}) ) {
2736 addHandle( "value", function( elem, name, isXML ) {
2737 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
2738 return elem.defaultValue;
2739 }
2740 });
2741}
2742
2743// Support: IE<9
2744// Use getAttributeNode to fetch booleans when getAttribute lies
2745if ( !assert(function( el ) {
2746 return el.getAttribute("disabled") == null;
2747}) ) {
2748 addHandle( booleans, function( elem, name, isXML ) {
2749 var val;
2750 if ( !isXML ) {
2751 return elem[ name ] === true ? name.toLowerCase() :
2752 (val = elem.getAttributeNode( name )) && val.specified ?
2753 val.value :
2754 null;
2755 }
2756 });
2757}
2758
2759return Sizzle;
2760
2761})( window );
2762
2763
2764
2765jQuery.find = Sizzle;
2766jQuery.expr = Sizzle.selectors;
2767
2768// Deprecated
2769jQuery.expr[ ":" ] = jQuery.expr.pseudos;
2770jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
2771jQuery.text = Sizzle.getText;
2772jQuery.isXMLDoc = Sizzle.isXML;
2773jQuery.contains = Sizzle.contains;
2774jQuery.escapeSelector = Sizzle.escape;
2775
2776
2777
2778
2779var dir = function( elem, dir, until ) {
2780 var matched = [],
2781 truncate = until !== undefined;
2782
2783 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
2784 if ( elem.nodeType === 1 ) {
2785 if ( truncate && jQuery( elem ).is( until ) ) {
2786 break;
2787 }
2788 matched.push( elem );
2789 }
2790 }
2791 return matched;
2792};
2793
2794
2795var siblings = function( n, elem ) {
2796 var matched = [];
2797
2798 for ( ; n; n = n.nextSibling ) {
2799 if ( n.nodeType === 1 && n !== elem ) {
2800 matched.push( n );
2801 }
2802 }
2803
2804 return matched;
2805};
2806
2807
2808var rneedsContext = jQuery.expr.match.needsContext;
2809
2810
2811
2812function nodeName( elem, name ) {
2813
2814 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
2815
2816};
2817var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
2818
2819
2820
2821// Implement the identical functionality for filter and not
2822function winnow( elements, qualifier, not ) {
2823 if ( isFunction( qualifier ) ) {
2824 return jQuery.grep( elements, function( elem, i ) {
2825 return !!qualifier.call( elem, i, elem ) !== not;
2826 } );
2827 }
2828
2829 // Single element
2830 if ( qualifier.nodeType ) {
2831 return jQuery.grep( elements, function( elem ) {
2832 return ( elem === qualifier ) !== not;
2833 } );
2834 }
2835
2836 // Arraylike of elements (jQuery, arguments, Array)
2837 if ( typeof qualifier !== "string" ) {
2838 return jQuery.grep( elements, function( elem ) {
2839 return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
2840 } );
2841 }
2842
2843 // Filtered directly for both simple and complex selectors
2844 return jQuery.filter( qualifier, elements, not );
2845}
2846
2847jQuery.filter = function( expr, elems, not ) {
2848 var elem = elems[ 0 ];
2849
2850 if ( not ) {
2851 expr = ":not(" + expr + ")";
2852 }
2853
2854 if ( elems.length === 1 && elem.nodeType === 1 ) {
2855 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
2856 }
2857
2858 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
2859 return elem.nodeType === 1;
2860 } ) );
2861};
2862
2863jQuery.fn.extend( {
2864 find: function( selector ) {
2865 var i, ret,
2866 len = this.length,
2867 self = this;
2868
2869 if ( typeof selector !== "string" ) {
2870 return this.pushStack( jQuery( selector ).filter( function() {
2871 for ( i = 0; i < len; i++ ) {
2872 if ( jQuery.contains( self[ i ], this ) ) {
2873 return true;
2874 }
2875 }
2876 } ) );
2877 }
2878
2879 ret = this.pushStack( [] );
2880
2881 for ( i = 0; i < len; i++ ) {
2882 jQuery.find( selector, self[ i ], ret );
2883 }
2884
2885 return len > 1 ? jQuery.uniqueSort( ret ) : ret;
2886 },
2887 filter: function( selector ) {
2888 return this.pushStack( winnow( this, selector || [], false ) );
2889 },
2890 not: function( selector ) {
2891 return this.pushStack( winnow( this, selector || [], true ) );
2892 },
2893 is: function( selector ) {
2894 return !!winnow(
2895 this,
2896
2897 // If this is a positional/relative selector, check membership in the returned set
2898 // so $("p:first").is("p:last") won't return true for a doc with two "p".
2899 typeof selector === "string" && rneedsContext.test( selector ) ?
2900 jQuery( selector ) :
2901 selector || [],
2902 false
2903 ).length;
2904 }
2905} );
2906
2907
2908// Initialize a jQuery object
2909
2910
2911// A central reference to the root jQuery(document)
2912var rootjQuery,
2913
2914 // A simple way to check for HTML strings
2915 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
2916 // Strict HTML recognition (#11290: must start with <)
2917 // Shortcut simple #id case for speed
2918 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
2919
2920 init = jQuery.fn.init = function( selector, context, root ) {
2921 var match, elem;
2922
2923 // HANDLE: $(""), $(null), $(undefined), $(false)
2924 if ( !selector ) {
2925 return this;
2926 }
2927
2928 // Method init() accepts an alternate rootjQuery
2929 // so migrate can support jQuery.sub (gh-2101)
2930 root = root || rootjQuery;
2931
2932 // Handle HTML strings
2933 if ( typeof selector === "string" ) {
2934 if ( selector[ 0 ] === "<" &&
2935 selector[ selector.length - 1 ] === ">" &&
2936 selector.length >= 3 ) {
2937
2938 // Assume that strings that start and end with <> are HTML and skip the regex check
2939 match = [ null, selector, null ];
2940
2941 } else {
2942 match = rquickExpr.exec( selector );
2943 }
2944
2945 // Match html or make sure no context is specified for #id
2946 if ( match && ( match[ 1 ] || !context ) ) {
2947
2948 // HANDLE: $(html) -> $(array)
2949 if ( match[ 1 ] ) {
2950 context = context instanceof jQuery ? context[ 0 ] : context;
2951
2952 // Option to run scripts is true for back-compat
2953 // Intentionally let the error be thrown if parseHTML is not present
2954 jQuery.merge( this, jQuery.parseHTML(
2955 match[ 1 ],
2956 context && context.nodeType ? context.ownerDocument || context : document,
2957 true
2958 ) );
2959
2960 // HANDLE: $(html, props)
2961 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
2962 for ( match in context ) {
2963
2964 // Properties of context are called as methods if possible
2965 if ( isFunction( this[ match ] ) ) {
2966 this[ match ]( context[ match ] );
2967
2968 // ...and otherwise set as attributes
2969 } else {
2970 this.attr( match, context[ match ] );
2971 }
2972 }
2973 }
2974
2975 return this;
2976
2977 // HANDLE: $(#id)
2978 } else {
2979 elem = document.getElementById( match[ 2 ] );
2980
2981 if ( elem ) {
2982
2983 // Inject the element directly into the jQuery object
2984 this[ 0 ] = elem;
2985 this.length = 1;
2986 }
2987 return this;
2988 }
2989
2990 // HANDLE: $(expr, $(...))
2991 } else if ( !context || context.jquery ) {
2992 return ( context || root ).find( selector );
2993
2994 // HANDLE: $(expr, context)
2995 // (which is just equivalent to: $(context).find(expr)
2996 } else {
2997 return this.constructor( context ).find( selector );
2998 }
2999
3000 // HANDLE: $(DOMElement)
3001 } else if ( selector.nodeType ) {
3002 this[ 0 ] = selector;
3003 this.length = 1;
3004 return this;
3005
3006 // HANDLE: $(function)
3007 // Shortcut for document ready
3008 } else if ( isFunction( selector ) ) {
3009 return root.ready !== undefined ?
3010 root.ready( selector ) :
3011
3012 // Execute immediately if ready is not present
3013 selector( jQuery );
3014 }
3015
3016 return jQuery.makeArray( selector, this );
3017 };
3018
3019// Give the init function the jQuery prototype for later instantiation
3020init.prototype = jQuery.fn;
3021
3022// Initialize central reference
3023rootjQuery = jQuery( document );
3024
3025
3026var rparentsprev = /^(?:parents|prev(?:Until|All))/,
3027
3028 // Methods guaranteed to produce a unique set when starting from a unique set
3029 guaranteedUnique = {
3030 children: true,
3031 contents: true,
3032 next: true,
3033 prev: true
3034 };
3035
3036jQuery.fn.extend( {
3037 has: function( target ) {
3038 var targets = jQuery( target, this ),
3039 l = targets.length;
3040
3041 return this.filter( function() {
3042 var i = 0;
3043 for ( ; i < l; i++ ) {
3044 if ( jQuery.contains( this, targets[ i ] ) ) {
3045 return true;
3046 }
3047 }
3048 } );
3049 },
3050
3051 closest: function( selectors, context ) {
3052 var cur,
3053 i = 0,
3054 l = this.length,
3055 matched = [],
3056 targets = typeof selectors !== "string" && jQuery( selectors );
3057
3058 // Positional selectors never match, since there's no _selection_ context
3059 if ( !rneedsContext.test( selectors ) ) {
3060 for ( ; i < l; i++ ) {
3061 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
3062
3063 // Always skip document fragments
3064 if ( cur.nodeType < 11 && ( targets ?
3065 targets.index( cur ) > -1 :
3066
3067 // Don't pass non-elements to Sizzle
3068 cur.nodeType === 1 &&
3069 jQuery.find.matchesSelector( cur, selectors ) ) ) {
3070
3071 matched.push( cur );
3072 break;
3073 }
3074 }
3075 }
3076 }
3077
3078 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
3079 },
3080
3081 // Determine the position of an element within the set
3082 index: function( elem ) {
3083
3084 // No argument, return index in parent
3085 if ( !elem ) {
3086 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
3087 }
3088
3089 // Index in selector
3090 if ( typeof elem === "string" ) {
3091 return indexOf.call( jQuery( elem ), this[ 0 ] );
3092 }
3093
3094 // Locate the position of the desired element
3095 return indexOf.call( this,
3096
3097 // If it receives a jQuery object, the first element is used
3098 elem.jquery ? elem[ 0 ] : elem
3099 );
3100 },
3101
3102 add: function( selector, context ) {
3103 return this.pushStack(
3104 jQuery.uniqueSort(
3105 jQuery.merge( this.get(), jQuery( selector, context ) )
3106 )
3107 );
3108 },
3109
3110 addBack: function( selector ) {
3111 return this.add( selector == null ?
3112 this.prevObject : this.prevObject.filter( selector )
3113 );
3114 }
3115} );
3116
3117function sibling( cur, dir ) {
3118 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
3119 return cur;
3120}
3121
3122jQuery.each( {
3123 parent: function( elem ) {
3124 var parent = elem.parentNode;
3125 return parent && parent.nodeType !== 11 ? parent : null;
3126 },
3127 parents: function( elem ) {
3128 return dir( elem, "parentNode" );
3129 },
3130 parentsUntil: function( elem, i, until ) {
3131 return dir( elem, "parentNode", until );
3132 },
3133 next: function( elem ) {
3134 return sibling( elem, "nextSibling" );
3135 },
3136 prev: function( elem ) {
3137 return sibling( elem, "previousSibling" );
3138 },
3139 nextAll: function( elem ) {
3140 return dir( elem, "nextSibling" );
3141 },
3142 prevAll: function( elem ) {
3143 return dir( elem, "previousSibling" );
3144 },
3145 nextUntil: function( elem, i, until ) {
3146 return dir( elem, "nextSibling", until );
3147 },
3148 prevUntil: function( elem, i, until ) {
3149 return dir( elem, "previousSibling", until );
3150 },
3151 siblings: function( elem ) {
3152 return siblings( ( elem.parentNode || {} ).firstChild, elem );
3153 },
3154 children: function( elem ) {
3155 return siblings( elem.firstChild );
3156 },
3157 contents: function( elem ) {
3158 if ( typeof elem.contentDocument !== "undefined" ) {
3159 return elem.contentDocument;
3160 }
3161
3162 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
3163 // Treat the template element as a regular one in browsers that
3164 // don't support it.
3165 if ( nodeName( elem, "template" ) ) {
3166 elem = elem.content || elem;
3167 }
3168
3169 return jQuery.merge( [], elem.childNodes );
3170 }
3171}, function( name, fn ) {
3172 jQuery.fn[ name ] = function( until, selector ) {
3173 var matched = jQuery.map( this, fn, until );
3174
3175 if ( name.slice( -5 ) !== "Until" ) {
3176 selector = until;
3177 }
3178
3179 if ( selector && typeof selector === "string" ) {
3180 matched = jQuery.filter( selector, matched );
3181 }
3182
3183 if ( this.length > 1 ) {
3184
3185 // Remove duplicates
3186 if ( !guaranteedUnique[ name ] ) {
3187 jQuery.uniqueSort( matched );
3188 }
3189
3190 // Reverse order for parents* and prev-derivatives
3191 if ( rparentsprev.test( name ) ) {
3192 matched.reverse();
3193 }
3194 }
3195
3196 return this.pushStack( matched );
3197 };
3198} );
3199var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
3200
3201
3202
3203// Convert String-formatted options into Object-formatted ones
3204function createOptions( options ) {
3205 var object = {};
3206 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
3207 object[ flag ] = true;
3208 } );
3209 return object;
3210}
3211
3212/*
3213 * Create a callback list using the following parameters:
3214 *
3215 * options: an optional list of space-separated options that will change how
3216 * the callback list behaves or a more traditional option object
3217 *
3218 * By default a callback list will act like an event callback list and can be
3219 * "fired" multiple times.
3220 *
3221 * Possible options:
3222 *
3223 * once: will ensure the callback list can only be fired once (like a Deferred)
3224 *
3225 * memory: will keep track of previous values and will call any callback added
3226 * after the list has been fired right away with the latest "memorized"
3227 * values (like a Deferred)
3228 *
3229 * unique: will ensure a callback can only be added once (no duplicate in the list)
3230 *
3231 * stopOnFalse: interrupt callings when a callback returns false
3232 *
3233 */
3234jQuery.Callbacks = function( options ) {
3235
3236 // Convert options from String-formatted to Object-formatted if needed
3237 // (we check in cache first)
3238 options = typeof options === "string" ?
3239 createOptions( options ) :
3240 jQuery.extend( {}, options );
3241
3242 var // Flag to know if list is currently firing
3243 firing,
3244
3245 // Last fire value for non-forgettable lists
3246 memory,
3247
3248 // Flag to know if list was already fired
3249 fired,
3250
3251 // Flag to prevent firing
3252 locked,
3253
3254 // Actual callback list
3255 list = [],
3256
3257 // Queue of execution data for repeatable lists
3258 queue = [],
3259
3260 // Index of currently firing callback (modified by add/remove as needed)
3261 firingIndex = -1,
3262
3263 // Fire callbacks
3264 fire = function() {
3265
3266 // Enforce single-firing
3267 locked = locked || options.once;
3268
3269 // Execute callbacks for all pending executions,
3270 // respecting firingIndex overrides and runtime changes
3271 fired = firing = true;
3272 for ( ; queue.length; firingIndex = -1 ) {
3273 memory = queue.shift();
3274 while ( ++firingIndex < list.length ) {
3275
3276 // Run callback and check for early termination
3277 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
3278 options.stopOnFalse ) {
3279
3280 // Jump to end and forget the data so .add doesn't re-fire
3281 firingIndex = list.length;
3282 memory = false;
3283 }
3284 }
3285 }
3286
3287 // Forget the data if we're done with it
3288 if ( !options.memory ) {
3289 memory = false;
3290 }
3291
3292 firing = false;
3293
3294 // Clean up if we're done firing for good
3295 if ( locked ) {
3296
3297 // Keep an empty list if we have data for future add calls
3298 if ( memory ) {
3299 list = [];
3300
3301 // Otherwise, this object is spent
3302 } else {
3303 list = "";
3304 }
3305 }
3306 },
3307
3308 // Actual Callbacks object
3309 self = {
3310
3311 // Add a callback or a collection of callbacks to the list
3312 add: function() {
3313 if ( list ) {
3314
3315 // If we have memory from a past run, we should fire after adding
3316 if ( memory && !firing ) {
3317 firingIndex = list.length - 1;
3318 queue.push( memory );
3319 }
3320
3321 ( function add( args ) {
3322 jQuery.each( args, function( _, arg ) {
3323 if ( isFunction( arg ) ) {
3324 if ( !options.unique || !self.has( arg ) ) {
3325 list.push( arg );
3326 }
3327 } else if ( arg && arg.length && toType( arg ) !== "string" ) {
3328
3329 // Inspect recursively
3330 add( arg );
3331 }
3332 } );
3333 } )( arguments );
3334
3335 if ( memory && !firing ) {
3336 fire();
3337 }
3338 }
3339 return this;
3340 },
3341
3342 // Remove a callback from the list
3343 remove: function() {
3344 jQuery.each( arguments, function( _, arg ) {
3345 var index;
3346 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
3347 list.splice( index, 1 );
3348
3349 // Handle firing indexes
3350 if ( index <= firingIndex ) {
3351 firingIndex--;
3352 }
3353 }
3354 } );
3355 return this;
3356 },
3357
3358 // Check if a given callback is in the list.
3359 // If no argument is given, return whether or not list has callbacks attached.
3360 has: function( fn ) {
3361 return fn ?
3362 jQuery.inArray( fn, list ) > -1 :
3363 list.length > 0;
3364 },
3365
3366 // Remove all callbacks from the list
3367 empty: function() {
3368 if ( list ) {
3369 list = [];
3370 }
3371 return this;
3372 },
3373
3374 // Disable .fire and .add
3375 // Abort any current/pending executions
3376 // Clear all callbacks and values
3377 disable: function() {
3378 locked = queue = [];
3379 list = memory = "";
3380 return this;
3381 },
3382 disabled: function() {
3383 return !list;
3384 },
3385
3386 // Disable .fire
3387 // Also disable .add unless we have memory (since it would have no effect)
3388 // Abort any pending executions
3389 lock: function() {
3390 locked = queue = [];
3391 if ( !memory && !firing ) {
3392 list = memory = "";
3393 }
3394 return this;
3395 },
3396 locked: function() {
3397 return !!locked;
3398 },
3399
3400 // Call all callbacks with the given context and arguments
3401 fireWith: function( context, args ) {
3402 if ( !locked ) {
3403 args = args || [];
3404 args = [ context, args.slice ? args.slice() : args ];
3405 queue.push( args );
3406 if ( !firing ) {
3407 fire();
3408 }
3409 }
3410 return this;
3411 },
3412
3413 // Call all the callbacks with the given arguments
3414 fire: function() {
3415 self.fireWith( this, arguments );
3416 return this;
3417 },
3418
3419 // To know if the callbacks have already been called at least once
3420 fired: function() {
3421 return !!fired;
3422 }
3423 };
3424
3425 return self;
3426};
3427
3428
3429function Identity( v ) {
3430 return v;
3431}
3432function Thrower( ex ) {
3433 throw ex;
3434}
3435
3436function adoptValue( value, resolve, reject, noValue ) {
3437 var method;
3438
3439 try {
3440
3441 // Check for promise aspect first to privilege synchronous behavior
3442 if ( value && isFunction( ( method = value.promise ) ) ) {
3443 method.call( value ).done( resolve ).fail( reject );
3444
3445 // Other thenables
3446 } else if ( value && isFunction( ( method = value.then ) ) ) {
3447 method.call( value, resolve, reject );
3448
3449 // Other non-thenables
3450 } else {
3451
3452 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
3453 // * false: [ value ].slice( 0 ) => resolve( value )
3454 // * true: [ value ].slice( 1 ) => resolve()
3455 resolve.apply( undefined, [ value ].slice( noValue ) );
3456 }
3457
3458 // For Promises/A+, convert exceptions into rejections
3459 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
3460 // Deferred#then to conditionally suppress rejection.
3461 } catch ( value ) {
3462
3463 // Support: Android 4.0 only
3464 // Strict mode functions invoked without .call/.apply get global-object context
3465 reject.apply( undefined, [ value ] );
3466 }
3467}
3468
3469jQuery.extend( {
3470
3471 Deferred: function( func ) {
3472 var tuples = [
3473
3474 // action, add listener, callbacks,
3475 // ... .then handlers, argument index, [final state]
3476 [ "notify", "progress", jQuery.Callbacks( "memory" ),
3477 jQuery.Callbacks( "memory" ), 2 ],
3478 [ "resolve", "done", jQuery.Callbacks( "once memory" ),
3479 jQuery.Callbacks( "once memory" ), 0, "resolved" ],
3480 [ "reject", "fail", jQuery.Callbacks( "once memory" ),
3481 jQuery.Callbacks( "once memory" ), 1, "rejected" ]
3482 ],
3483 state = "pending",
3484 promise = {
3485 state: function() {
3486 return state;
3487 },
3488 always: function() {
3489 deferred.done( arguments ).fail( arguments );
3490 return this;
3491 },
3492 "catch": function( fn ) {
3493 return promise.then( null, fn );
3494 },
3495
3496 // Keep pipe for back-compat
3497 pipe: function( /* fnDone, fnFail, fnProgress */ ) {
3498 var fns = arguments;
3499
3500 return jQuery.Deferred( function( newDefer ) {
3501 jQuery.each( tuples, function( i, tuple ) {
3502
3503 // Map tuples (progress, done, fail) to arguments (done, fail, progress)
3504 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
3505
3506 // deferred.progress(function() { bind to newDefer or newDefer.notify })
3507 // deferred.done(function() { bind to newDefer or newDefer.resolve })
3508 // deferred.fail(function() { bind to newDefer or newDefer.reject })
3509 deferred[ tuple[ 1 ] ]( function() {
3510 var returned = fn && fn.apply( this, arguments );
3511 if ( returned && isFunction( returned.promise ) ) {
3512 returned.promise()
3513 .progress( newDefer.notify )
3514 .done( newDefer.resolve )
3515 .fail( newDefer.reject );
3516 } else {
3517 newDefer[ tuple[ 0 ] + "With" ](
3518 this,
3519 fn ? [ returned ] : arguments
3520 );
3521 }
3522 } );
3523 } );
3524 fns = null;
3525 } ).promise();
3526 },
3527 then: function( onFulfilled, onRejected, onProgress ) {
3528 var maxDepth = 0;
3529 function resolve( depth, deferred, handler, special ) {
3530 return function() {
3531 var that = this,
3532 args = arguments,
3533 mightThrow = function() {
3534 var returned, then;
3535
3536 // Support: Promises/A+ section 2.3.3.3.3
3537 // https://promisesaplus.com/#point-59
3538 // Ignore double-resolution attempts
3539 if ( depth < maxDepth ) {
3540 return;
3541 }
3542
3543 returned = handler.apply( that, args );
3544
3545 // Support: Promises/A+ section 2.3.1
3546 // https://promisesaplus.com/#point-48
3547 if ( returned === deferred.promise() ) {
3548 throw new TypeError( "Thenable self-resolution" );
3549 }
3550
3551 // Support: Promises/A+ sections 2.3.3.1, 3.5
3552 // https://promisesaplus.com/#point-54
3553 // https://promisesaplus.com/#point-75
3554 // Retrieve `then` only once
3555 then = returned &&
3556
3557 // Support: Promises/A+ section 2.3.4
3558 // https://promisesaplus.com/#point-64
3559 // Only check objects and functions for thenability
3560 ( typeof returned === "object" ||
3561 typeof returned === "function" ) &&
3562 returned.then;
3563
3564 // Handle a returned thenable
3565 if ( isFunction( then ) ) {
3566
3567 // Special processors (notify) just wait for resolution
3568 if ( special ) {
3569 then.call(
3570 returned,
3571 resolve( maxDepth, deferred, Identity, special ),
3572 resolve( maxDepth, deferred, Thrower, special )
3573 );
3574
3575 // Normal processors (resolve) also hook into progress
3576 } else {
3577
3578 // ...and disregard older resolution values
3579 maxDepth++;
3580
3581 then.call(
3582 returned,
3583 resolve( maxDepth, deferred, Identity, special ),
3584 resolve( maxDepth, deferred, Thrower, special ),
3585 resolve( maxDepth, deferred, Identity,
3586 deferred.notifyWith )
3587 );
3588 }
3589
3590 // Handle all other returned values
3591 } else {
3592
3593 // Only substitute handlers pass on context
3594 // and multiple values (non-spec behavior)
3595 if ( handler !== Identity ) {
3596 that = undefined;
3597 args = [ returned ];
3598 }
3599
3600 // Process the value(s)
3601 // Default process is resolve
3602 ( special || deferred.resolveWith )( that, args );
3603 }
3604 },
3605
3606 // Only normal processors (resolve) catch and reject exceptions
3607 process = special ?
3608 mightThrow :
3609 function() {
3610 try {
3611 mightThrow();
3612 } catch ( e ) {
3613
3614 if ( jQuery.Deferred.exceptionHook ) {
3615 jQuery.Deferred.exceptionHook( e,
3616 process.stackTrace );
3617 }
3618
3619 // Support: Promises/A+ section 2.3.3.3.4.1
3620 // https://promisesaplus.com/#point-61
3621 // Ignore post-resolution exceptions
3622 if ( depth + 1 >= maxDepth ) {
3623
3624 // Only substitute handlers pass on context
3625 // and multiple values (non-spec behavior)
3626 if ( handler !== Thrower ) {
3627 that = undefined;
3628 args = [ e ];
3629 }
3630
3631 deferred.rejectWith( that, args );
3632 }
3633 }
3634 };
3635
3636 // Support: Promises/A+ section 2.3.3.3.1
3637 // https://promisesaplus.com/#point-57
3638 // Re-resolve promises immediately to dodge false rejection from
3639 // subsequent errors
3640 if ( depth ) {
3641 process();
3642 } else {
3643
3644 // Call an optional hook to record the stack, in case of exception
3645 // since it's otherwise lost when execution goes async
3646 if ( jQuery.Deferred.getStackHook ) {
3647 process.stackTrace = jQuery.Deferred.getStackHook();
3648 }
3649 window.setTimeout( process );
3650 }
3651 };
3652 }
3653
3654 return jQuery.Deferred( function( newDefer ) {
3655
3656 // progress_handlers.add( ... )
3657 tuples[ 0 ][ 3 ].add(
3658 resolve(
3659 0,
3660 newDefer,
3661 isFunction( onProgress ) ?
3662 onProgress :
3663 Identity,
3664 newDefer.notifyWith
3665 )
3666 );
3667
3668 // fulfilled_handlers.add( ... )
3669 tuples[ 1 ][ 3 ].add(
3670 resolve(
3671 0,
3672 newDefer,
3673 isFunction( onFulfilled ) ?
3674 onFulfilled :
3675 Identity
3676 )
3677 );
3678
3679 // rejected_handlers.add( ... )
3680 tuples[ 2 ][ 3 ].add(
3681 resolve(
3682 0,
3683 newDefer,
3684 isFunction( onRejected ) ?
3685 onRejected :
3686 Thrower
3687 )
3688 );
3689 } ).promise();
3690 },
3691
3692 // Get a promise for this deferred
3693 // If obj is provided, the promise aspect is added to the object
3694 promise: function( obj ) {
3695 return obj != null ? jQuery.extend( obj, promise ) : promise;
3696 }
3697 },
3698 deferred = {};
3699
3700 // Add list-specific methods
3701 jQuery.each( tuples, function( i, tuple ) {
3702 var list = tuple[ 2 ],
3703 stateString = tuple[ 5 ];
3704
3705 // promise.progress = list.add
3706 // promise.done = list.add
3707 // promise.fail = list.add
3708 promise[ tuple[ 1 ] ] = list.add;
3709
3710 // Handle state
3711 if ( stateString ) {
3712 list.add(
3713 function() {
3714
3715 // state = "resolved" (i.e., fulfilled)
3716 // state = "rejected"
3717 state = stateString;
3718 },
3719
3720 // rejected_callbacks.disable
3721 // fulfilled_callbacks.disable
3722 tuples[ 3 - i ][ 2 ].disable,
3723
3724 // rejected_handlers.disable
3725 // fulfilled_handlers.disable
3726 tuples[ 3 - i ][ 3 ].disable,
3727
3728 // progress_callbacks.lock
3729 tuples[ 0 ][ 2 ].lock,
3730
3731 // progress_handlers.lock
3732 tuples[ 0 ][ 3 ].lock
3733 );
3734 }
3735
3736 // progress_handlers.fire
3737 // fulfilled_handlers.fire
3738 // rejected_handlers.fire
3739 list.add( tuple[ 3 ].fire );
3740
3741 // deferred.notify = function() { deferred.notifyWith(...) }
3742 // deferred.resolve = function() { deferred.resolveWith(...) }
3743 // deferred.reject = function() { deferred.rejectWith(...) }
3744 deferred[ tuple[ 0 ] ] = function() {
3745 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
3746 return this;
3747 };
3748
3749 // deferred.notifyWith = list.fireWith
3750 // deferred.resolveWith = list.fireWith
3751 // deferred.rejectWith = list.fireWith
3752 deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
3753 } );
3754
3755 // Make the deferred a promise
3756 promise.promise( deferred );
3757
3758 // Call given func if any
3759 if ( func ) {
3760 func.call( deferred, deferred );
3761 }
3762
3763 // All done!
3764 return deferred;
3765 },
3766
3767 // Deferred helper
3768 when: function( singleValue ) {
3769 var
3770
3771 // count of uncompleted subordinates
3772 remaining = arguments.length,
3773
3774 // count of unprocessed arguments
3775 i = remaining,
3776
3777 // subordinate fulfillment data
3778 resolveContexts = Array( i ),
3779 resolveValues = slice.call( arguments ),
3780
3781 // the master Deferred
3782 master = jQuery.Deferred(),
3783
3784 // subordinate callback factory
3785 updateFunc = function( i ) {
3786 return function( value ) {
3787 resolveContexts[ i ] = this;
3788 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
3789 if ( !( --remaining ) ) {
3790 master.resolveWith( resolveContexts, resolveValues );
3791 }
3792 };
3793 };
3794
3795 // Single- and empty arguments are adopted like Promise.resolve
3796 if ( remaining <= 1 ) {
3797 adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
3798 !remaining );
3799
3800 // Use .then() to unwrap secondary thenables (cf. gh-3000)
3801 if ( master.state() === "pending" ||
3802 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
3803
3804 return master.then();
3805 }
3806 }
3807
3808 // Multiple arguments are aggregated like Promise.all array elements
3809 while ( i-- ) {
3810 adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
3811 }
3812
3813 return master.promise();
3814 }
3815} );
3816
3817
3818// These usually indicate a programmer mistake during development,
3819// warn about them ASAP rather than swallowing them by default.
3820var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
3821
3822jQuery.Deferred.exceptionHook = function( error, stack ) {
3823
3824 // Support: IE 8 - 9 only
3825 // Console exists when dev tools are open, which can happen at any time
3826 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
3827 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
3828 }
3829};
3830
3831
3832
3833
3834jQuery.readyException = function( error ) {
3835 window.setTimeout( function() {
3836 throw error;
3837 } );
3838};
3839
3840
3841
3842
3843// The deferred used on DOM ready
3844var readyList = jQuery.Deferred();
3845
3846jQuery.fn.ready = function( fn ) {
3847
3848 readyList
3849 .then( fn )
3850
3851 // Wrap jQuery.readyException in a function so that the lookup
3852 // happens at the time of error handling instead of callback
3853 // registration.
3854 .catch( function( error ) {
3855 jQuery.readyException( error );
3856 } );
3857
3858 return this;
3859};
3860
3861jQuery.extend( {
3862
3863 // Is the DOM ready to be used? Set to true once it occurs.
3864 isReady: false,
3865
3866 // A counter to track how many items to wait for before
3867 // the ready event fires. See #6781
3868 readyWait: 1,
3869
3870 // Handle when the DOM is ready
3871 ready: function( wait ) {
3872
3873 // Abort if there are pending holds or we're already ready
3874 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
3875 return;
3876 }
3877
3878 // Remember that the DOM is ready
3879 jQuery.isReady = true;
3880
3881 // If a normal DOM Ready event fired, decrement, and wait if need be
3882 if ( wait !== true && --jQuery.readyWait > 0 ) {
3883 return;
3884 }
3885
3886 // If there are functions bound, to execute
3887 readyList.resolveWith( document, [ jQuery ] );
3888 }
3889} );
3890
3891jQuery.ready.then = readyList.then;
3892
3893// The ready event handler and self cleanup method
3894function completed() {
3895 document.removeEventListener( "DOMContentLoaded", completed );
3896 window.removeEventListener( "load", completed );
3897 jQuery.ready();
3898}
3899
3900// Catch cases where $(document).ready() is called
3901// after the browser event has already occurred.
3902// Support: IE <=9 - 10 only
3903// Older IE sometimes signals "interactive" too soon
3904if ( document.readyState === "complete" ||
3905 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
3906
3907 // Handle it asynchronously to allow scripts the opportunity to delay ready
3908 window.setTimeout( jQuery.ready );
3909
3910} else {
3911
3912 // Use the handy event callback
3913 document.addEventListener( "DOMContentLoaded", completed );
3914
3915 // A fallback to window.onload, that will always work
3916 window.addEventListener( "load", completed );
3917}
3918
3919
3920
3921
3922// Multifunctional method to get and set values of a collection
3923// The value/s can optionally be executed if it's a function
3924var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
3925 var i = 0,
3926 len = elems.length,
3927 bulk = key == null;
3928
3929 // Sets many values
3930 if ( toType( key ) === "object" ) {
3931 chainable = true;
3932 for ( i in key ) {
3933 access( elems, fn, i, key[ i ], true, emptyGet, raw );
3934 }
3935
3936 // Sets one value
3937 } else if ( value !== undefined ) {
3938 chainable = true;
3939
3940 if ( !isFunction( value ) ) {
3941 raw = true;
3942 }
3943
3944 if ( bulk ) {
3945
3946 // Bulk operations run against the entire set
3947 if ( raw ) {
3948 fn.call( elems, value );
3949 fn = null;
3950
3951 // ...except when executing function values
3952 } else {
3953 bulk = fn;
3954 fn = function( elem, key, value ) {
3955 return bulk.call( jQuery( elem ), value );
3956 };
3957 }
3958 }
3959
3960 if ( fn ) {
3961 for ( ; i < len; i++ ) {
3962 fn(
3963 elems[ i ], key, raw ?
3964 value :
3965 value.call( elems[ i ], i, fn( elems[ i ], key ) )
3966 );
3967 }
3968 }
3969 }
3970
3971 if ( chainable ) {
3972 return elems;
3973 }
3974
3975 // Gets
3976 if ( bulk ) {
3977 return fn.call( elems );
3978 }
3979
3980 return len ? fn( elems[ 0 ], key ) : emptyGet;
3981};
3982
3983
3984// Matches dashed string for camelizing
3985var rmsPrefix = /^-ms-/,
3986 rdashAlpha = /-([a-z])/g;
3987
3988// Used by camelCase as callback to replace()
3989function fcamelCase( all, letter ) {
3990 return letter.toUpperCase();
3991}
3992
3993// Convert dashed to camelCase; used by the css and data modules
3994// Support: IE <=9 - 11, Edge 12 - 15
3995// Microsoft forgot to hump their vendor prefix (#9572)
3996function camelCase( string ) {
3997 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
3998}
3999var acceptData = function( owner ) {
4000
4001 // Accepts only:
4002 // - Node
4003 // - Node.ELEMENT_NODE
4004 // - Node.DOCUMENT_NODE
4005 // - Object
4006 // - Any
4007 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
4008};
4009
4010
4011
4012
4013function Data() {
4014 this.expando = jQuery.expando + Data.uid++;
4015}
4016
4017Data.uid = 1;
4018
4019Data.prototype = {
4020
4021 cache: function( owner ) {
4022
4023 // Check if the owner object already has a cache
4024 var value = owner[ this.expando ];
4025
4026 // If not, create one
4027 if ( !value ) {
4028 value = {};
4029
4030 // We can accept data for non-element nodes in modern browsers,
4031 // but we should not, see #8335.
4032 // Always return an empty object.
4033 if ( acceptData( owner ) ) {
4034
4035 // If it is a node unlikely to be stringify-ed or looped over
4036 // use plain assignment
4037 if ( owner.nodeType ) {
4038 owner[ this.expando ] = value;
4039
4040 // Otherwise secure it in a non-enumerable property
4041 // configurable must be true to allow the property to be
4042 // deleted when data is removed
4043 } else {
4044 Object.defineProperty( owner, this.expando, {
4045 value: value,
4046 configurable: true
4047 } );
4048 }
4049 }
4050 }
4051
4052 return value;
4053 },
4054 set: function( owner, data, value ) {
4055 var prop,
4056 cache = this.cache( owner );
4057
4058 // Handle: [ owner, key, value ] args
4059 // Always use camelCase key (gh-2257)
4060 if ( typeof data === "string" ) {
4061 cache[ camelCase( data ) ] = value;
4062
4063 // Handle: [ owner, { properties } ] args
4064 } else {
4065
4066 // Copy the properties one-by-one to the cache object
4067 for ( prop in data ) {
4068 cache[ camelCase( prop ) ] = data[ prop ];
4069 }
4070 }
4071 return cache;
4072 },
4073 get: function( owner, key ) {
4074 return key === undefined ?
4075 this.cache( owner ) :
4076
4077 // Always use camelCase key (gh-2257)
4078 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
4079 },
4080 access: function( owner, key, value ) {
4081
4082 // In cases where either:
4083 //
4084 // 1. No key was specified
4085 // 2. A string key was specified, but no value provided
4086 //
4087 // Take the "read" path and allow the get method to determine
4088 // which value to return, respectively either:
4089 //
4090 // 1. The entire cache object
4091 // 2. The data stored at the key
4092 //
4093 if ( key === undefined ||
4094 ( ( key && typeof key === "string" ) && value === undefined ) ) {
4095
4096 return this.get( owner, key );
4097 }
4098
4099 // When the key is not a string, or both a key and value
4100 // are specified, set or extend (existing objects) with either:
4101 //
4102 // 1. An object of properties
4103 // 2. A key and value
4104 //
4105 this.set( owner, key, value );
4106
4107 // Since the "set" path can have two possible entry points
4108 // return the expected data based on which path was taken[*]
4109 return value !== undefined ? value : key;
4110 },
4111 remove: function( owner, key ) {
4112 var i,
4113 cache = owner[ this.expando ];
4114
4115 if ( cache === undefined ) {
4116 return;
4117 }
4118
4119 if ( key !== undefined ) {
4120
4121 // Support array or space separated string of keys
4122 if ( Array.isArray( key ) ) {
4123
4124 // If key is an array of keys...
4125 // We always set camelCase keys, so remove that.
4126 key = key.map( camelCase );
4127 } else {
4128 key = camelCase( key );
4129
4130 // If a key with the spaces exists, use it.
4131 // Otherwise, create an array by matching non-whitespace
4132 key = key in cache ?
4133 [ key ] :
4134 ( key.match( rnothtmlwhite ) || [] );
4135 }
4136
4137 i = key.length;
4138
4139 while ( i-- ) {
4140 delete cache[ key[ i ] ];
4141 }
4142 }
4143
4144 // Remove the expando if there's no more data
4145 if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
4146
4147 // Support: Chrome <=35 - 45
4148 // Webkit & Blink performance suffers when deleting properties
4149 // from DOM nodes, so set to undefined instead
4150 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
4151 if ( owner.nodeType ) {
4152 owner[ this.expando ] = undefined;
4153 } else {
4154 delete owner[ this.expando ];
4155 }
4156 }
4157 },
4158 hasData: function( owner ) {
4159 var cache = owner[ this.expando ];
4160 return cache !== undefined && !jQuery.isEmptyObject( cache );
4161 }
4162};
4163var dataPriv = new Data();
4164
4165var dataUser = new Data();
4166
4167
4168
4169// Implementation Summary
4170//
4171// 1. Enforce API surface and semantic compatibility with 1.9.x branch
4172// 2. Improve the module's maintainability by reducing the storage
4173// paths to a single mechanism.
4174// 3. Use the same single mechanism to support "private" and "user" data.
4175// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
4176// 5. Avoid exposing implementation details on user objects (eg. expando properties)
4177// 6. Provide a clear path for implementation upgrade to WeakMap in 2014
4178
4179var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
4180 rmultiDash = /[A-Z]/g;
4181
4182function getData( data ) {
4183 if ( data === "true" ) {
4184 return true;
4185 }
4186
4187 if ( data === "false" ) {
4188 return false;
4189 }
4190
4191 if ( data === "null" ) {
4192 return null;
4193 }
4194
4195 // Only convert to a number if it doesn't change the string
4196 if ( data === +data + "" ) {
4197 return +data;
4198 }
4199
4200 if ( rbrace.test( data ) ) {
4201 return JSON.parse( data );
4202 }
4203
4204 return data;
4205}
4206
4207function dataAttr( elem, key, data ) {
4208 var name;
4209
4210 // If nothing was found internally, try to fetch any
4211 // data from the HTML5 data-* attribute
4212 if ( data === undefined && elem.nodeType === 1 ) {
4213 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
4214 data = elem.getAttribute( name );
4215
4216 if ( typeof data === "string" ) {
4217 try {
4218 data = getData( data );
4219 } catch ( e ) {}
4220
4221 // Make sure we set the data so it isn't changed later
4222 dataUser.set( elem, key, data );
4223 } else {
4224 data = undefined;
4225 }
4226 }
4227 return data;
4228}
4229
4230jQuery.extend( {
4231 hasData: function( elem ) {
4232 return dataUser.hasData( elem ) || dataPriv.hasData( elem );
4233 },
4234
4235 data: function( elem, name, data ) {
4236 return dataUser.access( elem, name, data );
4237 },
4238
4239 removeData: function( elem, name ) {
4240 dataUser.remove( elem, name );
4241 },
4242
4243 // TODO: Now that all calls to _data and _removeData have been replaced
4244 // with direct calls to dataPriv methods, these can be deprecated.
4245 _data: function( elem, name, data ) {
4246 return dataPriv.access( elem, name, data );
4247 },
4248
4249 _removeData: function( elem, name ) {
4250 dataPriv.remove( elem, name );
4251 }
4252} );
4253
4254jQuery.fn.extend( {
4255 data: function( key, value ) {
4256 var i, name, data,
4257 elem = this[ 0 ],
4258 attrs = elem && elem.attributes;
4259
4260 // Gets all values
4261 if ( key === undefined ) {
4262 if ( this.length ) {
4263 data = dataUser.get( elem );
4264
4265 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
4266 i = attrs.length;
4267 while ( i-- ) {
4268
4269 // Support: IE 11 only
4270 // The attrs elements can be null (#14894)
4271 if ( attrs[ i ] ) {
4272 name = attrs[ i ].name;
4273 if ( name.indexOf( "data-" ) === 0 ) {
4274 name = camelCase( name.slice( 5 ) );
4275 dataAttr( elem, name, data[ name ] );
4276 }
4277 }
4278 }
4279 dataPriv.set( elem, "hasDataAttrs", true );
4280 }
4281 }
4282
4283 return data;
4284 }
4285
4286 // Sets multiple values
4287 if ( typeof key === "object" ) {
4288 return this.each( function() {
4289 dataUser.set( this, key );
4290 } );
4291 }
4292
4293 return access( this, function( value ) {
4294 var data;
4295
4296 // The calling jQuery object (element matches) is not empty
4297 // (and therefore has an element appears at this[ 0 ]) and the
4298 // `value` parameter was not undefined. An empty jQuery object
4299 // will result in `undefined` for elem = this[ 0 ] which will
4300 // throw an exception if an attempt to read a data cache is made.
4301 if ( elem && value === undefined ) {
4302
4303 // Attempt to get data from the cache
4304 // The key will always be camelCased in Data
4305 data = dataUser.get( elem, key );
4306 if ( data !== undefined ) {
4307 return data;
4308 }
4309
4310 // Attempt to "discover" the data in
4311 // HTML5 custom data-* attrs
4312 data = dataAttr( elem, key );
4313 if ( data !== undefined ) {
4314 return data;
4315 }
4316
4317 // We tried really hard, but the data doesn't exist.
4318 return;
4319 }
4320
4321 // Set the data...
4322 this.each( function() {
4323
4324 // We always store the camelCased key
4325 dataUser.set( this, key, value );
4326 } );
4327 }, null, value, arguments.length > 1, null, true );
4328 },
4329
4330 removeData: function( key ) {
4331 return this.each( function() {
4332 dataUser.remove( this, key );
4333 } );
4334 }
4335} );
4336
4337
4338jQuery.extend( {
4339 queue: function( elem, type, data ) {
4340 var queue;
4341
4342 if ( elem ) {
4343 type = ( type || "fx" ) + "queue";
4344 queue = dataPriv.get( elem, type );
4345
4346 // Speed up dequeue by getting out quickly if this is just a lookup
4347 if ( data ) {
4348 if ( !queue || Array.isArray( data ) ) {
4349 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
4350 } else {
4351 queue.push( data );
4352 }
4353 }
4354 return queue || [];
4355 }
4356 },
4357
4358 dequeue: function( elem, type ) {
4359 type = type || "fx";
4360
4361 var queue = jQuery.queue( elem, type ),
4362 startLength = queue.length,
4363 fn = queue.shift(),
4364 hooks = jQuery._queueHooks( elem, type ),
4365 next = function() {
4366 jQuery.dequeue( elem, type );
4367 };
4368
4369 // If the fx queue is dequeued, always remove the progress sentinel
4370 if ( fn === "inprogress" ) {
4371 fn = queue.shift();
4372 startLength--;
4373 }
4374
4375 if ( fn ) {
4376
4377 // Add a progress sentinel to prevent the fx queue from being
4378 // automatically dequeued
4379 if ( type === "fx" ) {
4380 queue.unshift( "inprogress" );
4381 }
4382
4383 // Clear up the last queue stop function
4384 delete hooks.stop;
4385 fn.call( elem, next, hooks );
4386 }
4387
4388 if ( !startLength && hooks ) {
4389 hooks.empty.fire();
4390 }
4391 },
4392
4393 // Not public - generate a queueHooks object, or return the current one
4394 _queueHooks: function( elem, type ) {
4395 var key = type + "queueHooks";
4396 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
4397 empty: jQuery.Callbacks( "once memory" ).add( function() {
4398 dataPriv.remove( elem, [ type + "queue", key ] );
4399 } )
4400 } );
4401 }
4402} );
4403
4404jQuery.fn.extend( {
4405 queue: function( type, data ) {
4406 var setter = 2;
4407
4408 if ( typeof type !== "string" ) {
4409 data = type;
4410 type = "fx";
4411 setter--;
4412 }
4413
4414 if ( arguments.length < setter ) {
4415 return jQuery.queue( this[ 0 ], type );
4416 }
4417
4418 return data === undefined ?
4419 this :
4420 this.each( function() {
4421 var queue = jQuery.queue( this, type, data );
4422
4423 // Ensure a hooks for this queue
4424 jQuery._queueHooks( this, type );
4425
4426 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
4427 jQuery.dequeue( this, type );
4428 }
4429 } );
4430 },
4431 dequeue: function( type ) {
4432 return this.each( function() {
4433 jQuery.dequeue( this, type );
4434 } );
4435 },
4436 clearQueue: function( type ) {
4437 return this.queue( type || "fx", [] );
4438 },
4439
4440 // Get a promise resolved when queues of a certain type
4441 // are emptied (fx is the type by default)
4442 promise: function( type, obj ) {
4443 var tmp,
4444 count = 1,
4445 defer = jQuery.Deferred(),
4446 elements = this,
4447 i = this.length,
4448 resolve = function() {
4449 if ( !( --count ) ) {
4450 defer.resolveWith( elements, [ elements ] );
4451 }
4452 };
4453
4454 if ( typeof type !== "string" ) {
4455 obj = type;
4456 type = undefined;
4457 }
4458 type = type || "fx";
4459
4460 while ( i-- ) {
4461 tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
4462 if ( tmp && tmp.empty ) {
4463 count++;
4464 tmp.empty.add( resolve );
4465 }
4466 }
4467 resolve();
4468 return defer.promise( obj );
4469 }
4470} );
4471var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
4472
4473var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
4474
4475
4476var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
4477
4478var documentElement = document.documentElement;
4479
4480
4481
4482 var isAttached = function( elem ) {
4483 return jQuery.contains( elem.ownerDocument, elem );
4484 },
4485 composed = { composed: true };
4486
4487 // Check attachment across shadow DOM boundaries when possible (gh-3504)
4488 if ( documentElement.attachShadow ) {
4489 isAttached = function( elem ) {
4490 return jQuery.contains( elem.ownerDocument, elem ) ||
4491 elem.getRootNode( composed ) === elem.ownerDocument;
4492 };
4493 }
4494var isHiddenWithinTree = function( elem, el ) {
4495
4496 // isHiddenWithinTree might be called from jQuery#filter function;
4497 // in that case, element will be second argument
4498 elem = el || elem;
4499
4500 // Inline style trumps all
4501 return elem.style.display === "none" ||
4502 elem.style.display === "" &&
4503
4504 // Otherwise, check computed style
4505 // Support: Firefox <=43 - 45
4506 // Disconnected elements can have computed display: none, so first confirm that elem is
4507 // in the document.
4508 isAttached( elem ) &&
4509
4510 jQuery.css( elem, "display" ) === "none";
4511 };
4512
4513var swap = function( elem, options, callback, args ) {
4514 var ret, name,
4515 old = {};
4516
4517 // Remember the old values, and insert the new ones
4518 for ( name in options ) {
4519 old[ name ] = elem.style[ name ];
4520 elem.style[ name ] = options[ name ];
4521 }
4522
4523 ret = callback.apply( elem, args || [] );
4524
4525 // Revert the old values
4526 for ( name in options ) {
4527 elem.style[ name ] = old[ name ];
4528 }
4529
4530 return ret;
4531};
4532
4533
4534
4535
4536function adjustCSS( elem, prop, valueParts, tween ) {
4537 var adjusted, scale,
4538 maxIterations = 20,
4539 currentValue = tween ?
4540 function() {
4541 return tween.cur();
4542 } :
4543 function() {
4544 return jQuery.css( elem, prop, "" );
4545 },
4546 initial = currentValue(),
4547 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
4548
4549 // Starting value computation is required for potential unit mismatches
4550 initialInUnit = elem.nodeType &&
4551 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
4552 rcssNum.exec( jQuery.css( elem, prop ) );
4553
4554 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
4555
4556 // Support: Firefox <=54
4557 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
4558 initial = initial / 2;
4559
4560 // Trust units reported by jQuery.css
4561 unit = unit || initialInUnit[ 3 ];
4562
4563 // Iteratively approximate from a nonzero starting point
4564 initialInUnit = +initial || 1;
4565
4566 while ( maxIterations-- ) {
4567
4568 // Evaluate and update our best guess (doubling guesses that zero out).
4569 // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
4570 jQuery.style( elem, prop, initialInUnit + unit );
4571 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
4572 maxIterations = 0;
4573 }
4574 initialInUnit = initialInUnit / scale;
4575
4576 }
4577
4578 initialInUnit = initialInUnit * 2;
4579 jQuery.style( elem, prop, initialInUnit + unit );
4580
4581 // Make sure we update the tween properties later on
4582 valueParts = valueParts || [];
4583 }
4584
4585 if ( valueParts ) {
4586 initialInUnit = +initialInUnit || +initial || 0;
4587
4588 // Apply relative offset (+=/-=) if specified
4589 adjusted = valueParts[ 1 ] ?
4590 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
4591 +valueParts[ 2 ];
4592 if ( tween ) {
4593 tween.unit = unit;
4594 tween.start = initialInUnit;
4595 tween.end = adjusted;
4596 }
4597 }
4598 return adjusted;
4599}
4600
4601
4602var defaultDisplayMap = {};
4603
4604function getDefaultDisplay( elem ) {
4605 var temp,
4606 doc = elem.ownerDocument,
4607 nodeName = elem.nodeName,
4608 display = defaultDisplayMap[ nodeName ];
4609
4610 if ( display ) {
4611 return display;
4612 }
4613
4614 temp = doc.body.appendChild( doc.createElement( nodeName ) );
4615 display = jQuery.css( temp, "display" );
4616
4617 temp.parentNode.removeChild( temp );
4618
4619 if ( display === "none" ) {
4620 display = "block";
4621 }
4622 defaultDisplayMap[ nodeName ] = display;
4623
4624 return display;
4625}
4626
4627function showHide( elements, show ) {
4628 var display, elem,
4629 values = [],
4630 index = 0,
4631 length = elements.length;
4632
4633 // Determine new display value for elements that need to change
4634 for ( ; index < length; index++ ) {
4635 elem = elements[ index ];
4636 if ( !elem.style ) {
4637 continue;
4638 }
4639
4640 display = elem.style.display;
4641 if ( show ) {
4642
4643 // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
4644 // check is required in this first loop unless we have a nonempty display value (either
4645 // inline or about-to-be-restored)
4646 if ( display === "none" ) {
4647 values[ index ] = dataPriv.get( elem, "display" ) || null;
4648 if ( !values[ index ] ) {
4649 elem.style.display = "";
4650 }
4651 }
4652 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
4653 values[ index ] = getDefaultDisplay( elem );
4654 }
4655 } else {
4656 if ( display !== "none" ) {
4657 values[ index ] = "none";
4658
4659 // Remember what we're overwriting
4660 dataPriv.set( elem, "display", display );
4661 }
4662 }
4663 }
4664
4665 // Set the display of the elements in a second loop to avoid constant reflow
4666 for ( index = 0; index < length; index++ ) {
4667 if ( values[ index ] != null ) {
4668 elements[ index ].style.display = values[ index ];
4669 }
4670 }
4671
4672 return elements;
4673}
4674
4675jQuery.fn.extend( {
4676 show: function() {
4677 return showHide( this, true );
4678 },
4679 hide: function() {
4680 return showHide( this );
4681 },
4682 toggle: function( state ) {
4683 if ( typeof state === "boolean" ) {
4684 return state ? this.show() : this.hide();
4685 }
4686
4687 return this.each( function() {
4688 if ( isHiddenWithinTree( this ) ) {
4689 jQuery( this ).show();
4690 } else {
4691 jQuery( this ).hide();
4692 }
4693 } );
4694 }
4695} );
4696var rcheckableType = ( /^(?:checkbox|radio)$/i );
4697
4698var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
4699
4700var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
4701
4702
4703
4704// We have to close these tags to support XHTML (#13200)
4705var wrapMap = {
4706
4707 // Support: IE <=9 only
4708 option: [ 1, "<select multiple='multiple'>", "</select>" ],
4709
4710 // XHTML parsers do not magically insert elements in the
4711 // same way that tag soup parsers do. So we cannot shorten
4712 // this by omitting <tbody> or other required elements.
4713 thead: [ 1, "<table>", "</table>" ],
4714 col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
4715 tr: [ 2, "<table><tbody>", "</tbody></table>" ],
4716 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
4717
4718 _default: [ 0, "", "" ]
4719};
4720
4721// Support: IE <=9 only
4722wrapMap.optgroup = wrapMap.option;
4723
4724wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
4725wrapMap.th = wrapMap.td;
4726
4727
4728function getAll( context, tag ) {
4729
4730 // Support: IE <=9 - 11 only
4731 // Use typeof to avoid zero-argument method invocation on host objects (#15151)
4732 var ret;
4733
4734 if ( typeof context.getElementsByTagName !== "undefined" ) {
4735 ret = context.getElementsByTagName( tag || "*" );
4736
4737 } else if ( typeof context.querySelectorAll !== "undefined" ) {
4738 ret = context.querySelectorAll( tag || "*" );
4739
4740 } else {
4741 ret = [];
4742 }
4743
4744 if ( tag === undefined || tag && nodeName( context, tag ) ) {
4745 return jQuery.merge( [ context ], ret );
4746 }
4747
4748 return ret;
4749}
4750
4751
4752// Mark scripts as having already been evaluated
4753function setGlobalEval( elems, refElements ) {
4754 var i = 0,
4755 l = elems.length;
4756
4757 for ( ; i < l; i++ ) {
4758 dataPriv.set(
4759 elems[ i ],
4760 "globalEval",
4761 !refElements || dataPriv.get( refElements[ i ], "globalEval" )
4762 );
4763 }
4764}
4765
4766
4767var rhtml = /<|&#?\w+;/;
4768
4769function buildFragment( elems, context, scripts, selection, ignored ) {
4770 var elem, tmp, tag, wrap, attached, j,
4771 fragment = context.createDocumentFragment(),
4772 nodes = [],
4773 i = 0,
4774 l = elems.length;
4775
4776 for ( ; i < l; i++ ) {
4777 elem = elems[ i ];
4778
4779 if ( elem || elem === 0 ) {
4780
4781 // Add nodes directly
4782 if ( toType( elem ) === "object" ) {
4783
4784 // Support: Android <=4.0 only, PhantomJS 1 only
4785 // push.apply(_, arraylike) throws on ancient WebKit
4786 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
4787
4788 // Convert non-html into a text node
4789 } else if ( !rhtml.test( elem ) ) {
4790 nodes.push( context.createTextNode( elem ) );
4791
4792 // Convert html into DOM nodes
4793 } else {
4794 tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
4795
4796 // Deserialize a standard representation
4797 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
4798 wrap = wrapMap[ tag ] || wrapMap._default;
4799 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
4800
4801 // Descend through wrappers to the right content
4802 j = wrap[ 0 ];
4803 while ( j-- ) {
4804 tmp = tmp.lastChild;
4805 }
4806
4807 // Support: Android <=4.0 only, PhantomJS 1 only
4808 // push.apply(_, arraylike) throws on ancient WebKit
4809 jQuery.merge( nodes, tmp.childNodes );
4810
4811 // Remember the top-level container
4812 tmp = fragment.firstChild;
4813
4814 // Ensure the created nodes are orphaned (#12392)
4815 tmp.textContent = "";
4816 }
4817 }
4818 }
4819
4820 // Remove wrapper from fragment
4821 fragment.textContent = "";
4822
4823 i = 0;
4824 while ( ( elem = nodes[ i++ ] ) ) {
4825
4826 // Skip elements already in the context collection (trac-4087)
4827 if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
4828 if ( ignored ) {
4829 ignored.push( elem );
4830 }
4831 continue;
4832 }
4833
4834 attached = isAttached( elem );
4835
4836 // Append to fragment
4837 tmp = getAll( fragment.appendChild( elem ), "script" );
4838
4839 // Preserve script evaluation history
4840 if ( attached ) {
4841 setGlobalEval( tmp );
4842 }
4843
4844 // Capture executables
4845 if ( scripts ) {
4846 j = 0;
4847 while ( ( elem = tmp[ j++ ] ) ) {
4848 if ( rscriptType.test( elem.type || "" ) ) {
4849 scripts.push( elem );
4850 }
4851 }
4852 }
4853 }
4854
4855 return fragment;
4856}
4857
4858
4859( function() {
4860 var fragment = document.createDocumentFragment(),
4861 div = fragment.appendChild( document.createElement( "div" ) ),
4862 input = document.createElement( "input" );
4863
4864 // Support: Android 4.0 - 4.3 only
4865 // Check state lost if the name is set (#11217)
4866 // Support: Windows Web Apps (WWA)
4867 // `name` and `type` must use .setAttribute for WWA (#14901)
4868 input.setAttribute( "type", "radio" );
4869 input.setAttribute( "checked", "checked" );
4870 input.setAttribute( "name", "t" );
4871
4872 div.appendChild( input );
4873
4874 // Support: Android <=4.1 only
4875 // Older WebKit doesn't clone checked state correctly in fragments
4876 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
4877
4878 // Support: IE <=11 only
4879 // Make sure textarea (and checkbox) defaultValue is properly cloned
4880 div.innerHTML = "<textarea>x</textarea>";
4881 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
4882} )();
4883
4884
4885var
4886 rkeyEvent = /^key/,
4887 rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
4888 rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
4889
4890function returnTrue() {
4891 return true;
4892}
4893
4894function returnFalse() {
4895 return false;
4896}
4897
4898// Support: IE <=9 only
4899// See #13393 for more info
4900function safeActiveElement() {
4901 try {
4902 return document.activeElement;
4903 } catch ( err ) { }
4904}
4905
4906function on( elem, types, selector, data, fn, one ) {
4907 var origFn, type;
4908
4909 // Types can be a map of types/handlers
4910 if ( typeof types === "object" ) {
4911
4912 // ( types-Object, selector, data )
4913 if ( typeof selector !== "string" ) {
4914
4915 // ( types-Object, data )
4916 data = data || selector;
4917 selector = undefined;
4918 }
4919 for ( type in types ) {
4920 on( elem, type, selector, data, types[ type ], one );
4921 }
4922 return elem;
4923 }
4924
4925 if ( data == null && fn == null ) {
4926
4927 // ( types, fn )
4928 fn = selector;
4929 data = selector = undefined;
4930 } else if ( fn == null ) {
4931 if ( typeof selector === "string" ) {
4932
4933 // ( types, selector, fn )
4934 fn = data;
4935 data = undefined;
4936 } else {
4937
4938 // ( types, data, fn )
4939 fn = data;
4940 data = selector;
4941 selector = undefined;
4942 }
4943 }
4944 if ( fn === false ) {
4945 fn = returnFalse;
4946 } else if ( !fn ) {
4947 return elem;
4948 }
4949
4950 if ( one === 1 ) {
4951 origFn = fn;
4952 fn = function( event ) {
4953
4954 // Can use an empty set, since event contains the info
4955 jQuery().off( event );
4956 return origFn.apply( this, arguments );
4957 };
4958
4959 // Use same guid so caller can remove using origFn
4960 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
4961 }
4962 return elem.each( function() {
4963 jQuery.event.add( this, types, fn, data, selector );
4964 } );
4965}
4966
4967/*
4968 * Helper functions for managing events -- not part of the public interface.
4969 * Props to Dean Edwards' addEvent library for many of the ideas.
4970 */
4971jQuery.event = {
4972
4973 global: {},
4974
4975 add: function( elem, types, handler, data, selector ) {
4976
4977 var handleObjIn, eventHandle, tmp,
4978 events, t, handleObj,
4979 special, handlers, type, namespaces, origType,
4980 elemData = dataPriv.get( elem );
4981
4982 // Don't attach events to noData or text/comment nodes (but allow plain objects)
4983 if ( !elemData ) {
4984 return;
4985 }
4986
4987 // Caller can pass in an object of custom data in lieu of the handler
4988 if ( handler.handler ) {
4989 handleObjIn = handler;
4990 handler = handleObjIn.handler;
4991 selector = handleObjIn.selector;
4992 }
4993
4994 // Ensure that invalid selectors throw exceptions at attach time
4995 // Evaluate against documentElement in case elem is a non-element node (e.g., document)
4996 if ( selector ) {
4997 jQuery.find.matchesSelector( documentElement, selector );
4998 }
4999
5000 // Make sure that the handler has a unique ID, used to find/remove it later
5001 if ( !handler.guid ) {
5002 handler.guid = jQuery.guid++;
5003 }
5004
5005 // Init the element's event structure and main handler, if this is the first
5006 if ( !( events = elemData.events ) ) {
5007 events = elemData.events = {};
5008 }
5009 if ( !( eventHandle = elemData.handle ) ) {
5010 eventHandle = elemData.handle = function( e ) {
5011
5012 // Discard the second event of a jQuery.event.trigger() and
5013 // when an event is called after a page has unloaded
5014 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
5015 jQuery.event.dispatch.apply( elem, arguments ) : undefined;
5016 };
5017 }
5018
5019 // Handle multiple events separated by a space
5020 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
5021 t = types.length;
5022 while ( t-- ) {
5023 tmp = rtypenamespace.exec( types[ t ] ) || [];
5024 type = origType = tmp[ 1 ];
5025 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
5026
5027 // There *must* be a type, no attaching namespace-only handlers
5028 if ( !type ) {
5029 continue;
5030 }
5031
5032 // If event changes its type, use the special event handlers for the changed type
5033 special = jQuery.event.special[ type ] || {};
5034
5035 // If selector defined, determine special event api type, otherwise given type
5036 type = ( selector ? special.delegateType : special.bindType ) || type;
5037
5038 // Update special based on newly reset type
5039 special = jQuery.event.special[ type ] || {};
5040
5041 // handleObj is passed to all event handlers
5042 handleObj = jQuery.extend( {
5043 type: type,
5044 origType: origType,
5045 data: data,
5046 handler: handler,
5047 guid: handler.guid,
5048 selector: selector,
5049 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
5050 namespace: namespaces.join( "." )
5051 }, handleObjIn );
5052
5053 // Init the event handler queue if we're the first
5054 if ( !( handlers = events[ type ] ) ) {
5055 handlers = events[ type ] = [];
5056 handlers.delegateCount = 0;
5057
5058 // Only use addEventListener if the special events handler returns false
5059 if ( !special.setup ||
5060 special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
5061
5062 if ( elem.addEventListener ) {
5063 elem.addEventListener( type, eventHandle );
5064 }
5065 }
5066 }
5067
5068 if ( special.add ) {
5069 special.add.call( elem, handleObj );
5070
5071 if ( !handleObj.handler.guid ) {
5072 handleObj.handler.guid = handler.guid;
5073 }
5074 }
5075
5076 // Add to the element's handler list, delegates in front
5077 if ( selector ) {
5078 handlers.splice( handlers.delegateCount++, 0, handleObj );
5079 } else {
5080 handlers.push( handleObj );
5081 }
5082
5083 // Keep track of which events have ever been used, for event optimization
5084 jQuery.event.global[ type ] = true;
5085 }
5086
5087 },
5088
5089 // Detach an event or set of events from an element
5090 remove: function( elem, types, handler, selector, mappedTypes ) {
5091
5092 var j, origCount, tmp,
5093 events, t, handleObj,
5094 special, handlers, type, namespaces, origType,
5095 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
5096
5097 if ( !elemData || !( events = elemData.events ) ) {
5098 return;
5099 }
5100
5101 // Once for each type.namespace in types; type may be omitted
5102 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
5103 t = types.length;
5104 while ( t-- ) {
5105 tmp = rtypenamespace.exec( types[ t ] ) || [];
5106 type = origType = tmp[ 1 ];
5107 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
5108
5109 // Unbind all events (on this namespace, if provided) for the element
5110 if ( !type ) {
5111 for ( type in events ) {
5112 jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
5113 }
5114 continue;
5115 }
5116
5117 special = jQuery.event.special[ type ] || {};
5118 type = ( selector ? special.delegateType : special.bindType ) || type;
5119 handlers = events[ type ] || [];
5120 tmp = tmp[ 2 ] &&
5121 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
5122
5123 // Remove matching events
5124 origCount = j = handlers.length;
5125 while ( j-- ) {
5126 handleObj = handlers[ j ];
5127
5128 if ( ( mappedTypes || origType === handleObj.origType ) &&
5129 ( !handler || handler.guid === handleObj.guid ) &&
5130 ( !tmp || tmp.test( handleObj.namespace ) ) &&
5131 ( !selector || selector === handleObj.selector ||
5132 selector === "**" && handleObj.selector ) ) {
5133 handlers.splice( j, 1 );
5134
5135 if ( handleObj.selector ) {
5136 handlers.delegateCount--;
5137 }
5138 if ( special.remove ) {
5139 special.remove.call( elem, handleObj );
5140 }
5141 }
5142 }
5143
5144 // Remove generic event handler if we removed something and no more handlers exist
5145 // (avoids potential for endless recursion during removal of special event handlers)
5146 if ( origCount && !handlers.length ) {
5147 if ( !special.teardown ||
5148 special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
5149
5150 jQuery.removeEvent( elem, type, elemData.handle );
5151 }
5152
5153 delete events[ type ];
5154 }
5155 }
5156
5157 // Remove data and the expando if it's no longer used
5158 if ( jQuery.isEmptyObject( events ) ) {
5159 dataPriv.remove( elem, "handle events" );
5160 }
5161 },
5162
5163 dispatch: function( nativeEvent ) {
5164
5165 // Make a writable jQuery.Event from the native event object
5166 var event = jQuery.event.fix( nativeEvent );
5167
5168 var i, j, ret, matched, handleObj, handlerQueue,
5169 args = new Array( arguments.length ),
5170 handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
5171 special = jQuery.event.special[ event.type ] || {};
5172
5173 // Use the fix-ed jQuery.Event rather than the (read-only) native event
5174 args[ 0 ] = event;
5175
5176 for ( i = 1; i < arguments.length; i++ ) {
5177 args[ i ] = arguments[ i ];
5178 }
5179
5180 event.delegateTarget = this;
5181
5182 // Call the preDispatch hook for the mapped type, and let it bail if desired
5183 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
5184 return;
5185 }
5186
5187 // Determine handlers
5188 handlerQueue = jQuery.event.handlers.call( this, event, handlers );
5189
5190 // Run delegates first; they may want to stop propagation beneath us
5191 i = 0;
5192 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
5193 event.currentTarget = matched.elem;
5194
5195 j = 0;
5196 while ( ( handleObj = matched.handlers[ j++ ] ) &&
5197 !event.isImmediatePropagationStopped() ) {
5198
5199 // Triggered event must either 1) have no namespace, or 2) have namespace(s)
5200 // a subset or equal to those in the bound event (both can have no namespace).
5201 if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
5202
5203 event.handleObj = handleObj;
5204 event.data = handleObj.data;
5205
5206 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
5207 handleObj.handler ).apply( matched.elem, args );
5208
5209 if ( ret !== undefined ) {
5210 if ( ( event.result = ret ) === false ) {
5211 event.preventDefault();
5212 event.stopPropagation();
5213 }
5214 }
5215 }
5216 }
5217 }
5218
5219 // Call the postDispatch hook for the mapped type
5220 if ( special.postDispatch ) {
5221 special.postDispatch.call( this, event );
5222 }
5223
5224 return event.result;
5225 },
5226
5227 handlers: function( event, handlers ) {
5228 var i, handleObj, sel, matchedHandlers, matchedSelectors,
5229 handlerQueue = [],
5230 delegateCount = handlers.delegateCount,
5231 cur = event.target;
5232
5233 // Find delegate handlers
5234 if ( delegateCount &&
5235
5236 // Support: IE <=9
5237 // Black-hole SVG <use> instance trees (trac-13180)
5238 cur.nodeType &&
5239
5240 // Support: Firefox <=42
5241 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
5242 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
5243 // Support: IE 11 only
5244 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
5245 !( event.type === "click" && event.button >= 1 ) ) {
5246
5247 for ( ; cur !== this; cur = cur.parentNode || this ) {
5248
5249 // Don't check non-elements (#13208)
5250 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
5251 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
5252 matchedHandlers = [];
5253 matchedSelectors = {};
5254 for ( i = 0; i < delegateCount; i++ ) {
5255 handleObj = handlers[ i ];
5256
5257 // Don't conflict with Object.prototype properties (#13203)
5258 sel = handleObj.selector + " ";
5259
5260 if ( matchedSelectors[ sel ] === undefined ) {
5261 matchedSelectors[ sel ] = handleObj.needsContext ?
5262 jQuery( sel, this ).index( cur ) > -1 :
5263 jQuery.find( sel, this, null, [ cur ] ).length;
5264 }
5265 if ( matchedSelectors[ sel ] ) {
5266 matchedHandlers.push( handleObj );
5267 }
5268 }
5269 if ( matchedHandlers.length ) {
5270 handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
5271 }
5272 }
5273 }
5274 }
5275
5276 // Add the remaining (directly-bound) handlers
5277 cur = this;
5278 if ( delegateCount < handlers.length ) {
5279 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
5280 }
5281
5282 return handlerQueue;
5283 },
5284
5285 addProp: function( name, hook ) {
5286 Object.defineProperty( jQuery.Event.prototype, name, {
5287 enumerable: true,
5288 configurable: true,
5289
5290 get: isFunction( hook ) ?
5291 function() {
5292 if ( this.originalEvent ) {
5293 return hook( this.originalEvent );
5294 }
5295 } :
5296 function() {
5297 if ( this.originalEvent ) {
5298 return this.originalEvent[ name ];
5299 }
5300 },
5301
5302 set: function( value ) {
5303 Object.defineProperty( this, name, {
5304 enumerable: true,
5305 configurable: true,
5306 writable: true,
5307 value: value
5308 } );
5309 }
5310 } );
5311 },
5312
5313 fix: function( originalEvent ) {
5314 return originalEvent[ jQuery.expando ] ?
5315 originalEvent :
5316 new jQuery.Event( originalEvent );
5317 },
5318
5319 special: {
5320 load: {
5321
5322 // Prevent triggered image.load events from bubbling to window.load
5323 noBubble: true
5324 },
5325 focus: {
5326
5327 // Fire native event if possible so blur/focus sequence is correct
5328 trigger: function() {
5329 if ( this !== safeActiveElement() && this.focus ) {
5330 this.focus();
5331 return false;
5332 }
5333 },
5334 delegateType: "focusin"
5335 },
5336 blur: {
5337 trigger: function() {
5338 if ( this === safeActiveElement() && this.blur ) {
5339 this.blur();
5340 return false;
5341 }
5342 },
5343 delegateType: "focusout"
5344 },
5345 click: {
5346
5347 // For checkbox, fire native event so checked state will be right
5348 trigger: function() {
5349 if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
5350 this.click();
5351 return false;
5352 }
5353 },
5354
5355 // For cross-browser consistency, don't fire native .click() on links
5356 _default: function( event ) {
5357 return nodeName( event.target, "a" );
5358 }
5359 },
5360
5361 beforeunload: {
5362 postDispatch: function( event ) {
5363
5364 // Support: Firefox 20+
5365 // Firefox doesn't alert if the returnValue field is not set.
5366 if ( event.result !== undefined && event.originalEvent ) {
5367 event.originalEvent.returnValue = event.result;
5368 }
5369 }
5370 }
5371 }
5372};
5373
5374jQuery.removeEvent = function( elem, type, handle ) {
5375
5376 // This "if" is needed for plain objects
5377 if ( elem.removeEventListener ) {
5378 elem.removeEventListener( type, handle );
5379 }
5380};
5381
5382jQuery.Event = function( src, props ) {
5383
5384 // Allow instantiation without the 'new' keyword
5385 if ( !( this instanceof jQuery.Event ) ) {
5386 return new jQuery.Event( src, props );
5387 }
5388
5389 // Event object
5390 if ( src && src.type ) {
5391 this.originalEvent = src;
5392 this.type = src.type;
5393
5394 // Events bubbling up the document may have been marked as prevented
5395 // by a handler lower down the tree; reflect the correct value.
5396 this.isDefaultPrevented = src.defaultPrevented ||
5397 src.defaultPrevented === undefined &&
5398
5399 // Support: Android <=2.3 only
5400 src.returnValue === false ?
5401 returnTrue :
5402 returnFalse;
5403
5404 // Create target properties
5405 // Support: Safari <=6 - 7 only
5406 // Target should not be a text node (#504, #13143)
5407 this.target = ( src.target && src.target.nodeType === 3 ) ?
5408 src.target.parentNode :
5409 src.target;
5410
5411 this.currentTarget = src.currentTarget;
5412 this.relatedTarget = src.relatedTarget;
5413
5414 // Event type
5415 } else {
5416 this.type = src;
5417 }
5418
5419 // Put explicitly provided properties onto the event object
5420 if ( props ) {
5421 jQuery.extend( this, props );
5422 }
5423
5424 // Create a timestamp if incoming event doesn't have one
5425 this.timeStamp = src && src.timeStamp || Date.now();
5426
5427 // Mark it as fixed
5428 this[ jQuery.expando ] = true;
5429};
5430
5431// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
5432// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
5433jQuery.Event.prototype = {
5434 constructor: jQuery.Event,
5435 isDefaultPrevented: returnFalse,
5436 isPropagationStopped: returnFalse,
5437 isImmediatePropagationStopped: returnFalse,
5438 isSimulated: false,
5439
5440 preventDefault: function() {
5441 var e = this.originalEvent;
5442
5443 this.isDefaultPrevented = returnTrue;
5444
5445 if ( e && !this.isSimulated ) {
5446 e.preventDefault();
5447 }
5448 },
5449 stopPropagation: function() {
5450 var e = this.originalEvent;
5451
5452 this.isPropagationStopped = returnTrue;
5453
5454 if ( e && !this.isSimulated ) {
5455 e.stopPropagation();
5456 }
5457 },
5458 stopImmediatePropagation: function() {
5459 var e = this.originalEvent;
5460
5461 this.isImmediatePropagationStopped = returnTrue;
5462
5463 if ( e && !this.isSimulated ) {
5464 e.stopImmediatePropagation();
5465 }
5466
5467 this.stopPropagation();
5468 }
5469};
5470
5471// Includes all common event props including KeyEvent and MouseEvent specific props
5472jQuery.each( {
5473 altKey: true,
5474 bubbles: true,
5475 cancelable: true,
5476 changedTouches: true,
5477 ctrlKey: true,
5478 detail: true,
5479 eventPhase: true,
5480 metaKey: true,
5481 pageX: true,
5482 pageY: true,
5483 shiftKey: true,
5484 view: true,
5485 "char": true,
5486 code: true,
5487 charCode: true,
5488 key: true,
5489 keyCode: true,
5490 button: true,
5491 buttons: true,
5492 clientX: true,
5493 clientY: true,
5494 offsetX: true,
5495 offsetY: true,
5496 pointerId: true,
5497 pointerType: true,
5498 screenX: true,
5499 screenY: true,
5500 targetTouches: true,
5501 toElement: true,
5502 touches: true,
5503
5504 which: function( event ) {
5505 var button = event.button;
5506
5507 // Add which for key events
5508 if ( event.which == null && rkeyEvent.test( event.type ) ) {
5509 return event.charCode != null ? event.charCode : event.keyCode;
5510 }
5511
5512 // Add which for click: 1 === left; 2 === middle; 3 === right
5513 if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
5514 if ( button & 1 ) {
5515 return 1;
5516 }
5517
5518 if ( button & 2 ) {
5519 return 3;
5520 }
5521
5522 if ( button & 4 ) {
5523 return 2;
5524 }
5525
5526 return 0;
5527 }
5528
5529 return event.which;
5530 }
5531}, jQuery.event.addProp );
5532
5533// Create mouseenter/leave events using mouseover/out and event-time checks
5534// so that event delegation works in jQuery.
5535// Do the same for pointerenter/pointerleave and pointerover/pointerout
5536//
5537// Support: Safari 7 only
5538// Safari sends mouseenter too often; see:
5539// https://bugs.chromium.org/p/chromium/issues/detail?id=470258
5540// for the description of the bug (it existed in older Chrome versions as well).
5541jQuery.each( {
5542 mouseenter: "mouseover",
5543 mouseleave: "mouseout",
5544 pointerenter: "pointerover",
5545 pointerleave: "pointerout"
5546}, function( orig, fix ) {
5547 jQuery.event.special[ orig ] = {
5548 delegateType: fix,
5549 bindType: fix,
5550
5551 handle: function( event ) {
5552 var ret,
5553 target = this,
5554 related = event.relatedTarget,
5555 handleObj = event.handleObj;
5556
5557 // For mouseenter/leave call the handler if related is outside the target.
5558 // NB: No relatedTarget if the mouse left/entered the browser window
5559 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
5560 event.type = handleObj.origType;
5561 ret = handleObj.handler.apply( this, arguments );
5562 event.type = fix;
5563 }
5564 return ret;
5565 }
5566 };
5567} );
5568
5569jQuery.fn.extend( {
5570
5571 on: function( types, selector, data, fn ) {
5572 return on( this, types, selector, data, fn );
5573 },
5574 one: function( types, selector, data, fn ) {
5575 return on( this, types, selector, data, fn, 1 );
5576 },
5577 off: function( types, selector, fn ) {
5578 var handleObj, type;
5579 if ( types && types.preventDefault && types.handleObj ) {
5580
5581 // ( event ) dispatched jQuery.Event
5582 handleObj = types.handleObj;
5583 jQuery( types.delegateTarget ).off(
5584 handleObj.namespace ?
5585 handleObj.origType + "." + handleObj.namespace :
5586 handleObj.origType,
5587 handleObj.selector,
5588 handleObj.handler
5589 );
5590 return this;
5591 }
5592 if ( typeof types === "object" ) {
5593
5594 // ( types-object [, selector] )
5595 for ( type in types ) {
5596 this.off( type, selector, types[ type ] );
5597 }
5598 return this;
5599 }
5600 if ( selector === false || typeof selector === "function" ) {
5601
5602 // ( types [, fn] )
5603 fn = selector;
5604 selector = undefined;
5605 }
5606 if ( fn === false ) {
5607 fn = returnFalse;
5608 }
5609 return this.each( function() {
5610 jQuery.event.remove( this, types, fn, selector );
5611 } );
5612 }
5613} );
5614
5615
5616var
5617
5618 /* eslint-disable max-len */
5619
5620 // See https://github.com/eslint/eslint/issues/3229
5621 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
5622
5623 /* eslint-enable */
5624
5625 // Support: IE <=10 - 11, Edge 12 - 13 only
5626 // In IE/Edge using regex groups here causes severe slowdowns.
5627 // See https://connect.microsoft.com/IE/feedback/details/1736512/
5628 rnoInnerhtml = /<script|<style|<link/i,
5629
5630 // checked="checked" or checked
5631 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
5632 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
5633
5634// Prefer a tbody over its parent table for containing new rows
5635function manipulationTarget( elem, content ) {
5636 if ( nodeName( elem, "table" ) &&
5637 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
5638
5639 return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
5640 }
5641
5642 return elem;
5643}
5644
5645// Replace/restore the type attribute of script elements for safe DOM manipulation
5646function disableScript( elem ) {
5647 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
5648 return elem;
5649}
5650function restoreScript( elem ) {
5651 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
5652 elem.type = elem.type.slice( 5 );
5653 } else {
5654 elem.removeAttribute( "type" );
5655 }
5656
5657 return elem;
5658}
5659
5660function cloneCopyEvent( src, dest ) {
5661 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
5662
5663 if ( dest.nodeType !== 1 ) {
5664 return;
5665 }
5666
5667 // 1. Copy private data: events, handlers, etc.
5668 if ( dataPriv.hasData( src ) ) {
5669 pdataOld = dataPriv.access( src );
5670 pdataCur = dataPriv.set( dest, pdataOld );
5671 events = pdataOld.events;
5672
5673 if ( events ) {
5674 delete pdataCur.handle;
5675 pdataCur.events = {};
5676
5677 for ( type in events ) {
5678 for ( i = 0, l = events[ type ].length; i < l; i++ ) {
5679 jQuery.event.add( dest, type, events[ type ][ i ] );
5680 }
5681 }
5682 }
5683 }
5684
5685 // 2. Copy user data
5686 if ( dataUser.hasData( src ) ) {
5687 udataOld = dataUser.access( src );
5688 udataCur = jQuery.extend( {}, udataOld );
5689
5690 dataUser.set( dest, udataCur );
5691 }
5692}
5693
5694// Fix IE bugs, see support tests
5695function fixInput( src, dest ) {
5696 var nodeName = dest.nodeName.toLowerCase();
5697
5698 // Fails to persist the checked state of a cloned checkbox or radio button.
5699 if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
5700 dest.checked = src.checked;
5701
5702 // Fails to return the selected option to the default selected state when cloning options
5703 } else if ( nodeName === "input" || nodeName === "textarea" ) {
5704 dest.defaultValue = src.defaultValue;
5705 }
5706}
5707
5708function domManip( collection, args, callback, ignored ) {
5709
5710 // Flatten any nested arrays
5711 args = concat.apply( [], args );
5712
5713 var fragment, first, scripts, hasScripts, node, doc,
5714 i = 0,
5715 l = collection.length,
5716 iNoClone = l - 1,
5717 value = args[ 0 ],
5718 valueIsFunction = isFunction( value );
5719
5720 // We can't cloneNode fragments that contain checked, in WebKit
5721 if ( valueIsFunction ||
5722 ( l > 1 && typeof value === "string" &&
5723 !support.checkClone && rchecked.test( value ) ) ) {
5724 return collection.each( function( index ) {
5725 var self = collection.eq( index );
5726 if ( valueIsFunction ) {
5727 args[ 0 ] = value.call( this, index, self.html() );
5728 }
5729 domManip( self, args, callback, ignored );
5730 } );
5731 }
5732
5733 if ( l ) {
5734 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
5735 first = fragment.firstChild;
5736
5737 if ( fragment.childNodes.length === 1 ) {
5738 fragment = first;
5739 }
5740
5741 // Require either new content or an interest in ignored elements to invoke the callback
5742 if ( first || ignored ) {
5743 scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
5744 hasScripts = scripts.length;
5745
5746 // Use the original fragment for the last item
5747 // instead of the first because it can end up
5748 // being emptied incorrectly in certain situations (#8070).
5749 for ( ; i < l; i++ ) {
5750 node = fragment;
5751
5752 if ( i !== iNoClone ) {
5753 node = jQuery.clone( node, true, true );
5754
5755 // Keep references to cloned scripts for later restoration
5756 if ( hasScripts ) {
5757
5758 // Support: Android <=4.0 only, PhantomJS 1 only
5759 // push.apply(_, arraylike) throws on ancient WebKit
5760 jQuery.merge( scripts, getAll( node, "script" ) );
5761 }
5762 }
5763
5764 callback.call( collection[ i ], node, i );
5765 }
5766
5767 if ( hasScripts ) {
5768 doc = scripts[ scripts.length - 1 ].ownerDocument;
5769
5770 // Reenable scripts
5771 jQuery.map( scripts, restoreScript );
5772
5773 // Evaluate executable scripts on first document insertion
5774 for ( i = 0; i < hasScripts; i++ ) {
5775 node = scripts[ i ];
5776 if ( rscriptType.test( node.type || "" ) &&
5777 !dataPriv.access( node, "globalEval" ) &&
5778 jQuery.contains( doc, node ) ) {
5779
5780 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
5781
5782 // Optional AJAX dependency, but won't run scripts if not present
5783 if ( jQuery._evalUrl ) {
5784 jQuery._evalUrl( node.src );
5785 }
5786 } else {
5787 DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node );
5788 }
5789 }
5790 }
5791 }
5792 }
5793 }
5794
5795 return collection;
5796}
5797
5798function remove( elem, selector, keepData ) {
5799 var node,
5800 nodes = selector ? jQuery.filter( selector, elem ) : elem,
5801 i = 0;
5802
5803 for ( ; ( node = nodes[ i ] ) != null; i++ ) {
5804 if ( !keepData && node.nodeType === 1 ) {
5805 jQuery.cleanData( getAll( node ) );
5806 }
5807
5808 if ( node.parentNode ) {
5809 if ( keepData && isAttached( node ) ) {
5810 setGlobalEval( getAll( node, "script" ) );
5811 }
5812 node.parentNode.removeChild( node );
5813 }
5814 }
5815
5816 return elem;
5817}
5818
5819jQuery.extend( {
5820 htmlPrefilter: function( html ) {
5821 return html.replace( rxhtmlTag, "<$1></$2>" );
5822 },
5823
5824 clone: function( elem, dataAndEvents, deepDataAndEvents ) {
5825 var i, l, srcElements, destElements,
5826 clone = elem.cloneNode( true ),
5827 inPage = isAttached( elem );
5828
5829 // Fix IE cloning issues
5830 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
5831 !jQuery.isXMLDoc( elem ) ) {
5832
5833 // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
5834 destElements = getAll( clone );
5835 srcElements = getAll( elem );
5836
5837 for ( i = 0, l = srcElements.length; i < l; i++ ) {
5838 fixInput( srcElements[ i ], destElements[ i ] );
5839 }
5840 }
5841
5842 // Copy the events from the original to the clone
5843 if ( dataAndEvents ) {
5844 if ( deepDataAndEvents ) {
5845 srcElements = srcElements || getAll( elem );
5846 destElements = destElements || getAll( clone );
5847
5848 for ( i = 0, l = srcElements.length; i < l; i++ ) {
5849 cloneCopyEvent( srcElements[ i ], destElements[ i ] );
5850 }
5851 } else {
5852 cloneCopyEvent( elem, clone );
5853 }
5854 }
5855
5856 // Preserve script evaluation history
5857 destElements = getAll( clone, "script" );
5858 if ( destElements.length > 0 ) {
5859 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
5860 }
5861
5862 // Return the cloned set
5863 return clone;
5864 },
5865
5866 cleanData: function( elems ) {
5867 var data, elem, type,
5868 special = jQuery.event.special,
5869 i = 0;
5870
5871 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
5872 if ( acceptData( elem ) ) {
5873 if ( ( data = elem[ dataPriv.expando ] ) ) {
5874 if ( data.events ) {
5875 for ( type in data.events ) {
5876 if ( special[ type ] ) {
5877 jQuery.event.remove( elem, type );
5878
5879 // This is a shortcut to avoid jQuery.event.remove's overhead
5880 } else {
5881 jQuery.removeEvent( elem, type, data.handle );
5882 }
5883 }
5884 }
5885
5886 // Support: Chrome <=35 - 45+
5887 // Assign undefined instead of using delete, see Data#remove
5888 elem[ dataPriv.expando ] = undefined;
5889 }
5890 if ( elem[ dataUser.expando ] ) {
5891
5892 // Support: Chrome <=35 - 45+
5893 // Assign undefined instead of using delete, see Data#remove
5894 elem[ dataUser.expando ] = undefined;
5895 }
5896 }
5897 }
5898 }
5899} );
5900
5901jQuery.fn.extend( {
5902 detach: function( selector ) {
5903 return remove( this, selector, true );
5904 },
5905
5906 remove: function( selector ) {
5907 return remove( this, selector );
5908 },
5909
5910 text: function( value ) {
5911 return access( this, function( value ) {
5912 return value === undefined ?
5913 jQuery.text( this ) :
5914 this.empty().each( function() {
5915 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5916 this.textContent = value;
5917 }
5918 } );
5919 }, null, value, arguments.length );
5920 },
5921
5922 append: function() {
5923 return domManip( this, arguments, function( elem ) {
5924 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5925 var target = manipulationTarget( this, elem );
5926 target.appendChild( elem );
5927 }
5928 } );
5929 },
5930
5931 prepend: function() {
5932 return domManip( this, arguments, function( elem ) {
5933 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
5934 var target = manipulationTarget( this, elem );
5935 target.insertBefore( elem, target.firstChild );
5936 }
5937 } );
5938 },
5939
5940 before: function() {
5941 return domManip( this, arguments, function( elem ) {
5942 if ( this.parentNode ) {
5943 this.parentNode.insertBefore( elem, this );
5944 }
5945 } );
5946 },
5947
5948 after: function() {
5949 return domManip( this, arguments, function( elem ) {
5950 if ( this.parentNode ) {
5951 this.parentNode.insertBefore( elem, this.nextSibling );
5952 }
5953 } );
5954 },
5955
5956 empty: function() {
5957 var elem,
5958 i = 0;
5959
5960 for ( ; ( elem = this[ i ] ) != null; i++ ) {
5961 if ( elem.nodeType === 1 ) {
5962
5963 // Prevent memory leaks
5964 jQuery.cleanData( getAll( elem, false ) );
5965
5966 // Remove any remaining nodes
5967 elem.textContent = "";
5968 }
5969 }
5970
5971 return this;
5972 },
5973
5974 clone: function( dataAndEvents, deepDataAndEvents ) {
5975 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
5976 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
5977
5978 return this.map( function() {
5979 return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
5980 } );
5981 },
5982
5983 html: function( value ) {
5984 return access( this, function( value ) {
5985 var elem = this[ 0 ] || {},
5986 i = 0,
5987 l = this.length;
5988
5989 if ( value === undefined && elem.nodeType === 1 ) {
5990 return elem.innerHTML;
5991 }
5992
5993 // See if we can take a shortcut and just use innerHTML
5994 if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
5995 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
5996
5997 value = jQuery.htmlPrefilter( value );
5998
5999 try {
6000 for ( ; i < l; i++ ) {
6001 elem = this[ i ] || {};
6002
6003 // Remove element nodes and prevent memory leaks
6004 if ( elem.nodeType === 1 ) {
6005 jQuery.cleanData( getAll( elem, false ) );
6006 elem.innerHTML = value;
6007 }
6008 }
6009
6010 elem = 0;
6011
6012 // If using innerHTML throws an exception, use the fallback method
6013 } catch ( e ) {}
6014 }
6015
6016 if ( elem ) {
6017 this.empty().append( value );
6018 }
6019 }, null, value, arguments.length );
6020 },
6021
6022 replaceWith: function() {
6023 var ignored = [];
6024
6025 // Make the changes, replacing each non-ignored context element with the new content
6026 return domManip( this, arguments, function( elem ) {
6027 var parent = this.parentNode;
6028
6029 if ( jQuery.inArray( this, ignored ) < 0 ) {
6030 jQuery.cleanData( getAll( this ) );
6031 if ( parent ) {
6032 parent.replaceChild( elem, this );
6033 }
6034 }
6035
6036 // Force callback invocation
6037 }, ignored );
6038 }
6039} );
6040
6041jQuery.each( {
6042 appendTo: "append",
6043 prependTo: "prepend",
6044 insertBefore: "before",
6045 insertAfter: "after",
6046 replaceAll: "replaceWith"
6047}, function( name, original ) {
6048 jQuery.fn[ name ] = function( selector ) {
6049 var elems,
6050 ret = [],
6051 insert = jQuery( selector ),
6052 last = insert.length - 1,
6053 i = 0;
6054
6055 for ( ; i <= last; i++ ) {
6056 elems = i === last ? this : this.clone( true );
6057 jQuery( insert[ i ] )[ original ]( elems );
6058
6059 // Support: Android <=4.0 only, PhantomJS 1 only
6060 // .get() because push.apply(_, arraylike) throws on ancient WebKit
6061 push.apply( ret, elems.get() );
6062 }
6063
6064 return this.pushStack( ret );
6065 };
6066} );
6067var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
6068
6069var getStyles = function( elem ) {
6070
6071 // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
6072 // IE throws on elements created in popups
6073 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
6074 var view = elem.ownerDocument.defaultView;
6075
6076 if ( !view || !view.opener ) {
6077 view = window;
6078 }
6079
6080 return view.getComputedStyle( elem );
6081 };
6082
6083var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6084
6085
6086
6087( function() {
6088
6089 // Executing both pixelPosition & boxSizingReliable tests require only one layout
6090 // so they're executed at the same time to save the second computation.
6091 function computeStyleTests() {
6092
6093 // This is a singleton, we need to execute it only once
6094 if ( !div ) {
6095 return;
6096 }
6097
6098 container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
6099 "margin-top:1px;padding:0;border:0";
6100 div.style.cssText =
6101 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
6102 "margin:auto;border:1px;padding:1px;" +
6103 "width:60%;top:1%";
6104 documentElement.appendChild( container ).appendChild( div );
6105
6106 var divStyle = window.getComputedStyle( div );
6107 pixelPositionVal = divStyle.top !== "1%";
6108
6109 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
6110 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
6111
6112 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
6113 // Some styles come back with percentage values, even though they shouldn't
6114 div.style.right = "60%";
6115 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
6116
6117 // Support: IE 9 - 11 only
6118 // Detect misreporting of content dimensions for box-sizing:border-box elements
6119 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
6120
6121 // Support: IE 9 only
6122 // Detect overflow:scroll screwiness (gh-3699)
6123 // Support: Chrome <=64
6124 // Don't get tricked when zoom affects offsetWidth (gh-4029)
6125 div.style.position = "absolute";
6126 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
6127
6128 documentElement.removeChild( container );
6129
6130 // Nullify the div so it wouldn't be stored in the memory and
6131 // it will also be a sign that checks already performed
6132 div = null;
6133 }
6134
6135 function roundPixelMeasures( measure ) {
6136 return Math.round( parseFloat( measure ) );
6137 }
6138
6139 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
6140 reliableMarginLeftVal,
6141 container = document.createElement( "div" ),
6142 div = document.createElement( "div" );
6143
6144 // Finish early in limited (non-browser) environments
6145 if ( !div.style ) {
6146 return;
6147 }
6148
6149 // Support: IE <=9 - 11 only
6150 // Style of cloned element affects source element cloned (#8908)
6151 div.style.backgroundClip = "content-box";
6152 div.cloneNode( true ).style.backgroundClip = "";
6153 support.clearCloneStyle = div.style.backgroundClip === "content-box";
6154
6155 jQuery.extend( support, {
6156 boxSizingReliable: function() {
6157 computeStyleTests();
6158 return boxSizingReliableVal;
6159 },
6160 pixelBoxStyles: function() {
6161 computeStyleTests();
6162 return pixelBoxStylesVal;
6163 },
6164 pixelPosition: function() {
6165 computeStyleTests();
6166 return pixelPositionVal;
6167 },
6168 reliableMarginLeft: function() {
6169 computeStyleTests();
6170 return reliableMarginLeftVal;
6171 },
6172 scrollboxSize: function() {
6173 computeStyleTests();
6174 return scrollboxSizeVal;
6175 }
6176 } );
6177} )();
6178
6179
6180function curCSS( elem, name, computed ) {
6181 var width, minWidth, maxWidth, ret,
6182
6183 // Support: Firefox 51+
6184 // Retrieving style before computed somehow
6185 // fixes an issue with getting wrong values
6186 // on detached elements
6187 style = elem.style;
6188
6189 computed = computed || getStyles( elem );
6190
6191 // getPropertyValue is needed for:
6192 // .css('filter') (IE 9 only, #12537)
6193 // .css('--customProperty) (#3144)
6194 if ( computed ) {
6195 ret = computed.getPropertyValue( name ) || computed[ name ];
6196
6197 if ( ret === "" && !isAttached( elem ) ) {
6198 ret = jQuery.style( elem, name );
6199 }
6200
6201 // A tribute to the "awesome hack by Dean Edwards"
6202 // Android Browser returns percentage for some values,
6203 // but width seems to be reliably pixels.
6204 // This is against the CSSOM draft spec:
6205 // https://drafts.csswg.org/cssom/#resolved-values
6206 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
6207
6208 // Remember the original values
6209 width = style.width;
6210 minWidth = style.minWidth;
6211 maxWidth = style.maxWidth;
6212
6213 // Put in the new values to get a computed value out
6214 style.minWidth = style.maxWidth = style.width = ret;
6215 ret = computed.width;
6216
6217 // Revert the changed values
6218 style.width = width;
6219 style.minWidth = minWidth;
6220 style.maxWidth = maxWidth;
6221 }
6222 }
6223
6224 return ret !== undefined ?
6225
6226 // Support: IE <=9 - 11 only
6227 // IE returns zIndex value as an integer.
6228 ret + "" :
6229 ret;
6230}
6231
6232
6233function addGetHookIf( conditionFn, hookFn ) {
6234
6235 // Define the hook, we'll check on the first run if it's really needed.
6236 return {
6237 get: function() {
6238 if ( conditionFn() ) {
6239
6240 // Hook not needed (or it's not possible to use it due
6241 // to missing dependency), remove it.
6242 delete this.get;
6243 return;
6244 }
6245
6246 // Hook needed; redefine it so that the support test is not executed again.
6247 return ( this.get = hookFn ).apply( this, arguments );
6248 }
6249 };
6250}
6251
6252
6253var cssPrefixes = [ "Webkit", "Moz", "ms" ],
6254 emptyStyle = document.createElement( "div" ).style,
6255 vendorProps = {};
6256
6257// Return a vendor-prefixed property or undefined
6258function vendorPropName( name ) {
6259
6260 // Check for vendor prefixed names
6261 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
6262 i = cssPrefixes.length;
6263
6264 while ( i-- ) {
6265 name = cssPrefixes[ i ] + capName;
6266 if ( name in emptyStyle ) {
6267 return name;
6268 }
6269 }
6270}
6271
6272// Return a potentially-mapped jQuery.cssProps or vendor prefixed property
6273function finalPropName( name ) {
6274 var final = jQuery.cssProps[ name ] || vendorProps[ name ];
6275
6276 if ( final ) {
6277 return final;
6278 }
6279 if ( name in emptyStyle ) {
6280 return name;
6281 }
6282 return vendorProps[ name ] = vendorPropName( name ) || name;
6283}
6284
6285
6286var
6287
6288 // Swappable if display is none or starts with table
6289 // except "table", "table-cell", or "table-caption"
6290 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
6291 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
6292 rcustomProp = /^--/,
6293 cssShow = { position: "absolute", visibility: "hidden", display: "block" },
6294 cssNormalTransform = {
6295 letterSpacing: "0",
6296 fontWeight: "400"
6297 };
6298
6299function setPositiveNumber( elem, value, subtract ) {
6300
6301 // Any relative (+/-) values have already been
6302 // normalized at this point
6303 var matches = rcssNum.exec( value );
6304 return matches ?
6305
6306 // Guard against undefined "subtract", e.g., when used as in cssHooks
6307 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
6308 value;
6309}
6310
6311function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
6312 var i = dimension === "width" ? 1 : 0,
6313 extra = 0,
6314 delta = 0;
6315
6316 // Adjustment may not be necessary
6317 if ( box === ( isBorderBox ? "border" : "content" ) ) {
6318 return 0;
6319 }
6320
6321 for ( ; i < 4; i += 2 ) {
6322
6323 // Both box models exclude margin
6324 if ( box === "margin" ) {
6325 delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
6326 }
6327
6328 // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
6329 if ( !isBorderBox ) {
6330
6331 // Add padding
6332 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6333
6334 // For "border" or "margin", add border
6335 if ( box !== "padding" ) {
6336 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6337
6338 // But still keep track of it otherwise
6339 } else {
6340 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6341 }
6342
6343 // If we get here with a border-box (content + padding + border), we're seeking "content" or
6344 // "padding" or "margin"
6345 } else {
6346
6347 // For "content", subtract padding
6348 if ( box === "content" ) {
6349 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6350 }
6351
6352 // For "content" or "padding", subtract border
6353 if ( box !== "margin" ) {
6354 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6355 }
6356 }
6357 }
6358
6359 // Account for positive content-box scroll gutter when requested by providing computedVal
6360 if ( !isBorderBox && computedVal >= 0 ) {
6361
6362 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
6363 // Assuming integer scroll gutter, subtract the rest and round down
6364 delta += Math.max( 0, Math.ceil(
6365 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
6366 computedVal -
6367 delta -
6368 extra -
6369 0.5
6370
6371 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
6372 // Use an explicit zero to avoid NaN (gh-3964)
6373 ) ) || 0;
6374 }
6375
6376 return delta;
6377}
6378
6379function getWidthOrHeight( elem, dimension, extra ) {
6380
6381 // Start with computed style
6382 var styles = getStyles( elem ),
6383 val = curCSS( elem, dimension, styles ),
6384 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6385 valueIsBorderBox = isBorderBox,
6386 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
6387
6388 // Support: Firefox <=54
6389 // Return a confounding non-pixel value or feign ignorance, as appropriate.
6390 if ( rnumnonpx.test( val ) ) {
6391 if ( !extra ) {
6392 return val;
6393 }
6394 val = "auto";
6395 }
6396
6397
6398 // Fall back to offsetWidth/offsetHeight when value is "auto"
6399 // This happens for inline elements with no explicit setting (gh-3571)
6400 // Support: Android <=4.1 - 4.3 only
6401 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
6402 // Support: IE 9-11 only
6403 // Also use offsetWidth/offsetHeight for when box sizing is unreliable
6404 // We use getClientRects() to check for hidden/disconnected.
6405 // In those cases, the computed value can be trusted to be border-box
6406 if ( ( isBorderBox && !support.boxSizingReliable() || val === "auto" ||
6407 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
6408 elem.getClientRects().length ) {
6409
6410 // Where available, offsetWidth/offsetHeight approximate border box dimensions.
6411 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
6412 // retrieved value as a content box dimension.
6413 valueIsBorderBox = offsetProp in elem;
6414 if ( valueIsBorderBox ) {
6415 val = elem[ offsetProp ];
6416 }
6417 }
6418
6419 // Normalize "" and auto
6420 val = parseFloat( val ) || 0;
6421
6422 // Adjust for the element's box model
6423 return ( val +
6424 boxModelAdjustment(
6425 elem,
6426 dimension,
6427 extra || ( isBorderBox ? "border" : "content" ),
6428 valueIsBorderBox,
6429 styles,
6430
6431 // Provide the current computed size to request scroll gutter calculation (gh-3589)
6432 val
6433 )
6434 ) + "px";
6435}
6436
6437jQuery.extend( {
6438
6439 // Add in style property hooks for overriding the default
6440 // behavior of getting and setting a style property
6441 cssHooks: {
6442 opacity: {
6443 get: function( elem, computed ) {
6444 if ( computed ) {
6445
6446 // We should always get a number back from opacity
6447 var ret = curCSS( elem, "opacity" );
6448 return ret === "" ? "1" : ret;
6449 }
6450 }
6451 }
6452 },
6453
6454 // Don't automatically add "px" to these possibly-unitless properties
6455 cssNumber: {
6456 "animationIterationCount": true,
6457 "columnCount": true,
6458 "fillOpacity": true,
6459 "flexGrow": true,
6460 "flexShrink": true,
6461 "fontWeight": true,
6462 "gridArea": true,
6463 "gridColumn": true,
6464 "gridColumnEnd": true,
6465 "gridColumnStart": true,
6466 "gridRow": true,
6467 "gridRowEnd": true,
6468 "gridRowStart": true,
6469 "lineHeight": true,
6470 "opacity": true,
6471 "order": true,
6472 "orphans": true,
6473 "widows": true,
6474 "zIndex": true,
6475 "zoom": true
6476 },
6477
6478 // Add in properties whose names you wish to fix before
6479 // setting or getting the value
6480 cssProps: {},
6481
6482 // Get and set the style property on a DOM Node
6483 style: function( elem, name, value, extra ) {
6484
6485 // Don't set styles on text and comment nodes
6486 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
6487 return;
6488 }
6489
6490 // Make sure that we're working with the right name
6491 var ret, type, hooks,
6492 origName = camelCase( name ),
6493 isCustomProp = rcustomProp.test( name ),
6494 style = elem.style;
6495
6496 // Make sure that we're working with the right name. We don't
6497 // want to query the value if it is a CSS custom property
6498 // since they are user-defined.
6499 if ( !isCustomProp ) {
6500 name = finalPropName( origName );
6501 }
6502
6503 // Gets hook for the prefixed version, then unprefixed version
6504 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6505
6506 // Check if we're setting a value
6507 if ( value !== undefined ) {
6508 type = typeof value;
6509
6510 // Convert "+=" or "-=" to relative numbers (#7345)
6511 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
6512 value = adjustCSS( elem, name, ret );
6513
6514 // Fixes bug #9237
6515 type = "number";
6516 }
6517
6518 // Make sure that null and NaN values aren't set (#7116)
6519 if ( value == null || value !== value ) {
6520 return;
6521 }
6522
6523 // If a number was passed in, add the unit (except for certain CSS properties)
6524 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
6525 // "px" to a few hardcoded values.
6526 if ( type === "number" && !isCustomProp ) {
6527 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
6528 }
6529
6530 // background-* props affect original clone's values
6531 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
6532 style[ name ] = "inherit";
6533 }
6534
6535 // If a hook was provided, use that value, otherwise just set the specified value
6536 if ( !hooks || !( "set" in hooks ) ||
6537 ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
6538
6539 if ( isCustomProp ) {
6540 style.setProperty( name, value );
6541 } else {
6542 style[ name ] = value;
6543 }
6544 }
6545
6546 } else {
6547
6548 // If a hook was provided get the non-computed value from there
6549 if ( hooks && "get" in hooks &&
6550 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
6551
6552 return ret;
6553 }
6554
6555 // Otherwise just get the value from the style object
6556 return style[ name ];
6557 }
6558 },
6559
6560 css: function( elem, name, extra, styles ) {
6561 var val, num, hooks,
6562 origName = camelCase( name ),
6563 isCustomProp = rcustomProp.test( name );
6564
6565 // Make sure that we're working with the right name. We don't
6566 // want to modify the value if it is a CSS custom property
6567 // since they are user-defined.
6568 if ( !isCustomProp ) {
6569 name = finalPropName( origName );
6570 }
6571
6572 // Try prefixed name followed by the unprefixed name
6573 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
6574
6575 // If a hook was provided get the computed value from there
6576 if ( hooks && "get" in hooks ) {
6577 val = hooks.get( elem, true, extra );
6578 }
6579
6580 // Otherwise, if a way to get the computed value exists, use that
6581 if ( val === undefined ) {
6582 val = curCSS( elem, name, styles );
6583 }
6584
6585 // Convert "normal" to computed value
6586 if ( val === "normal" && name in cssNormalTransform ) {
6587 val = cssNormalTransform[ name ];
6588 }
6589
6590 // Make numeric if forced or a qualifier was provided and val looks numeric
6591 if ( extra === "" || extra ) {
6592 num = parseFloat( val );
6593 return extra === true || isFinite( num ) ? num || 0 : val;
6594 }
6595
6596 return val;
6597 }
6598} );
6599
6600jQuery.each( [ "height", "width" ], function( i, dimension ) {
6601 jQuery.cssHooks[ dimension ] = {
6602 get: function( elem, computed, extra ) {
6603 if ( computed ) {
6604
6605 // Certain elements can have dimension info if we invisibly show them
6606 // but it must have a current display style that would benefit
6607 return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
6608
6609 // Support: Safari 8+
6610 // Table columns in Safari have non-zero offsetWidth & zero
6611 // getBoundingClientRect().width unless display is changed.
6612 // Support: IE <=11 only
6613 // Running getBoundingClientRect on a disconnected node
6614 // in IE throws an error.
6615 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
6616 swap( elem, cssShow, function() {
6617 return getWidthOrHeight( elem, dimension, extra );
6618 } ) :
6619 getWidthOrHeight( elem, dimension, extra );
6620 }
6621 },
6622
6623 set: function( elem, value, extra ) {
6624 var matches,
6625 styles = getStyles( elem ),
6626
6627 // Only read styles.position if the test has a chance to fail
6628 // to avoid forcing a reflow.
6629 scrollboxSizeBuggy = !support.scrollboxSize() &&
6630 styles.position === "absolute",
6631
6632 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
6633 boxSizingNeeded = scrollboxSizeBuggy || extra,
6634 isBorderBox = boxSizingNeeded &&
6635 jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6636 subtract = extra ?
6637 boxModelAdjustment(
6638 elem,
6639 dimension,
6640 extra,
6641 isBorderBox,
6642 styles
6643 ) :
6644 0;
6645
6646 // Account for unreliable border-box dimensions by comparing offset* to computed and
6647 // faking a content-box to get border and padding (gh-3699)
6648 if ( isBorderBox && scrollboxSizeBuggy ) {
6649 subtract -= Math.ceil(
6650 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
6651 parseFloat( styles[ dimension ] ) -
6652 boxModelAdjustment( elem, dimension, "border", false, styles ) -
6653 0.5
6654 );
6655 }
6656
6657 // Convert to pixels if value adjustment is needed
6658 if ( subtract && ( matches = rcssNum.exec( value ) ) &&
6659 ( matches[ 3 ] || "px" ) !== "px" ) {
6660
6661 elem.style[ dimension ] = value;
6662 value = jQuery.css( elem, dimension );
6663 }
6664
6665 return setPositiveNumber( elem, value, subtract );
6666 }
6667 };
6668} );
6669
6670jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
6671 function( elem, computed ) {
6672 if ( computed ) {
6673 return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
6674 elem.getBoundingClientRect().left -
6675 swap( elem, { marginLeft: 0 }, function() {
6676 return elem.getBoundingClientRect().left;
6677 } )
6678 ) + "px";
6679 }
6680 }
6681);
6682
6683// These hooks are used by animate to expand properties
6684jQuery.each( {
6685 margin: "",
6686 padding: "",
6687 border: "Width"
6688}, function( prefix, suffix ) {
6689 jQuery.cssHooks[ prefix + suffix ] = {
6690 expand: function( value ) {
6691 var i = 0,
6692 expanded = {},
6693
6694 // Assumes a single number if not a string
6695 parts = typeof value === "string" ? value.split( " " ) : [ value ];
6696
6697 for ( ; i < 4; i++ ) {
6698 expanded[ prefix + cssExpand[ i ] + suffix ] =
6699 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
6700 }
6701
6702 return expanded;
6703 }
6704 };
6705
6706 if ( prefix !== "margin" ) {
6707 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
6708 }
6709} );
6710
6711jQuery.fn.extend( {
6712 css: function( name, value ) {
6713 return access( this, function( elem, name, value ) {
6714 var styles, len,
6715 map = {},
6716 i = 0;
6717
6718 if ( Array.isArray( name ) ) {
6719 styles = getStyles( elem );
6720 len = name.length;
6721
6722 for ( ; i < len; i++ ) {
6723 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
6724 }
6725
6726 return map;
6727 }
6728
6729 return value !== undefined ?
6730 jQuery.style( elem, name, value ) :
6731 jQuery.css( elem, name );
6732 }, name, value, arguments.length > 1 );
6733 }
6734} );
6735
6736
6737function Tween( elem, options, prop, end, easing ) {
6738 return new Tween.prototype.init( elem, options, prop, end, easing );
6739}
6740jQuery.Tween = Tween;
6741
6742Tween.prototype = {
6743 constructor: Tween,
6744 init: function( elem, options, prop, end, easing, unit ) {
6745 this.elem = elem;
6746 this.prop = prop;
6747 this.easing = easing || jQuery.easing._default;
6748 this.options = options;
6749 this.start = this.now = this.cur();
6750 this.end = end;
6751 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
6752 },
6753 cur: function() {
6754 var hooks = Tween.propHooks[ this.prop ];
6755
6756 return hooks && hooks.get ?
6757 hooks.get( this ) :
6758 Tween.propHooks._default.get( this );
6759 },
6760 run: function( percent ) {
6761 var eased,
6762 hooks = Tween.propHooks[ this.prop ];
6763
6764 if ( this.options.duration ) {
6765 this.pos = eased = jQuery.easing[ this.easing ](
6766 percent, this.options.duration * percent, 0, 1, this.options.duration
6767 );
6768 } else {
6769 this.pos = eased = percent;
6770 }
6771 this.now = ( this.end - this.start ) * eased + this.start;
6772
6773 if ( this.options.step ) {
6774 this.options.step.call( this.elem, this.now, this );
6775 }
6776
6777 if ( hooks && hooks.set ) {
6778 hooks.set( this );
6779 } else {
6780 Tween.propHooks._default.set( this );
6781 }
6782 return this;
6783 }
6784};
6785
6786Tween.prototype.init.prototype = Tween.prototype;
6787
6788Tween.propHooks = {
6789 _default: {
6790 get: function( tween ) {
6791 var result;
6792
6793 // Use a property on the element directly when it is not a DOM element,
6794 // or when there is no matching style property that exists.
6795 if ( tween.elem.nodeType !== 1 ||
6796 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
6797 return tween.elem[ tween.prop ];
6798 }
6799
6800 // Passing an empty string as a 3rd parameter to .css will automatically
6801 // attempt a parseFloat and fallback to a string if the parse fails.
6802 // Simple values such as "10px" are parsed to Float;
6803 // complex values such as "rotate(1rad)" are returned as-is.
6804 result = jQuery.css( tween.elem, tween.prop, "" );
6805
6806 // Empty strings, null, undefined and "auto" are converted to 0.
6807 return !result || result === "auto" ? 0 : result;
6808 },
6809 set: function( tween ) {
6810
6811 // Use step hook for back compat.
6812 // Use cssHook if its there.
6813 // Use .style if available and use plain properties where available.
6814 if ( jQuery.fx.step[ tween.prop ] ) {
6815 jQuery.fx.step[ tween.prop ]( tween );
6816 } else if ( tween.elem.nodeType === 1 && (
6817 jQuery.cssHooks[ tween.prop ] ||
6818 tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) {
6819 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
6820 } else {
6821 tween.elem[ tween.prop ] = tween.now;
6822 }
6823 }
6824 }
6825};
6826
6827// Support: IE <=9 only
6828// Panic based approach to setting things on disconnected nodes
6829Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
6830 set: function( tween ) {
6831 if ( tween.elem.nodeType && tween.elem.parentNode ) {
6832 tween.elem[ tween.prop ] = tween.now;
6833 }
6834 }
6835};
6836
6837jQuery.easing = {
6838 linear: function( p ) {
6839 return p;
6840 },
6841 swing: function( p ) {
6842 return 0.5 - Math.cos( p * Math.PI ) / 2;
6843 },
6844 _default: "swing"
6845};
6846
6847jQuery.fx = Tween.prototype.init;
6848
6849// Back compat <1.8 extension point
6850jQuery.fx.step = {};
6851
6852
6853
6854
6855var
6856 fxNow, inProgress,
6857 rfxtypes = /^(?:toggle|show|hide)$/,
6858 rrun = /queueHooks$/;
6859
6860function schedule() {
6861 if ( inProgress ) {
6862 if ( document.hidden === false && window.requestAnimationFrame ) {
6863 window.requestAnimationFrame( schedule );
6864 } else {
6865 window.setTimeout( schedule, jQuery.fx.interval );
6866 }
6867
6868 jQuery.fx.tick();
6869 }
6870}
6871
6872// Animations created synchronously will run synchronously
6873function createFxNow() {
6874 window.setTimeout( function() {
6875 fxNow = undefined;
6876 } );
6877 return ( fxNow = Date.now() );
6878}
6879
6880// Generate parameters to create a standard animation
6881function genFx( type, includeWidth ) {
6882 var which,
6883 i = 0,
6884 attrs = { height: type };
6885
6886 // If we include width, step value is 1 to do all cssExpand values,
6887 // otherwise step value is 2 to skip over Left and Right
6888 includeWidth = includeWidth ? 1 : 0;
6889 for ( ; i < 4; i += 2 - includeWidth ) {
6890 which = cssExpand[ i ];
6891 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
6892 }
6893
6894 if ( includeWidth ) {
6895 attrs.opacity = attrs.width = type;
6896 }
6897
6898 return attrs;
6899}
6900
6901function createTween( value, prop, animation ) {
6902 var tween,
6903 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
6904 index = 0,
6905 length = collection.length;
6906 for ( ; index < length; index++ ) {
6907 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
6908
6909 // We're done with this property
6910 return tween;
6911 }
6912 }
6913}
6914
6915function defaultPrefilter( elem, props, opts ) {
6916 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
6917 isBox = "width" in props || "height" in props,
6918 anim = this,
6919 orig = {},
6920 style = elem.style,
6921 hidden = elem.nodeType && isHiddenWithinTree( elem ),
6922 dataShow = dataPriv.get( elem, "fxshow" );
6923
6924 // Queue-skipping animations hijack the fx hooks
6925 if ( !opts.queue ) {
6926 hooks = jQuery._queueHooks( elem, "fx" );
6927 if ( hooks.unqueued == null ) {
6928 hooks.unqueued = 0;
6929 oldfire = hooks.empty.fire;
6930 hooks.empty.fire = function() {
6931 if ( !hooks.unqueued ) {
6932 oldfire();
6933 }
6934 };
6935 }
6936 hooks.unqueued++;
6937
6938 anim.always( function() {
6939
6940 // Ensure the complete handler is called before this completes
6941 anim.always( function() {
6942 hooks.unqueued--;
6943 if ( !jQuery.queue( elem, "fx" ).length ) {
6944 hooks.empty.fire();
6945 }
6946 } );
6947 } );
6948 }
6949
6950 // Detect show/hide animations
6951 for ( prop in props ) {
6952 value = props[ prop ];
6953 if ( rfxtypes.test( value ) ) {
6954 delete props[ prop ];
6955 toggle = toggle || value === "toggle";
6956 if ( value === ( hidden ? "hide" : "show" ) ) {
6957
6958 // Pretend to be hidden if this is a "show" and
6959 // there is still data from a stopped show/hide
6960 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
6961 hidden = true;
6962
6963 // Ignore all other no-op show/hide data
6964 } else {
6965 continue;
6966 }
6967 }
6968 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
6969 }
6970 }
6971
6972 // Bail out if this is a no-op like .hide().hide()
6973 propTween = !jQuery.isEmptyObject( props );
6974 if ( !propTween && jQuery.isEmptyObject( orig ) ) {
6975 return;
6976 }
6977
6978 // Restrict "overflow" and "display" styles during box animations
6979 if ( isBox && elem.nodeType === 1 ) {
6980
6981 // Support: IE <=9 - 11, Edge 12 - 15
6982 // Record all 3 overflow attributes because IE does not infer the shorthand
6983 // from identically-valued overflowX and overflowY and Edge just mirrors
6984 // the overflowX value there.
6985 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
6986
6987 // Identify a display type, preferring old show/hide data over the CSS cascade
6988 restoreDisplay = dataShow && dataShow.display;
6989 if ( restoreDisplay == null ) {
6990 restoreDisplay = dataPriv.get( elem, "display" );
6991 }
6992 display = jQuery.css( elem, "display" );
6993 if ( display === "none" ) {
6994 if ( restoreDisplay ) {
6995 display = restoreDisplay;
6996 } else {
6997
6998 // Get nonempty value(s) by temporarily forcing visibility
6999 showHide( [ elem ], true );
7000 restoreDisplay = elem.style.display || restoreDisplay;
7001 display = jQuery.css( elem, "display" );
7002 showHide( [ elem ] );
7003 }
7004 }
7005
7006 // Animate inline elements as inline-block
7007 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
7008 if ( jQuery.css( elem, "float" ) === "none" ) {
7009
7010 // Restore the original display value at the end of pure show/hide animations
7011 if ( !propTween ) {
7012 anim.done( function() {
7013 style.display = restoreDisplay;
7014 } );
7015 if ( restoreDisplay == null ) {
7016 display = style.display;
7017 restoreDisplay = display === "none" ? "" : display;
7018 }
7019 }
7020 style.display = "inline-block";
7021 }
7022 }
7023 }
7024
7025 if ( opts.overflow ) {
7026 style.overflow = "hidden";
7027 anim.always( function() {
7028 style.overflow = opts.overflow[ 0 ];
7029 style.overflowX = opts.overflow[ 1 ];
7030 style.overflowY = opts.overflow[ 2 ];
7031 } );
7032 }
7033
7034 // Implement show/hide animations
7035 propTween = false;
7036 for ( prop in orig ) {
7037
7038 // General show/hide setup for this element animation
7039 if ( !propTween ) {
7040 if ( dataShow ) {
7041 if ( "hidden" in dataShow ) {
7042 hidden = dataShow.hidden;
7043 }
7044 } else {
7045 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
7046 }
7047
7048 // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
7049 if ( toggle ) {
7050 dataShow.hidden = !hidden;
7051 }
7052
7053 // Show elements before animating them
7054 if ( hidden ) {
7055 showHide( [ elem ], true );
7056 }
7057
7058 /* eslint-disable no-loop-func */
7059
7060 anim.done( function() {
7061
7062 /* eslint-enable no-loop-func */
7063
7064 // The final step of a "hide" animation is actually hiding the element
7065 if ( !hidden ) {
7066 showHide( [ elem ] );
7067 }
7068 dataPriv.remove( elem, "fxshow" );
7069 for ( prop in orig ) {
7070 jQuery.style( elem, prop, orig[ prop ] );
7071 }
7072 } );
7073 }
7074
7075 // Per-property setup
7076 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
7077 if ( !( prop in dataShow ) ) {
7078 dataShow[ prop ] = propTween.start;
7079 if ( hidden ) {
7080 propTween.end = propTween.start;
7081 propTween.start = 0;
7082 }
7083 }
7084 }
7085}
7086
7087function propFilter( props, specialEasing ) {
7088 var index, name, easing, value, hooks;
7089
7090 // camelCase, specialEasing and expand cssHook pass
7091 for ( index in props ) {
7092 name = camelCase( index );
7093 easing = specialEasing[ name ];
7094 value = props[ index ];
7095 if ( Array.isArray( value ) ) {
7096 easing = value[ 1 ];
7097 value = props[ index ] = value[ 0 ];
7098 }
7099
7100 if ( index !== name ) {
7101 props[ name ] = value;
7102 delete props[ index ];
7103 }
7104
7105 hooks = jQuery.cssHooks[ name ];
7106 if ( hooks && "expand" in hooks ) {
7107 value = hooks.expand( value );
7108 delete props[ name ];
7109
7110 // Not quite $.extend, this won't overwrite existing keys.
7111 // Reusing 'index' because we have the correct "name"
7112 for ( index in value ) {
7113 if ( !( index in props ) ) {
7114 props[ index ] = value[ index ];
7115 specialEasing[ index ] = easing;
7116 }
7117 }
7118 } else {
7119 specialEasing[ name ] = easing;
7120 }
7121 }
7122}
7123
7124function Animation( elem, properties, options ) {
7125 var result,
7126 stopped,
7127 index = 0,
7128 length = Animation.prefilters.length,
7129 deferred = jQuery.Deferred().always( function() {
7130
7131 // Don't match elem in the :animated selector
7132 delete tick.elem;
7133 } ),
7134 tick = function() {
7135 if ( stopped ) {
7136 return false;
7137 }
7138 var currentTime = fxNow || createFxNow(),
7139 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
7140
7141 // Support: Android 2.3 only
7142 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
7143 temp = remaining / animation.duration || 0,
7144 percent = 1 - temp,
7145 index = 0,
7146 length = animation.tweens.length;
7147
7148 for ( ; index < length; index++ ) {
7149 animation.tweens[ index ].run( percent );
7150 }
7151
7152 deferred.notifyWith( elem, [ animation, percent, remaining ] );
7153
7154 // If there's more to do, yield
7155 if ( percent < 1 && length ) {
7156 return remaining;
7157 }
7158
7159 // If this was an empty animation, synthesize a final progress notification
7160 if ( !length ) {
7161 deferred.notifyWith( elem, [ animation, 1, 0 ] );
7162 }
7163
7164 // Resolve the animation and report its conclusion
7165 deferred.resolveWith( elem, [ animation ] );
7166 return false;
7167 },
7168 animation = deferred.promise( {
7169 elem: elem,
7170 props: jQuery.extend( {}, properties ),
7171 opts: jQuery.extend( true, {
7172 specialEasing: {},
7173 easing: jQuery.easing._default
7174 }, options ),
7175 originalProperties: properties,
7176 originalOptions: options,
7177 startTime: fxNow || createFxNow(),
7178 duration: options.duration,
7179 tweens: [],
7180 createTween: function( prop, end ) {
7181 var tween = jQuery.Tween( elem, animation.opts, prop, end,
7182 animation.opts.specialEasing[ prop ] || animation.opts.easing );
7183 animation.tweens.push( tween );
7184 return tween;
7185 },
7186 stop: function( gotoEnd ) {
7187 var index = 0,
7188
7189 // If we are going to the end, we want to run all the tweens
7190 // otherwise we skip this part
7191 length = gotoEnd ? animation.tweens.length : 0;
7192 if ( stopped ) {
7193 return this;
7194 }
7195 stopped = true;
7196 for ( ; index < length; index++ ) {
7197 animation.tweens[ index ].run( 1 );
7198 }
7199
7200 // Resolve when we played the last frame; otherwise, reject
7201 if ( gotoEnd ) {
7202 deferred.notifyWith( elem, [ animation, 1, 0 ] );
7203 deferred.resolveWith( elem, [ animation, gotoEnd ] );
7204 } else {
7205 deferred.rejectWith( elem, [ animation, gotoEnd ] );
7206 }
7207 return this;
7208 }
7209 } ),
7210 props = animation.props;
7211
7212 propFilter( props, animation.opts.specialEasing );
7213
7214 for ( ; index < length; index++ ) {
7215 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
7216 if ( result ) {
7217 if ( isFunction( result.stop ) ) {
7218 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
7219 result.stop.bind( result );
7220 }
7221 return result;
7222 }
7223 }
7224
7225 jQuery.map( props, createTween, animation );
7226
7227 if ( isFunction( animation.opts.start ) ) {
7228 animation.opts.start.call( elem, animation );
7229 }
7230
7231 // Attach callbacks from options
7232 animation
7233 .progress( animation.opts.progress )
7234 .done( animation.opts.done, animation.opts.complete )
7235 .fail( animation.opts.fail )
7236 .always( animation.opts.always );
7237
7238 jQuery.fx.timer(
7239 jQuery.extend( tick, {
7240 elem: elem,
7241 anim: animation,
7242 queue: animation.opts.queue
7243 } )
7244 );
7245
7246 return animation;
7247}
7248
7249jQuery.Animation = jQuery.extend( Animation, {
7250
7251 tweeners: {
7252 "*": [ function( prop, value ) {
7253 var tween = this.createTween( prop, value );
7254 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
7255 return tween;
7256 } ]
7257 },
7258
7259 tweener: function( props, callback ) {
7260 if ( isFunction( props ) ) {
7261 callback = props;
7262 props = [ "*" ];
7263 } else {
7264 props = props.match( rnothtmlwhite );
7265 }
7266
7267 var prop,
7268 index = 0,
7269 length = props.length;
7270
7271 for ( ; index < length; index++ ) {
7272 prop = props[ index ];
7273 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
7274 Animation.tweeners[ prop ].unshift( callback );
7275 }
7276 },
7277
7278 prefilters: [ defaultPrefilter ],
7279
7280 prefilter: function( callback, prepend ) {
7281 if ( prepend ) {
7282 Animation.prefilters.unshift( callback );
7283 } else {
7284 Animation.prefilters.push( callback );
7285 }
7286 }
7287} );
7288
7289jQuery.speed = function( speed, easing, fn ) {
7290 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
7291 complete: fn || !fn && easing ||
7292 isFunction( speed ) && speed,
7293 duration: speed,
7294 easing: fn && easing || easing && !isFunction( easing ) && easing
7295 };
7296
7297 // Go to the end state if fx are off
7298 if ( jQuery.fx.off ) {
7299 opt.duration = 0;
7300
7301 } else {
7302 if ( typeof opt.duration !== "number" ) {
7303 if ( opt.duration in jQuery.fx.speeds ) {
7304 opt.duration = jQuery.fx.speeds[ opt.duration ];
7305
7306 } else {
7307 opt.duration = jQuery.fx.speeds._default;
7308 }
7309 }
7310 }
7311
7312 // Normalize opt.queue - true/undefined/null -> "fx"
7313 if ( opt.queue == null || opt.queue === true ) {
7314 opt.queue = "fx";
7315 }
7316
7317 // Queueing
7318 opt.old = opt.complete;
7319
7320 opt.complete = function() {
7321 if ( isFunction( opt.old ) ) {
7322 opt.old.call( this );
7323 }
7324
7325 if ( opt.queue ) {
7326 jQuery.dequeue( this, opt.queue );
7327 }
7328 };
7329
7330 return opt;
7331};
7332
7333jQuery.fn.extend( {
7334 fadeTo: function( speed, to, easing, callback ) {
7335
7336 // Show any hidden elements after setting opacity to 0
7337 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
7338
7339 // Animate to the value specified
7340 .end().animate( { opacity: to }, speed, easing, callback );
7341 },
7342 animate: function( prop, speed, easing, callback ) {
7343 var empty = jQuery.isEmptyObject( prop ),
7344 optall = jQuery.speed( speed, easing, callback ),
7345 doAnimation = function() {
7346
7347 // Operate on a copy of prop so per-property easing won't be lost
7348 var anim = Animation( this, jQuery.extend( {}, prop ), optall );
7349
7350 // Empty animations, or finishing resolves immediately
7351 if ( empty || dataPriv.get( this, "finish" ) ) {
7352 anim.stop( true );
7353 }
7354 };
7355 doAnimation.finish = doAnimation;
7356
7357 return empty || optall.queue === false ?
7358 this.each( doAnimation ) :
7359 this.queue( optall.queue, doAnimation );
7360 },
7361 stop: function( type, clearQueue, gotoEnd ) {
7362 var stopQueue = function( hooks ) {
7363 var stop = hooks.stop;
7364 delete hooks.stop;
7365 stop( gotoEnd );
7366 };
7367
7368 if ( typeof type !== "string" ) {
7369 gotoEnd = clearQueue;
7370 clearQueue = type;
7371 type = undefined;
7372 }
7373 if ( clearQueue && type !== false ) {
7374 this.queue( type || "fx", [] );
7375 }
7376
7377 return this.each( function() {
7378 var dequeue = true,
7379 index = type != null && type + "queueHooks",
7380 timers = jQuery.timers,
7381 data = dataPriv.get( this );
7382
7383 if ( index ) {
7384 if ( data[ index ] && data[ index ].stop ) {
7385 stopQueue( data[ index ] );
7386 }
7387 } else {
7388 for ( index in data ) {
7389 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
7390 stopQueue( data[ index ] );
7391 }
7392 }
7393 }
7394
7395 for ( index = timers.length; index--; ) {
7396 if ( timers[ index ].elem === this &&
7397 ( type == null || timers[ index ].queue === type ) ) {
7398
7399 timers[ index ].anim.stop( gotoEnd );
7400 dequeue = false;
7401 timers.splice( index, 1 );
7402 }
7403 }
7404
7405 // Start the next in the queue if the last step wasn't forced.
7406 // Timers currently will call their complete callbacks, which
7407 // will dequeue but only if they were gotoEnd.
7408 if ( dequeue || !gotoEnd ) {
7409 jQuery.dequeue( this, type );
7410 }
7411 } );
7412 },
7413 finish: function( type ) {
7414 if ( type !== false ) {
7415 type = type || "fx";
7416 }
7417 return this.each( function() {
7418 var index,
7419 data = dataPriv.get( this ),
7420 queue = data[ type + "queue" ],
7421 hooks = data[ type + "queueHooks" ],
7422 timers = jQuery.timers,
7423 length = queue ? queue.length : 0;
7424
7425 // Enable finishing flag on private data
7426 data.finish = true;
7427
7428 // Empty the queue first
7429 jQuery.queue( this, type, [] );
7430
7431 if ( hooks && hooks.stop ) {
7432 hooks.stop.call( this, true );
7433 }
7434
7435 // Look for any active animations, and finish them
7436 for ( index = timers.length; index--; ) {
7437 if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
7438 timers[ index ].anim.stop( true );
7439 timers.splice( index, 1 );
7440 }
7441 }
7442
7443 // Look for any animations in the old queue and finish them
7444 for ( index = 0; index < length; index++ ) {
7445 if ( queue[ index ] && queue[ index ].finish ) {
7446 queue[ index ].finish.call( this );
7447 }
7448 }
7449
7450 // Turn off finishing flag
7451 delete data.finish;
7452 } );
7453 }
7454} );
7455
7456jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
7457 var cssFn = jQuery.fn[ name ];
7458 jQuery.fn[ name ] = function( speed, easing, callback ) {
7459 return speed == null || typeof speed === "boolean" ?
7460 cssFn.apply( this, arguments ) :
7461 this.animate( genFx( name, true ), speed, easing, callback );
7462 };
7463} );
7464
7465// Generate shortcuts for custom animations
7466jQuery.each( {
7467 slideDown: genFx( "show" ),
7468 slideUp: genFx( "hide" ),
7469 slideToggle: genFx( "toggle" ),
7470 fadeIn: { opacity: "show" },
7471 fadeOut: { opacity: "hide" },
7472 fadeToggle: { opacity: "toggle" }
7473}, function( name, props ) {
7474 jQuery.fn[ name ] = function( speed, easing, callback ) {
7475 return this.animate( props, speed, easing, callback );
7476 };
7477} );
7478
7479jQuery.timers = [];
7480jQuery.fx.tick = function() {
7481 var timer,
7482 i = 0,
7483 timers = jQuery.timers;
7484
7485 fxNow = Date.now();
7486
7487 for ( ; i < timers.length; i++ ) {
7488 timer = timers[ i ];
7489
7490 // Run the timer and safely remove it when done (allowing for external removal)
7491 if ( !timer() && timers[ i ] === timer ) {
7492 timers.splice( i--, 1 );
7493 }
7494 }
7495
7496 if ( !timers.length ) {
7497 jQuery.fx.stop();
7498 }
7499 fxNow = undefined;
7500};
7501
7502jQuery.fx.timer = function( timer ) {
7503 jQuery.timers.push( timer );
7504 jQuery.fx.start();
7505};
7506
7507jQuery.fx.interval = 13;
7508jQuery.fx.start = function() {
7509 if ( inProgress ) {
7510 return;
7511 }
7512
7513 inProgress = true;
7514 schedule();
7515};
7516
7517jQuery.fx.stop = function() {
7518 inProgress = null;
7519};
7520
7521jQuery.fx.speeds = {
7522 slow: 600,
7523 fast: 200,
7524
7525 // Default speed
7526 _default: 400
7527};
7528
7529
7530// Based off of the plugin by Clint Helfers, with permission.
7531// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
7532jQuery.fn.delay = function( time, type ) {
7533 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
7534 type = type || "fx";
7535
7536 return this.queue( type, function( next, hooks ) {
7537 var timeout = window.setTimeout( next, time );
7538 hooks.stop = function() {
7539 window.clearTimeout( timeout );
7540 };
7541 } );
7542};
7543
7544
7545( function() {
7546 var input = document.createElement( "input" ),
7547 select = document.createElement( "select" ),
7548 opt = select.appendChild( document.createElement( "option" ) );
7549
7550 input.type = "checkbox";
7551
7552 // Support: Android <=4.3 only
7553 // Default value for a checkbox should be "on"
7554 support.checkOn = input.value !== "";
7555
7556 // Support: IE <=11 only
7557 // Must access selectedIndex to make default options select
7558 support.optSelected = opt.selected;
7559
7560 // Support: IE <=11 only
7561 // An input loses its value after becoming a radio
7562 input = document.createElement( "input" );
7563 input.value = "t";
7564 input.type = "radio";
7565 support.radioValue = input.value === "t";
7566} )();
7567
7568
7569var boolHook,
7570 attrHandle = jQuery.expr.attrHandle;
7571
7572jQuery.fn.extend( {
7573 attr: function( name, value ) {
7574 return access( this, jQuery.attr, name, value, arguments.length > 1 );
7575 },
7576
7577 removeAttr: function( name ) {
7578 return this.each( function() {
7579 jQuery.removeAttr( this, name );
7580 } );
7581 }
7582} );
7583
7584jQuery.extend( {
7585 attr: function( elem, name, value ) {
7586 var ret, hooks,
7587 nType = elem.nodeType;
7588
7589 // Don't get/set attributes on text, comment and attribute nodes
7590 if ( nType === 3 || nType === 8 || nType === 2 ) {
7591 return;
7592 }
7593
7594 // Fallback to prop when attributes are not supported
7595 if ( typeof elem.getAttribute === "undefined" ) {
7596 return jQuery.prop( elem, name, value );
7597 }
7598
7599 // Attribute hooks are determined by the lowercase version
7600 // Grab necessary hook if one is defined
7601 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
7602 hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
7603 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
7604 }
7605
7606 if ( value !== undefined ) {
7607 if ( value === null ) {
7608 jQuery.removeAttr( elem, name );
7609 return;
7610 }
7611
7612 if ( hooks && "set" in hooks &&
7613 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
7614 return ret;
7615 }
7616
7617 elem.setAttribute( name, value + "" );
7618 return value;
7619 }
7620
7621 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
7622 return ret;
7623 }
7624
7625 ret = jQuery.find.attr( elem, name );
7626
7627 // Non-existent attributes return null, we normalize to undefined
7628 return ret == null ? undefined : ret;
7629 },
7630
7631 attrHooks: {
7632 type: {
7633 set: function( elem, value ) {
7634 if ( !support.radioValue && value === "radio" &&
7635 nodeName( elem, "input" ) ) {
7636 var val = elem.value;
7637 elem.setAttribute( "type", value );
7638 if ( val ) {
7639 elem.value = val;
7640 }
7641 return value;
7642 }
7643 }
7644 }
7645 },
7646
7647 removeAttr: function( elem, value ) {
7648 var name,
7649 i = 0,
7650
7651 // Attribute names can contain non-HTML whitespace characters
7652 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
7653 attrNames = value && value.match( rnothtmlwhite );
7654
7655 if ( attrNames && elem.nodeType === 1 ) {
7656 while ( ( name = attrNames[ i++ ] ) ) {
7657 elem.removeAttribute( name );
7658 }
7659 }
7660 }
7661} );
7662
7663// Hooks for boolean attributes
7664boolHook = {
7665 set: function( elem, value, name ) {
7666 if ( value === false ) {
7667
7668 // Remove boolean attributes when set to false
7669 jQuery.removeAttr( elem, name );
7670 } else {
7671 elem.setAttribute( name, name );
7672 }
7673 return name;
7674 }
7675};
7676
7677jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
7678 var getter = attrHandle[ name ] || jQuery.find.attr;
7679
7680 attrHandle[ name ] = function( elem, name, isXML ) {
7681 var ret, handle,
7682 lowercaseName = name.toLowerCase();
7683
7684 if ( !isXML ) {
7685
7686 // Avoid an infinite loop by temporarily removing this function from the getter
7687 handle = attrHandle[ lowercaseName ];
7688 attrHandle[ lowercaseName ] = ret;
7689 ret = getter( elem, name, isXML ) != null ?
7690 lowercaseName :
7691 null;
7692 attrHandle[ lowercaseName ] = handle;
7693 }
7694 return ret;
7695 };
7696} );
7697
7698
7699
7700
7701var rfocusable = /^(?:input|select|textarea|button)$/i,
7702 rclickable = /^(?:a|area)$/i;
7703
7704jQuery.fn.extend( {
7705 prop: function( name, value ) {
7706 return access( this, jQuery.prop, name, value, arguments.length > 1 );
7707 },
7708
7709 removeProp: function( name ) {
7710 return this.each( function() {
7711 delete this[ jQuery.propFix[ name ] || name ];
7712 } );
7713 }
7714} );
7715
7716jQuery.extend( {
7717 prop: function( elem, name, value ) {
7718 var ret, hooks,
7719 nType = elem.nodeType;
7720
7721 // Don't get/set properties on text, comment and attribute nodes
7722 if ( nType === 3 || nType === 8 || nType === 2 ) {
7723 return;
7724 }
7725
7726 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
7727
7728 // Fix name and attach hooks
7729 name = jQuery.propFix[ name ] || name;
7730 hooks = jQuery.propHooks[ name ];
7731 }
7732
7733 if ( value !== undefined ) {
7734 if ( hooks && "set" in hooks &&
7735 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
7736 return ret;
7737 }
7738
7739 return ( elem[ name ] = value );
7740 }
7741
7742 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
7743 return ret;
7744 }
7745
7746 return elem[ name ];
7747 },
7748
7749 propHooks: {
7750 tabIndex: {
7751 get: function( elem ) {
7752
7753 // Support: IE <=9 - 11 only
7754 // elem.tabIndex doesn't always return the
7755 // correct value when it hasn't been explicitly set
7756 // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
7757 // Use proper attribute retrieval(#12072)
7758 var tabindex = jQuery.find.attr( elem, "tabindex" );
7759
7760 if ( tabindex ) {
7761 return parseInt( tabindex, 10 );
7762 }
7763
7764 if (
7765 rfocusable.test( elem.nodeName ) ||
7766 rclickable.test( elem.nodeName ) &&
7767 elem.href
7768 ) {
7769 return 0;
7770 }
7771
7772 return -1;
7773 }
7774 }
7775 },
7776
7777 propFix: {
7778 "for": "htmlFor",
7779 "class": "className"
7780 }
7781} );
7782
7783// Support: IE <=11 only
7784// Accessing the selectedIndex property
7785// forces the browser to respect setting selected
7786// on the option
7787// The getter ensures a default option is selected
7788// when in an optgroup
7789// eslint rule "no-unused-expressions" is disabled for this code
7790// since it considers such accessions noop
7791if ( !support.optSelected ) {
7792 jQuery.propHooks.selected = {
7793 get: function( elem ) {
7794
7795 /* eslint no-unused-expressions: "off" */
7796
7797 var parent = elem.parentNode;
7798 if ( parent && parent.parentNode ) {
7799 parent.parentNode.selectedIndex;
7800 }
7801 return null;
7802 },
7803 set: function( elem ) {
7804
7805 /* eslint no-unused-expressions: "off" */
7806
7807 var parent = elem.parentNode;
7808 if ( parent ) {
7809 parent.selectedIndex;
7810
7811 if ( parent.parentNode ) {
7812 parent.parentNode.selectedIndex;
7813 }
7814 }
7815 }
7816 };
7817}
7818
7819jQuery.each( [
7820 "tabIndex",
7821 "readOnly",
7822 "maxLength",
7823 "cellSpacing",
7824 "cellPadding",
7825 "rowSpan",
7826 "colSpan",
7827 "useMap",
7828 "frameBorder",
7829 "contentEditable"
7830], function() {
7831 jQuery.propFix[ this.toLowerCase() ] = this;
7832} );
7833
7834
7835
7836
7837 // Strip and collapse whitespace according to HTML spec
7838 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
7839 function stripAndCollapse( value ) {
7840 var tokens = value.match( rnothtmlwhite ) || [];
7841 return tokens.join( " " );
7842 }
7843
7844
7845function getClass( elem ) {
7846 return elem.getAttribute && elem.getAttribute( "class" ) || "";
7847}
7848
7849function classesToArray( value ) {
7850 if ( Array.isArray( value ) ) {
7851 return value;
7852 }
7853 if ( typeof value === "string" ) {
7854 return value.match( rnothtmlwhite ) || [];
7855 }
7856 return [];
7857}
7858
7859jQuery.fn.extend( {
7860 addClass: function( value ) {
7861 var classes, elem, cur, curValue, clazz, j, finalValue,
7862 i = 0;
7863
7864 if ( isFunction( value ) ) {
7865 return this.each( function( j ) {
7866 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
7867 } );
7868 }
7869
7870 classes = classesToArray( value );
7871
7872 if ( classes.length ) {
7873 while ( ( elem = this[ i++ ] ) ) {
7874 curValue = getClass( elem );
7875 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
7876
7877 if ( cur ) {
7878 j = 0;
7879 while ( ( clazz = classes[ j++ ] ) ) {
7880 if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
7881 cur += clazz + " ";
7882 }
7883 }
7884
7885 // Only assign if different to avoid unneeded rendering.
7886 finalValue = stripAndCollapse( cur );
7887 if ( curValue !== finalValue ) {
7888 elem.setAttribute( "class", finalValue );
7889 }
7890 }
7891 }
7892 }
7893
7894 return this;
7895 },
7896
7897 removeClass: function( value ) {
7898 var classes, elem, cur, curValue, clazz, j, finalValue,
7899 i = 0;
7900
7901 if ( isFunction( value ) ) {
7902 return this.each( function( j ) {
7903 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
7904 } );
7905 }
7906
7907 if ( !arguments.length ) {
7908 return this.attr( "class", "" );
7909 }
7910
7911 classes = classesToArray( value );
7912
7913 if ( classes.length ) {
7914 while ( ( elem = this[ i++ ] ) ) {
7915 curValue = getClass( elem );
7916
7917 // This expression is here for better compressibility (see addClass)
7918 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
7919
7920 if ( cur ) {
7921 j = 0;
7922 while ( ( clazz = classes[ j++ ] ) ) {
7923
7924 // Remove *all* instances
7925 while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
7926 cur = cur.replace( " " + clazz + " ", " " );
7927 }
7928 }
7929
7930 // Only assign if different to avoid unneeded rendering.
7931 finalValue = stripAndCollapse( cur );
7932 if ( curValue !== finalValue ) {
7933 elem.setAttribute( "class", finalValue );
7934 }
7935 }
7936 }
7937 }
7938
7939 return this;
7940 },
7941
7942 toggleClass: function( value, stateVal ) {
7943 var type = typeof value,
7944 isValidValue = type === "string" || Array.isArray( value );
7945
7946 if ( typeof stateVal === "boolean" && isValidValue ) {
7947 return stateVal ? this.addClass( value ) : this.removeClass( value );
7948 }
7949
7950 if ( isFunction( value ) ) {
7951 return this.each( function( i ) {
7952 jQuery( this ).toggleClass(
7953 value.call( this, i, getClass( this ), stateVal ),
7954 stateVal
7955 );
7956 } );
7957 }
7958
7959 return this.each( function() {
7960 var className, i, self, classNames;
7961
7962 if ( isValidValue ) {
7963
7964 // Toggle individual class names
7965 i = 0;
7966 self = jQuery( this );
7967 classNames = classesToArray( value );
7968
7969 while ( ( className = classNames[ i++ ] ) ) {
7970
7971 // Check each className given, space separated list
7972 if ( self.hasClass( className ) ) {
7973 self.removeClass( className );
7974 } else {
7975 self.addClass( className );
7976 }
7977 }
7978
7979 // Toggle whole class name
7980 } else if ( value === undefined || type === "boolean" ) {
7981 className = getClass( this );
7982 if ( className ) {
7983
7984 // Store className if set
7985 dataPriv.set( this, "__className__", className );
7986 }
7987
7988 // If the element has a class name or if we're passed `false`,
7989 // then remove the whole classname (if there was one, the above saved it).
7990 // Otherwise bring back whatever was previously saved (if anything),
7991 // falling back to the empty string if nothing was stored.
7992 if ( this.setAttribute ) {
7993 this.setAttribute( "class",
7994 className || value === false ?
7995 "" :
7996 dataPriv.get( this, "__className__" ) || ""
7997 );
7998 }
7999 }
8000 } );
8001 },
8002
8003 hasClass: function( selector ) {
8004 var className, elem,
8005 i = 0;
8006
8007 className = " " + selector + " ";
8008 while ( ( elem = this[ i++ ] ) ) {
8009 if ( elem.nodeType === 1 &&
8010 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
8011 return true;
8012 }
8013 }
8014
8015 return false;
8016 }
8017} );
8018
8019
8020
8021
8022var rreturn = /\r/g;
8023
8024jQuery.fn.extend( {
8025 val: function( value ) {
8026 var hooks, ret, valueIsFunction,
8027 elem = this[ 0 ];
8028
8029 if ( !arguments.length ) {
8030 if ( elem ) {
8031 hooks = jQuery.valHooks[ elem.type ] ||
8032 jQuery.valHooks[ elem.nodeName.toLowerCase() ];
8033
8034 if ( hooks &&
8035 "get" in hooks &&
8036 ( ret = hooks.get( elem, "value" ) ) !== undefined
8037 ) {
8038 return ret;
8039 }
8040
8041 ret = elem.value;
8042
8043 // Handle most common string cases
8044 if ( typeof ret === "string" ) {
8045 return ret.replace( rreturn, "" );
8046 }
8047
8048 // Handle cases where value is null/undef or number
8049 return ret == null ? "" : ret;
8050 }
8051
8052 return;
8053 }
8054
8055 valueIsFunction = isFunction( value );
8056
8057 return this.each( function( i ) {
8058 var val;
8059
8060 if ( this.nodeType !== 1 ) {
8061 return;
8062 }
8063
8064 if ( valueIsFunction ) {
8065 val = value.call( this, i, jQuery( this ).val() );
8066 } else {
8067 val = value;
8068 }
8069
8070 // Treat null/undefined as ""; convert numbers to string
8071 if ( val == null ) {
8072 val = "";
8073
8074 } else if ( typeof val === "number" ) {
8075 val += "";
8076
8077 } else if ( Array.isArray( val ) ) {
8078 val = jQuery.map( val, function( value ) {
8079 return value == null ? "" : value + "";
8080 } );
8081 }
8082
8083 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
8084
8085 // If set returns undefined, fall back to normal setting
8086 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
8087 this.value = val;
8088 }
8089 } );
8090 }
8091} );
8092
8093jQuery.extend( {
8094 valHooks: {
8095 option: {
8096 get: function( elem ) {
8097
8098 var val = jQuery.find.attr( elem, "value" );
8099 return val != null ?
8100 val :
8101
8102 // Support: IE <=10 - 11 only
8103 // option.text throws exceptions (#14686, #14858)
8104 // Strip and collapse whitespace
8105 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
8106 stripAndCollapse( jQuery.text( elem ) );
8107 }
8108 },
8109 select: {
8110 get: function( elem ) {
8111 var value, option, i,
8112 options = elem.options,
8113 index = elem.selectedIndex,
8114 one = elem.type === "select-one",
8115 values = one ? null : [],
8116 max = one ? index + 1 : options.length;
8117
8118 if ( index < 0 ) {
8119 i = max;
8120
8121 } else {
8122 i = one ? index : 0;
8123 }
8124
8125 // Loop through all the selected options
8126 for ( ; i < max; i++ ) {
8127 option = options[ i ];
8128
8129 // Support: IE <=9 only
8130 // IE8-9 doesn't update selected after form reset (#2551)
8131 if ( ( option.selected || i === index ) &&
8132
8133 // Don't return options that are disabled or in a disabled optgroup
8134 !option.disabled &&
8135 ( !option.parentNode.disabled ||
8136 !nodeName( option.parentNode, "optgroup" ) ) ) {
8137
8138 // Get the specific value for the option
8139 value = jQuery( option ).val();
8140
8141 // We don't need an array for one selects
8142 if ( one ) {
8143 return value;
8144 }
8145
8146 // Multi-Selects return an array
8147 values.push( value );
8148 }
8149 }
8150
8151 return values;
8152 },
8153
8154 set: function( elem, value ) {
8155 var optionSet, option,
8156 options = elem.options,
8157 values = jQuery.makeArray( value ),
8158 i = options.length;
8159
8160 while ( i-- ) {
8161 option = options[ i ];
8162
8163 /* eslint-disable no-cond-assign */
8164
8165 if ( option.selected =
8166 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
8167 ) {
8168 optionSet = true;
8169 }
8170
8171 /* eslint-enable no-cond-assign */
8172 }
8173
8174 // Force browsers to behave consistently when non-matching value is set
8175 if ( !optionSet ) {
8176 elem.selectedIndex = -1;
8177 }
8178 return values;
8179 }
8180 }
8181 }
8182} );
8183
8184// Radios and checkboxes getter/setter
8185jQuery.each( [ "radio", "checkbox" ], function() {
8186 jQuery.valHooks[ this ] = {
8187 set: function( elem, value ) {
8188 if ( Array.isArray( value ) ) {
8189 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
8190 }
8191 }
8192 };
8193 if ( !support.checkOn ) {
8194 jQuery.valHooks[ this ].get = function( elem ) {
8195 return elem.getAttribute( "value" ) === null ? "on" : elem.value;
8196 };
8197 }
8198} );
8199
8200
8201
8202
8203// Return jQuery for attributes-only inclusion
8204
8205
8206support.focusin = "onfocusin" in window;
8207
8208
8209var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
8210 stopPropagationCallback = function( e ) {
8211 e.stopPropagation();
8212 };
8213
8214jQuery.extend( jQuery.event, {
8215
8216 trigger: function( event, data, elem, onlyHandlers ) {
8217
8218 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
8219 eventPath = [ elem || document ],
8220 type = hasOwn.call( event, "type" ) ? event.type : event,
8221 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
8222
8223 cur = lastElement = tmp = elem = elem || document;
8224
8225 // Don't do events on text and comment nodes
8226 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
8227 return;
8228 }
8229
8230 // focus/blur morphs to focusin/out; ensure we're not firing them right now
8231 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
8232 return;
8233 }
8234
8235 if ( type.indexOf( "." ) > -1 ) {
8236
8237 // Namespaced trigger; create a regexp to match event type in handle()
8238 namespaces = type.split( "." );
8239 type = namespaces.shift();
8240 namespaces.sort();
8241 }
8242 ontype = type.indexOf( ":" ) < 0 && "on" + type;
8243
8244 // Caller can pass in a jQuery.Event object, Object, or just an event type string
8245 event = event[ jQuery.expando ] ?
8246 event :
8247 new jQuery.Event( type, typeof event === "object" && event );
8248
8249 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
8250 event.isTrigger = onlyHandlers ? 2 : 3;
8251 event.namespace = namespaces.join( "." );
8252 event.rnamespace = event.namespace ?
8253 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
8254 null;
8255
8256 // Clean up the event in case it is being reused
8257 event.result = undefined;
8258 if ( !event.target ) {
8259 event.target = elem;
8260 }
8261
8262 // Clone any incoming data and prepend the event, creating the handler arg list
8263 data = data == null ?
8264 [ event ] :
8265 jQuery.makeArray( data, [ event ] );
8266
8267 // Allow special events to draw outside the lines
8268 special = jQuery.event.special[ type ] || {};
8269 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
8270 return;
8271 }
8272
8273 // Determine event propagation path in advance, per W3C events spec (#9951)
8274 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
8275 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
8276
8277 bubbleType = special.delegateType || type;
8278 if ( !rfocusMorph.test( bubbleType + type ) ) {
8279 cur = cur.parentNode;
8280 }
8281 for ( ; cur; cur = cur.parentNode ) {
8282 eventPath.push( cur );
8283 tmp = cur;
8284 }
8285
8286 // Only add window if we got to document (e.g., not plain obj or detached DOM)
8287 if ( tmp === ( elem.ownerDocument || document ) ) {
8288 eventPath.push( tmp.defaultView || tmp.parentWindow || window );
8289 }
8290 }
8291
8292 // Fire handlers on the event path
8293 i = 0;
8294 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
8295 lastElement = cur;
8296 event.type = i > 1 ?
8297 bubbleType :
8298 special.bindType || type;
8299
8300 // jQuery handler
8301 handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
8302 dataPriv.get( cur, "handle" );
8303 if ( handle ) {
8304 handle.apply( cur, data );
8305 }
8306
8307 // Native handler
8308 handle = ontype && cur[ ontype ];
8309 if ( handle && handle.apply && acceptData( cur ) ) {
8310 event.result = handle.apply( cur, data );
8311 if ( event.result === false ) {
8312 event.preventDefault();
8313 }
8314 }
8315 }
8316 event.type = type;
8317
8318 // If nobody prevented the default action, do it now
8319 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
8320
8321 if ( ( !special._default ||
8322 special._default.apply( eventPath.pop(), data ) === false ) &&
8323 acceptData( elem ) ) {
8324
8325 // Call a native DOM method on the target with the same name as the event.
8326 // Don't do default actions on window, that's where global variables be (#6170)
8327 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
8328
8329 // Don't re-trigger an onFOO event when we call its FOO() method
8330 tmp = elem[ ontype ];
8331
8332 if ( tmp ) {
8333 elem[ ontype ] = null;
8334 }
8335
8336 // Prevent re-triggering of the same event, since we already bubbled it above
8337 jQuery.event.triggered = type;
8338
8339 if ( event.isPropagationStopped() ) {
8340 lastElement.addEventListener( type, stopPropagationCallback );
8341 }
8342
8343 elem[ type ]();
8344
8345 if ( event.isPropagationStopped() ) {
8346 lastElement.removeEventListener( type, stopPropagationCallback );
8347 }
8348
8349 jQuery.event.triggered = undefined;
8350
8351 if ( tmp ) {
8352 elem[ ontype ] = tmp;
8353 }
8354 }
8355 }
8356 }
8357
8358 return event.result;
8359 },
8360
8361 // Piggyback on a donor event to simulate a different one
8362 // Used only for `focus(in | out)` events
8363 simulate: function( type, elem, event ) {
8364 var e = jQuery.extend(
8365 new jQuery.Event(),
8366 event,
8367 {
8368 type: type,
8369 isSimulated: true
8370 }
8371 );
8372
8373 jQuery.event.trigger( e, null, elem );
8374 }
8375
8376} );
8377
8378jQuery.fn.extend( {
8379
8380 trigger: function( type, data ) {
8381 return this.each( function() {
8382 jQuery.event.trigger( type, data, this );
8383 } );
8384 },
8385 triggerHandler: function( type, data ) {
8386 var elem = this[ 0 ];
8387 if ( elem ) {
8388 return jQuery.event.trigger( type, data, elem, true );
8389 }
8390 }
8391} );
8392
8393
8394// Support: Firefox <=44
8395// Firefox doesn't have focus(in | out) events
8396// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
8397//
8398// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
8399// focus(in | out) events fire after focus & blur events,
8400// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
8401// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
8402if ( !support.focusin ) {
8403 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
8404
8405 // Attach a single capturing handler on the document while someone wants focusin/focusout
8406 var handler = function( event ) {
8407 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
8408 };
8409
8410 jQuery.event.special[ fix ] = {
8411 setup: function() {
8412 var doc = this.ownerDocument || this,
8413 attaches = dataPriv.access( doc, fix );
8414
8415 if ( !attaches ) {
8416 doc.addEventListener( orig, handler, true );
8417 }
8418 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
8419 },
8420 teardown: function() {
8421 var doc = this.ownerDocument || this,
8422 attaches = dataPriv.access( doc, fix ) - 1;
8423
8424 if ( !attaches ) {
8425 doc.removeEventListener( orig, handler, true );
8426 dataPriv.remove( doc, fix );
8427
8428 } else {
8429 dataPriv.access( doc, fix, attaches );
8430 }
8431 }
8432 };
8433 } );
8434}
8435var location = window.location;
8436
8437var nonce = Date.now();
8438
8439var rquery = ( /\?/ );
8440
8441
8442
8443// Cross-browser xml parsing
8444jQuery.parseXML = function( data ) {
8445 var xml;
8446 if ( !data || typeof data !== "string" ) {
8447 return null;
8448 }
8449
8450 // Support: IE 9 - 11 only
8451 // IE throws on parseFromString with invalid input.
8452 try {
8453 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
8454 } catch ( e ) {
8455 xml = undefined;
8456 }
8457
8458 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
8459 jQuery.error( "Invalid XML: " + data );
8460 }
8461 return xml;
8462};
8463
8464
8465var
8466 rbracket = /\[\]$/,
8467 rCRLF = /\r?\n/g,
8468 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
8469 rsubmittable = /^(?:input|select|textarea|keygen)/i;
8470
8471function buildParams( prefix, obj, traditional, add ) {
8472 var name;
8473
8474 if ( Array.isArray( obj ) ) {
8475
8476 // Serialize array item.
8477 jQuery.each( obj, function( i, v ) {
8478 if ( traditional || rbracket.test( prefix ) ) {
8479
8480 // Treat each array item as a scalar.
8481 add( prefix, v );
8482
8483 } else {
8484
8485 // Item is non-scalar (array or object), encode its numeric index.
8486 buildParams(
8487 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
8488 v,
8489 traditional,
8490 add
8491 );
8492 }
8493 } );
8494
8495 } else if ( !traditional && toType( obj ) === "object" ) {
8496
8497 // Serialize object item.
8498 for ( name in obj ) {
8499 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
8500 }
8501
8502 } else {
8503
8504 // Serialize scalar item.
8505 add( prefix, obj );
8506 }
8507}
8508
8509// Serialize an array of form elements or a set of
8510// key/values into a query string
8511jQuery.param = function( a, traditional ) {
8512 var prefix,
8513 s = [],
8514 add = function( key, valueOrFunction ) {
8515
8516 // If value is a function, invoke it and use its return value
8517 var value = isFunction( valueOrFunction ) ?
8518 valueOrFunction() :
8519 valueOrFunction;
8520
8521 s[ s.length ] = encodeURIComponent( key ) + "=" +
8522 encodeURIComponent( value == null ? "" : value );
8523 };
8524
8525 if ( a == null ) {
8526 return "";
8527 }
8528
8529 // If an array was passed in, assume that it is an array of form elements.
8530 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
8531
8532 // Serialize the form elements
8533 jQuery.each( a, function() {
8534 add( this.name, this.value );
8535 } );
8536
8537 } else {
8538
8539 // If traditional, encode the "old" way (the way 1.3.2 or older
8540 // did it), otherwise encode params recursively.
8541 for ( prefix in a ) {
8542 buildParams( prefix, a[ prefix ], traditional, add );
8543 }
8544 }
8545
8546 // Return the resulting serialization
8547 return s.join( "&" );
8548};
8549
8550jQuery.fn.extend( {
8551 serialize: function() {
8552 return jQuery.param( this.serializeArray() );
8553 },
8554 serializeArray: function() {
8555 return this.map( function() {
8556
8557 // Can add propHook for "elements" to filter or add form elements
8558 var elements = jQuery.prop( this, "elements" );
8559 return elements ? jQuery.makeArray( elements ) : this;
8560 } )
8561 .filter( function() {
8562 var type = this.type;
8563
8564 // Use .is( ":disabled" ) so that fieldset[disabled] works
8565 return this.name && !jQuery( this ).is( ":disabled" ) &&
8566 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
8567 ( this.checked || !rcheckableType.test( type ) );
8568 } )
8569 .map( function( i, elem ) {
8570 var val = jQuery( this ).val();
8571
8572 if ( val == null ) {
8573 return null;
8574 }
8575
8576 if ( Array.isArray( val ) ) {
8577 return jQuery.map( val, function( val ) {
8578 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
8579 } );
8580 }
8581
8582 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
8583 } ).get();
8584 }
8585} );
8586
8587
8588var
8589 r20 = /%20/g,
8590 rhash = /#.*$/,
8591 rantiCache = /([?&])_=[^&]*/,
8592 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
8593
8594 // #7653, #8125, #8152: local protocol detection
8595 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
8596 rnoContent = /^(?:GET|HEAD)$/,
8597 rprotocol = /^\/\//,
8598
8599 /* Prefilters
8600 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
8601 * 2) These are called:
8602 * - BEFORE asking for a transport
8603 * - AFTER param serialization (s.data is a string if s.processData is true)
8604 * 3) key is the dataType
8605 * 4) the catchall symbol "*" can be used
8606 * 5) execution will start with transport dataType and THEN continue down to "*" if needed
8607 */
8608 prefilters = {},
8609
8610 /* Transports bindings
8611 * 1) key is the dataType
8612 * 2) the catchall symbol "*" can be used
8613 * 3) selection will start with transport dataType and THEN go to "*" if needed
8614 */
8615 transports = {},
8616
8617 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
8618 allTypes = "*/".concat( "*" ),
8619
8620 // Anchor tag for parsing the document origin
8621 originAnchor = document.createElement( "a" );
8622 originAnchor.href = location.href;
8623
8624// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
8625function addToPrefiltersOrTransports( structure ) {
8626
8627 // dataTypeExpression is optional and defaults to "*"
8628 return function( dataTypeExpression, func ) {
8629
8630 if ( typeof dataTypeExpression !== "string" ) {
8631 func = dataTypeExpression;
8632 dataTypeExpression = "*";
8633 }
8634
8635 var dataType,
8636 i = 0,
8637 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
8638
8639 if ( isFunction( func ) ) {
8640
8641 // For each dataType in the dataTypeExpression
8642 while ( ( dataType = dataTypes[ i++ ] ) ) {
8643
8644 // Prepend if requested
8645 if ( dataType[ 0 ] === "+" ) {
8646 dataType = dataType.slice( 1 ) || "*";
8647 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
8648
8649 // Otherwise append
8650 } else {
8651 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
8652 }
8653 }
8654 }
8655 };
8656}
8657
8658// Base inspection function for prefilters and transports
8659function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
8660
8661 var inspected = {},
8662 seekingTransport = ( structure === transports );
8663
8664 function inspect( dataType ) {
8665 var selected;
8666 inspected[ dataType ] = true;
8667 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
8668 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
8669 if ( typeof dataTypeOrTransport === "string" &&
8670 !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
8671
8672 options.dataTypes.unshift( dataTypeOrTransport );
8673 inspect( dataTypeOrTransport );
8674 return false;
8675 } else if ( seekingTransport ) {
8676 return !( selected = dataTypeOrTransport );
8677 }
8678 } );
8679 return selected;
8680 }
8681
8682 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
8683}
8684
8685// A special extend for ajax options
8686// that takes "flat" options (not to be deep extended)
8687// Fixes #9887
8688function ajaxExtend( target, src ) {
8689 var key, deep,
8690 flatOptions = jQuery.ajaxSettings.flatOptions || {};
8691
8692 for ( key in src ) {
8693 if ( src[ key ] !== undefined ) {
8694 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
8695 }
8696 }
8697 if ( deep ) {
8698 jQuery.extend( true, target, deep );
8699 }
8700
8701 return target;
8702}
8703
8704/* Handles responses to an ajax request:
8705 * - finds the right dataType (mediates between content-type and expected dataType)
8706 * - returns the corresponding response
8707 */
8708function ajaxHandleResponses( s, jqXHR, responses ) {
8709
8710 var ct, type, finalDataType, firstDataType,
8711 contents = s.contents,
8712 dataTypes = s.dataTypes;
8713
8714 // Remove auto dataType and get content-type in the process
8715 while ( dataTypes[ 0 ] === "*" ) {
8716 dataTypes.shift();
8717 if ( ct === undefined ) {
8718 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
8719 }
8720 }
8721
8722 // Check if we're dealing with a known content-type
8723 if ( ct ) {
8724 for ( type in contents ) {
8725 if ( contents[ type ] && contents[ type ].test( ct ) ) {
8726 dataTypes.unshift( type );
8727 break;
8728 }
8729 }
8730 }
8731
8732 // Check to see if we have a response for the expected dataType
8733 if ( dataTypes[ 0 ] in responses ) {
8734 finalDataType = dataTypes[ 0 ];
8735 } else {
8736
8737 // Try convertible dataTypes
8738 for ( type in responses ) {
8739 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
8740 finalDataType = type;
8741 break;
8742 }
8743 if ( !firstDataType ) {
8744 firstDataType = type;
8745 }
8746 }
8747
8748 // Or just use first one
8749 finalDataType = finalDataType || firstDataType;
8750 }
8751
8752 // If we found a dataType
8753 // We add the dataType to the list if needed
8754 // and return the corresponding response
8755 if ( finalDataType ) {
8756 if ( finalDataType !== dataTypes[ 0 ] ) {
8757 dataTypes.unshift( finalDataType );
8758 }
8759 return responses[ finalDataType ];
8760 }
8761}
8762
8763/* Chain conversions given the request and the original response
8764 * Also sets the responseXXX fields on the jqXHR instance
8765 */
8766function ajaxConvert( s, response, jqXHR, isSuccess ) {
8767 var conv2, current, conv, tmp, prev,
8768 converters = {},
8769
8770 // Work with a copy of dataTypes in case we need to modify it for conversion
8771 dataTypes = s.dataTypes.slice();
8772
8773 // Create converters map with lowercased keys
8774 if ( dataTypes[ 1 ] ) {
8775 for ( conv in s.converters ) {
8776 converters[ conv.toLowerCase() ] = s.converters[ conv ];
8777 }
8778 }
8779
8780 current = dataTypes.shift();
8781
8782 // Convert to each sequential dataType
8783 while ( current ) {
8784
8785 if ( s.responseFields[ current ] ) {
8786 jqXHR[ s.responseFields[ current ] ] = response;
8787 }
8788
8789 // Apply the dataFilter if provided
8790 if ( !prev && isSuccess && s.dataFilter ) {
8791 response = s.dataFilter( response, s.dataType );
8792 }
8793
8794 prev = current;
8795 current = dataTypes.shift();
8796
8797 if ( current ) {
8798
8799 // There's only work to do if current dataType is non-auto
8800 if ( current === "*" ) {
8801
8802 current = prev;
8803
8804 // Convert response if prev dataType is non-auto and differs from current
8805 } else if ( prev !== "*" && prev !== current ) {
8806
8807 // Seek a direct converter
8808 conv = converters[ prev + " " + current ] || converters[ "* " + current ];
8809
8810 // If none found, seek a pair
8811 if ( !conv ) {
8812 for ( conv2 in converters ) {
8813
8814 // If conv2 outputs current
8815 tmp = conv2.split( " " );
8816 if ( tmp[ 1 ] === current ) {
8817
8818 // If prev can be converted to accepted input
8819 conv = converters[ prev + " " + tmp[ 0 ] ] ||
8820 converters[ "* " + tmp[ 0 ] ];
8821 if ( conv ) {
8822
8823 // Condense equivalence converters
8824 if ( conv === true ) {
8825 conv = converters[ conv2 ];
8826
8827 // Otherwise, insert the intermediate dataType
8828 } else if ( converters[ conv2 ] !== true ) {
8829 current = tmp[ 0 ];
8830 dataTypes.unshift( tmp[ 1 ] );
8831 }
8832 break;
8833 }
8834 }
8835 }
8836 }
8837
8838 // Apply converter (if not an equivalence)
8839 if ( conv !== true ) {
8840
8841 // Unless errors are allowed to bubble, catch and return them
8842 if ( conv && s.throws ) {
8843 response = conv( response );
8844 } else {
8845 try {
8846 response = conv( response );
8847 } catch ( e ) {
8848 return {
8849 state: "parsererror",
8850 error: conv ? e : "No conversion from " + prev + " to " + current
8851 };
8852 }
8853 }
8854 }
8855 }
8856 }
8857 }
8858
8859 return { state: "success", data: response };
8860}
8861
8862jQuery.extend( {
8863
8864 // Counter for holding the number of active queries
8865 active: 0,
8866
8867 // Last-Modified header cache for next request
8868 lastModified: {},
8869 etag: {},
8870
8871 ajaxSettings: {
8872 url: location.href,
8873 type: "GET",
8874 isLocal: rlocalProtocol.test( location.protocol ),
8875 global: true,
8876 processData: true,
8877 async: true,
8878 contentType: "application/x-www-form-urlencoded; charset=UTF-8",
8879
8880 /*
8881 timeout: 0,
8882 data: null,
8883 dataType: null,
8884 username: null,
8885 password: null,
8886 cache: null,
8887 throws: false,
8888 traditional: false,
8889 headers: {},
8890 */
8891
8892 accepts: {
8893 "*": allTypes,
8894 text: "text/plain",
8895 html: "text/html",
8896 xml: "application/xml, text/xml",
8897 json: "application/json, text/javascript"
8898 },
8899
8900 contents: {
8901 xml: /\bxml\b/,
8902 html: /\bhtml/,
8903 json: /\bjson\b/
8904 },
8905
8906 responseFields: {
8907 xml: "responseXML",
8908 text: "responseText",
8909 json: "responseJSON"
8910 },
8911
8912 // Data converters
8913 // Keys separate source (or catchall "*") and destination types with a single space
8914 converters: {
8915
8916 // Convert anything to text
8917 "* text": String,
8918
8919 // Text to html (true = no transformation)
8920 "text html": true,
8921
8922 // Evaluate text as a json expression
8923 "text json": JSON.parse,
8924
8925 // Parse text as xml
8926 "text xml": jQuery.parseXML
8927 },
8928
8929 // For options that shouldn't be deep extended:
8930 // you can add your own custom options here if
8931 // and when you create one that shouldn't be
8932 // deep extended (see ajaxExtend)
8933 flatOptions: {
8934 url: true,
8935 context: true
8936 }
8937 },
8938
8939 // Creates a full fledged settings object into target
8940 // with both ajaxSettings and settings fields.
8941 // If target is omitted, writes into ajaxSettings.
8942 ajaxSetup: function( target, settings ) {
8943 return settings ?
8944
8945 // Building a settings object
8946 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
8947
8948 // Extending ajaxSettings
8949 ajaxExtend( jQuery.ajaxSettings, target );
8950 },
8951
8952 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
8953 ajaxTransport: addToPrefiltersOrTransports( transports ),
8954
8955 // Main method
8956 ajax: function( url, options ) {
8957
8958 // If url is an object, simulate pre-1.5 signature
8959 if ( typeof url === "object" ) {
8960 options = url;
8961 url = undefined;
8962 }
8963
8964 // Force options to be an object
8965 options = options || {};
8966
8967 var transport,
8968
8969 // URL without anti-cache param
8970 cacheURL,
8971
8972 // Response headers
8973 responseHeadersString,
8974 responseHeaders,
8975
8976 // timeout handle
8977 timeoutTimer,
8978
8979 // Url cleanup var
8980 urlAnchor,
8981
8982 // Request state (becomes false upon send and true upon completion)
8983 completed,
8984
8985 // To know if global events are to be dispatched
8986 fireGlobals,
8987
8988 // Loop variable
8989 i,
8990
8991 // uncached part of the url
8992 uncached,
8993
8994 // Create the final options object
8995 s = jQuery.ajaxSetup( {}, options ),
8996
8997 // Callbacks context
8998 callbackContext = s.context || s,
8999
9000 // Context for global events is callbackContext if it is a DOM node or jQuery collection
9001 globalEventContext = s.context &&
9002 ( callbackContext.nodeType || callbackContext.jquery ) ?
9003 jQuery( callbackContext ) :
9004 jQuery.event,
9005
9006 // Deferreds
9007 deferred = jQuery.Deferred(),
9008 completeDeferred = jQuery.Callbacks( "once memory" ),
9009
9010 // Status-dependent callbacks
9011 statusCode = s.statusCode || {},
9012
9013 // Headers (they are sent all at once)
9014 requestHeaders = {},
9015 requestHeadersNames = {},
9016
9017 // Default abort message
9018 strAbort = "canceled",
9019
9020 // Fake xhr
9021 jqXHR = {
9022 readyState: 0,
9023
9024 // Builds headers hashtable if needed
9025 getResponseHeader: function( key ) {
9026 var match;
9027 if ( completed ) {
9028 if ( !responseHeaders ) {
9029 responseHeaders = {};
9030 while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
9031 responseHeaders[ match[ 1 ].toLowerCase() + " " ] =
9032 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] )
9033 .concat( match[ 2 ] );
9034 }
9035 }
9036 match = responseHeaders[ key.toLowerCase() + " " ];
9037 }
9038 return match == null ? null : match.join( ", " );
9039 },
9040
9041 // Raw string
9042 getAllResponseHeaders: function() {
9043 return completed ? responseHeadersString : null;
9044 },
9045
9046 // Caches the header
9047 setRequestHeader: function( name, value ) {
9048 if ( completed == null ) {
9049 name = requestHeadersNames[ name.toLowerCase() ] =
9050 requestHeadersNames[ name.toLowerCase() ] || name;
9051 requestHeaders[ name ] = value;
9052 }
9053 return this;
9054 },
9055
9056 // Overrides response content-type header
9057 overrideMimeType: function( type ) {
9058 if ( completed == null ) {
9059 s.mimeType = type;
9060 }
9061 return this;
9062 },
9063
9064 // Status-dependent callbacks
9065 statusCode: function( map ) {
9066 var code;
9067 if ( map ) {
9068 if ( completed ) {
9069
9070 // Execute the appropriate callbacks
9071 jqXHR.always( map[ jqXHR.status ] );
9072 } else {
9073
9074 // Lazy-add the new callbacks in a way that preserves old ones
9075 for ( code in map ) {
9076 statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
9077 }
9078 }
9079 }
9080 return this;
9081 },
9082
9083 // Cancel the request
9084 abort: function( statusText ) {
9085 var finalText = statusText || strAbort;
9086 if ( transport ) {
9087 transport.abort( finalText );
9088 }
9089 done( 0, finalText );
9090 return this;
9091 }
9092 };
9093
9094 // Attach deferreds
9095 deferred.promise( jqXHR );
9096
9097 // Add protocol if not provided (prefilters might expect it)
9098 // Handle falsy url in the settings object (#10093: consistency with old signature)
9099 // We also use the url parameter if available
9100 s.url = ( ( url || s.url || location.href ) + "" )
9101 .replace( rprotocol, location.protocol + "//" );
9102
9103 // Alias method option to type as per ticket #12004
9104 s.type = options.method || options.type || s.method || s.type;
9105
9106 // Extract dataTypes list
9107 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
9108
9109 // A cross-domain request is in order when the origin doesn't match the current origin.
9110 if ( s.crossDomain == null ) {
9111 urlAnchor = document.createElement( "a" );
9112
9113 // Support: IE <=8 - 11, Edge 12 - 15
9114 // IE throws exception on accessing the href property if url is malformed,
9115 // e.g. http://example.com:80x/
9116 try {
9117 urlAnchor.href = s.url;
9118
9119 // Support: IE <=8 - 11 only
9120 // Anchor's host property isn't correctly set when s.url is relative
9121 urlAnchor.href = urlAnchor.href;
9122 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
9123 urlAnchor.protocol + "//" + urlAnchor.host;
9124 } catch ( e ) {
9125
9126 // If there is an error parsing the URL, assume it is crossDomain,
9127 // it can be rejected by the transport if it is invalid
9128 s.crossDomain = true;
9129 }
9130 }
9131
9132 // Convert data if not already a string
9133 if ( s.data && s.processData && typeof s.data !== "string" ) {
9134 s.data = jQuery.param( s.data, s.traditional );
9135 }
9136
9137 // Apply prefilters
9138 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
9139
9140 // If request was aborted inside a prefilter, stop there
9141 if ( completed ) {
9142 return jqXHR;
9143 }
9144
9145 // We can fire global events as of now if asked to
9146 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
9147 fireGlobals = jQuery.event && s.global;
9148
9149 // Watch for a new set of requests
9150 if ( fireGlobals && jQuery.active++ === 0 ) {
9151 jQuery.event.trigger( "ajaxStart" );
9152 }
9153
9154 // Uppercase the type
9155 s.type = s.type.toUpperCase();
9156
9157 // Determine if request has content
9158 s.hasContent = !rnoContent.test( s.type );
9159
9160 // Save the URL in case we're toying with the If-Modified-Since
9161 // and/or If-None-Match header later on
9162 // Remove hash to simplify url manipulation
9163 cacheURL = s.url.replace( rhash, "" );
9164
9165 // More options handling for requests with no content
9166 if ( !s.hasContent ) {
9167
9168 // Remember the hash so we can put it back
9169 uncached = s.url.slice( cacheURL.length );
9170
9171 // If data is available and should be processed, append data to url
9172 if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
9173 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
9174
9175 // #9682: remove data so that it's not used in an eventual retry
9176 delete s.data;
9177 }
9178
9179 // Add or update anti-cache param if needed
9180 if ( s.cache === false ) {
9181 cacheURL = cacheURL.replace( rantiCache, "$1" );
9182 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
9183 }
9184
9185 // Put hash and anti-cache on the URL that will be requested (gh-1732)
9186 s.url = cacheURL + uncached;
9187
9188 // Change '%20' to '+' if this is encoded form body content (gh-2658)
9189 } else if ( s.data && s.processData &&
9190 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
9191 s.data = s.data.replace( r20, "+" );
9192 }
9193
9194 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
9195 if ( s.ifModified ) {
9196 if ( jQuery.lastModified[ cacheURL ] ) {
9197 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
9198 }
9199 if ( jQuery.etag[ cacheURL ] ) {
9200 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
9201 }
9202 }
9203
9204 // Set the correct header, if data is being sent
9205 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
9206 jqXHR.setRequestHeader( "Content-Type", s.contentType );
9207 }
9208
9209 // Set the Accepts header for the server, depending on the dataType
9210 jqXHR.setRequestHeader(
9211 "Accept",
9212 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
9213 s.accepts[ s.dataTypes[ 0 ] ] +
9214 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
9215 s.accepts[ "*" ]
9216 );
9217
9218 // Check for headers option
9219 for ( i in s.headers ) {
9220 jqXHR.setRequestHeader( i, s.headers[ i ] );
9221 }
9222
9223 // Allow custom headers/mimetypes and early abort
9224 if ( s.beforeSend &&
9225 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
9226
9227 // Abort if not done already and return
9228 return jqXHR.abort();
9229 }
9230
9231 // Aborting is no longer a cancellation
9232 strAbort = "abort";
9233
9234 // Install callbacks on deferreds
9235 completeDeferred.add( s.complete );
9236 jqXHR.done( s.success );
9237 jqXHR.fail( s.error );
9238
9239 // Get transport
9240 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
9241
9242 // If no transport, we auto-abort
9243 if ( !transport ) {
9244 done( -1, "No Transport" );
9245 } else {
9246 jqXHR.readyState = 1;
9247
9248 // Send global event
9249 if ( fireGlobals ) {
9250 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
9251 }
9252
9253 // If request was aborted inside ajaxSend, stop there
9254 if ( completed ) {
9255 return jqXHR;
9256 }
9257
9258 // Timeout
9259 if ( s.async && s.timeout > 0 ) {
9260 timeoutTimer = window.setTimeout( function() {
9261 jqXHR.abort( "timeout" );
9262 }, s.timeout );
9263 }
9264
9265 try {
9266 completed = false;
9267 transport.send( requestHeaders, done );
9268 } catch ( e ) {
9269
9270 // Rethrow post-completion exceptions
9271 if ( completed ) {
9272 throw e;
9273 }
9274
9275 // Propagate others as results
9276 done( -1, e );
9277 }
9278 }
9279
9280 // Callback for when everything is done
9281 function done( status, nativeStatusText, responses, headers ) {
9282 var isSuccess, success, error, response, modified,
9283 statusText = nativeStatusText;
9284
9285 // Ignore repeat invocations
9286 if ( completed ) {
9287 return;
9288 }
9289
9290 completed = true;
9291
9292 // Clear timeout if it exists
9293 if ( timeoutTimer ) {
9294 window.clearTimeout( timeoutTimer );
9295 }
9296
9297 // Dereference transport for early garbage collection
9298 // (no matter how long the jqXHR object will be used)
9299 transport = undefined;
9300
9301 // Cache response headers
9302 responseHeadersString = headers || "";
9303
9304 // Set readyState
9305 jqXHR.readyState = status > 0 ? 4 : 0;
9306
9307 // Determine if successful
9308 isSuccess = status >= 200 && status < 300 || status === 304;
9309
9310 // Get response data
9311 if ( responses ) {
9312 response = ajaxHandleResponses( s, jqXHR, responses );
9313 }
9314
9315 // Convert no matter what (that way responseXXX fields are always set)
9316 response = ajaxConvert( s, response, jqXHR, isSuccess );
9317
9318 // If successful, handle type chaining
9319 if ( isSuccess ) {
9320
9321 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
9322 if ( s.ifModified ) {
9323 modified = jqXHR.getResponseHeader( "Last-Modified" );
9324 if ( modified ) {
9325 jQuery.lastModified[ cacheURL ] = modified;
9326 }
9327 modified = jqXHR.getResponseHeader( "etag" );
9328 if ( modified ) {
9329 jQuery.etag[ cacheURL ] = modified;
9330 }
9331 }
9332
9333 // if no content
9334 if ( status === 204 || s.type === "HEAD" ) {
9335 statusText = "nocontent";
9336
9337 // if not modified
9338 } else if ( status === 304 ) {
9339 statusText = "notmodified";
9340
9341 // If we have data, let's convert it
9342 } else {
9343 statusText = response.state;
9344 success = response.data;
9345 error = response.error;
9346 isSuccess = !error;
9347 }
9348 } else {
9349
9350 // Extract error from statusText and normalize for non-aborts
9351 error = statusText;
9352 if ( status || !statusText ) {
9353 statusText = "error";
9354 if ( status < 0 ) {
9355 status = 0;
9356 }
9357 }
9358 }
9359
9360 // Set data for the fake xhr object
9361 jqXHR.status = status;
9362 jqXHR.statusText = ( nativeStatusText || statusText ) + "";
9363
9364 // Success/Error
9365 if ( isSuccess ) {
9366 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
9367 } else {
9368 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
9369 }
9370
9371 // Status-dependent callbacks
9372 jqXHR.statusCode( statusCode );
9373 statusCode = undefined;
9374
9375 if ( fireGlobals ) {
9376 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
9377 [ jqXHR, s, isSuccess ? success : error ] );
9378 }
9379
9380 // Complete
9381 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
9382
9383 if ( fireGlobals ) {
9384 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
9385
9386 // Handle the global AJAX counter
9387 if ( !( --jQuery.active ) ) {
9388 jQuery.event.trigger( "ajaxStop" );
9389 }
9390 }
9391 }
9392
9393 return jqXHR;
9394 },
9395
9396 getJSON: function( url, data, callback ) {
9397 return jQuery.get( url, data, callback, "json" );
9398 },
9399
9400 getScript: function( url, callback ) {
9401 return jQuery.get( url, undefined, callback, "script" );
9402 }
9403} );
9404
9405jQuery.each( [ "get", "post" ], function( i, method ) {
9406 jQuery[ method ] = function( url, data, callback, type ) {
9407
9408 // Shift arguments if data argument was omitted
9409 if ( isFunction( data ) ) {
9410 type = type || callback;
9411 callback = data;
9412 data = undefined;
9413 }
9414
9415 // The url can be an options object (which then must have .url)
9416 return jQuery.ajax( jQuery.extend( {
9417 url: url,
9418 type: method,
9419 dataType: type,
9420 data: data,
9421 success: callback
9422 }, jQuery.isPlainObject( url ) && url ) );
9423 };
9424} );
9425
9426
9427jQuery._evalUrl = function( url ) {
9428 return jQuery.ajax( {
9429 url: url,
9430
9431 // Make this explicit, since user can override this through ajaxSetup (#11264)
9432 type: "GET",
9433 dataType: "script",
9434 cache: true,
9435 async: false,
9436 global: false,
9437
9438 // Only evaluate the response if it is successful (gh-4126)
9439 // dataFilter is not invoked for failure responses, so using it instead
9440 // of the default converter is kludgy but it works.
9441 converters: {
9442 "text script": function() {}
9443 },
9444 dataFilter: function( response ) {
9445 jQuery.globalEval( response );
9446 }
9447 } );
9448};
9449
9450
9451jQuery.fn.extend( {
9452 wrapAll: function( html ) {
9453 var wrap;
9454
9455 if ( this[ 0 ] ) {
9456 if ( isFunction( html ) ) {
9457 html = html.call( this[ 0 ] );
9458 }
9459
9460 // The elements to wrap the target around
9461 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
9462
9463 if ( this[ 0 ].parentNode ) {
9464 wrap.insertBefore( this[ 0 ] );
9465 }
9466
9467 wrap.map( function() {
9468 var elem = this;
9469
9470 while ( elem.firstElementChild ) {
9471 elem = elem.firstElementChild;
9472 }
9473
9474 return elem;
9475 } ).append( this );
9476 }
9477
9478 return this;
9479 },
9480
9481 wrapInner: function( html ) {
9482 if ( isFunction( html ) ) {
9483 return this.each( function( i ) {
9484 jQuery( this ).wrapInner( html.call( this, i ) );
9485 } );
9486 }
9487
9488 return this.each( function() {
9489 var self = jQuery( this ),
9490 contents = self.contents();
9491
9492 if ( contents.length ) {
9493 contents.wrapAll( html );
9494
9495 } else {
9496 self.append( html );
9497 }
9498 } );
9499 },
9500
9501 wrap: function( html ) {
9502 var htmlIsFunction = isFunction( html );
9503
9504 return this.each( function( i ) {
9505 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
9506 } );
9507 },
9508
9509 unwrap: function( selector ) {
9510 this.parent( selector ).not( "body" ).each( function() {
9511 jQuery( this ).replaceWith( this.childNodes );
9512 } );
9513 return this;
9514 }
9515} );
9516
9517
9518jQuery.expr.pseudos.hidden = function( elem ) {
9519 return !jQuery.expr.pseudos.visible( elem );
9520};
9521jQuery.expr.pseudos.visible = function( elem ) {
9522 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
9523};
9524
9525
9526
9527
9528jQuery.ajaxSettings.xhr = function() {
9529 try {
9530 return new window.XMLHttpRequest();
9531 } catch ( e ) {}
9532};
9533
9534var xhrSuccessStatus = {
9535
9536 // File protocol always yields status code 0, assume 200
9537 0: 200,
9538
9539 // Support: IE <=9 only
9540 // #1450: sometimes IE returns 1223 when it should be 204
9541 1223: 204
9542 },
9543 xhrSupported = jQuery.ajaxSettings.xhr();
9544
9545support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
9546support.ajax = xhrSupported = !!xhrSupported;
9547
9548jQuery.ajaxTransport( function( options ) {
9549 var callback, errorCallback;
9550
9551 // Cross domain only allowed if supported through XMLHttpRequest
9552 if ( support.cors || xhrSupported && !options.crossDomain ) {
9553 return {
9554 send: function( headers, complete ) {
9555 var i,
9556 xhr = options.xhr();
9557
9558 xhr.open(
9559 options.type,
9560 options.url,
9561 options.async,
9562 options.username,
9563 options.password
9564 );
9565
9566 // Apply custom fields if provided
9567 if ( options.xhrFields ) {
9568 for ( i in options.xhrFields ) {
9569 xhr[ i ] = options.xhrFields[ i ];
9570 }
9571 }
9572
9573 // Override mime type if needed
9574 if ( options.mimeType && xhr.overrideMimeType ) {
9575 xhr.overrideMimeType( options.mimeType );
9576 }
9577
9578 // X-Requested-With header
9579 // For cross-domain requests, seeing as conditions for a preflight are
9580 // akin to a jigsaw puzzle, we simply never set it to be sure.
9581 // (it can always be set on a per-request basis or even using ajaxSetup)
9582 // For same-domain requests, won't change header if already provided.
9583 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
9584 headers[ "X-Requested-With" ] = "XMLHttpRequest";
9585 }
9586
9587 // Set headers
9588 for ( i in headers ) {
9589 xhr.setRequestHeader( i, headers[ i ] );
9590 }
9591
9592 // Callback
9593 callback = function( type ) {
9594 return function() {
9595 if ( callback ) {
9596 callback = errorCallback = xhr.onload =
9597 xhr.onerror = xhr.onabort = xhr.ontimeout =
9598 xhr.onreadystatechange = null;
9599
9600 if ( type === "abort" ) {
9601 xhr.abort();
9602 } else if ( type === "error" ) {
9603
9604 // Support: IE <=9 only
9605 // On a manual native abort, IE9 throws
9606 // errors on any property access that is not readyState
9607 if ( typeof xhr.status !== "number" ) {
9608 complete( 0, "error" );
9609 } else {
9610 complete(
9611
9612 // File: protocol always yields status 0; see #8605, #14207
9613 xhr.status,
9614 xhr.statusText
9615 );
9616 }
9617 } else {
9618 complete(
9619 xhrSuccessStatus[ xhr.status ] || xhr.status,
9620 xhr.statusText,
9621
9622 // Support: IE <=9 only
9623 // IE9 has no XHR2 but throws on binary (trac-11426)
9624 // For XHR2 non-text, let the caller handle it (gh-2498)
9625 ( xhr.responseType || "text" ) !== "text" ||
9626 typeof xhr.responseText !== "string" ?
9627 { binary: xhr.response } :
9628 { text: xhr.responseText },
9629 xhr.getAllResponseHeaders()
9630 );
9631 }
9632 }
9633 };
9634 };
9635
9636 // Listen to events
9637 xhr.onload = callback();
9638 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
9639
9640 // Support: IE 9 only
9641 // Use onreadystatechange to replace onabort
9642 // to handle uncaught aborts
9643 if ( xhr.onabort !== undefined ) {
9644 xhr.onabort = errorCallback;
9645 } else {
9646 xhr.onreadystatechange = function() {
9647
9648 // Check readyState before timeout as it changes
9649 if ( xhr.readyState === 4 ) {
9650
9651 // Allow onerror to be called first,
9652 // but that will not handle a native abort
9653 // Also, save errorCallback to a variable
9654 // as xhr.onerror cannot be accessed
9655 window.setTimeout( function() {
9656 if ( callback ) {
9657 errorCallback();
9658 }
9659 } );
9660 }
9661 };
9662 }
9663
9664 // Create the abort callback
9665 callback = callback( "abort" );
9666
9667 try {
9668
9669 // Do send the request (this may raise an exception)
9670 xhr.send( options.hasContent && options.data || null );
9671 } catch ( e ) {
9672
9673 // #14683: Only rethrow if this hasn't been notified as an error yet
9674 if ( callback ) {
9675 throw e;
9676 }
9677 }
9678 },
9679
9680 abort: function() {
9681 if ( callback ) {
9682 callback();
9683 }
9684 }
9685 };
9686 }
9687} );
9688
9689
9690
9691
9692// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
9693jQuery.ajaxPrefilter( function( s ) {
9694 if ( s.crossDomain ) {
9695 s.contents.script = false;
9696 }
9697} );
9698
9699// Install script dataType
9700jQuery.ajaxSetup( {
9701 accepts: {
9702 script: "text/javascript, application/javascript, " +
9703 "application/ecmascript, application/x-ecmascript"
9704 },
9705 contents: {
9706 script: /\b(?:java|ecma)script\b/
9707 },
9708 converters: {
9709 "text script": function( text ) {
9710 jQuery.globalEval( text );
9711 return text;
9712 }
9713 }
9714} );
9715
9716// Handle cache's special case and crossDomain
9717jQuery.ajaxPrefilter( "script", function( s ) {
9718 if ( s.cache === undefined ) {
9719 s.cache = false;
9720 }
9721 if ( s.crossDomain ) {
9722 s.type = "GET";
9723 }
9724} );
9725
9726// Bind script tag hack transport
9727jQuery.ajaxTransport( "script", function( s ) {
9728
9729 // This transport only deals with cross domain or forced-by-attrs requests
9730 if ( s.crossDomain || s.scriptAttrs ) {
9731 var script, callback;
9732 return {
9733 send: function( _, complete ) {
9734 script = jQuery( "<script>" )
9735 .attr( s.scriptAttrs || {} )
9736 .prop( { charset: s.scriptCharset, src: s.url } )
9737 .on( "load error", callback = function( evt ) {
9738 script.remove();
9739 callback = null;
9740 if ( evt ) {
9741 complete( evt.type === "error" ? 404 : 200, evt.type );
9742 }
9743 } );
9744
9745 // Use native DOM manipulation to avoid our domManip AJAX trickery
9746 document.head.appendChild( script[ 0 ] );
9747 },
9748 abort: function() {
9749 if ( callback ) {
9750 callback();
9751 }
9752 }
9753 };
9754 }
9755} );
9756
9757
9758
9759
9760var oldCallbacks = [],
9761 rjsonp = /(=)\?(?=&|$)|\?\?/;
9762
9763// Default jsonp settings
9764jQuery.ajaxSetup( {
9765 jsonp: "callback",
9766 jsonpCallback: function() {
9767 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
9768 this[ callback ] = true;
9769 return callback;
9770 }
9771} );
9772
9773// Detect, normalize options and install callbacks for jsonp requests
9774jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
9775
9776 var callbackName, overwritten, responseContainer,
9777 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
9778 "url" :
9779 typeof s.data === "string" &&
9780 ( s.contentType || "" )
9781 .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
9782 rjsonp.test( s.data ) && "data"
9783 );
9784
9785 // Handle iff the expected data type is "jsonp" or we have a parameter to set
9786 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
9787
9788 // Get callback name, remembering preexisting value associated with it
9789 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
9790 s.jsonpCallback() :
9791 s.jsonpCallback;
9792
9793 // Insert callback into url or form data
9794 if ( jsonProp ) {
9795 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
9796 } else if ( s.jsonp !== false ) {
9797 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
9798 }
9799
9800 // Use data converter to retrieve json after script execution
9801 s.converters[ "script json" ] = function() {
9802 if ( !responseContainer ) {
9803 jQuery.error( callbackName + " was not called" );
9804 }
9805 return responseContainer[ 0 ];
9806 };
9807
9808 // Force json dataType
9809 s.dataTypes[ 0 ] = "json";
9810
9811 // Install callback
9812 overwritten = window[ callbackName ];
9813 window[ callbackName ] = function() {
9814 responseContainer = arguments;
9815 };
9816
9817 // Clean-up function (fires after converters)
9818 jqXHR.always( function() {
9819
9820 // If previous value didn't exist - remove it
9821 if ( overwritten === undefined ) {
9822 jQuery( window ).removeProp( callbackName );
9823
9824 // Otherwise restore preexisting value
9825 } else {
9826 window[ callbackName ] = overwritten;
9827 }
9828
9829 // Save back as free
9830 if ( s[ callbackName ] ) {
9831
9832 // Make sure that re-using the options doesn't screw things around
9833 s.jsonpCallback = originalSettings.jsonpCallback;
9834
9835 // Save the callback name for future use
9836 oldCallbacks.push( callbackName );
9837 }
9838
9839 // Call if it was a function and we have a response
9840 if ( responseContainer && isFunction( overwritten ) ) {
9841 overwritten( responseContainer[ 0 ] );
9842 }
9843
9844 responseContainer = overwritten = undefined;
9845 } );
9846
9847 // Delegate to script
9848 return "script";
9849 }
9850} );
9851
9852
9853
9854
9855// Support: Safari 8 only
9856// In Safari 8 documents created via document.implementation.createHTMLDocument
9857// collapse sibling forms: the second one becomes a child of the first one.
9858// Because of that, this security measure has to be disabled in Safari 8.
9859// https://bugs.webkit.org/show_bug.cgi?id=137337
9860support.createHTMLDocument = ( function() {
9861 var body = document.implementation.createHTMLDocument( "" ).body;
9862 body.innerHTML = "<form></form><form></form>";
9863 return body.childNodes.length === 2;
9864} )();
9865
9866
9867// Argument "data" should be string of html
9868// context (optional): If specified, the fragment will be created in this context,
9869// defaults to document
9870// keepScripts (optional): If true, will include scripts passed in the html string
9871jQuery.parseHTML = function( data, context, keepScripts ) {
9872 if ( typeof data !== "string" ) {
9873 return [];
9874 }
9875 if ( typeof context === "boolean" ) {
9876 keepScripts = context;
9877 context = false;
9878 }
9879
9880 var base, parsed, scripts;
9881
9882 if ( !context ) {
9883
9884 // Stop scripts or inline event handlers from being executed immediately
9885 // by using document.implementation
9886 if ( support.createHTMLDocument ) {
9887 context = document.implementation.createHTMLDocument( "" );
9888
9889 // Set the base href for the created document
9890 // so any parsed elements with URLs
9891 // are based on the document's URL (gh-2965)
9892 base = context.createElement( "base" );
9893 base.href = document.location.href;
9894 context.head.appendChild( base );
9895 } else {
9896 context = document;
9897 }
9898 }
9899
9900 parsed = rsingleTag.exec( data );
9901 scripts = !keepScripts && [];
9902
9903 // Single tag
9904 if ( parsed ) {
9905 return [ context.createElement( parsed[ 1 ] ) ];
9906 }
9907
9908 parsed = buildFragment( [ data ], context, scripts );
9909
9910 if ( scripts && scripts.length ) {
9911 jQuery( scripts ).remove();
9912 }
9913
9914 return jQuery.merge( [], parsed.childNodes );
9915};
9916
9917
9918/**
9919 * Load a url into a page
9920 */
9921jQuery.fn.load = function( url, params, callback ) {
9922 var selector, type, response,
9923 self = this,
9924 off = url.indexOf( " " );
9925
9926 if ( off > -1 ) {
9927 selector = stripAndCollapse( url.slice( off ) );
9928 url = url.slice( 0, off );
9929 }
9930
9931 // If it's a function
9932 if ( isFunction( params ) ) {
9933
9934 // We assume that it's the callback
9935 callback = params;
9936 params = undefined;
9937
9938 // Otherwise, build a param string
9939 } else if ( params && typeof params === "object" ) {
9940 type = "POST";
9941 }
9942
9943 // If we have elements to modify, make the request
9944 if ( self.length > 0 ) {
9945 jQuery.ajax( {
9946 url: url,
9947
9948 // If "type" variable is undefined, then "GET" method will be used.
9949 // Make value of this field explicit since
9950 // user can override it through ajaxSetup method
9951 type: type || "GET",
9952 dataType: "html",
9953 data: params
9954 } ).done( function( responseText ) {
9955
9956 // Save response for use in complete callback
9957 response = arguments;
9958
9959 self.html( selector ?
9960
9961 // If a selector was specified, locate the right elements in a dummy div
9962 // Exclude scripts to avoid IE 'Permission Denied' errors
9963 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
9964
9965 // Otherwise use the full result
9966 responseText );
9967
9968 // If the request succeeds, this function gets "data", "status", "jqXHR"
9969 // but they are ignored because response was set above.
9970 // If it fails, this function gets "jqXHR", "status", "error"
9971 } ).always( callback && function( jqXHR, status ) {
9972 self.each( function() {
9973 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
9974 } );
9975 } );
9976 }
9977
9978 return this;
9979};
9980
9981
9982
9983
9984// Attach a bunch of functions for handling common AJAX events
9985jQuery.each( [
9986 "ajaxStart",
9987 "ajaxStop",
9988 "ajaxComplete",
9989 "ajaxError",
9990 "ajaxSuccess",
9991 "ajaxSend"
9992], function( i, type ) {
9993 jQuery.fn[ type ] = function( fn ) {
9994 return this.on( type, fn );
9995 };
9996} );
9997
9998
9999
10000
10001jQuery.expr.pseudos.animated = function( elem ) {
10002 return jQuery.grep( jQuery.timers, function( fn ) {
10003 return elem === fn.elem;
10004 } ).length;
10005};
10006
10007
10008
10009
10010jQuery.offset = {
10011 setOffset: function( elem, options, i ) {
10012 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
10013 position = jQuery.css( elem, "position" ),
10014 curElem = jQuery( elem ),
10015 props = {};
10016
10017 // Set position first, in-case top/left are set even on static elem
10018 if ( position === "static" ) {
10019 elem.style.position = "relative";
10020 }
10021
10022 curOffset = curElem.offset();
10023 curCSSTop = jQuery.css( elem, "top" );
10024 curCSSLeft = jQuery.css( elem, "left" );
10025 calculatePosition = ( position === "absolute" || position === "fixed" ) &&
10026 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
10027
10028 // Need to be able to calculate position if either
10029 // top or left is auto and position is either absolute or fixed
10030 if ( calculatePosition ) {
10031 curPosition = curElem.position();
10032 curTop = curPosition.top;
10033 curLeft = curPosition.left;
10034
10035 } else {
10036 curTop = parseFloat( curCSSTop ) || 0;
10037 curLeft = parseFloat( curCSSLeft ) || 0;
10038 }
10039
10040 if ( isFunction( options ) ) {
10041
10042 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
10043 options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
10044 }
10045
10046 if ( options.top != null ) {
10047 props.top = ( options.top - curOffset.top ) + curTop;
10048 }
10049 if ( options.left != null ) {
10050 props.left = ( options.left - curOffset.left ) + curLeft;
10051 }
10052
10053 if ( "using" in options ) {
10054 options.using.call( elem, props );
10055
10056 } else {
10057 curElem.css( props );
10058 }
10059 }
10060};
10061
10062jQuery.fn.extend( {
10063
10064 // offset() relates an element's border box to the document origin
10065 offset: function( options ) {
10066
10067 // Preserve chaining for setter
10068 if ( arguments.length ) {
10069 return options === undefined ?
10070 this :
10071 this.each( function( i ) {
10072 jQuery.offset.setOffset( this, options, i );
10073 } );
10074 }
10075
10076 var rect, win,
10077 elem = this[ 0 ];
10078
10079 if ( !elem ) {
10080 return;
10081 }
10082
10083 // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
10084 // Support: IE <=11 only
10085 // Running getBoundingClientRect on a
10086 // disconnected node in IE throws an error
10087 if ( !elem.getClientRects().length ) {
10088 return { top: 0, left: 0 };
10089 }
10090
10091 // Get document-relative position by adding viewport scroll to viewport-relative gBCR
10092 rect = elem.getBoundingClientRect();
10093 win = elem.ownerDocument.defaultView;
10094 return {
10095 top: rect.top + win.pageYOffset,
10096 left: rect.left + win.pageXOffset
10097 };
10098 },
10099
10100 // position() relates an element's margin box to its offset parent's padding box
10101 // This corresponds to the behavior of CSS absolute positioning
10102 position: function() {
10103 if ( !this[ 0 ] ) {
10104 return;
10105 }
10106
10107 var offsetParent, offset, doc,
10108 elem = this[ 0 ],
10109 parentOffset = { top: 0, left: 0 };
10110
10111 // position:fixed elements are offset from the viewport, which itself always has zero offset
10112 if ( jQuery.css( elem, "position" ) === "fixed" ) {
10113
10114 // Assume position:fixed implies availability of getBoundingClientRect
10115 offset = elem.getBoundingClientRect();
10116
10117 } else {
10118 offset = this.offset();
10119
10120 // Account for the *real* offset parent, which can be the document or its root element
10121 // when a statically positioned element is identified
10122 doc = elem.ownerDocument;
10123 offsetParent = elem.offsetParent || doc.documentElement;
10124 while ( offsetParent &&
10125 ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
10126 jQuery.css( offsetParent, "position" ) === "static" ) {
10127
10128 offsetParent = offsetParent.parentNode;
10129 }
10130 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
10131
10132 // Incorporate borders into its offset, since they are outside its content origin
10133 parentOffset = jQuery( offsetParent ).offset();
10134 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
10135 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
10136 }
10137 }
10138
10139 // Subtract parent offsets and element margins
10140 return {
10141 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
10142 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
10143 };
10144 },
10145
10146 // This method will return documentElement in the following cases:
10147 // 1) For the element inside the iframe without offsetParent, this method will return
10148 // documentElement of the parent window
10149 // 2) For the hidden or detached element
10150 // 3) For body or html element, i.e. in case of the html node - it will return itself
10151 //
10152 // but those exceptions were never presented as a real life use-cases
10153 // and might be considered as more preferable results.
10154 //
10155 // This logic, however, is not guaranteed and can change at any point in the future
10156 offsetParent: function() {
10157 return this.map( function() {
10158 var offsetParent = this.offsetParent;
10159
10160 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
10161 offsetParent = offsetParent.offsetParent;
10162 }
10163
10164 return offsetParent || documentElement;
10165 } );
10166 }
10167} );
10168
10169// Create scrollLeft and scrollTop methods
10170jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
10171 var top = "pageYOffset" === prop;
10172
10173 jQuery.fn[ method ] = function( val ) {
10174 return access( this, function( elem, method, val ) {
10175
10176 // Coalesce documents and windows
10177 var win;
10178 if ( isWindow( elem ) ) {
10179 win = elem;
10180 } else if ( elem.nodeType === 9 ) {
10181 win = elem.defaultView;
10182 }
10183
10184 if ( val === undefined ) {
10185 return win ? win[ prop ] : elem[ method ];
10186 }
10187
10188 if ( win ) {
10189 win.scrollTo(
10190 !top ? val : win.pageXOffset,
10191 top ? val : win.pageYOffset
10192 );
10193
10194 } else {
10195 elem[ method ] = val;
10196 }
10197 }, method, val, arguments.length );
10198 };
10199} );
10200
10201// Support: Safari <=7 - 9.1, Chrome <=37 - 49
10202// Add the top/left cssHooks using jQuery.fn.position
10203// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
10204// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
10205// getComputedStyle returns percent when specified for top/left/bottom/right;
10206// rather than make the css module depend on the offset module, just check for it here
10207jQuery.each( [ "top", "left" ], function( i, prop ) {
10208 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
10209 function( elem, computed ) {
10210 if ( computed ) {
10211 computed = curCSS( elem, prop );
10212
10213 // If curCSS returns percentage, fallback to offset
10214 return rnumnonpx.test( computed ) ?
10215 jQuery( elem ).position()[ prop ] + "px" :
10216 computed;
10217 }
10218 }
10219 );
10220} );
10221
10222
10223// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
10224jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
10225 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
10226 function( defaultExtra, funcName ) {
10227
10228 // Margin is only for outerHeight, outerWidth
10229 jQuery.fn[ funcName ] = function( margin, value ) {
10230 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
10231 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
10232
10233 return access( this, function( elem, type, value ) {
10234 var doc;
10235
10236 if ( isWindow( elem ) ) {
10237
10238 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
10239 return funcName.indexOf( "outer" ) === 0 ?
10240 elem[ "inner" + name ] :
10241 elem.document.documentElement[ "client" + name ];
10242 }
10243
10244 // Get document width or height
10245 if ( elem.nodeType === 9 ) {
10246 doc = elem.documentElement;
10247
10248 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
10249 // whichever is greatest
10250 return Math.max(
10251 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
10252 elem.body[ "offset" + name ], doc[ "offset" + name ],
10253 doc[ "client" + name ]
10254 );
10255 }
10256
10257 return value === undefined ?
10258
10259 // Get width or height on the element, requesting but not forcing parseFloat
10260 jQuery.css( elem, type, extra ) :
10261
10262 // Set width or height on the element
10263 jQuery.style( elem, type, value, extra );
10264 }, type, chainable ? margin : undefined, chainable );
10265 };
10266 } );
10267} );
10268
10269
10270jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
10271 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
10272 "change select submit keydown keypress keyup contextmenu" ).split( " " ),
10273 function( i, name ) {
10274
10275 // Handle event binding
10276 jQuery.fn[ name ] = function( data, fn ) {
10277 return arguments.length > 0 ?
10278 this.on( name, null, data, fn ) :
10279 this.trigger( name );
10280 };
10281} );
10282
10283jQuery.fn.extend( {
10284 hover: function( fnOver, fnOut ) {
10285 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
10286 }
10287} );
10288
10289
10290
10291
10292jQuery.fn.extend( {
10293
10294 bind: function( types, data, fn ) {
10295 return this.on( types, null, data, fn );
10296 },
10297 unbind: function( types, fn ) {
10298 return this.off( types, null, fn );
10299 },
10300
10301 delegate: function( selector, types, data, fn ) {
10302 return this.on( types, selector, data, fn );
10303 },
10304 undelegate: function( selector, types, fn ) {
10305
10306 // ( namespace ) or ( selector, types [, fn] )
10307 return arguments.length === 1 ?
10308 this.off( selector, "**" ) :
10309 this.off( types, selector || "**", fn );
10310 }
10311} );
10312
10313// Bind a function to a context, optionally partially applying any
10314// arguments.
10315// jQuery.proxy is deprecated to promote standards (specifically Function#bind)
10316// However, it is not slated for removal any time soon
10317jQuery.proxy = function( fn, context ) {
10318 var tmp, args, proxy;
10319
10320 if ( typeof context === "string" ) {
10321 tmp = fn[ context ];
10322 context = fn;
10323 fn = tmp;
10324 }
10325
10326 // Quick check to determine if target is callable, in the spec
10327 // this throws a TypeError, but we will just return undefined.
10328 if ( !isFunction( fn ) ) {
10329 return undefined;
10330 }
10331
10332 // Simulated bind
10333 args = slice.call( arguments, 2 );
10334 proxy = function() {
10335 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
10336 };
10337
10338 // Set the guid of unique handler to the same of original handler, so it can be removed
10339 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
10340
10341 return proxy;
10342};
10343
10344jQuery.holdReady = function( hold ) {
10345 if ( hold ) {
10346 jQuery.readyWait++;
10347 } else {
10348 jQuery.ready( true );
10349 }
10350};
10351jQuery.isArray = Array.isArray;
10352jQuery.parseJSON = JSON.parse;
10353jQuery.nodeName = nodeName;
10354jQuery.isFunction = isFunction;
10355jQuery.isWindow = isWindow;
10356jQuery.camelCase = camelCase;
10357jQuery.type = toType;
10358
10359jQuery.now = Date.now;
10360
10361jQuery.isNumeric = function( obj ) {
10362
10363 // As of jQuery 3.0, isNumeric is limited to
10364 // strings and numbers (primitives or objects)
10365 // that can be coerced to finite numbers (gh-2662)
10366 var type = jQuery.type( obj );
10367 return ( type === "number" || type === "string" ) &&
10368
10369 // parseFloat NaNs numeric-cast false positives ("")
10370 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
10371 // subtraction forces infinities to NaN
10372 !isNaN( obj - parseFloat( obj ) );
10373};
10374
10375
10376
10377
10378// Register as a named AMD module, since jQuery can be concatenated with other
10379// files that may use define, but not via a proper concatenation script that
10380// understands anonymous AMD modules. A named AMD is safest and most robust
10381// way to register. Lowercase jquery is used because AMD module names are
10382// derived from file names, and jQuery is normally delivered in a lowercase
10383// file name. Do this after creating the global so that if an AMD module wants
10384// to call noConflict to hide this version of jQuery, it will work.
10385
10386// Note that for maximum portability, libraries that are not jQuery should
10387// declare themselves as anonymous modules, and avoid setting a global if an
10388// AMD loader is present. jQuery is a special case. For more information, see
10389// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
10390
10391if ( typeof define === "function" && define.amd ) {
10392 define( "jquery", [], function() {
10393 return jQuery;
10394 } );
10395}
10396
10397
10398
10399
10400var
10401
10402 // Map over jQuery in case of overwrite
10403 _jQuery = window.jQuery,
10404
10405 // Map over the $ in case of overwrite
10406 _$ = window.$;
10407
10408jQuery.noConflict = function( deep ) {
10409 if ( window.$ === jQuery ) {
10410 window.$ = _$;
10411 }
10412
10413 if ( deep && window.jQuery === jQuery ) {
10414 window.jQuery = _jQuery;
10415 }
10416
10417 return jQuery;
10418};
10419
10420// Expose jQuery and $ identifiers, even in AMD
10421// (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
10422// and CommonJS for browser emulators (#13566)
10423if ( !noGlobal ) {
10424 window.jQuery = window.$ = jQuery;
10425}
10426
10427
10428
10429
10430return jQuery;
10431} );