changeset 21 | 48c4eec2b7e6 |
parent 18 | be944660c56a |
20:7b1b88e27a20 | 21:48c4eec2b7e6 |
---|---|
1 /*! |
1 /*! |
2 * jQuery JavaScript Library v3.6.0 |
2 * jQuery JavaScript Library v3.7.1 |
3 * https://jquery.com/ |
3 * https://jquery.com/ |
4 * |
|
5 * Includes Sizzle.js |
|
6 * https://sizzlejs.com/ |
|
7 * |
4 * |
8 * Copyright OpenJS Foundation and other contributors |
5 * Copyright OpenJS Foundation and other contributors |
9 * Released under the MIT license |
6 * Released under the MIT license |
10 * https://jquery.org/license |
7 * https://jquery.org/license |
11 * |
8 * |
12 * Date: 2021-03-02T17:08Z |
9 * Date: 2023-08-28T13:37Z |
13 */ |
10 */ |
14 ( function( global, factory ) { |
11 ( function( global, factory ) { |
15 |
12 |
16 "use strict"; |
13 "use strict"; |
17 |
14 |
21 // is present, execute the factory and get jQuery. |
18 // is present, execute the factory and get jQuery. |
22 // For environments that do not have a `window` with a `document` |
19 // For environments that do not have a `window` with a `document` |
23 // (such as Node.js), expose a factory as module.exports. |
20 // (such as Node.js), expose a factory as module.exports. |
24 // This accentuates the need for the creation of a real `window`. |
21 // This accentuates the need for the creation of a real `window`. |
25 // e.g. var jQuery = require("jquery")(window); |
22 // e.g. var jQuery = require("jquery")(window); |
26 // See ticket #14549 for more info. |
23 // See ticket trac-14549 for more info. |
27 module.exports = global.document ? |
24 module.exports = global.document ? |
28 factory( global, true ) : |
25 factory( global, true ) : |
29 function( w ) { |
26 function( w ) { |
30 if ( !w.document ) { |
27 if ( !w.document ) { |
31 throw new Error( "jQuery requires a window with a document" ); |
28 throw new Error( "jQuery requires a window with a document" ); |
148 // Defining this global in .eslintrc.json would create a danger of using the global |
145 // 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 |
146 // unguarded in another place, it seems safer to define global only for this module |
150 |
147 |
151 |
148 |
152 |
149 |
153 var |
150 var version = "3.7.1", |
154 version = "3.6.0", |
151 |
152 rhtmlSuffix = /HTML$/i, |
|
155 |
153 |
156 // Define a local copy of jQuery |
154 // Define a local copy of jQuery |
157 jQuery = function( selector, context ) { |
155 jQuery = function( selector, context ) { |
158 |
156 |
159 // The jQuery object is actually just the init constructor 'enhanced' |
157 // The jQuery object is actually just the init constructor 'enhanced' |
395 } |
393 } |
396 |
394 |
397 return obj; |
395 return obj; |
398 }, |
396 }, |
399 |
397 |
398 |
|
399 // Retrieve the text value of an array of DOM nodes |
|
400 text: function( elem ) { |
|
401 var node, |
|
402 ret = "", |
|
403 i = 0, |
|
404 nodeType = elem.nodeType; |
|
405 |
|
406 if ( !nodeType ) { |
|
407 |
|
408 // If no nodeType, this is expected to be an array |
|
409 while ( ( node = elem[ i++ ] ) ) { |
|
410 |
|
411 // Do not traverse comment nodes |
|
412 ret += jQuery.text( node ); |
|
413 } |
|
414 } |
|
415 if ( nodeType === 1 || nodeType === 11 ) { |
|
416 return elem.textContent; |
|
417 } |
|
418 if ( nodeType === 9 ) { |
|
419 return elem.documentElement.textContent; |
|
420 } |
|
421 if ( nodeType === 3 || nodeType === 4 ) { |
|
422 return elem.nodeValue; |
|
423 } |
|
424 |
|
425 // Do not include comment or processing instruction nodes |
|
426 |
|
427 return ret; |
|
428 }, |
|
429 |
|
400 // results is for internal usage only |
430 // results is for internal usage only |
401 makeArray: function( arr, results ) { |
431 makeArray: function( arr, results ) { |
402 var ret = results || []; |
432 var ret = results || []; |
403 |
433 |
404 if ( arr != null ) { |
434 if ( arr != null ) { |
417 |
447 |
418 inArray: function( elem, arr, i ) { |
448 inArray: function( elem, arr, i ) { |
419 return arr == null ? -1 : indexOf.call( arr, elem, i ); |
449 return arr == null ? -1 : indexOf.call( arr, elem, i ); |
420 }, |
450 }, |
421 |
451 |
452 isXMLDoc: function( elem ) { |
|
453 var namespace = elem && elem.namespaceURI, |
|
454 docElem = elem && ( elem.ownerDocument || elem ).documentElement; |
|
455 |
|
456 // Assume HTML when documentElement doesn't yet exist, such as inside |
|
457 // document fragments. |
|
458 return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" ); |
|
459 }, |
|
460 |
|
422 // Support: Android <=4.0 only, PhantomJS 1 only |
461 // Support: Android <=4.0 only, PhantomJS 1 only |
423 // push.apply(_, arraylike) throws on ancient WebKit |
462 // push.apply(_, arraylike) throws on ancient WebKit |
424 merge: function( first, second ) { |
463 merge: function( first, second ) { |
425 var len = +second.length, |
464 var len = +second.length, |
426 j = 0, |
465 j = 0, |
518 } |
557 } |
519 |
558 |
520 return type === "array" || length === 0 || |
559 return type === "array" || length === 0 || |
521 typeof length === "number" && length > 0 && ( length - 1 ) in obj; |
560 typeof length === "number" && length > 0 && ( length - 1 ) in obj; |
522 } |
561 } |
523 var Sizzle = |
562 |
524 /*! |
563 |
525 * Sizzle CSS Selector Engine v2.3.6 |
564 function nodeName( elem, name ) { |
526 * https://sizzlejs.com/ |
565 |
527 * |
566 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); |
528 * Copyright JS Foundation and other contributors |
567 |
529 * Released under the MIT license |
568 } |
530 * https://js.foundation/ |
569 var pop = arr.pop; |
531 * |
570 |
532 * Date: 2021-02-16 |
571 |
533 */ |
572 var sort = arr.sort; |
534 ( function( window ) { |
573 |
574 |
|
575 var splice = arr.splice; |
|
576 |
|
577 |
|
578 var whitespace = "[\\x20\\t\\r\\n\\f]"; |
|
579 |
|
580 |
|
581 var rtrimCSS = new RegExp( |
|
582 "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", |
|
583 "g" |
|
584 ); |
|
585 |
|
586 |
|
587 |
|
588 |
|
589 // Note: an element does not contain itself |
|
590 jQuery.contains = function( a, b ) { |
|
591 var bup = b && b.parentNode; |
|
592 |
|
593 return a === bup || !!( bup && bup.nodeType === 1 && ( |
|
594 |
|
595 // Support: IE 9 - 11+ |
|
596 // IE doesn't have `contains` on SVG. |
|
597 a.contains ? |
|
598 a.contains( bup ) : |
|
599 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 |
|
600 ) ); |
|
601 }; |
|
602 |
|
603 |
|
604 |
|
605 |
|
606 // CSS string/identifier serialization |
|
607 // https://drafts.csswg.org/cssom/#common-serializing-idioms |
|
608 var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; |
|
609 |
|
610 function fcssescape( ch, asCodePoint ) { |
|
611 if ( asCodePoint ) { |
|
612 |
|
613 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER |
|
614 if ( ch === "\0" ) { |
|
615 return "\uFFFD"; |
|
616 } |
|
617 |
|
618 // Control characters and (dependent upon position) numbers get escaped as code points |
|
619 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; |
|
620 } |
|
621 |
|
622 // Other potentially-special ASCII characters get backslash-escaped |
|
623 return "\\" + ch; |
|
624 } |
|
625 |
|
626 jQuery.escapeSelector = function( sel ) { |
|
627 return ( sel + "" ).replace( rcssescape, fcssescape ); |
|
628 }; |
|
629 |
|
630 |
|
631 |
|
632 |
|
633 var preferredDoc = document, |
|
634 pushNative = push; |
|
635 |
|
636 ( function() { |
|
637 |
|
535 var i, |
638 var i, |
536 support, |
|
537 Expr, |
639 Expr, |
538 getText, |
|
539 isXML, |
|
540 tokenize, |
|
541 compile, |
|
542 select, |
|
543 outermostContext, |
640 outermostContext, |
544 sortInput, |
641 sortInput, |
545 hasDuplicate, |
642 hasDuplicate, |
643 push = pushNative, |
|
546 |
644 |
547 // Local document vars |
645 // Local document vars |
548 setDocument, |
|
549 document, |
646 document, |
550 docElem, |
647 documentElement, |
551 documentIsHTML, |
648 documentIsHTML, |
552 rbuggyQSA, |
649 rbuggyQSA, |
553 rbuggyMatches, |
|
554 matches, |
650 matches, |
555 contains, |
|
556 |
651 |
557 // Instance-specific data |
652 // Instance-specific data |
558 expando = "sizzle" + 1 * new Date(), |
653 expando = jQuery.expando, |
559 preferredDoc = window.document, |
|
560 dirruns = 0, |
654 dirruns = 0, |
561 done = 0, |
655 done = 0, |
562 classCache = createCache(), |
656 classCache = createCache(), |
563 tokenCache = createCache(), |
657 tokenCache = createCache(), |
564 compilerCache = createCache(), |
658 compilerCache = createCache(), |
568 hasDuplicate = true; |
662 hasDuplicate = true; |
569 } |
663 } |
570 return 0; |
664 return 0; |
571 }, |
665 }, |
572 |
666 |
573 // Instance methods |
667 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" + |
574 hasOwn = ( {} ).hasOwnProperty, |
668 "loop|multiple|open|readonly|required|scoped", |
575 arr = [], |
|
576 pop = arr.pop, |
|
577 pushNative = arr.push, |
|
578 push = arr.push, |
|
579 slice = arr.slice, |
|
580 |
|
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 ) { |
|
584 var i = 0, |
|
585 len = list.length; |
|
586 for ( ; i < len; i++ ) { |
|
587 if ( list[ i ] === elem ) { |
|
588 return i; |
|
589 } |
|
590 } |
|
591 return -1; |
|
592 }, |
|
593 |
|
594 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" + |
|
595 "ismap|loop|multiple|open|readonly|required|scoped", |
|
596 |
669 |
597 // Regular expressions |
670 // Regular expressions |
598 |
|
599 // http://www.w3.org/TR/css3-selectors/#whitespace |
|
600 whitespace = "[\\x20\\t\\r\\n\\f]", |
|
601 |
671 |
602 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram |
672 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram |
603 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + |
673 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + |
604 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", |
674 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", |
605 |
675 |
606 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors |
676 // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors |
607 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + |
677 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + |
608 |
678 |
609 // Operator (capture 2) |
679 // Operator (capture 2) |
610 "*([*^$|!~]?=)" + whitespace + |
680 "*([*^$|!~]?=)" + whitespace + |
611 |
681 |
612 // "Attribute values must be CSS identifiers [capture 5] |
682 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" |
613 // or strings [capture 3 or capture 4]" |
|
614 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + |
683 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + |
615 whitespace + "*\\]", |
684 whitespace + "*\\]", |
616 |
685 |
617 pseudos = ":(" + identifier + ")(?:\\((" + |
686 pseudos = ":(" + identifier + ")(?:\\((" + |
618 |
687 |
627 ".*" + |
696 ".*" + |
628 ")\\)|)", |
697 ")\\)|)", |
629 |
698 |
630 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter |
699 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter |
631 rwhitespace = new RegExp( whitespace + "+", "g" ), |
700 rwhitespace = new RegExp( whitespace + "+", "g" ), |
632 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + |
|
633 whitespace + "+$", "g" ), |
|
634 |
701 |
635 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), |
702 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), |
636 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + |
703 rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + |
637 "*" ), |
704 whitespace + "*" ), |
638 rdescend = new RegExp( whitespace + "|>" ), |
705 rdescend = new RegExp( whitespace + "|>" ), |
639 |
706 |
640 rpseudo = new RegExp( pseudos ), |
707 rpseudo = new RegExp( pseudos ), |
641 ridentifier = new RegExp( "^" + identifier + "$" ), |
708 ridentifier = new RegExp( "^" + identifier + "$" ), |
642 |
709 |
643 matchExpr = { |
710 matchExpr = { |
644 "ID": new RegExp( "^#(" + identifier + ")" ), |
711 ID: new RegExp( "^#(" + identifier + ")" ), |
645 "CLASS": new RegExp( "^\\.(" + identifier + ")" ), |
712 CLASS: new RegExp( "^\\.(" + identifier + ")" ), |
646 "TAG": new RegExp( "^(" + identifier + "|[*])" ), |
713 TAG: new RegExp( "^(" + identifier + "|[*])" ), |
647 "ATTR": new RegExp( "^" + attributes ), |
714 ATTR: new RegExp( "^" + attributes ), |
648 "PSEUDO": new RegExp( "^" + pseudos ), |
715 PSEUDO: new RegExp( "^" + pseudos ), |
649 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + |
716 CHILD: new RegExp( |
650 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + |
717 "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + |
651 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), |
718 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + |
652 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), |
719 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), |
720 bool: new RegExp( "^(?:" + booleans + ")$", "i" ), |
|
653 |
721 |
654 // For use in libraries implementing .is() |
722 // For use in libraries implementing .is() |
655 // We use this for POS matching in `select` |
723 // We use this for POS matching in `select` |
656 "needsContext": new RegExp( "^" + whitespace + |
724 needsContext: new RegExp( "^" + whitespace + |
657 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + |
725 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + |
658 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) |
726 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) |
659 }, |
727 }, |
660 |
728 |
661 rhtml = /HTML$/i, |
|
662 rinputs = /^(?:input|select|textarea|button)$/i, |
729 rinputs = /^(?:input|select|textarea|button)$/i, |
663 rheader = /^h\d$/i, |
730 rheader = /^h\d$/i, |
664 |
731 |
665 rnative = /^[^{]+\{\s*\[native \w/, |
|
666 |
|
667 // Easily-parseable/retrievable ID or TAG or CLASS selectors |
732 // Easily-parseable/retrievable ID or TAG or CLASS selectors |
668 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, |
733 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, |
669 |
734 |
670 rsibling = /[+~]/, |
735 rsibling = /[+~]/, |
671 |
736 |
672 // CSS escapes |
737 // CSS escapes |
673 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters |
738 // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters |
674 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ), |
739 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + |
740 "?|\\\\([^\\r\\n\\f])", "g" ), |
|
675 funescape = function( escape, nonHex ) { |
741 funescape = function( escape, nonHex ) { |
676 var high = "0x" + escape.slice( 1 ) - 0x10000; |
742 var high = "0x" + escape.slice( 1 ) - 0x10000; |
677 |
743 |
678 return nonHex ? |
744 if ( nonHex ) { |
679 |
745 |
680 // Strip the backslash prefix from a non-hex escape sequence |
746 // Strip the backslash prefix from a non-hex escape sequence |
681 nonHex : |
747 return nonHex; |
682 |
748 } |
683 // Replace a hexadecimal escape sequence with the encoded Unicode code point |
749 |
684 // Support: IE <=11+ |
750 // Replace a hexadecimal escape sequence with the encoded Unicode code point |
685 // For values outside the Basic Multilingual Plane (BMP), manually construct a |
751 // Support: IE <=11+ |
686 // surrogate pair |
752 // For values outside the Basic Multilingual Plane (BMP), manually construct a |
687 high < 0 ? |
753 // surrogate pair |
688 String.fromCharCode( high + 0x10000 ) : |
754 return high < 0 ? |
689 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); |
755 String.fromCharCode( high + 0x10000 ) : |
690 }, |
756 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); |
691 |
757 }, |
692 // CSS string/identifier serialization |
758 |
693 // https://drafts.csswg.org/cssom/#common-serializing-idioms |
759 // Used for iframes; see `setDocument`. |
694 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, |
760 // Support: IE 9 - 11+, Edge 12 - 18+ |
695 fcssescape = function( ch, asCodePoint ) { |
|
696 if ( asCodePoint ) { |
|
697 |
|
698 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER |
|
699 if ( ch === "\0" ) { |
|
700 return "\uFFFD"; |
|
701 } |
|
702 |
|
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 ) + " "; |
|
706 } |
|
707 |
|
708 // Other potentially-special ASCII characters get backslash-escaped |
|
709 return "\\" + ch; |
|
710 }, |
|
711 |
|
712 // Used for iframes |
|
713 // See setDocument() |
|
714 // Removing the function wrapper causes a "Permission Denied" |
761 // Removing the function wrapper causes a "Permission Denied" |
715 // error in IE |
762 // error in IE/Edge. |
716 unloadHandler = function() { |
763 unloadHandler = function() { |
717 setDocument(); |
764 setDocument(); |
718 }, |
765 }, |
719 |
766 |
720 inDisabledFieldset = addCombinator( |
767 inDisabledFieldset = addCombinator( |
721 function( elem ) { |
768 function( elem ) { |
722 return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; |
769 return elem.disabled === true && nodeName( elem, "fieldset" ); |
723 }, |
770 }, |
724 { dir: "parentNode", next: "legend" } |
771 { dir: "parentNode", next: "legend" } |
725 ); |
772 ); |
773 |
|
774 // Support: IE <=9 only |
|
775 // Accessing document.activeElement can throw unexpectedly |
|
776 // https://bugs.jquery.com/ticket/13393 |
|
777 function safeActiveElement() { |
|
778 try { |
|
779 return document.activeElement; |
|
780 } catch ( err ) { } |
|
781 } |
|
726 |
782 |
727 // Optimize for push.apply( _, NodeList ) |
783 // Optimize for push.apply( _, NodeList ) |
728 try { |
784 try { |
729 push.apply( |
785 push.apply( |
730 ( arr = slice.call( preferredDoc.childNodes ) ), |
786 ( arr = slice.call( preferredDoc.childNodes ) ), |
731 preferredDoc.childNodes |
787 preferredDoc.childNodes |
732 ); |
788 ); |
733 |
789 |
734 // Support: Android<4.0 |
790 // Support: Android <=4.0 |
735 // Detect silently failing push.apply |
791 // Detect silently failing push.apply |
736 // eslint-disable-next-line no-unused-expressions |
792 // eslint-disable-next-line no-unused-expressions |
737 arr[ preferredDoc.childNodes.length ].nodeType; |
793 arr[ preferredDoc.childNodes.length ].nodeType; |
738 } catch ( e ) { |
794 } catch ( e ) { |
739 push = { apply: arr.length ? |
795 push = { |
740 |
796 apply: function( target, els ) { |
741 // Leverage slice if possible |
|
742 function( target, els ) { |
|
743 pushNative.apply( target, slice.call( els ) ); |
797 pushNative.apply( target, slice.call( els ) ); |
744 } : |
798 }, |
745 |
799 call: function( target ) { |
746 // Support: IE<9 |
800 pushNative.apply( target, slice.call( arguments, 1 ) ); |
747 // Otherwise append directly |
|
748 function( target, els ) { |
|
749 var j = target.length, |
|
750 i = 0; |
|
751 |
|
752 // Can't trust NodeList.length |
|
753 while ( ( target[ j++ ] = els[ i++ ] ) ) {} |
|
754 target.length = j - 1; |
|
755 } |
801 } |
756 }; |
802 }; |
757 } |
803 } |
758 |
804 |
759 function Sizzle( selector, context, results, seed ) { |
805 function find( selector, context, results, seed ) { |
760 var m, i, elem, nid, match, groups, newSelector, |
806 var m, i, elem, nid, match, groups, newSelector, |
761 newContext = context && context.ownerDocument, |
807 newContext = context && context.ownerDocument, |
762 |
808 |
763 // nodeType defaults to 9, since context defaults to document |
809 // nodeType defaults to 9, since context defaults to document |
764 nodeType = context ? context.nodeType : 9; |
810 nodeType = context ? context.nodeType : 9; |
788 |
834 |
789 // Document context |
835 // Document context |
790 if ( nodeType === 9 ) { |
836 if ( nodeType === 9 ) { |
791 if ( ( elem = context.getElementById( m ) ) ) { |
837 if ( ( elem = context.getElementById( m ) ) ) { |
792 |
838 |
793 // Support: IE, Opera, Webkit |
839 // Support: IE 9 only |
794 // TODO: identify versions |
|
795 // getElementById can match elements by name instead of ID |
840 // getElementById can match elements by name instead of ID |
796 if ( elem.id === m ) { |
841 if ( elem.id === m ) { |
797 results.push( elem ); |
842 push.call( results, elem ); |
798 return results; |
843 return results; |
799 } |
844 } |
800 } else { |
845 } else { |
801 return results; |
846 return results; |
802 } |
847 } |
803 |
848 |
804 // Element context |
849 // Element context |
805 } else { |
850 } else { |
806 |
851 |
807 // Support: IE, Opera, Webkit |
852 // Support: IE 9 only |
808 // TODO: identify versions |
|
809 // getElementById can match elements by name instead of ID |
853 // getElementById can match elements by name instead of ID |
810 if ( newContext && ( elem = newContext.getElementById( m ) ) && |
854 if ( newContext && ( elem = newContext.getElementById( m ) ) && |
811 contains( context, elem ) && |
855 find.contains( context, elem ) && |
812 elem.id === m ) { |
856 elem.id === m ) { |
813 |
857 |
814 results.push( elem ); |
858 push.call( results, elem ); |
815 return results; |
859 return results; |
816 } |
860 } |
817 } |
861 } |
818 |
862 |
819 // Type selector |
863 // Type selector |
820 } else if ( match[ 2 ] ) { |
864 } else if ( match[ 2 ] ) { |
821 push.apply( results, context.getElementsByTagName( selector ) ); |
865 push.apply( results, context.getElementsByTagName( selector ) ); |
822 return results; |
866 return results; |
823 |
867 |
824 // Class selector |
868 // Class selector |
825 } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName && |
869 } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) { |
826 context.getElementsByClassName ) { |
|
827 |
|
828 push.apply( results, context.getElementsByClassName( m ) ); |
870 push.apply( results, context.getElementsByClassName( m ) ); |
829 return results; |
871 return results; |
830 } |
872 } |
831 } |
873 } |
832 |
874 |
833 // Take advantage of querySelectorAll |
875 // Take advantage of querySelectorAll |
834 if ( support.qsa && |
876 if ( !nonnativeSelectorCache[ selector + " " ] && |
835 !nonnativeSelectorCache[ selector + " " ] && |
877 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) { |
836 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) && |
|
837 |
|
838 // Support: IE 8 only |
|
839 // Exclude object elements |
|
840 ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) { |
|
841 |
878 |
842 newSelector = selector; |
879 newSelector = selector; |
843 newContext = context; |
880 newContext = context; |
844 |
881 |
845 // qSA considers elements outside a scoping root when evaluating child or |
882 // qSA considers elements outside a scoping root when evaluating child or |
848 // list with an ID selector referencing the scope context. |
885 // list with an ID selector referencing the scope context. |
849 // The technique has to be used as well when a leading combinator is used |
886 // The technique has to be used as well when a leading combinator is used |
850 // as such selectors are not recognized by querySelectorAll. |
887 // as such selectors are not recognized by querySelectorAll. |
851 // Thanks to Andrew Dupont for this technique. |
888 // Thanks to Andrew Dupont for this technique. |
852 if ( nodeType === 1 && |
889 if ( nodeType === 1 && |
853 ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) { |
890 ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) { |
854 |
891 |
855 // Expand context for sibling selectors |
892 // Expand context for sibling selectors |
856 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || |
893 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || |
857 context; |
894 context; |
858 |
895 |
859 // We can use :scope instead of the ID hack if the browser |
896 // We can use :scope instead of the ID hack if the browser |
860 // supports it & if we're not changing the context. |
897 // supports it & if we're not changing the context. |
861 if ( newContext !== context || !support.scope ) { |
898 // Support: IE 11+, Edge 17 - 18+ |
899 // IE/Edge sometimes throw a "Permission denied" error when |
|
900 // strict-comparing two documents; shallow comparisons work. |
|
901 // eslint-disable-next-line eqeqeq |
|
902 if ( newContext != context || !support.scope ) { |
|
862 |
903 |
863 // Capture the context ID, setting it first if necessary |
904 // Capture the context ID, setting it first if necessary |
864 if ( ( nid = context.getAttribute( "id" ) ) ) { |
905 if ( ( nid = context.getAttribute( "id" ) ) ) { |
865 nid = nid.replace( rcssescape, fcssescape ); |
906 nid = jQuery.escapeSelector( nid ); |
866 } else { |
907 } else { |
867 context.setAttribute( "id", ( nid = expando ) ); |
908 context.setAttribute( "id", ( nid = expando ) ); |
868 } |
909 } |
869 } |
910 } |
870 |
911 |
893 } |
934 } |
894 } |
935 } |
895 } |
936 } |
896 |
937 |
897 // All others |
938 // All others |
898 return select( selector.replace( rtrim, "$1" ), context, results, seed ); |
939 return select( selector.replace( rtrimCSS, "$1" ), context, results, seed ); |
899 } |
940 } |
900 |
941 |
901 /** |
942 /** |
902 * Create key-value caches of limited size |
943 * Create key-value caches of limited size |
903 * @returns {function(string, object)} Returns the Object data after storing it on itself with |
944 * @returns {function(string, object)} Returns the Object data after storing it on itself with |
907 function createCache() { |
948 function createCache() { |
908 var keys = []; |
949 var keys = []; |
909 |
950 |
910 function cache( key, value ) { |
951 function cache( key, value ) { |
911 |
952 |
912 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) |
953 // Use (key + " ") to avoid collision with native prototype properties |
954 // (see https://github.com/jquery/sizzle/issues/157) |
|
913 if ( keys.push( key + " " ) > Expr.cacheLength ) { |
955 if ( keys.push( key + " " ) > Expr.cacheLength ) { |
914 |
956 |
915 // Only keep the most recent entries |
957 // Only keep the most recent entries |
916 delete cache[ keys.shift() ]; |
958 delete cache[ keys.shift() ]; |
917 } |
959 } |
919 } |
961 } |
920 return cache; |
962 return cache; |
921 } |
963 } |
922 |
964 |
923 /** |
965 /** |
924 * Mark a function for special use by Sizzle |
966 * Mark a function for special use by jQuery selector module |
925 * @param {Function} fn The function to mark |
967 * @param {Function} fn The function to mark |
926 */ |
968 */ |
927 function markFunction( fn ) { |
969 function markFunction( fn ) { |
928 fn[ expando ] = true; |
970 fn[ expando ] = true; |
929 return fn; |
971 return fn; |
951 el = null; |
993 el = null; |
952 } |
994 } |
953 } |
995 } |
954 |
996 |
955 /** |
997 /** |
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 |
|
959 */ |
|
960 function addHandle( attrs, handler ) { |
|
961 var arr = attrs.split( "|" ), |
|
962 i = arr.length; |
|
963 |
|
964 while ( i-- ) { |
|
965 Expr.attrHandle[ arr[ i ] ] = handler; |
|
966 } |
|
967 } |
|
968 |
|
969 /** |
|
970 * Checks document order of two siblings |
|
971 * @param {Element} a |
|
972 * @param {Element} b |
|
973 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b |
|
974 */ |
|
975 function siblingCheck( a, b ) { |
|
976 var cur = b && a, |
|
977 diff = cur && a.nodeType === 1 && b.nodeType === 1 && |
|
978 a.sourceIndex - b.sourceIndex; |
|
979 |
|
980 // Use IE sourceIndex if available on both nodes |
|
981 if ( diff ) { |
|
982 return diff; |
|
983 } |
|
984 |
|
985 // Check if b follows a |
|
986 if ( cur ) { |
|
987 while ( ( cur = cur.nextSibling ) ) { |
|
988 if ( cur === b ) { |
|
989 return -1; |
|
990 } |
|
991 } |
|
992 } |
|
993 |
|
994 return a ? 1 : -1; |
|
995 } |
|
996 |
|
997 /** |
|
998 * Returns a function to use in pseudos for input types |
998 * Returns a function to use in pseudos for input types |
999 * @param {String} type |
999 * @param {String} type |
1000 */ |
1000 */ |
1001 function createInputPseudo( type ) { |
1001 function createInputPseudo( type ) { |
1002 return function( elem ) { |
1002 return function( elem ) { |
1003 var name = elem.nodeName.toLowerCase(); |
1003 return nodeName( elem, "input" ) && elem.type === type; |
1004 return name === "input" && elem.type === type; |
|
1005 }; |
1004 }; |
1006 } |
1005 } |
1007 |
1006 |
1008 /** |
1007 /** |
1009 * Returns a function to use in pseudos for buttons |
1008 * Returns a function to use in pseudos for buttons |
1010 * @param {String} type |
1009 * @param {String} type |
1011 */ |
1010 */ |
1012 function createButtonPseudo( type ) { |
1011 function createButtonPseudo( type ) { |
1013 return function( elem ) { |
1012 return function( elem ) { |
1014 var name = elem.nodeName.toLowerCase(); |
1013 return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) && |
1015 return ( name === "input" || name === "button" ) && elem.type === type; |
1014 elem.type === type; |
1016 }; |
1015 }; |
1017 } |
1016 } |
1018 |
1017 |
1019 /** |
1018 /** |
1020 * Returns a function to use in pseudos for :enabled/:disabled |
1019 * Returns a function to use in pseudos for :enabled/:disabled |
1046 } else { |
1045 } else { |
1047 return elem.disabled === disabled; |
1046 return elem.disabled === disabled; |
1048 } |
1047 } |
1049 } |
1048 } |
1050 |
1049 |
1051 // Support: IE 6 - 11 |
1050 // Support: IE 6 - 11+ |
1052 // Use the isDisabled shortcut property to check for disabled fieldset ancestors |
1051 // Use the isDisabled shortcut property to check for disabled fieldset ancestors |
1053 return elem.isDisabled === disabled || |
1052 return elem.isDisabled === disabled || |
1054 |
1053 |
1055 // Where there is no isDisabled, check manually |
1054 // Where there is no isDisabled, check manually |
1056 /* jshint -W018 */ |
|
1057 elem.isDisabled !== !disabled && |
1055 elem.isDisabled !== !disabled && |
1058 inDisabledFieldset( elem ) === disabled; |
1056 inDisabledFieldset( elem ) === disabled; |
1059 } |
1057 } |
1060 |
1058 |
1061 return elem.disabled === disabled; |
1059 return elem.disabled === disabled; |
1062 |
1060 |
1063 // Try to winnow out elements that can't be disabled before trusting the disabled property. |
1061 // Try to winnow out elements that can't be disabled before trusting the disabled property. |
1093 } ); |
1091 } ); |
1094 } ); |
1092 } ); |
1095 } |
1093 } |
1096 |
1094 |
1097 /** |
1095 /** |
1098 * Checks a node for validity as a Sizzle context |
1096 * Checks a node for validity as a jQuery selector context |
1099 * @param {Element|Object=} context |
1097 * @param {Element|Object=} context |
1100 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value |
1098 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value |
1101 */ |
1099 */ |
1102 function testContext( context ) { |
1100 function testContext( context ) { |
1103 return context && typeof context.getElementsByTagName !== "undefined" && context; |
1101 return context && typeof context.getElementsByTagName !== "undefined" && context; |
1104 } |
1102 } |
1105 |
1103 |
1106 // Expose support vars for convenience |
|
1107 support = Sizzle.support = {}; |
|
1108 |
|
1109 /** |
|
1110 * Detects XML nodes |
|
1111 * @param {Element|Object} elem An element or a document |
|
1112 * @returns {Boolean} True iff elem is a non-HTML XML node |
|
1113 */ |
|
1114 isXML = Sizzle.isXML = function( elem ) { |
|
1115 var namespace = elem && elem.namespaceURI, |
|
1116 docElem = elem && ( elem.ownerDocument || elem ).documentElement; |
|
1117 |
|
1118 // Support: IE <=8 |
|
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" ); |
|
1122 }; |
|
1123 |
|
1124 /** |
1104 /** |
1125 * Sets document-related variables once based on the current document |
1105 * 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 |
1106 * @param {Element|Object} [node] An element or document object to use to set the document |
1127 * @returns {Object} Returns the current document |
1107 * @returns {Object} Returns the current document |
1128 */ |
1108 */ |
1129 setDocument = Sizzle.setDocument = function( node ) { |
1109 function setDocument( node ) { |
1130 var hasCompare, subWindow, |
1110 var subWindow, |
1131 doc = node ? node.ownerDocument || node : preferredDoc; |
1111 doc = node ? node.ownerDocument || node : preferredDoc; |
1132 |
1112 |
1133 // Return early if doc is invalid or already selected |
1113 // Return early if doc is invalid or already selected |
1134 // Support: IE 11+, Edge 17 - 18+ |
1114 // Support: IE 11+, Edge 17 - 18+ |
1135 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1115 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1139 return document; |
1119 return document; |
1140 } |
1120 } |
1141 |
1121 |
1142 // Update global variables |
1122 // Update global variables |
1143 document = doc; |
1123 document = doc; |
1144 docElem = document.documentElement; |
1124 documentElement = document.documentElement; |
1145 documentIsHTML = !isXML( document ); |
1125 documentIsHTML = !jQuery.isXMLDoc( document ); |
1126 |
|
1127 // Support: iOS 7 only, IE 9 - 11+ |
|
1128 // Older browsers didn't support unprefixed `matches`. |
|
1129 matches = documentElement.matches || |
|
1130 documentElement.webkitMatchesSelector || |
|
1131 documentElement.msMatchesSelector; |
|
1146 |
1132 |
1147 // Support: IE 9 - 11+, Edge 12 - 18+ |
1133 // Support: IE 9 - 11+, Edge 12 - 18+ |
1148 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) |
1134 // Accessing iframe documents after unload throws "permission denied" errors |
1149 // Support: IE 11+, Edge 17 - 18+ |
1135 // (see trac-13936). |
1150 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1136 // Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`, |
1151 // two documents; shallow comparisons work. |
1137 // all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well. |
1152 // eslint-disable-next-line eqeqeq |
1138 if ( documentElement.msMatchesSelector && |
1153 if ( preferredDoc != document && |
1139 |
1140 // Support: IE 11+, Edge 17 - 18+ |
|
1141 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
|
1142 // two documents; shallow comparisons work. |
|
1143 // eslint-disable-next-line eqeqeq |
|
1144 preferredDoc != document && |
|
1154 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { |
1145 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { |
1155 |
1146 |
1156 // Support: IE 11, Edge |
1147 // Support: IE 9 - 11+, Edge 12 - 18+ |
1157 if ( subWindow.addEventListener ) { |
1148 subWindow.addEventListener( "unload", unloadHandler ); |
1158 subWindow.addEventListener( "unload", unloadHandler, false ); |
1149 } |
1159 |
1150 |
1160 // Support: IE 9 - 10 only |
1151 // Support: IE <10 |
1161 } else if ( subWindow.attachEvent ) { |
|
1162 subWindow.attachEvent( "onunload", unloadHandler ); |
|
1163 } |
|
1164 } |
|
1165 |
|
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; |
|
1175 } ); |
|
1176 |
|
1177 /* Attributes |
|
1178 ---------------------------------------------------------------------- */ |
|
1179 |
|
1180 // Support: IE<8 |
|
1181 // Verify that getAttribute really returns attributes and not properties |
|
1182 // (excepting IE8 booleans) |
|
1183 support.attributes = assert( function( el ) { |
|
1184 el.className = "i"; |
|
1185 return !el.getAttribute( "className" ); |
|
1186 } ); |
|
1187 |
|
1188 /* getElement(s)By* |
|
1189 ---------------------------------------------------------------------- */ |
|
1190 |
|
1191 // Check if getElementsByTagName("*") returns only elements |
|
1192 support.getElementsByTagName = assert( function( el ) { |
|
1193 el.appendChild( document.createComment( "" ) ); |
|
1194 return !el.getElementsByTagName( "*" ).length; |
|
1195 } ); |
|
1196 |
|
1197 // Support: IE<9 |
|
1198 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); |
|
1199 |
|
1200 // Support: IE<10 |
|
1201 // Check if getElementById returns elements by name |
1152 // Check if getElementById returns elements by name |
1202 // The broken getElementById methods don't pick up programmatically-set names, |
1153 // The broken getElementById methods don't pick up programmatically-set names, |
1203 // so use a roundabout getElementsByName test |
1154 // so use a roundabout getElementsByName test |
1204 support.getById = assert( function( el ) { |
1155 support.getById = assert( function( el ) { |
1205 docElem.appendChild( el ).id = expando; |
1156 documentElement.appendChild( el ).id = jQuery.expando; |
1206 return !document.getElementsByName || !document.getElementsByName( expando ).length; |
1157 return !document.getElementsByName || |
1158 !document.getElementsByName( jQuery.expando ).length; |
|
1159 } ); |
|
1160 |
|
1161 // Support: IE 9 only |
|
1162 // Check to see if it's possible to do matchesSelector |
|
1163 // on a disconnected node. |
|
1164 support.disconnectedMatch = assert( function( el ) { |
|
1165 return matches.call( el, "*" ); |
|
1166 } ); |
|
1167 |
|
1168 // Support: IE 9 - 11+, Edge 12 - 18+ |
|
1169 // IE/Edge don't support the :scope pseudo-class. |
|
1170 support.scope = assert( function() { |
|
1171 return document.querySelectorAll( ":scope" ); |
|
1172 } ); |
|
1173 |
|
1174 // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only |
|
1175 // Make sure the `:has()` argument is parsed unforgivingly. |
|
1176 // We include `*` in the test to detect buggy implementations that are |
|
1177 // _selectively_ forgiving (specifically when the list includes at least |
|
1178 // one valid selector). |
|
1179 // Note that we treat complete lack of support for `:has()` as if it were |
|
1180 // spec-compliant support, which is fine because use of `:has()` in such |
|
1181 // environments will fail in the qSA path and fall back to jQuery traversal |
|
1182 // anyway. |
|
1183 support.cssHas = assert( function() { |
|
1184 try { |
|
1185 document.querySelector( ":has(*,:jqfake)" ); |
|
1186 return false; |
|
1187 } catch ( e ) { |
|
1188 return true; |
|
1189 } |
|
1207 } ); |
1190 } ); |
1208 |
1191 |
1209 // ID filter and find |
1192 // ID filter and find |
1210 if ( support.getById ) { |
1193 if ( support.getById ) { |
1211 Expr.filter[ "ID" ] = function( id ) { |
1194 Expr.filter.ID = function( id ) { |
1212 var attrId = id.replace( runescape, funescape ); |
1195 var attrId = id.replace( runescape, funescape ); |
1213 return function( elem ) { |
1196 return function( elem ) { |
1214 return elem.getAttribute( "id" ) === attrId; |
1197 return elem.getAttribute( "id" ) === attrId; |
1215 }; |
1198 }; |
1216 }; |
1199 }; |
1217 Expr.find[ "ID" ] = function( id, context ) { |
1200 Expr.find.ID = function( id, context ) { |
1218 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { |
1201 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { |
1219 var elem = context.getElementById( id ); |
1202 var elem = context.getElementById( id ); |
1220 return elem ? [ elem ] : []; |
1203 return elem ? [ elem ] : []; |
1221 } |
1204 } |
1222 }; |
1205 }; |
1223 } else { |
1206 } else { |
1224 Expr.filter[ "ID" ] = function( id ) { |
1207 Expr.filter.ID = function( id ) { |
1225 var attrId = id.replace( runescape, funescape ); |
1208 var attrId = id.replace( runescape, funescape ); |
1226 return function( elem ) { |
1209 return function( elem ) { |
1227 var node = typeof elem.getAttributeNode !== "undefined" && |
1210 var node = typeof elem.getAttributeNode !== "undefined" && |
1228 elem.getAttributeNode( "id" ); |
1211 elem.getAttributeNode( "id" ); |
1229 return node && node.value === attrId; |
1212 return node && node.value === attrId; |
1230 }; |
1213 }; |
1231 }; |
1214 }; |
1232 |
1215 |
1233 // Support: IE 6 - 7 only |
1216 // Support: IE 6 - 7 only |
1234 // getElementById is not reliable as a find shortcut |
1217 // getElementById is not reliable as a find shortcut |
1235 Expr.find[ "ID" ] = function( id, context ) { |
1218 Expr.find.ID = function( id, context ) { |
1236 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { |
1219 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { |
1237 var node, i, elems, |
1220 var node, i, elems, |
1238 elem = context.getElementById( id ); |
1221 elem = context.getElementById( id ); |
1239 |
1222 |
1240 if ( elem ) { |
1223 if ( elem ) { |
1260 } |
1243 } |
1261 }; |
1244 }; |
1262 } |
1245 } |
1263 |
1246 |
1264 // Tag |
1247 // Tag |
1265 Expr.find[ "TAG" ] = support.getElementsByTagName ? |
1248 Expr.find.TAG = function( tag, context ) { |
1266 function( tag, context ) { |
1249 if ( typeof context.getElementsByTagName !== "undefined" ) { |
1267 if ( typeof context.getElementsByTagName !== "undefined" ) { |
1250 return context.getElementsByTagName( tag ); |
1268 return context.getElementsByTagName( tag ); |
1251 |
1269 |
1252 // DocumentFragment nodes don't have gEBTN |
1270 // DocumentFragment nodes don't have gEBTN |
1253 } else { |
1271 } else if ( support.qsa ) { |
1254 return context.querySelectorAll( tag ); |
1272 return context.querySelectorAll( tag ); |
1255 } |
1273 } |
1256 }; |
1274 } : |
|
1275 |
|
1276 function( tag, context ) { |
|
1277 var elem, |
|
1278 tmp = [], |
|
1279 i = 0, |
|
1280 |
|
1281 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too |
|
1282 results = context.getElementsByTagName( tag ); |
|
1283 |
|
1284 // Filter out possible comments |
|
1285 if ( tag === "*" ) { |
|
1286 while ( ( elem = results[ i++ ] ) ) { |
|
1287 if ( elem.nodeType === 1 ) { |
|
1288 tmp.push( elem ); |
|
1289 } |
|
1290 } |
|
1291 |
|
1292 return tmp; |
|
1293 } |
|
1294 return results; |
|
1295 }; |
|
1296 |
1257 |
1297 // Class |
1258 // Class |
1298 Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) { |
1259 Expr.find.CLASS = function( className, context ) { |
1299 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { |
1260 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { |
1300 return context.getElementsByClassName( className ); |
1261 return context.getElementsByClassName( className ); |
1301 } |
1262 } |
1302 }; |
1263 }; |
1303 |
1264 |
1304 /* QSA/matchesSelector |
1265 /* QSA/matchesSelector |
1305 ---------------------------------------------------------------------- */ |
1266 ---------------------------------------------------------------------- */ |
1306 |
1267 |
1307 // QSA and matchesSelector support |
1268 // QSA and matchesSelector support |
1308 |
1269 |
1309 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) |
|
1310 rbuggyMatches = []; |
|
1311 |
|
1312 // qSa(:focus) reports false when true (Chrome 21) |
|
1313 // We allow this because of a bug in IE8/9 that throws an error |
|
1314 // whenever `document.activeElement` is accessed on an iframe |
|
1315 // So, we allow :focus to pass through QSA all the time to avoid the IE error |
|
1316 // See https://bugs.jquery.com/ticket/13378 |
|
1317 rbuggyQSA = []; |
1270 rbuggyQSA = []; |
1318 |
1271 |
1319 if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) { |
1272 // Build QSA regex |
1320 |
1273 // Regex strategy adopted from Diego Perini |
1321 // Build QSA regex |
1274 assert( function( el ) { |
1322 // Regex strategy adopted from Diego Perini |
1275 |
1323 assert( function( el ) { |
1276 var input; |
1324 |
1277 |
1325 var input; |
1278 documentElement.appendChild( el ).innerHTML = |
1326 |
1279 "<a id='" + expando + "' href='' disabled='disabled'></a>" + |
1327 // Select is set to empty string on purpose |
1280 "<select id='" + expando + "-\r\\' disabled='disabled'>" + |
1328 // This is to test IE's treatment of not explicitly |
1281 "<option selected=''></option></select>"; |
1329 // setting a boolean content attribute, |
1282 |
1330 // since its presence should be enough |
1283 // Support: iOS <=7 - 8 only |
1331 // https://bugs.jquery.com/ticket/12359 |
1284 // Boolean attributes and "value" are not treated correctly in some XML documents |
1332 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + |
1285 if ( !el.querySelectorAll( "[selected]" ).length ) { |
1333 "<select id='" + expando + "-\r\\' msallowcapture=''>" + |
1286 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); |
1334 "<option selected=''></option></select>"; |
1287 } |
1335 |
1288 |
1336 // Support: IE8, Opera 11-12.16 |
1289 // Support: iOS <=7 - 8 only |
1337 // Nothing should be selected when empty strings follow ^= or $= or *= |
1290 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { |
1338 // The test attribute must be unknown in Opera but "safe" for WinRT |
1291 rbuggyQSA.push( "~=" ); |
1339 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section |
1292 } |
1340 if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) { |
1293 |
1341 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); |
1294 // Support: iOS 8 only |
1342 } |
1295 // https://bugs.webkit.org/show_bug.cgi?id=136851 |
1343 |
1296 // In-page `selector#id sibling-combinator selector` fails |
1344 // Support: IE8 |
1297 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { |
1345 // Boolean attributes and "value" are not treated correctly |
1298 rbuggyQSA.push( ".#.+[+~]" ); |
1346 if ( !el.querySelectorAll( "[selected]" ).length ) { |
1299 } |
1347 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); |
1300 |
1348 } |
1301 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ |
1349 |
1302 // In some of the document kinds, these selectors wouldn't work natively. |
1350 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ |
1303 // This is probably OK but for backwards compatibility we want to maintain |
1351 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { |
1304 // handling them through jQuery traversal in jQuery 3.x. |
1352 rbuggyQSA.push( "~=" ); |
1305 if ( !el.querySelectorAll( ":checked" ).length ) { |
1353 } |
1306 rbuggyQSA.push( ":checked" ); |
1354 |
1307 } |
1355 // Support: IE 11+, Edge 15 - 18+ |
1308 |
1356 // IE 11/Edge don't find elements on a `[name='']` query in some cases. |
1309 // Support: Windows 8 Native Apps |
1357 // Adding a temporary attribute to the document before the selection works |
1310 // The type and name attributes are restricted during .innerHTML assignment |
1358 // around the issue. |
1311 input = document.createElement( "input" ); |
1359 // Interestingly, IE 10 & older don't seem to have the issue. |
1312 input.setAttribute( "type", "hidden" ); |
1360 input = document.createElement( "input" ); |
1313 el.appendChild( input ).setAttribute( "name", "D" ); |
1361 input.setAttribute( "name", "" ); |
1314 |
1362 el.appendChild( input ); |
1315 // Support: IE 9 - 11+ |
1363 if ( !el.querySelectorAll( "[name='']" ).length ) { |
1316 // IE's :disabled selector does not pick up the children of disabled fieldsets |
1364 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + |
1317 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ |
1365 whitespace + "*(?:''|\"\")" ); |
1318 // In some of the document kinds, these selectors wouldn't work natively. |
1366 } |
1319 // This is probably OK but for backwards compatibility we want to maintain |
1367 |
1320 // handling them through jQuery traversal in jQuery 3.x. |
1368 // Webkit/Opera - :checked should return selected option elements |
1321 documentElement.appendChild( el ).disabled = true; |
1369 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
1322 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { |
1370 // IE8 throws error here and will not see later tests |
1323 rbuggyQSA.push( ":enabled", ":disabled" ); |
1371 if ( !el.querySelectorAll( ":checked" ).length ) { |
1324 } |
1372 rbuggyQSA.push( ":checked" ); |
1325 |
1373 } |
1326 // Support: IE 11+, Edge 15 - 18+ |
1374 |
1327 // IE 11/Edge don't find elements on a `[name='']` query in some cases. |
1375 // Support: Safari 8+, iOS 8+ |
1328 // Adding a temporary attribute to the document before the selection works |
1376 // https://bugs.webkit.org/show_bug.cgi?id=136851 |
1329 // around the issue. |
1377 // In-page `selector#id sibling-combinator selector` fails |
1330 // Interestingly, IE 10 & older don't seem to have the issue. |
1378 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { |
1331 input = document.createElement( "input" ); |
1379 rbuggyQSA.push( ".#.+[+~]" ); |
1332 input.setAttribute( "name", "" ); |
1380 } |
1333 el.appendChild( input ); |
1381 |
1334 if ( !el.querySelectorAll( "[name='']" ).length ) { |
1382 // Support: Firefox <=3.6 - 5 only |
1335 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + |
1383 // Old Firefox doesn't throw on a badly-escaped identifier. |
1336 whitespace + "*(?:''|\"\")" ); |
1384 el.querySelectorAll( "\\\f" ); |
1337 } |
1385 rbuggyQSA.push( "[\\r\\n\\f]" ); |
1338 } ); |
1386 } ); |
1339 |
1387 |
1340 if ( !support.cssHas ) { |
1388 assert( function( el ) { |
1341 |
1389 el.innerHTML = "<a href='' disabled='disabled'></a>" + |
1342 // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ |
1390 "<select disabled='disabled'><option/></select>"; |
1343 // Our regular `try-catch` mechanism fails to detect natively-unsupported |
1391 |
1344 // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`) |
1392 // Support: Windows 8 Native Apps |
1345 // in browsers that parse the `:has()` argument as a forgiving selector list. |
1393 // The type and name attributes are restricted during .innerHTML assignment |
1346 // https://drafts.csswg.org/selectors/#relational now requires the argument |
1394 var input = document.createElement( "input" ); |
1347 // to be parsed unforgivingly, but browsers have not yet fully adjusted. |
1395 input.setAttribute( "type", "hidden" ); |
1348 rbuggyQSA.push( ":has" ); |
1396 el.appendChild( input ).setAttribute( "name", "D" ); |
|
1397 |
|
1398 // Support: IE8 |
|
1399 // Enforce case-sensitivity of name attribute |
|
1400 if ( el.querySelectorAll( "[name=d]" ).length ) { |
|
1401 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); |
|
1402 } |
|
1403 |
|
1404 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) |
|
1405 // IE8 throws error here and will not see later tests |
|
1406 if ( el.querySelectorAll( ":enabled" ).length !== 2 ) { |
|
1407 rbuggyQSA.push( ":enabled", ":disabled" ); |
|
1408 } |
|
1409 |
|
1410 // Support: IE9-11+ |
|
1411 // IE's :disabled selector does not pick up the children of disabled fieldsets |
|
1412 docElem.appendChild( el ).disabled = true; |
|
1413 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { |
|
1414 rbuggyQSA.push( ":enabled", ":disabled" ); |
|
1415 } |
|
1416 |
|
1417 // Support: Opera 10 - 11 only |
|
1418 // Opera 10-11 does not throw on post-comma invalid pseudos |
|
1419 el.querySelectorAll( "*,:x" ); |
|
1420 rbuggyQSA.push( ",.*:" ); |
|
1421 } ); |
|
1422 } |
|
1423 |
|
1424 if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches || |
|
1425 docElem.webkitMatchesSelector || |
|
1426 docElem.mozMatchesSelector || |
|
1427 docElem.oMatchesSelector || |
|
1428 docElem.msMatchesSelector ) ) ) ) { |
|
1429 |
|
1430 assert( function( el ) { |
|
1431 |
|
1432 // Check to see if it's possible to do matchesSelector |
|
1433 // on a disconnected node (IE 9) |
|
1434 support.disconnectedMatch = matches.call( el, "*" ); |
|
1435 |
|
1436 // This should fail with an exception |
|
1437 // Gecko does not error, returns false instead |
|
1438 matches.call( el, "[s!='']:x" ); |
|
1439 rbuggyMatches.push( "!=", pseudos ); |
|
1440 } ); |
|
1441 } |
1349 } |
1442 |
1350 |
1443 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); |
1351 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); |
1444 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) ); |
|
1445 |
|
1446 /* Contains |
|
1447 ---------------------------------------------------------------------- */ |
|
1448 hasCompare = rnative.test( docElem.compareDocumentPosition ); |
|
1449 |
|
1450 // Element contains another |
|
1451 // Purposefully self-exclusive |
|
1452 // As in, an element does not contain itself |
|
1453 contains = hasCompare || rnative.test( docElem.contains ) ? |
|
1454 function( a, b ) { |
|
1455 var adown = a.nodeType === 9 ? a.documentElement : a, |
|
1456 bup = b && b.parentNode; |
|
1457 return a === bup || !!( bup && bup.nodeType === 1 && ( |
|
1458 adown.contains ? |
|
1459 adown.contains( bup ) : |
|
1460 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 |
|
1461 ) ); |
|
1462 } : |
|
1463 function( a, b ) { |
|
1464 if ( b ) { |
|
1465 while ( ( b = b.parentNode ) ) { |
|
1466 if ( b === a ) { |
|
1467 return true; |
|
1468 } |
|
1469 } |
|
1470 } |
|
1471 return false; |
|
1472 }; |
|
1473 |
1352 |
1474 /* Sorting |
1353 /* Sorting |
1475 ---------------------------------------------------------------------- */ |
1354 ---------------------------------------------------------------------- */ |
1476 |
1355 |
1477 // Document order sorting |
1356 // Document order sorting |
1478 sortOrder = hasCompare ? |
1357 sortOrder = function( a, b ) { |
1479 function( a, b ) { |
|
1480 |
1358 |
1481 // Flag for duplicate removal |
1359 // Flag for duplicate removal |
1482 if ( a === b ) { |
1360 if ( a === b ) { |
1483 hasDuplicate = true; |
1361 hasDuplicate = true; |
1484 return 0; |
1362 return 0; |
1508 // Choose the first element that is related to our preferred document |
1386 // Choose the first element that is related to our preferred document |
1509 // Support: IE 11+, Edge 17 - 18+ |
1387 // Support: IE 11+, Edge 17 - 18+ |
1510 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1388 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1511 // two documents; shallow comparisons work. |
1389 // two documents; shallow comparisons work. |
1512 // eslint-disable-next-line eqeqeq |
1390 // eslint-disable-next-line eqeqeq |
1513 if ( a == document || a.ownerDocument == preferredDoc && |
1391 if ( a === document || a.ownerDocument == preferredDoc && |
1514 contains( preferredDoc, a ) ) { |
1392 find.contains( preferredDoc, a ) ) { |
1515 return -1; |
1393 return -1; |
1516 } |
1394 } |
1517 |
1395 |
1518 // Support: IE 11+, Edge 17 - 18+ |
1396 // Support: IE 11+, Edge 17 - 18+ |
1519 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1397 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1520 // two documents; shallow comparisons work. |
1398 // two documents; shallow comparisons work. |
1521 // eslint-disable-next-line eqeqeq |
1399 // eslint-disable-next-line eqeqeq |
1522 if ( b == document || b.ownerDocument == preferredDoc && |
1400 if ( b === document || b.ownerDocument == preferredDoc && |
1523 contains( preferredDoc, b ) ) { |
1401 find.contains( preferredDoc, b ) ) { |
1524 return 1; |
1402 return 1; |
1525 } |
1403 } |
1526 |
1404 |
1527 // Maintain original order |
1405 // Maintain original order |
1528 return sortInput ? |
1406 return sortInput ? |
1529 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : |
1407 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : |
1530 0; |
1408 0; |
1531 } |
1409 } |
1532 |
1410 |
1533 return compare & 4 ? -1 : 1; |
1411 return compare & 4 ? -1 : 1; |
1534 } : |
|
1535 function( a, b ) { |
|
1536 |
|
1537 // Exit early if the nodes are identical |
|
1538 if ( a === b ) { |
|
1539 hasDuplicate = true; |
|
1540 return 0; |
|
1541 } |
|
1542 |
|
1543 var cur, |
|
1544 i = 0, |
|
1545 aup = a.parentNode, |
|
1546 bup = b.parentNode, |
|
1547 ap = [ a ], |
|
1548 bp = [ b ]; |
|
1549 |
|
1550 // Parentless nodes are either documents or disconnected |
|
1551 if ( !aup || !bup ) { |
|
1552 |
|
1553 // Support: IE 11+, Edge 17 - 18+ |
|
1554 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
|
1555 // two documents; shallow comparisons work. |
|
1556 /* eslint-disable eqeqeq */ |
|
1557 return a == document ? -1 : |
|
1558 b == document ? 1 : |
|
1559 /* eslint-enable eqeqeq */ |
|
1560 aup ? -1 : |
|
1561 bup ? 1 : |
|
1562 sortInput ? |
|
1563 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : |
|
1564 0; |
|
1565 |
|
1566 // If the nodes are siblings, we can do a quick check |
|
1567 } else if ( aup === bup ) { |
|
1568 return siblingCheck( a, b ); |
|
1569 } |
|
1570 |
|
1571 // Otherwise we need full lists of their ancestors for comparison |
|
1572 cur = a; |
|
1573 while ( ( cur = cur.parentNode ) ) { |
|
1574 ap.unshift( cur ); |
|
1575 } |
|
1576 cur = b; |
|
1577 while ( ( cur = cur.parentNode ) ) { |
|
1578 bp.unshift( cur ); |
|
1579 } |
|
1580 |
|
1581 // Walk down the tree looking for a discrepancy |
|
1582 while ( ap[ i ] === bp[ i ] ) { |
|
1583 i++; |
|
1584 } |
|
1585 |
|
1586 return i ? |
|
1587 |
|
1588 // Do a sibling check if the nodes have a common ancestor |
|
1589 siblingCheck( ap[ i ], bp[ i ] ) : |
|
1590 |
|
1591 // Otherwise nodes in our document sort first |
|
1592 // Support: IE 11+, Edge 17 - 18+ |
|
1593 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
|
1594 // two documents; shallow comparisons work. |
|
1595 /* eslint-disable eqeqeq */ |
|
1596 ap[ i ] == preferredDoc ? -1 : |
|
1597 bp[ i ] == preferredDoc ? 1 : |
|
1598 /* eslint-enable eqeqeq */ |
|
1599 0; |
|
1600 }; |
1412 }; |
1601 |
1413 |
1602 return document; |
1414 return document; |
1415 } |
|
1416 |
|
1417 find.matches = function( expr, elements ) { |
|
1418 return find( expr, null, null, elements ); |
|
1603 }; |
1419 }; |
1604 |
1420 |
1605 Sizzle.matches = function( expr, elements ) { |
1421 find.matchesSelector = function( elem, expr ) { |
1606 return Sizzle( expr, null, null, elements ); |
|
1607 }; |
|
1608 |
|
1609 Sizzle.matchesSelector = function( elem, expr ) { |
|
1610 setDocument( elem ); |
1422 setDocument( elem ); |
1611 |
1423 |
1612 if ( support.matchesSelector && documentIsHTML && |
1424 if ( documentIsHTML && |
1613 !nonnativeSelectorCache[ expr + " " ] && |
1425 !nonnativeSelectorCache[ expr + " " ] && |
1614 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && |
1426 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { |
1615 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { |
|
1616 |
1427 |
1617 try { |
1428 try { |
1618 var ret = matches.call( elem, expr ); |
1429 var ret = matches.call( elem, expr ); |
1619 |
1430 |
1620 // IE 9's matchesSelector returns false on disconnected nodes |
1431 // IE 9's matchesSelector returns false on disconnected nodes |
1621 if ( ret || support.disconnectedMatch || |
1432 if ( ret || support.disconnectedMatch || |
1622 |
1433 |
1623 // As well, disconnected nodes are said to be in a document |
1434 // As well, disconnected nodes are said to be in a document |
1624 // fragment in IE 9 |
1435 // fragment in IE 9 |
1625 elem.document && elem.document.nodeType !== 11 ) { |
1436 elem.document && elem.document.nodeType !== 11 ) { |
1626 return ret; |
1437 return ret; |
1627 } |
1438 } |
1628 } catch ( e ) { |
1439 } catch ( e ) { |
1629 nonnativeSelectorCache( expr, true ); |
1440 nonnativeSelectorCache( expr, true ); |
1630 } |
1441 } |
1631 } |
1442 } |
1632 |
1443 |
1633 return Sizzle( expr, document, null, [ elem ] ).length > 0; |
1444 return find( expr, document, null, [ elem ] ).length > 0; |
1634 }; |
1445 }; |
1635 |
1446 |
1636 Sizzle.contains = function( context, elem ) { |
1447 find.contains = function( context, elem ) { |
1637 |
1448 |
1638 // Set document vars if needed |
1449 // Set document vars if needed |
1639 // Support: IE 11+, Edge 17 - 18+ |
1450 // Support: IE 11+, Edge 17 - 18+ |
1640 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1451 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1641 // two documents; shallow comparisons work. |
1452 // two documents; shallow comparisons work. |
1642 // eslint-disable-next-line eqeqeq |
1453 // eslint-disable-next-line eqeqeq |
1643 if ( ( context.ownerDocument || context ) != document ) { |
1454 if ( ( context.ownerDocument || context ) != document ) { |
1644 setDocument( context ); |
1455 setDocument( context ); |
1645 } |
1456 } |
1646 return contains( context, elem ); |
1457 return jQuery.contains( context, elem ); |
1647 }; |
1458 }; |
1648 |
1459 |
1649 Sizzle.attr = function( elem, name ) { |
1460 |
1461 find.attr = function( elem, name ) { |
|
1650 |
1462 |
1651 // Set document vars if needed |
1463 // Set document vars if needed |
1652 // Support: IE 11+, Edge 17 - 18+ |
1464 // Support: IE 11+, Edge 17 - 18+ |
1653 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1465 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1654 // two documents; shallow comparisons work. |
1466 // two documents; shallow comparisons work. |
1657 setDocument( elem ); |
1469 setDocument( elem ); |
1658 } |
1470 } |
1659 |
1471 |
1660 var fn = Expr.attrHandle[ name.toLowerCase() ], |
1472 var fn = Expr.attrHandle[ name.toLowerCase() ], |
1661 |
1473 |
1662 // Don't get fooled by Object.prototype properties (jQuery #13807) |
1474 // Don't get fooled by Object.prototype properties (see trac-13807) |
1663 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? |
1475 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? |
1664 fn( elem, name, !documentIsHTML ) : |
1476 fn( elem, name, !documentIsHTML ) : |
1665 undefined; |
1477 undefined; |
1666 |
1478 |
1667 return val !== undefined ? |
1479 if ( val !== undefined ) { |
1668 val : |
1480 return val; |
1669 support.attributes || !documentIsHTML ? |
1481 } |
1670 elem.getAttribute( name ) : |
1482 |
1671 ( val = elem.getAttributeNode( name ) ) && val.specified ? |
1483 return elem.getAttribute( name ); |
1672 val.value : |
|
1673 null; |
|
1674 }; |
1484 }; |
1675 |
1485 |
1676 Sizzle.escape = function( sel ) { |
1486 find.error = function( msg ) { |
1677 return ( sel + "" ).replace( rcssescape, fcssescape ); |
|
1678 }; |
|
1679 |
|
1680 Sizzle.error = function( msg ) { |
|
1681 throw new Error( "Syntax error, unrecognized expression: " + msg ); |
1487 throw new Error( "Syntax error, unrecognized expression: " + msg ); |
1682 }; |
1488 }; |
1683 |
1489 |
1684 /** |
1490 /** |
1685 * Document sorting and removing duplicates |
1491 * Document sorting and removing duplicates |
1686 * @param {ArrayLike} results |
1492 * @param {ArrayLike} results |
1687 */ |
1493 */ |
1688 Sizzle.uniqueSort = function( results ) { |
1494 jQuery.uniqueSort = function( results ) { |
1689 var elem, |
1495 var elem, |
1690 duplicates = [], |
1496 duplicates = [], |
1691 j = 0, |
1497 j = 0, |
1692 i = 0; |
1498 i = 0; |
1693 |
1499 |
1694 // Unless we *know* we can detect duplicates, assume their presence |
1500 // Unless we *know* we can detect duplicates, assume their presence |
1695 hasDuplicate = !support.detectDuplicates; |
1501 // |
1696 sortInput = !support.sortStable && results.slice( 0 ); |
1502 // Support: Android <=4.0+ |
1697 results.sort( sortOrder ); |
1503 // Testing for detecting duplicates is unpredictable so instead assume we can't |
1504 // depend on duplicate detection in all browsers without a stable sort. |
|
1505 hasDuplicate = !support.sortStable; |
|
1506 sortInput = !support.sortStable && slice.call( results, 0 ); |
|
1507 sort.call( results, sortOrder ); |
|
1698 |
1508 |
1699 if ( hasDuplicate ) { |
1509 if ( hasDuplicate ) { |
1700 while ( ( elem = results[ i++ ] ) ) { |
1510 while ( ( elem = results[ i++ ] ) ) { |
1701 if ( elem === results[ i ] ) { |
1511 if ( elem === results[ i ] ) { |
1702 j = duplicates.push( i ); |
1512 j = duplicates.push( i ); |
1703 } |
1513 } |
1704 } |
1514 } |
1705 while ( j-- ) { |
1515 while ( j-- ) { |
1706 results.splice( duplicates[ j ], 1 ); |
1516 splice.call( results, duplicates[ j ], 1 ); |
1707 } |
1517 } |
1708 } |
1518 } |
1709 |
1519 |
1710 // Clear input after sorting to release objects |
1520 // Clear input after sorting to release objects |
1711 // See https://github.com/jquery/sizzle/pull/225 |
1521 // See https://github.com/jquery/sizzle/pull/225 |
1712 sortInput = null; |
1522 sortInput = null; |
1713 |
1523 |
1714 return results; |
1524 return results; |
1715 }; |
1525 }; |
1716 |
1526 |
1717 /** |
1527 jQuery.fn.uniqueSort = function() { |
1718 * Utility function for retrieving the text value of an array of DOM nodes |
1528 return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) ); |
1719 * @param {Array|Element} elem |
|
1720 */ |
|
1721 getText = Sizzle.getText = function( elem ) { |
|
1722 var node, |
|
1723 ret = "", |
|
1724 i = 0, |
|
1725 nodeType = elem.nodeType; |
|
1726 |
|
1727 if ( !nodeType ) { |
|
1728 |
|
1729 // If no nodeType, this is expected to be an array |
|
1730 while ( ( node = elem[ i++ ] ) ) { |
|
1731 |
|
1732 // Do not traverse comment nodes |
|
1733 ret += getText( node ); |
|
1734 } |
|
1735 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { |
|
1736 |
|
1737 // Use textContent for elements |
|
1738 // innerText usage removed for consistency of new lines (jQuery #11153) |
|
1739 if ( typeof elem.textContent === "string" ) { |
|
1740 return elem.textContent; |
|
1741 } else { |
|
1742 |
|
1743 // Traverse its children |
|
1744 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
|
1745 ret += getText( elem ); |
|
1746 } |
|
1747 } |
|
1748 } else if ( nodeType === 3 || nodeType === 4 ) { |
|
1749 return elem.nodeValue; |
|
1750 } |
|
1751 |
|
1752 // Do not include comment or processing instruction nodes |
|
1753 |
|
1754 return ret; |
|
1755 }; |
1529 }; |
1756 |
1530 |
1757 Expr = Sizzle.selectors = { |
1531 Expr = jQuery.expr = { |
1758 |
1532 |
1759 // Can be adjusted by the user |
1533 // Can be adjusted by the user |
1760 cacheLength: 50, |
1534 cacheLength: 50, |
1761 |
1535 |
1762 createPseudo: markFunction, |
1536 createPseudo: markFunction, |
1773 "+": { dir: "previousSibling", first: true }, |
1547 "+": { dir: "previousSibling", first: true }, |
1774 "~": { dir: "previousSibling" } |
1548 "~": { dir: "previousSibling" } |
1775 }, |
1549 }, |
1776 |
1550 |
1777 preFilter: { |
1551 preFilter: { |
1778 "ATTR": function( match ) { |
1552 ATTR: function( match ) { |
1779 match[ 1 ] = match[ 1 ].replace( runescape, funescape ); |
1553 match[ 1 ] = match[ 1 ].replace( runescape, funescape ); |
1780 |
1554 |
1781 // Move the given value to match[3] whether quoted or unquoted |
1555 // Move the given value to match[3] whether quoted or unquoted |
1782 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || |
1556 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" ) |
1783 match[ 5 ] || "" ).replace( runescape, funescape ); |
1557 .replace( runescape, funescape ); |
1784 |
1558 |
1785 if ( match[ 2 ] === "~=" ) { |
1559 if ( match[ 2 ] === "~=" ) { |
1786 match[ 3 ] = " " + match[ 3 ] + " "; |
1560 match[ 3 ] = " " + match[ 3 ] + " "; |
1787 } |
1561 } |
1788 |
1562 |
1789 return match.slice( 0, 4 ); |
1563 return match.slice( 0, 4 ); |
1790 }, |
1564 }, |
1791 |
1565 |
1792 "CHILD": function( match ) { |
1566 CHILD: function( match ) { |
1793 |
1567 |
1794 /* matches from matchExpr["CHILD"] |
1568 /* matches from matchExpr["CHILD"] |
1795 1 type (only|nth|...) |
1569 1 type (only|nth|...) |
1796 2 what (child|of-type) |
1570 2 what (child|of-type) |
1797 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) |
1571 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) |
1805 |
1579 |
1806 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { |
1580 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { |
1807 |
1581 |
1808 // nth-* requires argument |
1582 // nth-* requires argument |
1809 if ( !match[ 3 ] ) { |
1583 if ( !match[ 3 ] ) { |
1810 Sizzle.error( match[ 0 ] ); |
1584 find.error( match[ 0 ] ); |
1811 } |
1585 } |
1812 |
1586 |
1813 // numeric x and y parameters for Expr.filter.CHILD |
1587 // numeric x and y parameters for Expr.filter.CHILD |
1814 // remember that false/true cast respectively to 0/1 |
1588 // remember that false/true cast respectively to 0/1 |
1815 match[ 4 ] = +( match[ 4 ] ? |
1589 match[ 4 ] = +( match[ 4 ] ? |
1816 match[ 5 ] + ( match[ 6 ] || 1 ) : |
1590 match[ 5 ] + ( match[ 6 ] || 1 ) : |
1817 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) ); |
1591 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) |
1592 ); |
|
1818 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); |
1593 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); |
1819 |
1594 |
1820 // other types prohibit arguments |
1595 // other types prohibit arguments |
1821 } else if ( match[ 3 ] ) { |
1596 } else if ( match[ 3 ] ) { |
1822 Sizzle.error( match[ 0 ] ); |
1597 find.error( match[ 0 ] ); |
1823 } |
1598 } |
1824 |
1599 |
1825 return match; |
1600 return match; |
1826 }, |
1601 }, |
1827 |
1602 |
1828 "PSEUDO": function( match ) { |
1603 PSEUDO: function( match ) { |
1829 var excess, |
1604 var excess, |
1830 unquoted = !match[ 6 ] && match[ 2 ]; |
1605 unquoted = !match[ 6 ] && match[ 2 ]; |
1831 |
1606 |
1832 if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) { |
1607 if ( matchExpr.CHILD.test( match[ 0 ] ) ) { |
1833 return null; |
1608 return null; |
1834 } |
1609 } |
1835 |
1610 |
1836 // Accept quoted arguments as-is |
1611 // Accept quoted arguments as-is |
1837 if ( match[ 3 ] ) { |
1612 if ( match[ 3 ] ) { |
1856 } |
1631 } |
1857 }, |
1632 }, |
1858 |
1633 |
1859 filter: { |
1634 filter: { |
1860 |
1635 |
1861 "TAG": function( nodeNameSelector ) { |
1636 TAG: function( nodeNameSelector ) { |
1862 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); |
1637 var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); |
1863 return nodeNameSelector === "*" ? |
1638 return nodeNameSelector === "*" ? |
1864 function() { |
1639 function() { |
1865 return true; |
1640 return true; |
1866 } : |
1641 } : |
1867 function( elem ) { |
1642 function( elem ) { |
1868 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; |
1643 return nodeName( elem, expectedNodeName ); |
1869 }; |
1644 }; |
1870 }, |
1645 }, |
1871 |
1646 |
1872 "CLASS": function( className ) { |
1647 CLASS: function( className ) { |
1873 var pattern = classCache[ className + " " ]; |
1648 var pattern = classCache[ className + " " ]; |
1874 |
1649 |
1875 return pattern || |
1650 return pattern || |
1876 ( pattern = new RegExp( "(^|" + whitespace + |
1651 ( pattern = new RegExp( "(^|" + whitespace + ")" + className + |
1877 ")" + className + "(" + whitespace + "|$)" ) ) && classCache( |
1652 "(" + whitespace + "|$)" ) ) && |
1878 className, function( elem ) { |
1653 classCache( className, function( elem ) { |
1879 return pattern.test( |
1654 return pattern.test( |
1880 typeof elem.className === "string" && elem.className || |
1655 typeof elem.className === "string" && elem.className || |
1881 typeof elem.getAttribute !== "undefined" && |
1656 typeof elem.getAttribute !== "undefined" && |
1882 elem.getAttribute( "class" ) || |
1657 elem.getAttribute( "class" ) || |
1883 "" |
1658 "" |
1884 ); |
1659 ); |
1885 } ); |
1660 } ); |
1886 }, |
1661 }, |
1887 |
1662 |
1888 "ATTR": function( name, operator, check ) { |
1663 ATTR: function( name, operator, check ) { |
1889 return function( elem ) { |
1664 return function( elem ) { |
1890 var result = Sizzle.attr( elem, name ); |
1665 var result = find.attr( elem, name ); |
1891 |
1666 |
1892 if ( result == null ) { |
1667 if ( result == null ) { |
1893 return operator === "!="; |
1668 return operator === "!="; |
1894 } |
1669 } |
1895 if ( !operator ) { |
1670 if ( !operator ) { |
1896 return true; |
1671 return true; |
1897 } |
1672 } |
1898 |
1673 |
1899 result += ""; |
1674 result += ""; |
1900 |
1675 |
1901 /* eslint-disable max-len */ |
1676 if ( operator === "=" ) { |
1902 |
1677 return result === check; |
1903 return operator === "=" ? result === check : |
1678 } |
1904 operator === "!=" ? result !== check : |
1679 if ( operator === "!=" ) { |
1905 operator === "^=" ? check && result.indexOf( check ) === 0 : |
1680 return result !== check; |
1906 operator === "*=" ? check && result.indexOf( check ) > -1 : |
1681 } |
1907 operator === "$=" ? check && result.slice( -check.length ) === check : |
1682 if ( operator === "^=" ) { |
1908 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : |
1683 return check && result.indexOf( check ) === 0; |
1909 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : |
1684 } |
1910 false; |
1685 if ( operator === "*=" ) { |
1911 /* eslint-enable max-len */ |
1686 return check && result.indexOf( check ) > -1; |
1912 |
1687 } |
1688 if ( operator === "$=" ) { |
|
1689 return check && result.slice( -check.length ) === check; |
|
1690 } |
|
1691 if ( operator === "~=" ) { |
|
1692 return ( " " + result.replace( rwhitespace, " " ) + " " ) |
|
1693 .indexOf( check ) > -1; |
|
1694 } |
|
1695 if ( operator === "|=" ) { |
|
1696 return result === check || result.slice( 0, check.length + 1 ) === check + "-"; |
|
1697 } |
|
1698 |
|
1699 return false; |
|
1913 }; |
1700 }; |
1914 }, |
1701 }, |
1915 |
1702 |
1916 "CHILD": function( type, what, _argument, first, last ) { |
1703 CHILD: function( type, what, _argument, first, last ) { |
1917 var simple = type.slice( 0, 3 ) !== "nth", |
1704 var simple = type.slice( 0, 3 ) !== "nth", |
1918 forward = type.slice( -4 ) !== "last", |
1705 forward = type.slice( -4 ) !== "last", |
1919 ofType = what === "of-type"; |
1706 ofType = what === "of-type"; |
1920 |
1707 |
1921 return first === 1 && last === 0 ? |
1708 return first === 1 && last === 0 ? |
1924 function( elem ) { |
1711 function( elem ) { |
1925 return !!elem.parentNode; |
1712 return !!elem.parentNode; |
1926 } : |
1713 } : |
1927 |
1714 |
1928 function( elem, _context, xml ) { |
1715 function( elem, _context, xml ) { |
1929 var cache, uniqueCache, outerCache, node, nodeIndex, start, |
1716 var cache, outerCache, node, nodeIndex, start, |
1930 dir = simple !== forward ? "nextSibling" : "previousSibling", |
1717 dir = simple !== forward ? "nextSibling" : "previousSibling", |
1931 parent = elem.parentNode, |
1718 parent = elem.parentNode, |
1932 name = ofType && elem.nodeName.toLowerCase(), |
1719 name = ofType && elem.nodeName.toLowerCase(), |
1933 useCache = !xml && !ofType, |
1720 useCache = !xml && !ofType, |
1934 diff = false; |
1721 diff = false; |
1939 if ( simple ) { |
1726 if ( simple ) { |
1940 while ( dir ) { |
1727 while ( dir ) { |
1941 node = elem; |
1728 node = elem; |
1942 while ( ( node = node[ dir ] ) ) { |
1729 while ( ( node = node[ dir ] ) ) { |
1943 if ( ofType ? |
1730 if ( ofType ? |
1944 node.nodeName.toLowerCase() === name : |
1731 nodeName( node, name ) : |
1945 node.nodeType === 1 ) { |
1732 node.nodeType === 1 ) { |
1946 |
1733 |
1947 return false; |
1734 return false; |
1948 } |
1735 } |
1949 } |
1736 } |
1958 |
1745 |
1959 // non-xml :nth-child(...) stores cache data on `parent` |
1746 // non-xml :nth-child(...) stores cache data on `parent` |
1960 if ( forward && useCache ) { |
1747 if ( forward && useCache ) { |
1961 |
1748 |
1962 // Seek `elem` from a previously-cached index |
1749 // Seek `elem` from a previously-cached index |
1963 |
1750 outerCache = parent[ expando ] || ( parent[ expando ] = {} ); |
1964 // ...in a gzip-friendly way |
1751 cache = outerCache[ type ] || []; |
1965 node = parent; |
|
1966 outerCache = node[ expando ] || ( node[ expando ] = {} ); |
|
1967 |
|
1968 // Support: IE <9 only |
|
1969 // Defend against cloned attroperties (jQuery gh-1709) |
|
1970 uniqueCache = outerCache[ node.uniqueID ] || |
|
1971 ( outerCache[ node.uniqueID ] = {} ); |
|
1972 |
|
1973 cache = uniqueCache[ type ] || []; |
|
1974 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
1752 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
1975 diff = nodeIndex && cache[ 2 ]; |
1753 diff = nodeIndex && cache[ 2 ]; |
1976 node = nodeIndex && parent.childNodes[ nodeIndex ]; |
1754 node = nodeIndex && parent.childNodes[ nodeIndex ]; |
1977 |
1755 |
1978 while ( ( node = ++nodeIndex && node && node[ dir ] || |
1756 while ( ( node = ++nodeIndex && node && node[ dir ] || |
1980 // Fallback to seeking `elem` from the start |
1758 // Fallback to seeking `elem` from the start |
1981 ( diff = nodeIndex = 0 ) || start.pop() ) ) { |
1759 ( diff = nodeIndex = 0 ) || start.pop() ) ) { |
1982 |
1760 |
1983 // When found, cache indexes on `parent` and break |
1761 // When found, cache indexes on `parent` and break |
1984 if ( node.nodeType === 1 && ++diff && node === elem ) { |
1762 if ( node.nodeType === 1 && ++diff && node === elem ) { |
1985 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; |
1763 outerCache[ type ] = [ dirruns, nodeIndex, diff ]; |
1986 break; |
1764 break; |
1987 } |
1765 } |
1988 } |
1766 } |
1989 |
1767 |
1990 } else { |
1768 } else { |
1991 |
1769 |
1992 // Use previously-cached element index if available |
1770 // Use previously-cached element index if available |
1993 if ( useCache ) { |
1771 if ( useCache ) { |
1994 |
1772 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); |
1995 // ...in a gzip-friendly way |
1773 cache = outerCache[ type ] || []; |
1996 node = elem; |
|
1997 outerCache = node[ expando ] || ( node[ expando ] = {} ); |
|
1998 |
|
1999 // Support: IE <9 only |
|
2000 // Defend against cloned attroperties (jQuery gh-1709) |
|
2001 uniqueCache = outerCache[ node.uniqueID ] || |
|
2002 ( outerCache[ node.uniqueID ] = {} ); |
|
2003 |
|
2004 cache = uniqueCache[ type ] || []; |
|
2005 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
1774 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
2006 diff = nodeIndex; |
1775 diff = nodeIndex; |
2007 } |
1776 } |
2008 |
1777 |
2009 // xml :nth-child(...) |
1778 // xml :nth-child(...) |
2013 // Use the same loop as above to seek `elem` from the start |
1782 // Use the same loop as above to seek `elem` from the start |
2014 while ( ( node = ++nodeIndex && node && node[ dir ] || |
1783 while ( ( node = ++nodeIndex && node && node[ dir ] || |
2015 ( diff = nodeIndex = 0 ) || start.pop() ) ) { |
1784 ( diff = nodeIndex = 0 ) || start.pop() ) ) { |
2016 |
1785 |
2017 if ( ( ofType ? |
1786 if ( ( ofType ? |
2018 node.nodeName.toLowerCase() === name : |
1787 nodeName( node, name ) : |
2019 node.nodeType === 1 ) && |
1788 node.nodeType === 1 ) && |
2020 ++diff ) { |
1789 ++diff ) { |
2021 |
1790 |
2022 // Cache the index of each encountered element |
1791 // Cache the index of each encountered element |
2023 if ( useCache ) { |
1792 if ( useCache ) { |
2024 outerCache = node[ expando ] || |
1793 outerCache = node[ expando ] || |
2025 ( node[ expando ] = {} ); |
1794 ( node[ expando ] = {} ); |
2026 |
1795 outerCache[ type ] = [ dirruns, diff ]; |
2027 // Support: IE <9 only |
|
2028 // Defend against cloned attroperties (jQuery gh-1709) |
|
2029 uniqueCache = outerCache[ node.uniqueID ] || |
|
2030 ( outerCache[ node.uniqueID ] = {} ); |
|
2031 |
|
2032 uniqueCache[ type ] = [ dirruns, diff ]; |
|
2033 } |
1796 } |
2034 |
1797 |
2035 if ( node === elem ) { |
1798 if ( node === elem ) { |
2036 break; |
1799 break; |
2037 } |
1800 } |
2045 return diff === first || ( diff % first === 0 && diff / first >= 0 ); |
1808 return diff === first || ( diff % first === 0 && diff / first >= 0 ); |
2046 } |
1809 } |
2047 }; |
1810 }; |
2048 }, |
1811 }, |
2049 |
1812 |
2050 "PSEUDO": function( pseudo, argument ) { |
1813 PSEUDO: function( pseudo, argument ) { |
2051 |
1814 |
2052 // pseudo-class names are case-insensitive |
1815 // pseudo-class names are case-insensitive |
2053 // http://www.w3.org/TR/selectors/#pseudo-classes |
1816 // https://www.w3.org/TR/selectors/#pseudo-classes |
2054 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters |
1817 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters |
2055 // Remember that setFilters inherits from pseudos |
1818 // Remember that setFilters inherits from pseudos |
2056 var args, |
1819 var args, |
2057 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || |
1820 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || |
2058 Sizzle.error( "unsupported pseudo: " + pseudo ); |
1821 find.error( "unsupported pseudo: " + pseudo ); |
2059 |
1822 |
2060 // The user may use createPseudo to indicate that |
1823 // The user may use createPseudo to indicate that |
2061 // arguments are needed to create the filter function |
1824 // arguments are needed to create the filter function |
2062 // just as Sizzle does |
1825 // just as jQuery does |
2063 if ( fn[ expando ] ) { |
1826 if ( fn[ expando ] ) { |
2064 return fn( argument ); |
1827 return fn( argument ); |
2065 } |
1828 } |
2066 |
1829 |
2067 // But maintain support for old signatures |
1830 // But maintain support for old signatures |
2071 markFunction( function( seed, matches ) { |
1834 markFunction( function( seed, matches ) { |
2072 var idx, |
1835 var idx, |
2073 matched = fn( seed, argument ), |
1836 matched = fn( seed, argument ), |
2074 i = matched.length; |
1837 i = matched.length; |
2075 while ( i-- ) { |
1838 while ( i-- ) { |
2076 idx = indexOf( seed, matched[ i ] ); |
1839 idx = indexOf.call( seed, matched[ i ] ); |
2077 seed[ idx ] = !( matches[ idx ] = matched[ i ] ); |
1840 seed[ idx ] = !( matches[ idx ] = matched[ i ] ); |
2078 } |
1841 } |
2079 } ) : |
1842 } ) : |
2080 function( elem ) { |
1843 function( elem ) { |
2081 return fn( elem, 0, args ); |
1844 return fn( elem, 0, args ); |
2087 }, |
1850 }, |
2088 |
1851 |
2089 pseudos: { |
1852 pseudos: { |
2090 |
1853 |
2091 // Potentially complex pseudos |
1854 // Potentially complex pseudos |
2092 "not": markFunction( function( selector ) { |
1855 not: markFunction( function( selector ) { |
2093 |
1856 |
2094 // Trim the selector passed to compile |
1857 // Trim the selector passed to compile |
2095 // to avoid treating leading and trailing |
1858 // to avoid treating leading and trailing |
2096 // spaces as combinators |
1859 // spaces as combinators |
2097 var input = [], |
1860 var input = [], |
2098 results = [], |
1861 results = [], |
2099 matcher = compile( selector.replace( rtrim, "$1" ) ); |
1862 matcher = compile( selector.replace( rtrimCSS, "$1" ) ); |
2100 |
1863 |
2101 return matcher[ expando ] ? |
1864 return matcher[ expando ] ? |
2102 markFunction( function( seed, matches, _context, xml ) { |
1865 markFunction( function( seed, matches, _context, xml ) { |
2103 var elem, |
1866 var elem, |
2104 unmatched = matcher( seed, null, xml, [] ), |
1867 unmatched = matcher( seed, null, xml, [] ), |
2113 } ) : |
1876 } ) : |
2114 function( elem, _context, xml ) { |
1877 function( elem, _context, xml ) { |
2115 input[ 0 ] = elem; |
1878 input[ 0 ] = elem; |
2116 matcher( input, null, xml, results ); |
1879 matcher( input, null, xml, results ); |
2117 |
1880 |
2118 // Don't keep the element (issue #299) |
1881 // Don't keep the element |
1882 // (see https://github.com/jquery/sizzle/issues/299) |
|
2119 input[ 0 ] = null; |
1883 input[ 0 ] = null; |
2120 return !results.pop(); |
1884 return !results.pop(); |
2121 }; |
1885 }; |
2122 } ), |
1886 } ), |
2123 |
1887 |
2124 "has": markFunction( function( selector ) { |
1888 has: markFunction( function( selector ) { |
2125 return function( elem ) { |
1889 return function( elem ) { |
2126 return Sizzle( selector, elem ).length > 0; |
1890 return find( selector, elem ).length > 0; |
2127 }; |
1891 }; |
2128 } ), |
1892 } ), |
2129 |
1893 |
2130 "contains": markFunction( function( text ) { |
1894 contains: markFunction( function( text ) { |
2131 text = text.replace( runescape, funescape ); |
1895 text = text.replace( runescape, funescape ); |
2132 return function( elem ) { |
1896 return function( elem ) { |
2133 return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; |
1897 return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1; |
2134 }; |
1898 }; |
2135 } ), |
1899 } ), |
2136 |
1900 |
2137 // "Whether an element is represented by a :lang() selector |
1901 // "Whether an element is represented by a :lang() selector |
2138 // is based solely on the element's language value |
1902 // is based solely on the element's language value |
2139 // being equal to the identifier C, |
1903 // being equal to the identifier C, |
2140 // or beginning with the identifier C immediately followed by "-". |
1904 // or beginning with the identifier C immediately followed by "-". |
2141 // The matching of C against the element's language value is performed case-insensitively. |
1905 // The matching of C against the element's language value is performed case-insensitively. |
2142 // The identifier C does not have to be a valid language name." |
1906 // The identifier C does not have to be a valid language name." |
2143 // http://www.w3.org/TR/selectors/#lang-pseudo |
1907 // https://www.w3.org/TR/selectors/#lang-pseudo |
2144 "lang": markFunction( function( lang ) { |
1908 lang: markFunction( function( lang ) { |
2145 |
1909 |
2146 // lang value must be a valid identifier |
1910 // lang value must be a valid identifier |
2147 if ( !ridentifier.test( lang || "" ) ) { |
1911 if ( !ridentifier.test( lang || "" ) ) { |
2148 Sizzle.error( "unsupported lang: " + lang ); |
1912 find.error( "unsupported lang: " + lang ); |
2149 } |
1913 } |
2150 lang = lang.replace( runescape, funescape ).toLowerCase(); |
1914 lang = lang.replace( runescape, funescape ).toLowerCase(); |
2151 return function( elem ) { |
1915 return function( elem ) { |
2152 var elemLang; |
1916 var elemLang; |
2153 do { |
1917 do { |
2162 return false; |
1926 return false; |
2163 }; |
1927 }; |
2164 } ), |
1928 } ), |
2165 |
1929 |
2166 // Miscellaneous |
1930 // Miscellaneous |
2167 "target": function( elem ) { |
1931 target: function( elem ) { |
2168 var hash = window.location && window.location.hash; |
1932 var hash = window.location && window.location.hash; |
2169 return hash && hash.slice( 1 ) === elem.id; |
1933 return hash && hash.slice( 1 ) === elem.id; |
2170 }, |
1934 }, |
2171 |
1935 |
2172 "root": function( elem ) { |
1936 root: function( elem ) { |
2173 return elem === docElem; |
1937 return elem === documentElement; |
2174 }, |
1938 }, |
2175 |
1939 |
2176 "focus": function( elem ) { |
1940 focus: function( elem ) { |
2177 return elem === document.activeElement && |
1941 return elem === safeActiveElement() && |
2178 ( !document.hasFocus || document.hasFocus() ) && |
1942 document.hasFocus() && |
2179 !!( elem.type || elem.href || ~elem.tabIndex ); |
1943 !!( elem.type || elem.href || ~elem.tabIndex ); |
2180 }, |
1944 }, |
2181 |
1945 |
2182 // Boolean properties |
1946 // Boolean properties |
2183 "enabled": createDisabledPseudo( false ), |
1947 enabled: createDisabledPseudo( false ), |
2184 "disabled": createDisabledPseudo( true ), |
1948 disabled: createDisabledPseudo( true ), |
2185 |
1949 |
2186 "checked": function( elem ) { |
1950 checked: function( elem ) { |
2187 |
1951 |
2188 // In CSS3, :checked should return both checked and selected elements |
1952 // In CSS3, :checked should return both checked and selected elements |
2189 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
1953 // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
2190 var nodeName = elem.nodeName.toLowerCase(); |
1954 return ( nodeName( elem, "input" ) && !!elem.checked ) || |
2191 return ( nodeName === "input" && !!elem.checked ) || |
1955 ( nodeName( elem, "option" ) && !!elem.selected ); |
2192 ( nodeName === "option" && !!elem.selected ); |
|
2193 }, |
1956 }, |
2194 |
1957 |
2195 "selected": function( elem ) { |
1958 selected: function( elem ) { |
2196 |
1959 |
2197 // Accessing this property makes selected-by-default |
1960 // Support: IE <=11+ |
2198 // options in Safari work properly |
1961 // Accessing the selectedIndex property |
1962 // forces the browser to treat the default option as |
|
1963 // selected when in an optgroup. |
|
2199 if ( elem.parentNode ) { |
1964 if ( elem.parentNode ) { |
2200 // eslint-disable-next-line no-unused-expressions |
1965 // eslint-disable-next-line no-unused-expressions |
2201 elem.parentNode.selectedIndex; |
1966 elem.parentNode.selectedIndex; |
2202 } |
1967 } |
2203 |
1968 |
2204 return elem.selected === true; |
1969 return elem.selected === true; |
2205 }, |
1970 }, |
2206 |
1971 |
2207 // Contents |
1972 // Contents |
2208 "empty": function( elem ) { |
1973 empty: function( elem ) { |
2209 |
1974 |
2210 // http://www.w3.org/TR/selectors/#empty-pseudo |
1975 // https://www.w3.org/TR/selectors/#empty-pseudo |
2211 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), |
1976 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), |
2212 // but not by others (comment: 8; processing instruction: 7; etc.) |
1977 // but not by others (comment: 8; processing instruction: 7; etc.) |
2213 // nodeType < 6 works because attributes (2) do not appear as children |
1978 // nodeType < 6 works because attributes (2) do not appear as children |
2214 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
1979 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
2215 if ( elem.nodeType < 6 ) { |
1980 if ( elem.nodeType < 6 ) { |
2217 } |
1982 } |
2218 } |
1983 } |
2219 return true; |
1984 return true; |
2220 }, |
1985 }, |
2221 |
1986 |
2222 "parent": function( elem ) { |
1987 parent: function( elem ) { |
2223 return !Expr.pseudos[ "empty" ]( elem ); |
1988 return !Expr.pseudos.empty( elem ); |
2224 }, |
1989 }, |
2225 |
1990 |
2226 // Element/input types |
1991 // Element/input types |
2227 "header": function( elem ) { |
1992 header: function( elem ) { |
2228 return rheader.test( elem.nodeName ); |
1993 return rheader.test( elem.nodeName ); |
2229 }, |
1994 }, |
2230 |
1995 |
2231 "input": function( elem ) { |
1996 input: function( elem ) { |
2232 return rinputs.test( elem.nodeName ); |
1997 return rinputs.test( elem.nodeName ); |
2233 }, |
1998 }, |
2234 |
1999 |
2235 "button": function( elem ) { |
2000 button: function( elem ) { |
2236 var name = elem.nodeName.toLowerCase(); |
2001 return nodeName( elem, "input" ) && elem.type === "button" || |
2237 return name === "input" && elem.type === "button" || name === "button"; |
2002 nodeName( elem, "button" ); |
2238 }, |
2003 }, |
2239 |
2004 |
2240 "text": function( elem ) { |
2005 text: function( elem ) { |
2241 var attr; |
2006 var attr; |
2242 return elem.nodeName.toLowerCase() === "input" && |
2007 return nodeName( elem, "input" ) && elem.type === "text" && |
2243 elem.type === "text" && |
2008 |
2244 |
2009 // Support: IE <10 only |
2245 // Support: IE<8 |
2010 // New HTML5 attribute values (e.g., "search") appear |
2246 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" |
2011 // with elem.type === "text" |
2247 ( ( attr = elem.getAttribute( "type" ) ) == null || |
2012 ( ( attr = elem.getAttribute( "type" ) ) == null || |
2248 attr.toLowerCase() === "text" ); |
2013 attr.toLowerCase() === "text" ); |
2249 }, |
2014 }, |
2250 |
2015 |
2251 // Position-in-collection |
2016 // Position-in-collection |
2252 "first": createPositionalPseudo( function() { |
2017 first: createPositionalPseudo( function() { |
2253 return [ 0 ]; |
2018 return [ 0 ]; |
2254 } ), |
2019 } ), |
2255 |
2020 |
2256 "last": createPositionalPseudo( function( _matchIndexes, length ) { |
2021 last: createPositionalPseudo( function( _matchIndexes, length ) { |
2257 return [ length - 1 ]; |
2022 return [ length - 1 ]; |
2258 } ), |
2023 } ), |
2259 |
2024 |
2260 "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) { |
2025 eq: createPositionalPseudo( function( _matchIndexes, length, argument ) { |
2261 return [ argument < 0 ? argument + length : argument ]; |
2026 return [ argument < 0 ? argument + length : argument ]; |
2262 } ), |
2027 } ), |
2263 |
2028 |
2264 "even": createPositionalPseudo( function( matchIndexes, length ) { |
2029 even: createPositionalPseudo( function( matchIndexes, length ) { |
2265 var i = 0; |
2030 var i = 0; |
2266 for ( ; i < length; i += 2 ) { |
2031 for ( ; i < length; i += 2 ) { |
2267 matchIndexes.push( i ); |
2032 matchIndexes.push( i ); |
2268 } |
2033 } |
2269 return matchIndexes; |
2034 return matchIndexes; |
2270 } ), |
2035 } ), |
2271 |
2036 |
2272 "odd": createPositionalPseudo( function( matchIndexes, length ) { |
2037 odd: createPositionalPseudo( function( matchIndexes, length ) { |
2273 var i = 1; |
2038 var i = 1; |
2274 for ( ; i < length; i += 2 ) { |
2039 for ( ; i < length; i += 2 ) { |
2275 matchIndexes.push( i ); |
2040 matchIndexes.push( i ); |
2276 } |
2041 } |
2277 return matchIndexes; |
2042 return matchIndexes; |
2278 } ), |
2043 } ), |
2279 |
2044 |
2280 "lt": createPositionalPseudo( function( matchIndexes, length, argument ) { |
2045 lt: createPositionalPseudo( function( matchIndexes, length, argument ) { |
2281 var i = argument < 0 ? |
2046 var i; |
2282 argument + length : |
2047 |
2283 argument > length ? |
2048 if ( argument < 0 ) { |
2284 length : |
2049 i = argument + length; |
2285 argument; |
2050 } else if ( argument > length ) { |
2051 i = length; |
|
2052 } else { |
|
2053 i = argument; |
|
2054 } |
|
2055 |
|
2286 for ( ; --i >= 0; ) { |
2056 for ( ; --i >= 0; ) { |
2287 matchIndexes.push( i ); |
2057 matchIndexes.push( i ); |
2288 } |
2058 } |
2289 return matchIndexes; |
2059 return matchIndexes; |
2290 } ), |
2060 } ), |
2291 |
2061 |
2292 "gt": createPositionalPseudo( function( matchIndexes, length, argument ) { |
2062 gt: createPositionalPseudo( function( matchIndexes, length, argument ) { |
2293 var i = argument < 0 ? argument + length : argument; |
2063 var i = argument < 0 ? argument + length : argument; |
2294 for ( ; ++i < length; ) { |
2064 for ( ; ++i < length; ) { |
2295 matchIndexes.push( i ); |
2065 matchIndexes.push( i ); |
2296 } |
2066 } |
2297 return matchIndexes; |
2067 return matchIndexes; |
2298 } ) |
2068 } ) |
2299 } |
2069 } |
2300 }; |
2070 }; |
2301 |
2071 |
2302 Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ]; |
2072 Expr.pseudos.nth = Expr.pseudos.eq; |
2303 |
2073 |
2304 // Add button/input type pseudos |
2074 // Add button/input type pseudos |
2305 for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { |
2075 for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { |
2306 Expr.pseudos[ i ] = createInputPseudo( i ); |
2076 Expr.pseudos[ i ] = createInputPseudo( i ); |
2307 } |
2077 } |
2312 // Easy API for creating new setFilters |
2082 // Easy API for creating new setFilters |
2313 function setFilters() {} |
2083 function setFilters() {} |
2314 setFilters.prototype = Expr.filters = Expr.pseudos; |
2084 setFilters.prototype = Expr.filters = Expr.pseudos; |
2315 Expr.setFilters = new setFilters(); |
2085 Expr.setFilters = new setFilters(); |
2316 |
2086 |
2317 tokenize = Sizzle.tokenize = function( selector, parseOnly ) { |
2087 function tokenize( selector, parseOnly ) { |
2318 var matched, match, tokens, type, |
2088 var matched, match, tokens, type, |
2319 soFar, groups, preFilters, |
2089 soFar, groups, preFilters, |
2320 cached = tokenCache[ selector + " " ]; |
2090 cached = tokenCache[ selector + " " ]; |
2321 |
2091 |
2322 if ( cached ) { |
2092 if ( cached ) { |
2340 } |
2110 } |
2341 |
2111 |
2342 matched = false; |
2112 matched = false; |
2343 |
2113 |
2344 // Combinators |
2114 // Combinators |
2345 if ( ( match = rcombinators.exec( soFar ) ) ) { |
2115 if ( ( match = rleadingCombinator.exec( soFar ) ) ) { |
2346 matched = match.shift(); |
2116 matched = match.shift(); |
2347 tokens.push( { |
2117 tokens.push( { |
2348 value: matched, |
2118 value: matched, |
2349 |
2119 |
2350 // Cast descendant combinators to space |
2120 // Cast descendant combinators to space |
2351 type: match[ 0 ].replace( rtrim, " " ) |
2121 type: match[ 0 ].replace( rtrimCSS, " " ) |
2352 } ); |
2122 } ); |
2353 soFar = soFar.slice( matched.length ); |
2123 soFar = soFar.slice( matched.length ); |
2354 } |
2124 } |
2355 |
2125 |
2356 // Filters |
2126 // Filters |
2373 } |
2143 } |
2374 |
2144 |
2375 // Return the length of the invalid excess |
2145 // Return the length of the invalid excess |
2376 // if we're just parsing |
2146 // if we're just parsing |
2377 // Otherwise, throw an error or return tokens |
2147 // Otherwise, throw an error or return tokens |
2378 return parseOnly ? |
2148 if ( parseOnly ) { |
2379 soFar.length : |
2149 return soFar.length; |
2380 soFar ? |
2150 } |
2381 Sizzle.error( selector ) : |
2151 |
2382 |
2152 return soFar ? |
2383 // Cache the tokens |
2153 find.error( selector ) : |
2384 tokenCache( selector, groups ).slice( 0 ); |
2154 |
2385 }; |
2155 // Cache the tokens |
2156 tokenCache( selector, groups ).slice( 0 ); |
|
2157 } |
|
2386 |
2158 |
2387 function toSelector( tokens ) { |
2159 function toSelector( tokens ) { |
2388 var i = 0, |
2160 var i = 0, |
2389 len = tokens.length, |
2161 len = tokens.length, |
2390 selector = ""; |
2162 selector = ""; |
2413 return false; |
2185 return false; |
2414 } : |
2186 } : |
2415 |
2187 |
2416 // Check against all ancestor/preceding elements |
2188 // Check against all ancestor/preceding elements |
2417 function( elem, context, xml ) { |
2189 function( elem, context, xml ) { |
2418 var oldCache, uniqueCache, outerCache, |
2190 var oldCache, outerCache, |
2419 newCache = [ dirruns, doneName ]; |
2191 newCache = [ dirruns, doneName ]; |
2420 |
2192 |
2421 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching |
2193 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching |
2422 if ( xml ) { |
2194 if ( xml ) { |
2423 while ( ( elem = elem[ dir ] ) ) { |
2195 while ( ( elem = elem[ dir ] ) ) { |
2430 } else { |
2202 } else { |
2431 while ( ( elem = elem[ dir ] ) ) { |
2203 while ( ( elem = elem[ dir ] ) ) { |
2432 if ( elem.nodeType === 1 || checkNonElements ) { |
2204 if ( elem.nodeType === 1 || checkNonElements ) { |
2433 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); |
2205 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); |
2434 |
2206 |
2435 // Support: IE <9 only |
2207 if ( skip && nodeName( elem, skip ) ) { |
2436 // Defend against cloned attroperties (jQuery gh-1709) |
|
2437 uniqueCache = outerCache[ elem.uniqueID ] || |
|
2438 ( outerCache[ elem.uniqueID ] = {} ); |
|
2439 |
|
2440 if ( skip && skip === elem.nodeName.toLowerCase() ) { |
|
2441 elem = elem[ dir ] || elem; |
2208 elem = elem[ dir ] || elem; |
2442 } else if ( ( oldCache = uniqueCache[ key ] ) && |
2209 } else if ( ( oldCache = outerCache[ key ] ) && |
2443 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { |
2210 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { |
2444 |
2211 |
2445 // Assign to newCache so results back-propagate to previous elements |
2212 // Assign to newCache so results back-propagate to previous elements |
2446 return ( newCache[ 2 ] = oldCache[ 2 ] ); |
2213 return ( newCache[ 2 ] = oldCache[ 2 ] ); |
2447 } else { |
2214 } else { |
2448 |
2215 |
2449 // Reuse newcache so results back-propagate to previous elements |
2216 // Reuse newcache so results back-propagate to previous elements |
2450 uniqueCache[ key ] = newCache; |
2217 outerCache[ key ] = newCache; |
2451 |
2218 |
2452 // A match means we're done; a fail means we have to keep checking |
2219 // A match means we're done; a fail means we have to keep checking |
2453 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { |
2220 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { |
2454 return true; |
2221 return true; |
2455 } |
2222 } |
2477 |
2244 |
2478 function multipleContexts( selector, contexts, results ) { |
2245 function multipleContexts( selector, contexts, results ) { |
2479 var i = 0, |
2246 var i = 0, |
2480 len = contexts.length; |
2247 len = contexts.length; |
2481 for ( ; i < len; i++ ) { |
2248 for ( ; i < len; i++ ) { |
2482 Sizzle( selector, contexts[ i ], results ); |
2249 find( selector, contexts[ i ], results ); |
2483 } |
2250 } |
2484 return results; |
2251 return results; |
2485 } |
2252 } |
2486 |
2253 |
2487 function condense( unmatched, map, filter, context, xml ) { |
2254 function condense( unmatched, map, filter, context, xml ) { |
2511 } |
2278 } |
2512 if ( postFinder && !postFinder[ expando ] ) { |
2279 if ( postFinder && !postFinder[ expando ] ) { |
2513 postFinder = setMatcher( postFinder, postSelector ); |
2280 postFinder = setMatcher( postFinder, postSelector ); |
2514 } |
2281 } |
2515 return markFunction( function( seed, results, context, xml ) { |
2282 return markFunction( function( seed, results, context, xml ) { |
2516 var temp, i, elem, |
2283 var temp, i, elem, matcherOut, |
2517 preMap = [], |
2284 preMap = [], |
2518 postMap = [], |
2285 postMap = [], |
2519 preexisting = results.length, |
2286 preexisting = results.length, |
2520 |
2287 |
2521 // Get initial elements from seed or context |
2288 // Get initial elements from seed or context |
2522 elems = seed || multipleContexts( |
2289 elems = seed || |
2523 selector || "*", |
2290 multipleContexts( selector || "*", |
2524 context.nodeType ? [ context ] : context, |
2291 context.nodeType ? [ context ] : context, [] ), |
2525 [] |
|
2526 ), |
|
2527 |
2292 |
2528 // Prefilter to get matcher input, preserving a map for seed-results synchronization |
2293 // Prefilter to get matcher input, preserving a map for seed-results synchronization |
2529 matcherIn = preFilter && ( seed || !selector ) ? |
2294 matcherIn = preFilter && ( seed || !selector ) ? |
2530 condense( elems, preMap, preFilter, context, xml ) : |
2295 condense( elems, preMap, preFilter, context, xml ) : |
2531 elems, |
2296 elems; |
2532 |
2297 |
2533 matcherOut = matcher ? |
|
2534 |
|
2535 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, |
|
2536 postFinder || ( seed ? preFilter : preexisting || postFilter ) ? |
|
2537 |
|
2538 // ...intermediate processing is necessary |
|
2539 [] : |
|
2540 |
|
2541 // ...otherwise use results directly |
|
2542 results : |
|
2543 matcherIn; |
|
2544 |
|
2545 // Find primary matches |
|
2546 if ( matcher ) { |
2298 if ( matcher ) { |
2299 |
|
2300 // If we have a postFinder, or filtered seed, or non-seed postFilter |
|
2301 // or preexisting results, |
|
2302 matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ? |
|
2303 |
|
2304 // ...intermediate processing is necessary |
|
2305 [] : |
|
2306 |
|
2307 // ...otherwise use results directly |
|
2308 results; |
|
2309 |
|
2310 // Find primary matches |
|
2547 matcher( matcherIn, matcherOut, context, xml ); |
2311 matcher( matcherIn, matcherOut, context, xml ); |
2312 } else { |
|
2313 matcherOut = matcherIn; |
|
2548 } |
2314 } |
2549 |
2315 |
2550 // Apply postFilter |
2316 // Apply postFilter |
2551 if ( postFilter ) { |
2317 if ( postFilter ) { |
2552 temp = condense( matcherOut, postMap ); |
2318 temp = condense( matcherOut, postMap ); |
2580 |
2346 |
2581 // Move matched elements from seed to results to keep them synchronized |
2347 // Move matched elements from seed to results to keep them synchronized |
2582 i = matcherOut.length; |
2348 i = matcherOut.length; |
2583 while ( i-- ) { |
2349 while ( i-- ) { |
2584 if ( ( elem = matcherOut[ i ] ) && |
2350 if ( ( elem = matcherOut[ i ] ) && |
2585 ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) { |
2351 ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) { |
2586 |
2352 |
2587 seed[ temp ] = !( results[ temp ] = elem ); |
2353 seed[ temp ] = !( results[ temp ] = elem ); |
2588 } |
2354 } |
2589 } |
2355 } |
2590 } |
2356 } |
2615 // The foundational matcher ensures that elements are reachable from top-level context(s) |
2381 // The foundational matcher ensures that elements are reachable from top-level context(s) |
2616 matchContext = addCombinator( function( elem ) { |
2382 matchContext = addCombinator( function( elem ) { |
2617 return elem === checkContext; |
2383 return elem === checkContext; |
2618 }, implicitRelative, true ), |
2384 }, implicitRelative, true ), |
2619 matchAnyContext = addCombinator( function( elem ) { |
2385 matchAnyContext = addCombinator( function( elem ) { |
2620 return indexOf( checkContext, elem ) > -1; |
2386 return indexOf.call( checkContext, elem ) > -1; |
2621 }, implicitRelative, true ), |
2387 }, implicitRelative, true ), |
2622 matchers = [ function( elem, context, xml ) { |
2388 matchers = [ function( elem, context, xml ) { |
2623 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( |
2389 |
2390 // Support: IE 11+, Edge 17 - 18+ |
|
2391 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
|
2392 // two documents; shallow comparisons work. |
|
2393 // eslint-disable-next-line eqeqeq |
|
2394 var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || ( |
|
2624 ( checkContext = context ).nodeType ? |
2395 ( checkContext = context ).nodeType ? |
2625 matchContext( elem, context, xml ) : |
2396 matchContext( elem, context, xml ) : |
2626 matchAnyContext( elem, context, xml ) ); |
2397 matchAnyContext( elem, context, xml ) ); |
2627 |
2398 |
2628 // Avoid hanging onto element (issue #299) |
2399 // Avoid hanging onto element |
2400 // (see https://github.com/jquery/sizzle/issues/299) |
|
2629 checkContext = null; |
2401 checkContext = null; |
2630 return ret; |
2402 return ret; |
2631 } ]; |
2403 } ]; |
2632 |
2404 |
2633 for ( ; i < len; i++ ) { |
2405 for ( ; i < len; i++ ) { |
2648 } |
2420 } |
2649 return setMatcher( |
2421 return setMatcher( |
2650 i > 1 && elementMatcher( matchers ), |
2422 i > 1 && elementMatcher( matchers ), |
2651 i > 1 && toSelector( |
2423 i > 1 && toSelector( |
2652 |
2424 |
2653 // If the preceding token was a descendant combinator, insert an implicit any-element `*` |
2425 // If the preceding token was a descendant combinator, insert an implicit any-element `*` |
2654 tokens |
2426 tokens.slice( 0, i - 1 ) |
2655 .slice( 0, i - 1 ) |
2427 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) |
2656 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) |
2428 ).replace( rtrimCSS, "$1" ), |
2657 ).replace( rtrim, "$1" ), |
|
2658 matcher, |
2429 matcher, |
2659 i < j && matcherFromTokens( tokens.slice( i, j ) ), |
2430 i < j && matcherFromTokens( tokens.slice( i, j ) ), |
2660 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), |
2431 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), |
2661 j < len && toSelector( tokens ) |
2432 j < len && toSelector( tokens ) |
2662 ); |
2433 ); |
2678 unmatched = seed && [], |
2449 unmatched = seed && [], |
2679 setMatched = [], |
2450 setMatched = [], |
2680 contextBackup = outermostContext, |
2451 contextBackup = outermostContext, |
2681 |
2452 |
2682 // We must always have either seed elements or outermost context |
2453 // We must always have either seed elements or outermost context |
2683 elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ), |
2454 elems = seed || byElement && Expr.find.TAG( "*", outermost ), |
2684 |
2455 |
2685 // Use integer dirruns iff this is the outermost matcher |
2456 // Use integer dirruns iff this is the outermost matcher |
2686 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), |
2457 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), |
2687 len = elems.length; |
2458 len = elems.length; |
2688 |
2459 |
2694 // eslint-disable-next-line eqeqeq |
2465 // eslint-disable-next-line eqeqeq |
2695 outermostContext = context == document || context || outermost; |
2466 outermostContext = context == document || context || outermost; |
2696 } |
2467 } |
2697 |
2468 |
2698 // Add elements passing elementMatchers directly to results |
2469 // Add elements passing elementMatchers directly to results |
2699 // Support: IE<9, Safari |
2470 // Support: iOS <=7 - 9 only |
2700 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id |
2471 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching |
2472 // elements by id. (see trac-14142) |
|
2701 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { |
2473 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { |
2702 if ( byElement && elem ) { |
2474 if ( byElement && elem ) { |
2703 j = 0; |
2475 j = 0; |
2704 |
2476 |
2705 // Support: IE 11+, Edge 17 - 18+ |
2477 // Support: IE 11+, Edge 17 - 18+ |
2710 setDocument( elem ); |
2482 setDocument( elem ); |
2711 xml = !documentIsHTML; |
2483 xml = !documentIsHTML; |
2712 } |
2484 } |
2713 while ( ( matcher = elementMatchers[ j++ ] ) ) { |
2485 while ( ( matcher = elementMatchers[ j++ ] ) ) { |
2714 if ( matcher( elem, context || document, xml ) ) { |
2486 if ( matcher( elem, context || document, xml ) ) { |
2715 results.push( elem ); |
2487 push.call( results, elem ); |
2716 break; |
2488 break; |
2717 } |
2489 } |
2718 } |
2490 } |
2719 if ( outermost ) { |
2491 if ( outermost ) { |
2720 dirruns = dirrunsUnique; |
2492 dirruns = dirrunsUnique; |
2773 |
2545 |
2774 // Seedless set matches succeeding multiple successful matchers stipulate sorting |
2546 // Seedless set matches succeeding multiple successful matchers stipulate sorting |
2775 if ( outermost && !seed && setMatched.length > 0 && |
2547 if ( outermost && !seed && setMatched.length > 0 && |
2776 ( matchedCount + setMatchers.length ) > 1 ) { |
2548 ( matchedCount + setMatchers.length ) > 1 ) { |
2777 |
2549 |
2778 Sizzle.uniqueSort( results ); |
2550 jQuery.uniqueSort( results ); |
2779 } |
2551 } |
2780 } |
2552 } |
2781 |
2553 |
2782 // Override manipulation of globals by nested matchers |
2554 // Override manipulation of globals by nested matchers |
2783 if ( outermost ) { |
2555 if ( outermost ) { |
2791 return bySet ? |
2563 return bySet ? |
2792 markFunction( superMatcher ) : |
2564 markFunction( superMatcher ) : |
2793 superMatcher; |
2565 superMatcher; |
2794 } |
2566 } |
2795 |
2567 |
2796 compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { |
2568 function compile( selector, match /* Internal Use Only */ ) { |
2797 var i, |
2569 var i, |
2798 setMatchers = [], |
2570 setMatchers = [], |
2799 elementMatchers = [], |
2571 elementMatchers = [], |
2800 cached = compilerCache[ selector + " " ]; |
2572 cached = compilerCache[ selector + " " ]; |
2801 |
2573 |
2814 elementMatchers.push( cached ); |
2586 elementMatchers.push( cached ); |
2815 } |
2587 } |
2816 } |
2588 } |
2817 |
2589 |
2818 // Cache the compiled function |
2590 // Cache the compiled function |
2819 cached = compilerCache( |
2591 cached = compilerCache( selector, |
2820 selector, |
2592 matcherFromGroupMatchers( elementMatchers, setMatchers ) ); |
2821 matcherFromGroupMatchers( elementMatchers, setMatchers ) |
|
2822 ); |
|
2823 |
2593 |
2824 // Save selector and tokenization |
2594 // Save selector and tokenization |
2825 cached.selector = selector; |
2595 cached.selector = selector; |
2826 } |
2596 } |
2827 return cached; |
2597 return cached; |
2828 }; |
2598 } |
2829 |
2599 |
2830 /** |
2600 /** |
2831 * A low-level selection function that works with Sizzle's compiled |
2601 * A low-level selection function that works with jQuery's compiled |
2832 * selector functions |
2602 * selector functions |
2833 * @param {String|Function} selector A selector or a pre-compiled |
2603 * @param {String|Function} selector A selector or a pre-compiled |
2834 * selector function built with Sizzle.compile |
2604 * selector function built with jQuery selector compile |
2835 * @param {Element} context |
2605 * @param {Element} context |
2836 * @param {Array} [results] |
2606 * @param {Array} [results] |
2837 * @param {Array} [seed] A set of elements to match against |
2607 * @param {Array} [seed] A set of elements to match against |
2838 */ |
2608 */ |
2839 select = Sizzle.select = function( selector, context, results, seed ) { |
2609 function select( selector, context, results, seed ) { |
2840 var i, tokens, token, type, find, |
2610 var i, tokens, token, type, find, |
2841 compiled = typeof selector === "function" && selector, |
2611 compiled = typeof selector === "function" && selector, |
2842 match = !seed && tokenize( ( selector = compiled.selector || selector ) ); |
2612 match = !seed && tokenize( ( selector = compiled.selector || selector ) ); |
2843 |
2613 |
2844 results = results || []; |
2614 results = results || []; |
2848 if ( match.length === 1 ) { |
2618 if ( match.length === 1 ) { |
2849 |
2619 |
2850 // Reduce context if the leading compound selector is an ID |
2620 // Reduce context if the leading compound selector is an ID |
2851 tokens = match[ 0 ] = match[ 0 ].slice( 0 ); |
2621 tokens = match[ 0 ] = match[ 0 ].slice( 0 ); |
2852 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && |
2622 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && |
2853 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { |
2623 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { |
2854 |
2624 |
2855 context = ( Expr.find[ "ID" ]( token.matches[ 0 ] |
2625 context = ( Expr.find.ID( |
2856 .replace( runescape, funescape ), context ) || [] )[ 0 ]; |
2626 token.matches[ 0 ].replace( runescape, funescape ), |
2627 context |
|
2628 ) || [] )[ 0 ]; |
|
2857 if ( !context ) { |
2629 if ( !context ) { |
2858 return results; |
2630 return results; |
2859 |
2631 |
2860 // Precompiled matchers will still verify ancestry, so step up a level |
2632 // Precompiled matchers will still verify ancestry, so step up a level |
2861 } else if ( compiled ) { |
2633 } else if ( compiled ) { |
2864 |
2636 |
2865 selector = selector.slice( tokens.shift().value.length ); |
2637 selector = selector.slice( tokens.shift().value.length ); |
2866 } |
2638 } |
2867 |
2639 |
2868 // Fetch a seed set for right-to-left matching |
2640 // Fetch a seed set for right-to-left matching |
2869 i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length; |
2641 i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length; |
2870 while ( i-- ) { |
2642 while ( i-- ) { |
2871 token = tokens[ i ]; |
2643 token = tokens[ i ]; |
2872 |
2644 |
2873 // Abort if we hit a combinator |
2645 // Abort if we hit a combinator |
2874 if ( Expr.relative[ ( type = token.type ) ] ) { |
2646 if ( Expr.relative[ ( type = token.type ) ] ) { |
2877 if ( ( find = Expr.find[ type ] ) ) { |
2649 if ( ( find = Expr.find[ type ] ) ) { |
2878 |
2650 |
2879 // Search, expanding context for leading sibling combinators |
2651 // Search, expanding context for leading sibling combinators |
2880 if ( ( seed = find( |
2652 if ( ( seed = find( |
2881 token.matches[ 0 ].replace( runescape, funescape ), |
2653 token.matches[ 0 ].replace( runescape, funescape ), |
2882 rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) || |
2654 rsibling.test( tokens[ 0 ].type ) && |
2883 context |
2655 testContext( context.parentNode ) || context |
2884 ) ) ) { |
2656 ) ) ) { |
2885 |
2657 |
2886 // If seed is empty or no tokens remain, we can return early |
2658 // If seed is empty or no tokens remain, we can return early |
2887 tokens.splice( i, 1 ); |
2659 tokens.splice( i, 1 ); |
2888 selector = seed.length && toSelector( tokens ); |
2660 selector = seed.length && toSelector( tokens ); |
2905 !documentIsHTML, |
2677 !documentIsHTML, |
2906 results, |
2678 results, |
2907 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context |
2679 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context |
2908 ); |
2680 ); |
2909 return results; |
2681 return results; |
2910 }; |
2682 } |
2911 |
2683 |
2912 // One-time assignments |
2684 // One-time assignments |
2913 |
2685 |
2686 // Support: Android <=4.0 - 4.1+ |
|
2914 // Sort stability |
2687 // Sort stability |
2915 support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; |
2688 support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; |
2916 |
2689 |
2917 // Support: Chrome 14-35+ |
|
2918 // Always assume duplicates if they aren't passed to the comparison function |
|
2919 support.detectDuplicates = !!hasDuplicate; |
|
2920 |
|
2921 // Initialize against the default document |
2690 // Initialize against the default document |
2922 setDocument(); |
2691 setDocument(); |
2923 |
2692 |
2924 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) |
2693 // Support: Android <=4.0 - 4.1+ |
2925 // Detached nodes confoundingly follow *each other* |
2694 // Detached nodes confoundingly follow *each other* |
2926 support.sortDetached = assert( function( el ) { |
2695 support.sortDetached = assert( function( el ) { |
2927 |
2696 |
2928 // Should return 1, but returns 4 (following) |
2697 // Should return 1, but returns 4 (following) |
2929 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; |
2698 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; |
2930 } ); |
2699 } ); |
2931 |
2700 |
2932 // Support: IE<8 |
2701 jQuery.find = find; |
2933 // Prevent attribute/property "interpolation" |
|
2934 // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx |
|
2935 if ( !assert( function( el ) { |
|
2936 el.innerHTML = "<a href='#'></a>"; |
|
2937 return el.firstChild.getAttribute( "href" ) === "#"; |
|
2938 } ) ) { |
|
2939 addHandle( "type|href|height|width", function( elem, name, isXML ) { |
|
2940 if ( !isXML ) { |
|
2941 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); |
|
2942 } |
|
2943 } ); |
|
2944 } |
|
2945 |
|
2946 // Support: IE<9 |
|
2947 // Use defaultValue in place of getAttribute("value") |
|
2948 if ( !support.attributes || !assert( function( el ) { |
|
2949 el.innerHTML = "<input/>"; |
|
2950 el.firstChild.setAttribute( "value", "" ); |
|
2951 return el.firstChild.getAttribute( "value" ) === ""; |
|
2952 } ) ) { |
|
2953 addHandle( "value", function( elem, _name, isXML ) { |
|
2954 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { |
|
2955 return elem.defaultValue; |
|
2956 } |
|
2957 } ); |
|
2958 } |
|
2959 |
|
2960 // Support: IE<9 |
|
2961 // Use getAttributeNode to fetch booleans when getAttribute lies |
|
2962 if ( !assert( function( el ) { |
|
2963 return el.getAttribute( "disabled" ) == null; |
|
2964 } ) ) { |
|
2965 addHandle( booleans, function( elem, name, isXML ) { |
|
2966 var val; |
|
2967 if ( !isXML ) { |
|
2968 return elem[ name ] === true ? name.toLowerCase() : |
|
2969 ( val = elem.getAttributeNode( name ) ) && val.specified ? |
|
2970 val.value : |
|
2971 null; |
|
2972 } |
|
2973 } ); |
|
2974 } |
|
2975 |
|
2976 return Sizzle; |
|
2977 |
|
2978 } )( window ); |
|
2979 |
|
2980 |
|
2981 |
|
2982 jQuery.find = Sizzle; |
|
2983 jQuery.expr = Sizzle.selectors; |
|
2984 |
2702 |
2985 // Deprecated |
2703 // Deprecated |
2986 jQuery.expr[ ":" ] = jQuery.expr.pseudos; |
2704 jQuery.expr[ ":" ] = jQuery.expr.pseudos; |
2987 jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; |
2705 jQuery.unique = jQuery.uniqueSort; |
2988 jQuery.text = Sizzle.getText; |
2706 |
2989 jQuery.isXMLDoc = Sizzle.isXML; |
2707 // These have always been private, but they used to be documented as part of |
2990 jQuery.contains = Sizzle.contains; |
2708 // Sizzle so let's maintain them for now for backwards compatibility purposes. |
2991 jQuery.escapeSelector = Sizzle.escape; |
2709 find.compile = compile; |
2992 |
2710 find.select = select; |
2993 |
2711 find.setDocument = setDocument; |
2712 find.tokenize = tokenize; |
|
2713 |
|
2714 find.escape = jQuery.escapeSelector; |
|
2715 find.getText = jQuery.text; |
|
2716 find.isXML = jQuery.isXMLDoc; |
|
2717 find.selectors = jQuery.expr; |
|
2718 find.support = jQuery.support; |
|
2719 find.uniqueSort = jQuery.uniqueSort; |
|
2720 |
|
2721 /* eslint-enable */ |
|
2722 |
|
2723 } )(); |
|
2994 |
2724 |
2995 |
2725 |
2996 var dir = function( elem, dir, until ) { |
2726 var dir = function( elem, dir, until ) { |
2997 var matched = [], |
2727 var matched = [], |
2998 truncate = until !== undefined; |
2728 truncate = until !== undefined; |
3022 }; |
2752 }; |
3023 |
2753 |
3024 |
2754 |
3025 var rneedsContext = jQuery.expr.match.needsContext; |
2755 var rneedsContext = jQuery.expr.match.needsContext; |
3026 |
2756 |
3027 |
|
3028 |
|
3029 function nodeName( elem, name ) { |
|
3030 |
|
3031 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); |
|
3032 |
|
3033 } |
|
3034 var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); |
2757 var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); |
3035 |
2758 |
3036 |
2759 |
3037 |
2760 |
3038 // Implement the identical functionality for filter and not |
2761 // Implement the identical functionality for filter and not |
3127 |
2850 |
3128 // A central reference to the root jQuery(document) |
2851 // A central reference to the root jQuery(document) |
3129 var rootjQuery, |
2852 var rootjQuery, |
3130 |
2853 |
3131 // A simple way to check for HTML strings |
2854 // A simple way to check for HTML strings |
3132 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) |
2855 // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521) |
3133 // Strict HTML recognition (#11290: must start with <) |
2856 // Strict HTML recognition (trac-11290: must start with <) |
3134 // Shortcut simple #id case for speed |
2857 // Shortcut simple #id case for speed |
3135 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, |
2858 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, |
3136 |
2859 |
3137 init = jQuery.fn.init = function( selector, context, root ) { |
2860 init = jQuery.fn.init = function( selector, context, root ) { |
3138 var match, elem; |
2861 var match, elem; |
3279 |
3002 |
3280 // Always skip document fragments |
3003 // Always skip document fragments |
3281 if ( cur.nodeType < 11 && ( targets ? |
3004 if ( cur.nodeType < 11 && ( targets ? |
3282 targets.index( cur ) > -1 : |
3005 targets.index( cur ) > -1 : |
3283 |
3006 |
3284 // Don't pass non-elements to Sizzle |
3007 // Don't pass non-elements to jQuery#find |
3285 cur.nodeType === 1 && |
3008 cur.nodeType === 1 && |
3286 jQuery.find.matchesSelector( cur, selectors ) ) ) { |
3009 jQuery.find.matchesSelector( cur, selectors ) ) ) { |
3287 |
3010 |
3288 matched.push( cur ); |
3011 matched.push( cur ); |
3289 break; |
3012 break; |
3834 mightThrow(); |
3557 mightThrow(); |
3835 } catch ( e ) { |
3558 } catch ( e ) { |
3836 |
3559 |
3837 if ( jQuery.Deferred.exceptionHook ) { |
3560 if ( jQuery.Deferred.exceptionHook ) { |
3838 jQuery.Deferred.exceptionHook( e, |
3561 jQuery.Deferred.exceptionHook( e, |
3839 process.stackTrace ); |
3562 process.error ); |
3840 } |
3563 } |
3841 |
3564 |
3842 // Support: Promises/A+ section 2.3.3.3.4.1 |
3565 // Support: Promises/A+ section 2.3.3.3.4.1 |
3843 // https://promisesaplus.com/#point-61 |
3566 // https://promisesaplus.com/#point-61 |
3844 // Ignore post-resolution exceptions |
3567 // Ignore post-resolution exceptions |
3862 // subsequent errors |
3585 // subsequent errors |
3863 if ( depth ) { |
3586 if ( depth ) { |
3864 process(); |
3587 process(); |
3865 } else { |
3588 } else { |
3866 |
3589 |
3867 // Call an optional hook to record the stack, in case of exception |
3590 // Call an optional hook to record the error, in case of exception |
3868 // since it's otherwise lost when execution goes async |
3591 // since it's otherwise lost when execution goes async |
3869 if ( jQuery.Deferred.getStackHook ) { |
3592 if ( jQuery.Deferred.getErrorHook ) { |
3870 process.stackTrace = jQuery.Deferred.getStackHook(); |
3593 process.error = jQuery.Deferred.getErrorHook(); |
3594 |
|
3595 // The deprecated alias of the above. While the name suggests |
|
3596 // returning the stack, not an error instance, jQuery just passes |
|
3597 // it directly to `console.warn` so both will work; an instance |
|
3598 // just better cooperates with source maps. |
|
3599 } else if ( jQuery.Deferred.getStackHook ) { |
|
3600 process.error = jQuery.Deferred.getStackHook(); |
|
3871 } |
3601 } |
3872 window.setTimeout( process ); |
3602 window.setTimeout( process ); |
3873 } |
3603 } |
3874 }; |
3604 }; |
3875 } |
3605 } |
4040 |
3770 |
4041 // These usually indicate a programmer mistake during development, |
3771 // These usually indicate a programmer mistake during development, |
4042 // warn about them ASAP rather than swallowing them by default. |
3772 // warn about them ASAP rather than swallowing them by default. |
4043 var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; |
3773 var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; |
4044 |
3774 |
4045 jQuery.Deferred.exceptionHook = function( error, stack ) { |
3775 // If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error |
3776 // captured before the async barrier to get the original error cause |
|
3777 // which may otherwise be hidden. |
|
3778 jQuery.Deferred.exceptionHook = function( error, asyncError ) { |
|
4046 |
3779 |
4047 // Support: IE 8 - 9 only |
3780 // Support: IE 8 - 9 only |
4048 // Console exists when dev tools are open, which can happen at any time |
3781 // Console exists when dev tools are open, which can happen at any time |
4049 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { |
3782 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { |
4050 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); |
3783 window.console.warn( "jQuery.Deferred exception: " + error.message, |
3784 error.stack, asyncError ); |
|
4051 } |
3785 } |
4052 }; |
3786 }; |
4053 |
3787 |
4054 |
3788 |
4055 |
3789 |
4085 |
3819 |
4086 // Is the DOM ready to be used? Set to true once it occurs. |
3820 // Is the DOM ready to be used? Set to true once it occurs. |
4087 isReady: false, |
3821 isReady: false, |
4088 |
3822 |
4089 // A counter to track how many items to wait for before |
3823 // A counter to track how many items to wait for before |
4090 // the ready event fires. See #6781 |
3824 // the ready event fires. See trac-6781 |
4091 readyWait: 1, |
3825 readyWait: 1, |
4092 |
3826 |
4093 // Handle when the DOM is ready |
3827 // Handle when the DOM is ready |
4094 ready: function( wait ) { |
3828 ready: function( wait ) { |
4095 |
3829 |
4213 return letter.toUpperCase(); |
3947 return letter.toUpperCase(); |
4214 } |
3948 } |
4215 |
3949 |
4216 // Convert dashed to camelCase; used by the css and data modules |
3950 // Convert dashed to camelCase; used by the css and data modules |
4217 // Support: IE <=9 - 11, Edge 12 - 15 |
3951 // Support: IE <=9 - 11, Edge 12 - 15 |
4218 // Microsoft forgot to hump their vendor prefix (#9572) |
3952 // Microsoft forgot to hump their vendor prefix (trac-9572) |
4219 function camelCase( string ) { |
3953 function camelCase( string ) { |
4220 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); |
3954 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); |
4221 } |
3955 } |
4222 var acceptData = function( owner ) { |
3956 var acceptData = function( owner ) { |
4223 |
3957 |
4249 // If not, create one |
3983 // If not, create one |
4250 if ( !value ) { |
3984 if ( !value ) { |
4251 value = {}; |
3985 value = {}; |
4252 |
3986 |
4253 // We can accept data for non-element nodes in modern browsers, |
3987 // We can accept data for non-element nodes in modern browsers, |
4254 // but we should not, see #8335. |
3988 // but we should not, see trac-8335. |
4255 // Always return an empty object. |
3989 // Always return an empty object. |
4256 if ( acceptData( owner ) ) { |
3990 if ( acceptData( owner ) ) { |
4257 |
3991 |
4258 // If it is a node unlikely to be stringify-ed or looped over |
3992 // If it is a node unlikely to be stringify-ed or looped over |
4259 // use plain assignment |
3993 // use plain assignment |
4488 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { |
4222 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { |
4489 i = attrs.length; |
4223 i = attrs.length; |
4490 while ( i-- ) { |
4224 while ( i-- ) { |
4491 |
4225 |
4492 // Support: IE 11 only |
4226 // Support: IE 11 only |
4493 // The attrs elements can be null (#14894) |
4227 // The attrs elements can be null (trac-14894) |
4494 if ( attrs[ i ] ) { |
4228 if ( attrs[ i ] ) { |
4495 name = attrs[ i ].name; |
4229 name = attrs[ i ].name; |
4496 if ( name.indexOf( "data-" ) === 0 ) { |
4230 if ( name.indexOf( "data-" ) === 0 ) { |
4497 name = camelCase( name.slice( 5 ) ); |
4231 name = camelCase( name.slice( 5 ) ); |
4498 dataAttr( elem, name, data[ name ] ); |
4232 dataAttr( elem, name, data[ name ] ); |
4911 var fragment = document.createDocumentFragment(), |
4645 var fragment = document.createDocumentFragment(), |
4912 div = fragment.appendChild( document.createElement( "div" ) ), |
4646 div = fragment.appendChild( document.createElement( "div" ) ), |
4913 input = document.createElement( "input" ); |
4647 input = document.createElement( "input" ); |
4914 |
4648 |
4915 // Support: Android 4.0 - 4.3 only |
4649 // Support: Android 4.0 - 4.3 only |
4916 // Check state lost if the name is set (#11217) |
4650 // Check state lost if the name is set (trac-11217) |
4917 // Support: Windows Web Apps (WWA) |
4651 // Support: Windows Web Apps (WWA) |
4918 // `name` and `type` must use .setAttribute for WWA (#14901) |
4652 // `name` and `type` must use .setAttribute for WWA (trac-14901) |
4919 input.setAttribute( "type", "radio" ); |
4653 input.setAttribute( "type", "radio" ); |
4920 input.setAttribute( "checked", "checked" ); |
4654 input.setAttribute( "checked", "checked" ); |
4921 input.setAttribute( "name", "t" ); |
4655 input.setAttribute( "name", "t" ); |
4922 |
4656 |
4923 div.appendChild( input ); |
4657 div.appendChild( input ); |
4937 div.innerHTML = "<option></option>"; |
4671 div.innerHTML = "<option></option>"; |
4938 support.option = !!div.lastChild; |
4672 support.option = !!div.lastChild; |
4939 } )(); |
4673 } )(); |
4940 |
4674 |
4941 |
4675 |
4942 // We have to close these tags to support XHTML (#13200) |
4676 // We have to close these tags to support XHTML (trac-13200) |
4943 var wrapMap = { |
4677 var wrapMap = { |
4944 |
4678 |
4945 // XHTML parsers do not magically insert elements in the |
4679 // XHTML parsers do not magically insert elements in the |
4946 // same way that tag soup parsers do. So we cannot shorten |
4680 // same way that tag soup parsers do. So we cannot shorten |
4947 // this by omitting <tbody> or other required elements. |
4681 // this by omitting <tbody> or other required elements. |
4963 |
4697 |
4964 |
4698 |
4965 function getAll( context, tag ) { |
4699 function getAll( context, tag ) { |
4966 |
4700 |
4967 // Support: IE <=9 - 11 only |
4701 // Support: IE <=9 - 11 only |
4968 // Use typeof to avoid zero-argument method invocation on host objects (#15151) |
4702 // Use typeof to avoid zero-argument method invocation on host objects (trac-15151) |
4969 var ret; |
4703 var ret; |
4970 |
4704 |
4971 if ( typeof context.getElementsByTagName !== "undefined" ) { |
4705 if ( typeof context.getElementsByTagName !== "undefined" ) { |
4972 ret = context.getElementsByTagName( tag || "*" ); |
4706 ret = context.getElementsByTagName( tag || "*" ); |
4973 |
4707 |
5046 jQuery.merge( nodes, tmp.childNodes ); |
4780 jQuery.merge( nodes, tmp.childNodes ); |
5047 |
4781 |
5048 // Remember the top-level container |
4782 // Remember the top-level container |
5049 tmp = fragment.firstChild; |
4783 tmp = fragment.firstChild; |
5050 |
4784 |
5051 // Ensure the created nodes are orphaned (#12392) |
4785 // Ensure the created nodes are orphaned (trac-12392) |
5052 tmp.textContent = ""; |
4786 tmp.textContent = ""; |
5053 } |
4787 } |
5054 } |
4788 } |
5055 } |
4789 } |
5056 |
4790 |
5099 return true; |
4833 return true; |
5100 } |
4834 } |
5101 |
4835 |
5102 function returnFalse() { |
4836 function returnFalse() { |
5103 return false; |
4837 return false; |
5104 } |
|
5105 |
|
5106 // Support: IE <=9 - 11+ |
|
5107 // focus() and blur() are asynchronous, except when they are no-op. |
|
5108 // So expect focus to be synchronous when the element is already active, |
|
5109 // and blur to be synchronous when the element is not already active. |
|
5110 // (focus and blur are always synchronous in other supported browsers, |
|
5111 // this just defines when we can count on it). |
|
5112 function expectSync( elem, type ) { |
|
5113 return ( elem === safeActiveElement() ) === ( type === "focus" ); |
|
5114 } |
|
5115 |
|
5116 // Support: IE <=9 only |
|
5117 // Accessing document.activeElement can throw unexpectedly |
|
5118 // https://bugs.jquery.com/ticket/13393 |
|
5119 function safeActiveElement() { |
|
5120 try { |
|
5121 return document.activeElement; |
|
5122 } catch ( err ) { } |
|
5123 } |
4838 } |
5124 |
4839 |
5125 function on( elem, types, selector, data, fn, one ) { |
4840 function on( elem, types, selector, data, fn, one ) { |
5126 var origFn, type; |
4841 var origFn, type; |
5127 |
4842 |
5467 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) |
5182 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) |
5468 !( event.type === "click" && event.button >= 1 ) ) { |
5183 !( event.type === "click" && event.button >= 1 ) ) { |
5469 |
5184 |
5470 for ( ; cur !== this; cur = cur.parentNode || this ) { |
5185 for ( ; cur !== this; cur = cur.parentNode || this ) { |
5471 |
5186 |
5472 // Don't check non-elements (#13208) |
5187 // Don't check non-elements (trac-13208) |
5473 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) |
5188 // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764) |
5474 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { |
5189 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { |
5475 matchedHandlers = []; |
5190 matchedHandlers = []; |
5476 matchedSelectors = {}; |
5191 matchedSelectors = {}; |
5477 for ( i = 0; i < delegateCount; i++ ) { |
5192 for ( i = 0; i < delegateCount; i++ ) { |
5478 handleObj = handlers[ i ]; |
5193 handleObj = handlers[ i ]; |
5479 |
5194 |
5480 // Don't conflict with Object.prototype properties (#13203) |
5195 // Don't conflict with Object.prototype properties (trac-13203) |
5481 sel = handleObj.selector + " "; |
5196 sel = handleObj.selector + " "; |
5482 |
5197 |
5483 if ( matchedSelectors[ sel ] === undefined ) { |
5198 if ( matchedSelectors[ sel ] === undefined ) { |
5484 matchedSelectors[ sel ] = handleObj.needsContext ? |
5199 matchedSelectors[ sel ] = handleObj.needsContext ? |
5485 jQuery( sel, this ).index( cur ) > -1 : |
5200 jQuery( sel, this ).index( cur ) > -1 : |
5557 // Claim the first handler |
5272 // Claim the first handler |
5558 if ( rcheckableType.test( el.type ) && |
5273 if ( rcheckableType.test( el.type ) && |
5559 el.click && nodeName( el, "input" ) ) { |
5274 el.click && nodeName( el, "input" ) ) { |
5560 |
5275 |
5561 // dataPriv.set( el, "click", ... ) |
5276 // dataPriv.set( el, "click", ... ) |
5562 leverageNative( el, "click", returnTrue ); |
5277 leverageNative( el, "click", true ); |
5563 } |
5278 } |
5564 |
5279 |
5565 // Return false to allow normal processing in the caller |
5280 // Return false to allow normal processing in the caller |
5566 return false; |
5281 return false; |
5567 }, |
5282 }, |
5608 |
5323 |
5609 // Ensure the presence of an event listener that handles manually-triggered |
5324 // Ensure the presence of an event listener that handles manually-triggered |
5610 // synthetic events by interrupting progress until reinvoked in response to |
5325 // synthetic events by interrupting progress until reinvoked in response to |
5611 // *native* events that it fires directly, ensuring that state changes have |
5326 // *native* events that it fires directly, ensuring that state changes have |
5612 // already occurred before other listeners are invoked. |
5327 // already occurred before other listeners are invoked. |
5613 function leverageNative( el, type, expectSync ) { |
5328 function leverageNative( el, type, isSetup ) { |
5614 |
5329 |
5615 // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add |
5330 // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add |
5616 if ( !expectSync ) { |
5331 if ( !isSetup ) { |
5617 if ( dataPriv.get( el, type ) === undefined ) { |
5332 if ( dataPriv.get( el, type ) === undefined ) { |
5618 jQuery.event.add( el, type, returnTrue ); |
5333 jQuery.event.add( el, type, returnTrue ); |
5619 } |
5334 } |
5620 return; |
5335 return; |
5621 } |
5336 } |
5623 // Register the controller as a special universal handler for all event namespaces |
5338 // Register the controller as a special universal handler for all event namespaces |
5624 dataPriv.set( el, type, false ); |
5339 dataPriv.set( el, type, false ); |
5625 jQuery.event.add( el, type, { |
5340 jQuery.event.add( el, type, { |
5626 namespace: false, |
5341 namespace: false, |
5627 handler: function( event ) { |
5342 handler: function( event ) { |
5628 var notAsync, result, |
5343 var result, |
5629 saved = dataPriv.get( this, type ); |
5344 saved = dataPriv.get( this, type ); |
5630 |
5345 |
5631 if ( ( event.isTrigger & 1 ) && this[ type ] ) { |
5346 if ( ( event.isTrigger & 1 ) && this[ type ] ) { |
5632 |
5347 |
5633 // Interrupt processing of the outer synthetic .trigger()ed event |
5348 // Interrupt processing of the outer synthetic .trigger()ed event |
5634 // Saved data should be false in such cases, but might be a leftover capture object |
5349 if ( !saved ) { |
5635 // from an async native handler (gh-4350) |
|
5636 if ( !saved.length ) { |
|
5637 |
5350 |
5638 // Store arguments for use when handling the inner native event |
5351 // Store arguments for use when handling the inner native event |
5639 // There will always be at least one argument (an event object), so this array |
5352 // There will always be at least one argument (an event object), so this array |
5640 // will not be confused with a leftover capture object. |
5353 // will not be confused with a leftover capture object. |
5641 saved = slice.call( arguments ); |
5354 saved = slice.call( arguments ); |
5642 dataPriv.set( this, type, saved ); |
5355 dataPriv.set( this, type, saved ); |
5643 |
5356 |
5644 // Trigger the native event and capture its result |
5357 // Trigger the native event and capture its result |
5645 // Support: IE <=9 - 11+ |
|
5646 // focus() and blur() are asynchronous |
|
5647 notAsync = expectSync( this, type ); |
|
5648 this[ type ](); |
5358 this[ type ](); |
5649 result = dataPriv.get( this, type ); |
5359 result = dataPriv.get( this, type ); |
5650 if ( saved !== result || notAsync ) { |
5360 dataPriv.set( this, type, false ); |
5651 dataPriv.set( this, type, false ); |
5361 |
5652 } else { |
|
5653 result = {}; |
|
5654 } |
|
5655 if ( saved !== result ) { |
5362 if ( saved !== result ) { |
5656 |
5363 |
5657 // Cancel the outer synthetic event |
5364 // Cancel the outer synthetic event |
5658 event.stopImmediatePropagation(); |
5365 event.stopImmediatePropagation(); |
5659 event.preventDefault(); |
5366 event.preventDefault(); |
5660 |
5367 |
5661 // Support: Chrome 86+ |
5368 return result; |
5662 // In Chrome, if an element having a focusout handler is blurred by |
|
5663 // clicking outside of it, it invokes the handler synchronously. If |
|
5664 // that handler calls `.remove()` on the element, the data is cleared, |
|
5665 // leaving `result` undefined. We need to guard against this. |
|
5666 return result && result.value; |
|
5667 } |
5369 } |
5668 |
5370 |
5669 // If this is an inner synthetic event for an event with a bubbling surrogate |
5371 // If this is an inner synthetic event for an event with a bubbling surrogate |
5670 // (focus or blur), assume that the surrogate already propagated from triggering the |
5372 // (focus or blur), assume that the surrogate already propagated from triggering |
5671 // native event and prevent that from happening again here. |
5373 // the native event and prevent that from happening again here. |
5672 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the |
5374 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the |
5673 // bubbling surrogate propagates *after* the non-bubbling base), but that seems |
5375 // bubbling surrogate propagates *after* the non-bubbling base), but that seems |
5674 // less bad than duplication. |
5376 // less bad than duplication. |
5675 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { |
5377 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { |
5676 event.stopPropagation(); |
5378 event.stopPropagation(); |
5677 } |
5379 } |
5678 |
5380 |
5679 // If this is a native event triggered above, everything is now in order |
5381 // If this is a native event triggered above, everything is now in order |
5680 // Fire an inner synthetic event with the original arguments |
5382 // Fire an inner synthetic event with the original arguments |
5681 } else if ( saved.length ) { |
5383 } else if ( saved ) { |
5682 |
5384 |
5683 // ...and capture the result |
5385 // ...and capture the result |
5684 dataPriv.set( this, type, { |
5386 dataPriv.set( this, type, jQuery.event.trigger( |
5685 value: jQuery.event.trigger( |
5387 saved[ 0 ], |
5686 |
5388 saved.slice( 1 ), |
5687 // Support: IE <=9 - 11+ |
5389 this |
5688 // Extend with the prototype to reset the above stopImmediatePropagation() |
5390 ) ); |
5689 jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), |
5391 |
5690 saved.slice( 1 ), |
5392 // Abort handling of the native event by all jQuery handlers while allowing |
5691 this |
5393 // native handlers on the same element to run. On target, this is achieved |
5692 ) |
5394 // by stopping immediate propagation just on the jQuery event. However, |
5693 } ); |
5395 // the native event is re-wrapped by a jQuery one on each level of the |
5694 |
5396 // propagation so the only way to stop it for jQuery is to stop it for |
5695 // Abort handling of the native event |
5397 // everyone via native `stopPropagation()`. This is not a problem for |
5696 event.stopImmediatePropagation(); |
5398 // focus/blur which don't bubble, but it does also stop click on checkboxes |
5399 // and radios. We accept this limitation. |
|
5400 event.stopPropagation(); |
|
5401 event.isImmediatePropagationStopped = returnTrue; |
|
5697 } |
5402 } |
5698 } |
5403 } |
5699 } ); |
5404 } ); |
5700 } |
5405 } |
5701 |
5406 |
5729 returnTrue : |
5434 returnTrue : |
5730 returnFalse; |
5435 returnFalse; |
5731 |
5436 |
5732 // Create target properties |
5437 // Create target properties |
5733 // Support: Safari <=6 - 7 only |
5438 // Support: Safari <=6 - 7 only |
5734 // Target should not be a text node (#504, #13143) |
5439 // Target should not be a text node (trac-504, trac-13143) |
5735 this.target = ( src.target && src.target.nodeType === 3 ) ? |
5440 this.target = ( src.target && src.target.nodeType === 3 ) ? |
5736 src.target.parentNode : |
5441 src.target.parentNode : |
5737 src.target; |
5442 src.target; |
5738 |
5443 |
5739 this.currentTarget = src.currentTarget; |
5444 this.currentTarget = src.currentTarget; |
5830 touches: true, |
5535 touches: true, |
5831 which: true |
5536 which: true |
5832 }, jQuery.event.addProp ); |
5537 }, jQuery.event.addProp ); |
5833 |
5538 |
5834 jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { |
5539 jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { |
5540 |
|
5541 function focusMappedHandler( nativeEvent ) { |
|
5542 if ( document.documentMode ) { |
|
5543 |
|
5544 // Support: IE 11+ |
|
5545 // Attach a single focusin/focusout handler on the document while someone wants |
|
5546 // focus/blur. This is because the former are synchronous in IE while the latter |
|
5547 // are async. In other browsers, all those handlers are invoked synchronously. |
|
5548 |
|
5549 // `handle` from private data would already wrap the event, but we need |
|
5550 // to change the `type` here. |
|
5551 var handle = dataPriv.get( this, "handle" ), |
|
5552 event = jQuery.event.fix( nativeEvent ); |
|
5553 event.type = nativeEvent.type === "focusin" ? "focus" : "blur"; |
|
5554 event.isSimulated = true; |
|
5555 |
|
5556 // First, handle focusin/focusout |
|
5557 handle( nativeEvent ); |
|
5558 |
|
5559 // ...then, handle focus/blur |
|
5560 // |
|
5561 // focus/blur don't bubble while focusin/focusout do; simulate the former by only |
|
5562 // invoking the handler at the lower level. |
|
5563 if ( event.target === event.currentTarget ) { |
|
5564 |
|
5565 // The setup part calls `leverageNative`, which, in turn, calls |
|
5566 // `jQuery.event.add`, so event handle will already have been set |
|
5567 // by this point. |
|
5568 handle( event ); |
|
5569 } |
|
5570 } else { |
|
5571 |
|
5572 // For non-IE browsers, attach a single capturing handler on the document |
|
5573 // while someone wants focusin/focusout. |
|
5574 jQuery.event.simulate( delegateType, nativeEvent.target, |
|
5575 jQuery.event.fix( nativeEvent ) ); |
|
5576 } |
|
5577 } |
|
5578 |
|
5835 jQuery.event.special[ type ] = { |
5579 jQuery.event.special[ type ] = { |
5836 |
5580 |
5837 // Utilize native event if possible so blur/focus sequence is correct |
5581 // Utilize native event if possible so blur/focus sequence is correct |
5838 setup: function() { |
5582 setup: function() { |
5583 |
|
5584 var attaches; |
|
5839 |
5585 |
5840 // Claim the first handler |
5586 // Claim the first handler |
5841 // dataPriv.set( this, "focus", ... ) |
5587 // dataPriv.set( this, "focus", ... ) |
5842 // dataPriv.set( this, "blur", ... ) |
5588 // dataPriv.set( this, "blur", ... ) |
5843 leverageNative( this, type, expectSync ); |
5589 leverageNative( this, type, true ); |
5844 |
5590 |
5845 // Return false to allow normal processing in the caller |
5591 if ( document.documentMode ) { |
5846 return false; |
5592 |
5593 // Support: IE 9 - 11+ |
|
5594 // We use the same native handler for focusin & focus (and focusout & blur) |
|
5595 // so we need to coordinate setup & teardown parts between those events. |
|
5596 // Use `delegateType` as the key as `type` is already used by `leverageNative`. |
|
5597 attaches = dataPriv.get( this, delegateType ); |
|
5598 if ( !attaches ) { |
|
5599 this.addEventListener( delegateType, focusMappedHandler ); |
|
5600 } |
|
5601 dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 ); |
|
5602 } else { |
|
5603 |
|
5604 // Return false to allow normal processing in the caller |
|
5605 return false; |
|
5606 } |
|
5847 }, |
5607 }, |
5848 trigger: function() { |
5608 trigger: function() { |
5849 |
5609 |
5850 // Force setup before trigger |
5610 // Force setup before trigger |
5851 leverageNative( this, type ); |
5611 leverageNative( this, type ); |
5852 |
5612 |
5853 // Return non-false to allow normal event-path propagation |
5613 // Return non-false to allow normal event-path propagation |
5854 return true; |
5614 return true; |
5855 }, |
5615 }, |
5856 |
5616 |
5857 // Suppress native focus or blur as it's already being fired |
5617 teardown: function() { |
5858 // in leverageNative. |
5618 var attaches; |
5859 _default: function() { |
5619 |
5860 return true; |
5620 if ( document.documentMode ) { |
5621 attaches = dataPriv.get( this, delegateType ) - 1; |
|
5622 if ( !attaches ) { |
|
5623 this.removeEventListener( delegateType, focusMappedHandler ); |
|
5624 dataPriv.remove( this, delegateType ); |
|
5625 } else { |
|
5626 dataPriv.set( this, delegateType, attaches ); |
|
5627 } |
|
5628 } else { |
|
5629 |
|
5630 // Return false to indicate standard teardown should be applied |
|
5631 return false; |
|
5632 } |
|
5861 }, |
5633 }, |
5862 |
5634 |
5635 // Suppress native focus or blur if we're currently inside |
|
5636 // a leveraged native-event stack |
|
5637 _default: function( event ) { |
|
5638 return dataPriv.get( event.target, type ); |
|
5639 }, |
|
5640 |
|
5863 delegateType: delegateType |
5641 delegateType: delegateType |
5642 }; |
|
5643 |
|
5644 // Support: Firefox <=44 |
|
5645 // Firefox doesn't have focus(in | out) events |
|
5646 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 |
|
5647 // |
|
5648 // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 |
|
5649 // focus(in | out) events fire after focus & blur events, |
|
5650 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order |
|
5651 // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 |
|
5652 // |
|
5653 // Support: IE 9 - 11+ |
|
5654 // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch, |
|
5655 // attach a single handler for both events in IE. |
|
5656 jQuery.event.special[ delegateType ] = { |
|
5657 setup: function() { |
|
5658 |
|
5659 // Handle: regular nodes (via `this.ownerDocument`), window |
|
5660 // (via `this.document`) & document (via `this`). |
|
5661 var doc = this.ownerDocument || this.document || this, |
|
5662 dataHolder = document.documentMode ? this : doc, |
|
5663 attaches = dataPriv.get( dataHolder, delegateType ); |
|
5664 |
|
5665 // Support: IE 9 - 11+ |
|
5666 // We use the same native handler for focusin & focus (and focusout & blur) |
|
5667 // so we need to coordinate setup & teardown parts between those events. |
|
5668 // Use `delegateType` as the key as `type` is already used by `leverageNative`. |
|
5669 if ( !attaches ) { |
|
5670 if ( document.documentMode ) { |
|
5671 this.addEventListener( delegateType, focusMappedHandler ); |
|
5672 } else { |
|
5673 doc.addEventListener( type, focusMappedHandler, true ); |
|
5674 } |
|
5675 } |
|
5676 dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 ); |
|
5677 }, |
|
5678 teardown: function() { |
|
5679 var doc = this.ownerDocument || this.document || this, |
|
5680 dataHolder = document.documentMode ? this : doc, |
|
5681 attaches = dataPriv.get( dataHolder, delegateType ) - 1; |
|
5682 |
|
5683 if ( !attaches ) { |
|
5684 if ( document.documentMode ) { |
|
5685 this.removeEventListener( delegateType, focusMappedHandler ); |
|
5686 } else { |
|
5687 doc.removeEventListener( type, focusMappedHandler, true ); |
|
5688 } |
|
5689 dataPriv.remove( dataHolder, delegateType ); |
|
5690 } else { |
|
5691 dataPriv.set( dataHolder, delegateType, attaches ); |
|
5692 } |
|
5693 } |
|
5864 }; |
5694 }; |
5865 } ); |
5695 } ); |
5866 |
5696 |
5867 // Create mouseenter/leave events using mouseover/out and event-time checks |
5697 // Create mouseenter/leave events using mouseover/out and event-time checks |
5868 // so that event delegation works in jQuery. |
5698 // so that event delegation works in jQuery. |
5954 // See https://connect.microsoft.com/IE/feedback/details/1736512/ |
5784 // See https://connect.microsoft.com/IE/feedback/details/1736512/ |
5955 rnoInnerhtml = /<script|<style|<link/i, |
5785 rnoInnerhtml = /<script|<style|<link/i, |
5956 |
5786 |
5957 // checked="checked" or checked |
5787 // checked="checked" or checked |
5958 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, |
5788 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, |
5959 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; |
5789 |
5790 rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g; |
|
5960 |
5791 |
5961 // Prefer a tbody over its parent table for containing new rows |
5792 // Prefer a tbody over its parent table for containing new rows |
5962 function manipulationTarget( elem, content ) { |
5793 function manipulationTarget( elem, content ) { |
5963 if ( nodeName( elem, "table" ) && |
5794 if ( nodeName( elem, "table" ) && |
5964 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { |
5795 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { |
6068 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); |
5899 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); |
6069 hasScripts = scripts.length; |
5900 hasScripts = scripts.length; |
6070 |
5901 |
6071 // Use the original fragment for the last item |
5902 // Use the original fragment for the last item |
6072 // instead of the first because it can end up |
5903 // instead of the first because it can end up |
6073 // being emptied incorrectly in certain situations (#8070). |
5904 // being emptied incorrectly in certain situations (trac-8070). |
6074 for ( ; i < l; i++ ) { |
5905 for ( ; i < l; i++ ) { |
6075 node = fragment; |
5906 node = fragment; |
6076 |
5907 |
6077 if ( i !== iNoClone ) { |
5908 if ( i !== iNoClone ) { |
6078 node = jQuery.clone( node, true, true ); |
5909 node = jQuery.clone( node, true, true ); |
6090 } |
5921 } |
6091 |
5922 |
6092 if ( hasScripts ) { |
5923 if ( hasScripts ) { |
6093 doc = scripts[ scripts.length - 1 ].ownerDocument; |
5924 doc = scripts[ scripts.length - 1 ].ownerDocument; |
6094 |
5925 |
6095 // Reenable scripts |
5926 // Re-enable scripts |
6096 jQuery.map( scripts, restoreScript ); |
5927 jQuery.map( scripts, restoreScript ); |
6097 |
5928 |
6098 // Evaluate executable scripts on first document insertion |
5929 // Evaluate executable scripts on first document insertion |
6099 for ( i = 0; i < hasScripts; i++ ) { |
5930 for ( i = 0; i < hasScripts; i++ ) { |
6100 node = scripts[ i ]; |
5931 node = scripts[ i ]; |
6109 jQuery._evalUrl( node.src, { |
5940 jQuery._evalUrl( node.src, { |
6110 nonce: node.nonce || node.getAttribute( "nonce" ) |
5941 nonce: node.nonce || node.getAttribute( "nonce" ) |
6111 }, doc ); |
5942 }, doc ); |
6112 } |
5943 } |
6113 } else { |
5944 } else { |
5945 |
|
5946 // Unwrap a CDATA section containing script contents. This shouldn't be |
|
5947 // needed as in XML documents they're already not visible when |
|
5948 // inspecting element contents and in HTML documents they have no |
|
5949 // meaning but we're preserving that logic for backwards compatibility. |
|
5950 // This will be removed completely in 4.0. See gh-4904. |
|
6114 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); |
5951 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); |
6115 } |
5952 } |
6116 } |
5953 } |
6117 } |
5954 } |
6118 } |
5955 } |
6155 |
5992 |
6156 // Fix IE cloning issues |
5993 // Fix IE cloning issues |
6157 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && |
5994 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && |
6158 !jQuery.isXMLDoc( elem ) ) { |
5995 !jQuery.isXMLDoc( elem ) ) { |
6159 |
5996 |
6160 // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 |
5997 // We eschew jQuery#find here for performance reasons: |
5998 // https://jsperf.com/getall-vs-sizzle/2 |
|
6161 destElements = getAll( clone ); |
5999 destElements = getAll( clone ); |
6162 srcElements = getAll( elem ); |
6000 srcElements = getAll( elem ); |
6163 |
6001 |
6164 for ( i = 0, l = srcElements.length; i < l; i++ ) { |
6002 for ( i = 0, l = srcElements.length; i < l; i++ ) { |
6165 fixInput( srcElements[ i ], destElements[ i ] ); |
6003 fixInput( srcElements[ i ], destElements[ i ] ); |
6391 return this.pushStack( ret ); |
6229 return this.pushStack( ret ); |
6392 }; |
6230 }; |
6393 } ); |
6231 } ); |
6394 var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); |
6232 var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); |
6395 |
6233 |
6234 var rcustomProp = /^--/; |
|
6235 |
|
6236 |
|
6396 var getStyles = function( elem ) { |
6237 var getStyles = function( elem ) { |
6397 |
6238 |
6398 // Support: IE <=11 only, Firefox <=30 (#15098, #14150) |
6239 // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150) |
6399 // IE throws on elements created in popups |
6240 // IE throws on elements created in popups |
6400 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" |
6241 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" |
6401 var view = elem.ownerDocument.defaultView; |
6242 var view = elem.ownerDocument.defaultView; |
6402 |
6243 |
6403 if ( !view || !view.opener ) { |
6244 if ( !view || !view.opener ) { |
6493 if ( !div.style ) { |
6334 if ( !div.style ) { |
6494 return; |
6335 return; |
6495 } |
6336 } |
6496 |
6337 |
6497 // Support: IE <=9 - 11 only |
6338 // Support: IE <=9 - 11 only |
6498 // Style of cloned element affects source element cloned (#8908) |
6339 // Style of cloned element affects source element cloned (trac-8908) |
6499 div.style.backgroundClip = "content-box"; |
6340 div.style.backgroundClip = "content-box"; |
6500 div.cloneNode( true ).style.backgroundClip = ""; |
6341 div.cloneNode( true ).style.backgroundClip = ""; |
6501 support.clearCloneStyle = div.style.backgroundClip === "content-box"; |
6342 support.clearCloneStyle = div.style.backgroundClip === "content-box"; |
6502 |
6343 |
6503 jQuery.extend( support, { |
6344 jQuery.extend( support, { |
6537 table = document.createElement( "table" ); |
6378 table = document.createElement( "table" ); |
6538 tr = document.createElement( "tr" ); |
6379 tr = document.createElement( "tr" ); |
6539 trChild = document.createElement( "div" ); |
6380 trChild = document.createElement( "div" ); |
6540 |
6381 |
6541 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; |
6382 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; |
6542 tr.style.cssText = "border:1px solid"; |
6383 tr.style.cssText = "box-sizing:content-box;border:1px solid"; |
6543 |
6384 |
6544 // Support: Chrome 86+ |
6385 // Support: Chrome 86+ |
6545 // Height set through cssText does not get applied. |
6386 // Height set through cssText does not get applied. |
6546 // Computed height then comes back as 0. |
6387 // Computed height then comes back as 0. |
6547 tr.style.height = "1px"; |
6388 tr.style.height = "1px"; |
6549 |
6390 |
6550 // Support: Android 8 Chrome 86+ |
6391 // Support: Android 8 Chrome 86+ |
6551 // In our bodyBackground.html iframe, |
6392 // In our bodyBackground.html iframe, |
6552 // display for all div elements is set to "inline", |
6393 // display for all div elements is set to "inline", |
6553 // which causes a problem only in Android 8 Chrome 86. |
6394 // which causes a problem only in Android 8 Chrome 86. |
6554 // Ensuring the div is display: block |
6395 // Ensuring the div is `display: block` |
6555 // gets around this issue. |
6396 // gets around this issue. |
6556 trChild.style.display = "block"; |
6397 trChild.style.display = "block"; |
6557 |
6398 |
6558 documentElement |
6399 documentElement |
6559 .appendChild( table ) |
6400 .appendChild( table ) |
6573 } )(); |
6414 } )(); |
6574 |
6415 |
6575 |
6416 |
6576 function curCSS( elem, name, computed ) { |
6417 function curCSS( elem, name, computed ) { |
6577 var width, minWidth, maxWidth, ret, |
6418 var width, minWidth, maxWidth, ret, |
6419 isCustomProp = rcustomProp.test( name ), |
|
6578 |
6420 |
6579 // Support: Firefox 51+ |
6421 // Support: Firefox 51+ |
6580 // Retrieving style before computed somehow |
6422 // Retrieving style before computed somehow |
6581 // fixes an issue with getting wrong values |
6423 // fixes an issue with getting wrong values |
6582 // on detached elements |
6424 // on detached elements |
6583 style = elem.style; |
6425 style = elem.style; |
6584 |
6426 |
6585 computed = computed || getStyles( elem ); |
6427 computed = computed || getStyles( elem ); |
6586 |
6428 |
6587 // getPropertyValue is needed for: |
6429 // getPropertyValue is needed for: |
6588 // .css('filter') (IE 9 only, #12537) |
6430 // .css('filter') (IE 9 only, trac-12537) |
6589 // .css('--customProperty) (#3144) |
6431 // .css('--customProperty) (gh-3144) |
6590 if ( computed ) { |
6432 if ( computed ) { |
6433 |
|
6434 // Support: IE <=9 - 11+ |
|
6435 // IE only supports `"float"` in `getPropertyValue`; in computed styles |
|
6436 // it's only available as `"cssFloat"`. We no longer modify properties |
|
6437 // sent to `.css()` apart from camelCasing, so we need to check both. |
|
6438 // Normally, this would create difference in behavior: if |
|
6439 // `getPropertyValue` returns an empty string, the value returned |
|
6440 // by `.css()` would be `undefined`. This is usually the case for |
|
6441 // disconnected elements. However, in IE even disconnected elements |
|
6442 // with no styles return `"none"` for `getPropertyValue( "float" )` |
|
6591 ret = computed.getPropertyValue( name ) || computed[ name ]; |
6443 ret = computed.getPropertyValue( name ) || computed[ name ]; |
6444 |
|
6445 if ( isCustomProp && ret ) { |
|
6446 |
|
6447 // Support: Firefox 105+, Chrome <=105+ |
|
6448 // Spec requires trimming whitespace for custom properties (gh-4926). |
|
6449 // Firefox only trims leading whitespace. Chrome just collapses |
|
6450 // both leading & trailing whitespace to a single space. |
|
6451 // |
|
6452 // Fall back to `undefined` if empty string returned. |
|
6453 // This collapses a missing definition with property defined |
|
6454 // and set to an empty string but there's no standard API |
|
6455 // allowing us to differentiate them without a performance penalty |
|
6456 // and returning `undefined` aligns with older jQuery. |
|
6457 // |
|
6458 // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED |
|
6459 // as whitespace while CSS does not, but this is not a problem |
|
6460 // because CSS preprocessing replaces them with U+000A LINE FEED |
|
6461 // (which *is* CSS whitespace) |
|
6462 // https://www.w3.org/TR/css-syntax-3/#input-preprocessing |
|
6463 ret = ret.replace( rtrimCSS, "$1" ) || undefined; |
|
6464 } |
|
6592 |
6465 |
6593 if ( ret === "" && !isAttached( elem ) ) { |
6466 if ( ret === "" && !isAttached( elem ) ) { |
6594 ret = jQuery.style( elem, name ); |
6467 ret = jQuery.style( elem, name ); |
6595 } |
6468 } |
6596 |
6469 |
6683 |
6556 |
6684 // Swappable if display is none or starts with table |
6557 // Swappable if display is none or starts with table |
6685 // except "table", "table-cell", or "table-caption" |
6558 // except "table", "table-cell", or "table-caption" |
6686 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display |
6559 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display |
6687 rdisplayswap = /^(none|table(?!-c[ea]).+)/, |
6560 rdisplayswap = /^(none|table(?!-c[ea]).+)/, |
6688 rcustomProp = /^--/, |
|
6689 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, |
6561 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, |
6690 cssNormalTransform = { |
6562 cssNormalTransform = { |
6691 letterSpacing: "0", |
6563 letterSpacing: "0", |
6692 fontWeight: "400" |
6564 fontWeight: "400" |
6693 }; |
6565 }; |
6705 } |
6577 } |
6706 |
6578 |
6707 function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { |
6579 function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { |
6708 var i = dimension === "width" ? 1 : 0, |
6580 var i = dimension === "width" ? 1 : 0, |
6709 extra = 0, |
6581 extra = 0, |
6710 delta = 0; |
6582 delta = 0, |
6583 marginDelta = 0; |
|
6711 |
6584 |
6712 // Adjustment may not be necessary |
6585 // Adjustment may not be necessary |
6713 if ( box === ( isBorderBox ? "border" : "content" ) ) { |
6586 if ( box === ( isBorderBox ? "border" : "content" ) ) { |
6714 return 0; |
6587 return 0; |
6715 } |
6588 } |
6716 |
6589 |
6717 for ( ; i < 4; i += 2 ) { |
6590 for ( ; i < 4; i += 2 ) { |
6718 |
6591 |
6719 // Both box models exclude margin |
6592 // Both box models exclude margin |
6593 // Count margin delta separately to only add it after scroll gutter adjustment. |
|
6594 // This is needed to make negative margins work with `outerHeight( true )` (gh-3982). |
|
6720 if ( box === "margin" ) { |
6595 if ( box === "margin" ) { |
6721 delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); |
6596 marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); |
6722 } |
6597 } |
6723 |
6598 |
6724 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" |
6599 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" |
6725 if ( !isBorderBox ) { |
6600 if ( !isBorderBox ) { |
6726 |
6601 |
6767 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter |
6642 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter |
6768 // Use an explicit zero to avoid NaN (gh-3964) |
6643 // Use an explicit zero to avoid NaN (gh-3964) |
6769 ) ) || 0; |
6644 ) ) || 0; |
6770 } |
6645 } |
6771 |
6646 |
6772 return delta; |
6647 return delta + marginDelta; |
6773 } |
6648 } |
6774 |
6649 |
6775 function getWidthOrHeight( elem, dimension, extra ) { |
6650 function getWidthOrHeight( elem, dimension, extra ) { |
6776 |
6651 |
6777 // Start with computed style |
6652 // Start with computed style |
6865 } |
6740 } |
6866 }, |
6741 }, |
6867 |
6742 |
6868 // Don't automatically add "px" to these possibly-unitless properties |
6743 // Don't automatically add "px" to these possibly-unitless properties |
6869 cssNumber: { |
6744 cssNumber: { |
6870 "animationIterationCount": true, |
6745 animationIterationCount: true, |
6871 "columnCount": true, |
6746 aspectRatio: true, |
6872 "fillOpacity": true, |
6747 borderImageSlice: true, |
6873 "flexGrow": true, |
6748 columnCount: true, |
6874 "flexShrink": true, |
6749 flexGrow: true, |
6875 "fontWeight": true, |
6750 flexShrink: true, |
6876 "gridArea": true, |
6751 fontWeight: true, |
6877 "gridColumn": true, |
6752 gridArea: true, |
6878 "gridColumnEnd": true, |
6753 gridColumn: true, |
6879 "gridColumnStart": true, |
6754 gridColumnEnd: true, |
6880 "gridRow": true, |
6755 gridColumnStart: true, |
6881 "gridRowEnd": true, |
6756 gridRow: true, |
6882 "gridRowStart": true, |
6757 gridRowEnd: true, |
6883 "lineHeight": true, |
6758 gridRowStart: true, |
6884 "opacity": true, |
6759 lineHeight: true, |
6885 "order": true, |
6760 opacity: true, |
6886 "orphans": true, |
6761 order: true, |
6887 "widows": true, |
6762 orphans: true, |
6888 "zIndex": true, |
6763 scale: true, |
6889 "zoom": true |
6764 widows: true, |
6765 zIndex: true, |
|
6766 zoom: true, |
|
6767 |
|
6768 // SVG-related |
|
6769 fillOpacity: true, |
|
6770 floodOpacity: true, |
|
6771 stopOpacity: true, |
|
6772 strokeMiterlimit: true, |
|
6773 strokeOpacity: true |
|
6890 }, |
6774 }, |
6891 |
6775 |
6892 // Add in properties whose names you wish to fix before |
6776 // Add in properties whose names you wish to fix before |
6893 // setting or getting the value |
6777 // setting or getting the value |
6894 cssProps: {}, |
6778 cssProps: {}, |
6919 |
6803 |
6920 // Check if we're setting a value |
6804 // Check if we're setting a value |
6921 if ( value !== undefined ) { |
6805 if ( value !== undefined ) { |
6922 type = typeof value; |
6806 type = typeof value; |
6923 |
6807 |
6924 // Convert "+=" or "-=" to relative numbers (#7345) |
6808 // Convert "+=" or "-=" to relative numbers (trac-7345) |
6925 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { |
6809 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { |
6926 value = adjustCSS( elem, name, ret ); |
6810 value = adjustCSS( elem, name, ret ); |
6927 |
6811 |
6928 // Fixes bug #9237 |
6812 // Fixes bug trac-9237 |
6929 type = "number"; |
6813 type = "number"; |
6930 } |
6814 } |
6931 |
6815 |
6932 // Make sure that null and NaN values aren't set (#7116) |
6816 // Make sure that null and NaN values aren't set (trac-7116) |
6933 if ( value == null || value !== value ) { |
6817 if ( value == null || value !== value ) { |
6934 return; |
6818 return; |
6935 } |
6819 } |
6936 |
6820 |
6937 // If a number was passed in, add the unit (except for certain CSS properties) |
6821 // If a number was passed in, add the unit (except for certain CSS properties) |
7551 } |
7435 } |
7552 var currentTime = fxNow || createFxNow(), |
7436 var currentTime = fxNow || createFxNow(), |
7553 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), |
7437 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), |
7554 |
7438 |
7555 // Support: Android 2.3 only |
7439 // Support: Android 2.3 only |
7556 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) |
7440 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497) |
7557 temp = remaining / animation.duration || 0, |
7441 temp = remaining / animation.duration || 0, |
7558 percent = 1 - temp, |
7442 percent = 1 - temp, |
7559 index = 0, |
7443 index = 0, |
7560 length = animation.tweens.length; |
7444 length = animation.tweens.length; |
7561 |
7445 |
7941 _default: 400 |
7825 _default: 400 |
7942 }; |
7826 }; |
7943 |
7827 |
7944 |
7828 |
7945 // Based off of the plugin by Clint Helfers, with permission. |
7829 // Based off of the plugin by Clint Helfers, with permission. |
7946 // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ |
|
7947 jQuery.fn.delay = function( time, type ) { |
7830 jQuery.fn.delay = function( time, type ) { |
7948 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; |
7831 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; |
7949 type = type || "fx"; |
7832 type = type || "fx"; |
7950 |
7833 |
7951 return this.queue( type, function( next, hooks ) { |
7834 return this.queue( type, function( next, hooks ) { |
8166 get: function( elem ) { |
8049 get: function( elem ) { |
8167 |
8050 |
8168 // Support: IE <=9 - 11 only |
8051 // Support: IE <=9 - 11 only |
8169 // elem.tabIndex doesn't always return the |
8052 // elem.tabIndex doesn't always return the |
8170 // correct value when it hasn't been explicitly set |
8053 // correct value when it hasn't been explicitly set |
8171 // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ |
8054 // Use proper attribute retrieval (trac-12072) |
8172 // Use proper attribute retrieval(#12072) |
|
8173 var tabindex = jQuery.find.attr( elem, "tabindex" ); |
8055 var tabindex = jQuery.find.attr( elem, "tabindex" ); |
8174 |
8056 |
8175 if ( tabindex ) { |
8057 if ( tabindex ) { |
8176 return parseInt( tabindex, 10 ); |
8058 return parseInt( tabindex, 10 ); |
8177 } |
8059 } |
8271 return []; |
8153 return []; |
8272 } |
8154 } |
8273 |
8155 |
8274 jQuery.fn.extend( { |
8156 jQuery.fn.extend( { |
8275 addClass: function( value ) { |
8157 addClass: function( value ) { |
8276 var classes, elem, cur, curValue, clazz, j, finalValue, |
8158 var classNames, cur, curValue, className, i, finalValue; |
8277 i = 0; |
|
8278 |
8159 |
8279 if ( isFunction( value ) ) { |
8160 if ( isFunction( value ) ) { |
8280 return this.each( function( j ) { |
8161 return this.each( function( j ) { |
8281 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); |
8162 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); |
8282 } ); |
8163 } ); |
8283 } |
8164 } |
8284 |
8165 |
8285 classes = classesToArray( value ); |
8166 classNames = classesToArray( value ); |
8286 |
8167 |
8287 if ( classes.length ) { |
8168 if ( classNames.length ) { |
8288 while ( ( elem = this[ i++ ] ) ) { |
8169 return this.each( function() { |
8289 curValue = getClass( elem ); |
8170 curValue = getClass( this ); |
8290 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); |
8171 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); |
8291 |
8172 |
8292 if ( cur ) { |
8173 if ( cur ) { |
8293 j = 0; |
8174 for ( i = 0; i < classNames.length; i++ ) { |
8294 while ( ( clazz = classes[ j++ ] ) ) { |
8175 className = classNames[ i ]; |
8295 if ( cur.indexOf( " " + clazz + " " ) < 0 ) { |
8176 if ( cur.indexOf( " " + className + " " ) < 0 ) { |
8296 cur += clazz + " "; |
8177 cur += className + " "; |
8297 } |
8178 } |
8298 } |
8179 } |
8299 |
8180 |
8300 // Only assign if different to avoid unneeded rendering. |
8181 // Only assign if different to avoid unneeded rendering. |
8301 finalValue = stripAndCollapse( cur ); |
8182 finalValue = stripAndCollapse( cur ); |
8302 if ( curValue !== finalValue ) { |
8183 if ( curValue !== finalValue ) { |
8303 elem.setAttribute( "class", finalValue ); |
8184 this.setAttribute( "class", finalValue ); |
8304 } |
8185 } |
8305 } |
8186 } |
8306 } |
8187 } ); |
8307 } |
8188 } |
8308 |
8189 |
8309 return this; |
8190 return this; |
8310 }, |
8191 }, |
8311 |
8192 |
8312 removeClass: function( value ) { |
8193 removeClass: function( value ) { |
8313 var classes, elem, cur, curValue, clazz, j, finalValue, |
8194 var classNames, cur, curValue, className, i, finalValue; |
8314 i = 0; |
|
8315 |
8195 |
8316 if ( isFunction( value ) ) { |
8196 if ( isFunction( value ) ) { |
8317 return this.each( function( j ) { |
8197 return this.each( function( j ) { |
8318 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); |
8198 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); |
8319 } ); |
8199 } ); |
8321 |
8201 |
8322 if ( !arguments.length ) { |
8202 if ( !arguments.length ) { |
8323 return this.attr( "class", "" ); |
8203 return this.attr( "class", "" ); |
8324 } |
8204 } |
8325 |
8205 |
8326 classes = classesToArray( value ); |
8206 classNames = classesToArray( value ); |
8327 |
8207 |
8328 if ( classes.length ) { |
8208 if ( classNames.length ) { |
8329 while ( ( elem = this[ i++ ] ) ) { |
8209 return this.each( function() { |
8330 curValue = getClass( elem ); |
8210 curValue = getClass( this ); |
8331 |
8211 |
8332 // This expression is here for better compressibility (see addClass) |
8212 // This expression is here for better compressibility (see addClass) |
8333 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); |
8213 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); |
8334 |
8214 |
8335 if ( cur ) { |
8215 if ( cur ) { |
8336 j = 0; |
8216 for ( i = 0; i < classNames.length; i++ ) { |
8337 while ( ( clazz = classes[ j++ ] ) ) { |
8217 className = classNames[ i ]; |
8338 |
8218 |
8339 // Remove *all* instances |
8219 // Remove *all* instances |
8340 while ( cur.indexOf( " " + clazz + " " ) > -1 ) { |
8220 while ( cur.indexOf( " " + className + " " ) > -1 ) { |
8341 cur = cur.replace( " " + clazz + " ", " " ); |
8221 cur = cur.replace( " " + className + " ", " " ); |
8342 } |
8222 } |
8343 } |
8223 } |
8344 |
8224 |
8345 // Only assign if different to avoid unneeded rendering. |
8225 // Only assign if different to avoid unneeded rendering. |
8346 finalValue = stripAndCollapse( cur ); |
8226 finalValue = stripAndCollapse( cur ); |
8347 if ( curValue !== finalValue ) { |
8227 if ( curValue !== finalValue ) { |
8348 elem.setAttribute( "class", finalValue ); |
8228 this.setAttribute( "class", finalValue ); |
8349 } |
8229 } |
8350 } |
8230 } |
8351 } |
8231 } ); |
8352 } |
8232 } |
8353 |
8233 |
8354 return this; |
8234 return this; |
8355 }, |
8235 }, |
8356 |
8236 |
8357 toggleClass: function( value, stateVal ) { |
8237 toggleClass: function( value, stateVal ) { |
8358 var type = typeof value, |
8238 var classNames, className, i, self, |
8239 type = typeof value, |
|
8359 isValidValue = type === "string" || Array.isArray( value ); |
8240 isValidValue = type === "string" || Array.isArray( value ); |
8360 |
|
8361 if ( typeof stateVal === "boolean" && isValidValue ) { |
|
8362 return stateVal ? this.addClass( value ) : this.removeClass( value ); |
|
8363 } |
|
8364 |
8241 |
8365 if ( isFunction( value ) ) { |
8242 if ( isFunction( value ) ) { |
8366 return this.each( function( i ) { |
8243 return this.each( function( i ) { |
8367 jQuery( this ).toggleClass( |
8244 jQuery( this ).toggleClass( |
8368 value.call( this, i, getClass( this ), stateVal ), |
8245 value.call( this, i, getClass( this ), stateVal ), |
8369 stateVal |
8246 stateVal |
8370 ); |
8247 ); |
8371 } ); |
8248 } ); |
8372 } |
8249 } |
8373 |
8250 |
8251 if ( typeof stateVal === "boolean" && isValidValue ) { |
|
8252 return stateVal ? this.addClass( value ) : this.removeClass( value ); |
|
8253 } |
|
8254 |
|
8255 classNames = classesToArray( value ); |
|
8256 |
|
8374 return this.each( function() { |
8257 return this.each( function() { |
8375 var className, i, self, classNames; |
|
8376 |
|
8377 if ( isValidValue ) { |
8258 if ( isValidValue ) { |
8378 |
8259 |
8379 // Toggle individual class names |
8260 // Toggle individual class names |
8380 i = 0; |
|
8381 self = jQuery( this ); |
8261 self = jQuery( this ); |
8382 classNames = classesToArray( value ); |
8262 |
8383 |
8263 for ( i = 0; i < classNames.length; i++ ) { |
8384 while ( ( className = classNames[ i++ ] ) ) { |
8264 className = classNames[ i ]; |
8385 |
8265 |
8386 // Check each className given, space separated list |
8266 // Check each className given, space separated list |
8387 if ( self.hasClass( className ) ) { |
8267 if ( self.hasClass( className ) ) { |
8388 self.removeClass( className ); |
8268 self.removeClass( className ); |
8389 } else { |
8269 } else { |
8513 var val = jQuery.find.attr( elem, "value" ); |
8393 var val = jQuery.find.attr( elem, "value" ); |
8514 return val != null ? |
8394 return val != null ? |
8515 val : |
8395 val : |
8516 |
8396 |
8517 // Support: IE <=10 - 11 only |
8397 // Support: IE <=10 - 11 only |
8518 // option.text throws exceptions (#14686, #14858) |
8398 // option.text throws exceptions (trac-14686, trac-14858) |
8519 // Strip and collapse whitespace |
8399 // Strip and collapse whitespace |
8520 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace |
8400 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace |
8521 stripAndCollapse( jQuery.text( elem ) ); |
8401 stripAndCollapse( jQuery.text( elem ) ); |
8522 } |
8402 } |
8523 }, |
8403 }, |
8540 // Loop through all the selected options |
8420 // Loop through all the selected options |
8541 for ( ; i < max; i++ ) { |
8421 for ( ; i < max; i++ ) { |
8542 option = options[ i ]; |
8422 option = options[ i ]; |
8543 |
8423 |
8544 // Support: IE <=9 only |
8424 // Support: IE <=9 only |
8545 // IE8-9 doesn't update selected after form reset (#2551) |
8425 // IE8-9 doesn't update selected after form reset (trac-2551) |
8546 if ( ( option.selected || i === index ) && |
8426 if ( ( option.selected || i === index ) && |
8547 |
8427 |
8548 // Don't return options that are disabled or in a disabled optgroup |
8428 // Don't return options that are disabled or in a disabled optgroup |
8549 !option.disabled && |
8429 !option.disabled && |
8550 ( !option.parentNode.disabled || |
8430 ( !option.parentNode.disabled || |
8614 |
8494 |
8615 |
8495 |
8616 |
8496 |
8617 |
8497 |
8618 // Return jQuery for attributes-only inclusion |
8498 // Return jQuery for attributes-only inclusion |
8619 |
8499 var location = window.location; |
8620 |
8500 |
8621 support.focusin = "onfocusin" in window; |
8501 var nonce = { guid: Date.now() }; |
8502 |
|
8503 var rquery = ( /\?/ ); |
|
8504 |
|
8505 |
|
8506 |
|
8507 // Cross-browser xml parsing |
|
8508 jQuery.parseXML = function( data ) { |
|
8509 var xml, parserErrorElem; |
|
8510 if ( !data || typeof data !== "string" ) { |
|
8511 return null; |
|
8512 } |
|
8513 |
|
8514 // Support: IE 9 - 11 only |
|
8515 // IE throws on parseFromString with invalid input. |
|
8516 try { |
|
8517 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); |
|
8518 } catch ( e ) {} |
|
8519 |
|
8520 parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; |
|
8521 if ( !xml || parserErrorElem ) { |
|
8522 jQuery.error( "Invalid XML: " + ( |
|
8523 parserErrorElem ? |
|
8524 jQuery.map( parserErrorElem.childNodes, function( el ) { |
|
8525 return el.textContent; |
|
8526 } ).join( "\n" ) : |
|
8527 data |
|
8528 ) ); |
|
8529 } |
|
8530 return xml; |
|
8531 }; |
|
8622 |
8532 |
8623 |
8533 |
8624 var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, |
8534 var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, |
8625 stopPropagationCallback = function( e ) { |
8535 stopPropagationCallback = function( e ) { |
8626 e.stopPropagation(); |
8536 e.stopPropagation(); |
8683 special = jQuery.event.special[ type ] || {}; |
8593 special = jQuery.event.special[ type ] || {}; |
8684 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { |
8594 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { |
8685 return; |
8595 return; |
8686 } |
8596 } |
8687 |
8597 |
8688 // Determine event propagation path in advance, per W3C events spec (#9951) |
8598 // Determine event propagation path in advance, per W3C events spec (trac-9951) |
8689 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) |
8599 // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724) |
8690 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { |
8600 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { |
8691 |
8601 |
8692 bubbleType = special.delegateType || type; |
8602 bubbleType = special.delegateType || type; |
8693 if ( !rfocusMorph.test( bubbleType + type ) ) { |
8603 if ( !rfocusMorph.test( bubbleType + type ) ) { |
8694 cur = cur.parentNode; |
8604 cur = cur.parentNode; |
8736 if ( ( !special._default || |
8646 if ( ( !special._default || |
8737 special._default.apply( eventPath.pop(), data ) === false ) && |
8647 special._default.apply( eventPath.pop(), data ) === false ) && |
8738 acceptData( elem ) ) { |
8648 acceptData( elem ) ) { |
8739 |
8649 |
8740 // Call a native DOM method on the target with the same name as the event. |
8650 // Call a native DOM method on the target with the same name as the event. |
8741 // Don't do default actions on window, that's where global variables be (#6170) |
8651 // Don't do default actions on window, that's where global variables be (trac-6170) |
8742 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { |
8652 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { |
8743 |
8653 |
8744 // Don't re-trigger an onFOO event when we call its FOO() method |
8654 // Don't re-trigger an onFOO event when we call its FOO() method |
8745 tmp = elem[ ontype ]; |
8655 tmp = elem[ ontype ]; |
8746 |
8656 |
8804 } |
8714 } |
8805 } |
8715 } |
8806 } ); |
8716 } ); |
8807 |
8717 |
8808 |
8718 |
8809 // Support: Firefox <=44 |
|
8810 // Firefox doesn't have focus(in | out) events |
|
8811 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 |
|
8812 // |
|
8813 // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 |
|
8814 // focus(in | out) events fire after focus & blur events, |
|
8815 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order |
|
8816 // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 |
|
8817 if ( !support.focusin ) { |
|
8818 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { |
|
8819 |
|
8820 // Attach a single capturing handler on the document while someone wants focusin/focusout |
|
8821 var handler = function( event ) { |
|
8822 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); |
|
8823 }; |
|
8824 |
|
8825 jQuery.event.special[ fix ] = { |
|
8826 setup: function() { |
|
8827 |
|
8828 // Handle: regular nodes (via `this.ownerDocument`), window |
|
8829 // (via `this.document`) & document (via `this`). |
|
8830 var doc = this.ownerDocument || this.document || this, |
|
8831 attaches = dataPriv.access( doc, fix ); |
|
8832 |
|
8833 if ( !attaches ) { |
|
8834 doc.addEventListener( orig, handler, true ); |
|
8835 } |
|
8836 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); |
|
8837 }, |
|
8838 teardown: function() { |
|
8839 var doc = this.ownerDocument || this.document || this, |
|
8840 attaches = dataPriv.access( doc, fix ) - 1; |
|
8841 |
|
8842 if ( !attaches ) { |
|
8843 doc.removeEventListener( orig, handler, true ); |
|
8844 dataPriv.remove( doc, fix ); |
|
8845 |
|
8846 } else { |
|
8847 dataPriv.access( doc, fix, attaches ); |
|
8848 } |
|
8849 } |
|
8850 }; |
|
8851 } ); |
|
8852 } |
|
8853 var location = window.location; |
|
8854 |
|
8855 var nonce = { guid: Date.now() }; |
|
8856 |
|
8857 var rquery = ( /\?/ ); |
|
8858 |
|
8859 |
|
8860 |
|
8861 // Cross-browser xml parsing |
|
8862 jQuery.parseXML = function( data ) { |
|
8863 var xml, parserErrorElem; |
|
8864 if ( !data || typeof data !== "string" ) { |
|
8865 return null; |
|
8866 } |
|
8867 |
|
8868 // Support: IE 9 - 11 only |
|
8869 // IE throws on parseFromString with invalid input. |
|
8870 try { |
|
8871 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); |
|
8872 } catch ( e ) {} |
|
8873 |
|
8874 parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; |
|
8875 if ( !xml || parserErrorElem ) { |
|
8876 jQuery.error( "Invalid XML: " + ( |
|
8877 parserErrorElem ? |
|
8878 jQuery.map( parserErrorElem.childNodes, function( el ) { |
|
8879 return el.textContent; |
|
8880 } ).join( "\n" ) : |
|
8881 data |
|
8882 ) ); |
|
8883 } |
|
8884 return xml; |
|
8885 }; |
|
8886 |
|
8887 |
|
8888 var |
8719 var |
8889 rbracket = /\[\]$/, |
8720 rbracket = /\[\]$/, |
8890 rCRLF = /\r?\n/g, |
8721 rCRLF = /\r?\n/g, |
8891 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, |
8722 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, |
8892 rsubmittable = /^(?:input|select|textarea|keygen)/i; |
8723 rsubmittable = /^(?:input|select|textarea|keygen)/i; |
9010 r20 = /%20/g, |
8841 r20 = /%20/g, |
9011 rhash = /#.*$/, |
8842 rhash = /#.*$/, |
9012 rantiCache = /([?&])_=[^&]*/, |
8843 rantiCache = /([?&])_=[^&]*/, |
9013 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, |
8844 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, |
9014 |
8845 |
9015 // #7653, #8125, #8152: local protocol detection |
8846 // trac-7653, trac-8125, trac-8152: local protocol detection |
9016 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, |
8847 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, |
9017 rnoContent = /^(?:GET|HEAD)$/, |
8848 rnoContent = /^(?:GET|HEAD)$/, |
9018 rprotocol = /^\/\//, |
8849 rprotocol = /^\/\//, |
9019 |
8850 |
9020 /* Prefilters |
8851 /* Prefilters |
9033 * 2) the catchall symbol "*" can be used |
8864 * 2) the catchall symbol "*" can be used |
9034 * 3) selection will start with transport dataType and THEN go to "*" if needed |
8865 * 3) selection will start with transport dataType and THEN go to "*" if needed |
9035 */ |
8866 */ |
9036 transports = {}, |
8867 transports = {}, |
9037 |
8868 |
9038 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression |
8869 // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression |
9039 allTypes = "*/".concat( "*" ), |
8870 allTypes = "*/".concat( "*" ), |
9040 |
8871 |
9041 // Anchor tag for parsing the document origin |
8872 // Anchor tag for parsing the document origin |
9042 originAnchor = document.createElement( "a" ); |
8873 originAnchor = document.createElement( "a" ); |
9043 |
8874 |
9104 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); |
8935 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); |
9105 } |
8936 } |
9106 |
8937 |
9107 // A special extend for ajax options |
8938 // A special extend for ajax options |
9108 // that takes "flat" options (not to be deep extended) |
8939 // that takes "flat" options (not to be deep extended) |
9109 // Fixes #9887 |
8940 // Fixes trac-9887 |
9110 function ajaxExtend( target, src ) { |
8941 function ajaxExtend( target, src ) { |
9111 var key, deep, |
8942 var key, deep, |
9112 flatOptions = jQuery.ajaxSettings.flatOptions || {}; |
8943 flatOptions = jQuery.ajaxSettings.flatOptions || {}; |
9113 |
8944 |
9114 for ( key in src ) { |
8945 for ( key in src ) { |
9515 |
9346 |
9516 // Attach deferreds |
9347 // Attach deferreds |
9517 deferred.promise( jqXHR ); |
9348 deferred.promise( jqXHR ); |
9518 |
9349 |
9519 // Add protocol if not provided (prefilters might expect it) |
9350 // Add protocol if not provided (prefilters might expect it) |
9520 // Handle falsy url in the settings object (#10093: consistency with old signature) |
9351 // Handle falsy url in the settings object (trac-10093: consistency with old signature) |
9521 // We also use the url parameter if available |
9352 // We also use the url parameter if available |
9522 s.url = ( ( url || s.url || location.href ) + "" ) |
9353 s.url = ( ( url || s.url || location.href ) + "" ) |
9523 .replace( rprotocol, location.protocol + "//" ); |
9354 .replace( rprotocol, location.protocol + "//" ); |
9524 |
9355 |
9525 // Alias method option to type as per ticket #12004 |
9356 // Alias method option to type as per ticket trac-12004 |
9526 s.type = options.method || options.type || s.method || s.type; |
9357 s.type = options.method || options.type || s.method || s.type; |
9527 |
9358 |
9528 // Extract dataTypes list |
9359 // Extract dataTypes list |
9529 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; |
9360 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; |
9530 |
9361 |
9563 if ( completed ) { |
9394 if ( completed ) { |
9564 return jqXHR; |
9395 return jqXHR; |
9565 } |
9396 } |
9566 |
9397 |
9567 // We can fire global events as of now if asked to |
9398 // We can fire global events as of now if asked to |
9568 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) |
9399 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118) |
9569 fireGlobals = jQuery.event && s.global; |
9400 fireGlobals = jQuery.event && s.global; |
9570 |
9401 |
9571 // Watch for a new set of requests |
9402 // Watch for a new set of requests |
9572 if ( fireGlobals && jQuery.active++ === 0 ) { |
9403 if ( fireGlobals && jQuery.active++ === 0 ) { |
9573 jQuery.event.trigger( "ajaxStart" ); |
9404 jQuery.event.trigger( "ajaxStart" ); |
9592 |
9423 |
9593 // If data is available and should be processed, append data to url |
9424 // If data is available and should be processed, append data to url |
9594 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { |
9425 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { |
9595 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; |
9426 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; |
9596 |
9427 |
9597 // #9682: remove data so that it's not used in an eventual retry |
9428 // trac-9682: remove data so that it's not used in an eventual retry |
9598 delete s.data; |
9429 delete s.data; |
9599 } |
9430 } |
9600 |
9431 |
9601 // Add or update anti-cache param if needed |
9432 // Add or update anti-cache param if needed |
9602 if ( s.cache === false ) { |
9433 if ( s.cache === false ) { |
9865 |
9696 |
9866 jQuery._evalUrl = function( url, options, doc ) { |
9697 jQuery._evalUrl = function( url, options, doc ) { |
9867 return jQuery.ajax( { |
9698 return jQuery.ajax( { |
9868 url: url, |
9699 url: url, |
9869 |
9700 |
9870 // Make this explicit, since user can override this through ajaxSetup (#11264) |
9701 // Make this explicit, since user can override this through ajaxSetup (trac-11264) |
9871 type: "GET", |
9702 type: "GET", |
9872 dataType: "script", |
9703 dataType: "script", |
9873 cache: true, |
9704 cache: true, |
9874 async: false, |
9705 async: false, |
9875 global: false, |
9706 global: false, |
9974 |
9805 |
9975 // File protocol always yields status code 0, assume 200 |
9806 // File protocol always yields status code 0, assume 200 |
9976 0: 200, |
9807 0: 200, |
9977 |
9808 |
9978 // Support: IE <=9 only |
9809 // Support: IE <=9 only |
9979 // #1450: sometimes IE returns 1223 when it should be 204 |
9810 // trac-1450: sometimes IE returns 1223 when it should be 204 |
9980 1223: 204 |
9811 1223: 204 |
9981 }, |
9812 }, |
9982 xhrSupported = jQuery.ajaxSettings.xhr(); |
9813 xhrSupported = jQuery.ajaxSettings.xhr(); |
9983 |
9814 |
9984 support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); |
9815 support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); |
10046 if ( typeof xhr.status !== "number" ) { |
9877 if ( typeof xhr.status !== "number" ) { |
10047 complete( 0, "error" ); |
9878 complete( 0, "error" ); |
10048 } else { |
9879 } else { |
10049 complete( |
9880 complete( |
10050 |
9881 |
10051 // File: protocol always yields status 0; see #8605, #14207 |
9882 // File: protocol always yields status 0; see trac-8605, trac-14207 |
10052 xhr.status, |
9883 xhr.status, |
10053 xhr.statusText |
9884 xhr.statusText |
10054 ); |
9885 ); |
10055 } |
9886 } |
10056 } else { |
9887 } else { |
10107 |
9938 |
10108 // Do send the request (this may raise an exception) |
9939 // Do send the request (this may raise an exception) |
10109 xhr.send( options.hasContent && options.data || null ); |
9940 xhr.send( options.hasContent && options.data || null ); |
10110 } catch ( e ) { |
9941 } catch ( e ) { |
10111 |
9942 |
10112 // #14683: Only rethrow if this hasn't been notified as an error yet |
9943 // trac-14683: Only rethrow if this hasn't been notified as an error yet |
10113 if ( callback ) { |
9944 if ( callback ) { |
10114 throw e; |
9945 throw e; |
10115 } |
9946 } |
10116 } |
9947 } |
10117 }, |
9948 }, |
10727 this.off( selector, "**" ) : |
10558 this.off( selector, "**" ) : |
10728 this.off( types, selector || "**", fn ); |
10559 this.off( types, selector || "**", fn ); |
10729 }, |
10560 }, |
10730 |
10561 |
10731 hover: function( fnOver, fnOut ) { |
10562 hover: function( fnOver, fnOut ) { |
10732 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); |
10563 return this |
10564 .on( "mouseenter", fnOver ) |
|
10565 .on( "mouseleave", fnOut || fnOver ); |
|
10733 } |
10566 } |
10734 } ); |
10567 } ); |
10735 |
10568 |
10736 jQuery.each( |
10569 jQuery.each( |
10737 ( "blur focus focusin focusout resize scroll click dblclick " + |
10570 ( "blur focus focusin focusout resize scroll click dblclick " + |
10751 |
10584 |
10752 |
10585 |
10753 |
10586 |
10754 // Support: Android <=4.0 only |
10587 // Support: Android <=4.0 only |
10755 // Make sure we trim BOM and NBSP |
10588 // Make sure we trim BOM and NBSP |
10756 var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; |
10589 // Require that the "whitespace run" starts from a non-whitespace |
10590 // to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position. |
|
10591 var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; |
|
10757 |
10592 |
10758 // Bind a function to a context, optionally partially applying any |
10593 // Bind a function to a context, optionally partially applying any |
10759 // arguments. |
10594 // arguments. |
10760 // jQuery.proxy is deprecated to promote standards (specifically Function#bind) |
10595 // jQuery.proxy is deprecated to promote standards (specifically Function#bind) |
10761 // However, it is not slated for removal any time soon |
10596 // However, it is not slated for removal any time soon |
10818 }; |
10653 }; |
10819 |
10654 |
10820 jQuery.trim = function( text ) { |
10655 jQuery.trim = function( text ) { |
10821 return text == null ? |
10656 return text == null ? |
10822 "" : |
10657 "" : |
10823 ( text + "" ).replace( rtrim, "" ); |
10658 ( text + "" ).replace( rtrim, "$1" ); |
10824 }; |
10659 }; |
10825 |
10660 |
10826 |
10661 |
10827 |
10662 |
10828 // Register as a named AMD module, since jQuery can be concatenated with other |
10663 // Register as a named AMD module, since jQuery can be concatenated with other |
10866 |
10701 |
10867 return jQuery; |
10702 return jQuery; |
10868 }; |
10703 }; |
10869 |
10704 |
10870 // Expose jQuery and $ identifiers, even in AMD |
10705 // Expose jQuery and $ identifiers, even in AMD |
10871 // (#7102#comment:10, https://github.com/jquery/jquery/pull/557) |
10706 // (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557) |
10872 // and CommonJS for browser emulators (#13566) |
10707 // and CommonJS for browser emulators (trac-13566) |
10873 if ( typeof noGlobal === "undefined" ) { |
10708 if ( typeof noGlobal === "undefined" ) { |
10874 window.jQuery = window.$ = jQuery; |
10709 window.jQuery = window.$ = jQuery; |
10875 } |
10710 } |
10876 |
10711 |
10877 |
10712 |