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