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