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