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