src/eric7/WebBrowser/data/javascript/jquery.js

branch
eric7
changeset 10509
094ab8028423
parent 9678
32ddecc54baf
equal deleted inserted replaced
10508:a20222f2d8a2 10509:094ab8028423
1 /*! 1 /*!
2 * jQuery JavaScript Library v3.6.3 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: 2022-12-20T21:28Z 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
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.3", 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.9 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: 2022-12-19 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
877 } 918 }
878 newSelector = groups.join( "," ); 919 newSelector = groups.join( "," );
879 } 920 }
880 921
881 try { 922 try {
882
883 // `qSA` may not throw for unrecognized parts using forgiving parsing:
884 // https://drafts.csswg.org/selectors/#forgiving-selector
885 // like the `:has()` pseudo-class:
886 // https://drafts.csswg.org/selectors/#relational
887 // `CSS.supports` is still expected to return `false` then:
888 // https://drafts.csswg.org/css-conditional-4/#typedef-supports-selector-fn
889 // https://drafts.csswg.org/css-conditional-4/#dfn-support-selector
890 if ( support.cssSupportsSelector &&
891
892 // eslint-disable-next-line no-undef
893 !CSS.supports( "selector(:is(" + newSelector + "))" ) ) {
894
895 // Support: IE 11+
896 // Throw to get to the same code path as an error directly in qSA.
897 // Note: once we only support browser supporting
898 // `CSS.supports('selector(...)')`, we can most likely drop
899 // the `try-catch`. IE doesn't implement the API.
900 throw new Error();
901 }
902
903 push.apply( results, 923 push.apply( results,
904 newContext.querySelectorAll( newSelector ) 924 newContext.querySelectorAll( newSelector )
905 ); 925 );
906 return results; 926 return results;
907 } catch ( qsaError ) { 927 } catch ( qsaError ) {
914 } 934 }
915 } 935 }
916 } 936 }
917 937
918 // All others 938 // All others
919 return select( selector.replace( rtrim, "$1" ), context, results, seed ); 939 return select( selector.replace( rtrimCSS, "$1" ), context, results, seed );
920 } 940 }
921 941
922 /** 942 /**
923 * Create key-value caches of limited size 943 * Create key-value caches of limited size
924 * @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
928 function createCache() { 948 function createCache() {
929 var keys = []; 949 var keys = [];
930 950
931 function cache( key, value ) { 951 function cache( key, value ) {
932 952
933 // 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)
934 if ( keys.push( key + " " ) > Expr.cacheLength ) { 955 if ( keys.push( key + " " ) > Expr.cacheLength ) {
935 956
936 // Only keep the most recent entries 957 // Only keep the most recent entries
937 delete cache[ keys.shift() ]; 958 delete cache[ keys.shift() ];
938 } 959 }
940 } 961 }
941 return cache; 962 return cache;
942 } 963 }
943 964
944 /** 965 /**
945 * Mark a function for special use by Sizzle 966 * Mark a function for special use by jQuery selector module
946 * @param {Function} fn The function to mark 967 * @param {Function} fn The function to mark
947 */ 968 */
948 function markFunction( fn ) { 969 function markFunction( fn ) {
949 fn[ expando ] = true; 970 fn[ expando ] = true;
950 return fn; 971 return fn;
972 el = null; 993 el = null;
973 } 994 }
974 } 995 }
975 996
976 /** 997 /**
977 * Adds the same handler for all of the specified attrs
978 * @param {String} attrs Pipe-separated list of attributes
979 * @param {Function} handler The method that will be applied
980 */
981 function addHandle( attrs, handler ) {
982 var arr = attrs.split( "|" ),
983 i = arr.length;
984
985 while ( i-- ) {
986 Expr.attrHandle[ arr[ i ] ] = handler;
987 }
988 }
989
990 /**
991 * Checks document order of two siblings
992 * @param {Element} a
993 * @param {Element} b
994 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
995 */
996 function siblingCheck( a, b ) {
997 var cur = b && a,
998 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
999 a.sourceIndex - b.sourceIndex;
1000
1001 // Use IE sourceIndex if available on both nodes
1002 if ( diff ) {
1003 return diff;
1004 }
1005
1006 // Check if b follows a
1007 if ( cur ) {
1008 while ( ( cur = cur.nextSibling ) ) {
1009 if ( cur === b ) {
1010 return -1;
1011 }
1012 }
1013 }
1014
1015 return a ? 1 : -1;
1016 }
1017
1018 /**
1019 * Returns a function to use in pseudos for input types 998 * Returns a function to use in pseudos for input types
1020 * @param {String} type 999 * @param {String} type
1021 */ 1000 */
1022 function createInputPseudo( type ) { 1001 function createInputPseudo( type ) {
1023 return function( elem ) { 1002 return function( elem ) {
1024 var name = elem.nodeName.toLowerCase(); 1003 return nodeName( elem, "input" ) && elem.type === type;
1025 return name === "input" && elem.type === type;
1026 }; 1004 };
1027 } 1005 }
1028 1006
1029 /** 1007 /**
1030 * Returns a function to use in pseudos for buttons 1008 * Returns a function to use in pseudos for buttons
1031 * @param {String} type 1009 * @param {String} type
1032 */ 1010 */
1033 function createButtonPseudo( type ) { 1011 function createButtonPseudo( type ) {
1034 return function( elem ) { 1012 return function( elem ) {
1035 var name = elem.nodeName.toLowerCase(); 1013 return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) &&
1036 return ( name === "input" || name === "button" ) && elem.type === type; 1014 elem.type === type;
1037 }; 1015 };
1038 } 1016 }
1039 1017
1040 /** 1018 /**
1041 * Returns a function to use in pseudos for :enabled/:disabled 1019 * Returns a function to use in pseudos for :enabled/:disabled
1067 } else { 1045 } else {
1068 return elem.disabled === disabled; 1046 return elem.disabled === disabled;
1069 } 1047 }
1070 } 1048 }
1071 1049
1072 // Support: IE 6 - 11 1050 // Support: IE 6 - 11+
1073 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 1051 // Use the isDisabled shortcut property to check for disabled fieldset ancestors
1074 return elem.isDisabled === disabled || 1052 return elem.isDisabled === disabled ||
1075 1053
1076 // Where there is no isDisabled, check manually 1054 // Where there is no isDisabled, check manually
1077 /* jshint -W018 */
1078 elem.isDisabled !== !disabled && 1055 elem.isDisabled !== !disabled &&
1079 inDisabledFieldset( elem ) === disabled; 1056 inDisabledFieldset( elem ) === disabled;
1080 } 1057 }
1081 1058
1082 return elem.disabled === disabled; 1059 return elem.disabled === disabled;
1083 1060
1084 // 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.
1114 } ); 1091 } );
1115 } ); 1092 } );
1116 } 1093 }
1117 1094
1118 /** 1095 /**
1119 * Checks a node for validity as a Sizzle context 1096 * Checks a node for validity as a jQuery selector context
1120 * @param {Element|Object=} context 1097 * @param {Element|Object=} context
1121 * @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
1122 */ 1099 */
1123 function testContext( context ) { 1100 function testContext( context ) {
1124 return context && typeof context.getElementsByTagName !== "undefined" && context; 1101 return context && typeof context.getElementsByTagName !== "undefined" && context;
1125 } 1102 }
1126 1103
1127 // Expose support vars for convenience
1128 support = Sizzle.support = {};
1129
1130 /**
1131 * Detects XML nodes
1132 * @param {Element|Object} elem An element or a document
1133 * @returns {Boolean} True iff elem is a non-HTML XML node
1134 */
1135 isXML = Sizzle.isXML = function( elem ) {
1136 var namespace = elem && elem.namespaceURI,
1137 docElem = elem && ( elem.ownerDocument || elem ).documentElement;
1138
1139 // Support: IE <=8
1140 // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes
1141 // https://bugs.jquery.com/ticket/4833
1142 return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" );
1143 };
1144
1145 /** 1104 /**
1146 * Sets document-related variables once based on the current document 1105 * Sets document-related variables once based on the current document
1147 * @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
1148 * @returns {Object} Returns the current document 1107 * @returns {Object} Returns the current document
1149 */ 1108 */
1150 setDocument = Sizzle.setDocument = function( node ) { 1109 function setDocument( node ) {
1151 var hasCompare, subWindow, 1110 var subWindow,
1152 doc = node ? node.ownerDocument || node : preferredDoc; 1111 doc = node ? node.ownerDocument || node : preferredDoc;
1153 1112
1154 // Return early if doc is invalid or already selected 1113 // Return early if doc is invalid or already selected
1155 // Support: IE 11+, Edge 17 - 18+ 1114 // Support: IE 11+, Edge 17 - 18+
1156 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1115 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1160 return document; 1119 return document;
1161 } 1120 }
1162 1121
1163 // Update global variables 1122 // Update global variables
1164 document = doc; 1123 document = doc;
1165 docElem = document.documentElement; 1124 documentElement = document.documentElement;
1166 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;
1167 1132
1168 // Support: IE 9 - 11+, Edge 12 - 18+ 1133 // Support: IE 9 - 11+, Edge 12 - 18+
1169 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) 1134 // Accessing iframe documents after unload throws "permission denied" errors
1170 // Support: IE 11+, Edge 17 - 18+ 1135 // (see trac-13936).
1171 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1136 // Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`,
1172 // two documents; shallow comparisons work. 1137 // all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well.
1173 // eslint-disable-next-line eqeqeq 1138 if ( documentElement.msMatchesSelector &&
1174 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 &&
1175 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { 1145 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) {
1176 1146
1177 // Support: IE 11, Edge 1147 // Support: IE 9 - 11+, Edge 12 - 18+
1178 if ( subWindow.addEventListener ) { 1148 subWindow.addEventListener( "unload", unloadHandler );
1179 subWindow.addEventListener( "unload", unloadHandler, false ); 1149 }
1180 1150
1181 // Support: IE 9 - 10 only 1151 // Support: IE <10
1182 } else if ( subWindow.attachEvent ) {
1183 subWindow.attachEvent( "onunload", unloadHandler );
1184 }
1185 }
1186
1187 // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only,
1188 // Safari 4 - 5 only, Opera <=11.6 - 12.x only
1189 // IE/Edge & older browsers don't support the :scope pseudo-class.
1190 // Support: Safari 6.0 only
1191 // Safari 6.0 supports :scope but it's an alias of :root there.
1192 support.scope = assert( function( el ) {
1193 docElem.appendChild( el ).appendChild( document.createElement( "div" ) );
1194 return typeof el.querySelectorAll !== "undefined" &&
1195 !el.querySelectorAll( ":scope fieldset div" ).length;
1196 } );
1197
1198 // Support: Chrome 105+, Firefox 104+, Safari 15.4+
1199 // Make sure forgiving mode is not used in `CSS.supports( "selector(...)" )`.
1200 //
1201 // `:is()` uses a forgiving selector list as an argument and is widely
1202 // implemented, so it's a good one to test against.
1203 support.cssSupportsSelector = assert( function() {
1204 /* eslint-disable no-undef */
1205
1206 return CSS.supports( "selector(*)" ) &&
1207
1208 // Support: Firefox 78-81 only
1209 // In old Firefox, `:is()` didn't use forgiving parsing. In that case,
1210 // fail this test as there's no selector to test against that.
1211 // `CSS.supports` uses unforgiving parsing
1212 document.querySelectorAll( ":is(:jqfake)" ) &&
1213
1214 // `*` is needed as Safari & newer Chrome implemented something in between
1215 // for `:has()` - it throws in `qSA` if it only contains an unsupported
1216 // argument but multiple ones, one of which is supported, are fine.
1217 // We want to play safe in case `:is()` gets the same treatment.
1218 !CSS.supports( "selector(:is(*,:jqfake))" );
1219
1220 /* eslint-enable */
1221 } );
1222
1223 /* Attributes
1224 ---------------------------------------------------------------------- */
1225
1226 // Support: IE<8
1227 // Verify that getAttribute really returns attributes and not properties
1228 // (excepting IE8 booleans)
1229 support.attributes = assert( function( el ) {
1230 el.className = "i";
1231 return !el.getAttribute( "className" );
1232 } );
1233
1234 /* getElement(s)By*
1235 ---------------------------------------------------------------------- */
1236
1237 // Check if getElementsByTagName("*") returns only elements
1238 support.getElementsByTagName = assert( function( el ) {
1239 el.appendChild( document.createComment( "" ) );
1240 return !el.getElementsByTagName( "*" ).length;
1241 } );
1242
1243 // Support: IE<9
1244 support.getElementsByClassName = rnative.test( document.getElementsByClassName );
1245
1246 // Support: IE<10
1247 // Check if getElementById returns elements by name 1152 // Check if getElementById returns elements by name
1248 // The broken getElementById methods don't pick up programmatically-set names, 1153 // The broken getElementById methods don't pick up programmatically-set names,
1249 // so use a roundabout getElementsByName test 1154 // so use a roundabout getElementsByName test
1250 support.getById = assert( function( el ) { 1155 support.getById = assert( function( el ) {
1251 docElem.appendChild( el ).id = expando; 1156 documentElement.appendChild( el ).id = jQuery.expando;
1252 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 }
1253 } ); 1190 } );
1254 1191
1255 // ID filter and find 1192 // ID filter and find
1256 if ( support.getById ) { 1193 if ( support.getById ) {
1257 Expr.filter[ "ID" ] = function( id ) { 1194 Expr.filter.ID = function( id ) {
1258 var attrId = id.replace( runescape, funescape ); 1195 var attrId = id.replace( runescape, funescape );
1259 return function( elem ) { 1196 return function( elem ) {
1260 return elem.getAttribute( "id" ) === attrId; 1197 return elem.getAttribute( "id" ) === attrId;
1261 }; 1198 };
1262 }; 1199 };
1263 Expr.find[ "ID" ] = function( id, context ) { 1200 Expr.find.ID = function( id, context ) {
1264 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1201 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1265 var elem = context.getElementById( id ); 1202 var elem = context.getElementById( id );
1266 return elem ? [ elem ] : []; 1203 return elem ? [ elem ] : [];
1267 } 1204 }
1268 }; 1205 };
1269 } else { 1206 } else {
1270 Expr.filter[ "ID" ] = function( id ) { 1207 Expr.filter.ID = function( id ) {
1271 var attrId = id.replace( runescape, funescape ); 1208 var attrId = id.replace( runescape, funescape );
1272 return function( elem ) { 1209 return function( elem ) {
1273 var node = typeof elem.getAttributeNode !== "undefined" && 1210 var node = typeof elem.getAttributeNode !== "undefined" &&
1274 elem.getAttributeNode( "id" ); 1211 elem.getAttributeNode( "id" );
1275 return node && node.value === attrId; 1212 return node && node.value === attrId;
1276 }; 1213 };
1277 }; 1214 };
1278 1215
1279 // Support: IE 6 - 7 only 1216 // Support: IE 6 - 7 only
1280 // getElementById is not reliable as a find shortcut 1217 // getElementById is not reliable as a find shortcut
1281 Expr.find[ "ID" ] = function( id, context ) { 1218 Expr.find.ID = function( id, context ) {
1282 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1219 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1283 var node, i, elems, 1220 var node, i, elems,
1284 elem = context.getElementById( id ); 1221 elem = context.getElementById( id );
1285 1222
1286 if ( elem ) { 1223 if ( elem ) {
1306 } 1243 }
1307 }; 1244 };
1308 } 1245 }
1309 1246
1310 // Tag 1247 // Tag
1311 Expr.find[ "TAG" ] = support.getElementsByTagName ? 1248 Expr.find.TAG = function( tag, context ) {
1312 function( tag, context ) { 1249 if ( typeof context.getElementsByTagName !== "undefined" ) {
1313 if ( typeof context.getElementsByTagName !== "undefined" ) { 1250 return context.getElementsByTagName( tag );
1314 return context.getElementsByTagName( tag ); 1251
1315 1252 // DocumentFragment nodes don't have gEBTN
1316 // DocumentFragment nodes don't have gEBTN 1253 } else {
1317 } else if ( support.qsa ) { 1254 return context.querySelectorAll( tag );
1318 return context.querySelectorAll( tag ); 1255 }
1319 } 1256 };
1320 } :
1321
1322 function( tag, context ) {
1323 var elem,
1324 tmp = [],
1325 i = 0,
1326
1327 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
1328 results = context.getElementsByTagName( tag );
1329
1330 // Filter out possible comments
1331 if ( tag === "*" ) {
1332 while ( ( elem = results[ i++ ] ) ) {
1333 if ( elem.nodeType === 1 ) {
1334 tmp.push( elem );
1335 }
1336 }
1337
1338 return tmp;
1339 }
1340 return results;
1341 };
1342 1257
1343 // Class 1258 // Class
1344 Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) { 1259 Expr.find.CLASS = function( className, context ) {
1345 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 1260 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
1346 return context.getElementsByClassName( className ); 1261 return context.getElementsByClassName( className );
1347 } 1262 }
1348 }; 1263 };
1349 1264
1350 /* QSA/matchesSelector 1265 /* QSA/matchesSelector
1351 ---------------------------------------------------------------------- */ 1266 ---------------------------------------------------------------------- */
1352 1267
1353 // QSA and matchesSelector support 1268 // QSA and matchesSelector support
1354 1269
1355 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
1356 rbuggyMatches = [];
1357
1358 // qSa(:focus) reports false when true (Chrome 21)
1359 // We allow this because of a bug in IE8/9 that throws an error
1360 // whenever `document.activeElement` is accessed on an iframe
1361 // So, we allow :focus to pass through QSA all the time to avoid the IE error
1362 // See https://bugs.jquery.com/ticket/13378
1363 rbuggyQSA = []; 1270 rbuggyQSA = [];
1364 1271
1365 if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) { 1272 // Build QSA regex
1366 1273 // Regex strategy adopted from Diego Perini
1367 // Build QSA regex 1274 assert( function( el ) {
1368 // Regex strategy adopted from Diego Perini 1275
1369 assert( function( el ) { 1276 var input;
1370 1277
1371 var input; 1278 documentElement.appendChild( el ).innerHTML =
1372 1279 "<a id='" + expando + "' href='' disabled='disabled'></a>" +
1373 // Select is set to empty string on purpose 1280 "<select id='" + expando + "-\r\\' disabled='disabled'>" +
1374 // This is to test IE's treatment of not explicitly 1281 "<option selected=''></option></select>";
1375 // setting a boolean content attribute, 1282
1376 // since its presence should be enough 1283 // Support: iOS <=7 - 8 only
1377 // https://bugs.jquery.com/ticket/12359 1284 // Boolean attributes and "value" are not treated correctly in some XML documents
1378 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + 1285 if ( !el.querySelectorAll( "[selected]" ).length ) {
1379 "<select id='" + expando + "-\r\\' msallowcapture=''>" + 1286 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1380 "<option selected=''></option></select>"; 1287 }
1381 1288
1382 // Support: IE8, Opera 11-12.16 1289 // Support: iOS <=7 - 8 only
1383 // Nothing should be selected when empty strings follow ^= or $= or *= 1290 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1384 // The test attribute must be unknown in Opera but "safe" for WinRT 1291 rbuggyQSA.push( "~=" );
1385 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section 1292 }
1386 if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) { 1293
1387 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); 1294 // Support: iOS 8 only
1388 } 1295 // https://bugs.webkit.org/show_bug.cgi?id=136851
1389 1296 // In-page `selector#id sibling-combinator selector` fails
1390 // Support: IE8 1297 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
1391 // Boolean attributes and "value" are not treated correctly 1298 rbuggyQSA.push( ".#.+[+~]" );
1392 if ( !el.querySelectorAll( "[selected]" ).length ) { 1299 }
1393 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 1300
1394 } 1301 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
1395 1302 // In some of the document kinds, these selectors wouldn't work natively.
1396 // 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
1397 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 1304 // handling them through jQuery traversal in jQuery 3.x.
1398 rbuggyQSA.push( "~=" ); 1305 if ( !el.querySelectorAll( ":checked" ).length ) {
1399 } 1306 rbuggyQSA.push( ":checked" );
1400 1307 }
1401 // Support: IE 11+, Edge 15 - 18+ 1308
1402 // IE 11/Edge don't find elements on a `[name='']` query in some cases. 1309 // Support: Windows 8 Native Apps
1403 // Adding a temporary attribute to the document before the selection works 1310 // The type and name attributes are restricted during .innerHTML assignment
1404 // around the issue. 1311 input = document.createElement( "input" );
1405 // Interestingly, IE 10 & older don't seem to have the issue. 1312 input.setAttribute( "type", "hidden" );
1406 input = document.createElement( "input" ); 1313 el.appendChild( input ).setAttribute( "name", "D" );
1407 input.setAttribute( "name", "" ); 1314
1408 el.appendChild( input ); 1315 // Support: IE 9 - 11+
1409 if ( !el.querySelectorAll( "[name='']" ).length ) { 1316 // IE's :disabled selector does not pick up the children of disabled fieldsets
1410 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + 1317 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+
1411 whitespace + "*(?:''|\"\")" ); 1318 // In some of the document kinds, these selectors wouldn't work natively.
1412 } 1319 // This is probably OK but for backwards compatibility we want to maintain
1413 1320 // handling them through jQuery traversal in jQuery 3.x.
1414 // Webkit/Opera - :checked should return selected option elements 1321 documentElement.appendChild( el ).disabled = true;
1415 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 1322 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
1416 // IE8 throws error here and will not see later tests 1323 rbuggyQSA.push( ":enabled", ":disabled" );
1417 if ( !el.querySelectorAll( ":checked" ).length ) { 1324 }
1418 rbuggyQSA.push( ":checked" ); 1325
1419 } 1326 // Support: IE 11+, Edge 15 - 18+
1420 1327 // IE 11/Edge don't find elements on a `[name='']` query in some cases.
1421 // Support: Safari 8+, iOS 8+ 1328 // Adding a temporary attribute to the document before the selection works
1422 // https://bugs.webkit.org/show_bug.cgi?id=136851 1329 // around the issue.
1423 // In-page `selector#id sibling-combinator selector` fails 1330 // Interestingly, IE 10 & older don't seem to have the issue.
1424 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 1331 input = document.createElement( "input" );
1425 rbuggyQSA.push( ".#.+[+~]" ); 1332 input.setAttribute( "name", "" );
1426 } 1333 el.appendChild( input );
1427 1334 if ( !el.querySelectorAll( "[name='']" ).length ) {
1428 // Support: Firefox <=3.6 - 5 only 1335 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" +
1429 // Old Firefox doesn't throw on a badly-escaped identifier. 1336 whitespace + "*(?:''|\"\")" );
1430 el.querySelectorAll( "\\\f" ); 1337 }
1431 rbuggyQSA.push( "[\\r\\n\\f]" ); 1338 } );
1432 } ); 1339
1433 1340 if ( !support.cssHas ) {
1434 assert( function( el ) { 1341
1435 el.innerHTML = "<a href='' disabled='disabled'></a>" + 1342 // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+
1436 "<select disabled='disabled'><option/></select>"; 1343 // Our regular `try-catch` mechanism fails to detect natively-unsupported
1437 1344 // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`)
1438 // Support: Windows 8 Native Apps 1345 // in browsers that parse the `:has()` argument as a forgiving selector list.
1439 // The type and name attributes are restricted during .innerHTML assignment 1346 // https://drafts.csswg.org/selectors/#relational now requires the argument
1440 var input = document.createElement( "input" ); 1347 // to be parsed unforgivingly, but browsers have not yet fully adjusted.
1441 input.setAttribute( "type", "hidden" );
1442 el.appendChild( input ).setAttribute( "name", "D" );
1443
1444 // Support: IE8
1445 // Enforce case-sensitivity of name attribute
1446 if ( el.querySelectorAll( "[name=d]" ).length ) {
1447 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1448 }
1449
1450 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1451 // IE8 throws error here and will not see later tests
1452 if ( el.querySelectorAll( ":enabled" ).length !== 2 ) {
1453 rbuggyQSA.push( ":enabled", ":disabled" );
1454 }
1455
1456 // Support: IE9-11+
1457 // IE's :disabled selector does not pick up the children of disabled fieldsets
1458 docElem.appendChild( el ).disabled = true;
1459 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) {
1460 rbuggyQSA.push( ":enabled", ":disabled" );
1461 }
1462
1463 // Support: Opera 10 - 11 only
1464 // Opera 10-11 does not throw on post-comma invalid pseudos
1465 el.querySelectorAll( "*,:x" );
1466 rbuggyQSA.push( ",.*:" );
1467 } );
1468 }
1469
1470 if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches ||
1471 docElem.webkitMatchesSelector ||
1472 docElem.mozMatchesSelector ||
1473 docElem.oMatchesSelector ||
1474 docElem.msMatchesSelector ) ) ) ) {
1475
1476 assert( function( el ) {
1477
1478 // Check to see if it's possible to do matchesSelector
1479 // on a disconnected node (IE 9)
1480 support.disconnectedMatch = matches.call( el, "*" );
1481
1482 // This should fail with an exception
1483 // Gecko does not error, returns false instead
1484 matches.call( el, "[s!='']:x" );
1485 rbuggyMatches.push( "!=", pseudos );
1486 } );
1487 }
1488
1489 if ( !support.cssSupportsSelector ) {
1490
1491 // Support: Chrome 105+, Safari 15.4+
1492 // `:has()` uses a forgiving selector list as an argument so our regular
1493 // `try-catch` mechanism fails to catch `:has()` with arguments not supported
1494 // natively like `:has(:contains("Foo"))`. Where supported & spec-compliant,
1495 // we now use `CSS.supports("selector(:is(SELECTOR_TO_BE_TESTED))")`, but
1496 // outside that we mark `:has` as buggy.
1497 rbuggyQSA.push( ":has" ); 1348 rbuggyQSA.push( ":has" );
1498 } 1349 }
1499 1350
1500 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); 1351 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) );
1501 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) );
1502
1503 /* Contains
1504 ---------------------------------------------------------------------- */
1505 hasCompare = rnative.test( docElem.compareDocumentPosition );
1506
1507 // Element contains another
1508 // Purposefully self-exclusive
1509 // As in, an element does not contain itself
1510 contains = hasCompare || rnative.test( docElem.contains ) ?
1511 function( a, b ) {
1512
1513 // Support: IE <9 only
1514 // IE doesn't have `contains` on `document` so we need to check for
1515 // `documentElement` presence.
1516 // We need to fall back to `a` when `documentElement` is missing
1517 // as `ownerDocument` of elements within `<template/>` may have
1518 // a null one - a default behavior of all modern browsers.
1519 var adown = a.nodeType === 9 && a.documentElement || a,
1520 bup = b && b.parentNode;
1521 return a === bup || !!( bup && bup.nodeType === 1 && (
1522 adown.contains ?
1523 adown.contains( bup ) :
1524 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1525 ) );
1526 } :
1527 function( a, b ) {
1528 if ( b ) {
1529 while ( ( b = b.parentNode ) ) {
1530 if ( b === a ) {
1531 return true;
1532 }
1533 }
1534 }
1535 return false;
1536 };
1537 1352
1538 /* Sorting 1353 /* Sorting
1539 ---------------------------------------------------------------------- */ 1354 ---------------------------------------------------------------------- */
1540 1355
1541 // Document order sorting 1356 // Document order sorting
1542 sortOrder = hasCompare ? 1357 sortOrder = function( a, b ) {
1543 function( a, b ) {
1544 1358
1545 // Flag for duplicate removal 1359 // Flag for duplicate removal
1546 if ( a === b ) { 1360 if ( a === b ) {
1547 hasDuplicate = true; 1361 hasDuplicate = true;
1548 return 0; 1362 return 0;
1572 // Choose the first element that is related to our preferred document 1386 // Choose the first element that is related to our preferred document
1573 // Support: IE 11+, Edge 17 - 18+ 1387 // Support: IE 11+, Edge 17 - 18+
1574 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1388 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1575 // two documents; shallow comparisons work. 1389 // two documents; shallow comparisons work.
1576 // eslint-disable-next-line eqeqeq 1390 // eslint-disable-next-line eqeqeq
1577 if ( a == document || a.ownerDocument == preferredDoc && 1391 if ( a === document || a.ownerDocument == preferredDoc &&
1578 contains( preferredDoc, a ) ) { 1392 find.contains( preferredDoc, a ) ) {
1579 return -1; 1393 return -1;
1580 } 1394 }
1581 1395
1582 // Support: IE 11+, Edge 17 - 18+ 1396 // Support: IE 11+, Edge 17 - 18+
1583 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1397 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1584 // two documents; shallow comparisons work. 1398 // two documents; shallow comparisons work.
1585 // eslint-disable-next-line eqeqeq 1399 // eslint-disable-next-line eqeqeq
1586 if ( b == document || b.ownerDocument == preferredDoc && 1400 if ( b === document || b.ownerDocument == preferredDoc &&
1587 contains( preferredDoc, b ) ) { 1401 find.contains( preferredDoc, b ) ) {
1588 return 1; 1402 return 1;
1589 } 1403 }
1590 1404
1591 // Maintain original order 1405 // Maintain original order
1592 return sortInput ? 1406 return sortInput ?
1593 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 1407 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
1594 0; 1408 0;
1595 } 1409 }
1596 1410
1597 return compare & 4 ? -1 : 1; 1411 return compare & 4 ? -1 : 1;
1598 } :
1599 function( a, b ) {
1600
1601 // Exit early if the nodes are identical
1602 if ( a === b ) {
1603 hasDuplicate = true;
1604 return 0;
1605 }
1606
1607 var cur,
1608 i = 0,
1609 aup = a.parentNode,
1610 bup = b.parentNode,
1611 ap = [ a ],
1612 bp = [ b ];
1613
1614 // Parentless nodes are either documents or disconnected
1615 if ( !aup || !bup ) {
1616
1617 // Support: IE 11+, Edge 17 - 18+
1618 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1619 // two documents; shallow comparisons work.
1620 /* eslint-disable eqeqeq */
1621 return a == document ? -1 :
1622 b == document ? 1 :
1623 /* eslint-enable eqeqeq */
1624 aup ? -1 :
1625 bup ? 1 :
1626 sortInput ?
1627 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1628 0;
1629
1630 // If the nodes are siblings, we can do a quick check
1631 } else if ( aup === bup ) {
1632 return siblingCheck( a, b );
1633 }
1634
1635 // Otherwise we need full lists of their ancestors for comparison
1636 cur = a;
1637 while ( ( cur = cur.parentNode ) ) {
1638 ap.unshift( cur );
1639 }
1640 cur = b;
1641 while ( ( cur = cur.parentNode ) ) {
1642 bp.unshift( cur );
1643 }
1644
1645 // Walk down the tree looking for a discrepancy
1646 while ( ap[ i ] === bp[ i ] ) {
1647 i++;
1648 }
1649
1650 return i ?
1651
1652 // Do a sibling check if the nodes have a common ancestor
1653 siblingCheck( ap[ i ], bp[ i ] ) :
1654
1655 // Otherwise nodes in our document sort first
1656 // Support: IE 11+, Edge 17 - 18+
1657 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1658 // two documents; shallow comparisons work.
1659 /* eslint-disable eqeqeq */
1660 ap[ i ] == preferredDoc ? -1 :
1661 bp[ i ] == preferredDoc ? 1 :
1662 /* eslint-enable eqeqeq */
1663 0;
1664 }; 1412 };
1665 1413
1666 return document; 1414 return document;
1415 }
1416
1417 find.matches = function( expr, elements ) {
1418 return find( expr, null, null, elements );
1667 }; 1419 };
1668 1420
1669 Sizzle.matches = function( expr, elements ) { 1421 find.matchesSelector = function( elem, expr ) {
1670 return Sizzle( expr, null, null, elements );
1671 };
1672
1673 Sizzle.matchesSelector = function( elem, expr ) {
1674 setDocument( elem ); 1422 setDocument( elem );
1675 1423
1676 if ( support.matchesSelector && documentIsHTML && 1424 if ( documentIsHTML &&
1677 !nonnativeSelectorCache[ expr + " " ] && 1425 !nonnativeSelectorCache[ expr + " " ] &&
1678 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && 1426 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
1679 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
1680 1427
1681 try { 1428 try {
1682 var ret = matches.call( elem, expr ); 1429 var ret = matches.call( elem, expr );
1683 1430
1684 // IE 9's matchesSelector returns false on disconnected nodes 1431 // IE 9's matchesSelector returns false on disconnected nodes
1685 if ( ret || support.disconnectedMatch || 1432 if ( ret || support.disconnectedMatch ||
1686 1433
1687 // As well, disconnected nodes are said to be in a document 1434 // As well, disconnected nodes are said to be in a document
1688 // fragment in IE 9 1435 // fragment in IE 9
1689 elem.document && elem.document.nodeType !== 11 ) { 1436 elem.document && elem.document.nodeType !== 11 ) {
1690 return ret; 1437 return ret;
1691 } 1438 }
1692 } catch ( e ) { 1439 } catch ( e ) {
1693 nonnativeSelectorCache( expr, true ); 1440 nonnativeSelectorCache( expr, true );
1694 } 1441 }
1695 } 1442 }
1696 1443
1697 return Sizzle( expr, document, null, [ elem ] ).length > 0; 1444 return find( expr, document, null, [ elem ] ).length > 0;
1698 }; 1445 };
1699 1446
1700 Sizzle.contains = function( context, elem ) { 1447 find.contains = function( context, elem ) {
1701 1448
1702 // Set document vars if needed 1449 // Set document vars if needed
1703 // Support: IE 11+, Edge 17 - 18+ 1450 // Support: IE 11+, Edge 17 - 18+
1704 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1451 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1705 // two documents; shallow comparisons work. 1452 // two documents; shallow comparisons work.
1706 // eslint-disable-next-line eqeqeq 1453 // eslint-disable-next-line eqeqeq
1707 if ( ( context.ownerDocument || context ) != document ) { 1454 if ( ( context.ownerDocument || context ) != document ) {
1708 setDocument( context ); 1455 setDocument( context );
1709 } 1456 }
1710 return contains( context, elem ); 1457 return jQuery.contains( context, elem );
1711 }; 1458 };
1712 1459
1713 Sizzle.attr = function( elem, name ) { 1460
1461 find.attr = function( elem, name ) {
1714 1462
1715 // Set document vars if needed 1463 // Set document vars if needed
1716 // Support: IE 11+, Edge 17 - 18+ 1464 // Support: IE 11+, Edge 17 - 18+
1717 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1465 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing
1718 // two documents; shallow comparisons work. 1466 // two documents; shallow comparisons work.
1721 setDocument( elem ); 1469 setDocument( elem );
1722 } 1470 }
1723 1471
1724 var fn = Expr.attrHandle[ name.toLowerCase() ], 1472 var fn = Expr.attrHandle[ name.toLowerCase() ],
1725 1473
1726 // Don't get fooled by Object.prototype properties (jQuery #13807) 1474 // Don't get fooled by Object.prototype properties (see trac-13807)
1727 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 1475 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1728 fn( elem, name, !documentIsHTML ) : 1476 fn( elem, name, !documentIsHTML ) :
1729 undefined; 1477 undefined;
1730 1478
1731 return val !== undefined ? 1479 if ( val !== undefined ) {
1732 val : 1480 return val;
1733 support.attributes || !documentIsHTML ? 1481 }
1734 elem.getAttribute( name ) : 1482
1735 ( val = elem.getAttributeNode( name ) ) && val.specified ? 1483 return elem.getAttribute( name );
1736 val.value :
1737 null;
1738 }; 1484 };
1739 1485
1740 Sizzle.escape = function( sel ) { 1486 find.error = function( msg ) {
1741 return ( sel + "" ).replace( rcssescape, fcssescape );
1742 };
1743
1744 Sizzle.error = function( msg ) {
1745 throw new Error( "Syntax error, unrecognized expression: " + msg ); 1487 throw new Error( "Syntax error, unrecognized expression: " + msg );
1746 }; 1488 };
1747 1489
1748 /** 1490 /**
1749 * Document sorting and removing duplicates 1491 * Document sorting and removing duplicates
1750 * @param {ArrayLike} results 1492 * @param {ArrayLike} results
1751 */ 1493 */
1752 Sizzle.uniqueSort = function( results ) { 1494 jQuery.uniqueSort = function( results ) {
1753 var elem, 1495 var elem,
1754 duplicates = [], 1496 duplicates = [],
1755 j = 0, 1497 j = 0,
1756 i = 0; 1498 i = 0;
1757 1499
1758 // Unless we *know* we can detect duplicates, assume their presence 1500 // Unless we *know* we can detect duplicates, assume their presence
1759 hasDuplicate = !support.detectDuplicates; 1501 //
1760 sortInput = !support.sortStable && results.slice( 0 ); 1502 // Support: Android <=4.0+
1761 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 );
1762 1508
1763 if ( hasDuplicate ) { 1509 if ( hasDuplicate ) {
1764 while ( ( elem = results[ i++ ] ) ) { 1510 while ( ( elem = results[ i++ ] ) ) {
1765 if ( elem === results[ i ] ) { 1511 if ( elem === results[ i ] ) {
1766 j = duplicates.push( i ); 1512 j = duplicates.push( i );
1767 } 1513 }
1768 } 1514 }
1769 while ( j-- ) { 1515 while ( j-- ) {
1770 results.splice( duplicates[ j ], 1 ); 1516 splice.call( results, duplicates[ j ], 1 );
1771 } 1517 }
1772 } 1518 }
1773 1519
1774 // Clear input after sorting to release objects 1520 // Clear input after sorting to release objects
1775 // See https://github.com/jquery/sizzle/pull/225 1521 // See https://github.com/jquery/sizzle/pull/225
1776 sortInput = null; 1522 sortInput = null;
1777 1523
1778 return results; 1524 return results;
1779 }; 1525 };
1780 1526
1781 /** 1527 jQuery.fn.uniqueSort = function() {
1782 * Utility function for retrieving the text value of an array of DOM nodes 1528 return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) );
1783 * @param {Array|Element} elem
1784 */
1785 getText = Sizzle.getText = function( elem ) {
1786 var node,
1787 ret = "",
1788 i = 0,
1789 nodeType = elem.nodeType;
1790
1791 if ( !nodeType ) {
1792
1793 // If no nodeType, this is expected to be an array
1794 while ( ( node = elem[ i++ ] ) ) {
1795
1796 // Do not traverse comment nodes
1797 ret += getText( node );
1798 }
1799 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1800
1801 // Use textContent for elements
1802 // innerText usage removed for consistency of new lines (jQuery #11153)
1803 if ( typeof elem.textContent === "string" ) {
1804 return elem.textContent;
1805 } else {
1806
1807 // Traverse its children
1808 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1809 ret += getText( elem );
1810 }
1811 }
1812 } else if ( nodeType === 3 || nodeType === 4 ) {
1813 return elem.nodeValue;
1814 }
1815
1816 // Do not include comment or processing instruction nodes
1817
1818 return ret;
1819 }; 1529 };
1820 1530
1821 Expr = Sizzle.selectors = { 1531 Expr = jQuery.expr = {
1822 1532
1823 // Can be adjusted by the user 1533 // Can be adjusted by the user
1824 cacheLength: 50, 1534 cacheLength: 50,
1825 1535
1826 createPseudo: markFunction, 1536 createPseudo: markFunction,
1837 "+": { dir: "previousSibling", first: true }, 1547 "+": { dir: "previousSibling", first: true },
1838 "~": { dir: "previousSibling" } 1548 "~": { dir: "previousSibling" }
1839 }, 1549 },
1840 1550
1841 preFilter: { 1551 preFilter: {
1842 "ATTR": function( match ) { 1552 ATTR: function( match ) {
1843 match[ 1 ] = match[ 1 ].replace( runescape, funescape ); 1553 match[ 1 ] = match[ 1 ].replace( runescape, funescape );
1844 1554
1845 // Move the given value to match[3] whether quoted or unquoted 1555 // Move the given value to match[3] whether quoted or unquoted
1846 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || 1556 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" )
1847 match[ 5 ] || "" ).replace( runescape, funescape ); 1557 .replace( runescape, funescape );
1848 1558
1849 if ( match[ 2 ] === "~=" ) { 1559 if ( match[ 2 ] === "~=" ) {
1850 match[ 3 ] = " " + match[ 3 ] + " "; 1560 match[ 3 ] = " " + match[ 3 ] + " ";
1851 } 1561 }
1852 1562
1853 return match.slice( 0, 4 ); 1563 return match.slice( 0, 4 );
1854 }, 1564 },
1855 1565
1856 "CHILD": function( match ) { 1566 CHILD: function( match ) {
1857 1567
1858 /* matches from matchExpr["CHILD"] 1568 /* matches from matchExpr["CHILD"]
1859 1 type (only|nth|...) 1569 1 type (only|nth|...)
1860 2 what (child|of-type) 1570 2 what (child|of-type)
1861 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 1571 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
1869 1579
1870 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { 1580 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) {
1871 1581
1872 // nth-* requires argument 1582 // nth-* requires argument
1873 if ( !match[ 3 ] ) { 1583 if ( !match[ 3 ] ) {
1874 Sizzle.error( match[ 0 ] ); 1584 find.error( match[ 0 ] );
1875 } 1585 }
1876 1586
1877 // numeric x and y parameters for Expr.filter.CHILD 1587 // numeric x and y parameters for Expr.filter.CHILD
1878 // remember that false/true cast respectively to 0/1 1588 // remember that false/true cast respectively to 0/1
1879 match[ 4 ] = +( match[ 4 ] ? 1589 match[ 4 ] = +( match[ 4 ] ?
1880 match[ 5 ] + ( match[ 6 ] || 1 ) : 1590 match[ 5 ] + ( match[ 6 ] || 1 ) :
1881 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) ); 1591 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" )
1592 );
1882 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); 1593 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" );
1883 1594
1884 // other types prohibit arguments 1595 // other types prohibit arguments
1885 } else if ( match[ 3 ] ) { 1596 } else if ( match[ 3 ] ) {
1886 Sizzle.error( match[ 0 ] ); 1597 find.error( match[ 0 ] );
1887 } 1598 }
1888 1599
1889 return match; 1600 return match;
1890 }, 1601 },
1891 1602
1892 "PSEUDO": function( match ) { 1603 PSEUDO: function( match ) {
1893 var excess, 1604 var excess,
1894 unquoted = !match[ 6 ] && match[ 2 ]; 1605 unquoted = !match[ 6 ] && match[ 2 ];
1895 1606
1896 if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) { 1607 if ( matchExpr.CHILD.test( match[ 0 ] ) ) {
1897 return null; 1608 return null;
1898 } 1609 }
1899 1610
1900 // Accept quoted arguments as-is 1611 // Accept quoted arguments as-is
1901 if ( match[ 3 ] ) { 1612 if ( match[ 3 ] ) {
1920 } 1631 }
1921 }, 1632 },
1922 1633
1923 filter: { 1634 filter: {
1924 1635
1925 "TAG": function( nodeNameSelector ) { 1636 TAG: function( nodeNameSelector ) {
1926 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 1637 var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1927 return nodeNameSelector === "*" ? 1638 return nodeNameSelector === "*" ?
1928 function() { 1639 function() {
1929 return true; 1640 return true;
1930 } : 1641 } :
1931 function( elem ) { 1642 function( elem ) {
1932 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 1643 return nodeName( elem, expectedNodeName );
1933 }; 1644 };
1934 }, 1645 },
1935 1646
1936 "CLASS": function( className ) { 1647 CLASS: function( className ) {
1937 var pattern = classCache[ className + " " ]; 1648 var pattern = classCache[ className + " " ];
1938 1649
1939 return pattern || 1650 return pattern ||
1940 ( pattern = new RegExp( "(^|" + whitespace + 1651 ( pattern = new RegExp( "(^|" + whitespace + ")" + className +
1941 ")" + className + "(" + whitespace + "|$)" ) ) && classCache( 1652 "(" + whitespace + "|$)" ) ) &&
1942 className, function( elem ) { 1653 classCache( className, function( elem ) {
1943 return pattern.test( 1654 return pattern.test(
1944 typeof elem.className === "string" && elem.className || 1655 typeof elem.className === "string" && elem.className ||
1945 typeof elem.getAttribute !== "undefined" && 1656 typeof elem.getAttribute !== "undefined" &&
1946 elem.getAttribute( "class" ) || 1657 elem.getAttribute( "class" ) ||
1947 "" 1658 ""
1948 ); 1659 );
1949 } ); 1660 } );
1950 }, 1661 },
1951 1662
1952 "ATTR": function( name, operator, check ) { 1663 ATTR: function( name, operator, check ) {
1953 return function( elem ) { 1664 return function( elem ) {
1954 var result = Sizzle.attr( elem, name ); 1665 var result = find.attr( elem, name );
1955 1666
1956 if ( result == null ) { 1667 if ( result == null ) {
1957 return operator === "!="; 1668 return operator === "!=";
1958 } 1669 }
1959 if ( !operator ) { 1670 if ( !operator ) {
1960 return true; 1671 return true;
1961 } 1672 }
1962 1673
1963 result += ""; 1674 result += "";
1964 1675
1965 /* eslint-disable max-len */ 1676 if ( operator === "=" ) {
1966 1677 return result === check;
1967 return operator === "=" ? result === check : 1678 }
1968 operator === "!=" ? result !== check : 1679 if ( operator === "!=" ) {
1969 operator === "^=" ? check && result.indexOf( check ) === 0 : 1680 return result !== check;
1970 operator === "*=" ? check && result.indexOf( check ) > -1 : 1681 }
1971 operator === "$=" ? check && result.slice( -check.length ) === check : 1682 if ( operator === "^=" ) {
1972 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : 1683 return check && result.indexOf( check ) === 0;
1973 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : 1684 }
1974 false; 1685 if ( operator === "*=" ) {
1975 /* eslint-enable max-len */ 1686 return check && result.indexOf( check ) > -1;
1976 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;
1977 }; 1700 };
1978 }, 1701 },
1979 1702
1980 "CHILD": function( type, what, _argument, first, last ) { 1703 CHILD: function( type, what, _argument, first, last ) {
1981 var simple = type.slice( 0, 3 ) !== "nth", 1704 var simple = type.slice( 0, 3 ) !== "nth",
1982 forward = type.slice( -4 ) !== "last", 1705 forward = type.slice( -4 ) !== "last",
1983 ofType = what === "of-type"; 1706 ofType = what === "of-type";
1984 1707
1985 return first === 1 && last === 0 ? 1708 return first === 1 && last === 0 ?
1988 function( elem ) { 1711 function( elem ) {
1989 return !!elem.parentNode; 1712 return !!elem.parentNode;
1990 } : 1713 } :
1991 1714
1992 function( elem, _context, xml ) { 1715 function( elem, _context, xml ) {
1993 var cache, uniqueCache, outerCache, node, nodeIndex, start, 1716 var cache, outerCache, node, nodeIndex, start,
1994 dir = simple !== forward ? "nextSibling" : "previousSibling", 1717 dir = simple !== forward ? "nextSibling" : "previousSibling",
1995 parent = elem.parentNode, 1718 parent = elem.parentNode,
1996 name = ofType && elem.nodeName.toLowerCase(), 1719 name = ofType && elem.nodeName.toLowerCase(),
1997 useCache = !xml && !ofType, 1720 useCache = !xml && !ofType,
1998 diff = false; 1721 diff = false;
2003 if ( simple ) { 1726 if ( simple ) {
2004 while ( dir ) { 1727 while ( dir ) {
2005 node = elem; 1728 node = elem;
2006 while ( ( node = node[ dir ] ) ) { 1729 while ( ( node = node[ dir ] ) ) {
2007 if ( ofType ? 1730 if ( ofType ?
2008 node.nodeName.toLowerCase() === name : 1731 nodeName( node, name ) :
2009 node.nodeType === 1 ) { 1732 node.nodeType === 1 ) {
2010 1733
2011 return false; 1734 return false;
2012 } 1735 }
2013 } 1736 }
2022 1745
2023 // non-xml :nth-child(...) stores cache data on `parent` 1746 // non-xml :nth-child(...) stores cache data on `parent`
2024 if ( forward && useCache ) { 1747 if ( forward && useCache ) {
2025 1748
2026 // Seek `elem` from a previously-cached index 1749 // Seek `elem` from a previously-cached index
2027 1750 outerCache = parent[ expando ] || ( parent[ expando ] = {} );
2028 // ...in a gzip-friendly way 1751 cache = outerCache[ type ] || [];
2029 node = parent;
2030 outerCache = node[ expando ] || ( node[ expando ] = {} );
2031
2032 // Support: IE <9 only
2033 // Defend against cloned attroperties (jQuery gh-1709)
2034 uniqueCache = outerCache[ node.uniqueID ] ||
2035 ( outerCache[ node.uniqueID ] = {} );
2036
2037 cache = uniqueCache[ type ] || [];
2038 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1752 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
2039 diff = nodeIndex && cache[ 2 ]; 1753 diff = nodeIndex && cache[ 2 ];
2040 node = nodeIndex && parent.childNodes[ nodeIndex ]; 1754 node = nodeIndex && parent.childNodes[ nodeIndex ];
2041 1755
2042 while ( ( node = ++nodeIndex && node && node[ dir ] || 1756 while ( ( node = ++nodeIndex && node && node[ dir ] ||
2044 // Fallback to seeking `elem` from the start 1758 // Fallback to seeking `elem` from the start
2045 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 1759 ( diff = nodeIndex = 0 ) || start.pop() ) ) {
2046 1760
2047 // When found, cache indexes on `parent` and break 1761 // When found, cache indexes on `parent` and break
2048 if ( node.nodeType === 1 && ++diff && node === elem ) { 1762 if ( node.nodeType === 1 && ++diff && node === elem ) {
2049 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; 1763 outerCache[ type ] = [ dirruns, nodeIndex, diff ];
2050 break; 1764 break;
2051 } 1765 }
2052 } 1766 }
2053 1767
2054 } else { 1768 } else {
2055 1769
2056 // Use previously-cached element index if available 1770 // Use previously-cached element index if available
2057 if ( useCache ) { 1771 if ( useCache ) {
2058 1772 outerCache = elem[ expando ] || ( elem[ expando ] = {} );
2059 // ...in a gzip-friendly way 1773 cache = outerCache[ type ] || [];
2060 node = elem;
2061 outerCache = node[ expando ] || ( node[ expando ] = {} );
2062
2063 // Support: IE <9 only
2064 // Defend against cloned attroperties (jQuery gh-1709)
2065 uniqueCache = outerCache[ node.uniqueID ] ||
2066 ( outerCache[ node.uniqueID ] = {} );
2067
2068 cache = uniqueCache[ type ] || [];
2069 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1774 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
2070 diff = nodeIndex; 1775 diff = nodeIndex;
2071 } 1776 }
2072 1777
2073 // xml :nth-child(...) 1778 // xml :nth-child(...)
2077 // 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
2078 while ( ( node = ++nodeIndex && node && node[ dir ] || 1783 while ( ( node = ++nodeIndex && node && node[ dir ] ||
2079 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 1784 ( diff = nodeIndex = 0 ) || start.pop() ) ) {
2080 1785
2081 if ( ( ofType ? 1786 if ( ( ofType ?
2082 node.nodeName.toLowerCase() === name : 1787 nodeName( node, name ) :
2083 node.nodeType === 1 ) && 1788 node.nodeType === 1 ) &&
2084 ++diff ) { 1789 ++diff ) {
2085 1790
2086 // Cache the index of each encountered element 1791 // Cache the index of each encountered element
2087 if ( useCache ) { 1792 if ( useCache ) {
2088 outerCache = node[ expando ] || 1793 outerCache = node[ expando ] ||
2089 ( node[ expando ] = {} ); 1794 ( node[ expando ] = {} );
2090 1795 outerCache[ type ] = [ dirruns, diff ];
2091 // Support: IE <9 only
2092 // Defend against cloned attroperties (jQuery gh-1709)
2093 uniqueCache = outerCache[ node.uniqueID ] ||
2094 ( outerCache[ node.uniqueID ] = {} );
2095
2096 uniqueCache[ type ] = [ dirruns, diff ];
2097 } 1796 }
2098 1797
2099 if ( node === elem ) { 1798 if ( node === elem ) {
2100 break; 1799 break;
2101 } 1800 }
2109 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 1808 return diff === first || ( diff % first === 0 && diff / first >= 0 );
2110 } 1809 }
2111 }; 1810 };
2112 }, 1811 },
2113 1812
2114 "PSEUDO": function( pseudo, argument ) { 1813 PSEUDO: function( pseudo, argument ) {
2115 1814
2116 // pseudo-class names are case-insensitive 1815 // pseudo-class names are case-insensitive
2117 // http://www.w3.org/TR/selectors/#pseudo-classes 1816 // https://www.w3.org/TR/selectors/#pseudo-classes
2118 // 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
2119 // Remember that setFilters inherits from pseudos 1818 // Remember that setFilters inherits from pseudos
2120 var args, 1819 var args,
2121 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 1820 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
2122 Sizzle.error( "unsupported pseudo: " + pseudo ); 1821 find.error( "unsupported pseudo: " + pseudo );
2123 1822
2124 // The user may use createPseudo to indicate that 1823 // The user may use createPseudo to indicate that
2125 // arguments are needed to create the filter function 1824 // arguments are needed to create the filter function
2126 // just as Sizzle does 1825 // just as jQuery does
2127 if ( fn[ expando ] ) { 1826 if ( fn[ expando ] ) {
2128 return fn( argument ); 1827 return fn( argument );
2129 } 1828 }
2130 1829
2131 // But maintain support for old signatures 1830 // But maintain support for old signatures
2135 markFunction( function( seed, matches ) { 1834 markFunction( function( seed, matches ) {
2136 var idx, 1835 var idx,
2137 matched = fn( seed, argument ), 1836 matched = fn( seed, argument ),
2138 i = matched.length; 1837 i = matched.length;
2139 while ( i-- ) { 1838 while ( i-- ) {
2140 idx = indexOf( seed, matched[ i ] ); 1839 idx = indexOf.call( seed, matched[ i ] );
2141 seed[ idx ] = !( matches[ idx ] = matched[ i ] ); 1840 seed[ idx ] = !( matches[ idx ] = matched[ i ] );
2142 } 1841 }
2143 } ) : 1842 } ) :
2144 function( elem ) { 1843 function( elem ) {
2145 return fn( elem, 0, args ); 1844 return fn( elem, 0, args );
2151 }, 1850 },
2152 1851
2153 pseudos: { 1852 pseudos: {
2154 1853
2155 // Potentially complex pseudos 1854 // Potentially complex pseudos
2156 "not": markFunction( function( selector ) { 1855 not: markFunction( function( selector ) {
2157 1856
2158 // Trim the selector passed to compile 1857 // Trim the selector passed to compile
2159 // to avoid treating leading and trailing 1858 // to avoid treating leading and trailing
2160 // spaces as combinators 1859 // spaces as combinators
2161 var input = [], 1860 var input = [],
2162 results = [], 1861 results = [],
2163 matcher = compile( selector.replace( rtrim, "$1" ) ); 1862 matcher = compile( selector.replace( rtrimCSS, "$1" ) );
2164 1863
2165 return matcher[ expando ] ? 1864 return matcher[ expando ] ?
2166 markFunction( function( seed, matches, _context, xml ) { 1865 markFunction( function( seed, matches, _context, xml ) {
2167 var elem, 1866 var elem,
2168 unmatched = matcher( seed, null, xml, [] ), 1867 unmatched = matcher( seed, null, xml, [] ),
2177 } ) : 1876 } ) :
2178 function( elem, _context, xml ) { 1877 function( elem, _context, xml ) {
2179 input[ 0 ] = elem; 1878 input[ 0 ] = elem;
2180 matcher( input, null, xml, results ); 1879 matcher( input, null, xml, results );
2181 1880
2182 // Don't keep the element (issue #299) 1881 // Don't keep the element
1882 // (see https://github.com/jquery/sizzle/issues/299)
2183 input[ 0 ] = null; 1883 input[ 0 ] = null;
2184 return !results.pop(); 1884 return !results.pop();
2185 }; 1885 };
2186 } ), 1886 } ),
2187 1887
2188 "has": markFunction( function( selector ) { 1888 has: markFunction( function( selector ) {
2189 return function( elem ) { 1889 return function( elem ) {
2190 return Sizzle( selector, elem ).length > 0; 1890 return find( selector, elem ).length > 0;
2191 }; 1891 };
2192 } ), 1892 } ),
2193 1893
2194 "contains": markFunction( function( text ) { 1894 contains: markFunction( function( text ) {
2195 text = text.replace( runescape, funescape ); 1895 text = text.replace( runescape, funescape );
2196 return function( elem ) { 1896 return function( elem ) {
2197 return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; 1897 return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1;
2198 }; 1898 };
2199 } ), 1899 } ),
2200 1900
2201 // "Whether an element is represented by a :lang() selector 1901 // "Whether an element is represented by a :lang() selector
2202 // is based solely on the element's language value 1902 // is based solely on the element's language value
2203 // being equal to the identifier C, 1903 // being equal to the identifier C,
2204 // or beginning with the identifier C immediately followed by "-". 1904 // or beginning with the identifier C immediately followed by "-".
2205 // 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.
2206 // 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."
2207 // http://www.w3.org/TR/selectors/#lang-pseudo 1907 // https://www.w3.org/TR/selectors/#lang-pseudo
2208 "lang": markFunction( function( lang ) { 1908 lang: markFunction( function( lang ) {
2209 1909
2210 // lang value must be a valid identifier 1910 // lang value must be a valid identifier
2211 if ( !ridentifier.test( lang || "" ) ) { 1911 if ( !ridentifier.test( lang || "" ) ) {
2212 Sizzle.error( "unsupported lang: " + lang ); 1912 find.error( "unsupported lang: " + lang );
2213 } 1913 }
2214 lang = lang.replace( runescape, funescape ).toLowerCase(); 1914 lang = lang.replace( runescape, funescape ).toLowerCase();
2215 return function( elem ) { 1915 return function( elem ) {
2216 var elemLang; 1916 var elemLang;
2217 do { 1917 do {
2226 return false; 1926 return false;
2227 }; 1927 };
2228 } ), 1928 } ),
2229 1929
2230 // Miscellaneous 1930 // Miscellaneous
2231 "target": function( elem ) { 1931 target: function( elem ) {
2232 var hash = window.location && window.location.hash; 1932 var hash = window.location && window.location.hash;
2233 return hash && hash.slice( 1 ) === elem.id; 1933 return hash && hash.slice( 1 ) === elem.id;
2234 }, 1934 },
2235 1935
2236 "root": function( elem ) { 1936 root: function( elem ) {
2237 return elem === docElem; 1937 return elem === documentElement;
2238 }, 1938 },
2239 1939
2240 "focus": function( elem ) { 1940 focus: function( elem ) {
2241 return elem === document.activeElement && 1941 return elem === safeActiveElement() &&
2242 ( !document.hasFocus || document.hasFocus() ) && 1942 document.hasFocus() &&
2243 !!( elem.type || elem.href || ~elem.tabIndex ); 1943 !!( elem.type || elem.href || ~elem.tabIndex );
2244 }, 1944 },
2245 1945
2246 // Boolean properties 1946 // Boolean properties
2247 "enabled": createDisabledPseudo( false ), 1947 enabled: createDisabledPseudo( false ),
2248 "disabled": createDisabledPseudo( true ), 1948 disabled: createDisabledPseudo( true ),
2249 1949
2250 "checked": function( elem ) { 1950 checked: function( elem ) {
2251 1951
2252 // In CSS3, :checked should return both checked and selected elements 1952 // In CSS3, :checked should return both checked and selected elements
2253 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 1953 // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
2254 var nodeName = elem.nodeName.toLowerCase(); 1954 return ( nodeName( elem, "input" ) && !!elem.checked ) ||
2255 return ( nodeName === "input" && !!elem.checked ) || 1955 ( nodeName( elem, "option" ) && !!elem.selected );
2256 ( nodeName === "option" && !!elem.selected );
2257 }, 1956 },
2258 1957
2259 "selected": function( elem ) { 1958 selected: function( elem ) {
2260 1959
2261 // Accessing this property makes selected-by-default 1960 // Support: IE <=11+
2262 // 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.
2263 if ( elem.parentNode ) { 1964 if ( elem.parentNode ) {
2264 // eslint-disable-next-line no-unused-expressions 1965 // eslint-disable-next-line no-unused-expressions
2265 elem.parentNode.selectedIndex; 1966 elem.parentNode.selectedIndex;
2266 } 1967 }
2267 1968
2268 return elem.selected === true; 1969 return elem.selected === true;
2269 }, 1970 },
2270 1971
2271 // Contents 1972 // Contents
2272 "empty": function( elem ) { 1973 empty: function( elem ) {
2273 1974
2274 // http://www.w3.org/TR/selectors/#empty-pseudo 1975 // https://www.w3.org/TR/selectors/#empty-pseudo
2275 // :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),
2276 // but not by others (comment: 8; processing instruction: 7; etc.) 1977 // but not by others (comment: 8; processing instruction: 7; etc.)
2277 // nodeType < 6 works because attributes (2) do not appear as children 1978 // nodeType < 6 works because attributes (2) do not appear as children
2278 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 1979 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
2279 if ( elem.nodeType < 6 ) { 1980 if ( elem.nodeType < 6 ) {
2281 } 1982 }
2282 } 1983 }
2283 return true; 1984 return true;
2284 }, 1985 },
2285 1986
2286 "parent": function( elem ) { 1987 parent: function( elem ) {
2287 return !Expr.pseudos[ "empty" ]( elem ); 1988 return !Expr.pseudos.empty( elem );
2288 }, 1989 },
2289 1990
2290 // Element/input types 1991 // Element/input types
2291 "header": function( elem ) { 1992 header: function( elem ) {
2292 return rheader.test( elem.nodeName ); 1993 return rheader.test( elem.nodeName );
2293 }, 1994 },
2294 1995
2295 "input": function( elem ) { 1996 input: function( elem ) {
2296 return rinputs.test( elem.nodeName ); 1997 return rinputs.test( elem.nodeName );
2297 }, 1998 },
2298 1999
2299 "button": function( elem ) { 2000 button: function( elem ) {
2300 var name = elem.nodeName.toLowerCase(); 2001 return nodeName( elem, "input" ) && elem.type === "button" ||
2301 return name === "input" && elem.type === "button" || name === "button"; 2002 nodeName( elem, "button" );
2302 }, 2003 },
2303 2004
2304 "text": function( elem ) { 2005 text: function( elem ) {
2305 var attr; 2006 var attr;
2306 return elem.nodeName.toLowerCase() === "input" && 2007 return nodeName( elem, "input" ) && elem.type === "text" &&
2307 elem.type === "text" &&
2308 2008
2309 // Support: IE <10 only 2009 // Support: IE <10 only
2310 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 2010 // New HTML5 attribute values (e.g., "search") appear
2011 // with elem.type === "text"
2311 ( ( attr = elem.getAttribute( "type" ) ) == null || 2012 ( ( attr = elem.getAttribute( "type" ) ) == null ||
2312 attr.toLowerCase() === "text" ); 2013 attr.toLowerCase() === "text" );
2313 }, 2014 },
2314 2015
2315 // Position-in-collection 2016 // Position-in-collection
2316 "first": createPositionalPseudo( function() { 2017 first: createPositionalPseudo( function() {
2317 return [ 0 ]; 2018 return [ 0 ];
2318 } ), 2019 } ),
2319 2020
2320 "last": createPositionalPseudo( function( _matchIndexes, length ) { 2021 last: createPositionalPseudo( function( _matchIndexes, length ) {
2321 return [ length - 1 ]; 2022 return [ length - 1 ];
2322 } ), 2023 } ),
2323 2024
2324 "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) { 2025 eq: createPositionalPseudo( function( _matchIndexes, length, argument ) {
2325 return [ argument < 0 ? argument + length : argument ]; 2026 return [ argument < 0 ? argument + length : argument ];
2326 } ), 2027 } ),
2327 2028
2328 "even": createPositionalPseudo( function( matchIndexes, length ) { 2029 even: createPositionalPseudo( function( matchIndexes, length ) {
2329 var i = 0; 2030 var i = 0;
2330 for ( ; i < length; i += 2 ) { 2031 for ( ; i < length; i += 2 ) {
2331 matchIndexes.push( i ); 2032 matchIndexes.push( i );
2332 } 2033 }
2333 return matchIndexes; 2034 return matchIndexes;
2334 } ), 2035 } ),
2335 2036
2336 "odd": createPositionalPseudo( function( matchIndexes, length ) { 2037 odd: createPositionalPseudo( function( matchIndexes, length ) {
2337 var i = 1; 2038 var i = 1;
2338 for ( ; i < length; i += 2 ) { 2039 for ( ; i < length; i += 2 ) {
2339 matchIndexes.push( i ); 2040 matchIndexes.push( i );
2340 } 2041 }
2341 return matchIndexes; 2042 return matchIndexes;
2342 } ), 2043 } ),
2343 2044
2344 "lt": createPositionalPseudo( function( matchIndexes, length, argument ) { 2045 lt: createPositionalPseudo( function( matchIndexes, length, argument ) {
2345 var i = argument < 0 ? 2046 var i;
2346 argument + length : 2047
2347 argument > length ? 2048 if ( argument < 0 ) {
2348 length : 2049 i = argument + length;
2349 argument; 2050 } else if ( argument > length ) {
2051 i = length;
2052 } else {
2053 i = argument;
2054 }
2055
2350 for ( ; --i >= 0; ) { 2056 for ( ; --i >= 0; ) {
2351 matchIndexes.push( i ); 2057 matchIndexes.push( i );
2352 } 2058 }
2353 return matchIndexes; 2059 return matchIndexes;
2354 } ), 2060 } ),
2355 2061
2356 "gt": createPositionalPseudo( function( matchIndexes, length, argument ) { 2062 gt: createPositionalPseudo( function( matchIndexes, length, argument ) {
2357 var i = argument < 0 ? argument + length : argument; 2063 var i = argument < 0 ? argument + length : argument;
2358 for ( ; ++i < length; ) { 2064 for ( ; ++i < length; ) {
2359 matchIndexes.push( i ); 2065 matchIndexes.push( i );
2360 } 2066 }
2361 return matchIndexes; 2067 return matchIndexes;
2362 } ) 2068 } )
2363 } 2069 }
2364 }; 2070 };
2365 2071
2366 Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ]; 2072 Expr.pseudos.nth = Expr.pseudos.eq;
2367 2073
2368 // Add button/input type pseudos 2074 // Add button/input type pseudos
2369 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 } ) {
2370 Expr.pseudos[ i ] = createInputPseudo( i ); 2076 Expr.pseudos[ i ] = createInputPseudo( i );
2371 } 2077 }
2376 // Easy API for creating new setFilters 2082 // Easy API for creating new setFilters
2377 function setFilters() {} 2083 function setFilters() {}
2378 setFilters.prototype = Expr.filters = Expr.pseudos; 2084 setFilters.prototype = Expr.filters = Expr.pseudos;
2379 Expr.setFilters = new setFilters(); 2085 Expr.setFilters = new setFilters();
2380 2086
2381 tokenize = Sizzle.tokenize = function( selector, parseOnly ) { 2087 function tokenize( selector, parseOnly ) {
2382 var matched, match, tokens, type, 2088 var matched, match, tokens, type,
2383 soFar, groups, preFilters, 2089 soFar, groups, preFilters,
2384 cached = tokenCache[ selector + " " ]; 2090 cached = tokenCache[ selector + " " ];
2385 2091
2386 if ( cached ) { 2092 if ( cached ) {
2404 } 2110 }
2405 2111
2406 matched = false; 2112 matched = false;
2407 2113
2408 // Combinators 2114 // Combinators
2409 if ( ( match = rcombinators.exec( soFar ) ) ) { 2115 if ( ( match = rleadingCombinator.exec( soFar ) ) ) {
2410 matched = match.shift(); 2116 matched = match.shift();
2411 tokens.push( { 2117 tokens.push( {
2412 value: matched, 2118 value: matched,
2413 2119
2414 // Cast descendant combinators to space 2120 // Cast descendant combinators to space
2415 type: match[ 0 ].replace( rtrim, " " ) 2121 type: match[ 0 ].replace( rtrimCSS, " " )
2416 } ); 2122 } );
2417 soFar = soFar.slice( matched.length ); 2123 soFar = soFar.slice( matched.length );
2418 } 2124 }
2419 2125
2420 // Filters 2126 // Filters
2437 } 2143 }
2438 2144
2439 // Return the length of the invalid excess 2145 // Return the length of the invalid excess
2440 // if we're just parsing 2146 // if we're just parsing
2441 // Otherwise, throw an error or return tokens 2147 // Otherwise, throw an error or return tokens
2442 return parseOnly ? 2148 if ( parseOnly ) {
2443 soFar.length : 2149 return soFar.length;
2444 soFar ? 2150 }
2445 Sizzle.error( selector ) : 2151
2446 2152 return soFar ?
2447 // Cache the tokens 2153 find.error( selector ) :
2448 tokenCache( selector, groups ).slice( 0 ); 2154
2449 }; 2155 // Cache the tokens
2156 tokenCache( selector, groups ).slice( 0 );
2157 }
2450 2158
2451 function toSelector( tokens ) { 2159 function toSelector( tokens ) {
2452 var i = 0, 2160 var i = 0,
2453 len = tokens.length, 2161 len = tokens.length,
2454 selector = ""; 2162 selector = "";
2477 return false; 2185 return false;
2478 } : 2186 } :
2479 2187
2480 // Check against all ancestor/preceding elements 2188 // Check against all ancestor/preceding elements
2481 function( elem, context, xml ) { 2189 function( elem, context, xml ) {
2482 var oldCache, uniqueCache, outerCache, 2190 var oldCache, outerCache,
2483 newCache = [ dirruns, doneName ]; 2191 newCache = [ dirruns, doneName ];
2484 2192
2485 // 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
2486 if ( xml ) { 2194 if ( xml ) {
2487 while ( ( elem = elem[ dir ] ) ) { 2195 while ( ( elem = elem[ dir ] ) ) {
2494 } else { 2202 } else {
2495 while ( ( elem = elem[ dir ] ) ) { 2203 while ( ( elem = elem[ dir ] ) ) {
2496 if ( elem.nodeType === 1 || checkNonElements ) { 2204 if ( elem.nodeType === 1 || checkNonElements ) {
2497 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 2205 outerCache = elem[ expando ] || ( elem[ expando ] = {} );
2498 2206
2499 // Support: IE <9 only 2207 if ( skip && nodeName( elem, skip ) ) {
2500 // Defend against cloned attroperties (jQuery gh-1709)
2501 uniqueCache = outerCache[ elem.uniqueID ] ||
2502 ( outerCache[ elem.uniqueID ] = {} );
2503
2504 if ( skip && skip === elem.nodeName.toLowerCase() ) {
2505 elem = elem[ dir ] || elem; 2208 elem = elem[ dir ] || elem;
2506 } else if ( ( oldCache = uniqueCache[ key ] ) && 2209 } else if ( ( oldCache = outerCache[ key ] ) &&
2507 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 2210 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2508 2211
2509 // Assign to newCache so results back-propagate to previous elements 2212 // Assign to newCache so results back-propagate to previous elements
2510 return ( newCache[ 2 ] = oldCache[ 2 ] ); 2213 return ( newCache[ 2 ] = oldCache[ 2 ] );
2511 } else { 2214 } else {
2512 2215
2513 // Reuse newcache so results back-propagate to previous elements 2216 // Reuse newcache so results back-propagate to previous elements
2514 uniqueCache[ key ] = newCache; 2217 outerCache[ key ] = newCache;
2515 2218
2516 // 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
2517 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { 2220 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) {
2518 return true; 2221 return true;
2519 } 2222 }
2541 2244
2542 function multipleContexts( selector, contexts, results ) { 2245 function multipleContexts( selector, contexts, results ) {
2543 var i = 0, 2246 var i = 0,
2544 len = contexts.length; 2247 len = contexts.length;
2545 for ( ; i < len; i++ ) { 2248 for ( ; i < len; i++ ) {
2546 Sizzle( selector, contexts[ i ], results ); 2249 find( selector, contexts[ i ], results );
2547 } 2250 }
2548 return results; 2251 return results;
2549 } 2252 }
2550 2253
2551 function condense( unmatched, map, filter, context, xml ) { 2254 function condense( unmatched, map, filter, context, xml ) {
2575 } 2278 }
2576 if ( postFinder && !postFinder[ expando ] ) { 2279 if ( postFinder && !postFinder[ expando ] ) {
2577 postFinder = setMatcher( postFinder, postSelector ); 2280 postFinder = setMatcher( postFinder, postSelector );
2578 } 2281 }
2579 return markFunction( function( seed, results, context, xml ) { 2282 return markFunction( function( seed, results, context, xml ) {
2580 var temp, i, elem, 2283 var temp, i, elem, matcherOut,
2581 preMap = [], 2284 preMap = [],
2582 postMap = [], 2285 postMap = [],
2583 preexisting = results.length, 2286 preexisting = results.length,
2584 2287
2585 // Get initial elements from seed or context 2288 // Get initial elements from seed or context
2586 elems = seed || multipleContexts( 2289 elems = seed ||
2587 selector || "*", 2290 multipleContexts( selector || "*",
2588 context.nodeType ? [ context ] : context, 2291 context.nodeType ? [ context ] : context, [] ),
2589 []
2590 ),
2591 2292
2592 // 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
2593 matcherIn = preFilter && ( seed || !selector ) ? 2294 matcherIn = preFilter && ( seed || !selector ) ?
2594 condense( elems, preMap, preFilter, context, xml ) : 2295 condense( elems, preMap, preFilter, context, xml ) :
2595 elems, 2296 elems;
2596 2297
2597 matcherOut = matcher ?
2598
2599 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2600 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2601
2602 // ...intermediate processing is necessary
2603 [] :
2604
2605 // ...otherwise use results directly
2606 results :
2607 matcherIn;
2608
2609 // Find primary matches
2610 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
2611 matcher( matcherIn, matcherOut, context, xml ); 2311 matcher( matcherIn, matcherOut, context, xml );
2312 } else {
2313 matcherOut = matcherIn;
2612 } 2314 }
2613 2315
2614 // Apply postFilter 2316 // Apply postFilter
2615 if ( postFilter ) { 2317 if ( postFilter ) {
2616 temp = condense( matcherOut, postMap ); 2318 temp = condense( matcherOut, postMap );
2644 2346
2645 // Move matched elements from seed to results to keep them synchronized 2347 // Move matched elements from seed to results to keep them synchronized
2646 i = matcherOut.length; 2348 i = matcherOut.length;
2647 while ( i-- ) { 2349 while ( i-- ) {
2648 if ( ( elem = matcherOut[ i ] ) && 2350 if ( ( elem = matcherOut[ i ] ) &&
2649 ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) { 2351 ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) {
2650 2352
2651 seed[ temp ] = !( results[ temp ] = elem ); 2353 seed[ temp ] = !( results[ temp ] = elem );
2652 } 2354 }
2653 } 2355 }
2654 } 2356 }
2679 // 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)
2680 matchContext = addCombinator( function( elem ) { 2382 matchContext = addCombinator( function( elem ) {
2681 return elem === checkContext; 2383 return elem === checkContext;
2682 }, implicitRelative, true ), 2384 }, implicitRelative, true ),
2683 matchAnyContext = addCombinator( function( elem ) { 2385 matchAnyContext = addCombinator( function( elem ) {
2684 return indexOf( checkContext, elem ) > -1; 2386 return indexOf.call( checkContext, elem ) > -1;
2685 }, implicitRelative, true ), 2387 }, implicitRelative, true ),
2686 matchers = [ function( elem, context, xml ) { 2388 matchers = [ function( elem, context, xml ) {
2687 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 ) ) || (
2688 ( checkContext = context ).nodeType ? 2395 ( checkContext = context ).nodeType ?
2689 matchContext( elem, context, xml ) : 2396 matchContext( elem, context, xml ) :
2690 matchAnyContext( elem, context, xml ) ); 2397 matchAnyContext( elem, context, xml ) );
2691 2398
2692 // Avoid hanging onto element (issue #299) 2399 // Avoid hanging onto element
2400 // (see https://github.com/jquery/sizzle/issues/299)
2693 checkContext = null; 2401 checkContext = null;
2694 return ret; 2402 return ret;
2695 } ]; 2403 } ];
2696 2404
2697 for ( ; i < len; i++ ) { 2405 for ( ; i < len; i++ ) {
2712 } 2420 }
2713 return setMatcher( 2421 return setMatcher(
2714 i > 1 && elementMatcher( matchers ), 2422 i > 1 && elementMatcher( matchers ),
2715 i > 1 && toSelector( 2423 i > 1 && toSelector(
2716 2424
2717 // 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 `*`
2718 tokens 2426 tokens.slice( 0, i - 1 )
2719 .slice( 0, i - 1 ) 2427 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } )
2720 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) 2428 ).replace( rtrimCSS, "$1" ),
2721 ).replace( rtrim, "$1" ),
2722 matcher, 2429 matcher,
2723 i < j && matcherFromTokens( tokens.slice( i, j ) ), 2430 i < j && matcherFromTokens( tokens.slice( i, j ) ),
2724 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), 2431 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ),
2725 j < len && toSelector( tokens ) 2432 j < len && toSelector( tokens )
2726 ); 2433 );
2742 unmatched = seed && [], 2449 unmatched = seed && [],
2743 setMatched = [], 2450 setMatched = [],
2744 contextBackup = outermostContext, 2451 contextBackup = outermostContext,
2745 2452
2746 // We must always have either seed elements or outermost context 2453 // We must always have either seed elements or outermost context
2747 elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ), 2454 elems = seed || byElement && Expr.find.TAG( "*", outermost ),
2748 2455
2749 // Use integer dirruns iff this is the outermost matcher 2456 // Use integer dirruns iff this is the outermost matcher
2750 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), 2457 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ),
2751 len = elems.length; 2458 len = elems.length;
2752 2459
2758 // eslint-disable-next-line eqeqeq 2465 // eslint-disable-next-line eqeqeq
2759 outermostContext = context == document || context || outermost; 2466 outermostContext = context == document || context || outermost;
2760 } 2467 }
2761 2468
2762 // Add elements passing elementMatchers directly to results 2469 // Add elements passing elementMatchers directly to results
2763 // Support: IE<9, Safari 2470 // Support: iOS <=7 - 9 only
2764 // 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)
2765 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { 2473 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) {
2766 if ( byElement && elem ) { 2474 if ( byElement && elem ) {
2767 j = 0; 2475 j = 0;
2768 2476
2769 // Support: IE 11+, Edge 17 - 18+ 2477 // Support: IE 11+, Edge 17 - 18+
2774 setDocument( elem ); 2482 setDocument( elem );
2775 xml = !documentIsHTML; 2483 xml = !documentIsHTML;
2776 } 2484 }
2777 while ( ( matcher = elementMatchers[ j++ ] ) ) { 2485 while ( ( matcher = elementMatchers[ j++ ] ) ) {
2778 if ( matcher( elem, context || document, xml ) ) { 2486 if ( matcher( elem, context || document, xml ) ) {
2779 results.push( elem ); 2487 push.call( results, elem );
2780 break; 2488 break;
2781 } 2489 }
2782 } 2490 }
2783 if ( outermost ) { 2491 if ( outermost ) {
2784 dirruns = dirrunsUnique; 2492 dirruns = dirrunsUnique;
2837 2545
2838 // Seedless set matches succeeding multiple successful matchers stipulate sorting 2546 // Seedless set matches succeeding multiple successful matchers stipulate sorting
2839 if ( outermost && !seed && setMatched.length > 0 && 2547 if ( outermost && !seed && setMatched.length > 0 &&
2840 ( matchedCount + setMatchers.length ) > 1 ) { 2548 ( matchedCount + setMatchers.length ) > 1 ) {
2841 2549
2842 Sizzle.uniqueSort( results ); 2550 jQuery.uniqueSort( results );
2843 } 2551 }
2844 } 2552 }
2845 2553
2846 // Override manipulation of globals by nested matchers 2554 // Override manipulation of globals by nested matchers
2847 if ( outermost ) { 2555 if ( outermost ) {
2855 return bySet ? 2563 return bySet ?
2856 markFunction( superMatcher ) : 2564 markFunction( superMatcher ) :
2857 superMatcher; 2565 superMatcher;
2858 } 2566 }
2859 2567
2860 compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { 2568 function compile( selector, match /* Internal Use Only */ ) {
2861 var i, 2569 var i,
2862 setMatchers = [], 2570 setMatchers = [],
2863 elementMatchers = [], 2571 elementMatchers = [],
2864 cached = compilerCache[ selector + " " ]; 2572 cached = compilerCache[ selector + " " ];
2865 2573
2878 elementMatchers.push( cached ); 2586 elementMatchers.push( cached );
2879 } 2587 }
2880 } 2588 }
2881 2589
2882 // Cache the compiled function 2590 // Cache the compiled function
2883 cached = compilerCache( 2591 cached = compilerCache( selector,
2884 selector, 2592 matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2885 matcherFromGroupMatchers( elementMatchers, setMatchers )
2886 );
2887 2593
2888 // Save selector and tokenization 2594 // Save selector and tokenization
2889 cached.selector = selector; 2595 cached.selector = selector;
2890 } 2596 }
2891 return cached; 2597 return cached;
2892 }; 2598 }
2893 2599
2894 /** 2600 /**
2895 * A low-level selection function that works with Sizzle's compiled 2601 * A low-level selection function that works with jQuery's compiled
2896 * selector functions 2602 * selector functions
2897 * @param {String|Function} selector A selector or a pre-compiled 2603 * @param {String|Function} selector A selector or a pre-compiled
2898 * selector function built with Sizzle.compile 2604 * selector function built with jQuery selector compile
2899 * @param {Element} context 2605 * @param {Element} context
2900 * @param {Array} [results] 2606 * @param {Array} [results]
2901 * @param {Array} [seed] A set of elements to match against 2607 * @param {Array} [seed] A set of elements to match against
2902 */ 2608 */
2903 select = Sizzle.select = function( selector, context, results, seed ) { 2609 function select( selector, context, results, seed ) {
2904 var i, tokens, token, type, find, 2610 var i, tokens, token, type, find,
2905 compiled = typeof selector === "function" && selector, 2611 compiled = typeof selector === "function" && selector,
2906 match = !seed && tokenize( ( selector = compiled.selector || selector ) ); 2612 match = !seed && tokenize( ( selector = compiled.selector || selector ) );
2907 2613
2908 results = results || []; 2614 results = results || [];
2912 if ( match.length === 1 ) { 2618 if ( match.length === 1 ) {
2913 2619
2914 // Reduce context if the leading compound selector is an ID 2620 // Reduce context if the leading compound selector is an ID
2915 tokens = match[ 0 ] = match[ 0 ].slice( 0 ); 2621 tokens = match[ 0 ] = match[ 0 ].slice( 0 );
2916 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && 2622 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" &&
2917 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { 2623 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) {
2918 2624
2919 context = ( Expr.find[ "ID" ]( token.matches[ 0 ] 2625 context = ( Expr.find.ID(
2920 .replace( runescape, funescape ), context ) || [] )[ 0 ]; 2626 token.matches[ 0 ].replace( runescape, funescape ),
2627 context
2628 ) || [] )[ 0 ];
2921 if ( !context ) { 2629 if ( !context ) {
2922 return results; 2630 return results;
2923 2631
2924 // Precompiled matchers will still verify ancestry, so step up a level 2632 // Precompiled matchers will still verify ancestry, so step up a level
2925 } else if ( compiled ) { 2633 } else if ( compiled ) {
2928 2636
2929 selector = selector.slice( tokens.shift().value.length ); 2637 selector = selector.slice( tokens.shift().value.length );
2930 } 2638 }
2931 2639
2932 // Fetch a seed set for right-to-left matching 2640 // Fetch a seed set for right-to-left matching
2933 i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length; 2641 i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length;
2934 while ( i-- ) { 2642 while ( i-- ) {
2935 token = tokens[ i ]; 2643 token = tokens[ i ];
2936 2644
2937 // Abort if we hit a combinator 2645 // Abort if we hit a combinator
2938 if ( Expr.relative[ ( type = token.type ) ] ) { 2646 if ( Expr.relative[ ( type = token.type ) ] ) {
2941 if ( ( find = Expr.find[ type ] ) ) { 2649 if ( ( find = Expr.find[ type ] ) ) {
2942 2650
2943 // Search, expanding context for leading sibling combinators 2651 // Search, expanding context for leading sibling combinators
2944 if ( ( seed = find( 2652 if ( ( seed = find(
2945 token.matches[ 0 ].replace( runescape, funescape ), 2653 token.matches[ 0 ].replace( runescape, funescape ),
2946 rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) || 2654 rsibling.test( tokens[ 0 ].type ) &&
2947 context 2655 testContext( context.parentNode ) || context
2948 ) ) ) { 2656 ) ) ) {
2949 2657
2950 // 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
2951 tokens.splice( i, 1 ); 2659 tokens.splice( i, 1 );
2952 selector = seed.length && toSelector( tokens ); 2660 selector = seed.length && toSelector( tokens );
2969 !documentIsHTML, 2677 !documentIsHTML,
2970 results, 2678 results,
2971 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 2679 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
2972 ); 2680 );
2973 return results; 2681 return results;
2974 }; 2682 }
2975 2683
2976 // One-time assignments 2684 // One-time assignments
2977 2685
2686 // Support: Android <=4.0 - 4.1+
2978 // Sort stability 2687 // Sort stability
2979 support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; 2688 support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando;
2980 2689
2981 // Support: Chrome 14-35+
2982 // Always assume duplicates if they aren't passed to the comparison function
2983 support.detectDuplicates = !!hasDuplicate;
2984
2985 // Initialize against the default document 2690 // Initialize against the default document
2986 setDocument(); 2691 setDocument();
2987 2692
2988 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 2693 // Support: Android <=4.0 - 4.1+
2989 // Detached nodes confoundingly follow *each other* 2694 // Detached nodes confoundingly follow *each other*
2990 support.sortDetached = assert( function( el ) { 2695 support.sortDetached = assert( function( el ) {
2991 2696
2992 // Should return 1, but returns 4 (following) 2697 // Should return 1, but returns 4 (following)
2993 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; 2698 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1;
2994 } ); 2699 } );
2995 2700
2996 // Support: IE<8 2701 jQuery.find = find;
2997 // Prevent attribute/property "interpolation"
2998 // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2999 if ( !assert( function( el ) {
3000 el.innerHTML = "<a href='#'></a>";
3001 return el.firstChild.getAttribute( "href" ) === "#";
3002 } ) ) {
3003 addHandle( "type|href|height|width", function( elem, name, isXML ) {
3004 if ( !isXML ) {
3005 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
3006 }
3007 } );
3008 }
3009
3010 // Support: IE<9
3011 // Use defaultValue in place of getAttribute("value")
3012 if ( !support.attributes || !assert( function( el ) {
3013 el.innerHTML = "<input/>";
3014 el.firstChild.setAttribute( "value", "" );
3015 return el.firstChild.getAttribute( "value" ) === "";
3016 } ) ) {
3017 addHandle( "value", function( elem, _name, isXML ) {
3018 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
3019 return elem.defaultValue;
3020 }
3021 } );
3022 }
3023
3024 // Support: IE<9
3025 // Use getAttributeNode to fetch booleans when getAttribute lies
3026 if ( !assert( function( el ) {
3027 return el.getAttribute( "disabled" ) == null;
3028 } ) ) {
3029 addHandle( booleans, function( elem, name, isXML ) {
3030 var val;
3031 if ( !isXML ) {
3032 return elem[ name ] === true ? name.toLowerCase() :
3033 ( val = elem.getAttributeNode( name ) ) && val.specified ?
3034 val.value :
3035 null;
3036 }
3037 } );
3038 }
3039
3040 return Sizzle;
3041
3042 } )( window );
3043
3044
3045
3046 jQuery.find = Sizzle;
3047 jQuery.expr = Sizzle.selectors;
3048 2702
3049 // Deprecated 2703 // Deprecated
3050 jQuery.expr[ ":" ] = jQuery.expr.pseudos; 2704 jQuery.expr[ ":" ] = jQuery.expr.pseudos;
3051 jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; 2705 jQuery.unique = jQuery.uniqueSort;
3052 jQuery.text = Sizzle.getText; 2706
3053 jQuery.isXMLDoc = Sizzle.isXML; 2707 // These have always been private, but they used to be documented as part of
3054 jQuery.contains = Sizzle.contains; 2708 // Sizzle so let's maintain them for now for backwards compatibility purposes.
3055 jQuery.escapeSelector = Sizzle.escape; 2709 find.compile = compile;
3056 2710 find.select = select;
3057 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 } )();
3058 2724
3059 2725
3060 var dir = function( elem, dir, until ) { 2726 var dir = function( elem, dir, until ) {
3061 var matched = [], 2727 var matched = [],
3062 truncate = until !== undefined; 2728 truncate = until !== undefined;
3086 }; 2752 };
3087 2753
3088 2754
3089 var rneedsContext = jQuery.expr.match.needsContext; 2755 var rneedsContext = jQuery.expr.match.needsContext;
3090 2756
3091
3092
3093 function nodeName( elem, name ) {
3094
3095 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
3096
3097 }
3098 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 );
3099 2758
3100 2759
3101 2760
3102 // Implement the identical functionality for filter and not 2761 // Implement the identical functionality for filter and not
3343 3002
3344 // Always skip document fragments 3003 // Always skip document fragments
3345 if ( cur.nodeType < 11 && ( targets ? 3004 if ( cur.nodeType < 11 && ( targets ?
3346 targets.index( cur ) > -1 : 3005 targets.index( cur ) > -1 :
3347 3006
3348 // Don't pass non-elements to Sizzle 3007 // Don't pass non-elements to jQuery#find
3349 cur.nodeType === 1 && 3008 cur.nodeType === 1 &&
3350 jQuery.find.matchesSelector( cur, selectors ) ) ) { 3009 jQuery.find.matchesSelector( cur, selectors ) ) ) {
3351 3010
3352 matched.push( cur ); 3011 matched.push( cur );
3353 break; 3012 break;
3898 mightThrow(); 3557 mightThrow();
3899 } catch ( e ) { 3558 } catch ( e ) {
3900 3559
3901 if ( jQuery.Deferred.exceptionHook ) { 3560 if ( jQuery.Deferred.exceptionHook ) {
3902 jQuery.Deferred.exceptionHook( e, 3561 jQuery.Deferred.exceptionHook( e,
3903 process.stackTrace ); 3562 process.error );
3904 } 3563 }
3905 3564
3906 // Support: Promises/A+ section 2.3.3.3.4.1 3565 // Support: Promises/A+ section 2.3.3.3.4.1
3907 // https://promisesaplus.com/#point-61 3566 // https://promisesaplus.com/#point-61
3908 // Ignore post-resolution exceptions 3567 // Ignore post-resolution exceptions
3926 // subsequent errors 3585 // subsequent errors
3927 if ( depth ) { 3586 if ( depth ) {
3928 process(); 3587 process();
3929 } else { 3588 } else {
3930 3589
3931 // 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
3932 // since it's otherwise lost when execution goes async 3591 // since it's otherwise lost when execution goes async
3933 if ( jQuery.Deferred.getStackHook ) { 3592 if ( jQuery.Deferred.getErrorHook ) {
3934 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();
3935 } 3601 }
3936 window.setTimeout( process ); 3602 window.setTimeout( process );
3937 } 3603 }
3938 }; 3604 };
3939 } 3605 }
4104 3770
4105 // These usually indicate a programmer mistake during development, 3771 // These usually indicate a programmer mistake during development,
4106 // warn about them ASAP rather than swallowing them by default. 3772 // warn about them ASAP rather than swallowing them by default.
4107 var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 3773 var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
4108 3774
4109 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 ) {
4110 3779
4111 // Support: IE 8 - 9 only 3780 // Support: IE 8 - 9 only
4112 // 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
4113 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 3782 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
4114 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); 3783 window.console.warn( "jQuery.Deferred exception: " + error.message,
3784 error.stack, asyncError );
4115 } 3785 }
4116 }; 3786 };
4117 3787
4118 3788
4119 3789
5165 4835
5166 function returnFalse() { 4836 function returnFalse() {
5167 return false; 4837 return false;
5168 } 4838 }
5169 4839
5170 // Support: IE <=9 - 11+
5171 // focus() and blur() are asynchronous, except when they are no-op.
5172 // So expect focus to be synchronous when the element is already active,
5173 // and blur to be synchronous when the element is not already active.
5174 // (focus and blur are always synchronous in other supported browsers,
5175 // this just defines when we can count on it).
5176 function expectSync( elem, type ) {
5177 return ( elem === safeActiveElement() ) === ( type === "focus" );
5178 }
5179
5180 // Support: IE <=9 only
5181 // Accessing document.activeElement can throw unexpectedly
5182 // https://bugs.jquery.com/ticket/13393
5183 function safeActiveElement() {
5184 try {
5185 return document.activeElement;
5186 } catch ( err ) { }
5187 }
5188
5189 function on( elem, types, selector, data, fn, one ) { 4840 function on( elem, types, selector, data, fn, one ) {
5190 var origFn, type; 4841 var origFn, type;
5191 4842
5192 // Types can be a map of types/handlers 4843 // Types can be a map of types/handlers
5193 if ( typeof types === "object" ) { 4844 if ( typeof types === "object" ) {
5621 // Claim the first handler 5272 // Claim the first handler
5622 if ( rcheckableType.test( el.type ) && 5273 if ( rcheckableType.test( el.type ) &&
5623 el.click && nodeName( el, "input" ) ) { 5274 el.click && nodeName( el, "input" ) ) {
5624 5275
5625 // dataPriv.set( el, "click", ... ) 5276 // dataPriv.set( el, "click", ... )
5626 leverageNative( el, "click", returnTrue ); 5277 leverageNative( el, "click", true );
5627 } 5278 }
5628 5279
5629 // Return false to allow normal processing in the caller 5280 // Return false to allow normal processing in the caller
5630 return false; 5281 return false;
5631 }, 5282 },
5672 5323
5673 // Ensure the presence of an event listener that handles manually-triggered 5324 // Ensure the presence of an event listener that handles manually-triggered
5674 // synthetic events by interrupting progress until reinvoked in response to 5325 // synthetic events by interrupting progress until reinvoked in response to
5675 // *native* events that it fires directly, ensuring that state changes have 5326 // *native* events that it fires directly, ensuring that state changes have
5676 // already occurred before other listeners are invoked. 5327 // already occurred before other listeners are invoked.
5677 function leverageNative( el, type, expectSync ) { 5328 function leverageNative( el, type, isSetup ) {
5678 5329
5679 // 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
5680 if ( !expectSync ) { 5331 if ( !isSetup ) {
5681 if ( dataPriv.get( el, type ) === undefined ) { 5332 if ( dataPriv.get( el, type ) === undefined ) {
5682 jQuery.event.add( el, type, returnTrue ); 5333 jQuery.event.add( el, type, returnTrue );
5683 } 5334 }
5684 return; 5335 return;
5685 } 5336 }
5687 // 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
5688 dataPriv.set( el, type, false ); 5339 dataPriv.set( el, type, false );
5689 jQuery.event.add( el, type, { 5340 jQuery.event.add( el, type, {
5690 namespace: false, 5341 namespace: false,
5691 handler: function( event ) { 5342 handler: function( event ) {
5692 var notAsync, result, 5343 var result,
5693 saved = dataPriv.get( this, type ); 5344 saved = dataPriv.get( this, type );
5694 5345
5695 if ( ( event.isTrigger & 1 ) && this[ type ] ) { 5346 if ( ( event.isTrigger & 1 ) && this[ type ] ) {
5696 5347
5697 // Interrupt processing of the outer synthetic .trigger()ed event 5348 // Interrupt processing of the outer synthetic .trigger()ed event
5698 // Saved data should be false in such cases, but might be a leftover capture object 5349 if ( !saved ) {
5699 // from an async native handler (gh-4350)
5700 if ( !saved.length ) {
5701 5350
5702 // Store arguments for use when handling the inner native event 5351 // Store arguments for use when handling the inner native event
5703 // 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
5704 // will not be confused with a leftover capture object. 5353 // will not be confused with a leftover capture object.
5705 saved = slice.call( arguments ); 5354 saved = slice.call( arguments );
5706 dataPriv.set( this, type, saved ); 5355 dataPriv.set( this, type, saved );
5707 5356
5708 // Trigger the native event and capture its result 5357 // Trigger the native event and capture its result
5709 // Support: IE <=9 - 11+
5710 // focus() and blur() are asynchronous
5711 notAsync = expectSync( this, type );
5712 this[ type ](); 5358 this[ type ]();
5713 result = dataPriv.get( this, type ); 5359 result = dataPriv.get( this, type );
5714 if ( saved !== result || notAsync ) { 5360 dataPriv.set( this, type, false );
5715 dataPriv.set( this, type, false ); 5361
5716 } else {
5717 result = {};
5718 }
5719 if ( saved !== result ) { 5362 if ( saved !== result ) {
5720 5363
5721 // Cancel the outer synthetic event 5364 // Cancel the outer synthetic event
5722 event.stopImmediatePropagation(); 5365 event.stopImmediatePropagation();
5723 event.preventDefault(); 5366 event.preventDefault();
5724 5367
5725 // Support: Chrome 86+ 5368 return result;
5726 // In Chrome, if an element having a focusout handler is blurred by
5727 // clicking outside of it, it invokes the handler synchronously. If
5728 // that handler calls `.remove()` on the element, the data is cleared,
5729 // leaving `result` undefined. We need to guard against this.
5730 return result && result.value;
5731 } 5369 }
5732 5370
5733 // 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
5734 // (focus or blur), assume that the surrogate already propagated from triggering the 5372 // (focus or blur), assume that the surrogate already propagated from triggering
5735 // native event and prevent that from happening again here. 5373 // the native event and prevent that from happening again here.
5736 // 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
5737 // bubbling surrogate propagates *after* the non-bubbling base), but that seems 5375 // bubbling surrogate propagates *after* the non-bubbling base), but that seems
5738 // less bad than duplication. 5376 // less bad than duplication.
5739 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { 5377 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) {
5740 event.stopPropagation(); 5378 event.stopPropagation();
5741 } 5379 }
5742 5380
5743 // 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
5744 // Fire an inner synthetic event with the original arguments 5382 // Fire an inner synthetic event with the original arguments
5745 } else if ( saved.length ) { 5383 } else if ( saved ) {
5746 5384
5747 // ...and capture the result 5385 // ...and capture the result
5748 dataPriv.set( this, type, { 5386 dataPriv.set( this, type, jQuery.event.trigger(
5749 value: jQuery.event.trigger( 5387 saved[ 0 ],
5750 5388 saved.slice( 1 ),
5751 // Support: IE <=9 - 11+ 5389 this
5752 // Extend with the prototype to reset the above stopImmediatePropagation() 5390 ) );
5753 jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), 5391
5754 saved.slice( 1 ), 5392 // Abort handling of the native event by all jQuery handlers while allowing
5755 this 5393 // native handlers on the same element to run. On target, this is achieved
5756 ) 5394 // by stopping immediate propagation just on the jQuery event. However,
5757 } ); 5395 // the native event is re-wrapped by a jQuery one on each level of the
5758 5396 // propagation so the only way to stop it for jQuery is to stop it for
5759 // Abort handling of the native event 5397 // everyone via native `stopPropagation()`. This is not a problem for
5760 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;
5761 } 5402 }
5762 } 5403 }
5763 } ); 5404 } );
5764 } 5405 }
5765 5406
5894 touches: true, 5535 touches: true,
5895 which: true 5536 which: true
5896 }, jQuery.event.addProp ); 5537 }, jQuery.event.addProp );
5897 5538
5898 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
5899 jQuery.event.special[ type ] = { 5579 jQuery.event.special[ type ] = {
5900 5580
5901 // Utilize native event if possible so blur/focus sequence is correct 5581 // Utilize native event if possible so blur/focus sequence is correct
5902 setup: function() { 5582 setup: function() {
5583
5584 var attaches;
5903 5585
5904 // Claim the first handler 5586 // Claim the first handler
5905 // dataPriv.set( this, "focus", ... ) 5587 // dataPriv.set( this, "focus", ... )
5906 // dataPriv.set( this, "blur", ... ) 5588 // dataPriv.set( this, "blur", ... )
5907 leverageNative( this, type, expectSync ); 5589 leverageNative( this, type, true );
5908 5590
5909 // Return false to allow normal processing in the caller 5591 if ( document.documentMode ) {
5910 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 }
5911 }, 5607 },
5912 trigger: function() { 5608 trigger: function() {
5913 5609
5914 // Force setup before trigger 5610 // Force setup before trigger
5915 leverageNative( this, type ); 5611 leverageNative( this, type );
5916 5612
5917 // Return non-false to allow normal event-path propagation 5613 // Return non-false to allow normal event-path propagation
5918 return true; 5614 return true;
5615 },
5616
5617 teardown: function() {
5618 var attaches;
5619
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 }
5919 }, 5633 },
5920 5634
5921 // Suppress native focus or blur if we're currently inside 5635 // Suppress native focus or blur if we're currently inside
5922 // a leveraged native-event stack 5636 // a leveraged native-event stack
5923 _default: function( event ) { 5637 _default: function( event ) {
5924 return dataPriv.get( event.target, type ); 5638 return dataPriv.get( event.target, type );
5925 }, 5639 },
5926 5640
5927 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 }
5928 }; 5694 };
5929 } ); 5695 } );
5930 5696
5931 // Create mouseenter/leave events using mouseover/out and event-time checks 5697 // Create mouseenter/leave events using mouseover/out and event-time checks
5932 // so that event delegation works in jQuery. 5698 // so that event delegation works in jQuery.
6155 } 5921 }
6156 5922
6157 if ( hasScripts ) { 5923 if ( hasScripts ) {
6158 doc = scripts[ scripts.length - 1 ].ownerDocument; 5924 doc = scripts[ scripts.length - 1 ].ownerDocument;
6159 5925
6160 // Reenable scripts 5926 // Re-enable scripts
6161 jQuery.map( scripts, restoreScript ); 5927 jQuery.map( scripts, restoreScript );
6162 5928
6163 // Evaluate executable scripts on first document insertion 5929 // Evaluate executable scripts on first document insertion
6164 for ( i = 0; i < hasScripts; i++ ) { 5930 for ( i = 0; i < hasScripts; i++ ) {
6165 node = scripts[ i ]; 5931 node = scripts[ i ];
6226 5992
6227 // Fix IE cloning issues 5993 // Fix IE cloning issues
6228 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 5994 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
6229 !jQuery.isXMLDoc( elem ) ) { 5995 !jQuery.isXMLDoc( elem ) ) {
6230 5996
6231 // 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
6232 destElements = getAll( clone ); 5999 destElements = getAll( clone );
6233 srcElements = getAll( elem ); 6000 srcElements = getAll( elem );
6234 6001
6235 for ( i = 0, l = srcElements.length; i < l; i++ ) { 6002 for ( i = 0, l = srcElements.length; i < l; i++ ) {
6236 fixInput( srcElements[ i ], destElements[ i ] ); 6003 fixInput( srcElements[ i ], destElements[ i ] );
6501 return ret; 6268 return ret;
6502 }; 6269 };
6503 6270
6504 6271
6505 var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); 6272 var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
6506
6507 var whitespace = "[\\x20\\t\\r\\n\\f]";
6508
6509
6510 var rtrimCSS = new RegExp(
6511 "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$",
6512 "g"
6513 );
6514
6515 6273
6516 6274
6517 6275
6518 ( function() { 6276 ( function() {
6519 6277
6620 table = document.createElement( "table" ); 6378 table = document.createElement( "table" );
6621 tr = document.createElement( "tr" ); 6379 tr = document.createElement( "tr" );
6622 trChild = document.createElement( "div" ); 6380 trChild = document.createElement( "div" );
6623 6381
6624 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; 6382 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate";
6625 tr.style.cssText = "border:1px solid"; 6383 tr.style.cssText = "box-sizing:content-box;border:1px solid";
6626 6384
6627 // Support: Chrome 86+ 6385 // Support: Chrome 86+
6628 // Height set through cssText does not get applied. 6386 // Height set through cssText does not get applied.
6629 // Computed height then comes back as 0. 6387 // Computed height then comes back as 0.
6630 tr.style.height = "1px"; 6388 tr.style.height = "1px";
6632 6390
6633 // Support: Android 8 Chrome 86+ 6391 // Support: Android 8 Chrome 86+
6634 // In our bodyBackground.html iframe, 6392 // In our bodyBackground.html iframe,
6635 // display for all div elements is set to "inline", 6393 // display for all div elements is set to "inline",
6636 // which causes a problem only in Android 8 Chrome 86. 6394 // which causes a problem only in Android 8 Chrome 86.
6637 // Ensuring the div is display: block 6395 // Ensuring the div is `display: block`
6638 // gets around this issue. 6396 // gets around this issue.
6639 trChild.style.display = "block"; 6397 trChild.style.display = "block";
6640 6398
6641 documentElement 6399 documentElement
6642 .appendChild( table ) 6400 .appendChild( table )
6819 } 6577 }
6820 6578
6821 function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { 6579 function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
6822 var i = dimension === "width" ? 1 : 0, 6580 var i = dimension === "width" ? 1 : 0,
6823 extra = 0, 6581 extra = 0,
6824 delta = 0; 6582 delta = 0,
6583 marginDelta = 0;
6825 6584
6826 // Adjustment may not be necessary 6585 // Adjustment may not be necessary
6827 if ( box === ( isBorderBox ? "border" : "content" ) ) { 6586 if ( box === ( isBorderBox ? "border" : "content" ) ) {
6828 return 0; 6587 return 0;
6829 } 6588 }
6830 6589
6831 for ( ; i < 4; i += 2 ) { 6590 for ( ; i < 4; i += 2 ) {
6832 6591
6833 // 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).
6834 if ( box === "margin" ) { 6595 if ( box === "margin" ) {
6835 delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); 6596 marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
6836 } 6597 }
6837 6598
6838 // 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"
6839 if ( !isBorderBox ) { 6600 if ( !isBorderBox ) {
6840 6601
6881 // 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
6882 // Use an explicit zero to avoid NaN (gh-3964) 6643 // Use an explicit zero to avoid NaN (gh-3964)
6883 ) ) || 0; 6644 ) ) || 0;
6884 } 6645 }
6885 6646
6886 return delta; 6647 return delta + marginDelta;
6887 } 6648 }
6888 6649
6889 function getWidthOrHeight( elem, dimension, extra ) { 6650 function getWidthOrHeight( elem, dimension, extra ) {
6890 6651
6891 // Start with computed style 6652 // Start with computed style
6979 } 6740 }
6980 }, 6741 },
6981 6742
6982 // Don't automatically add "px" to these possibly-unitless properties 6743 // Don't automatically add "px" to these possibly-unitless properties
6983 cssNumber: { 6744 cssNumber: {
6984 "animationIterationCount": true, 6745 animationIterationCount: true,
6985 "columnCount": true, 6746 aspectRatio: true,
6986 "fillOpacity": true, 6747 borderImageSlice: true,
6987 "flexGrow": true, 6748 columnCount: true,
6988 "flexShrink": true, 6749 flexGrow: true,
6989 "fontWeight": true, 6750 flexShrink: true,
6990 "gridArea": true, 6751 fontWeight: true,
6991 "gridColumn": true, 6752 gridArea: true,
6992 "gridColumnEnd": true, 6753 gridColumn: true,
6993 "gridColumnStart": true, 6754 gridColumnEnd: true,
6994 "gridRow": true, 6755 gridColumnStart: true,
6995 "gridRowEnd": true, 6756 gridRow: true,
6996 "gridRowStart": true, 6757 gridRowEnd: true,
6997 "lineHeight": true, 6758 gridRowStart: true,
6998 "opacity": true, 6759 lineHeight: true,
6999 "order": true, 6760 opacity: true,
7000 "orphans": true, 6761 order: true,
7001 "widows": true, 6762 orphans: true,
7002 "zIndex": true, 6763 scale: true,
7003 "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
7004 }, 6774 },
7005 6775
7006 // Add in properties whose names you wish to fix before 6776 // Add in properties whose names you wish to fix before
7007 // setting or getting the value 6777 // setting or getting the value
7008 cssProps: {}, 6778 cssProps: {},
8724 8494
8725 8495
8726 8496
8727 8497
8728 // Return jQuery for attributes-only inclusion 8498 // Return jQuery for attributes-only inclusion
8729 8499 var location = window.location;
8730 8500
8731 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 };
8732 8532
8733 8533
8734 var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 8534 var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
8735 stopPropagationCallback = function( e ) { 8535 stopPropagationCallback = function( e ) {
8736 e.stopPropagation(); 8536 e.stopPropagation();
8912 if ( elem ) { 8712 if ( elem ) {
8913 return jQuery.event.trigger( type, data, elem, true ); 8713 return jQuery.event.trigger( type, data, elem, true );
8914 } 8714 }
8915 } 8715 }
8916 } ); 8716 } );
8917
8918
8919 // Support: Firefox <=44
8920 // Firefox doesn't have focus(in | out) events
8921 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
8922 //
8923 // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
8924 // focus(in | out) events fire after focus & blur events,
8925 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
8926 // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
8927 if ( !support.focusin ) {
8928 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
8929
8930 // Attach a single capturing handler on the document while someone wants focusin/focusout
8931 var handler = function( event ) {
8932 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
8933 };
8934
8935 jQuery.event.special[ fix ] = {
8936 setup: function() {
8937
8938 // Handle: regular nodes (via `this.ownerDocument`), window
8939 // (via `this.document`) & document (via `this`).
8940 var doc = this.ownerDocument || this.document || this,
8941 attaches = dataPriv.access( doc, fix );
8942
8943 if ( !attaches ) {
8944 doc.addEventListener( orig, handler, true );
8945 }
8946 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
8947 },
8948 teardown: function() {
8949 var doc = this.ownerDocument || this.document || this,
8950 attaches = dataPriv.access( doc, fix ) - 1;
8951
8952 if ( !attaches ) {
8953 doc.removeEventListener( orig, handler, true );
8954 dataPriv.remove( doc, fix );
8955
8956 } else {
8957 dataPriv.access( doc, fix, attaches );
8958 }
8959 }
8960 };
8961 } );
8962 }
8963 var location = window.location;
8964
8965 var nonce = { guid: Date.now() };
8966
8967 var rquery = ( /\?/ );
8968
8969
8970
8971 // Cross-browser xml parsing
8972 jQuery.parseXML = function( data ) {
8973 var xml, parserErrorElem;
8974 if ( !data || typeof data !== "string" ) {
8975 return null;
8976 }
8977
8978 // Support: IE 9 - 11 only
8979 // IE throws on parseFromString with invalid input.
8980 try {
8981 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
8982 } catch ( e ) {}
8983
8984 parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ];
8985 if ( !xml || parserErrorElem ) {
8986 jQuery.error( "Invalid XML: " + (
8987 parserErrorElem ?
8988 jQuery.map( parserErrorElem.childNodes, function( el ) {
8989 return el.textContent;
8990 } ).join( "\n" ) :
8991 data
8992 ) );
8993 }
8994 return xml;
8995 };
8996 8717
8997 8718
8998 var 8719 var
8999 rbracket = /\[\]$/, 8720 rbracket = /\[\]$/,
9000 rCRLF = /\r?\n/g, 8721 rCRLF = /\r?\n/g,
10837 this.off( selector, "**" ) : 10558 this.off( selector, "**" ) :
10838 this.off( types, selector || "**", fn ); 10559 this.off( types, selector || "**", fn );
10839 }, 10560 },
10840 10561
10841 hover: function( fnOver, fnOut ) { 10562 hover: function( fnOver, fnOut ) {
10842 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 10563 return this
10564 .on( "mouseenter", fnOver )
10565 .on( "mouseleave", fnOut || fnOver );
10843 } 10566 }
10844 } ); 10567 } );
10845 10568
10846 jQuery.each( 10569 jQuery.each(
10847 ( "blur focus focusin focusout resize scroll click dblclick " + 10570 ( "blur focus focusin focusout resize scroll click dblclick " +

eric ide

mercurial