Debian Codegraph @

doc/pasdoc/html-parts/castle-engine-website-base/node_modules/jquery/dist/jquery.js

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