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