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