2 * jQuery JavaScript Library v3.6.4 -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-effects,-effects/animatedSelector,-effects/Tween
6 * https://sizzlejs.com/
8 * Copyright OpenJS Foundation and other contributors
9 * Released under the MIT license
10 * https://jquery.org/license
12 * Date: 2023-03-08T15:29Z
14 ( function( global, factory ) {
18 if ( typeof module === "object" && typeof module.exports === "object" ) {
20 // For CommonJS and CommonJS-like environments where a proper `window`
21 // is present, execute the factory and get jQuery.
22 // For environments that do not have a `window` with a `document`
23 // (such as Node.js), expose a factory as module.exports.
24 // This accentuates the need for the creation of a real `window`.
25 // e.g. var jQuery = require("jquery")(window);
26 // See ticket trac-14549 for more info.
27 module.exports = global.document ?
28 factory( global, true ) :
31 throw new Error( "jQuery requires a window with a document" );
39 // Pass this if window is not defined yet
40 } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
42 // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
43 // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
44 // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
45 // enough that all such attempts are guarded in a try block.
50 var getProto = Object.getPrototypeOf;
52 var slice = arr.slice;
54 var flat = arr.flat ? function( array ) {
55 return arr.flat.call( array );
56 } : function( array ) {
57 return arr.concat.apply( [], array );
63 var indexOf = arr.indexOf;
67 var toString = class2type.toString;
69 var hasOwn = class2type.hasOwnProperty;
71 var fnToString = hasOwn.toString;
73 var ObjectFunctionString = fnToString.call( Object );
77 var isFunction = function isFunction( obj ) {
79 // Support: Chrome <=57, Firefox <=52
80 // In some browsers, typeof returns "function" for HTML <object> elements
81 // (i.e., `typeof document.createElement( "object" ) === "function"`).
82 // We don't want to classify *any* DOM node as a function.
83 // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5
84 // Plus for old WebKit, typeof returns "function" for HTML collections
85 // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756)
86 return typeof obj === "function" && typeof obj.nodeType !== "number" &&
87 typeof obj.item !== "function";
91 var isWindow = function isWindow( obj ) {
92 return obj != null && obj === obj.window;
96 var document = window.document;
100 var preservedScriptAttributes = {
107 function DOMEval( code, node, doc ) {
108 doc = doc || document;
111 script = doc.createElement( "script" );
115 for ( i in preservedScriptAttributes ) {
117 // Support: Firefox 64+, Edge 18+
118 // Some browsers don't support the "nonce" property on scripts.
119 // On the other hand, just using `getAttribute` is not enough as
120 // the `nonce` attribute is reset to an empty string whenever it
121 // becomes browsing-context connected.
122 // See https://github.com/whatwg/html/issues/2369
123 // See https://html.spec.whatwg.org/#nonce-attributes
124 // The `node.getAttribute` check was added for the sake of
125 // `jQuery.globalEval` so that it can fake a nonce-containing node
127 val = node[ i ] || node.getAttribute && node.getAttribute( i );
129 script.setAttribute( i, val );
133 doc.head.appendChild( script ).parentNode.removeChild( script );
137 function toType( obj ) {
142 // Support: Android <=2.3 only (functionish RegExp)
143 return typeof obj === "object" || typeof obj === "function" ?
144 class2type[ toString.call( obj ) ] || "object" :
148 // Defining this global in .eslintrc.json would create a danger of using the global
149 // unguarded in another place, it seems safer to define global only for this module
154 version = "3.6.4 -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-effects,-effects/animatedSelector,-effects/Tween",
156 // Define a local copy of jQuery
157 jQuery = function( selector, context ) {
159 // The jQuery object is actually just the init constructor 'enhanced'
160 // Need init if jQuery is called (just allow error to be thrown if not included)
161 return new jQuery.fn.init( selector, context );
164 jQuery.fn = jQuery.prototype = {
166 // The current version of jQuery being used
171 // The default length of a jQuery object is 0
174 toArray: function() {
175 return slice.call( this );
178 // Get the Nth element in the matched element set OR
179 // Get the whole matched element set as a clean array
180 get: function( num ) {
182 // Return all the elements in a clean array
184 return slice.call( this );
187 // Return just the one element from the set
188 return num < 0 ? this[ num + this.length ] : this[ num ];
191 // Take an array of elements and push it onto the stack
192 // (returning the new matched element set)
193 pushStack: function( elems ) {
195 // Build a new jQuery matched element set
196 var ret = jQuery.merge( this.constructor(), elems );
198 // Add the old object onto the stack (as a reference)
199 ret.prevObject = this;
201 // Return the newly-formed element set
205 // Execute a callback for every element in the matched set.
206 each: function( callback ) {
207 return jQuery.each( this, callback );
210 map: function( callback ) {
211 return this.pushStack( jQuery.map( this, function( elem, i ) {
212 return callback.call( elem, i, elem );
217 return this.pushStack( slice.apply( this, arguments ) );
225 return this.eq( -1 );
229 return this.pushStack( jQuery.grep( this, function( _elem, i ) {
230 return ( i + 1 ) % 2;
235 return this.pushStack( jQuery.grep( this, function( _elem, i ) {
241 var len = this.length,
242 j = +i + ( i < 0 ? len : 0 );
243 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
247 return this.prevObject || this.constructor();
250 // For internal use only.
251 // Behaves like an Array's method, not like a jQuery method.
257 jQuery.extend = jQuery.fn.extend = function() {
258 var options, name, src, copy, copyIsArray, clone,
259 target = arguments[ 0 ] || {},
261 length = arguments.length,
264 // Handle a deep copy situation
265 if ( typeof target === "boolean" ) {
268 // Skip the boolean and the target
269 target = arguments[ i ] || {};
273 // Handle case when target is a string or something (possible in deep copy)
274 if ( typeof target !== "object" && !isFunction( target ) ) {
278 // Extend jQuery itself if only one argument is passed
279 if ( i === length ) {
284 for ( ; i < length; i++ ) {
286 // Only deal with non-null/undefined values
287 if ( ( options = arguments[ i ] ) != null ) {
289 // Extend the base object
290 for ( name in options ) {
291 copy = options[ name ];
293 // Prevent Object.prototype pollution
294 // Prevent never-ending loop
295 if ( name === "__proto__" || target === copy ) {
299 // Recurse if we're merging plain objects or arrays
300 if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
301 ( copyIsArray = Array.isArray( copy ) ) ) ) {
302 src = target[ name ];
304 // Ensure proper type for the source value
305 if ( copyIsArray && !Array.isArray( src ) ) {
307 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) {
314 // Never move original objects, clone them
315 target[ name ] = jQuery.extend( deep, clone, copy );
317 // Don't bring in undefined values
318 } else if ( copy !== undefined ) {
319 target[ name ] = copy;
325 // Return the modified object
331 // Unique for each copy of jQuery on the page
332 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
334 // Assume jQuery is ready without the ready module
337 error: function( msg ) {
338 throw new Error( msg );
343 isPlainObject: function( obj ) {
346 // Detect obvious negatives
347 // Use toString instead of jQuery.type to catch host objects
348 if ( !obj || toString.call( obj ) !== "[object Object]" ) {
352 proto = getProto( obj );
354 // Objects with no prototype (e.g., `Object.create( null )`) are plain
359 // Objects with prototype are plain iff they were constructed by a global Object function
360 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
361 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
364 isEmptyObject: function( obj ) {
367 for ( name in obj ) {
373 // Evaluates a script in a provided context; falls back to the global one
375 globalEval: function( code, options, doc ) {
376 DOMEval( code, { nonce: options && options.nonce }, doc );
379 each: function( obj, callback ) {
382 if ( isArrayLike( obj ) ) {
384 for ( ; i < length; i++ ) {
385 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
391 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
400 // results is for internal usage only
401 makeArray: function( arr, results ) {
402 var ret = results || [];
405 if ( isArrayLike( Object( arr ) ) ) {
407 typeof arr === "string" ?
411 push.call( ret, arr );
418 inArray: function( elem, arr, i ) {
419 return arr == null ? -1 : indexOf.call( arr, elem, i );
422 // Support: Android <=4.0 only, PhantomJS 1 only
423 // push.apply(_, arraylike) throws on ancient WebKit
424 merge: function( first, second ) {
425 var len = +second.length,
429 for ( ; j < len; j++ ) {
430 first[ i++ ] = second[ j ];
438 grep: function( elems, callback, invert ) {
442 length = elems.length,
443 callbackExpect = !invert;
445 // Go through the array, only saving the items
446 // that pass the validator function
447 for ( ; i < length; i++ ) {
448 callbackInverse = !callback( elems[ i ], i );
449 if ( callbackInverse !== callbackExpect ) {
450 matches.push( elems[ i ] );
457 // arg is for internal usage only
458 map: function( elems, callback, arg ) {
463 // Go through the array, translating each of the items to their new values
464 if ( isArrayLike( elems ) ) {
465 length = elems.length;
466 for ( ; i < length; i++ ) {
467 value = callback( elems[ i ], i, arg );
469 if ( value != null ) {
474 // Go through every key on the object,
477 value = callback( elems[ i ], i, arg );
479 if ( value != null ) {
485 // Flatten any nested arrays
489 // A global GUID counter for objects
492 // jQuery.support is not used in Core but other projects attach their
493 // properties to it so it needs to exist.
497 if ( typeof Symbol === "function" ) {
498 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
501 // Populate the class2type map
502 jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
503 function( _i, name ) {
504 class2type[ "[object " + name + "]" ] = name.toLowerCase();
507 function isArrayLike( obj ) {
509 // Support: real iOS 8.2 only (not reproducible in simulator)
510 // `in` check used to prevent JIT error (gh-2145)
511 // hasOwn isn't used here due to false negatives
512 // regarding Nodelist length in IE
513 var length = !!obj && "length" in obj && obj.length,
514 type = toType( obj );
516 if ( isFunction( obj ) || isWindow( obj ) ) {
520 return type === "array" || length === 0 ||
521 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
525 * Sizzle CSS Selector Engine v2.3.10
526 * https://sizzlejs.com/
528 * Copyright JS Foundation and other contributors
529 * Released under the MIT license
530 * https://js.foundation/
534 ( function( window ) {
547 // Local document vars
557 // Instance-specific data
558 expando = "sizzle" + 1 * new Date(),
559 preferredDoc = window.document,
562 classCache = createCache(),
563 tokenCache = createCache(),
564 compilerCache = createCache(),
565 nonnativeSelectorCache = createCache(),
566 sortOrder = function( a, b ) {
574 hasOwn = ( {} ).hasOwnProperty,
577 pushNative = arr.push,
581 // Use a stripped-down indexOf as it's faster than native
582 // https://jsperf.com/thor-indexof-vs-for/5
583 indexOf = function( list, elem ) {
586 for ( ; i < len; i++ ) {
587 if ( list[ i ] === elem ) {
594 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" +
595 "ismap|loop|multiple|open|readonly|required|scoped",
597 // Regular expressions
599 // http://www.w3.org/TR/css3-selectors/#whitespace
600 whitespace = "[\\x20\\t\\r\\n\\f]",
602 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram
603 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace +
604 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",
606 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
607 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
609 // Operator (capture 2)
610 "*([*^$|!~]?=)" + whitespace +
612 // "Attribute values must be CSS identifiers [capture 5]
613 // or strings [capture 3 or capture 4]"
614 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" +
617 pseudos = ":(" + identifier + ")(?:\\((" +
619 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
620 // 1. quoted (capture 3; capture 4 or capture 5)
621 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
623 // 2. simple (capture 6)
624 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
626 // 3. anything else (capture 2)
630 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
631 rwhitespace = new RegExp( whitespace + "+", "g" ),
632 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" +
633 whitespace + "+$", "g" ),
635 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
636 rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace +
638 rdescend = new RegExp( whitespace + "|>" ),
640 rpseudo = new RegExp( pseudos ),
641 ridentifier = new RegExp( "^" + identifier + "$" ),
644 "ID": new RegExp( "^#(" + identifier + ")" ),
645 "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
646 "TAG": new RegExp( "^(" + identifier + "|[*])" ),
647 "ATTR": new RegExp( "^" + attributes ),
648 "PSEUDO": new RegExp( "^" + pseudos ),
649 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" +
650 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" +
651 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
652 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
654 // For use in libraries implementing .is()
655 // We use this for POS matching in `select`
656 "needsContext": new RegExp( "^" + whitespace +
657 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace +
658 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
662 rinputs = /^(?:input|select|textarea|button)$/i,
665 rnative = /^[^{]+\{\s*\[native \w/,
667 // Easily-parseable/retrievable ID or TAG or CLASS selectors
668 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
673 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
674 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ),
675 funescape = function( escape, nonHex ) {
676 var high = "0x" + escape.slice( 1 ) - 0x10000;
680 // Strip the backslash prefix from a non-hex escape sequence
683 // Replace a hexadecimal escape sequence with the encoded Unicode code point
685 // For values outside the Basic Multilingual Plane (BMP), manually construct a
688 String.fromCharCode( high + 0x10000 ) :
689 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
692 // CSS string/identifier serialization
693 // https://drafts.csswg.org/cssom/#common-serializing-idioms
694 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
695 fcssescape = function( ch, asCodePoint ) {
698 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
703 // Control characters and (dependent upon position) numbers get escaped as code points
704 return ch.slice( 0, -1 ) + "\\" +
705 ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
708 // Other potentially-special ASCII characters get backslash-escaped
714 // Removing the function wrapper causes a "Permission Denied"
716 unloadHandler = function() {
720 inDisabledFieldset = addCombinator(
722 return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset";
724 { dir: "parentNode", next: "legend" }
727 // Optimize for push.apply( _, NodeList )
730 ( arr = slice.call( preferredDoc.childNodes ) ),
731 preferredDoc.childNodes
734 // Support: Android<4.0
735 // Detect silently failing push.apply
736 // eslint-disable-next-line no-unused-expressions
737 arr[ preferredDoc.childNodes.length ].nodeType;
739 push = { apply: arr.length ?
741 // Leverage slice if possible
742 function( target, els ) {
743 pushNative.apply( target, slice.call( els ) );
747 // Otherwise append directly
748 function( target, els ) {
749 var j = target.length,
752 // Can't trust NodeList.length
753 while ( ( target[ j++ ] = els[ i++ ] ) ) {}
754 target.length = j - 1;
759 function Sizzle( selector, context, results, seed ) {
760 var m, i, elem, nid, match, groups, newSelector,
761 newContext = context && context.ownerDocument,
763 // nodeType defaults to 9, since context defaults to document
764 nodeType = context ? context.nodeType : 9;
766 results = results || [];
768 // Return early from calls with invalid selector or context
769 if ( typeof selector !== "string" || !selector ||
770 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
775 // Try to shortcut find operations (as opposed to filters) in HTML documents
777 setDocument( context );
778 context = context || document;
780 if ( documentIsHTML ) {
782 // If the selector is sufficiently simple, try using a "get*By*" DOM method
783 // (excepting DocumentFragment context, where the methods don't exist)
784 if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) {
787 if ( ( m = match[ 1 ] ) ) {
790 if ( nodeType === 9 ) {
791 if ( ( elem = context.getElementById( m ) ) ) {
793 // Support: IE, Opera, Webkit
794 // TODO: identify versions
795 // getElementById can match elements by name instead of ID
796 if ( elem.id === m ) {
797 results.push( elem );
807 // Support: IE, Opera, Webkit
808 // TODO: identify versions
809 // getElementById can match elements by name instead of ID
810 if ( newContext && ( elem = newContext.getElementById( m ) ) &&
811 contains( context, elem ) &&
814 results.push( elem );
820 } else if ( match[ 2 ] ) {
821 push.apply( results, context.getElementsByTagName( selector ) );
825 } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName &&
826 context.getElementsByClassName ) {
828 push.apply( results, context.getElementsByClassName( m ) );
833 // Take advantage of querySelectorAll
835 !nonnativeSelectorCache[ selector + " " ] &&
836 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) &&
838 // Support: IE 8 only
839 // Exclude object elements
840 ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) {
842 newSelector = selector;
843 newContext = context;
845 // qSA considers elements outside a scoping root when evaluating child or
846 // descendant combinators, which is not what we want.
847 // In such cases, we work around the behavior by prefixing every selector in the
848 // list with an ID selector referencing the scope context.
849 // The technique has to be used as well when a leading combinator is used
850 // as such selectors are not recognized by querySelectorAll.
851 // Thanks to Andrew Dupont for this technique.
852 if ( nodeType === 1 &&
853 ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) {
855 // Expand context for sibling selectors
856 newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
859 // We can use :scope instead of the ID hack if the browser
860 // supports it & if we're not changing the context.
861 if ( newContext !== context || !support.scope ) {
863 // Capture the context ID, setting it first if necessary
864 if ( ( nid = context.getAttribute( "id" ) ) ) {
865 nid = nid.replace( rcssescape, fcssescape );
867 context.setAttribute( "id", ( nid = expando ) );
871 // Prefix every selector in the list
872 groups = tokenize( selector );
875 groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " +
876 toSelector( groups[ i ] );
878 newSelector = groups.join( "," );
883 newContext.querySelectorAll( newSelector )
886 } catch ( qsaError ) {
887 nonnativeSelectorCache( selector, true );
889 if ( nid === expando ) {
890 context.removeAttribute( "id" );
898 return select( selector.replace( rtrim, "$1" ), context, results, seed );
902 * Create key-value caches of limited size
903 * @returns {function(string, object)} Returns the Object data after storing it on itself with
904 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
905 * deleting the oldest entry
907 function createCache() {
910 function cache( key, value ) {
912 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
913 if ( keys.push( key + " " ) > Expr.cacheLength ) {
915 // Only keep the most recent entries
916 delete cache[ keys.shift() ];
918 return ( cache[ key + " " ] = value );
924 * Mark a function for special use by Sizzle
925 * @param {Function} fn The function to mark
927 function markFunction( fn ) {
928 fn[ expando ] = true;
933 * Support testing using an element
934 * @param {Function} fn Passed the created element and returns a boolean result
936 function assert( fn ) {
937 var el = document.createElement( "fieldset" );
945 // Remove from its parent by default
946 if ( el.parentNode ) {
947 el.parentNode.removeChild( el );
950 // release memory in IE
956 * Adds the same handler for all of the specified attrs
957 * @param {String} attrs Pipe-separated list of attributes
958 * @param {Function} handler The method that will be applied
960 function addHandle( attrs, handler ) {
961 var arr = attrs.split( "|" ),
965 Expr.attrHandle[ arr[ i ] ] = handler;
970 * Checks document order of two siblings
973 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
975 function siblingCheck( a, b ) {
977 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
978 a.sourceIndex - b.sourceIndex;
980 // Use IE sourceIndex if available on both nodes
985 // Check if b follows a
987 while ( ( cur = cur.nextSibling ) ) {
998 * Returns a function to use in pseudos for input types
999 * @param {String} type
1001 function createInputPseudo( type ) {
1002 return function( elem ) {
1003 var name = elem.nodeName.toLowerCase();
1004 return name === "input" && elem.type === type;
1009 * Returns a function to use in pseudos for buttons
1010 * @param {String} type
1012 function createButtonPseudo( type ) {
1013 return function( elem ) {
1014 var name = elem.nodeName.toLowerCase();
1015 return ( name === "input" || name === "button" ) && elem.type === type;
1020 * Returns a function to use in pseudos for :enabled/:disabled
1021 * @param {Boolean} disabled true for :disabled; false for :enabled
1023 function createDisabledPseudo( disabled ) {
1025 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
1026 return function( elem ) {
1028 // Only certain elements can match :enabled or :disabled
1029 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
1030 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
1031 if ( "form" in elem ) {
1033 // Check for inherited disabledness on relevant non-disabled elements:
1034 // * listed form-associated elements in a disabled fieldset
1035 // https://html.spec.whatwg.org/multipage/forms.html#category-listed
1036 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
1037 // * option elements in a disabled optgroup
1038 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
1039 // All such elements have a "form" property.
1040 if ( elem.parentNode && elem.disabled === false ) {
1042 // Option elements defer to a parent optgroup if present
1043 if ( "label" in elem ) {
1044 if ( "label" in elem.parentNode ) {
1045 return elem.parentNode.disabled === disabled;
1047 return elem.disabled === disabled;
1051 // Support: IE 6 - 11
1052 // Use the isDisabled shortcut property to check for disabled fieldset ancestors
1053 return elem.isDisabled === disabled ||
1055 // Where there is no isDisabled, check manually
1057 elem.isDisabled !== !disabled &&
1058 inDisabledFieldset( elem ) === disabled;
1061 return elem.disabled === disabled;
1063 // Try to winnow out elements that can't be disabled before trusting the disabled property.
1064 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
1065 // even exist on them, let alone have a boolean value.
1066 } else if ( "label" in elem ) {
1067 return elem.disabled === disabled;
1070 // Remaining elements are neither :enabled nor :disabled
1076 * Returns a function to use in pseudos for positionals
1077 * @param {Function} fn
1079 function createPositionalPseudo( fn ) {
1080 return markFunction( function( argument ) {
1081 argument = +argument;
1082 return markFunction( function( seed, matches ) {
1084 matchIndexes = fn( [], seed.length, argument ),
1085 i = matchIndexes.length;
1087 // Match elements found at the specified indexes
1089 if ( seed[ ( j = matchIndexes[ i ] ) ] ) {
1090 seed[ j ] = !( matches[ j ] = seed[ j ] );
1098 * Checks a node for validity as a Sizzle context
1099 * @param {Element|Object=} context
1100 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
1102 function testContext( context ) {
1103 return context && typeof context.getElementsByTagName !== "undefined" && context;
1106 // Expose support vars for convenience
1107 support = Sizzle.support = {};
1111 * @param {Element|Object} elem An element or a document
1112 * @returns {Boolean} True iff elem is a non-HTML XML node
1114 isXML = Sizzle.isXML = function( elem ) {
1115 var namespace = elem && elem.namespaceURI,
1116 docElem = elem && ( elem.ownerDocument || elem ).documentElement;
1119 // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
1120 // https://bugs.jquery.com/ticket/4833
1121 return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
1125 * Sets document-related variables once based on the current document
1126 * @param {Element|Object} [doc] An element or document object to use to set the document
1127 * @returns {Object} Returns the current document
1129 setDocument = Sizzle.setDocument = function( node ) {
1130 var hasCompare, subWindow,
1131 doc = node ? node.ownerDocument || node : preferredDoc;
1133 // Return early if doc is invalid or already selected
1134 // Support: IE 11+, Edge 17 - 18+
1135 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1136 // two documents; shallow comparisons work.
1137 // eslint-disable-next-line eqeqeq
1138 if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) {
1142 // Update global variables
1144 docElem = document.documentElement;
1145 documentIsHTML = !isXML( document );
1147 // Support: IE 9 - 11+, Edge 12 - 18+
1148 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
1149 // Support: IE 11+, Edge 17 - 18+
1150 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1151 // two documents; shallow comparisons work.
1152 // eslint-disable-next-line eqeqeq
1153 if ( preferredDoc != document &&
1154 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
1156 // Support: IE 11, Edge
1157 if ( subWindow.addEventListener ) {
1158 subWindow.addEventListener( "unload", unloadHandler, false );
1160 // Support: IE 9 - 10 only
1161 } else if ( subWindow.attachEvent ) {
1162 subWindow.attachEvent( "onunload", unloadHandler );
1166 // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,
1167 // Safari 4 - 5 only, Opera <=11.6 - 12.x only
1168 // IE/Edge & older browsers don't support the :scope pseudo-class.
1169 // Support: Safari 6.0 only
1170 // Safari 6.0 supports :scope but it's an alias of :root there.
1171 support.scope = assert( function( el ) {
1172 docElem.appendChild( el ).appendChild( document.createElement( "div" ) );
1173 return typeof el.querySelectorAll !== "undefined" &&
1174 !el.querySelectorAll( ":scope fieldset div" ).length;
1177 // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+
1178 // Make sure the the `:has()` argument is parsed unforgivingly.
1179 // We include `*` in the test to detect buggy implementations that are
1180 // _selectively_ forgiving (specifically when the list includes at least
1181 // one valid selector).
1182 // Note that we treat complete lack of support for `:has()` as if it were
1183 // spec-compliant support, which is fine because use of `:has()` in such
1184 // environments will fail in the qSA path and fall back to jQuery traversal
1186 support.cssHas = assert( function() {
1188 document.querySelector( ":has(*,:jqfake)" );
1196 ---------------------------------------------------------------------- */
1199 // Verify that getAttribute really returns attributes and not properties
1200 // (excepting IE8 booleans)
1201 support.attributes = assert( function( el ) {
1203 return !el.getAttribute( "className" );
1207 ---------------------------------------------------------------------- */
1209 // Check if getElementsByTagName("*") returns only elements
1210 support.getElementsByTagName = assert( function( el ) {
1211 el.appendChild( document.createComment( "" ) );
1212 return !el.getElementsByTagName( "*" ).length;
1216 support.getElementsByClassName = rnative.test( document.getElementsByClassName );
1219 // Check if getElementById returns elements by name
1220 // The broken getElementById methods don't pick up programmatically-set names,
1221 // so use a roundabout getElementsByName test
1222 support.getById = assert( function( el ) {
1223 docElem.appendChild( el ).id = expando;
1224 return !document.getElementsByName || !document.getElementsByName( expando ).length;
1227 // ID filter and find
1228 if ( support.getById ) {
1229 Expr.filter[ "ID" ] = function( id ) {
1230 var attrId = id.replace( runescape, funescape );
1231 return function( elem ) {
1232 return elem.getAttribute( "id" ) === attrId;
1235 Expr.find[ "ID" ] = function( id, context ) {
1236 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1237 var elem = context.getElementById( id );
1238 return elem ? [ elem ] : [];
1242 Expr.filter[ "ID" ] = function( id ) {
1243 var attrId = id.replace( runescape, funescape );
1244 return function( elem ) {
1245 var node = typeof elem.getAttributeNode !== "undefined" &&
1246 elem.getAttributeNode( "id" );
1247 return node && node.value === attrId;
1251 // Support: IE 6 - 7 only
1252 // getElementById is not reliable as a find shortcut
1253 Expr.find[ "ID" ] = function( id, context ) {
1254 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1256 elem = context.getElementById( id );
1260 // Verify the id attribute
1261 node = elem.getAttributeNode( "id" );
1262 if ( node && node.value === id ) {
1266 // Fall back on getElementsByName
1267 elems = context.getElementsByName( id );
1269 while ( ( elem = elems[ i++ ] ) ) {
1270 node = elem.getAttributeNode( "id" );
1271 if ( node && node.value === id ) {
1283 Expr.find[ "TAG" ] = support.getElementsByTagName ?
1284 function( tag, context ) {
1285 if ( typeof context.getElementsByTagName !== "undefined" ) {
1286 return context.getElementsByTagName( tag );
1288 // DocumentFragment nodes don't have gEBTN
1289 } else if ( support.qsa ) {
1290 return context.querySelectorAll( tag );
1294 function( tag, context ) {
1299 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
1300 results = context.getElementsByTagName( tag );
1302 // Filter out possible comments
1303 if ( tag === "*" ) {
1304 while ( ( elem = results[ i++ ] ) ) {
1305 if ( elem.nodeType === 1 ) {
1316 Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) {
1317 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
1318 return context.getElementsByClassName( className );
1322 /* QSA/matchesSelector
1323 ---------------------------------------------------------------------- */
1325 // QSA and matchesSelector support
1327 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
1330 // qSa(:focus) reports false when true (Chrome 21)
1331 // We allow this because of a bug in IE8/9 that throws an error
1332 // whenever `document.activeElement` is accessed on an iframe
1333 // So, we allow :focus to pass through QSA all the time to avoid the IE error
1334 // See https://bugs.jquery.com/ticket/13378
1337 if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) {
1340 // Regex strategy adopted from Diego Perini
1341 assert( function( el ) {
1345 // Select is set to empty string on purpose
1346 // This is to test IE's treatment of not explicitly
1347 // setting a boolean content attribute,
1348 // since its presence should be enough
1349 // https://bugs.jquery.com/ticket/12359
1350 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
1351 "<select id='" + expando + "-\r\\' msallowcapture=''>" +
1352 "<option selected=''></option></select>";
1354 // Support: IE8, Opera 11-12.16
1355 // Nothing should be selected when empty strings follow ^= or $= or *=
1356 // The test attribute must be unknown in Opera but "safe" for WinRT
1357 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
1358 if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) {
1359 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
1363 // Boolean attributes and "value" are not treated correctly
1364 if ( !el.querySelectorAll( "[selected]" ).length ) {
1365 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1368 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
1369 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1370 rbuggyQSA.push( "~=" );
1373 // Support: IE 11+, Edge 15 - 18+
1374 // IE 11/Edge don't find elements on a `[name='']` query in some cases.
1375 // Adding a temporary attribute to the document before the selection works
1376 // around the issue.
1377 // Interestingly, IE 10 & older don't seem to have the issue.
1378 input = document.createElement( "input" );
1379 input.setAttribute( "name", "" );
1380 el.appendChild( input );
1381 if ( !el.querySelectorAll( "[name='']" ).length ) {
1382 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
1383 whitespace + "*(?:''|\"\")" );
1386 // Webkit/Opera - :checked should return selected option elements
1387 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1388 // IE8 throws error here and will not see later tests
1389 if ( !el.querySelectorAll( ":checked" ).length ) {
1390 rbuggyQSA.push( ":checked" );
1393 // Support: Safari 8+, iOS 8+
1394 // https://bugs.webkit.org/show_bug.cgi?id=136851
1395 // In-page `selector#id sibling-combinator selector` fails
1396 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
1397 rbuggyQSA.push( ".#.+[+~]" );
1400 // Support: Firefox <=3.6 - 5 only
1401 // Old Firefox doesn't throw on a badly-escaped identifier.
1402 el.querySelectorAll( "\\\f" );
1403 rbuggyQSA.push( "[\\r\\n\\f]" );
1406 assert( function( el ) {
1407 el.innerHTML = "<a href='' disabled='disabled'></a>" +
1408 "<select disabled='disabled'><option/></select>";
1410 // Support: Windows 8 Native Apps
1411 // The type and name attributes are restricted during .innerHTML assignment
1412 var input = document.createElement( "input" );
1413 input.setAttribute( "type", "hidden" );
1414 el.appendChild( input ).setAttribute( "name", "D" );
1417 // Enforce case-sensitivity of name attribute
1418 if ( el.querySelectorAll( "[name=d]" ).length ) {
1419 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1422 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1423 // IE8 throws error here and will not see later tests
1424 if ( el.querySelectorAll( ":enabled" ).length !== 2 ) {
1425 rbuggyQSA.push( ":enabled", ":disabled" );
1429 // IE's :disabled selector does not pick up the children of disabled fieldsets
1430 docElem.appendChild( el ).disabled = true;
1431 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
1432 rbuggyQSA.push( ":enabled", ":disabled" );
1435 // Support: Opera 10 - 11 only
1436 // Opera 10-11 does not throw on post-comma invalid pseudos
1437 el.querySelectorAll( "*,:x" );
1438 rbuggyQSA.push( ",.*:" );
1442 if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches ||
1443 docElem.webkitMatchesSelector ||
1444 docElem.mozMatchesSelector ||
1445 docElem.oMatchesSelector ||
1446 docElem.msMatchesSelector ) ) ) ) {
1448 assert( function( el ) {
1450 // Check to see if it's possible to do matchesSelector
1451 // on a disconnected node (IE 9)
1452 support.disconnectedMatch = matches.call( el, "*" );
1454 // This should fail with an exception
1455 // Gecko does not error, returns false instead
1456 matches.call( el, "[s!='']:x" );
1457 rbuggyMatches.push( "!=", pseudos );
1461 if ( !support.cssHas ) {
1463 // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+
1464 // Our regular `try-catch` mechanism fails to detect natively-unsupported
1465 // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`)
1466 // in browsers that parse the `:has()` argument as a forgiving selector list.
1467 // https://drafts.csswg.org/selectors/#relational now requires the argument
1468 // to be parsed unforgivingly, but browsers have not yet fully adjusted.
1469 rbuggyQSA.push( ":has" );
1472 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
1473 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) );
1476 ---------------------------------------------------------------------- */
1477 hasCompare = rnative.test( docElem.compareDocumentPosition );
1479 // Element contains another
1480 // Purposefully self-exclusive
1481 // As in, an element does not contain itself
1482 contains = hasCompare || rnative.test( docElem.contains ) ?
1485 // Support: IE <9 only
1486 // IE doesn't have `contains` on `document` so we need to check for
1487 // `documentElement` presence.
1488 // We need to fall back to `a` when `documentElement` is missing
1489 // as `ownerDocument` of elements within `<template/>` may have
1490 // a null one - a default behavior of all modern browsers.
1491 var adown = a.nodeType === 9 && a.documentElement || a,
1492 bup = b && b.parentNode;
1493 return a === bup || !!( bup && bup.nodeType === 1 && (
1495 adown.contains( bup ) :
1496 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1501 while ( ( b = b.parentNode ) ) {
1511 ---------------------------------------------------------------------- */
1513 // Document order sorting
1514 sortOrder = hasCompare ?
1517 // Flag for duplicate removal
1519 hasDuplicate = true;
1523 // Sort on method existence if only one input has compareDocumentPosition
1524 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
1529 // Calculate position if both inputs belong to the same document
1530 // Support: IE 11+, Edge 17 - 18+
1531 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1532 // two documents; shallow comparisons work.
1533 // eslint-disable-next-line eqeqeq
1534 compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ?
1535 a.compareDocumentPosition( b ) :
1537 // Otherwise we know they are disconnected
1540 // Disconnected nodes
1542 ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) {
1544 // Choose the first element that is related to our preferred document
1545 // Support: IE 11+, Edge 17 - 18+
1546 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1547 // two documents; shallow comparisons work.
1548 // eslint-disable-next-line eqeqeq
1549 if ( a == document || a.ownerDocument == preferredDoc &&
1550 contains( preferredDoc, a ) ) {
1554 // Support: IE 11+, Edge 17 - 18+
1555 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1556 // two documents; shallow comparisons work.
1557 // eslint-disable-next-line eqeqeq
1558 if ( b == document || b.ownerDocument == preferredDoc &&
1559 contains( preferredDoc, b ) ) {
1563 // Maintain original order
1565 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1569 return compare & 4 ? -1 : 1;
1573 // Exit early if the nodes are identical
1575 hasDuplicate = true;
1586 // Parentless nodes are either documents or disconnected
1587 if ( !aup || !bup ) {
1589 // Support: IE 11+, Edge 17 - 18+
1590 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1591 // two documents; shallow comparisons work.
1592 /* eslint-disable eqeqeq */
1593 return a == document ? -1 :
1595 /* eslint-enable eqeqeq */
1599 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1602 // If the nodes are siblings, we can do a quick check
1603 } else if ( aup === bup ) {
1604 return siblingCheck( a, b );
1607 // Otherwise we need full lists of their ancestors for comparison
1609 while ( ( cur = cur.parentNode ) ) {
1613 while ( ( cur = cur.parentNode ) ) {
1617 // Walk down the tree looking for a discrepancy
1618 while ( ap[ i ] === bp[ i ] ) {
1624 // Do a sibling check if the nodes have a common ancestor
1625 siblingCheck( ap[ i ], bp[ i ] ) :
1627 // Otherwise nodes in our document sort first
1628 // Support: IE 11+, Edge 17 - 18+
1629 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1630 // two documents; shallow comparisons work.
1631 /* eslint-disable eqeqeq */
1632 ap[ i ] == preferredDoc ? -1 :
1633 bp[ i ] == preferredDoc ? 1 :
1634 /* eslint-enable eqeqeq */
1641 Sizzle.matches = function( expr, elements ) {
1642 return Sizzle( expr, null, null, elements );
1645 Sizzle.matchesSelector = function( elem, expr ) {
1646 setDocument( elem );
1648 if ( support.matchesSelector && documentIsHTML &&
1649 !nonnativeSelectorCache[ expr + " " ] &&
1650 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
1651 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
1654 var ret = matches.call( elem, expr );
1656 // IE 9's matchesSelector returns false on disconnected nodes
1657 if ( ret || support.disconnectedMatch ||
1659 // As well, disconnected nodes are said to be in a document
1661 elem.document && elem.document.nodeType !== 11 ) {
1665 nonnativeSelectorCache( expr, true );
1669 return Sizzle( expr, document, null, [ elem ] ).length > 0;
1672 Sizzle.contains = function( context, elem ) {
1674 // Set document vars if needed
1675 // Support: IE 11+, Edge 17 - 18+
1676 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1677 // two documents; shallow comparisons work.
1678 // eslint-disable-next-line eqeqeq
1679 if ( ( context.ownerDocument || context ) != document ) {
1680 setDocument( context );
1682 return contains( context, elem );
1685 Sizzle.attr = function( elem, name ) {
1687 // Set document vars if needed
1688 // Support: IE 11+, Edge 17 - 18+
1689 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1690 // two documents; shallow comparisons work.
1691 // eslint-disable-next-line eqeqeq
1692 if ( ( elem.ownerDocument || elem ) != document ) {
1693 setDocument( elem );
1696 var fn = Expr.attrHandle[ name.toLowerCase() ],
1698 // Don't get fooled by Object.prototype properties (jQuery #13807)
1699 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1700 fn( elem, name, !documentIsHTML ) :
1703 return val !== undefined ?
1705 support.attributes || !documentIsHTML ?
1706 elem.getAttribute( name ) :
1707 ( val = elem.getAttributeNode( name ) ) && val.specified ?
1712 Sizzle.escape = function( sel ) {
1713 return ( sel + "" ).replace( rcssescape, fcssescape );
1716 Sizzle.error = function( msg ) {
1717 throw new Error( "Syntax error, unrecognized expression: " + msg );
1721 * Document sorting and removing duplicates
1722 * @param {ArrayLike} results
1724 Sizzle.uniqueSort = function( results ) {
1730 // Unless we *know* we can detect duplicates, assume their presence
1731 hasDuplicate = !support.detectDuplicates;
1732 sortInput = !support.sortStable && results.slice( 0 );
1733 results.sort( sortOrder );
1735 if ( hasDuplicate ) {
1736 while ( ( elem = results[ i++ ] ) ) {
1737 if ( elem === results[ i ] ) {
1738 j = duplicates.push( i );
1742 results.splice( duplicates[ j ], 1 );
1746 // Clear input after sorting to release objects
1747 // See https://github.com/jquery/sizzle/pull/225
1754 * Utility function for retrieving the text value of an array of DOM nodes
1755 * @param {Array|Element} elem
1757 getText = Sizzle.getText = function( elem ) {
1761 nodeType = elem.nodeType;
1765 // If no nodeType, this is expected to be an array
1766 while ( ( node = elem[ i++ ] ) ) {
1768 // Do not traverse comment nodes
1769 ret += getText( node );
1771 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1773 // Use textContent for elements
1774 // innerText usage removed for consistency of new lines (jQuery #11153)
1775 if ( typeof elem.textContent === "string" ) {
1776 return elem.textContent;
1779 // Traverse its children
1780 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1781 ret += getText( elem );
1784 } else if ( nodeType === 3 || nodeType === 4 ) {
1785 return elem.nodeValue;
1788 // Do not include comment or processing instruction nodes
1793 Expr = Sizzle.selectors = {
1795 // Can be adjusted by the user
1798 createPseudo: markFunction,
1807 ">": { dir: "parentNode", first: true },
1808 " ": { dir: "parentNode" },
1809 "+": { dir: "previousSibling", first: true },
1810 "~": { dir: "previousSibling" }
1814 "ATTR": function( match ) {
1815 match[ 1 ] = match[ 1 ].replace( runescape, funescape );
1817 // Move the given value to match[3] whether quoted or unquoted
1818 match[ 3 ] = ( match[ 3 ] || match[ 4 ] ||
1819 match[ 5 ] || "" ).replace( runescape, funescape );
1821 if ( match[ 2 ] === "~=" ) {
1822 match[ 3 ] = " " + match[ 3 ] + " ";
1825 return match.slice( 0, 4 );
1828 "CHILD": function( match ) {
1830 /* matches from matchExpr["CHILD"]
1831 1 type (only|nth|...)
1832 2 what (child|of-type)
1833 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
1834 4 xn-component of xn+y argument ([+-]?\d*n|)
1835 5 sign of xn-component
1837 7 sign of y-component
1840 match[ 1 ] = match[ 1 ].toLowerCase();
1842 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {
1844 // nth-* requires argument
1845 if ( !match[ 3 ] ) {
1846 Sizzle.error( match[ 0 ] );
1849 // numeric x and y parameters for Expr.filter.CHILD
1850 // remember that false/true cast respectively to 0/1
1851 match[ 4 ] = +( match[ 4 ] ?
1852 match[ 5 ] + ( match[ 6 ] || 1 ) :
1853 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) );
1854 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
1856 // other types prohibit arguments
1857 } else if ( match[ 3 ] ) {
1858 Sizzle.error( match[ 0 ] );
1864 "PSEUDO": function( match ) {
1866 unquoted = !match[ 6 ] && match[ 2 ];
1868 if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) {
1872 // Accept quoted arguments as-is
1874 match[ 2 ] = match[ 4 ] || match[ 5 ] || "";
1876 // Strip excess characters from unquoted arguments
1877 } else if ( unquoted && rpseudo.test( unquoted ) &&
1879 // Get excess from tokenize (recursively)
1880 ( excess = tokenize( unquoted, true ) ) &&
1882 // advance to the next closing parenthesis
1883 ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) {
1885 // excess is a negative index
1886 match[ 0 ] = match[ 0 ].slice( 0, excess );
1887 match[ 2 ] = unquoted.slice( 0, excess );
1890 // Return only captures needed by the pseudo filter method (type and argument)
1891 return match.slice( 0, 3 );
1897 "TAG": function( nodeNameSelector ) {
1898 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1899 return nodeNameSelector === "*" ?
1904 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1908 "CLASS": function( className ) {
1909 var pattern = classCache[ className + " " ];
1912 ( pattern = new RegExp( "(^|" + whitespace +
1913 ")" + className + "(" + whitespace + "|$)" ) ) && classCache(
1914 className, function( elem ) {
1915 return pattern.test(
1916 typeof elem.className === "string" && elem.className ||
1917 typeof elem.getAttribute !== "undefined" &&
1918 elem.getAttribute( "class" ) ||
1924 "ATTR": function( name, operator, check ) {
1925 return function( elem ) {
1926 var result = Sizzle.attr( elem, name );
1928 if ( result == null ) {
1929 return operator === "!=";
1937 /* eslint-disable max-len */
1939 return operator === "=" ? result === check :
1940 operator === "!=" ? result !== check :
1941 operator === "^=" ? check && result.indexOf( check ) === 0 :
1942 operator === "*=" ? check && result.indexOf( check ) > -1 :
1943 operator === "$=" ? check && result.slice( -check.length ) === check :
1944 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
1945 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
1947 /* eslint-enable max-len */
1952 "CHILD": function( type, what, _argument, first, last ) {
1953 var simple = type.slice( 0, 3 ) !== "nth",
1954 forward = type.slice( -4 ) !== "last",
1955 ofType = what === "of-type";
1957 return first === 1 && last === 0 ?
1959 // Shortcut for :nth-*(n)
1961 return !!elem.parentNode;
1964 function( elem, _context, xml ) {
1965 var cache, uniqueCache, outerCache, node, nodeIndex, start,
1966 dir = simple !== forward ? "nextSibling" : "previousSibling",
1967 parent = elem.parentNode,
1968 name = ofType && elem.nodeName.toLowerCase(),
1969 useCache = !xml && !ofType,
1974 // :(first|last|only)-(child|of-type)
1978 while ( ( node = node[ dir ] ) ) {
1980 node.nodeName.toLowerCase() === name :
1981 node.nodeType === 1 ) {
1987 // Reverse direction for :only-* (if we haven't yet done so)
1988 start = dir = type === "only" && !start && "nextSibling";
1993 start = [ forward ? parent.firstChild : parent.lastChild ];
1995 // non-xml :nth-child(...) stores cache data on `parent`
1996 if ( forward && useCache ) {
1998 // Seek `elem` from a previously-cached index
2000 // ...in a gzip-friendly way
2002 outerCache = node[ expando ] || ( node[ expando ] = {} );
2004 // Support: IE <9 only
2005 // Defend against cloned attroperties (jQuery gh-1709)
2006 uniqueCache = outerCache[ node.uniqueID ] ||
2007 ( outerCache[ node.uniqueID ] = {} );
2009 cache = uniqueCache[ type ] || [];
2010 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
2011 diff = nodeIndex && cache[ 2 ];
2012 node = nodeIndex && parent.childNodes[ nodeIndex ];
2014 while ( ( node = ++nodeIndex && node && node[ dir ] ||
2016 // Fallback to seeking `elem` from the start
2017 ( diff = nodeIndex = 0 ) || start.pop() ) ) {
2019 // When found, cache indexes on `parent` and break
2020 if ( node.nodeType === 1 && ++diff && node === elem ) {
2021 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
2028 // Use previously-cached element index if available
2031 // ...in a gzip-friendly way
2033 outerCache = node[ expando ] || ( node[ expando ] = {} );
2035 // Support: IE <9 only
2036 // Defend against cloned attroperties (jQuery gh-1709)
2037 uniqueCache = outerCache[ node.uniqueID ] ||
2038 ( outerCache[ node.uniqueID ] = {} );
2040 cache = uniqueCache[ type ] || [];
2041 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
2045 // xml :nth-child(...)
2046 // or :nth-last-child(...) or :nth(-last)?-of-type(...)
2047 if ( diff === false ) {
2049 // Use the same loop as above to seek `elem` from the start
2050 while ( ( node = ++nodeIndex && node && node[ dir ] ||
2051 ( diff = nodeIndex = 0 ) || start.pop() ) ) {
2054 node.nodeName.toLowerCase() === name :
2055 node.nodeType === 1 ) &&
2058 // Cache the index of each encountered element
2060 outerCache = node[ expando ] ||
2061 ( node[ expando ] = {} );
2063 // Support: IE <9 only
2064 // Defend against cloned attroperties (jQuery gh-1709)
2065 uniqueCache = outerCache[ node.uniqueID ] ||
2066 ( outerCache[ node.uniqueID ] = {} );
2068 uniqueCache[ type ] = [ dirruns, diff ];
2071 if ( node === elem ) {
2079 // Incorporate the offset, then check against cycle size
2081 return diff === first || ( diff % first === 0 && diff / first >= 0 );
2086 "PSEUDO": function( pseudo, argument ) {
2088 // pseudo-class names are case-insensitive
2089 // http://www.w3.org/TR/selectors/#pseudo-classes
2090 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
2091 // Remember that setFilters inherits from pseudos
2093 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
2094 Sizzle.error( "unsupported pseudo: " + pseudo );
2096 // The user may use createPseudo to indicate that
2097 // arguments are needed to create the filter function
2098 // just as Sizzle does
2099 if ( fn[ expando ] ) {
2100 return fn( argument );
2103 // But maintain support for old signatures
2104 if ( fn.length > 1 ) {
2105 args = [ pseudo, pseudo, "", argument ];
2106 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
2107 markFunction( function( seed, matches ) {
2109 matched = fn( seed, argument ),
2112 idx = indexOf( seed, matched[ i ] );
2113 seed[ idx ] = !( matches[ idx ] = matched[ i ] );
2117 return fn( elem, 0, args );
2127 // Potentially complex pseudos
2128 "not": markFunction( function( selector ) {
2130 // Trim the selector passed to compile
2131 // to avoid treating leading and trailing
2132 // spaces as combinators
2135 matcher = compile( selector.replace( rtrim, "$1" ) );
2137 return matcher[ expando ] ?
2138 markFunction( function( seed, matches, _context, xml ) {
2140 unmatched = matcher( seed, null, xml, [] ),
2143 // Match elements unmatched by `matcher`
2145 if ( ( elem = unmatched[ i ] ) ) {
2146 seed[ i ] = !( matches[ i ] = elem );
2150 function( elem, _context, xml ) {
2152 matcher( input, null, xml, results );
2154 // Don't keep the element (issue #299)
2156 return !results.pop();
2160 "has": markFunction( function( selector ) {
2161 return function( elem ) {
2162 return Sizzle( selector, elem ).length > 0;
2166 "contains": markFunction( function( text ) {
2167 text = text.replace( runescape, funescape );
2168 return function( elem ) {
2169 return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1;
2173 // "Whether an element is represented by a :lang() selector
2174 // is based solely on the element's language value
2175 // being equal to the identifier C,
2176 // or beginning with the identifier C immediately followed by "-".
2177 // The matching of C against the element's language value is performed case-insensitively.
2178 // The identifier C does not have to be a valid language name."
2179 // http://www.w3.org/TR/selectors/#lang-pseudo
2180 "lang": markFunction( function( lang ) {
2182 // lang value must be a valid identifier
2183 if ( !ridentifier.test( lang || "" ) ) {
2184 Sizzle.error( "unsupported lang: " + lang );
2186 lang = lang.replace( runescape, funescape ).toLowerCase();
2187 return function( elem ) {
2190 if ( ( elemLang = documentIsHTML ?
2192 elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) {
2194 elemLang = elemLang.toLowerCase();
2195 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
2197 } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 );
2203 "target": function( elem ) {
2204 var hash = window.location && window.location.hash;
2205 return hash && hash.slice( 1 ) === elem.id;
2208 "root": function( elem ) {
2209 return elem === docElem;
2212 "focus": function( elem ) {
2213 return elem === document.activeElement &&
2214 ( !document.hasFocus || document.hasFocus() ) &&
2215 !!( elem.type || elem.href || ~elem.tabIndex );
2218 // Boolean properties
2219 "enabled": createDisabledPseudo( false ),
2220 "disabled": createDisabledPseudo( true ),
2222 "checked": function( elem ) {
2224 // In CSS3, :checked should return both checked and selected elements
2225 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
2226 var nodeName = elem.nodeName.toLowerCase();
2227 return ( nodeName === "input" && !!elem.checked ) ||
2228 ( nodeName === "option" && !!elem.selected );
2231 "selected": function( elem ) {
2233 // Accessing this property makes selected-by-default
2234 // options in Safari work properly
2235 if ( elem.parentNode ) {
2236 // eslint-disable-next-line no-unused-expressions
2237 elem.parentNode.selectedIndex;
2240 return elem.selected === true;
2244 "empty": function( elem ) {
2246 // http://www.w3.org/TR/selectors/#empty-pseudo
2247 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
2248 // but not by others (comment: 8; processing instruction: 7; etc.)
2249 // nodeType < 6 works because attributes (2) do not appear as children
2250 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
2251 if ( elem.nodeType < 6 ) {
2258 "parent": function( elem ) {
2259 return !Expr.pseudos[ "empty" ]( elem );
2262 // Element/input types
2263 "header": function( elem ) {
2264 return rheader.test( elem.nodeName );
2267 "input": function( elem ) {
2268 return rinputs.test( elem.nodeName );
2271 "button": function( elem ) {
2272 var name = elem.nodeName.toLowerCase();
2273 return name === "input" && elem.type === "button" || name === "button";
2276 "text": function( elem ) {
2278 return elem.nodeName.toLowerCase() === "input" &&
2279 elem.type === "text" &&
2281 // Support: IE <10 only
2282 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
2283 ( ( attr = elem.getAttribute( "type" ) ) == null ||
2284 attr.toLowerCase() === "text" );
2287 // Position-in-collection
2288 "first": createPositionalPseudo( function() {
2292 "last": createPositionalPseudo( function( _matchIndexes, length ) {
2293 return [ length - 1 ];
2296 "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) {
2297 return [ argument < 0 ? argument + length : argument ];
2300 "even": createPositionalPseudo( function( matchIndexes, length ) {
2302 for ( ; i < length; i += 2 ) {
2303 matchIndexes.push( i );
2305 return matchIndexes;
2308 "odd": createPositionalPseudo( function( matchIndexes, length ) {
2310 for ( ; i < length; i += 2 ) {
2311 matchIndexes.push( i );
2313 return matchIndexes;
2316 "lt": createPositionalPseudo( function( matchIndexes, length, argument ) {
2317 var i = argument < 0 ?
2322 for ( ; --i >= 0; ) {
2323 matchIndexes.push( i );
2325 return matchIndexes;
2328 "gt": createPositionalPseudo( function( matchIndexes, length, argument ) {
2329 var i = argument < 0 ? argument + length : argument;
2330 for ( ; ++i < length; ) {
2331 matchIndexes.push( i );
2333 return matchIndexes;
2338 Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ];
2340 // Add button/input type pseudos
2341 for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
2342 Expr.pseudos[ i ] = createInputPseudo( i );
2344 for ( i in { submit: true, reset: true } ) {
2345 Expr.pseudos[ i ] = createButtonPseudo( i );
2348 // Easy API for creating new setFilters
2349 function setFilters() {}
2350 setFilters.prototype = Expr.filters = Expr.pseudos;
2351 Expr.setFilters = new setFilters();
2353 tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2354 var matched, match, tokens, type,
2355 soFar, groups, preFilters,
2356 cached = tokenCache[ selector + " " ];
2359 return parseOnly ? 0 : cached.slice( 0 );
2364 preFilters = Expr.preFilter;
2368 // Comma and first run
2369 if ( !matched || ( match = rcomma.exec( soFar ) ) ) {
2372 // Don't consume trailing commas as valid
2373 soFar = soFar.slice( match[ 0 ].length ) || soFar;
2375 groups.push( ( tokens = [] ) );
2381 if ( ( match = rleadingCombinator.exec( soFar ) ) ) {
2382 matched = match.shift();
2386 // Cast descendant combinators to space
2387 type: match[ 0 ].replace( rtrim, " " )
2389 soFar = soFar.slice( matched.length );
2393 for ( type in Expr.filter ) {
2394 if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] ||
2395 ( match = preFilters[ type ]( match ) ) ) ) {
2396 matched = match.shift();
2402 soFar = soFar.slice( matched.length );
2411 // Return the length of the invalid excess
2412 // if we're just parsing
2413 // Otherwise, throw an error or return tokens
2417 Sizzle.error( selector ) :
2420 tokenCache( selector, groups ).slice( 0 );
2423 function toSelector( tokens ) {
2425 len = tokens.length,
2427 for ( ; i < len; i++ ) {
2428 selector += tokens[ i ].value;
2433 function addCombinator( matcher, combinator, base ) {
2434 var dir = combinator.dir,
2435 skip = combinator.next,
2437 checkNonElements = base && key === "parentNode",
2440 return combinator.first ?
2442 // Check against closest ancestor/preceding element
2443 function( elem, context, xml ) {
2444 while ( ( elem = elem[ dir ] ) ) {
2445 if ( elem.nodeType === 1 || checkNonElements ) {
2446 return matcher( elem, context, xml );
2452 // Check against all ancestor/preceding elements
2453 function( elem, context, xml ) {
2454 var oldCache, uniqueCache, outerCache,
2455 newCache = [ dirruns, doneName ];
2457 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
2459 while ( ( elem = elem[ dir ] ) ) {
2460 if ( elem.nodeType === 1 || checkNonElements ) {
2461 if ( matcher( elem, context, xml ) ) {
2467 while ( ( elem = elem[ dir ] ) ) {
2468 if ( elem.nodeType === 1 || checkNonElements ) {
2469 outerCache = elem[ expando ] || ( elem[ expando ] = {} );
2471 // Support: IE <9 only
2472 // Defend against cloned attroperties (jQuery gh-1709)
2473 uniqueCache = outerCache[ elem.uniqueID ] ||
2474 ( outerCache[ elem.uniqueID ] = {} );
2476 if ( skip && skip === elem.nodeName.toLowerCase() ) {
2477 elem = elem[ dir ] || elem;
2478 } else if ( ( oldCache = uniqueCache[ key ] ) &&
2479 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2481 // Assign to newCache so results back-propagate to previous elements
2482 return ( newCache[ 2 ] = oldCache[ 2 ] );
2485 // Reuse newcache so results back-propagate to previous elements
2486 uniqueCache[ key ] = newCache;
2488 // A match means we're done; a fail means we have to keep checking
2489 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
2500 function elementMatcher( matchers ) {
2501 return matchers.length > 1 ?
2502 function( elem, context, xml ) {
2503 var i = matchers.length;
2505 if ( !matchers[ i ]( elem, context, xml ) ) {
2514 function multipleContexts( selector, contexts, results ) {
2516 len = contexts.length;
2517 for ( ; i < len; i++ ) {
2518 Sizzle( selector, contexts[ i ], results );
2523 function condense( unmatched, map, filter, context, xml ) {
2527 len = unmatched.length,
2528 mapped = map != null;
2530 for ( ; i < len; i++ ) {
2531 if ( ( elem = unmatched[ i ] ) ) {
2532 if ( !filter || filter( elem, context, xml ) ) {
2533 newUnmatched.push( elem );
2541 return newUnmatched;
2544 function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2545 if ( postFilter && !postFilter[ expando ] ) {
2546 postFilter = setMatcher( postFilter );
2548 if ( postFinder && !postFinder[ expando ] ) {
2549 postFinder = setMatcher( postFinder, postSelector );
2551 return markFunction( function( seed, results, context, xml ) {
2555 preexisting = results.length,
2557 // Get initial elements from seed or context
2558 elems = seed || multipleContexts(
2560 context.nodeType ? [ context ] : context,
2564 // Prefilter to get matcher input, preserving a map for seed-results synchronization
2565 matcherIn = preFilter && ( seed || !selector ) ?
2566 condense( elems, preMap, preFilter, context, xml ) :
2569 matcherOut = matcher ?
2571 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2572 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2574 // ...intermediate processing is necessary
2577 // ...otherwise use results directly
2581 // Find primary matches
2583 matcher( matcherIn, matcherOut, context, xml );
2588 temp = condense( matcherOut, postMap );
2589 postFilter( temp, [], context, xml );
2591 // Un-match failing elements by moving them back to matcherIn
2594 if ( ( elem = temp[ i ] ) ) {
2595 matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem );
2601 if ( postFinder || preFilter ) {
2604 // Get the final matcherOut by condensing this intermediate into postFinder contexts
2606 i = matcherOut.length;
2608 if ( ( elem = matcherOut[ i ] ) ) {
2610 // Restore matcherIn since elem is not yet a final match
2611 temp.push( ( matcherIn[ i ] = elem ) );
2614 postFinder( null, ( matcherOut = [] ), temp, xml );
2617 // Move matched elements from seed to results to keep them synchronized
2618 i = matcherOut.length;
2620 if ( ( elem = matcherOut[ i ] ) &&
2621 ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) {
2623 seed[ temp ] = !( results[ temp ] = elem );
2628 // Add elements to results, through postFinder if defined
2630 matcherOut = condense(
2631 matcherOut === results ?
2632 matcherOut.splice( preexisting, matcherOut.length ) :
2636 postFinder( null, results, matcherOut, xml );
2638 push.apply( results, matcherOut );
2644 function matcherFromTokens( tokens ) {
2645 var checkContext, matcher, j,
2646 len = tokens.length,
2647 leadingRelative = Expr.relative[ tokens[ 0 ].type ],
2648 implicitRelative = leadingRelative || Expr.relative[ " " ],
2649 i = leadingRelative ? 1 : 0,
2651 // The foundational matcher ensures that elements are reachable from top-level context(s)
2652 matchContext = addCombinator( function( elem ) {
2653 return elem === checkContext;
2654 }, implicitRelative, true ),
2655 matchAnyContext = addCombinator( function( elem ) {
2656 return indexOf( checkContext, elem ) > -1;
2657 }, implicitRelative, true ),
2658 matchers = [ function( elem, context, xml ) {
2659 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2660 ( checkContext = context ).nodeType ?
2661 matchContext( elem, context, xml ) :
2662 matchAnyContext( elem, context, xml ) );
2664 // Avoid hanging onto element (issue #299)
2665 checkContext = null;
2669 for ( ; i < len; i++ ) {
2670 if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) {
2671 matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];
2673 matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches );
2675 // Return special upon seeing a positional matcher
2676 if ( matcher[ expando ] ) {
2678 // Find the next relative operator (if any) for proper handling
2680 for ( ; j < len; j++ ) {
2681 if ( Expr.relative[ tokens[ j ].type ] ) {
2686 i > 1 && elementMatcher( matchers ),
2687 i > 1 && toSelector(
2689 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2692 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
2693 ).replace( rtrim, "$1" ),
2695 i < j && matcherFromTokens( tokens.slice( i, j ) ),
2696 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
2697 j < len && toSelector( tokens )
2700 matchers.push( matcher );
2704 return elementMatcher( matchers );
2707 function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2708 var bySet = setMatchers.length > 0,
2709 byElement = elementMatchers.length > 0,
2710 superMatcher = function( seed, context, xml, results, outermost ) {
2711 var elem, j, matcher,
2714 unmatched = seed && [],
2716 contextBackup = outermostContext,
2718 // We must always have either seed elements or outermost context
2719 elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ),
2721 // Use integer dirruns iff this is the outermost matcher
2722 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
2727 // Support: IE 11+, Edge 17 - 18+
2728 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2729 // two documents; shallow comparisons work.
2730 // eslint-disable-next-line eqeqeq
2731 outermostContext = context == document || context || outermost;
2734 // Add elements passing elementMatchers directly to results
2735 // Support: IE<9, Safari
2736 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
2737 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
2738 if ( byElement && elem ) {
2741 // Support: IE 11+, Edge 17 - 18+
2742 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
2743 // two documents; shallow comparisons work.
2744 // eslint-disable-next-line eqeqeq
2745 if ( !context && elem.ownerDocument != document ) {
2746 setDocument( elem );
2747 xml = !documentIsHTML;
2749 while ( ( matcher = elementMatchers[ j++ ] ) ) {
2750 if ( matcher( elem, context || document, xml ) ) {
2751 results.push( elem );
2756 dirruns = dirrunsUnique;
2760 // Track unmatched elements for set filters
2763 // They will have gone through all possible matchers
2764 if ( ( elem = !matcher && elem ) ) {
2768 // Lengthen the array for every element, matched or not
2770 unmatched.push( elem );
2775 // `i` is now the count of elements visited above, and adding it to `matchedCount`
2776 // makes the latter nonnegative.
2779 // Apply set filters to unmatched elements
2780 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
2781 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
2782 // no element matchers and no seed.
2783 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
2784 // case, which will result in a "00" `matchedCount` that differs from `i` but is also
2785 // numerically zero.
2786 if ( bySet && i !== matchedCount ) {
2788 while ( ( matcher = setMatchers[ j++ ] ) ) {
2789 matcher( unmatched, setMatched, context, xml );
2794 // Reintegrate element matches to eliminate the need for sorting
2795 if ( matchedCount > 0 ) {
2797 if ( !( unmatched[ i ] || setMatched[ i ] ) ) {
2798 setMatched[ i ] = pop.call( results );
2803 // Discard index placeholder values to get only actual matches
2804 setMatched = condense( setMatched );
2807 // Add matches to results
2808 push.apply( results, setMatched );
2810 // Seedless set matches succeeding multiple successful matchers stipulate sorting
2811 if ( outermost && !seed && setMatched.length > 0 &&
2812 ( matchedCount + setMatchers.length ) > 1 ) {
2814 Sizzle.uniqueSort( results );
2818 // Override manipulation of globals by nested matchers
2820 dirruns = dirrunsUnique;
2821 outermostContext = contextBackup;
2828 markFunction( superMatcher ) :
2832 compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2835 elementMatchers = [],
2836 cached = compilerCache[ selector + " " ];
2840 // Generate a function of recursive functions that can be used to check each element
2842 match = tokenize( selector );
2846 cached = matcherFromTokens( match[ i ] );
2847 if ( cached[ expando ] ) {
2848 setMatchers.push( cached );
2850 elementMatchers.push( cached );
2854 // Cache the compiled function
2855 cached = compilerCache(
2857 matcherFromGroupMatchers( elementMatchers, setMatchers )
2860 // Save selector and tokenization
2861 cached.selector = selector;
2867 * A low-level selection function that works with Sizzle's compiled
2868 * selector functions
2869 * @param {String|Function} selector A selector or a pre-compiled
2870 * selector function built with Sizzle.compile
2871 * @param {Element} context
2872 * @param {Array} [results]
2873 * @param {Array} [seed] A set of elements to match against
2875 select = Sizzle.select = function( selector, context, results, seed ) {
2876 var i, tokens, token, type, find,
2877 compiled = typeof selector === "function" && selector,
2878 match = !seed && tokenize( ( selector = compiled.selector || selector ) );
2880 results = results || [];
2882 // Try to minimize operations if there is only one selector in the list and no seed
2883 // (the latter of which guarantees us context)
2884 if ( match.length === 1 ) {
2886 // Reduce context if the leading compound selector is an ID
2887 tokens = match[ 0 ] = match[ 0 ].slice( 0 );
2888 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
2889 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
2891 context = ( Expr.find[ "ID" ]( token.matches[ 0 ]
2892 .replace( runescape, funescape ), context ) || [] )[ 0 ];
2896 // Precompiled matchers will still verify ancestry, so step up a level
2897 } else if ( compiled ) {
2898 context = context.parentNode;
2901 selector = selector.slice( tokens.shift().value.length );
2904 // Fetch a seed set for right-to-left matching
2905 i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length;
2907 token = tokens[ i ];
2909 // Abort if we hit a combinator
2910 if ( Expr.relative[ ( type = token.type ) ] ) {
2913 if ( ( find = Expr.find[ type ] ) ) {
2915 // Search, expanding context for leading sibling combinators
2917 token.matches[ 0 ].replace( runescape, funescape ),
2918 rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) ||
2922 // If seed is empty or no tokens remain, we can return early
2923 tokens.splice( i, 1 );
2924 selector = seed.length && toSelector( tokens );
2926 push.apply( results, seed );
2936 // Compile and execute a filtering function if one is not provided
2937 // Provide `match` to avoid retokenization if we modified the selector above
2938 ( compiled || compile( selector, match ) )(
2943 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
2948 // One-time assignments
2951 support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando;
2953 // Support: Chrome 14-35+
2954 // Always assume duplicates if they aren't passed to the comparison function
2955 support.detectDuplicates = !!hasDuplicate;
2957 // Initialize against the default document
2960 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
2961 // Detached nodes confoundingly follow *each other*
2962 support.sortDetached = assert( function( el ) {
2964 // Should return 1, but returns 4 (following)
2965 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;
2969 // Prevent attribute/property "interpolation"
2970 // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2971 if ( !assert( function( el ) {
2972 el.innerHTML = "<a href='#'></a>";
2973 return el.firstChild.getAttribute( "href" ) === "#";
2975 addHandle( "type|href|height|width", function( elem, name, isXML ) {
2977 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
2983 // Use defaultValue in place of getAttribute("value")
2984 if ( !support.attributes || !assert( function( el ) {
2985 el.innerHTML = "<input/>";
2986 el.firstChild.setAttribute( "value", "" );
2987 return el.firstChild.getAttribute( "value" ) === "";
2989 addHandle( "value", function( elem, _name, isXML ) {
2990 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
2991 return elem.defaultValue;
2997 // Use getAttributeNode to fetch booleans when getAttribute lies
2998 if ( !assert( function( el ) {
2999 return el.getAttribute( "disabled" ) == null;
3001 addHandle( booleans, function( elem, name, isXML ) {
3004 return elem[ name ] === true ? name.toLowerCase() :
3005 ( val = elem.getAttributeNode( name ) ) && val.specified ?
3018 jQuery.find = Sizzle;
3019 jQuery.expr = Sizzle.selectors;
3022 jQuery.expr[ ":" ] = jQuery.expr.pseudos;
3023 jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
3024 jQuery.text = Sizzle.getText;
3025 jQuery.isXMLDoc = Sizzle.isXML;
3026 jQuery.contains = Sizzle.contains;
3027 jQuery.escapeSelector = Sizzle.escape;
3032 var dir = function( elem, dir, until ) {
3034 truncate = until !== undefined;
3036 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
3037 if ( elem.nodeType === 1 ) {
3038 if ( truncate && jQuery( elem ).is( until ) ) {
3041 matched.push( elem );
3048 var siblings = function( n, elem ) {
3051 for ( ; n; n = n.nextSibling ) {
3052 if ( n.nodeType === 1 && n !== elem ) {
3061 var rneedsContext = jQuery.expr.match.needsContext;
3065 function nodeName( elem, name ) {
3067 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
3070 var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
3074 // Implement the identical functionality for filter and not
3075 function winnow( elements, qualifier, not ) {
3076 if ( isFunction( qualifier ) ) {
3077 return jQuery.grep( elements, function( elem, i ) {
3078 return !!qualifier.call( elem, i, elem ) !== not;
3083 if ( qualifier.nodeType ) {
3084 return jQuery.grep( elements, function( elem ) {
3085 return ( elem === qualifier ) !== not;
3089 // Arraylike of elements (jQuery, arguments, Array)
3090 if ( typeof qualifier !== "string" ) {
3091 return jQuery.grep( elements, function( elem ) {
3092 return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
3096 // Filtered directly for both simple and complex selectors
3097 return jQuery.filter( qualifier, elements, not );
3100 jQuery.filter = function( expr, elems, not ) {
3101 var elem = elems[ 0 ];
3104 expr = ":not(" + expr + ")";
3107 if ( elems.length === 1 && elem.nodeType === 1 ) {
3108 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
3111 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
3112 return elem.nodeType === 1;
3117 find: function( selector ) {
3122 if ( typeof selector !== "string" ) {
3123 return this.pushStack( jQuery( selector ).filter( function() {
3124 for ( i = 0; i < len; i++ ) {
3125 if ( jQuery.contains( self[ i ], this ) ) {
3132 ret = this.pushStack( [] );
3134 for ( i = 0; i < len; i++ ) {
3135 jQuery.find( selector, self[ i ], ret );
3138 return len > 1 ? jQuery.uniqueSort( ret ) : ret;
3140 filter: function( selector ) {
3141 return this.pushStack( winnow( this, selector || [], false ) );
3143 not: function( selector ) {
3144 return this.pushStack( winnow( this, selector || [], true ) );
3146 is: function( selector ) {
3150 // If this is a positional/relative selector, check membership in the returned set
3151 // so $("p:first").is("p:last") won't return true for a doc with two "p".
3152 typeof selector === "string" && rneedsContext.test( selector ) ?
3153 jQuery( selector ) :
3161 // Initialize a jQuery object
3164 // A central reference to the root jQuery(document)
3167 // A simple way to check for HTML strings
3168 // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521)
3169 // Strict HTML recognition (trac-11290: must start with <)
3170 // Shortcut simple #id case for speed
3171 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
3173 init = jQuery.fn.init = function( selector, context, root ) {
3176 // HANDLE: $(""), $(null), $(undefined), $(false)
3181 // Method init() accepts an alternate rootjQuery
3182 // so migrate can support jQuery.sub (gh-2101)
3183 root = root || rootjQuery;
3185 // Handle HTML strings
3186 if ( typeof selector === "string" ) {
3187 if ( selector[ 0 ] === "<" &&
3188 selector[ selector.length - 1 ] === ">" &&
3189 selector.length >= 3 ) {
3191 // Assume that strings that start and end with <> are HTML and skip the regex check
3192 match = [ null, selector, null ];
3195 match = rquickExpr.exec( selector );
3198 // Match html or make sure no context is specified for #id
3199 if ( match && ( match[ 1 ] || !context ) ) {
3201 // HANDLE: $(html) -> $(array)
3203 context = context instanceof jQuery ? context[ 0 ] : context;
3205 // Option to run scripts is true for back-compat
3206 // Intentionally let the error be thrown if parseHTML is not present
3207 jQuery.merge( this, jQuery.parseHTML(
3209 context && context.nodeType ? context.ownerDocument || context : document,
3213 // HANDLE: $(html, props)
3214 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
3215 for ( match in context ) {
3217 // Properties of context are called as methods if possible
3218 if ( isFunction( this[ match ] ) ) {
3219 this[ match ]( context[ match ] );
3221 // ...and otherwise set as attributes
3223 this.attr( match, context[ match ] );
3232 elem = document.getElementById( match[ 2 ] );
3236 // Inject the element directly into the jQuery object
3243 // HANDLE: $(expr, $(...))
3244 } else if ( !context || context.jquery ) {
3245 return ( context || root ).find( selector );
3247 // HANDLE: $(expr, context)
3248 // (which is just equivalent to: $(context).find(expr)
3250 return this.constructor( context ).find( selector );
3253 // HANDLE: $(DOMElement)
3254 } else if ( selector.nodeType ) {
3255 this[ 0 ] = selector;
3259 // HANDLE: $(function)
3260 // Shortcut for document ready
3261 } else if ( isFunction( selector ) ) {
3262 return root.ready !== undefined ?
3263 root.ready( selector ) :
3265 // Execute immediately if ready is not present
3269 return jQuery.makeArray( selector, this );
3272 // Give the init function the jQuery prototype for later instantiation
3273 init.prototype = jQuery.fn;
3275 // Initialize central reference
3276 rootjQuery = jQuery( document );
3279 var rparentsprev = /^(?:parents|prev(?:Until|All))/,
3281 // Methods guaranteed to produce a unique set when starting from a unique set
3282 guaranteedUnique = {
3290 has: function( target ) {
3291 var targets = jQuery( target, this ),
3294 return this.filter( function() {
3296 for ( ; i < l; i++ ) {
3297 if ( jQuery.contains( this, targets[ i ] ) ) {
3304 closest: function( selectors, context ) {
3309 targets = typeof selectors !== "string" && jQuery( selectors );
3311 // Positional selectors never match, since there's no _selection_ context
3312 if ( !rneedsContext.test( selectors ) ) {
3313 for ( ; i < l; i++ ) {
3314 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
3316 // Always skip document fragments
3317 if ( cur.nodeType < 11 && ( targets ?
3318 targets.index( cur ) > -1 :
3320 // Don't pass non-elements to Sizzle
3321 cur.nodeType === 1 &&
3322 jQuery.find.matchesSelector( cur, selectors ) ) ) {
3324 matched.push( cur );
3331 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
3334 // Determine the position of an element within the set
3335 index: function( elem ) {
3337 // No argument, return index in parent
3339 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
3342 // Index in selector
3343 if ( typeof elem === "string" ) {
3344 return indexOf.call( jQuery( elem ), this[ 0 ] );
3347 // Locate the position of the desired element
3348 return indexOf.call( this,
3350 // If it receives a jQuery object, the first element is used
3351 elem.jquery ? elem[ 0 ] : elem
3355 add: function( selector, context ) {
3356 return this.pushStack(
3358 jQuery.merge( this.get(), jQuery( selector, context ) )
3363 addBack: function( selector ) {
3364 return this.add( selector == null ?
3365 this.prevObject : this.prevObject.filter( selector )
3370 function sibling( cur, dir ) {
3371 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
3376 parent: function( elem ) {
3377 var parent = elem.parentNode;
3378 return parent && parent.nodeType !== 11 ? parent : null;
3380 parents: function( elem ) {
3381 return dir( elem, "parentNode" );
3383 parentsUntil: function( elem, _i, until ) {
3384 return dir( elem, "parentNode", until );
3386 next: function( elem ) {
3387 return sibling( elem, "nextSibling" );
3389 prev: function( elem ) {
3390 return sibling( elem, "previousSibling" );
3392 nextAll: function( elem ) {
3393 return dir( elem, "nextSibling" );
3395 prevAll: function( elem ) {
3396 return dir( elem, "previousSibling" );
3398 nextUntil: function( elem, _i, until ) {
3399 return dir( elem, "nextSibling", until );
3401 prevUntil: function( elem, _i, until ) {
3402 return dir( elem, "previousSibling", until );
3404 siblings: function( elem ) {
3405 return siblings( ( elem.parentNode || {} ).firstChild, elem );
3407 children: function( elem ) {
3408 return siblings( elem.firstChild );
3410 contents: function( elem ) {
3411 if ( elem.contentDocument != null &&
3414 // <object> elements with no `data` attribute has an object
3415 // `contentDocument` with a `null` prototype.
3416 getProto( elem.contentDocument ) ) {
3418 return elem.contentDocument;
3421 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
3422 // Treat the template element as a regular one in browsers that
3423 // don't support it.
3424 if ( nodeName( elem, "template" ) ) {
3425 elem = elem.content || elem;
3428 return jQuery.merge( [], elem.childNodes );
3430 }, function( name, fn ) {
3431 jQuery.fn[ name ] = function( until, selector ) {
3432 var matched = jQuery.map( this, fn, until );
3434 if ( name.slice( -5 ) !== "Until" ) {
3438 if ( selector && typeof selector === "string" ) {
3439 matched = jQuery.filter( selector, matched );
3442 if ( this.length > 1 ) {
3444 // Remove duplicates
3445 if ( !guaranteedUnique[ name ] ) {
3446 jQuery.uniqueSort( matched );
3449 // Reverse order for parents* and prev-derivatives
3450 if ( rparentsprev.test( name ) ) {
3455 return this.pushStack( matched );
3458 var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
3462 // Convert String-formatted options into Object-formatted ones
3463 function createOptions( options ) {
3465 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
3466 object[ flag ] = true;
3472 * Create a callback list using the following parameters:
3474 * options: an optional list of space-separated options that will change how
3475 * the callback list behaves or a more traditional option object
3477 * By default a callback list will act like an event callback list and can be
3478 * "fired" multiple times.
3482 * once: will ensure the callback list can only be fired once (like a Deferred)
3484 * memory: will keep track of previous values and will call any callback added
3485 * after the list has been fired right away with the latest "memorized"
3486 * values (like a Deferred)
3488 * unique: will ensure a callback can only be added once (no duplicate in the list)
3490 * stopOnFalse: interrupt callings when a callback returns false
3493 jQuery.Callbacks = function( options ) {
3495 // Convert options from String-formatted to Object-formatted if needed
3496 // (we check in cache first)
3497 options = typeof options === "string" ?
3498 createOptions( options ) :
3499 jQuery.extend( {}, options );
3501 var // Flag to know if list is currently firing
3504 // Last fire value for non-forgettable lists
3507 // Flag to know if list was already fired
3510 // Flag to prevent firing
3513 // Actual callback list
3516 // Queue of execution data for repeatable lists
3519 // Index of currently firing callback (modified by add/remove as needed)
3525 // Enforce single-firing
3526 locked = locked || options.once;
3528 // Execute callbacks for all pending executions,
3529 // respecting firingIndex overrides and runtime changes
3530 fired = firing = true;
3531 for ( ; queue.length; firingIndex = -1 ) {
3532 memory = queue.shift();
3533 while ( ++firingIndex < list.length ) {
3535 // Run callback and check for early termination
3536 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
3537 options.stopOnFalse ) {
3539 // Jump to end and forget the data so .add doesn't re-fire
3540 firingIndex = list.length;
3546 // Forget the data if we're done with it
3547 if ( !options.memory ) {
3553 // Clean up if we're done firing for good
3556 // Keep an empty list if we have data for future add calls
3560 // Otherwise, this object is spent
3567 // Actual Callbacks object
3570 // Add a callback or a collection of callbacks to the list
3574 // If we have memory from a past run, we should fire after adding
3575 if ( memory && !firing ) {
3576 firingIndex = list.length - 1;
3577 queue.push( memory );
3580 ( function add( args ) {
3581 jQuery.each( args, function( _, arg ) {
3582 if ( isFunction( arg ) ) {
3583 if ( !options.unique || !self.has( arg ) ) {
3586 } else if ( arg && arg.length && toType( arg ) !== "string" ) {
3588 // Inspect recursively
3594 if ( memory && !firing ) {
3601 // Remove a callback from the list
3602 remove: function() {
3603 jQuery.each( arguments, function( _, arg ) {
3605 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
3606 list.splice( index, 1 );
3608 // Handle firing indexes
3609 if ( index <= firingIndex ) {
3617 // Check if a given callback is in the list.
3618 // If no argument is given, return whether or not list has callbacks attached.
3619 has: function( fn ) {
3621 jQuery.inArray( fn, list ) > -1 :
3625 // Remove all callbacks from the list
3633 // Disable .fire and .add
3634 // Abort any current/pending executions
3635 // Clear all callbacks and values
3636 disable: function() {
3637 locked = queue = [];
3641 disabled: function() {
3646 // Also disable .add unless we have memory (since it would have no effect)
3647 // Abort any pending executions
3649 locked = queue = [];
3650 if ( !memory && !firing ) {
3655 locked: function() {
3659 // Call all callbacks with the given context and arguments
3660 fireWith: function( context, args ) {
3663 args = [ context, args.slice ? args.slice() : args ];
3672 // Call all the callbacks with the given arguments
3674 self.fireWith( this, arguments );
3678 // To know if the callbacks have already been called at least once
3688 function Identity( v ) {
3691 function Thrower( ex ) {
3695 function adoptValue( value, resolve, reject, noValue ) {
3700 // Check for promise aspect first to privilege synchronous behavior
3701 if ( value && isFunction( ( method = value.promise ) ) ) {
3702 method.call( value ).done( resolve ).fail( reject );
3705 } else if ( value && isFunction( ( method = value.then ) ) ) {
3706 method.call( value, resolve, reject );
3708 // Other non-thenables
3711 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
3712 // * false: [ value ].slice( 0 ) => resolve( value )
3713 // * true: [ value ].slice( 1 ) => resolve()
3714 resolve.apply( undefined, [ value ].slice( noValue ) );
3717 // For Promises/A+, convert exceptions into rejections
3718 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
3719 // Deferred#then to conditionally suppress rejection.
3722 // Support: Android 4.0 only
3723 // Strict mode functions invoked without .call/.apply get global-object context
3724 reject.apply( undefined, [ value ] );
3730 Deferred: function( func ) {
3733 // action, add listener, callbacks,
3734 // ... .then handlers, argument index, [final state]
3735 [ "notify", "progress", jQuery.Callbacks( "memory" ),
3736 jQuery.Callbacks( "memory" ), 2 ],
3737 [ "resolve", "done", jQuery.Callbacks( "once memory" ),
3738 jQuery.Callbacks( "once memory" ), 0, "resolved" ],
3739 [ "reject", "fail", jQuery.Callbacks( "once memory" ),
3740 jQuery.Callbacks( "once memory" ), 1, "rejected" ]
3747 always: function() {
3748 deferred.done( arguments ).fail( arguments );
3751 "catch": function( fn ) {
3752 return promise.then( null, fn );
3755 // Keep pipe for back-compat
3756 pipe: function( /* fnDone, fnFail, fnProgress */ ) {
3757 var fns = arguments;
3759 return jQuery.Deferred( function( newDefer ) {
3760 jQuery.each( tuples, function( _i, tuple ) {
3762 // Map tuples (progress, done, fail) to arguments (done, fail, progress)
3763 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
3765 // deferred.progress(function() { bind to newDefer or newDefer.notify })
3766 // deferred.done(function() { bind to newDefer or newDefer.resolve })
3767 // deferred.fail(function() { bind to newDefer or newDefer.reject })
3768 deferred[ tuple[ 1 ] ]( function() {
3769 var returned = fn && fn.apply( this, arguments );
3770 if ( returned && isFunction( returned.promise ) ) {
3772 .progress( newDefer.notify )
3773 .done( newDefer.resolve )
3774 .fail( newDefer.reject );
3776 newDefer[ tuple[ 0 ] + "With" ](
3778 fn ? [ returned ] : arguments
3786 then: function( onFulfilled, onRejected, onProgress ) {
3788 function resolve( depth, deferred, handler, special ) {
3792 mightThrow = function() {
3795 // Support: Promises/A+ section 2.3.3.3.3
3796 // https://promisesaplus.com/#point-59
3797 // Ignore double-resolution attempts
3798 if ( depth < maxDepth ) {
3802 returned = handler.apply( that, args );
3804 // Support: Promises/A+ section 2.3.1
3805 // https://promisesaplus.com/#point-48
3806 if ( returned === deferred.promise() ) {
3807 throw new TypeError( "Thenable self-resolution" );
3810 // Support: Promises/A+ sections 2.3.3.1, 3.5
3811 // https://promisesaplus.com/#point-54
3812 // https://promisesaplus.com/#point-75
3813 // Retrieve `then` only once
3816 // Support: Promises/A+ section 2.3.4
3817 // https://promisesaplus.com/#point-64
3818 // Only check objects and functions for thenability
3819 ( typeof returned === "object" ||
3820 typeof returned === "function" ) &&
3823 // Handle a returned thenable
3824 if ( isFunction( then ) ) {
3826 // Special processors (notify) just wait for resolution
3830 resolve( maxDepth, deferred, Identity, special ),
3831 resolve( maxDepth, deferred, Thrower, special )
3834 // Normal processors (resolve) also hook into progress
3837 // ...and disregard older resolution values
3842 resolve( maxDepth, deferred, Identity, special ),
3843 resolve( maxDepth, deferred, Thrower, special ),
3844 resolve( maxDepth, deferred, Identity,
3845 deferred.notifyWith )
3849 // Handle all other returned values
3852 // Only substitute handlers pass on context
3853 // and multiple values (non-spec behavior)
3854 if ( handler !== Identity ) {
3856 args = [ returned ];
3859 // Process the value(s)
3860 // Default process is resolve
3861 ( special || deferred.resolveWith )( that, args );
3865 // Only normal processors (resolve) catch and reject exceptions
3873 if ( jQuery.Deferred.exceptionHook ) {
3874 jQuery.Deferred.exceptionHook( e,
3875 process.stackTrace );
3878 // Support: Promises/A+ section 2.3.3.3.4.1
3879 // https://promisesaplus.com/#point-61
3880 // Ignore post-resolution exceptions
3881 if ( depth + 1 >= maxDepth ) {
3883 // Only substitute handlers pass on context
3884 // and multiple values (non-spec behavior)
3885 if ( handler !== Thrower ) {
3890 deferred.rejectWith( that, args );
3895 // Support: Promises/A+ section 2.3.3.3.1
3896 // https://promisesaplus.com/#point-57
3897 // Re-resolve promises immediately to dodge false rejection from
3898 // subsequent errors
3903 // Call an optional hook to record the stack, in case of exception
3904 // since it's otherwise lost when execution goes async
3905 if ( jQuery.Deferred.getStackHook ) {
3906 process.stackTrace = jQuery.Deferred.getStackHook();
3908 window.setTimeout( process );
3913 return jQuery.Deferred( function( newDefer ) {
3915 // progress_handlers.add( ... )
3916 tuples[ 0 ][ 3 ].add(
3920 isFunction( onProgress ) ?
3927 // fulfilled_handlers.add( ... )
3928 tuples[ 1 ][ 3 ].add(
3932 isFunction( onFulfilled ) ?
3938 // rejected_handlers.add( ... )
3939 tuples[ 2 ][ 3 ].add(
3943 isFunction( onRejected ) ?
3951 // Get a promise for this deferred
3952 // If obj is provided, the promise aspect is added to the object
3953 promise: function( obj ) {
3954 return obj != null ? jQuery.extend( obj, promise ) : promise;
3959 // Add list-specific methods
3960 jQuery.each( tuples, function( i, tuple ) {
3961 var list = tuple[ 2 ],
3962 stateString = tuple[ 5 ];
3964 // promise.progress = list.add
3965 // promise.done = list.add
3966 // promise.fail = list.add
3967 promise[ tuple[ 1 ] ] = list.add;
3970 if ( stateString ) {
3974 // state = "resolved" (i.e., fulfilled)
3975 // state = "rejected"
3976 state = stateString;
3979 // rejected_callbacks.disable
3980 // fulfilled_callbacks.disable
3981 tuples[ 3 - i ][ 2 ].disable,
3983 // rejected_handlers.disable
3984 // fulfilled_handlers.disable
3985 tuples[ 3 - i ][ 3 ].disable,
3987 // progress_callbacks.lock
3988 tuples[ 0 ][ 2 ].lock,
3990 // progress_handlers.lock
3991 tuples[ 0 ][ 3 ].lock
3995 // progress_handlers.fire
3996 // fulfilled_handlers.fire
3997 // rejected_handlers.fire
3998 list.add( tuple[ 3 ].fire );
4000 // deferred.notify = function() { deferred.notifyWith(...) }
4001 // deferred.resolve = function() { deferred.resolveWith(...) }
4002 // deferred.reject = function() { deferred.rejectWith(...) }
4003 deferred[ tuple[ 0 ] ] = function() {
4004 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
4008 // deferred.notifyWith = list.fireWith
4009 // deferred.resolveWith = list.fireWith
4010 // deferred.rejectWith = list.fireWith
4011 deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
4014 // Make the deferred a promise
4015 promise.promise( deferred );
4017 // Call given func if any
4019 func.call( deferred, deferred );
4027 when: function( singleValue ) {
4030 // count of uncompleted subordinates
4031 remaining = arguments.length,
4033 // count of unprocessed arguments
4036 // subordinate fulfillment data
4037 resolveContexts = Array( i ),
4038 resolveValues = slice.call( arguments ),
4040 // the primary Deferred
4041 primary = jQuery.Deferred(),
4043 // subordinate callback factory
4044 updateFunc = function( i ) {
4045 return function( value ) {
4046 resolveContexts[ i ] = this;
4047 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
4048 if ( !( --remaining ) ) {
4049 primary.resolveWith( resolveContexts, resolveValues );
4054 // Single- and empty arguments are adopted like Promise.resolve
4055 if ( remaining <= 1 ) {
4056 adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject,
4059 // Use .then() to unwrap secondary thenables (cf. gh-3000)
4060 if ( primary.state() === "pending" ||
4061 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
4063 return primary.then();
4067 // Multiple arguments are aggregated like Promise.all array elements
4069 adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject );
4072 return primary.promise();
4077 // These usually indicate a programmer mistake during development,
4078 // warn about them ASAP rather than swallowing them by default.
4079 var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
4081 jQuery.Deferred.exceptionHook = function( error, stack ) {
4083 // Support: IE 8 - 9 only
4084 // Console exists when dev tools are open, which can happen at any time
4085 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
4086 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
4093 jQuery.readyException = function( error ) {
4094 window.setTimeout( function() {
4102 // The deferred used on DOM ready
4103 var readyList = jQuery.Deferred();
4105 jQuery.fn.ready = function( fn ) {
4110 // Wrap jQuery.readyException in a function so that the lookup
4111 // happens at the time of error handling instead of callback
4113 .catch( function( error ) {
4114 jQuery.readyException( error );
4122 // Is the DOM ready to be used? Set to true once it occurs.
4125 // A counter to track how many items to wait for before
4126 // the ready event fires. See trac-6781
4129 // Handle when the DOM is ready
4130 ready: function( wait ) {
4132 // Abort if there are pending holds or we're already ready
4133 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
4137 // Remember that the DOM is ready
4138 jQuery.isReady = true;
4140 // If a normal DOM Ready event fired, decrement, and wait if need be
4141 if ( wait !== true && --jQuery.readyWait > 0 ) {
4145 // If there are functions bound, to execute
4146 readyList.resolveWith( document, [ jQuery ] );
4150 jQuery.ready.then = readyList.then;
4152 // The ready event handler and self cleanup method
4153 function completed() {
4154 document.removeEventListener( "DOMContentLoaded", completed );
4155 window.removeEventListener( "load", completed );
4159 // Catch cases where $(document).ready() is called
4160 // after the browser event has already occurred.
4161 // Support: IE <=9 - 10 only
4162 // Older IE sometimes signals "interactive" too soon
4163 if ( document.readyState === "complete" ||
4164 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
4166 // Handle it asynchronously to allow scripts the opportunity to delay ready
4167 window.setTimeout( jQuery.ready );
4171 // Use the handy event callback
4172 document.addEventListener( "DOMContentLoaded", completed );
4174 // A fallback to window.onload, that will always work
4175 window.addEventListener( "load", completed );
4181 // Multifunctional method to get and set values of a collection
4182 // The value/s can optionally be executed if it's a function
4183 var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
4189 if ( toType( key ) === "object" ) {
4192 access( elems, fn, i, key[ i ], true, emptyGet, raw );
4196 } else if ( value !== undefined ) {
4199 if ( !isFunction( value ) ) {
4205 // Bulk operations run against the entire set
4207 fn.call( elems, value );
4210 // ...except when executing function values
4213 fn = function( elem, _key, value ) {
4214 return bulk.call( jQuery( elem ), value );
4220 for ( ; i < len; i++ ) {
4222 elems[ i ], key, raw ?
4224 value.call( elems[ i ], i, fn( elems[ i ], key ) )
4236 return fn.call( elems );
4239 return len ? fn( elems[ 0 ], key ) : emptyGet;
4243 // Matches dashed string for camelizing
4244 var rmsPrefix = /^-ms-/,
4245 rdashAlpha = /-([a-z])/g;
4247 // Used by camelCase as callback to replace()
4248 function fcamelCase( _all, letter ) {
4249 return letter.toUpperCase();
4252 // Convert dashed to camelCase; used by the css and data modules
4253 // Support: IE <=9 - 11, Edge 12 - 15
4254 // Microsoft forgot to hump their vendor prefix (trac-9572)
4255 function camelCase( string ) {
4256 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
4258 var acceptData = function( owner ) {
4262 // - Node.ELEMENT_NODE
4263 // - Node.DOCUMENT_NODE
4266 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
4273 this.expando = jQuery.expando + Data.uid++;
4280 cache: function( owner ) {
4282 // Check if the owner object already has a cache
4283 var value = owner[ this.expando ];
4285 // If not, create one
4289 // We can accept data for non-element nodes in modern browsers,
4290 // but we should not, see trac-8335.
4291 // Always return an empty object.
4292 if ( acceptData( owner ) ) {
4294 // If it is a node unlikely to be stringify-ed or looped over
4295 // use plain assignment
4296 if ( owner.nodeType ) {
4297 owner[ this.expando ] = value;
4299 // Otherwise secure it in a non-enumerable property
4300 // configurable must be true to allow the property to be
4301 // deleted when data is removed
4303 Object.defineProperty( owner, this.expando, {
4313 set: function( owner, data, value ) {
4315 cache = this.cache( owner );
4317 // Handle: [ owner, key, value ] args
4318 // Always use camelCase key (gh-2257)
4319 if ( typeof data === "string" ) {
4320 cache[ camelCase( data ) ] = value;
4322 // Handle: [ owner, { properties } ] args
4325 // Copy the properties one-by-one to the cache object
4326 for ( prop in data ) {
4327 cache[ camelCase( prop ) ] = data[ prop ];
4332 get: function( owner, key ) {
4333 return key === undefined ?
4334 this.cache( owner ) :
4336 // Always use camelCase key (gh-2257)
4337 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
4339 access: function( owner, key, value ) {
4341 // In cases where either:
4343 // 1. No key was specified
4344 // 2. A string key was specified, but no value provided
4346 // Take the "read" path and allow the get method to determine
4347 // which value to return, respectively either:
4349 // 1. The entire cache object
4350 // 2. The data stored at the key
4352 if ( key === undefined ||
4353 ( ( key && typeof key === "string" ) && value === undefined ) ) {
4355 return this.get( owner, key );
4358 // When the key is not a string, or both a key and value
4359 // are specified, set or extend (existing objects) with either:
4361 // 1. An object of properties
4362 // 2. A key and value
4364 this.set( owner, key, value );
4366 // Since the "set" path can have two possible entry points
4367 // return the expected data based on which path was taken[*]
4368 return value !== undefined ? value : key;
4370 remove: function( owner, key ) {
4372 cache = owner[ this.expando ];
4374 if ( cache === undefined ) {
4378 if ( key !== undefined ) {
4380 // Support array or space separated string of keys
4381 if ( Array.isArray( key ) ) {
4383 // If key is an array of keys...
4384 // We always set camelCase keys, so remove that.
4385 key = key.map( camelCase );
4387 key = camelCase( key );
4389 // If a key with the spaces exists, use it.
4390 // Otherwise, create an array by matching non-whitespace
4391 key = key in cache ?
4393 ( key.match( rnothtmlwhite ) || [] );
4399 delete cache[ key[ i ] ];
4403 // Remove the expando if there's no more data
4404 if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
4406 // Support: Chrome <=35 - 45
4407 // Webkit & Blink performance suffers when deleting properties
4408 // from DOM nodes, so set to undefined instead
4409 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
4410 if ( owner.nodeType ) {
4411 owner[ this.expando ] = undefined;
4413 delete owner[ this.expando ];
4417 hasData: function( owner ) {
4418 var cache = owner[ this.expando ];
4419 return cache !== undefined && !jQuery.isEmptyObject( cache );
4422 var dataPriv = new Data();
4424 var dataUser = new Data();
4428 // Implementation Summary
4430 // 1. Enforce API surface and semantic compatibility with 1.9.x branch
4431 // 2. Improve the module's maintainability by reducing the storage
4432 // paths to a single mechanism.
4433 // 3. Use the same single mechanism to support "private" and "user" data.
4434 // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
4435 // 5. Avoid exposing implementation details on user objects (eg. expando properties)
4436 // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
4438 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
4439 rmultiDash = /[A-Z]/g;
4441 function getData( data ) {
4442 if ( data === "true" ) {
4446 if ( data === "false" ) {
4450 if ( data === "null" ) {
4454 // Only convert to a number if it doesn't change the string
4455 if ( data === +data + "" ) {
4459 if ( rbrace.test( data ) ) {
4460 return JSON.parse( data );
4466 function dataAttr( elem, key, data ) {
4469 // If nothing was found internally, try to fetch any
4470 // data from the HTML5 data-* attribute
4471 if ( data === undefined && elem.nodeType === 1 ) {
4472 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
4473 data = elem.getAttribute( name );
4475 if ( typeof data === "string" ) {
4477 data = getData( data );
4480 // Make sure we set the data so it isn't changed later
4481 dataUser.set( elem, key, data );
4490 hasData: function( elem ) {
4491 return dataUser.hasData( elem ) || dataPriv.hasData( elem );
4494 data: function( elem, name, data ) {
4495 return dataUser.access( elem, name, data );
4498 removeData: function( elem, name ) {
4499 dataUser.remove( elem, name );
4502 // TODO: Now that all calls to _data and _removeData have been replaced
4503 // with direct calls to dataPriv methods, these can be deprecated.
4504 _data: function( elem, name, data ) {
4505 return dataPriv.access( elem, name, data );
4508 _removeData: function( elem, name ) {
4509 dataPriv.remove( elem, name );
4514 data: function( key, value ) {
4517 attrs = elem && elem.attributes;
4520 if ( key === undefined ) {
4521 if ( this.length ) {
4522 data = dataUser.get( elem );
4524 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
4528 // Support: IE 11 only
4529 // The attrs elements can be null (trac-14894)
4531 name = attrs[ i ].name;
4532 if ( name.indexOf( "data-" ) === 0 ) {
4533 name = camelCase( name.slice( 5 ) );
4534 dataAttr( elem, name, data[ name ] );
4538 dataPriv.set( elem, "hasDataAttrs", true );
4545 // Sets multiple values
4546 if ( typeof key === "object" ) {
4547 return this.each( function() {
4548 dataUser.set( this, key );
4552 return access( this, function( value ) {
4555 // The calling jQuery object (element matches) is not empty
4556 // (and therefore has an element appears at this[ 0 ]) and the
4557 // `value` parameter was not undefined. An empty jQuery object
4558 // will result in `undefined` for elem = this[ 0 ] which will
4559 // throw an exception if an attempt to read a data cache is made.
4560 if ( elem && value === undefined ) {
4562 // Attempt to get data from the cache
4563 // The key will always be camelCased in Data
4564 data = dataUser.get( elem, key );
4565 if ( data !== undefined ) {
4569 // Attempt to "discover" the data in
4570 // HTML5 custom data-* attrs
4571 data = dataAttr( elem, key );
4572 if ( data !== undefined ) {
4576 // We tried really hard, but the data doesn't exist.
4581 this.each( function() {
4583 // We always store the camelCased key
4584 dataUser.set( this, key, value );
4586 }, null, value, arguments.length > 1, null, true );
4589 removeData: function( key ) {
4590 return this.each( function() {
4591 dataUser.remove( this, key );
4598 queue: function( elem, type, data ) {
4602 type = ( type || "fx" ) + "queue";
4603 queue = dataPriv.get( elem, type );
4605 // Speed up dequeue by getting out quickly if this is just a lookup
4607 if ( !queue || Array.isArray( data ) ) {
4608 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
4617 dequeue: function( elem, type ) {
4618 type = type || "fx";
4620 var queue = jQuery.queue( elem, type ),
4621 startLength = queue.length,
4623 hooks = jQuery._queueHooks( elem, type ),
4625 jQuery.dequeue( elem, type );
4628 // If the fx queue is dequeued, always remove the progress sentinel
4629 if ( fn === "inprogress" ) {
4636 // Add a progress sentinel to prevent the fx queue from being
4637 // automatically dequeued
4638 if ( type === "fx" ) {
4639 queue.unshift( "inprogress" );
4642 // Clear up the last queue stop function
4644 fn.call( elem, next, hooks );
4647 if ( !startLength && hooks ) {
4652 // Not public - generate a queueHooks object, or return the current one
4653 _queueHooks: function( elem, type ) {
4654 var key = type + "queueHooks";
4655 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
4656 empty: jQuery.Callbacks( "once memory" ).add( function() {
4657 dataPriv.remove( elem, [ type + "queue", key ] );
4664 queue: function( type, data ) {
4667 if ( typeof type !== "string" ) {
4673 if ( arguments.length < setter ) {
4674 return jQuery.queue( this[ 0 ], type );
4677 return data === undefined ?
4679 this.each( function() {
4680 var queue = jQuery.queue( this, type, data );
4682 // Ensure a hooks for this queue
4683 jQuery._queueHooks( this, type );
4685 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
4686 jQuery.dequeue( this, type );
4690 dequeue: function( type ) {
4691 return this.each( function() {
4692 jQuery.dequeue( this, type );
4695 clearQueue: function( type ) {
4696 return this.queue( type || "fx", [] );
4699 // Get a promise resolved when queues of a certain type
4700 // are emptied (fx is the type by default)
4701 promise: function( type, obj ) {
4704 defer = jQuery.Deferred(),
4707 resolve = function() {
4708 if ( !( --count ) ) {
4709 defer.resolveWith( elements, [ elements ] );
4713 if ( typeof type !== "string" ) {
4717 type = type || "fx";
4720 tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
4721 if ( tmp && tmp.empty ) {
4723 tmp.empty.add( resolve );
4727 return defer.promise( obj );
4730 var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
4732 var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
4735 var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
4737 var documentElement = document.documentElement;
4741 var isAttached = function( elem ) {
4742 return jQuery.contains( elem.ownerDocument, elem );
4744 composed = { composed: true };
4746 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only
4747 // Check attachment across shadow DOM boundaries when possible (gh-3504)
4748 // Support: iOS 10.0-10.2 only
4749 // Early iOS 10 versions support `attachShadow` but not `getRootNode`,
4750 // leading to errors. We need to check for `getRootNode`.
4751 if ( documentElement.getRootNode ) {
4752 isAttached = function( elem ) {
4753 return jQuery.contains( elem.ownerDocument, elem ) ||
4754 elem.getRootNode( composed ) === elem.ownerDocument;
4757 var isHiddenWithinTree = function( elem, el ) {
4759 // isHiddenWithinTree might be called from jQuery#filter function;
4760 // in that case, element will be second argument
4763 // Inline style trumps all
4764 return elem.style.display === "none" ||
4765 elem.style.display === "" &&
4767 // Otherwise, check computed style
4768 // Support: Firefox <=43 - 45
4769 // Disconnected elements can have computed display: none, so first confirm that elem is
4771 isAttached( elem ) &&
4773 jQuery.css( elem, "display" ) === "none";
4778 function adjustCSS( elem, prop, valueParts, tween ) {
4779 var adjusted, scale,
4781 currentValue = tween ?
4786 return jQuery.css( elem, prop, "" );
4788 initial = currentValue(),
4789 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
4791 // Starting value computation is required for potential unit mismatches
4792 initialInUnit = elem.nodeType &&
4793 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
4794 rcssNum.exec( jQuery.css( elem, prop ) );
4796 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
4798 // Support: Firefox <=54
4799 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
4800 initial = initial / 2;
4802 // Trust units reported by jQuery.css
4803 unit = unit || initialInUnit[ 3 ];
4805 // Iteratively approximate from a nonzero starting point
4806 initialInUnit = +initial || 1;
4808 while ( maxIterations-- ) {
4810 // Evaluate and update our best guess (doubling guesses that zero out).
4811 // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
4812 jQuery.style( elem, prop, initialInUnit + unit );
4813 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
4816 initialInUnit = initialInUnit / scale;
4820 initialInUnit = initialInUnit * 2;
4821 jQuery.style( elem, prop, initialInUnit + unit );
4823 // Make sure we update the tween properties later on
4824 valueParts = valueParts || [];
4828 initialInUnit = +initialInUnit || +initial || 0;
4830 // Apply relative offset (+=/-=) if specified
4831 adjusted = valueParts[ 1 ] ?
4832 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
4836 tween.start = initialInUnit;
4837 tween.end = adjusted;
4844 var defaultDisplayMap = {};
4846 function getDefaultDisplay( elem ) {
4848 doc = elem.ownerDocument,
4849 nodeName = elem.nodeName,
4850 display = defaultDisplayMap[ nodeName ];
4856 temp = doc.body.appendChild( doc.createElement( nodeName ) );
4857 display = jQuery.css( temp, "display" );
4859 temp.parentNode.removeChild( temp );
4861 if ( display === "none" ) {
4864 defaultDisplayMap[ nodeName ] = display;
4869 function showHide( elements, show ) {
4873 length = elements.length;
4875 // Determine new display value for elements that need to change
4876 for ( ; index < length; index++ ) {
4877 elem = elements[ index ];
4878 if ( !elem.style ) {
4882 display = elem.style.display;
4885 // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
4886 // check is required in this first loop unless we have a nonempty display value (either
4887 // inline or about-to-be-restored)
4888 if ( display === "none" ) {
4889 values[ index ] = dataPriv.get( elem, "display" ) || null;
4890 if ( !values[ index ] ) {
4891 elem.style.display = "";
4894 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
4895 values[ index ] = getDefaultDisplay( elem );
4898 if ( display !== "none" ) {
4899 values[ index ] = "none";
4901 // Remember what we're overwriting
4902 dataPriv.set( elem, "display", display );
4907 // Set the display of the elements in a second loop to avoid constant reflow
4908 for ( index = 0; index < length; index++ ) {
4909 if ( values[ index ] != null ) {
4910 elements[ index ].style.display = values[ index ];
4919 return showHide( this, true );
4922 return showHide( this );
4924 toggle: function( state ) {
4925 if ( typeof state === "boolean" ) {
4926 return state ? this.show() : this.hide();
4929 return this.each( function() {
4930 if ( isHiddenWithinTree( this ) ) {
4931 jQuery( this ).show();
4933 jQuery( this ).hide();
4938 var rcheckableType = ( /^(?:checkbox|radio)$/i );
4940 var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i );
4942 var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
4947 var fragment = document.createDocumentFragment(),
4948 div = fragment.appendChild( document.createElement( "div" ) ),
4949 input = document.createElement( "input" );
4951 // Support: Android 4.0 - 4.3 only
4952 // Check state lost if the name is set (trac-11217)
4953 // Support: Windows Web Apps (WWA)
4954 // `name` and `type` must use .setAttribute for WWA (trac-14901)
4955 input.setAttribute( "type", "radio" );
4956 input.setAttribute( "checked", "checked" );
4957 input.setAttribute( "name", "t" );
4959 div.appendChild( input );
4961 // Support: Android <=4.1 only
4962 // Older WebKit doesn't clone checked state correctly in fragments
4963 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
4965 // Support: IE <=11 only
4966 // Make sure textarea (and checkbox) defaultValue is properly cloned
4967 div.innerHTML = "<textarea>x</textarea>";
4968 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
4970 // Support: IE <=9 only
4971 // IE <=9 replaces <option> tags with their contents when inserted outside of
4972 // the select element.
4973 div.innerHTML = "<option></option>";
4974 support.option = !!div.lastChild;
4978 // We have to close these tags to support XHTML (trac-13200)
4981 // XHTML parsers do not magically insert elements in the
4982 // same way that tag soup parsers do. So we cannot shorten
4983 // this by omitting <tbody> or other required elements.
4984 thead: [ 1, "<table>", "</table>" ],
4985 col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
4986 tr: [ 2, "<table><tbody>", "</tbody></table>" ],
4987 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
4989 _default: [ 0, "", "" ]
4992 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
4993 wrapMap.th = wrapMap.td;
4995 // Support: IE <=9 only
4996 if ( !support.option ) {
4997 wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ];
5001 function getAll( context, tag ) {
5003 // Support: IE <=9 - 11 only
5004 // Use typeof to avoid zero-argument method invocation on host objects (trac-15151)
5007 if ( typeof context.getElementsByTagName !== "undefined" ) {
5008 ret = context.getElementsByTagName( tag || "*" );
5010 } else if ( typeof context.querySelectorAll !== "undefined" ) {
5011 ret = context.querySelectorAll( tag || "*" );
5017 if ( tag === undefined || tag && nodeName( context, tag ) ) {
5018 return jQuery.merge( [ context ], ret );
5025 // Mark scripts as having already been evaluated
5026 function setGlobalEval( elems, refElements ) {
5030 for ( ; i < l; i++ ) {
5034 !refElements || dataPriv.get( refElements[ i ], "globalEval" )
5040 var rhtml = /<|&#?\w+;/;
5042 function buildFragment( elems, context, scripts, selection, ignored ) {
5043 var elem, tmp, tag, wrap, attached, j,
5044 fragment = context.createDocumentFragment(),
5049 for ( ; i < l; i++ ) {
5052 if ( elem || elem === 0 ) {
5054 // Add nodes directly
5055 if ( toType( elem ) === "object" ) {
5057 // Support: Android <=4.0 only, PhantomJS 1 only
5058 // push.apply(_, arraylike) throws on ancient WebKit
5059 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
5061 // Convert non-html into a text node
5062 } else if ( !rhtml.test( elem ) ) {
5063 nodes.push( context.createTextNode( elem ) );
5065 // Convert html into DOM nodes
5067 tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
5069 // Deserialize a standard representation
5070 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
5071 wrap = wrapMap[ tag ] || wrapMap._default;
5072 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
5074 // Descend through wrappers to the right content
5077 tmp = tmp.lastChild;
5080 // Support: Android <=4.0 only, PhantomJS 1 only
5081 // push.apply(_, arraylike) throws on ancient WebKit
5082 jQuery.merge( nodes, tmp.childNodes );
5084 // Remember the top-level container
5085 tmp = fragment.firstChild;
5087 // Ensure the created nodes are orphaned (trac-12392)
5088 tmp.textContent = "";
5093 // Remove wrapper from fragment
5094 fragment.textContent = "";
5097 while ( ( elem = nodes[ i++ ] ) ) {
5099 // Skip elements already in the context collection (trac-4087)
5100 if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
5102 ignored.push( elem );
5107 attached = isAttached( elem );
5109 // Append to fragment
5110 tmp = getAll( fragment.appendChild( elem ), "script" );
5112 // Preserve script evaluation history
5114 setGlobalEval( tmp );
5117 // Capture executables
5120 while ( ( elem = tmp[ j++ ] ) ) {
5121 if ( rscriptType.test( elem.type || "" ) ) {
5122 scripts.push( elem );
5132 var rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
5134 function returnTrue() {
5138 function returnFalse() {
5142 // Support: IE <=9 - 11+
5143 // focus() and blur() are asynchronous, except when they are no-op.
5144 // So expect focus to be synchronous when the element is already active,
5145 // and blur to be synchronous when the element is not already active.
5146 // (focus and blur are always synchronous in other supported browsers,
5147 // this just defines when we can count on it).
5148 function expectSync( elem, type ) {
5149 return ( elem === safeActiveElement() ) === ( type === "focus" );
5152 // Support: IE <=9 only
5153 // Accessing document.activeElement can throw unexpectedly
5154 // https://bugs.jquery.com/ticket/13393
5155 function safeActiveElement() {
5157 return document.activeElement;
5161 function on( elem, types, selector, data, fn, one ) {
5164 // Types can be a map of types/handlers
5165 if ( typeof types === "object" ) {
5167 // ( types-Object, selector, data )
5168 if ( typeof selector !== "string" ) {
5170 // ( types-Object, data )
5171 data = data || selector;
5172 selector = undefined;
5174 for ( type in types ) {
5175 on( elem, type, selector, data, types[ type ], one );
5180 if ( data == null && fn == null ) {
5184 data = selector = undefined;
5185 } else if ( fn == null ) {
5186 if ( typeof selector === "string" ) {
5188 // ( types, selector, fn )
5193 // ( types, data, fn )
5196 selector = undefined;
5199 if ( fn === false ) {
5207 fn = function( event ) {
5209 // Can use an empty set, since event contains the info
5210 jQuery().off( event );
5211 return origFn.apply( this, arguments );
5214 // Use same guid so caller can remove using origFn
5215 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
5217 return elem.each( function() {
5218 jQuery.event.add( this, types, fn, data, selector );
5223 * Helper functions for managing events -- not part of the public interface.
5224 * Props to Dean Edwards' addEvent library for many of the ideas.
5230 add: function( elem, types, handler, data, selector ) {
5232 var handleObjIn, eventHandle, tmp,
5233 events, t, handleObj,
5234 special, handlers, type, namespaces, origType,
5235 elemData = dataPriv.get( elem );
5237 // Only attach events to objects that accept data
5238 if ( !acceptData( elem ) ) {
5242 // Caller can pass in an object of custom data in lieu of the handler
5243 if ( handler.handler ) {
5244 handleObjIn = handler;
5245 handler = handleObjIn.handler;
5246 selector = handleObjIn.selector;
5249 // Ensure that invalid selectors throw exceptions at attach time
5250 // Evaluate against documentElement in case elem is a non-element node (e.g., document)
5252 jQuery.find.matchesSelector( documentElement, selector );
5255 // Make sure that the handler has a unique ID, used to find/remove it later
5256 if ( !handler.guid ) {
5257 handler.guid = jQuery.guid++;
5260 // Init the element's event structure and main handler, if this is the first
5261 if ( !( events = elemData.events ) ) {
5262 events = elemData.events = Object.create( null );
5264 if ( !( eventHandle = elemData.handle ) ) {
5265 eventHandle = elemData.handle = function( e ) {
5267 // Discard the second event of a jQuery.event.trigger() and
5268 // when an event is called after a page has unloaded
5269 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
5270 jQuery.event.dispatch.apply( elem, arguments ) : undefined;
5274 // Handle multiple events separated by a space
5275 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
5278 tmp = rtypenamespace.exec( types[ t ] ) || [];
5279 type = origType = tmp[ 1 ];
5280 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
5282 // There *must* be a type, no attaching namespace-only handlers
5287 // If event changes its type, use the special event handlers for the changed type
5288 special = jQuery.event.special[ type ] || {};
5290 // If selector defined, determine special event api type, otherwise given type
5291 type = ( selector ? special.delegateType : special.bindType ) || type;
5293 // Update special based on newly reset type
5294 special = jQuery.event.special[ type ] || {};
5296 // handleObj is passed to all event handlers
5297 handleObj = jQuery.extend( {
5304 needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
5305 namespace: namespaces.join( "." )
5308 // Init the event handler queue if we're the first
5309 if ( !( handlers = events[ type ] ) ) {
5310 handlers = events[ type ] = [];
5311 handlers.delegateCount = 0;
5313 // Only use addEventListener if the special events handler returns false
5314 if ( !special.setup ||
5315 special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
5317 if ( elem.addEventListener ) {
5318 elem.addEventListener( type, eventHandle );
5323 if ( special.add ) {
5324 special.add.call( elem, handleObj );
5326 if ( !handleObj.handler.guid ) {
5327 handleObj.handler.guid = handler.guid;
5331 // Add to the element's handler list, delegates in front
5333 handlers.splice( handlers.delegateCount++, 0, handleObj );
5335 handlers.push( handleObj );
5338 // Keep track of which events have ever been used, for event optimization
5339 jQuery.event.global[ type ] = true;
5344 // Detach an event or set of events from an element
5345 remove: function( elem, types, handler, selector, mappedTypes ) {
5347 var j, origCount, tmp,
5348 events, t, handleObj,
5349 special, handlers, type, namespaces, origType,
5350 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
5352 if ( !elemData || !( events = elemData.events ) ) {
5356 // Once for each type.namespace in types; type may be omitted
5357 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
5360 tmp = rtypenamespace.exec( types[ t ] ) || [];
5361 type = origType = tmp[ 1 ];
5362 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
5364 // Unbind all events (on this namespace, if provided) for the element
5366 for ( type in events ) {
5367 jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
5372 special = jQuery.event.special[ type ] || {};
5373 type = ( selector ? special.delegateType : special.bindType ) || type;
5374 handlers = events[ type ] || [];
5376 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
5378 // Remove matching events
5379 origCount = j = handlers.length;
5381 handleObj = handlers[ j ];
5383 if ( ( mappedTypes || origType === handleObj.origType ) &&
5384 ( !handler || handler.guid === handleObj.guid ) &&
5385 ( !tmp || tmp.test( handleObj.namespace ) ) &&
5386 ( !selector || selector === handleObj.selector ||
5387 selector === "**" && handleObj.selector ) ) {
5388 handlers.splice( j, 1 );
5390 if ( handleObj.selector ) {
5391 handlers.delegateCount--;
5393 if ( special.remove ) {
5394 special.remove.call( elem, handleObj );
5399 // Remove generic event handler if we removed something and no more handlers exist
5400 // (avoids potential for endless recursion during removal of special event handlers)
5401 if ( origCount && !handlers.length ) {
5402 if ( !special.teardown ||
5403 special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
5405 jQuery.removeEvent( elem, type, elemData.handle );
5408 delete events[ type ];
5412 // Remove data and the expando if it's no longer used
5413 if ( jQuery.isEmptyObject( events ) ) {
5414 dataPriv.remove( elem, "handle events" );
5418 dispatch: function( nativeEvent ) {
5420 var i, j, ret, matched, handleObj, handlerQueue,
5421 args = new Array( arguments.length ),
5423 // Make a writable jQuery.Event from the native event object
5424 event = jQuery.event.fix( nativeEvent ),
5427 dataPriv.get( this, "events" ) || Object.create( null )
5428 )[ event.type ] || [],
5429 special = jQuery.event.special[ event.type ] || {};
5431 // Use the fix-ed jQuery.Event rather than the (read-only) native event
5434 for ( i = 1; i < arguments.length; i++ ) {
5435 args[ i ] = arguments[ i ];
5438 event.delegateTarget = this;
5440 // Call the preDispatch hook for the mapped type, and let it bail if desired
5441 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
5445 // Determine handlers
5446 handlerQueue = jQuery.event.handlers.call( this, event, handlers );
5448 // Run delegates first; they may want to stop propagation beneath us
5450 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
5451 event.currentTarget = matched.elem;
5454 while ( ( handleObj = matched.handlers[ j++ ] ) &&
5455 !event.isImmediatePropagationStopped() ) {
5457 // If the event is namespaced, then each handler is only invoked if it is
5458 // specially universal or its namespaces are a superset of the event's.
5459 if ( !event.rnamespace || handleObj.namespace === false ||
5460 event.rnamespace.test( handleObj.namespace ) ) {
5462 event.handleObj = handleObj;
5463 event.data = handleObj.data;
5465 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
5466 handleObj.handler ).apply( matched.elem, args );
5468 if ( ret !== undefined ) {
5469 if ( ( event.result = ret ) === false ) {
5470 event.preventDefault();
5471 event.stopPropagation();
5478 // Call the postDispatch hook for the mapped type
5479 if ( special.postDispatch ) {
5480 special.postDispatch.call( this, event );
5483 return event.result;
5486 handlers: function( event, handlers ) {
5487 var i, handleObj, sel, matchedHandlers, matchedSelectors,
5489 delegateCount = handlers.delegateCount,
5492 // Find delegate handlers
5493 if ( delegateCount &&
5496 // Black-hole SVG <use> instance trees (trac-13180)
5499 // Support: Firefox <=42
5500 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
5501 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
5502 // Support: IE 11 only
5503 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
5504 !( event.type === "click" && event.button >= 1 ) ) {
5506 for ( ; cur !== this; cur = cur.parentNode || this ) {
5508 // Don't check non-elements (trac-13208)
5509 // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764)
5510 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
5511 matchedHandlers = [];
5512 matchedSelectors = {};
5513 for ( i = 0; i < delegateCount; i++ ) {
5514 handleObj = handlers[ i ];
5516 // Don't conflict with Object.prototype properties (trac-13203)
5517 sel = handleObj.selector + " ";
5519 if ( matchedSelectors[ sel ] === undefined ) {
5520 matchedSelectors[ sel ] = handleObj.needsContext ?
5521 jQuery( sel, this ).index( cur ) > -1 :
5522 jQuery.find( sel, this, null, [ cur ] ).length;
5524 if ( matchedSelectors[ sel ] ) {
5525 matchedHandlers.push( handleObj );
5528 if ( matchedHandlers.length ) {
5529 handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
5535 // Add the remaining (directly-bound) handlers
5537 if ( delegateCount < handlers.length ) {
5538 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
5541 return handlerQueue;
5544 addProp: function( name, hook ) {
5545 Object.defineProperty( jQuery.Event.prototype, name, {
5549 get: isFunction( hook ) ?
5551 if ( this.originalEvent ) {
5552 return hook( this.originalEvent );
5556 if ( this.originalEvent ) {
5557 return this.originalEvent[ name ];
5561 set: function( value ) {
5562 Object.defineProperty( this, name, {
5572 fix: function( originalEvent ) {
5573 return originalEvent[ jQuery.expando ] ?
5575 new jQuery.Event( originalEvent );
5581 // Prevent triggered image.load events from bubbling to window.load
5586 // Utilize native event to ensure correct state for checkable inputs
5587 setup: function( data ) {
5589 // For mutual compressibility with _default, replace `this` access with a local var.
5590 // `|| data` is dead code meant only to preserve the variable through minification.
5591 var el = this || data;
5593 // Claim the first handler
5594 if ( rcheckableType.test( el.type ) &&
5595 el.click && nodeName( el, "input" ) ) {
5597 // dataPriv.set( el, "click", ... )
5598 leverageNative( el, "click", returnTrue );
5601 // Return false to allow normal processing in the caller
5604 trigger: function( data ) {
5606 // For mutual compressibility with _default, replace `this` access with a local var.
5607 // `|| data` is dead code meant only to preserve the variable through minification.
5608 var el = this || data;
5610 // Force setup before triggering a click
5611 if ( rcheckableType.test( el.type ) &&
5612 el.click && nodeName( el, "input" ) ) {
5614 leverageNative( el, "click" );
5617 // Return non-false to allow normal event-path propagation
5621 // For cross-browser consistency, suppress native .click() on links
5622 // Also prevent it if we're currently inside a leveraged native-event stack
5623 _default: function( event ) {
5624 var target = event.target;
5625 return rcheckableType.test( target.type ) &&
5626 target.click && nodeName( target, "input" ) &&
5627 dataPriv.get( target, "click" ) ||
5628 nodeName( target, "a" );
5633 postDispatch: function( event ) {
5635 // Support: Firefox 20+
5636 // Firefox doesn't alert if the returnValue field is not set.
5637 if ( event.result !== undefined && event.originalEvent ) {
5638 event.originalEvent.returnValue = event.result;
5645 // Ensure the presence of an event listener that handles manually-triggered
5646 // synthetic events by interrupting progress until reinvoked in response to
5647 // *native* events that it fires directly, ensuring that state changes have
5648 // already occurred before other listeners are invoked.
5649 function leverageNative( el, type, expectSync ) {
5651 // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add
5652 if ( !expectSync ) {
5653 if ( dataPriv.get( el, type ) === undefined ) {
5654 jQuery.event.add( el, type, returnTrue );
5659 // Register the controller as a special universal handler for all event namespaces
5660 dataPriv.set( el, type, false );
5661 jQuery.event.add( el, type, {
5663 handler: function( event ) {
5664 var notAsync, result,
5665 saved = dataPriv.get( this, type );
5667 if ( ( event.isTrigger & 1 ) && this[ type ] ) {
5669 // Interrupt processing of the outer synthetic .trigger()ed event
5670 // Saved data should be false in such cases, but might be a leftover capture object
5671 // from an async native handler (gh-4350)
5672 if ( !saved.length ) {
5674 // Store arguments for use when handling the inner native event
5675 // There will always be at least one argument (an event object), so this array
5676 // will not be confused with a leftover capture object.
5677 saved = slice.call( arguments );
5678 dataPriv.set( this, type, saved );
5680 // Trigger the native event and capture its result
5681 // Support: IE <=9 - 11+
5682 // focus() and blur() are asynchronous
5683 notAsync = expectSync( this, type );
5685 result = dataPriv.get( this, type );
5686 if ( saved !== result || notAsync ) {
5687 dataPriv.set( this, type, false );
5691 if ( saved !== result ) {
5693 // Cancel the outer synthetic event
5694 event.stopImmediatePropagation();
5695 event.preventDefault();
5697 // Support: Chrome 86+
5698 // In Chrome, if an element having a focusout handler is blurred by
5699 // clicking outside of it, it invokes the handler synchronously. If
5700 // that handler calls `.remove()` on the element, the data is cleared,
5701 // leaving `result` undefined. We need to guard against this.
5702 return result && result.value;
5705 // If this is an inner synthetic event for an event with a bubbling surrogate
5706 // (focus or blur), assume that the surrogate already propagated from triggering the
5707 // native event and prevent that from happening again here.
5708 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the
5709 // bubbling surrogate propagates *after* the non-bubbling base), but that seems
5710 // less bad than duplication.
5711 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
5712 event.stopPropagation();
5715 // If this is a native event triggered above, everything is now in order
5716 // Fire an inner synthetic event with the original arguments
5717 } else if ( saved.length ) {
5719 // ...and capture the result
5720 dataPriv.set( this, type, {
5721 value: jQuery.event.trigger(
5723 // Support: IE <=9 - 11+
5724 // Extend with the prototype to reset the above stopImmediatePropagation()
5725 jQuery.extend( saved[ 0 ], jQuery.Event.prototype ),
5731 // Abort handling of the native event
5732 event.stopImmediatePropagation();
5738 jQuery.removeEvent = function( elem, type, handle ) {
5740 // This "if" is needed for plain objects
5741 if ( elem.removeEventListener ) {
5742 elem.removeEventListener( type, handle );
5746 jQuery.Event = function( src, props ) {
5748 // Allow instantiation without the 'new' keyword
5749 if ( !( this instanceof jQuery.Event ) ) {
5750 return new jQuery.Event( src, props );
5754 if ( src && src.type ) {
5755 this.originalEvent = src;
5756 this.type = src.type;
5758 // Events bubbling up the document may have been marked as prevented
5759 // by a handler lower down the tree; reflect the correct value.
5760 this.isDefaultPrevented = src.defaultPrevented ||
5761 src.defaultPrevented === undefined &&
5763 // Support: Android <=2.3 only
5764 src.returnValue === false ?
5768 // Create target properties
5769 // Support: Safari <=6 - 7 only
5770 // Target should not be a text node (trac-504, trac-13143)
5771 this.target = ( src.target && src.target.nodeType === 3 ) ?
5772 src.target.parentNode :
5775 this.currentTarget = src.currentTarget;
5776 this.relatedTarget = src.relatedTarget;
5783 // Put explicitly provided properties onto the event object
5785 jQuery.extend( this, props );
5788 // Create a timestamp if incoming event doesn't have one
5789 this.timeStamp = src && src.timeStamp || Date.now();
5792 this[ jQuery.expando ] = true;
5795 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
5796 // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
5797 jQuery.Event.prototype = {
5798 constructor: jQuery.Event,
5799 isDefaultPrevented: returnFalse,
5800 isPropagationStopped: returnFalse,
5801 isImmediatePropagationStopped: returnFalse,
5804 preventDefault: function() {
5805 var e = this.originalEvent;
5807 this.isDefaultPrevented = returnTrue;
5809 if ( e && !this.isSimulated ) {
5813 stopPropagation: function() {
5814 var e = this.originalEvent;
5816 this.isPropagationStopped = returnTrue;
5818 if ( e && !this.isSimulated ) {
5819 e.stopPropagation();
5822 stopImmediatePropagation: function() {
5823 var e = this.originalEvent;
5825 this.isImmediatePropagationStopped = returnTrue;
5827 if ( e && !this.isSimulated ) {
5828 e.stopImmediatePropagation();
5831 this.stopPropagation();
5835 // Includes all common event props including KeyEvent and MouseEvent specific props
5840 changedTouches: true,
5864 targetTouches: true,
5868 }, jQuery.event.addProp );
5870 jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) {
5871 jQuery.event.special[ type ] = {
5873 // Utilize native event if possible so blur/focus sequence is correct
5876 // Claim the first handler
5877 // dataPriv.set( this, "focus", ... )
5878 // dataPriv.set( this, "blur", ... )
5879 leverageNative( this, type, expectSync );
5881 // Return false to allow normal processing in the caller
5884 trigger: function() {
5886 // Force setup before trigger
5887 leverageNative( this, type );
5889 // Return non-false to allow normal event-path propagation
5893 // Suppress native focus or blur if we're currently inside
5894 // a leveraged native-event stack
5895 _default: function( event ) {
5896 return dataPriv.get( event.target, type );
5899 delegateType: delegateType
5903 // Create mouseenter/leave events using mouseover/out and event-time checks
5904 // so that event delegation works in jQuery.
5905 // Do the same for pointerenter/pointerleave and pointerover/pointerout
5907 // Support: Safari 7 only
5908 // Safari sends mouseenter too often; see:
5909 // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
5910 // for the description of the bug (it existed in older Chrome versions as well).
5912 mouseenter: "mouseover",
5913 mouseleave: "mouseout",
5914 pointerenter: "pointerover",
5915 pointerleave: "pointerout"
5916 }, function( orig, fix ) {
5917 jQuery.event.special[ orig ] = {
5921 handle: function( event ) {
5924 related = event.relatedTarget,
5925 handleObj = event.handleObj;
5927 // For mouseenter/leave call the handler if related is outside the target.
5928 // NB: No relatedTarget if the mouse left/entered the browser window
5929 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
5930 event.type = handleObj.origType;
5931 ret = handleObj.handler.apply( this, arguments );
5941 on: function( types, selector, data, fn ) {
5942 return on( this, types, selector, data, fn );
5944 one: function( types, selector, data, fn ) {
5945 return on( this, types, selector, data, fn, 1 );
5947 off: function( types, selector, fn ) {
5948 var handleObj, type;
5949 if ( types && types.preventDefault && types.handleObj ) {
5951 // ( event ) dispatched jQuery.Event
5952 handleObj = types.handleObj;
5953 jQuery( types.delegateTarget ).off(
5954 handleObj.namespace ?
5955 handleObj.origType + "." + handleObj.namespace :
5962 if ( typeof types === "object" ) {
5964 // ( types-object [, selector] )
5965 for ( type in types ) {
5966 this.off( type, selector, types[ type ] );
5970 if ( selector === false || typeof selector === "function" ) {
5974 selector = undefined;
5976 if ( fn === false ) {
5979 return this.each( function() {
5980 jQuery.event.remove( this, types, fn, selector );
5988 // Support: IE <=10 - 11, Edge 12 - 13 only
5989 // In IE/Edge using regex groups here causes severe slowdowns.
5990 // See https://connect.microsoft.com/IE/feedback/details/1736512/
5991 rnoInnerhtml = /<script|<style|<link/i,
5993 // checked="checked" or checked
5994 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
5996 rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g;
5998 // Prefer a tbody over its parent table for containing new rows
5999 function manipulationTarget( elem, content ) {
6000 if ( nodeName( elem, "table" ) &&
6001 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
6003 return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
6009 // Replace/restore the type attribute of script elements for safe DOM manipulation
6010 function disableScript( elem ) {
6011 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
6014 function restoreScript( elem ) {
6015 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
6016 elem.type = elem.type.slice( 5 );
6018 elem.removeAttribute( "type" );
6024 function cloneCopyEvent( src, dest ) {
6025 var i, l, type, pdataOld, udataOld, udataCur, events;
6027 if ( dest.nodeType !== 1 ) {
6031 // 1. Copy private data: events, handlers, etc.
6032 if ( dataPriv.hasData( src ) ) {
6033 pdataOld = dataPriv.get( src );
6034 events = pdataOld.events;
6037 dataPriv.remove( dest, "handle events" );
6039 for ( type in events ) {
6040 for ( i = 0, l = events[ type ].length; i < l; i++ ) {
6041 jQuery.event.add( dest, type, events[ type ][ i ] );
6047 // 2. Copy user data
6048 if ( dataUser.hasData( src ) ) {
6049 udataOld = dataUser.access( src );
6050 udataCur = jQuery.extend( {}, udataOld );
6052 dataUser.set( dest, udataCur );
6056 // Fix IE bugs, see support tests
6057 function fixInput( src, dest ) {
6058 var nodeName = dest.nodeName.toLowerCase();
6060 // Fails to persist the checked state of a cloned checkbox or radio button.
6061 if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
6062 dest.checked = src.checked;
6064 // Fails to return the selected option to the default selected state when cloning options
6065 } else if ( nodeName === "input" || nodeName === "textarea" ) {
6066 dest.defaultValue = src.defaultValue;
6070 function domManip( collection, args, callback, ignored ) {
6072 // Flatten any nested arrays
6073 args = flat( args );
6075 var fragment, first, scripts, hasScripts, node, doc,
6077 l = collection.length,
6080 valueIsFunction = isFunction( value );
6082 // We can't cloneNode fragments that contain checked, in WebKit
6083 if ( valueIsFunction ||
6084 ( l > 1 && typeof value === "string" &&
6085 !support.checkClone && rchecked.test( value ) ) ) {
6086 return collection.each( function( index ) {
6087 var self = collection.eq( index );
6088 if ( valueIsFunction ) {
6089 args[ 0 ] = value.call( this, index, self.html() );
6091 domManip( self, args, callback, ignored );
6096 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
6097 first = fragment.firstChild;
6099 if ( fragment.childNodes.length === 1 ) {
6103 // Require either new content or an interest in ignored elements to invoke the callback
6104 if ( first || ignored ) {
6105 scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
6106 hasScripts = scripts.length;
6108 // Use the original fragment for the last item
6109 // instead of the first because it can end up
6110 // being emptied incorrectly in certain situations (trac-8070).
6111 for ( ; i < l; i++ ) {
6114 if ( i !== iNoClone ) {
6115 node = jQuery.clone( node, true, true );
6117 // Keep references to cloned scripts for later restoration
6120 // Support: Android <=4.0 only, PhantomJS 1 only
6121 // push.apply(_, arraylike) throws on ancient WebKit
6122 jQuery.merge( scripts, getAll( node, "script" ) );
6126 callback.call( collection[ i ], node, i );
6130 doc = scripts[ scripts.length - 1 ].ownerDocument;
6133 jQuery.map( scripts, restoreScript );
6135 // Evaluate executable scripts on first document insertion
6136 for ( i = 0; i < hasScripts; i++ ) {
6137 node = scripts[ i ];
6138 if ( rscriptType.test( node.type || "" ) &&
6139 !dataPriv.access( node, "globalEval" ) &&
6140 jQuery.contains( doc, node ) ) {
6142 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
6144 // Optional AJAX dependency, but won't run scripts if not present
6145 if ( jQuery._evalUrl && !node.noModule ) {
6146 jQuery._evalUrl( node.src, {
6147 nonce: node.nonce || node.getAttribute( "nonce" )
6152 // Unwrap a CDATA section containing script contents. This shouldn't be
6153 // needed as in XML documents they're already not visible when
6154 // inspecting element contents and in HTML documents they have no
6155 // meaning but we're preserving that logic for backwards compatibility.
6156 // This will be removed completely in 4.0. See gh-4904.
6157 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc );
6168 function remove( elem, selector, keepData ) {
6170 nodes = selector ? jQuery.filter( selector, elem ) : elem,
6173 for ( ; ( node = nodes[ i ] ) != null; i++ ) {
6174 if ( !keepData && node.nodeType === 1 ) {
6175 jQuery.cleanData( getAll( node ) );
6178 if ( node.parentNode ) {
6179 if ( keepData && isAttached( node ) ) {
6180 setGlobalEval( getAll( node, "script" ) );
6182 node.parentNode.removeChild( node );
6190 htmlPrefilter: function( html ) {
6194 clone: function( elem, dataAndEvents, deepDataAndEvents ) {
6195 var i, l, srcElements, destElements,
6196 clone = elem.cloneNode( true ),
6197 inPage = isAttached( elem );
6199 // Fix IE cloning issues
6200 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
6201 !jQuery.isXMLDoc( elem ) ) {
6203 // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
6204 destElements = getAll( clone );
6205 srcElements = getAll( elem );
6207 for ( i = 0, l = srcElements.length; i < l; i++ ) {
6208 fixInput( srcElements[ i ], destElements[ i ] );
6212 // Copy the events from the original to the clone
6213 if ( dataAndEvents ) {
6214 if ( deepDataAndEvents ) {
6215 srcElements = srcElements || getAll( elem );
6216 destElements = destElements || getAll( clone );
6218 for ( i = 0, l = srcElements.length; i < l; i++ ) {
6219 cloneCopyEvent( srcElements[ i ], destElements[ i ] );
6222 cloneCopyEvent( elem, clone );
6226 // Preserve script evaluation history
6227 destElements = getAll( clone, "script" );
6228 if ( destElements.length > 0 ) {
6229 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
6232 // Return the cloned set
6236 cleanData: function( elems ) {
6237 var data, elem, type,
6238 special = jQuery.event.special,
6241 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
6242 if ( acceptData( elem ) ) {
6243 if ( ( data = elem[ dataPriv.expando ] ) ) {
6244 if ( data.events ) {
6245 for ( type in data.events ) {
6246 if ( special[ type ] ) {
6247 jQuery.event.remove( elem, type );
6249 // This is a shortcut to avoid jQuery.event.remove's overhead
6251 jQuery.removeEvent( elem, type, data.handle );
6256 // Support: Chrome <=35 - 45+
6257 // Assign undefined instead of using delete, see Data#remove
6258 elem[ dataPriv.expando ] = undefined;
6260 if ( elem[ dataUser.expando ] ) {
6262 // Support: Chrome <=35 - 45+
6263 // Assign undefined instead of using delete, see Data#remove
6264 elem[ dataUser.expando ] = undefined;
6272 detach: function( selector ) {
6273 return remove( this, selector, true );
6276 remove: function( selector ) {
6277 return remove( this, selector );
6280 text: function( value ) {
6281 return access( this, function( value ) {
6282 return value === undefined ?
6283 jQuery.text( this ) :
6284 this.empty().each( function() {
6285 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
6286 this.textContent = value;
6289 }, null, value, arguments.length );
6292 append: function() {
6293 return domManip( this, arguments, function( elem ) {
6294 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
6295 var target = manipulationTarget( this, elem );
6296 target.appendChild( elem );
6301 prepend: function() {
6302 return domManip( this, arguments, function( elem ) {
6303 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
6304 var target = manipulationTarget( this, elem );
6305 target.insertBefore( elem, target.firstChild );
6310 before: function() {
6311 return domManip( this, arguments, function( elem ) {
6312 if ( this.parentNode ) {
6313 this.parentNode.insertBefore( elem, this );
6319 return domManip( this, arguments, function( elem ) {
6320 if ( this.parentNode ) {
6321 this.parentNode.insertBefore( elem, this.nextSibling );
6330 for ( ; ( elem = this[ i ] ) != null; i++ ) {
6331 if ( elem.nodeType === 1 ) {
6333 // Prevent memory leaks
6334 jQuery.cleanData( getAll( elem, false ) );
6336 // Remove any remaining nodes
6337 elem.textContent = "";
6344 clone: function( dataAndEvents, deepDataAndEvents ) {
6345 dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
6346 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
6348 return this.map( function() {
6349 return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
6353 html: function( value ) {
6354 return access( this, function( value ) {
6355 var elem = this[ 0 ] || {},
6359 if ( value === undefined && elem.nodeType === 1 ) {
6360 return elem.innerHTML;
6363 // See if we can take a shortcut and just use innerHTML
6364 if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
6365 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
6367 value = jQuery.htmlPrefilter( value );
6370 for ( ; i < l; i++ ) {
6371 elem = this[ i ] || {};
6373 // Remove element nodes and prevent memory leaks
6374 if ( elem.nodeType === 1 ) {
6375 jQuery.cleanData( getAll( elem, false ) );
6376 elem.innerHTML = value;
6382 // If using innerHTML throws an exception, use the fallback method
6387 this.empty().append( value );
6389 }, null, value, arguments.length );
6392 replaceWith: function() {
6395 // Make the changes, replacing each non-ignored context element with the new content
6396 return domManip( this, arguments, function( elem ) {
6397 var parent = this.parentNode;
6399 if ( jQuery.inArray( this, ignored ) < 0 ) {
6400 jQuery.cleanData( getAll( this ) );
6402 parent.replaceChild( elem, this );
6406 // Force callback invocation
6413 prependTo: "prepend",
6414 insertBefore: "before",
6415 insertAfter: "after",
6416 replaceAll: "replaceWith"
6417 }, function( name, original ) {
6418 jQuery.fn[ name ] = function( selector ) {
6421 insert = jQuery( selector ),
6422 last = insert.length - 1,
6425 for ( ; i <= last; i++ ) {
6426 elems = i === last ? this : this.clone( true );
6427 jQuery( insert[ i ] )[ original ]( elems );
6429 // Support: Android <=4.0 only, PhantomJS 1 only
6430 // .get() because push.apply(_, arraylike) throws on ancient WebKit
6431 push.apply( ret, elems.get() );
6434 return this.pushStack( ret );
6437 var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
6439 var rcustomProp = /^--/;
6442 var getStyles = function( elem ) {
6444 // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150)
6445 // IE throws on elements created in popups
6446 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
6447 var view = elem.ownerDocument.defaultView;
6449 if ( !view || !view.opener ) {
6453 return view.getComputedStyle( elem );
6456 var swap = function( elem, options, callback ) {
6460 // Remember the old values, and insert the new ones
6461 for ( name in options ) {
6462 old[ name ] = elem.style[ name ];
6463 elem.style[ name ] = options[ name ];
6466 ret = callback.call( elem );
6468 // Revert the old values
6469 for ( name in options ) {
6470 elem.style[ name ] = old[ name ];
6477 var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6479 var whitespace = "[\\x20\\t\\r\\n\\f]";
6482 var rtrimCSS = new RegExp(
6483 "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$",
6492 // Executing both pixelPosition & boxSizingReliable tests require only one layout
6493 // so they're executed at the same time to save the second computation.
6494 function computeStyleTests() {
6496 // This is a singleton, we need to execute it only once
6501 container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
6502 "margin-top:1px;padding:0;border:0";
6504 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
6505 "margin:auto;border:1px;padding:1px;" +
6507 documentElement.appendChild( container ).appendChild( div );
6509 var divStyle = window.getComputedStyle( div );
6510 pixelPositionVal = divStyle.top !== "1%";
6512 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
6513 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
6515 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
6516 // Some styles come back with percentage values, even though they shouldn't
6517 div.style.right = "60%";
6518 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
6520 // Support: IE 9 - 11 only
6521 // Detect misreporting of content dimensions for box-sizing:border-box elements
6522 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
6524 // Support: IE 9 only
6525 // Detect overflow:scroll screwiness (gh-3699)
6526 // Support: Chrome <=64
6527 // Don't get tricked when zoom affects offsetWidth (gh-4029)
6528 div.style.position = "absolute";
6529 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12;
6531 documentElement.removeChild( container );
6533 // Nullify the div so it wouldn't be stored in the memory and
6534 // it will also be a sign that checks already performed
6538 function roundPixelMeasures( measure ) {
6539 return Math.round( parseFloat( measure ) );
6542 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
6543 reliableTrDimensionsVal, reliableMarginLeftVal,
6544 container = document.createElement( "div" ),
6545 div = document.createElement( "div" );
6547 // Finish early in limited (non-browser) environments
6552 // Support: IE <=9 - 11 only
6553 // Style of cloned element affects source element cloned (trac-8908)
6554 div.style.backgroundClip = "content-box";
6555 div.cloneNode( true ).style.backgroundClip = "";
6556 support.clearCloneStyle = div.style.backgroundClip === "content-box";
6558 jQuery.extend( support, {
6559 boxSizingReliable: function() {
6560 computeStyleTests();
6561 return boxSizingReliableVal;
6563 pixelBoxStyles: function() {
6564 computeStyleTests();
6565 return pixelBoxStylesVal;
6567 pixelPosition: function() {
6568 computeStyleTests();
6569 return pixelPositionVal;
6571 reliableMarginLeft: function() {
6572 computeStyleTests();
6573 return reliableMarginLeftVal;
6575 scrollboxSize: function() {
6576 computeStyleTests();
6577 return scrollboxSizeVal;
6580 // Support: IE 9 - 11+, Edge 15 - 18+
6581 // IE/Edge misreport `getComputedStyle` of table rows with width/height
6582 // set in CSS while `offset*` properties report correct values.
6583 // Behavior in IE 9 is more subtle than in newer versions & it passes
6584 // some versions of this test; make sure not to make it pass there!
6586 // Support: Firefox 70+
6587 // Only Firefox includes border widths
6588 // in computed dimensions. (gh-4529)
6589 reliableTrDimensions: function() {
6590 var table, tr, trChild, trStyle;
6591 if ( reliableTrDimensionsVal == null ) {
6592 table = document.createElement( "table" );
6593 tr = document.createElement( "tr" );
6594 trChild = document.createElement( "div" );
6596 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate";
6597 tr.style.cssText = "border:1px solid";
6599 // Support: Chrome 86+
6600 // Height set through cssText does not get applied.
6601 // Computed height then comes back as 0.
6602 tr.style.height = "1px";
6603 trChild.style.height = "9px";
6605 // Support: Android 8 Chrome 86+
6606 // In our bodyBackground.html iframe,
6607 // display for all div elements is set to "inline",
6608 // which causes a problem only in Android 8 Chrome 86.
6609 // Ensuring the div is display: block
6610 // gets around this issue.
6611 trChild.style.display = "block";
6614 .appendChild( table )
6616 .appendChild( trChild );
6618 trStyle = window.getComputedStyle( tr );
6619 reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) +
6620 parseInt( trStyle.borderTopWidth, 10 ) +
6621 parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight;
6623 documentElement.removeChild( table );
6625 return reliableTrDimensionsVal;
6631 function curCSS( elem, name, computed ) {
6632 var width, minWidth, maxWidth, ret,
6633 isCustomProp = rcustomProp.test( name ),
6635 // Support: Firefox 51+
6636 // Retrieving style before computed somehow
6637 // fixes an issue with getting wrong values
6638 // on detached elements
6641 computed = computed || getStyles( elem );
6643 // getPropertyValue is needed for:
6644 // .css('filter') (IE 9 only, trac-12537)
6645 // .css('--customProperty) (gh-3144)
6648 // Support: IE <=9 - 11+
6649 // IE only supports `"float"` in `getPropertyValue`; in computed styles
6650 // it's only available as `"cssFloat"`. We no longer modify properties
6651 // sent to `.css()` apart from camelCasing, so we need to check both.
6652 // Normally, this would create difference in behavior: if
6653 // `getPropertyValue` returns an empty string, the value returned
6654 // by `.css()` would be `undefined`. This is usually the case for
6655 // disconnected elements. However, in IE even disconnected elements
6656 // with no styles return `"none"` for `getPropertyValue( "float" )`
6657 ret = computed.getPropertyValue( name ) || computed[ name ];
6659 if ( isCustomProp && ret ) {
6661 // Support: Firefox 105+, Chrome <=105+
6662 // Spec requires trimming whitespace for custom properties (gh-4926).
6663 // Firefox only trims leading whitespace. Chrome just collapses
6664 // both leading & trailing whitespace to a single space.
6666 // Fall back to `undefined` if empty string returned.
6667 // This collapses a missing definition with property defined
6668 // and set to an empty string but there's no standard API
6669 // allowing us to differentiate them without a performance penalty
6670 // and returning `undefined` aligns with older jQuery.
6672 // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED
6673 // as whitespace while CSS does not, but this is not a problem
6674 // because CSS preprocessing replaces them with U+000A LINE FEED
6675 // (which *is* CSS whitespace)
6676 // https://www.w3.org/TR/css-syntax-3/#input-preprocessing
6677 ret = ret.replace( rtrimCSS, "$1" ) || undefined;
6680 if ( ret === "" && !isAttached( elem ) ) {
6681 ret = jQuery.style( elem, name );
6684 // A tribute to the "awesome hack by Dean Edwards"
6685 // Android Browser returns percentage for some values,
6686 // but width seems to be reliably pixels.
6687 // This is against the CSSOM draft spec:
6688 // https://drafts.csswg.org/cssom/#resolved-values
6689 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
6691 // Remember the original values
6692 width = style.width;
6693 minWidth = style.minWidth;
6694 maxWidth = style.maxWidth;
6696 // Put in the new values to get a computed value out
6697 style.minWidth = style.maxWidth = style.width = ret;
6698 ret = computed.width;
6700 // Revert the changed values
6701 style.width = width;
6702 style.minWidth = minWidth;
6703 style.maxWidth = maxWidth;
6707 return ret !== undefined ?
6709 // Support: IE <=9 - 11 only
6710 // IE returns zIndex value as an integer.
6716 function addGetHookIf( conditionFn, hookFn ) {
6718 // Define the hook, we'll check on the first run if it's really needed.
6721 if ( conditionFn() ) {
6723 // Hook not needed (or it's not possible to use it due
6724 // to missing dependency), remove it.
6729 // Hook needed; redefine it so that the support test is not executed again.
6730 return ( this.get = hookFn ).apply( this, arguments );
6736 var cssPrefixes = [ "Webkit", "Moz", "ms" ],
6737 emptyStyle = document.createElement( "div" ).style,
6740 // Return a vendor-prefixed property or undefined
6741 function vendorPropName( name ) {
6743 // Check for vendor prefixed names
6744 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
6745 i = cssPrefixes.length;
6748 name = cssPrefixes[ i ] + capName;
6749 if ( name in emptyStyle ) {
6755 // Return a potentially-mapped jQuery.cssProps or vendor prefixed property
6756 function finalPropName( name ) {
6757 var final = jQuery.cssProps[ name ] || vendorProps[ name ];
6762 if ( name in emptyStyle ) {
6765 return vendorProps[ name ] = vendorPropName( name ) || name;
6771 // Swappable if display is none or starts with table
6772 // except "table", "table-cell", or "table-caption"
6773 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
6774 rdisplayswap = /^(none|table(?!-c[ea]).+)/,
6775 cssShow = { position: "absolute", visibility: "hidden", display: "block" },
6776 cssNormalTransform = {
6781 function setPositiveNumber( _elem, value, subtract ) {
6783 // Any relative (+/-) values have already been
6784 // normalized at this point
6785 var matches = rcssNum.exec( value );
6788 // Guard against undefined "subtract", e.g., when used as in cssHooks
6789 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
6793 function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
6794 var i = dimension === "width" ? 1 : 0,
6798 // Adjustment may not be necessary
6799 if ( box === ( isBorderBox ? "border" : "content" ) ) {
6803 for ( ; i < 4; i += 2 ) {
6805 // Both box models exclude margin
6806 if ( box === "margin" ) {
6807 delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
6810 // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
6811 if ( !isBorderBox ) {
6814 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6816 // For "border" or "margin", add border
6817 if ( box !== "padding" ) {
6818 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6820 // But still keep track of it otherwise
6822 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6825 // If we get here with a border-box (content + padding + border), we're seeking "content" or
6826 // "padding" or "margin"
6829 // For "content", subtract padding
6830 if ( box === "content" ) {
6831 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
6834 // For "content" or "padding", subtract border
6835 if ( box !== "margin" ) {
6836 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
6841 // Account for positive content-box scroll gutter when requested by providing computedVal
6842 if ( !isBorderBox && computedVal >= 0 ) {
6844 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
6845 // Assuming integer scroll gutter, subtract the rest and round down
6846 delta += Math.max( 0, Math.ceil(
6847 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
6853 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter
6854 // Use an explicit zero to avoid NaN (gh-3964)
6861 function getWidthOrHeight( elem, dimension, extra ) {
6863 // Start with computed style
6864 var styles = getStyles( elem ),
6866 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322).
6867 // Fake content-box until we know it's needed to know the true value.
6868 boxSizingNeeded = !support.boxSizingReliable() || extra,
6869 isBorderBox = boxSizingNeeded &&
6870 jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
6871 valueIsBorderBox = isBorderBox,
6873 val = curCSS( elem, dimension, styles ),
6874 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 );
6876 // Support: Firefox <=54
6877 // Return a confounding non-pixel value or feign ignorance, as appropriate.
6878 if ( rnumnonpx.test( val ) ) {
6886 // Support: IE 9 - 11 only
6887 // Use offsetWidth/offsetHeight for when box sizing is unreliable.
6888 // In those cases, the computed value can be trusted to be border-box.
6889 if ( ( !support.boxSizingReliable() && isBorderBox ||
6891 // Support: IE 10 - 11+, Edge 15 - 18+
6892 // IE/Edge misreport `getComputedStyle` of table rows with width/height
6893 // set in CSS while `offset*` properties report correct values.
6894 // Interestingly, in some cases IE 9 doesn't suffer from this issue.
6895 !support.reliableTrDimensions() && nodeName( elem, "tr" ) ||
6897 // Fall back to offsetWidth/offsetHeight when value is "auto"
6898 // This happens for inline elements with no explicit setting (gh-3571)
6901 // Support: Android <=4.1 - 4.3 only
6902 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
6903 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) &&
6905 // Make sure the element is visible & connected
6906 elem.getClientRects().length ) {
6908 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box";
6910 // Where available, offsetWidth/offsetHeight approximate border box dimensions.
6911 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the
6912 // retrieved value as a content box dimension.
6913 valueIsBorderBox = offsetProp in elem;
6914 if ( valueIsBorderBox ) {
6915 val = elem[ offsetProp ];
6919 // Normalize "" and auto
6920 val = parseFloat( val ) || 0;
6922 // Adjust for the element's box model
6927 extra || ( isBorderBox ? "border" : "content" ),
6931 // Provide the current computed size to request scroll gutter calculation (gh-3589)
6939 // Add in style property hooks for overriding the default
6940 // behavior of getting and setting a style property
6943 get: function( elem, computed ) {
6946 // We should always get a number back from opacity
6947 var ret = curCSS( elem, "opacity" );
6948 return ret === "" ? "1" : ret;
6954 // Don't automatically add "px" to these possibly-unitless properties
6956 "animationIterationCount": true,
6957 "columnCount": true,
6958 "fillOpacity": true,
6964 "gridColumnEnd": true,
6965 "gridColumnStart": true,
6968 "gridRowStart": true,
6978 // Add in properties whose names you wish to fix before
6979 // setting or getting the value
6982 // Get and set the style property on a DOM Node
6983 style: function( elem, name, value, extra ) {
6985 // Don't set styles on text and comment nodes
6986 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
6990 // Make sure that we're working with the right name
6991 var ret, type, hooks,
6992 origName = camelCase( name ),
6993 isCustomProp = rcustomProp.test( name ),
6996 // Make sure that we're working with the right name. We don't
6997 // want to query the value if it is a CSS custom property
6998 // since they are user-defined.
6999 if ( !isCustomProp ) {
7000 name = finalPropName( origName );
7003 // Gets hook for the prefixed version, then unprefixed version
7004 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
7006 // Check if we're setting a value
7007 if ( value !== undefined ) {
7008 type = typeof value;
7010 // Convert "+=" or "-=" to relative numbers (trac-7345)
7011 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
7012 value = adjustCSS( elem, name, ret );
7014 // Fixes bug trac-9237
7018 // Make sure that null and NaN values aren't set (trac-7116)
7019 if ( value == null || value !== value ) {
7023 // If a number was passed in, add the unit (except for certain CSS properties)
7024 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append
7025 // "px" to a few hardcoded values.
7026 if ( type === "number" && !isCustomProp ) {
7027 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
7030 // background-* props affect original clone's values
7031 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
7032 style[ name ] = "inherit";
7035 // If a hook was provided, use that value, otherwise just set the specified value
7036 if ( !hooks || !( "set" in hooks ) ||
7037 ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
7039 if ( isCustomProp ) {
7040 style.setProperty( name, value );
7042 style[ name ] = value;
7048 // If a hook was provided get the non-computed value from there
7049 if ( hooks && "get" in hooks &&
7050 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
7055 // Otherwise just get the value from the style object
7056 return style[ name ];
7060 css: function( elem, name, extra, styles ) {
7061 var val, num, hooks,
7062 origName = camelCase( name ),
7063 isCustomProp = rcustomProp.test( name );
7065 // Make sure that we're working with the right name. We don't
7066 // want to modify the value if it is a CSS custom property
7067 // since they are user-defined.
7068 if ( !isCustomProp ) {
7069 name = finalPropName( origName );
7072 // Try prefixed name followed by the unprefixed name
7073 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
7075 // If a hook was provided get the computed value from there
7076 if ( hooks && "get" in hooks ) {
7077 val = hooks.get( elem, true, extra );
7080 // Otherwise, if a way to get the computed value exists, use that
7081 if ( val === undefined ) {
7082 val = curCSS( elem, name, styles );
7085 // Convert "normal" to computed value
7086 if ( val === "normal" && name in cssNormalTransform ) {
7087 val = cssNormalTransform[ name ];
7090 // Make numeric if forced or a qualifier was provided and val looks numeric
7091 if ( extra === "" || extra ) {
7092 num = parseFloat( val );
7093 return extra === true || isFinite( num ) ? num || 0 : val;
7100 jQuery.each( [ "height", "width" ], function( _i, dimension ) {
7101 jQuery.cssHooks[ dimension ] = {
7102 get: function( elem, computed, extra ) {
7105 // Certain elements can have dimension info if we invisibly show them
7106 // but it must have a current display style that would benefit
7107 return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
7109 // Support: Safari 8+
7110 // Table columns in Safari have non-zero offsetWidth & zero
7111 // getBoundingClientRect().width unless display is changed.
7112 // Support: IE <=11 only
7113 // Running getBoundingClientRect on a disconnected node
7114 // in IE throws an error.
7115 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
7116 swap( elem, cssShow, function() {
7117 return getWidthOrHeight( elem, dimension, extra );
7119 getWidthOrHeight( elem, dimension, extra );
7123 set: function( elem, value, extra ) {
7125 styles = getStyles( elem ),
7127 // Only read styles.position if the test has a chance to fail
7128 // to avoid forcing a reflow.
7129 scrollboxSizeBuggy = !support.scrollboxSize() &&
7130 styles.position === "absolute",
7132 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991)
7133 boxSizingNeeded = scrollboxSizeBuggy || extra,
7134 isBorderBox = boxSizingNeeded &&
7135 jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
7146 // Account for unreliable border-box dimensions by comparing offset* to computed and
7147 // faking a content-box to get border and padding (gh-3699)
7148 if ( isBorderBox && scrollboxSizeBuggy ) {
7149 subtract -= Math.ceil(
7150 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
7151 parseFloat( styles[ dimension ] ) -
7152 boxModelAdjustment( elem, dimension, "border", false, styles ) -
7157 // Convert to pixels if value adjustment is needed
7158 if ( subtract && ( matches = rcssNum.exec( value ) ) &&
7159 ( matches[ 3 ] || "px" ) !== "px" ) {
7161 elem.style[ dimension ] = value;
7162 value = jQuery.css( elem, dimension );
7165 return setPositiveNumber( elem, value, subtract );
7170 jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
7171 function( elem, computed ) {
7173 return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
7174 elem.getBoundingClientRect().left -
7175 swap( elem, { marginLeft: 0 }, function() {
7176 return elem.getBoundingClientRect().left;
7183 // These hooks are used by animate to expand properties
7188 }, function( prefix, suffix ) {
7189 jQuery.cssHooks[ prefix + suffix ] = {
7190 expand: function( value ) {
7194 // Assumes a single number if not a string
7195 parts = typeof value === "string" ? value.split( " " ) : [ value ];
7197 for ( ; i < 4; i++ ) {
7198 expanded[ prefix + cssExpand[ i ] + suffix ] =
7199 parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
7206 if ( prefix !== "margin" ) {
7207 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
7212 css: function( name, value ) {
7213 return access( this, function( elem, name, value ) {
7218 if ( Array.isArray( name ) ) {
7219 styles = getStyles( elem );
7222 for ( ; i < len; i++ ) {
7223 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
7229 return value !== undefined ?
7230 jQuery.style( elem, name, value ) :
7231 jQuery.css( elem, name );
7232 }, name, value, arguments.length > 1 );
7237 // Based off of the plugin by Clint Helfers, with permission.
7238 jQuery.fn.delay = function( time, type ) {
7239 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
7240 type = type || "fx";
7242 return this.queue( type, function( next, hooks ) {
7243 var timeout = window.setTimeout( next, time );
7244 hooks.stop = function() {
7245 window.clearTimeout( timeout );
7252 var input = document.createElement( "input" ),
7253 select = document.createElement( "select" ),
7254 opt = select.appendChild( document.createElement( "option" ) );
7256 input.type = "checkbox";
7258 // Support: Android <=4.3 only
7259 // Default value for a checkbox should be "on"
7260 support.checkOn = input.value !== "";
7262 // Support: IE <=11 only
7263 // Must access selectedIndex to make default options select
7264 support.optSelected = opt.selected;
7266 // Support: IE <=11 only
7267 // An input loses its value after becoming a radio
7268 input = document.createElement( "input" );
7270 input.type = "radio";
7271 support.radioValue = input.value === "t";
7276 attrHandle = jQuery.expr.attrHandle;
7279 attr: function( name, value ) {
7280 return access( this, jQuery.attr, name, value, arguments.length > 1 );
7283 removeAttr: function( name ) {
7284 return this.each( function() {
7285 jQuery.removeAttr( this, name );
7291 attr: function( elem, name, value ) {
7293 nType = elem.nodeType;
7295 // Don't get/set attributes on text, comment and attribute nodes
7296 if ( nType === 3 || nType === 8 || nType === 2 ) {
7300 // Fallback to prop when attributes are not supported
7301 if ( typeof elem.getAttribute === "undefined" ) {
7302 return jQuery.prop( elem, name, value );
7305 // Attribute hooks are determined by the lowercase version
7306 // Grab necessary hook if one is defined
7307 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
7308 hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
7309 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
7312 if ( value !== undefined ) {
7313 if ( value === null ) {
7314 jQuery.removeAttr( elem, name );
7318 if ( hooks && "set" in hooks &&
7319 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
7323 elem.setAttribute( name, value + "" );
7327 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
7331 ret = jQuery.find.attr( elem, name );
7333 // Non-existent attributes return null, we normalize to undefined
7334 return ret == null ? undefined : ret;
7339 set: function( elem, value ) {
7340 if ( !support.radioValue && value === "radio" &&
7341 nodeName( elem, "input" ) ) {
7342 var val = elem.value;
7343 elem.setAttribute( "type", value );
7353 removeAttr: function( elem, value ) {
7357 // Attribute names can contain non-HTML whitespace characters
7358 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
7359 attrNames = value && value.match( rnothtmlwhite );
7361 if ( attrNames && elem.nodeType === 1 ) {
7362 while ( ( name = attrNames[ i++ ] ) ) {
7363 elem.removeAttribute( name );
7369 // Hooks for boolean attributes
7371 set: function( elem, value, name ) {
7372 if ( value === false ) {
7374 // Remove boolean attributes when set to false
7375 jQuery.removeAttr( elem, name );
7377 elem.setAttribute( name, name );
7383 jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) {
7384 var getter = attrHandle[ name ] || jQuery.find.attr;
7386 attrHandle[ name ] = function( elem, name, isXML ) {
7388 lowercaseName = name.toLowerCase();
7392 // Avoid an infinite loop by temporarily removing this function from the getter
7393 handle = attrHandle[ lowercaseName ];
7394 attrHandle[ lowercaseName ] = ret;
7395 ret = getter( elem, name, isXML ) != null ?
7398 attrHandle[ lowercaseName ] = handle;
7407 var rfocusable = /^(?:input|select|textarea|button)$/i,
7408 rclickable = /^(?:a|area)$/i;
7411 prop: function( name, value ) {
7412 return access( this, jQuery.prop, name, value, arguments.length > 1 );
7415 removeProp: function( name ) {
7416 return this.each( function() {
7417 delete this[ jQuery.propFix[ name ] || name ];
7423 prop: function( elem, name, value ) {
7425 nType = elem.nodeType;
7427 // Don't get/set properties on text, comment and attribute nodes
7428 if ( nType === 3 || nType === 8 || nType === 2 ) {
7432 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
7434 // Fix name and attach hooks
7435 name = jQuery.propFix[ name ] || name;
7436 hooks = jQuery.propHooks[ name ];
7439 if ( value !== undefined ) {
7440 if ( hooks && "set" in hooks &&
7441 ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
7445 return ( elem[ name ] = value );
7448 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
7452 return elem[ name ];
7457 get: function( elem ) {
7459 // Support: IE <=9 - 11 only
7460 // elem.tabIndex doesn't always return the
7461 // correct value when it hasn't been explicitly set
7462 // Use proper attribute retrieval (trac-12072)
7463 var tabindex = jQuery.find.attr( elem, "tabindex" );
7466 return parseInt( tabindex, 10 );
7470 rfocusable.test( elem.nodeName ) ||
7471 rclickable.test( elem.nodeName ) &&
7484 "class": "className"
7488 // Support: IE <=11 only
7489 // Accessing the selectedIndex property
7490 // forces the browser to respect setting selected
7492 // The getter ensures a default option is selected
7493 // when in an optgroup
7494 // eslint rule "no-unused-expressions" is disabled for this code
7495 // since it considers such accessions noop
7496 if ( !support.optSelected ) {
7497 jQuery.propHooks.selected = {
7498 get: function( elem ) {
7500 /* eslint no-unused-expressions: "off" */
7502 var parent = elem.parentNode;
7503 if ( parent && parent.parentNode ) {
7504 parent.parentNode.selectedIndex;
7508 set: function( elem ) {
7510 /* eslint no-unused-expressions: "off" */
7512 var parent = elem.parentNode;
7514 parent.selectedIndex;
7516 if ( parent.parentNode ) {
7517 parent.parentNode.selectedIndex;
7536 jQuery.propFix[ this.toLowerCase() ] = this;
7542 // Strip and collapse whitespace according to HTML spec
7543 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
7544 function stripAndCollapse( value ) {
7545 var tokens = value.match( rnothtmlwhite ) || [];
7546 return tokens.join( " " );
7550 function getClass( elem ) {
7551 return elem.getAttribute && elem.getAttribute( "class" ) || "";
7554 function classesToArray( value ) {
7555 if ( Array.isArray( value ) ) {
7558 if ( typeof value === "string" ) {
7559 return value.match( rnothtmlwhite ) || [];
7565 addClass: function( value ) {
7566 var classNames, cur, curValue, className, i, finalValue;
7568 if ( isFunction( value ) ) {
7569 return this.each( function( j ) {
7570 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
7574 classNames = classesToArray( value );
7576 if ( classNames.length ) {
7577 return this.each( function() {
7578 curValue = getClass( this );
7579 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
7582 for ( i = 0; i < classNames.length; i++ ) {
7583 className = classNames[ i ];
7584 if ( cur.indexOf( " " + className + " " ) < 0 ) {
7585 cur += className + " ";
7589 // Only assign if different to avoid unneeded rendering.
7590 finalValue = stripAndCollapse( cur );
7591 if ( curValue !== finalValue ) {
7592 this.setAttribute( "class", finalValue );
7601 removeClass: function( value ) {
7602 var classNames, cur, curValue, className, i, finalValue;
7604 if ( isFunction( value ) ) {
7605 return this.each( function( j ) {
7606 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
7610 if ( !arguments.length ) {
7611 return this.attr( "class", "" );
7614 classNames = classesToArray( value );
7616 if ( classNames.length ) {
7617 return this.each( function() {
7618 curValue = getClass( this );
7620 // This expression is here for better compressibility (see addClass)
7621 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
7624 for ( i = 0; i < classNames.length; i++ ) {
7625 className = classNames[ i ];
7627 // Remove *all* instances
7628 while ( cur.indexOf( " " + className + " " ) > -1 ) {
7629 cur = cur.replace( " " + className + " ", " " );
7633 // Only assign if different to avoid unneeded rendering.
7634 finalValue = stripAndCollapse( cur );
7635 if ( curValue !== finalValue ) {
7636 this.setAttribute( "class", finalValue );
7645 toggleClass: function( value, stateVal ) {
7646 var classNames, className, i, self,
7647 type = typeof value,
7648 isValidValue = type === "string" || Array.isArray( value );
7650 if ( isFunction( value ) ) {
7651 return this.each( function( i ) {
7652 jQuery( this ).toggleClass(
7653 value.call( this, i, getClass( this ), stateVal ),
7659 if ( typeof stateVal === "boolean" && isValidValue ) {
7660 return stateVal ? this.addClass( value ) : this.removeClass( value );
7663 classNames = classesToArray( value );
7665 return this.each( function() {
7666 if ( isValidValue ) {
7668 // Toggle individual class names
7669 self = jQuery( this );
7671 for ( i = 0; i < classNames.length; i++ ) {
7672 className = classNames[ i ];
7674 // Check each className given, space separated list
7675 if ( self.hasClass( className ) ) {
7676 self.removeClass( className );
7678 self.addClass( className );
7682 // Toggle whole class name
7683 } else if ( value === undefined || type === "boolean" ) {
7684 className = getClass( this );
7687 // Store className if set
7688 dataPriv.set( this, "__className__", className );
7691 // If the element has a class name or if we're passed `false`,
7692 // then remove the whole classname (if there was one, the above saved it).
7693 // Otherwise bring back whatever was previously saved (if anything),
7694 // falling back to the empty string if nothing was stored.
7695 if ( this.setAttribute ) {
7696 this.setAttribute( "class",
7697 className || value === false ?
7699 dataPriv.get( this, "__className__" ) || ""
7706 hasClass: function( selector ) {
7707 var className, elem,
7710 className = " " + selector + " ";
7711 while ( ( elem = this[ i++ ] ) ) {
7712 if ( elem.nodeType === 1 &&
7713 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
7725 var rreturn = /\r/g;
7728 val: function( value ) {
7729 var hooks, ret, valueIsFunction,
7732 if ( !arguments.length ) {
7734 hooks = jQuery.valHooks[ elem.type ] ||
7735 jQuery.valHooks[ elem.nodeName.toLowerCase() ];
7739 ( ret = hooks.get( elem, "value" ) ) !== undefined
7746 // Handle most common string cases
7747 if ( typeof ret === "string" ) {
7748 return ret.replace( rreturn, "" );
7751 // Handle cases where value is null/undef or number
7752 return ret == null ? "" : ret;
7758 valueIsFunction = isFunction( value );
7760 return this.each( function( i ) {
7763 if ( this.nodeType !== 1 ) {
7767 if ( valueIsFunction ) {
7768 val = value.call( this, i, jQuery( this ).val() );
7773 // Treat null/undefined as ""; convert numbers to string
7774 if ( val == null ) {
7777 } else if ( typeof val === "number" ) {
7780 } else if ( Array.isArray( val ) ) {
7781 val = jQuery.map( val, function( value ) {
7782 return value == null ? "" : value + "";
7786 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
7788 // If set returns undefined, fall back to normal setting
7789 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
7799 get: function( elem ) {
7801 var val = jQuery.find.attr( elem, "value" );
7802 return val != null ?
7805 // Support: IE <=10 - 11 only
7806 // option.text throws exceptions (trac-14686, trac-14858)
7807 // Strip and collapse whitespace
7808 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
7809 stripAndCollapse( jQuery.text( elem ) );
7813 get: function( elem ) {
7814 var value, option, i,
7815 options = elem.options,
7816 index = elem.selectedIndex,
7817 one = elem.type === "select-one",
7818 values = one ? null : [],
7819 max = one ? index + 1 : options.length;
7825 i = one ? index : 0;
7828 // Loop through all the selected options
7829 for ( ; i < max; i++ ) {
7830 option = options[ i ];
7832 // Support: IE <=9 only
7833 // IE8-9 doesn't update selected after form reset (trac-2551)
7834 if ( ( option.selected || i === index ) &&
7836 // Don't return options that are disabled or in a disabled optgroup
7838 ( !option.parentNode.disabled ||
7839 !nodeName( option.parentNode, "optgroup" ) ) ) {
7841 // Get the specific value for the option
7842 value = jQuery( option ).val();
7844 // We don't need an array for one selects
7849 // Multi-Selects return an array
7850 values.push( value );
7857 set: function( elem, value ) {
7858 var optionSet, option,
7859 options = elem.options,
7860 values = jQuery.makeArray( value ),
7864 option = options[ i ];
7866 /* eslint-disable no-cond-assign */
7868 if ( option.selected =
7869 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
7874 /* eslint-enable no-cond-assign */
7877 // Force browsers to behave consistently when non-matching value is set
7879 elem.selectedIndex = -1;
7887 // Radios and checkboxes getter/setter
7888 jQuery.each( [ "radio", "checkbox" ], function() {
7889 jQuery.valHooks[ this ] = {
7890 set: function( elem, value ) {
7891 if ( Array.isArray( value ) ) {
7892 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
7896 if ( !support.checkOn ) {
7897 jQuery.valHooks[ this ].get = function( elem ) {
7898 return elem.getAttribute( "value" ) === null ? "on" : elem.value;
7906 // Return jQuery for attributes-only inclusion
7909 support.focusin = "onfocusin" in window;
7912 var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
7913 stopPropagationCallback = function( e ) {
7914 e.stopPropagation();
7917 jQuery.extend( jQuery.event, {
7919 trigger: function( event, data, elem, onlyHandlers ) {
7921 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
7922 eventPath = [ elem || document ],
7923 type = hasOwn.call( event, "type" ) ? event.type : event,
7924 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
7926 cur = lastElement = tmp = elem = elem || document;
7928 // Don't do events on text and comment nodes
7929 if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
7933 // focus/blur morphs to focusin/out; ensure we're not firing them right now
7934 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
7938 if ( type.indexOf( "." ) > -1 ) {
7940 // Namespaced trigger; create a regexp to match event type in handle()
7941 namespaces = type.split( "." );
7942 type = namespaces.shift();
7945 ontype = type.indexOf( ":" ) < 0 && "on" + type;
7947 // Caller can pass in a jQuery.Event object, Object, or just an event type string
7948 event = event[ jQuery.expando ] ?
7950 new jQuery.Event( type, typeof event === "object" && event );
7952 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
7953 event.isTrigger = onlyHandlers ? 2 : 3;
7954 event.namespace = namespaces.join( "." );
7955 event.rnamespace = event.namespace ?
7956 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
7959 // Clean up the event in case it is being reused
7960 event.result = undefined;
7961 if ( !event.target ) {
7962 event.target = elem;
7965 // Clone any incoming data and prepend the event, creating the handler arg list
7966 data = data == null ?
7968 jQuery.makeArray( data, [ event ] );
7970 // Allow special events to draw outside the lines
7971 special = jQuery.event.special[ type ] || {};
7972 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
7976 // Determine event propagation path in advance, per W3C events spec (trac-9951)
7977 // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724)
7978 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
7980 bubbleType = special.delegateType || type;
7981 if ( !rfocusMorph.test( bubbleType + type ) ) {
7982 cur = cur.parentNode;
7984 for ( ; cur; cur = cur.parentNode ) {
7985 eventPath.push( cur );
7989 // Only add window if we got to document (e.g., not plain obj or detached DOM)
7990 if ( tmp === ( elem.ownerDocument || document ) ) {
7991 eventPath.push( tmp.defaultView || tmp.parentWindow || window );
7995 // Fire handlers on the event path
7997 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
7999 event.type = i > 1 ?
8001 special.bindType || type;
8004 handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] &&
8005 dataPriv.get( cur, "handle" );
8007 handle.apply( cur, data );
8011 handle = ontype && cur[ ontype ];
8012 if ( handle && handle.apply && acceptData( cur ) ) {
8013 event.result = handle.apply( cur, data );
8014 if ( event.result === false ) {
8015 event.preventDefault();
8021 // If nobody prevented the default action, do it now
8022 if ( !onlyHandlers && !event.isDefaultPrevented() ) {
8024 if ( ( !special._default ||
8025 special._default.apply( eventPath.pop(), data ) === false ) &&
8026 acceptData( elem ) ) {
8028 // Call a native DOM method on the target with the same name as the event.
8029 // Don't do default actions on window, that's where global variables be (trac-6170)
8030 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
8032 // Don't re-trigger an onFOO event when we call its FOO() method
8033 tmp = elem[ ontype ];
8036 elem[ ontype ] = null;
8039 // Prevent re-triggering of the same event, since we already bubbled it above
8040 jQuery.event.triggered = type;
8042 if ( event.isPropagationStopped() ) {
8043 lastElement.addEventListener( type, stopPropagationCallback );
8048 if ( event.isPropagationStopped() ) {
8049 lastElement.removeEventListener( type, stopPropagationCallback );
8052 jQuery.event.triggered = undefined;
8055 elem[ ontype ] = tmp;
8061 return event.result;
8064 // Piggyback on a donor event to simulate a different one
8065 // Used only for `focus(in | out)` events
8066 simulate: function( type, elem, event ) {
8067 var e = jQuery.extend(
8076 jQuery.event.trigger( e, null, elem );
8083 trigger: function( type, data ) {
8084 return this.each( function() {
8085 jQuery.event.trigger( type, data, this );
8088 triggerHandler: function( type, data ) {
8089 var elem = this[ 0 ];
8091 return jQuery.event.trigger( type, data, elem, true );
8097 // Support: Firefox <=44
8098 // Firefox doesn't have focus(in | out) events
8099 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
8101 // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
8102 // focus(in | out) events fire after focus & blur events,
8103 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
8104 // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
8105 if ( !support.focusin ) {
8106 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
8108 // Attach a single capturing handler on the document while someone wants focusin/focusout
8109 var handler = function( event ) {
8110 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
8113 jQuery.event.special[ fix ] = {
8116 // Handle: regular nodes (via `this.ownerDocument`), window
8117 // (via `this.document`) & document (via `this`).
8118 var doc = this.ownerDocument || this.document || this,
8119 attaches = dataPriv.access( doc, fix );
8122 doc.addEventListener( orig, handler, true );
8124 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
8126 teardown: function() {
8127 var doc = this.ownerDocument || this.document || this,
8128 attaches = dataPriv.access( doc, fix ) - 1;
8131 doc.removeEventListener( orig, handler, true );
8132 dataPriv.remove( doc, fix );
8135 dataPriv.access( doc, fix, attaches );
8143 // Cross-browser xml parsing
8144 jQuery.parseXML = function( data ) {
8145 var xml, parserErrorElem;
8146 if ( !data || typeof data !== "string" ) {
8150 // Support: IE 9 - 11 only
8151 // IE throws on parseFromString with invalid input.
8153 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
8156 parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
8157 if ( !xml || parserErrorElem ) {
8158 jQuery.error( "Invalid XML: " + (
8160 jQuery.map( parserErrorElem.childNodes, function( el ) {
8161 return el.textContent;
8173 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
8174 rsubmittable = /^(?:input|select|textarea|keygen)/i;
8176 function buildParams( prefix, obj, traditional, add ) {
8179 if ( Array.isArray( obj ) ) {
8181 // Serialize array item.
8182 jQuery.each( obj, function( i, v ) {
8183 if ( traditional || rbracket.test( prefix ) ) {
8185 // Treat each array item as a scalar.
8190 // Item is non-scalar (array or object), encode its numeric index.
8192 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
8200 } else if ( !traditional && toType( obj ) === "object" ) {
8202 // Serialize object item.
8203 for ( name in obj ) {
8204 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
8209 // Serialize scalar item.
8214 // Serialize an array of form elements or a set of
8215 // key/values into a query string
8216 jQuery.param = function( a, traditional ) {
8219 add = function( key, valueOrFunction ) {
8221 // If value is a function, invoke it and use its return value
8222 var value = isFunction( valueOrFunction ) ?
8226 s[ s.length ] = encodeURIComponent( key ) + "=" +
8227 encodeURIComponent( value == null ? "" : value );
8234 // If an array was passed in, assume that it is an array of form elements.
8235 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
8237 // Serialize the form elements
8238 jQuery.each( a, function() {
8239 add( this.name, this.value );
8244 // If traditional, encode the "old" way (the way 1.3.2 or older
8245 // did it), otherwise encode params recursively.
8246 for ( prefix in a ) {
8247 buildParams( prefix, a[ prefix ], traditional, add );
8251 // Return the resulting serialization
8252 return s.join( "&" );
8256 serialize: function() {
8257 return jQuery.param( this.serializeArray() );
8259 serializeArray: function() {
8260 return this.map( function() {
8262 // Can add propHook for "elements" to filter or add form elements
8263 var elements = jQuery.prop( this, "elements" );
8264 return elements ? jQuery.makeArray( elements ) : this;
8265 } ).filter( function() {
8266 var type = this.type;
8268 // Use .is( ":disabled" ) so that fieldset[disabled] works
8269 return this.name && !jQuery( this ).is( ":disabled" ) &&
8270 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
8271 ( this.checked || !rcheckableType.test( type ) );
8272 } ).map( function( _i, elem ) {
8273 var val = jQuery( this ).val();
8275 if ( val == null ) {
8279 if ( Array.isArray( val ) ) {
8280 return jQuery.map( val, function( val ) {
8281 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
8285 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
8292 wrapAll: function( html ) {
8296 if ( isFunction( html ) ) {
8297 html = html.call( this[ 0 ] );
8300 // The elements to wrap the target around
8301 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
8303 if ( this[ 0 ].parentNode ) {
8304 wrap.insertBefore( this[ 0 ] );
8307 wrap.map( function() {
8310 while ( elem.firstElementChild ) {
8311 elem = elem.firstElementChild;
8321 wrapInner: function( html ) {
8322 if ( isFunction( html ) ) {
8323 return this.each( function( i ) {
8324 jQuery( this ).wrapInner( html.call( this, i ) );
8328 return this.each( function() {
8329 var self = jQuery( this ),
8330 contents = self.contents();
8332 if ( contents.length ) {
8333 contents.wrapAll( html );
8336 self.append( html );
8341 wrap: function( html ) {
8342 var htmlIsFunction = isFunction( html );
8344 return this.each( function( i ) {
8345 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
8349 unwrap: function( selector ) {
8350 this.parent( selector ).not( "body" ).each( function() {
8351 jQuery( this ).replaceWith( this.childNodes );
8358 jQuery.expr.pseudos.hidden = function( elem ) {
8359 return !jQuery.expr.pseudos.visible( elem );
8361 jQuery.expr.pseudos.visible = function( elem ) {
8362 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
8368 // Support: Safari 8 only
8369 // In Safari 8 documents created via document.implementation.createHTMLDocument
8370 // collapse sibling forms: the second one becomes a child of the first one.
8371 // Because of that, this security measure has to be disabled in Safari 8.
8372 // https://bugs.webkit.org/show_bug.cgi?id=137337
8373 support.createHTMLDocument = ( function() {
8374 var body = document.implementation.createHTMLDocument( "" ).body;
8375 body.innerHTML = "<form></form><form></form>";
8376 return body.childNodes.length === 2;
8380 // Argument "data" should be string of html
8381 // context (optional): If specified, the fragment will be created in this context,
8382 // defaults to document
8383 // keepScripts (optional): If true, will include scripts passed in the html string
8384 jQuery.parseHTML = function( data, context, keepScripts ) {
8385 if ( typeof data !== "string" ) {
8388 if ( typeof context === "boolean" ) {
8389 keepScripts = context;
8393 var base, parsed, scripts;
8397 // Stop scripts or inline event handlers from being executed immediately
8398 // by using document.implementation
8399 if ( support.createHTMLDocument ) {
8400 context = document.implementation.createHTMLDocument( "" );
8402 // Set the base href for the created document
8403 // so any parsed elements with URLs
8404 // are based on the document's URL (gh-2965)
8405 base = context.createElement( "base" );
8406 base.href = document.location.href;
8407 context.head.appendChild( base );
8413 parsed = rsingleTag.exec( data );
8414 scripts = !keepScripts && [];
8418 return [ context.createElement( parsed[ 1 ] ) ];
8421 parsed = buildFragment( [ data ], context, scripts );
8423 if ( scripts && scripts.length ) {
8424 jQuery( scripts ).remove();
8427 return jQuery.merge( [], parsed.childNodes );
8432 setOffset: function( elem, options, i ) {
8433 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
8434 position = jQuery.css( elem, "position" ),
8435 curElem = jQuery( elem ),
8438 // Set position first, in-case top/left are set even on static elem
8439 if ( position === "static" ) {
8440 elem.style.position = "relative";
8443 curOffset = curElem.offset();
8444 curCSSTop = jQuery.css( elem, "top" );
8445 curCSSLeft = jQuery.css( elem, "left" );
8446 calculatePosition = ( position === "absolute" || position === "fixed" ) &&
8447 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
8449 // Need to be able to calculate position if either
8450 // top or left is auto and position is either absolute or fixed
8451 if ( calculatePosition ) {
8452 curPosition = curElem.position();
8453 curTop = curPosition.top;
8454 curLeft = curPosition.left;
8457 curTop = parseFloat( curCSSTop ) || 0;
8458 curLeft = parseFloat( curCSSLeft ) || 0;
8461 if ( isFunction( options ) ) {
8463 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
8464 options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
8467 if ( options.top != null ) {
8468 props.top = ( options.top - curOffset.top ) + curTop;
8470 if ( options.left != null ) {
8471 props.left = ( options.left - curOffset.left ) + curLeft;
8474 if ( "using" in options ) {
8475 options.using.call( elem, props );
8478 curElem.css( props );
8485 // offset() relates an element's border box to the document origin
8486 offset: function( options ) {
8488 // Preserve chaining for setter
8489 if ( arguments.length ) {
8490 return options === undefined ?
8492 this.each( function( i ) {
8493 jQuery.offset.setOffset( this, options, i );
8504 // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
8505 // Support: IE <=11 only
8506 // Running getBoundingClientRect on a
8507 // disconnected node in IE throws an error
8508 if ( !elem.getClientRects().length ) {
8509 return { top: 0, left: 0 };
8512 // Get document-relative position by adding viewport scroll to viewport-relative gBCR
8513 rect = elem.getBoundingClientRect();
8514 win = elem.ownerDocument.defaultView;
8516 top: rect.top + win.pageYOffset,
8517 left: rect.left + win.pageXOffset
8521 // position() relates an element's margin box to its offset parent's padding box
8522 // This corresponds to the behavior of CSS absolute positioning
8523 position: function() {
8528 var offsetParent, offset, doc,
8530 parentOffset = { top: 0, left: 0 };
8532 // position:fixed elements are offset from the viewport, which itself always has zero offset
8533 if ( jQuery.css( elem, "position" ) === "fixed" ) {
8535 // Assume position:fixed implies availability of getBoundingClientRect
8536 offset = elem.getBoundingClientRect();
8539 offset = this.offset();
8541 // Account for the *real* offset parent, which can be the document or its root element
8542 // when a statically positioned element is identified
8543 doc = elem.ownerDocument;
8544 offsetParent = elem.offsetParent || doc.documentElement;
8545 while ( offsetParent &&
8546 ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
8547 jQuery.css( offsetParent, "position" ) === "static" ) {
8549 offsetParent = offsetParent.parentNode;
8551 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
8553 // Incorporate borders into its offset, since they are outside its content origin
8554 parentOffset = jQuery( offsetParent ).offset();
8555 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
8556 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
8560 // Subtract parent offsets and element margins
8562 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
8563 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
8567 // This method will return documentElement in the following cases:
8568 // 1) For the element inside the iframe without offsetParent, this method will return
8569 // documentElement of the parent window
8570 // 2) For the hidden or detached element
8571 // 3) For body or html element, i.e. in case of the html node - it will return itself
8573 // but those exceptions were never presented as a real life use-cases
8574 // and might be considered as more preferable results.
8576 // This logic, however, is not guaranteed and can change at any point in the future
8577 offsetParent: function() {
8578 return this.map( function() {
8579 var offsetParent = this.offsetParent;
8581 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
8582 offsetParent = offsetParent.offsetParent;
8585 return offsetParent || documentElement;
8590 // Create scrollLeft and scrollTop methods
8591 jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
8592 var top = "pageYOffset" === prop;
8594 jQuery.fn[ method ] = function( val ) {
8595 return access( this, function( elem, method, val ) {
8597 // Coalesce documents and windows
8599 if ( isWindow( elem ) ) {
8601 } else if ( elem.nodeType === 9 ) {
8602 win = elem.defaultView;
8605 if ( val === undefined ) {
8606 return win ? win[ prop ] : elem[ method ];
8611 !top ? val : win.pageXOffset,
8612 top ? val : win.pageYOffset
8616 elem[ method ] = val;
8618 }, method, val, arguments.length );
8622 // Support: Safari <=7 - 9.1, Chrome <=37 - 49
8623 // Add the top/left cssHooks using jQuery.fn.position
8624 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
8625 // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
8626 // getComputedStyle returns percent when specified for top/left/bottom/right;
8627 // rather than make the css module depend on the offset module, just check for it here
8628 jQuery.each( [ "top", "left" ], function( _i, prop ) {
8629 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
8630 function( elem, computed ) {
8632 computed = curCSS( elem, prop );
8634 // If curCSS returns percentage, fallback to offset
8635 return rnumnonpx.test( computed ) ?
8636 jQuery( elem ).position()[ prop ] + "px" :
8644 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
8645 jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
8647 padding: "inner" + name,
8650 }, function( defaultExtra, funcName ) {
8652 // Margin is only for outerHeight, outerWidth
8653 jQuery.fn[ funcName ] = function( margin, value ) {
8654 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
8655 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
8657 return access( this, function( elem, type, value ) {
8660 if ( isWindow( elem ) ) {
8662 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
8663 return funcName.indexOf( "outer" ) === 0 ?
8664 elem[ "inner" + name ] :
8665 elem.document.documentElement[ "client" + name ];
8668 // Get document width or height
8669 if ( elem.nodeType === 9 ) {
8670 doc = elem.documentElement;
8672 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
8673 // whichever is greatest
8675 elem.body[ "scroll" + name ], doc[ "scroll" + name ],
8676 elem.body[ "offset" + name ], doc[ "offset" + name ],
8677 doc[ "client" + name ]
8681 return value === undefined ?
8683 // Get width or height on the element, requesting but not forcing parseFloat
8684 jQuery.css( elem, type, extra ) :
8686 // Set width or height on the element
8687 jQuery.style( elem, type, value, extra );
8688 }, type, chainable ? margin : undefined, chainable );
8696 bind: function( types, data, fn ) {
8697 return this.on( types, null, data, fn );
8699 unbind: function( types, fn ) {
8700 return this.off( types, null, fn );
8703 delegate: function( selector, types, data, fn ) {
8704 return this.on( types, selector, data, fn );
8706 undelegate: function( selector, types, fn ) {
8708 // ( namespace ) or ( selector, types [, fn] )
8709 return arguments.length === 1 ?
8710 this.off( selector, "**" ) :
8711 this.off( types, selector || "**", fn );
8714 hover: function( fnOver, fnOut ) {
8715 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
8720 ( "blur focus focusin focusout resize scroll click dblclick " +
8721 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
8722 "change select submit keydown keypress keyup contextmenu" ).split( " " ),
8723 function( _i, name ) {
8725 // Handle event binding
8726 jQuery.fn[ name ] = function( data, fn ) {
8727 return arguments.length > 0 ?
8728 this.on( name, null, data, fn ) :
8729 this.trigger( name );
8737 // Support: Android <=4.0 only
8738 // Make sure we trim BOM and NBSP
8739 // Require that the "whitespace run" starts from a non-whitespace
8740 // to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position.
8741 var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;
8743 // Bind a function to a context, optionally partially applying any
8745 // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
8746 // However, it is not slated for removal any time soon
8747 jQuery.proxy = function( fn, context ) {
8748 var tmp, args, proxy;
8750 if ( typeof context === "string" ) {
8751 tmp = fn[ context ];
8756 // Quick check to determine if target is callable, in the spec
8757 // this throws a TypeError, but we will just return undefined.
8758 if ( !isFunction( fn ) ) {
8763 args = slice.call( arguments, 2 );
8764 proxy = function() {
8765 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
8768 // Set the guid of unique handler to the same of original handler, so it can be removed
8769 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
8774 jQuery.holdReady = function( hold ) {
8778 jQuery.ready( true );
8781 jQuery.isArray = Array.isArray;
8782 jQuery.parseJSON = JSON.parse;
8783 jQuery.nodeName = nodeName;
8784 jQuery.isFunction = isFunction;
8785 jQuery.isWindow = isWindow;
8786 jQuery.camelCase = camelCase;
8787 jQuery.type = toType;
8789 jQuery.now = Date.now;
8791 jQuery.isNumeric = function( obj ) {
8793 // As of jQuery 3.0, isNumeric is limited to
8794 // strings and numbers (primitives or objects)
8795 // that can be coerced to finite numbers (gh-2662)
8796 var type = jQuery.type( obj );
8797 return ( type === "number" || type === "string" ) &&
8799 // parseFloat NaNs numeric-cast false positives ("")
8800 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
8801 // subtraction forces infinities to NaN
8802 !isNaN( obj - parseFloat( obj ) );
8805 jQuery.trim = function( text ) {
8806 return text == null ?
8808 ( text + "" ).replace( rtrim, "$1" );
8813 // Register as a named AMD module, since jQuery can be concatenated with other
8814 // files that may use define, but not via a proper concatenation script that
8815 // understands anonymous AMD modules. A named AMD is safest and most robust
8816 // way to register. Lowercase jquery is used because AMD module names are
8817 // derived from file names, and jQuery is normally delivered in a lowercase
8818 // file name. Do this after creating the global so that if an AMD module wants
8819 // to call noConflict to hide this version of jQuery, it will work.
8821 // Note that for maximum portability, libraries that are not jQuery should
8822 // declare themselves as anonymous modules, and avoid setting a global if an
8823 // AMD loader is present. jQuery is a special case. For more information, see
8824 // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
8826 if ( typeof define === "function" && define.amd ) {
8827 define( "jquery", [], function() {
8837 // Map over jQuery in case of overwrite
8838 _jQuery = window.jQuery,
8840 // Map over the $ in case of overwrite
8843 jQuery.noConflict = function( deep ) {
8844 if ( window.$ === jQuery ) {
8848 if ( deep && window.jQuery === jQuery ) {
8849 window.jQuery = _jQuery;
8855 // Expose jQuery and $ identifiers, even in AMD
8856 // (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557)
8857 // and CommonJS for browser emulators (trac-13566)
8858 if ( typeof noGlobal === "undefined" ) {
8859 window.jQuery = window.$ = jQuery;