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