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