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