Rev 637 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 637 | Rev 1411 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /*! |
1 | /*! |
2 | * jQuery JavaScript Library v3.6.0 -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-effects,-effects/Tween,-effects/animatedSelector |
2 | * jQuery JavaScript Library v3.7.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-effects,-effects/animatedSelector,-effects/Tween |
3 | * https://jquery.com/ |
3 | * https://jquery.com/ |
4 | * |
4 | * |
5 | * Includes Sizzle.js |
- | |
6 | * https://sizzlejs.com/ |
- | |
7 | * |
- | |
8 | * Copyright OpenJS Foundation and other contributors |
5 | * Copyright OpenJS Foundation and other contributors |
9 | * Released under the MIT license |
6 | * Released under the MIT license |
10 | * https://jquery.org/license |
7 | * https://jquery.org/license |
11 | * |
8 | * |
12 | * Date: 2021-03-02T17:08Z |
9 | * Date: 2023-08-28T13:37Z |
13 | */ |
10 | */ |
14 | ( function( global, factory ) { |
11 | ( function( global, factory ) { |
15 | 12 | ||
16 | "use strict"; |
13 | "use strict"; |
17 | 14 | ||
Line 21... | Line 18... | ||
21 | // is present, execute the factory and get jQuery. |
18 | // is present, execute the factory and get jQuery. |
22 | // For environments that do not have a `window` with a `document` |
19 | // For environments that do not have a `window` with a `document` |
23 | // (such as Node.js), expose a factory as module.exports. |
20 | // (such as Node.js), expose a factory as module.exports. |
24 | // This accentuates the need for the creation of a real `window`. |
21 | // This accentuates the need for the creation of a real `window`. |
25 | // e.g. var jQuery = require("jquery")(window); |
22 | // e.g. var jQuery = require("jquery")(window); |
26 | // See ticket #14549 for more info. |
23 | // See ticket trac-14549 for more info. |
27 | module.exports = global.document ? |
24 | module.exports = global.document ? |
28 | factory( global, true ) : |
25 | factory( global, true ) : |
29 | function( w ) { |
26 | function( w ) { |
30 | if ( !w.document ) { |
27 | if ( !w.document ) { |
31 | throw new Error( "jQuery requires a window with a document" ); |
28 | throw new Error( "jQuery requires a window with a document" ); |
Line 148... | Line 145... | ||
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 |
- | |
154 | version = "3.6.0 -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-effects,-effects/Tween,-effects/animatedSelector", |
150 | var version = "3.7.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-deprecated/ajax-event-alias,-effects,-effects/animatedSelector,-effects/Tween", |
- | 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' |
Line 395... | Line 393... | ||
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 ) { |
Line 417... | Line 447... | ||
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, |
Line 518... | Line 557... | ||
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 | } |
- | 562 | ||
- | 563 | ||
- | 564 | function nodeName( elem, name ) { |
|
- | 565 | ||
- | 566 | return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); |
|
- | 567 | ||
- | 568 | } |
|
523 | var Sizzle = |
569 | var pop = arr.pop; |
- | 570 | ||
- | 571 | ||
- | 572 | var sort = arr.sort; |
|
- | 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" |
|
524 | /*! |
584 | ); |
- | 585 | ||
- | 586 | ||
- | 587 | ||
- | 588 | ||
525 | * Sizzle CSS Selector Engine v2.3.6 |
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 ? |
|
526 | * https://sizzlejs.com/ |
598 | a.contains( bup ) : |
- | 599 | a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 |
|
- | 600 | ) ); |
|
527 | * |
601 | }; |
- | 602 | ||
- | 603 | ||
- | 604 | ||
- | 605 | ||
528 | * Copyright JS Foundation and other contributors |
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 | ||
529 | * Released under the MIT license |
610 | function fcssescape( ch, asCodePoint ) { |
530 | * https://js.foundation/ |
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 ) + " "; |
|
531 | * |
620 | } |
- | 621 | ||
- | 622 | // Other potentially-special ASCII characters get backslash-escaped |
|
532 | * Date: 2021-02-16 |
623 | return "\\" + ch; |
- | 624 | } |
|
- | 625 | ||
- | 626 | jQuery.escapeSelector = function( sel ) { |
|
- | 627 | return ( sel + "" ).replace( rcssescape, fcssescape ); |
|
533 | */ |
628 | }; |
- | 629 | ||
- | 630 | ||
- | 631 | ||
- | 632 | ||
- | 633 | var preferredDoc = document, |
|
- | 634 | pushNative = push; |
|
- | 635 | ||
534 | ( function( window ) { |
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(), |
Line 568... | Line 662... | ||
568 | hasDuplicate = true; |
662 | hasDuplicate = true; |
569 | } |
663 | } |
570 | return 0; |
664 | return 0; |
571 | }, |
665 | }, |
572 | 666 | ||
573 | // Instance methods |
- | |
574 | hasOwn = ( {} ).hasOwnProperty, |
- | |
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|" + |
667 | booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" + |
595 | "ismap|loop|multiple|open|readonly|required|scoped", |
668 | "loop|multiple|open|readonly|required|scoped", |
596 | 669 | ||
597 | // Regular expressions |
670 | // Regular expressions |
598 | 671 | ||
599 | // http://www.w3.org/TR/css3-selectors/#whitespace |
- | |
600 | whitespace = "[\\x20\\t\\r\\n\\f]", |
- | |
601 | - | ||
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 | ||
Line 627... | Line 696... | ||
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 ), |
- | 716 | CHILD: new RegExp( |
|
649 | "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + |
717 | "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + |
650 | whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + |
718 | whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + |
651 | whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), |
719 | whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), |
652 | "bool": new RegExp( "^(?:" + booleans + ")$", "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; |
- | 748 | } |
|
682 | 749 | ||
683 | // Replace a hexadecimal escape sequence with the encoded Unicode code point |
750 | // Replace a hexadecimal escape sequence with the encoded Unicode code point |
684 | // Support: IE <=11+ |
751 | // Support: IE <=11+ |
685 | // For values outside the Basic Multilingual Plane (BMP), manually construct a |
752 | // For values outside the Basic Multilingual Plane (BMP), manually construct a |
686 | // surrogate pair |
753 | // surrogate pair |
687 | high < 0 ? |
754 | return high < 0 ? |
688 | String.fromCharCode( high + 0x10000 ) : |
755 | String.fromCharCode( high + 0x10000 ) : |
689 | String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); |
756 | String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); |
690 | }, |
757 | }, |
691 | 758 | ||
692 | // CSS string/identifier serialization |
759 | // Used for iframes; see `setDocument`. |
693 | // https://drafts.csswg.org/cssom/#common-serializing-idioms |
- | |
694 | rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, |
- | |
695 | fcssescape = function( ch, asCodePoint ) { |
- | |
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 ) + "\\" + |
760 | // Support: IE 9 - 11+, Edge 12 - 18+ |
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 | ); |
726 | 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 | } |
|
- | 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 | - | ||
741 | // Leverage slice if possible |
- | |
742 | function( target, els ) { |
796 | apply: function( target, els ) { |
743 | pushNative.apply( target, slice.call( els ) ); |
797 | pushNative.apply( target, slice.call( els ) ); |
744 | } : |
798 | }, |
745 | - | ||
746 | // Support: IE<9 |
- | |
747 | // Otherwise append directly |
- | |
748 | function( target, els ) { |
799 | call: function( target ) { |
749 | var j = target.length, |
- | |
750 | i = 0; |
- | |
751 | - | ||
752 | // Can't trust NodeList.length |
- | |
753 | while ( ( target[ j++ ] = els[ i++ ] ) ) {} |
800 | pushNative.apply( target, slice.call( arguments, 1 ) ); |
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; |
Line 788... | Line 834... | ||
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 && |
- | |
835 | !nonnativeSelectorCache[ selector + " " ] && |
876 | if ( !nonnativeSelectorCache[ selector + " " ] && |
836 | ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) && |
877 | ( !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 |
Line 848... | Line 885... | ||
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. |
- | 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 |
|
861 | if ( newContext !== context || !support.scope ) { |
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 | ||
Line 893... | Line 934... | ||
893 | } |
934 | } |
894 | } |
935 | } |
895 | } |
936 | } |
896 | 937 | ||
897 | // All others |
938 | // All others |
898 | return select( selector.replace( rtrim, "$1" ), context, results, seed ); |
939 | return select( selector.replace( rtrimCSS, "$1" ), context, results, seed ); |
899 | } |
940 | } |
900 | 941 | ||
901 | /** |
942 | /** |
902 | * Create key-value caches of limited size |
943 | * Create key-value caches of limited size |
903 | * @returns {function(string, object)} Returns the Object data after storing it on itself with |
944 | * @returns {function(string, object)} Returns the Object data after storing it on itself with |
Line 907... | Line 948... | ||
907 | function createCache() { |
948 | function createCache() { |
908 | var keys = []; |
949 | var keys = []; |
909 | 950 | ||
910 | function cache( key, value ) { |
951 | function cache( key, value ) { |
911 | 952 | ||
912 | // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) |
953 | // Use (key + " ") to avoid collision with native prototype properties |
- | 954 | // (see https://github.com/jquery/sizzle/issues/157) |
|
913 | if ( keys.push( key + " " ) > Expr.cacheLength ) { |
955 | if ( keys.push( key + " " ) > Expr.cacheLength ) { |
914 | 956 | ||
915 | // Only keep the most recent entries |
957 | // Only keep the most recent entries |
916 | delete cache[ keys.shift() ]; |
958 | delete cache[ keys.shift() ]; |
917 | } |
959 | } |
Line 919... | Line 961... | ||
919 | } |
961 | } |
920 | return cache; |
962 | return cache; |
921 | } |
963 | } |
922 | 964 | ||
923 | /** |
965 | /** |
924 | * Mark a function for special use by Sizzle |
966 | * Mark a function for special use by jQuery selector module |
925 | * @param {Function} fn The function to mark |
967 | * @param {Function} fn The function to mark |
926 | */ |
968 | */ |
927 | function markFunction( fn ) { |
969 | function markFunction( fn ) { |
928 | fn[ expando ] = true; |
970 | fn[ expando ] = true; |
929 | return fn; |
971 | return fn; |
Line 951... | Line 993... | ||
951 | el = null; |
993 | el = null; |
952 | } |
994 | } |
953 | } |
995 | } |
954 | 996 | ||
955 | /** |
997 | /** |
956 | * Adds the same handler for all of the specified attrs |
- | |
957 | * @param {String} attrs Pipe-separated list of attributes |
- | |
958 | * @param {Function} handler The method that will be applied |
- | |
959 | */ |
- | |
960 | function addHandle( attrs, handler ) { |
- | |
961 | var arr = attrs.split( "|" ), |
- | |
962 | i = arr.length; |
- | |
963 | - | ||
964 | while ( i-- ) { |
- | |
965 | Expr.attrHandle[ arr[ i ] ] = handler; |
- | |
966 | } |
- | |
967 | } |
- | |
968 | - | ||
969 | /** |
- | |
970 | * Checks document order of two siblings |
- | |
971 | * @param {Element} a |
- | |
972 | * @param {Element} b |
- | |
973 | * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b |
- | |
974 | */ |
- | |
975 | function siblingCheck( a, b ) { |
- | |
976 | var cur = b && a, |
- | |
977 | diff = cur && a.nodeType === 1 && b.nodeType === 1 && |
- | |
978 | a.sourceIndex - b.sourceIndex; |
- | |
979 | - | ||
980 | // Use IE sourceIndex if available on both nodes |
- | |
981 | if ( diff ) { |
- | |
982 | return diff; |
- | |
983 | } |
- | |
984 | - | ||
985 | // Check if b follows a |
- | |
986 | if ( cur ) { |
- | |
987 | while ( ( cur = cur.nextSibling ) ) { |
- | |
988 | if ( cur === b ) { |
- | |
989 | return -1; |
- | |
990 | } |
- | |
991 | } |
- | |
992 | } |
- | |
993 | - | ||
994 | return a ? 1 : -1; |
- | |
995 | } |
- | |
996 | - | ||
997 | /** |
- | |
998 | * Returns a function to use in pseudos for input types |
998 | * Returns a function to use in pseudos for input types |
999 | * @param {String} type |
999 | * @param {String} type |
1000 | */ |
1000 | */ |
1001 | function createInputPseudo( type ) { |
1001 | function createInputPseudo( type ) { |
1002 | return function( elem ) { |
1002 | return function( elem ) { |
1003 | var name = elem.nodeName.toLowerCase(); |
- | |
1004 | return name === "input" && elem.type === type; |
1003 | return nodeName( elem, "input" ) && elem.type === type; |
1005 | }; |
1004 | }; |
1006 | } |
1005 | } |
1007 | 1006 | ||
1008 | /** |
1007 | /** |
1009 | * Returns a function to use in pseudos for buttons |
1008 | * Returns a function to use in pseudos for buttons |
1010 | * @param {String} type |
1009 | * @param {String} type |
1011 | */ |
1010 | */ |
1012 | function createButtonPseudo( type ) { |
1011 | function createButtonPseudo( type ) { |
1013 | return function( elem ) { |
1012 | return function( elem ) { |
1014 | var name = elem.nodeName.toLowerCase(); |
1013 | return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) && |
1015 | return ( name === "input" || name === "button" ) && elem.type === type; |
1014 | elem.type === type; |
1016 | }; |
1015 | }; |
1017 | } |
1016 | } |
1018 | 1017 | ||
1019 | /** |
1018 | /** |
1020 | * Returns a function to use in pseudos for :enabled/:disabled |
1019 | * Returns a function to use in pseudos for :enabled/:disabled |
Line 1046... | Line 1045... | ||
1046 | } else { |
1045 | } else { |
1047 | return elem.disabled === disabled; |
1046 | return elem.disabled === disabled; |
1048 | } |
1047 | } |
1049 | } |
1048 | } |
1050 | 1049 | ||
1051 | // Support: IE 6 - 11 |
1050 | // Support: IE 6 - 11+ |
1052 | // Use the isDisabled shortcut property to check for disabled fieldset ancestors |
1051 | // Use the isDisabled shortcut property to check for disabled fieldset ancestors |
1053 | return elem.isDisabled === disabled || |
1052 | return elem.isDisabled === disabled || |
1054 | 1053 | ||
1055 | // Where there is no isDisabled, check manually |
1054 | // Where there is no isDisabled, check manually |
1056 | /* jshint -W018 */ |
- | |
1057 | elem.isDisabled !== !disabled && |
1055 | elem.isDisabled !== !disabled && |
1058 | inDisabledFieldset( elem ) === disabled; |
1056 | inDisabledFieldset( elem ) === disabled; |
1059 | } |
1057 | } |
1060 | 1058 | ||
1061 | return elem.disabled === disabled; |
1059 | return elem.disabled === disabled; |
Line 1093... | Line 1091... | ||
1093 | } ); |
1091 | } ); |
1094 | } ); |
1092 | } ); |
1095 | } |
1093 | } |
1096 | 1094 | ||
1097 | /** |
1095 | /** |
1098 | * Checks a node for validity as a Sizzle context |
1096 | * Checks a node for validity as a jQuery selector context |
1099 | * @param {Element|Object=} context |
1097 | * @param {Element|Object=} context |
1100 | * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value |
1098 | * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value |
1101 | */ |
1099 | */ |
1102 | function testContext( context ) { |
1100 | function testContext( context ) { |
1103 | return context && typeof context.getElementsByTagName !== "undefined" && context; |
1101 | return context && typeof context.getElementsByTagName !== "undefined" && context; |
1104 | } |
1102 | } |
1105 | 1103 | ||
1106 | // Expose support vars for convenience |
- | |
1107 | support = Sizzle.support = {}; |
- | |
1108 | - | ||
1109 | /** |
- | |
1110 | * Detects XML nodes |
- | |
1111 | * @param {Element|Object} elem An element or a document |
- | |
1112 | * @returns {Boolean} True iff elem is a non-HTML XML node |
- | |
1113 | */ |
- | |
1114 | isXML = Sizzle.isXML = function( elem ) { |
- | |
1115 | var namespace = elem && elem.namespaceURI, |
- | |
1116 | docElem = elem && ( elem.ownerDocument || elem ).documentElement; |
- | |
1117 | - | ||
1118 | // Support: IE <=8 |
- | |
1119 | // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes |
- | |
1120 | // https://bugs.jquery.com/ticket/4833 |
- | |
1121 | return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); |
- | |
1122 | }; |
- | |
1123 | - | ||
1124 | /** |
1104 | /** |
1125 | * Sets document-related variables once based on the current document |
1105 | * Sets document-related variables once based on the current document |
1126 | * @param {Element|Object} [doc] An element or document object to use to set the document |
1106 | * @param {Element|Object} [node] An element or document object to use to set the document |
1127 | * @returns {Object} Returns the current document |
1107 | * @returns {Object} Returns the current document |
1128 | */ |
1108 | */ |
1129 | setDocument = Sizzle.setDocument = function( node ) { |
1109 | function setDocument( node ) { |
1130 | var hasCompare, subWindow, |
1110 | var subWindow, |
1131 | doc = node ? node.ownerDocument || node : preferredDoc; |
1111 | doc = node ? node.ownerDocument || node : preferredDoc; |
1132 | 1112 | ||
1133 | // Return early if doc is invalid or already selected |
1113 | // Return early if doc is invalid or already selected |
1134 | // Support: IE 11+, Edge 17 - 18+ |
1114 | // Support: IE 11+, Edge 17 - 18+ |
1135 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1115 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
Line 1139... | Line 1119... | ||
1139 | return document; |
1119 | return document; |
1140 | } |
1120 | } |
1141 | 1121 | ||
1142 | // Update global variables |
1122 | // Update global variables |
1143 | document = doc; |
1123 | document = doc; |
1144 | docElem = document.documentElement; |
1124 | documentElement = document.documentElement; |
1145 | documentIsHTML = !isXML( document ); |
1125 | documentIsHTML = !jQuery.isXMLDoc( document ); |
- | 1126 | ||
- | 1127 | // Support: iOS 7 only, IE 9 - 11+ |
|
- | 1128 | // Older browsers didn't support unprefixed `matches`. |
|
- | 1129 | matches = documentElement.matches || |
|
- | 1130 | documentElement.webkitMatchesSelector || |
|
- | 1131 | documentElement.msMatchesSelector; |
|
1146 | 1132 | ||
1147 | // Support: IE 9 - 11+, Edge 12 - 18+ |
1133 | // Support: IE 9 - 11+, Edge 12 - 18+ |
1148 | // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) |
1134 | // Accessing iframe documents after unload throws "permission denied" errors |
- | 1135 | // (see trac-13936). |
|
- | 1136 | // Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`, |
|
- | 1137 | // all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well. |
|
- | 1138 | if ( documentElement.msMatchesSelector && |
|
- | 1139 | ||
1149 | // Support: IE 11+, Edge 17 - 18+ |
1140 | // Support: IE 11+, Edge 17 - 18+ |
1150 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1141 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1151 | // two documents; shallow comparisons work. |
1142 | // two documents; shallow comparisons work. |
1152 | // eslint-disable-next-line eqeqeq |
1143 | // eslint-disable-next-line eqeqeq |
1153 | if ( preferredDoc != document && |
1144 | preferredDoc != document && |
1154 | ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { |
1145 | ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { |
1155 | 1146 | ||
1156 | // Support: IE 11, Edge |
1147 | // Support: IE 9 - 11+, Edge 12 - 18+ |
1157 | if ( subWindow.addEventListener ) { |
- | |
1158 | subWindow.addEventListener( "unload", unloadHandler, false ); |
1148 | subWindow.addEventListener( "unload", unloadHandler ); |
1159 | - | ||
1160 | // Support: IE 9 - 10 only |
- | |
1161 | } else if ( subWindow.attachEvent ) { |
- | |
1162 | subWindow.attachEvent( "onunload", unloadHandler ); |
- | |
1163 | } |
- | |
1164 | } |
1149 | } |
1165 | 1150 | ||
1166 | // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only, |
1151 | // Support: IE <10 |
1167 | // Safari 4 - 5 only, Opera <=11.6 - 12.x only |
1152 | // Check if getElementById returns elements by name |
1168 | // IE/Edge & older browsers don't support the :scope pseudo-class. |
1153 | // The broken getElementById methods don't pick up programmatically-set names, |
1169 | // Support: Safari 6.0 only |
- | |
1170 | // Safari 6.0 supports :scope but it's an alias of :root there. |
1154 | // so use a roundabout getElementsByName test |
1171 | support.scope = assert( function( el ) { |
1155 | support.getById = assert( function( el ) { |
1172 | docElem.appendChild( el ).appendChild( document.createElement( "div" ) ); |
1156 | documentElement.appendChild( el ).id = jQuery.expando; |
1173 | return typeof el.querySelectorAll !== "undefined" && |
1157 | return !document.getElementsByName || |
1174 | !el.querySelectorAll( ":scope fieldset div" ).length; |
1158 | !document.getElementsByName( jQuery.expando ).length; |
1175 | } ); |
1159 | } ); |
1176 | 1160 | ||
1177 | /* Attributes |
- | |
1178 | ---------------------------------------------------------------------- */ |
- | |
1179 | - | ||
1180 | // Support: IE<8 |
1161 | // Support: IE 9 only |
1181 | // Verify that getAttribute really returns attributes and not properties |
1162 | // Check to see if it's possible to do matchesSelector |
1182 | // (excepting IE8 booleans) |
1163 | // on a disconnected node. |
1183 | support.attributes = assert( function( el ) { |
1164 | support.disconnectedMatch = assert( function( el ) { |
1184 | el.className = "i"; |
- | |
1185 | return !el.getAttribute( "className" ); |
1165 | return matches.call( el, "*" ); |
1186 | } ); |
1166 | } ); |
1187 | 1167 | ||
1188 | /* getElement(s)By* |
1168 | // Support: IE 9 - 11+, Edge 12 - 18+ |
1189 | ---------------------------------------------------------------------- */ |
- | |
1190 | - | ||
1191 | // Check if getElementsByTagName("*") returns only elements |
1169 | // IE/Edge don't support the :scope pseudo-class. |
1192 | support.getElementsByTagName = assert( function( el ) { |
1170 | support.scope = assert( function() { |
1193 | el.appendChild( document.createComment( "" ) ); |
- | |
1194 | return !el.getElementsByTagName( "*" ).length; |
1171 | return document.querySelectorAll( ":scope" ); |
1195 | } ); |
1172 | } ); |
1196 | 1173 | ||
1197 | // Support: IE<9 |
1174 | // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only |
- | 1175 | // Make sure the `:has()` argument is parsed unforgivingly. |
|
1198 | support.getElementsByClassName = rnative.test( document.getElementsByClassName ); |
1176 | // We include `*` in the test to detect buggy implementations that are |
1199 | - | ||
- | 1177 | // _selectively_ forgiving (specifically when the list includes at least |
|
1200 | // Support: IE<10 |
1178 | // one valid selector). |
1201 | // Check if getElementById returns elements by name |
1179 | // Note that we treat complete lack of support for `:has()` as if it were |
1202 | // The broken getElementById methods don't pick up programmatically-set names, |
1180 | // spec-compliant support, which is fine because use of `:has()` in such |
1203 | // so use a roundabout getElementsByName test |
1181 | // environments will fail in the qSA path and fall back to jQuery traversal |
- | 1182 | // anyway. |
|
1204 | support.getById = assert( function( el ) { |
1183 | support.cssHas = assert( function() { |
- | 1184 | try { |
|
1205 | docElem.appendChild( el ).id = expando; |
1185 | document.querySelector( ":has(*,:jqfake)" ); |
1206 | return !document.getElementsByName || !document.getElementsByName( expando ).length; |
1186 | return false; |
- | 1187 | } catch ( e ) { |
|
- | 1188 | return true; |
|
- | 1189 | } |
|
1207 | } ); |
1190 | } ); |
1208 | 1191 | ||
1209 | // ID filter and find |
1192 | // ID filter and find |
1210 | if ( support.getById ) { |
1193 | if ( support.getById ) { |
1211 | Expr.filter[ "ID" ] = function( id ) { |
1194 | Expr.filter.ID = function( id ) { |
1212 | var attrId = id.replace( runescape, funescape ); |
1195 | var attrId = id.replace( runescape, funescape ); |
1213 | return function( elem ) { |
1196 | return function( elem ) { |
1214 | return elem.getAttribute( "id" ) === attrId; |
1197 | return elem.getAttribute( "id" ) === attrId; |
1215 | }; |
1198 | }; |
1216 | }; |
1199 | }; |
1217 | Expr.find[ "ID" ] = function( id, context ) { |
1200 | Expr.find.ID = function( id, context ) { |
1218 | if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { |
1201 | if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { |
1219 | var elem = context.getElementById( id ); |
1202 | var elem = context.getElementById( id ); |
1220 | return elem ? [ elem ] : []; |
1203 | return elem ? [ elem ] : []; |
1221 | } |
1204 | } |
1222 | }; |
1205 | }; |
1223 | } else { |
1206 | } else { |
1224 | Expr.filter[ "ID" ] = function( id ) { |
1207 | Expr.filter.ID = function( id ) { |
1225 | var attrId = id.replace( runescape, funescape ); |
1208 | var attrId = id.replace( runescape, funescape ); |
1226 | return function( elem ) { |
1209 | return function( elem ) { |
1227 | var node = typeof elem.getAttributeNode !== "undefined" && |
1210 | var node = typeof elem.getAttributeNode !== "undefined" && |
1228 | elem.getAttributeNode( "id" ); |
1211 | elem.getAttributeNode( "id" ); |
1229 | return node && node.value === attrId; |
1212 | return node && node.value === attrId; |
1230 | }; |
1213 | }; |
1231 | }; |
1214 | }; |
1232 | 1215 | ||
1233 | // Support: IE 6 - 7 only |
1216 | // Support: IE 6 - 7 only |
1234 | // getElementById is not reliable as a find shortcut |
1217 | // getElementById is not reliable as a find shortcut |
1235 | Expr.find[ "ID" ] = function( id, context ) { |
1218 | Expr.find.ID = function( id, context ) { |
1236 | if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { |
1219 | if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { |
1237 | var node, i, elems, |
1220 | var node, i, elems, |
1238 | elem = context.getElementById( id ); |
1221 | elem = context.getElementById( id ); |
1239 | 1222 | ||
1240 | if ( elem ) { |
1223 | if ( elem ) { |
Line 1260... | Line 1243... | ||
1260 | } |
1243 | } |
1261 | }; |
1244 | }; |
1262 | } |
1245 | } |
1263 | 1246 | ||
1264 | // Tag |
1247 | // Tag |
1265 | Expr.find[ "TAG" ] = support.getElementsByTagName ? |
- | |
1266 | function( tag, context ) { |
1248 | Expr.find.TAG = function( tag, context ) { |
1267 | if ( typeof context.getElementsByTagName !== "undefined" ) { |
1249 | if ( typeof context.getElementsByTagName !== "undefined" ) { |
1268 | return context.getElementsByTagName( tag ); |
1250 | return context.getElementsByTagName( tag ); |
1269 | 1251 | ||
1270 | // DocumentFragment nodes don't have gEBTN |
1252 | // DocumentFragment nodes don't have gEBTN |
1271 | } else if ( support.qsa ) { |
1253 | } else { |
1272 | return context.querySelectorAll( tag ); |
1254 | return context.querySelectorAll( tag ); |
1273 | } |
1255 | } |
1274 | } : |
- | |
1275 | - | ||
1276 | function( tag, context ) { |
- | |
1277 | var elem, |
- | |
1278 | tmp = [], |
- | |
1279 | i = 0, |
- | |
1280 | - | ||
1281 | // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too |
- | |
1282 | results = context.getElementsByTagName( tag ); |
- | |
1283 | - | ||
1284 | // Filter out possible comments |
- | |
1285 | if ( tag === "*" ) { |
- | |
1286 | while ( ( elem = results[ i++ ] ) ) { |
- | |
1287 | if ( elem.nodeType === 1 ) { |
- | |
1288 | tmp.push( elem ); |
- | |
1289 | } |
- | |
1290 | } |
- | |
1291 | - | ||
1292 | return tmp; |
- | |
1293 | } |
- | |
1294 | return results; |
- | |
1295 | }; |
1256 | }; |
1296 | 1257 | ||
1297 | // Class |
1258 | // Class |
1298 | Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) { |
1259 | Expr.find.CLASS = function( className, context ) { |
1299 | if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { |
1260 | if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { |
1300 | return context.getElementsByClassName( className ); |
1261 | return context.getElementsByClassName( className ); |
1301 | } |
1262 | } |
1302 | }; |
1263 | }; |
1303 | 1264 | ||
1304 | /* QSA/matchesSelector |
1265 | /* QSA/matchesSelector |
1305 | ---------------------------------------------------------------------- */ |
1266 | ---------------------------------------------------------------------- */ |
1306 | 1267 | ||
1307 | // QSA and matchesSelector support |
1268 | // QSA and matchesSelector support |
1308 | 1269 | ||
1309 | // matchesSelector(:active) reports false when true (IE9/Opera 11.5) |
- | |
1310 | rbuggyMatches = []; |
- | |
1311 | - | ||
1312 | // qSa(:focus) reports false when true (Chrome 21) |
- | |
1313 | // We allow this because of a bug in IE8/9 that throws an error |
- | |
1314 | // whenever `document.activeElement` is accessed on an iframe |
- | |
1315 | // So, we allow :focus to pass through QSA all the time to avoid the IE error |
- | |
1316 | // See https://bugs.jquery.com/ticket/13378 |
- | |
1317 | rbuggyQSA = []; |
1270 | rbuggyQSA = []; |
1318 | 1271 | ||
1319 | if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) { |
- | |
1320 | - | ||
1321 | // Build QSA regex |
1272 | // Build QSA regex |
1322 | // Regex strategy adopted from Diego Perini |
1273 | // Regex strategy adopted from Diego Perini |
1323 | assert( function( el ) { |
1274 | assert( function( el ) { |
1324 | 1275 | ||
1325 | var input; |
1276 | var input; |
1326 | 1277 | ||
1327 | // Select is set to empty string on purpose |
- | |
1328 | // This is to test IE's treatment of not explicitly |
- | |
1329 | // setting a boolean content attribute, |
- | |
1330 | // since its presence should be enough |
1278 | documentElement.appendChild( el ).innerHTML = |
1331 | // https://bugs.jquery.com/ticket/12359 |
- | |
1332 | docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + |
1279 | "<a id='" + expando + "' href='' disabled='disabled'></a>" + |
1333 | "<select id='" + expando + "-\r\\' msallowcapture=''>" + |
1280 | "<select id='" + expando + "-\r\\' disabled='disabled'>" + |
1334 | "<option selected=''></option></select>"; |
1281 | "<option selected=''></option></select>"; |
1335 | 1282 | ||
1336 | // Support: IE8, Opera 11-12.16 |
1283 | // Support: iOS <=7 - 8 only |
1337 | // Nothing should be selected when empty strings follow ^= or $= or *= |
- | |
1338 | // The test attribute must be unknown in Opera but "safe" for WinRT |
- | |
1339 | // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section |
- | |
1340 | if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) { |
- | |
1341 | rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); |
- | |
1342 | } |
- | |
1343 | - | ||
1344 | // Support: IE8 |
- | |
1345 | // Boolean attributes and "value" are not treated correctly |
1284 | // Boolean attributes and "value" are not treated correctly in some XML documents |
1346 | if ( !el.querySelectorAll( "[selected]" ).length ) { |
1285 | if ( !el.querySelectorAll( "[selected]" ).length ) { |
1347 | rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); |
1286 | rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); |
1348 | } |
1287 | } |
1349 | 1288 | ||
1350 | // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ |
1289 | // Support: iOS <=7 - 8 only |
1351 | if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { |
1290 | if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { |
1352 | rbuggyQSA.push( "~=" ); |
1291 | rbuggyQSA.push( "~=" ); |
1353 | } |
1292 | } |
1354 | 1293 | ||
1355 | // Support: IE 11+, Edge 15 - 18+ |
- | |
1356 | // IE 11/Edge don't find elements on a `[name='']` query in some cases. |
- | |
1357 | // Adding a temporary attribute to the document before the selection works |
- | |
1358 | // around the issue. |
- | |
1359 | // Interestingly, IE 10 & older don't seem to have the issue. |
- | |
1360 | input = document.createElement( "input" ); |
- | |
1361 | input.setAttribute( "name", "" ); |
- | |
1362 | el.appendChild( input ); |
- | |
1363 | if ( !el.querySelectorAll( "[name='']" ).length ) { |
- | |
1364 | rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + |
- | |
1365 | whitespace + "*(?:''|\"\")" ); |
- | |
1366 | } |
- | |
1367 | - | ||
1368 | // Webkit/Opera - :checked should return selected option elements |
- | |
1369 | // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
- | |
1370 | // IE8 throws error here and will not see later tests |
- | |
1371 | if ( !el.querySelectorAll( ":checked" ).length ) { |
- | |
1372 | rbuggyQSA.push( ":checked" ); |
- | |
1373 | } |
- | |
1374 | - | ||
1375 | // Support: Safari 8+, iOS 8+ |
1294 | // Support: iOS 8 only |
1376 | // https://bugs.webkit.org/show_bug.cgi?id=136851 |
1295 | // https://bugs.webkit.org/show_bug.cgi?id=136851 |
1377 | // In-page `selector#id sibling-combinator selector` fails |
1296 | // In-page `selector#id sibling-combinator selector` fails |
1378 | if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { |
1297 | if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { |
1379 | rbuggyQSA.push( ".#.+[+~]" ); |
1298 | rbuggyQSA.push( ".#.+[+~]" ); |
1380 | } |
1299 | } |
1381 | 1300 | ||
1382 | // Support: Firefox <=3.6 - 5 only |
1301 | // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ |
- | 1302 | // In some of the document kinds, these selectors wouldn't work natively. |
|
- | 1303 | // This is probably OK but for backwards compatibility we want to maintain |
|
1383 | // Old Firefox doesn't throw on a badly-escaped identifier. |
1304 | // handling them through jQuery traversal in jQuery 3.x. |
1384 | el.querySelectorAll( "\\\f" ); |
1305 | if ( !el.querySelectorAll( ":checked" ).length ) { |
1385 | rbuggyQSA.push( "[\\r\\n\\f]" ); |
1306 | rbuggyQSA.push( ":checked" ); |
1386 | } ); |
1307 | } |
1387 | - | ||
1388 | assert( function( el ) { |
- | |
1389 | el.innerHTML = "<a href='' disabled='disabled'></a>" + |
- | |
1390 | "<select disabled='disabled'><option/></select>"; |
- | |
1391 | 1308 | ||
1392 | // Support: Windows 8 Native Apps |
1309 | // Support: Windows 8 Native Apps |
1393 | // The type and name attributes are restricted during .innerHTML assignment |
1310 | // The type and name attributes are restricted during .innerHTML assignment |
1394 | var input = document.createElement( "input" ); |
1311 | input = document.createElement( "input" ); |
1395 | input.setAttribute( "type", "hidden" ); |
1312 | input.setAttribute( "type", "hidden" ); |
1396 | el.appendChild( input ).setAttribute( "name", "D" ); |
1313 | el.appendChild( input ).setAttribute( "name", "D" ); |
1397 | 1314 | ||
1398 | // Support: IE8 |
- | |
1399 | // Enforce case-sensitivity of name attribute |
- | |
1400 | if ( el.querySelectorAll( "[name=d]" ).length ) { |
- | |
1401 | rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); |
- | |
1402 | } |
- | |
1403 | - | ||
1404 | // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) |
- | |
1405 | // IE8 throws error here and will not see later tests |
- | |
1406 | if ( el.querySelectorAll( ":enabled" ).length !== 2 ) { |
- | |
1407 | rbuggyQSA.push( ":enabled", ":disabled" ); |
- | |
1408 | } |
- | |
1409 | - | ||
1410 | // Support: IE9-11+ |
1315 | // Support: IE 9 - 11+ |
1411 | // IE's :disabled selector does not pick up the children of disabled fieldsets |
1316 | // IE's :disabled selector does not pick up the children of disabled fieldsets |
- | 1317 | // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ |
|
- | 1318 | // In some of the document kinds, these selectors wouldn't work natively. |
|
- | 1319 | // This is probably OK but for backwards compatibility we want to maintain |
|
- | 1320 | // handling them through jQuery traversal in jQuery 3.x. |
|
1412 | docElem.appendChild( el ).disabled = true; |
1321 | documentElement.appendChild( el ).disabled = true; |
1413 | if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { |
1322 | if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { |
1414 | rbuggyQSA.push( ":enabled", ":disabled" ); |
1323 | rbuggyQSA.push( ":enabled", ":disabled" ); |
1415 | } |
1324 | } |
1416 | 1325 | ||
1417 | // Support: Opera 10 - 11 only |
1326 | // Support: IE 11+, Edge 15 - 18+ |
- | 1327 | // IE 11/Edge don't find elements on a `[name='']` query in some cases. |
|
- | 1328 | // Adding a temporary attribute to the document before the selection works |
|
- | 1329 | // around the issue. |
|
1418 | // Opera 10-11 does not throw on post-comma invalid pseudos |
1330 | // Interestingly, IE 10 & older don't seem to have the issue. |
1419 | el.querySelectorAll( "*,:x" ); |
1331 | input = document.createElement( "input" ); |
1420 | rbuggyQSA.push( ",.*:" ); |
1332 | input.setAttribute( "name", "" ); |
1421 | } ); |
1333 | el.appendChild( input ); |
- | 1334 | if ( !el.querySelectorAll( "[name='']" ).length ) { |
|
- | 1335 | rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + |
|
- | 1336 | whitespace + "*(?:''|\"\")" ); |
|
1422 | } |
1337 | } |
- | 1338 | } ); |
|
1423 | 1339 | ||
1424 | if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches || |
- | |
1425 | docElem.webkitMatchesSelector || |
- | |
1426 | docElem.mozMatchesSelector || |
- | |
1427 | docElem.oMatchesSelector || |
- | |
1428 | docElem.msMatchesSelector ) ) ) ) { |
- | |
1429 | - | ||
1430 | assert( function( el ) { |
1340 | if ( !support.cssHas ) { |
1431 | - | ||
1432 | // Check to see if it's possible to do matchesSelector |
- | |
1433 | // on a disconnected node (IE 9) |
- | |
1434 | support.disconnectedMatch = matches.call( el, "*" ); |
- | |
1435 | 1341 | ||
1436 | // This should fail with an exception |
1342 | // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ |
1437 | // Gecko does not error, returns false instead |
1343 | // Our regular `try-catch` mechanism fails to detect natively-unsupported |
1438 | matches.call( el, "[s!='']:x" ); |
1344 | // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`) |
- | 1345 | // in browsers that parse the `:has()` argument as a forgiving selector list. |
|
- | 1346 | // https://drafts.csswg.org/selectors/#relational now requires the argument |
|
- | 1347 | // to be parsed unforgivingly, but browsers have not yet fully adjusted. |
|
1439 | rbuggyMatches.push( "!=", pseudos ); |
1348 | rbuggyQSA.push( ":has" ); |
1440 | } ); |
- | |
1441 | } |
1349 | } |
1442 | 1350 | ||
1443 | rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); |
1351 | rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); |
1444 | rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) ); |
- | |
1445 | - | ||
1446 | /* Contains |
- | |
1447 | ---------------------------------------------------------------------- */ |
- | |
1448 | hasCompare = rnative.test( docElem.compareDocumentPosition ); |
- | |
1449 | - | ||
1450 | // Element contains another |
- | |
1451 | // Purposefully self-exclusive |
- | |
1452 | // As in, an element does not contain itself |
- | |
1453 | contains = hasCompare || rnative.test( docElem.contains ) ? |
- | |
1454 | function( a, b ) { |
- | |
1455 | var adown = a.nodeType === 9 ? a.documentElement : a, |
- | |
1456 | bup = b && b.parentNode; |
- | |
1457 | return a === bup || !!( bup && bup.nodeType === 1 && ( |
- | |
1458 | adown.contains ? |
- | |
1459 | adown.contains( bup ) : |
- | |
1460 | a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 |
- | |
1461 | ) ); |
- | |
1462 | } : |
- | |
1463 | function( a, b ) { |
- | |
1464 | if ( b ) { |
- | |
1465 | while ( ( b = b.parentNode ) ) { |
- | |
1466 | if ( b === a ) { |
- | |
1467 | return true; |
- | |
1468 | } |
- | |
1469 | } |
- | |
1470 | } |
- | |
1471 | return false; |
- | |
1472 | }; |
- | |
1473 | 1352 | ||
1474 | /* Sorting |
1353 | /* Sorting |
1475 | ---------------------------------------------------------------------- */ |
1354 | ---------------------------------------------------------------------- */ |
1476 | 1355 | ||
1477 | // Document order sorting |
1356 | // Document order sorting |
1478 | sortOrder = hasCompare ? |
- | |
1479 | function( a, b ) { |
1357 | sortOrder = function( a, b ) { |
1480 | 1358 | ||
1481 | // Flag for duplicate removal |
1359 | // Flag for duplicate removal |
1482 | if ( a === b ) { |
1360 | if ( a === b ) { |
1483 | hasDuplicate = true; |
1361 | hasDuplicate = true; |
1484 | return 0; |
1362 | return 0; |
Line 1508... | Line 1386... | ||
1508 | // Choose the first element that is related to our preferred document |
1386 | // Choose the first element that is related to our preferred document |
1509 | // Support: IE 11+, Edge 17 - 18+ |
1387 | // Support: IE 11+, Edge 17 - 18+ |
1510 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1388 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1511 | // two documents; shallow comparisons work. |
1389 | // two documents; shallow comparisons work. |
1512 | // eslint-disable-next-line eqeqeq |
1390 | // eslint-disable-next-line eqeqeq |
1513 | if ( a == document || a.ownerDocument == preferredDoc && |
1391 | if ( a === document || a.ownerDocument == preferredDoc && |
1514 | contains( preferredDoc, a ) ) { |
1392 | find.contains( preferredDoc, a ) ) { |
1515 | return -1; |
1393 | return -1; |
1516 | } |
1394 | } |
1517 | 1395 | ||
1518 | // Support: IE 11+, Edge 17 - 18+ |
1396 | // Support: IE 11+, Edge 17 - 18+ |
1519 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1397 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1520 | // two documents; shallow comparisons work. |
1398 | // two documents; shallow comparisons work. |
1521 | // eslint-disable-next-line eqeqeq |
1399 | // eslint-disable-next-line eqeqeq |
1522 | if ( b == document || b.ownerDocument == preferredDoc && |
1400 | if ( b === document || b.ownerDocument == preferredDoc && |
1523 | contains( preferredDoc, b ) ) { |
1401 | find.contains( preferredDoc, b ) ) { |
1524 | return 1; |
1402 | return 1; |
1525 | } |
1403 | } |
1526 | 1404 | ||
1527 | // Maintain original order |
1405 | // Maintain original order |
1528 | return sortInput ? |
1406 | return sortInput ? |
1529 | ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : |
1407 | ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : |
1530 | 0; |
1408 | 0; |
1531 | } |
1409 | } |
1532 | 1410 | ||
1533 | return compare & 4 ? -1 : 1; |
1411 | return compare & 4 ? -1 : 1; |
1534 | } : |
- | |
1535 | function( a, b ) { |
- | |
1536 | - | ||
1537 | // Exit early if the nodes are identical |
- | |
1538 | if ( a === b ) { |
- | |
1539 | hasDuplicate = true; |
- | |
1540 | return 0; |
- | |
1541 | } |
- | |
1542 | - | ||
1543 | var cur, |
- | |
1544 | i = 0, |
- | |
1545 | aup = a.parentNode, |
- | |
1546 | bup = b.parentNode, |
- | |
1547 | ap = [ a ], |
- | |
1548 | bp = [ b ]; |
- | |
1549 | - | ||
1550 | // Parentless nodes are either documents or disconnected |
- | |
1551 | if ( !aup || !bup ) { |
- | |
1552 | - | ||
1553 | // Support: IE 11+, Edge 17 - 18+ |
- | |
1554 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
- | |
1555 | // two documents; shallow comparisons work. |
- | |
1556 | /* eslint-disable eqeqeq */ |
- | |
1557 | return a == document ? -1 : |
- | |
1558 | b == document ? 1 : |
- | |
1559 | /* eslint-enable eqeqeq */ |
- | |
1560 | aup ? -1 : |
- | |
1561 | bup ? 1 : |
- | |
1562 | sortInput ? |
- | |
1563 | ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : |
- | |
1564 | 0; |
- | |
1565 | - | ||
1566 | // If the nodes are siblings, we can do a quick check |
- | |
1567 | } else if ( aup === bup ) { |
- | |
1568 | return siblingCheck( a, b ); |
- | |
1569 | } |
- | |
1570 | - | ||
1571 | // Otherwise we need full lists of their ancestors for comparison |
- | |
1572 | cur = a; |
- | |
1573 | while ( ( cur = cur.parentNode ) ) { |
- | |
1574 | ap.unshift( cur ); |
- | |
1575 | } |
- | |
1576 | cur = b; |
- | |
1577 | while ( ( cur = cur.parentNode ) ) { |
- | |
1578 | bp.unshift( cur ); |
- | |
1579 | } |
- | |
1580 | - | ||
1581 | // Walk down the tree looking for a discrepancy |
- | |
1582 | while ( ap[ i ] === bp[ i ] ) { |
- | |
1583 | i++; |
- | |
1584 | } |
- | |
1585 | - | ||
1586 | return i ? |
- | |
1587 | - | ||
1588 | // Do a sibling check if the nodes have a common ancestor |
- | |
1589 | siblingCheck( ap[ i ], bp[ i ] ) : |
- | |
1590 | - | ||
1591 | // Otherwise nodes in our document sort first |
- | |
1592 | // Support: IE 11+, Edge 17 - 18+ |
- | |
1593 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
- | |
1594 | // two documents; shallow comparisons work. |
- | |
1595 | /* eslint-disable eqeqeq */ |
- | |
1596 | ap[ i ] == preferredDoc ? -1 : |
- | |
1597 | bp[ i ] == preferredDoc ? 1 : |
- | |
1598 | /* eslint-enable eqeqeq */ |
- | |
1599 | 0; |
- | |
1600 | }; |
1412 | }; |
1601 | 1413 | ||
1602 | return document; |
1414 | return document; |
1603 | }; |
1415 | } |
1604 | 1416 | ||
1605 | Sizzle.matches = function( expr, elements ) { |
1417 | find.matches = function( expr, elements ) { |
1606 | return Sizzle( expr, null, null, elements ); |
1418 | return find( expr, null, null, elements ); |
1607 | }; |
1419 | }; |
1608 | 1420 | ||
1609 | Sizzle.matchesSelector = function( elem, expr ) { |
1421 | find.matchesSelector = function( elem, expr ) { |
1610 | setDocument( elem ); |
1422 | setDocument( elem ); |
1611 | 1423 | ||
1612 | if ( support.matchesSelector && documentIsHTML && |
1424 | if ( documentIsHTML && |
1613 | !nonnativeSelectorCache[ expr + " " ] && |
1425 | !nonnativeSelectorCache[ expr + " " ] && |
1614 | ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && |
- | |
1615 | ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { |
1426 | ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { |
1616 | 1427 | ||
1617 | try { |
1428 | try { |
1618 | var ret = matches.call( elem, expr ); |
1429 | var ret = matches.call( elem, expr ); |
1619 | 1430 | ||
Line 1628... | Line 1439... | ||
1628 | } catch ( e ) { |
1439 | } catch ( e ) { |
1629 | nonnativeSelectorCache( expr, true ); |
1440 | nonnativeSelectorCache( expr, true ); |
1630 | } |
1441 | } |
1631 | } |
1442 | } |
1632 | 1443 | ||
1633 | return Sizzle( expr, document, null, [ elem ] ).length > 0; |
1444 | return find( expr, document, null, [ elem ] ).length > 0; |
1634 | }; |
1445 | }; |
1635 | 1446 | ||
1636 | Sizzle.contains = function( context, elem ) { |
1447 | find.contains = function( context, elem ) { |
1637 | 1448 | ||
1638 | // Set document vars if needed |
1449 | // Set document vars if needed |
1639 | // Support: IE 11+, Edge 17 - 18+ |
1450 | // Support: IE 11+, Edge 17 - 18+ |
1640 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1451 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1641 | // two documents; shallow comparisons work. |
1452 | // two documents; shallow comparisons work. |
1642 | // eslint-disable-next-line eqeqeq |
1453 | // eslint-disable-next-line eqeqeq |
1643 | if ( ( context.ownerDocument || context ) != document ) { |
1454 | if ( ( context.ownerDocument || context ) != document ) { |
1644 | setDocument( context ); |
1455 | setDocument( context ); |
1645 | } |
1456 | } |
1646 | return contains( context, elem ); |
1457 | return jQuery.contains( context, elem ); |
1647 | }; |
1458 | }; |
1648 | 1459 | ||
- | 1460 | ||
1649 | Sizzle.attr = function( elem, name ) { |
1461 | find.attr = function( elem, name ) { |
1650 | 1462 | ||
1651 | // Set document vars if needed |
1463 | // Set document vars if needed |
1652 | // Support: IE 11+, Edge 17 - 18+ |
1464 | // Support: IE 11+, Edge 17 - 18+ |
1653 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1465 | // IE/Edge sometimes throw a "Permission denied" error when strict-comparing |
1654 | // two documents; shallow comparisons work. |
1466 | // two documents; shallow comparisons work. |
Line 1657... | Line 1469... | ||
1657 | setDocument( elem ); |
1469 | setDocument( elem ); |
1658 | } |
1470 | } |
1659 | 1471 | ||
1660 | var fn = Expr.attrHandle[ name.toLowerCase() ], |
1472 | var fn = Expr.attrHandle[ name.toLowerCase() ], |
1661 | 1473 | ||
1662 | // Don't get fooled by Object.prototype properties (jQuery #13807) |
1474 | // Don't get fooled by Object.prototype properties (see trac-13807) |
1663 | val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? |
1475 | val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? |
1664 | fn( elem, name, !documentIsHTML ) : |
1476 | fn( elem, name, !documentIsHTML ) : |
1665 | undefined; |
1477 | undefined; |
1666 | 1478 | ||
1667 | return val !== undefined ? |
1479 | if ( val !== undefined ) { |
1668 | val : |
- | |
1669 | support.attributes || !documentIsHTML ? |
- | |
1670 | elem.getAttribute( name ) : |
- | |
1671 | ( val = elem.getAttributeNode( name ) ) && val.specified ? |
- | |
1672 | val.value : |
- | |
1673 | null; |
1480 | return val; |
1674 | }; |
1481 | } |
1675 | 1482 | ||
1676 | Sizzle.escape = function( sel ) { |
- | |
1677 | return ( sel + "" ).replace( rcssescape, fcssescape ); |
1483 | return elem.getAttribute( name ); |
1678 | }; |
1484 | }; |
1679 | 1485 | ||
1680 | Sizzle.error = function( msg ) { |
1486 | find.error = function( msg ) { |
1681 | throw new Error( "Syntax error, unrecognized expression: " + msg ); |
1487 | throw new Error( "Syntax error, unrecognized expression: " + msg ); |
1682 | }; |
1488 | }; |
1683 | 1489 | ||
1684 | /** |
1490 | /** |
1685 | * Document sorting and removing duplicates |
1491 | * Document sorting and removing duplicates |
1686 | * @param {ArrayLike} results |
1492 | * @param {ArrayLike} results |
1687 | */ |
1493 | */ |
1688 | Sizzle.uniqueSort = function( results ) { |
1494 | jQuery.uniqueSort = function( results ) { |
1689 | var elem, |
1495 | var elem, |
1690 | duplicates = [], |
1496 | duplicates = [], |
1691 | j = 0, |
1497 | j = 0, |
1692 | i = 0; |
1498 | i = 0; |
1693 | 1499 | ||
1694 | // Unless we *know* we can detect duplicates, assume their presence |
1500 | // Unless we *know* we can detect duplicates, assume their presence |
- | 1501 | // |
|
- | 1502 | // Support: Android <=4.0+ |
|
- | 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. |
|
1695 | hasDuplicate = !support.detectDuplicates; |
1505 | hasDuplicate = !support.sortStable; |
1696 | sortInput = !support.sortStable && results.slice( 0 ); |
1506 | sortInput = !support.sortStable && slice.call( results, 0 ); |
1697 | results.sort( sortOrder ); |
1507 | sort.call( results, sortOrder ); |
1698 | 1508 | ||
1699 | if ( hasDuplicate ) { |
1509 | if ( hasDuplicate ) { |
1700 | while ( ( elem = results[ i++ ] ) ) { |
1510 | while ( ( elem = results[ i++ ] ) ) { |
1701 | if ( elem === results[ i ] ) { |
1511 | if ( elem === results[ i ] ) { |
1702 | j = duplicates.push( i ); |
1512 | j = duplicates.push( i ); |
1703 | } |
1513 | } |
1704 | } |
1514 | } |
1705 | while ( j-- ) { |
1515 | while ( j-- ) { |
1706 | results.splice( duplicates[ j ], 1 ); |
1516 | splice.call( results, duplicates[ j ], 1 ); |
1707 | } |
1517 | } |
1708 | } |
1518 | } |
1709 | 1519 | ||
1710 | // Clear input after sorting to release objects |
1520 | // Clear input after sorting to release objects |
1711 | // See https://github.com/jquery/sizzle/pull/225 |
1521 | // See https://github.com/jquery/sizzle/pull/225 |
1712 | sortInput = null; |
1522 | sortInput = null; |
1713 | 1523 | ||
1714 | return results; |
1524 | return results; |
1715 | }; |
1525 | }; |
1716 | 1526 | ||
1717 | /** |
- | |
1718 | * Utility function for retrieving the text value of an array of DOM nodes |
- | |
1719 | * @param {Array|Element} elem |
- | |
1720 | */ |
- | |
1721 | getText = Sizzle.getText = function( elem ) { |
1527 | jQuery.fn.uniqueSort = function() { |
1722 | var node, |
- | |
1723 | ret = "", |
- | |
1724 | i = 0, |
- | |
1725 | nodeType = elem.nodeType; |
- | |
1726 | - | ||
1727 | if ( !nodeType ) { |
- | |
1728 | - | ||
1729 | // If no nodeType, this is expected to be an array |
- | |
1730 | while ( ( node = elem[ i++ ] ) ) { |
- | |
1731 | - | ||
1732 | // Do not traverse comment nodes |
- | |
1733 | ret += getText( node ); |
- | |
1734 | } |
- | |
1735 | } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { |
- | |
1736 | - | ||
1737 | // Use textContent for elements |
- | |
1738 | // innerText usage removed for consistency of new lines (jQuery #11153) |
- | |
1739 | if ( typeof elem.textContent === "string" ) { |
- | |
1740 | return elem.textContent; |
- | |
1741 | } else { |
- | |
1742 | - | ||
1743 | // Traverse its children |
- | |
1744 | for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
- | |
1745 | ret += getText( elem ); |
- | |
1746 | } |
- | |
1747 | } |
- | |
1748 | } else if ( nodeType === 3 || nodeType === 4 ) { |
- | |
1749 | return elem.nodeValue; |
- | |
1750 | } |
- | |
1751 | - | ||
1752 | // Do not include comment or processing instruction nodes |
1528 | return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) ); |
1753 | - | ||
1754 | return ret; |
- | |
1755 | }; |
1529 | }; |
1756 | 1530 | ||
1757 | Expr = Sizzle.selectors = { |
1531 | Expr = jQuery.expr = { |
1758 | 1532 | ||
1759 | // Can be adjusted by the user |
1533 | // Can be adjusted by the user |
1760 | cacheLength: 50, |
1534 | cacheLength: 50, |
1761 | 1535 | ||
1762 | createPseudo: markFunction, |
1536 | createPseudo: markFunction, |
Line 1773... | Line 1547... | ||
1773 | "+": { dir: "previousSibling", first: true }, |
1547 | "+": { dir: "previousSibling", first: true }, |
1774 | "~": { dir: "previousSibling" } |
1548 | "~": { dir: "previousSibling" } |
1775 | }, |
1549 | }, |
1776 | 1550 | ||
1777 | preFilter: { |
1551 | preFilter: { |
1778 | "ATTR": function( match ) { |
1552 | ATTR: function( match ) { |
1779 | match[ 1 ] = match[ 1 ].replace( runescape, funescape ); |
1553 | match[ 1 ] = match[ 1 ].replace( runescape, funescape ); |
1780 | 1554 | ||
1781 | // Move the given value to match[3] whether quoted or unquoted |
1555 | // Move the given value to match[3] whether quoted or unquoted |
1782 | match[ 3 ] = ( match[ 3 ] || match[ 4 ] || |
1556 | match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" ) |
1783 | match[ 5 ] || "" ).replace( runescape, funescape ); |
1557 | .replace( runescape, funescape ); |
1784 | 1558 | ||
1785 | if ( match[ 2 ] === "~=" ) { |
1559 | if ( match[ 2 ] === "~=" ) { |
1786 | match[ 3 ] = " " + match[ 3 ] + " "; |
1560 | match[ 3 ] = " " + match[ 3 ] + " "; |
1787 | } |
1561 | } |
1788 | 1562 | ||
1789 | return match.slice( 0, 4 ); |
1563 | return match.slice( 0, 4 ); |
1790 | }, |
1564 | }, |
1791 | 1565 | ||
1792 | "CHILD": function( match ) { |
1566 | CHILD: function( match ) { |
1793 | 1567 | ||
1794 | /* matches from matchExpr["CHILD"] |
1568 | /* matches from matchExpr["CHILD"] |
1795 | 1 type (only|nth|...) |
1569 | 1 type (only|nth|...) |
1796 | 2 what (child|of-type) |
1570 | 2 what (child|of-type) |
1797 | 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) |
1571 | 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) |
Line 1805... | Line 1579... | ||
1805 | 1579 | ||
1806 | if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { |
1580 | if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { |
1807 | 1581 | ||
1808 | // nth-* requires argument |
1582 | // nth-* requires argument |
1809 | if ( !match[ 3 ] ) { |
1583 | if ( !match[ 3 ] ) { |
1810 | Sizzle.error( match[ 0 ] ); |
1584 | find.error( match[ 0 ] ); |
1811 | } |
1585 | } |
1812 | 1586 | ||
1813 | // numeric x and y parameters for Expr.filter.CHILD |
1587 | // numeric x and y parameters for Expr.filter.CHILD |
1814 | // remember that false/true cast respectively to 0/1 |
1588 | // remember that false/true cast respectively to 0/1 |
1815 | match[ 4 ] = +( match[ 4 ] ? |
1589 | match[ 4 ] = +( match[ 4 ] ? |
1816 | match[ 5 ] + ( match[ 6 ] || 1 ) : |
1590 | match[ 5 ] + ( match[ 6 ] || 1 ) : |
1817 | 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) ); |
1591 | 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) |
- | 1592 | ); |
|
1818 | match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); |
1593 | match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); |
1819 | 1594 | ||
1820 | // other types prohibit arguments |
1595 | // other types prohibit arguments |
1821 | } else if ( match[ 3 ] ) { |
1596 | } else if ( match[ 3 ] ) { |
1822 | Sizzle.error( match[ 0 ] ); |
1597 | find.error( match[ 0 ] ); |
1823 | } |
1598 | } |
1824 | 1599 | ||
1825 | return match; |
1600 | return match; |
1826 | }, |
1601 | }, |
1827 | 1602 | ||
1828 | "PSEUDO": function( match ) { |
1603 | PSEUDO: function( match ) { |
1829 | var excess, |
1604 | var excess, |
1830 | unquoted = !match[ 6 ] && match[ 2 ]; |
1605 | unquoted = !match[ 6 ] && match[ 2 ]; |
1831 | 1606 | ||
1832 | if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) { |
1607 | if ( matchExpr.CHILD.test( match[ 0 ] ) ) { |
1833 | return null; |
1608 | return null; |
1834 | } |
1609 | } |
1835 | 1610 | ||
1836 | // Accept quoted arguments as-is |
1611 | // Accept quoted arguments as-is |
1837 | if ( match[ 3 ] ) { |
1612 | if ( match[ 3 ] ) { |
Line 1856... | Line 1631... | ||
1856 | } |
1631 | } |
1857 | }, |
1632 | }, |
1858 | 1633 | ||
1859 | filter: { |
1634 | filter: { |
1860 | 1635 | ||
1861 | "TAG": function( nodeNameSelector ) { |
1636 | TAG: function( nodeNameSelector ) { |
1862 | var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); |
1637 | var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); |
1863 | return nodeNameSelector === "*" ? |
1638 | return nodeNameSelector === "*" ? |
1864 | function() { |
1639 | function() { |
1865 | return true; |
1640 | return true; |
1866 | } : |
1641 | } : |
1867 | function( elem ) { |
1642 | function( elem ) { |
1868 | return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; |
1643 | return nodeName( elem, expectedNodeName ); |
1869 | }; |
1644 | }; |
1870 | }, |
1645 | }, |
1871 | 1646 | ||
1872 | "CLASS": function( className ) { |
1647 | CLASS: function( className ) { |
1873 | var pattern = classCache[ className + " " ]; |
1648 | var pattern = classCache[ className + " " ]; |
1874 | 1649 | ||
1875 | return pattern || |
1650 | return pattern || |
1876 | ( pattern = new RegExp( "(^|" + whitespace + |
1651 | ( pattern = new RegExp( "(^|" + whitespace + ")" + className + |
1877 | ")" + className + "(" + whitespace + "|$)" ) ) && classCache( |
1652 | "(" + whitespace + "|$)" ) ) && |
1878 | className, function( elem ) { |
1653 | classCache( className, function( elem ) { |
1879 | return pattern.test( |
1654 | return pattern.test( |
1880 | typeof elem.className === "string" && elem.className || |
1655 | typeof elem.className === "string" && elem.className || |
1881 | typeof elem.getAttribute !== "undefined" && |
1656 | typeof elem.getAttribute !== "undefined" && |
1882 | elem.getAttribute( "class" ) || |
1657 | elem.getAttribute( "class" ) || |
1883 | "" |
1658 | "" |
1884 | ); |
1659 | ); |
1885 | } ); |
1660 | } ); |
1886 | }, |
1661 | }, |
1887 | 1662 | ||
1888 | "ATTR": function( name, operator, check ) { |
1663 | ATTR: function( name, operator, check ) { |
1889 | return function( elem ) { |
1664 | return function( elem ) { |
1890 | var result = Sizzle.attr( elem, name ); |
1665 | var result = find.attr( elem, name ); |
1891 | 1666 | ||
1892 | if ( result == null ) { |
1667 | if ( result == null ) { |
1893 | return operator === "!="; |
1668 | return operator === "!="; |
1894 | } |
1669 | } |
1895 | if ( !operator ) { |
1670 | if ( !operator ) { |
1896 | return true; |
1671 | return true; |
1897 | } |
1672 | } |
1898 | 1673 | ||
1899 | result += ""; |
1674 | result += ""; |
1900 | 1675 | ||
- | 1676 | if ( operator === "=" ) { |
|
1901 | /* eslint-disable max-len */ |
1677 | return result === check; |
1902 | 1678 | } |
|
1903 | return operator === "=" ? result === check : |
1679 | if ( operator === "!=" ) { |
1904 | operator === "!=" ? result !== check : |
1680 | return result !== check; |
- | 1681 | } |
|
- | 1682 | if ( operator === "^=" ) { |
|
1905 | operator === "^=" ? check && result.indexOf( check ) === 0 : |
1683 | return check && result.indexOf( check ) === 0; |
- | 1684 | } |
|
- | 1685 | if ( operator === "*=" ) { |
|
1906 | operator === "*=" ? check && result.indexOf( check ) > -1 : |
1686 | return check && result.indexOf( check ) > -1; |
- | 1687 | } |
|
- | 1688 | if ( operator === "$=" ) { |
|
1907 | operator === "$=" ? check && result.slice( -check.length ) === check : |
1689 | return check && result.slice( -check.length ) === check; |
- | 1690 | } |
|
- | 1691 | if ( operator === "~=" ) { |
|
1908 | operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : |
1692 | return ( " " + result.replace( rwhitespace, " " ) + " " ) |
- | 1693 | .indexOf( check ) > -1; |
|
- | 1694 | } |
|
- | 1695 | if ( operator === "|=" ) { |
|
1909 | operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : |
1696 | return result === check || result.slice( 0, check.length + 1 ) === check + "-"; |
1910 | false; |
1697 | } |
1911 | /* eslint-enable max-len */ |
- | |
1912 | 1698 | ||
- | 1699 | return false; |
|
1913 | }; |
1700 | }; |
1914 | }, |
1701 | }, |
1915 | 1702 | ||
1916 | "CHILD": function( type, what, _argument, first, last ) { |
1703 | CHILD: function( type, what, _argument, first, last ) { |
1917 | var simple = type.slice( 0, 3 ) !== "nth", |
1704 | var simple = type.slice( 0, 3 ) !== "nth", |
1918 | forward = type.slice( -4 ) !== "last", |
1705 | forward = type.slice( -4 ) !== "last", |
1919 | ofType = what === "of-type"; |
1706 | ofType = what === "of-type"; |
1920 | 1707 | ||
1921 | return first === 1 && last === 0 ? |
1708 | return first === 1 && last === 0 ? |
Line 1924... | Line 1711... | ||
1924 | function( elem ) { |
1711 | function( elem ) { |
1925 | return !!elem.parentNode; |
1712 | return !!elem.parentNode; |
1926 | } : |
1713 | } : |
1927 | 1714 | ||
1928 | function( elem, _context, xml ) { |
1715 | function( elem, _context, xml ) { |
1929 | var cache, uniqueCache, outerCache, node, nodeIndex, start, |
1716 | var cache, outerCache, node, nodeIndex, start, |
1930 | dir = simple !== forward ? "nextSibling" : "previousSibling", |
1717 | dir = simple !== forward ? "nextSibling" : "previousSibling", |
1931 | parent = elem.parentNode, |
1718 | parent = elem.parentNode, |
1932 | name = ofType && elem.nodeName.toLowerCase(), |
1719 | name = ofType && elem.nodeName.toLowerCase(), |
1933 | useCache = !xml && !ofType, |
1720 | useCache = !xml && !ofType, |
1934 | diff = false; |
1721 | diff = false; |
Line 1939... | Line 1726... | ||
1939 | if ( simple ) { |
1726 | if ( simple ) { |
1940 | while ( dir ) { |
1727 | while ( dir ) { |
1941 | node = elem; |
1728 | node = elem; |
1942 | while ( ( node = node[ dir ] ) ) { |
1729 | while ( ( node = node[ dir ] ) ) { |
1943 | if ( ofType ? |
1730 | if ( ofType ? |
1944 | node.nodeName.toLowerCase() === name : |
1731 | nodeName( node, name ) : |
1945 | node.nodeType === 1 ) { |
1732 | node.nodeType === 1 ) { |
1946 | 1733 | ||
1947 | return false; |
1734 | return false; |
1948 | } |
1735 | } |
1949 | } |
1736 | } |
Line 1958... | Line 1745... | ||
1958 | 1745 | ||
1959 | // non-xml :nth-child(...) stores cache data on `parent` |
1746 | // non-xml :nth-child(...) stores cache data on `parent` |
1960 | if ( forward && useCache ) { |
1747 | if ( forward && useCache ) { |
1961 | 1748 | ||
1962 | // Seek `elem` from a previously-cached index |
1749 | // Seek `elem` from a previously-cached index |
1963 | - | ||
1964 | // ...in a gzip-friendly way |
- | |
1965 | node = parent; |
- | |
1966 | outerCache = node[ expando ] || ( node[ expando ] = {} ); |
1750 | outerCache = parent[ expando ] || ( parent[ expando ] = {} ); |
1967 | - | ||
1968 | // Support: IE <9 only |
- | |
1969 | // Defend against cloned attroperties (jQuery gh-1709) |
- | |
1970 | uniqueCache = outerCache[ node.uniqueID ] || |
- | |
1971 | ( outerCache[ node.uniqueID ] = {} ); |
- | |
1972 | - | ||
1973 | cache = uniqueCache[ type ] || []; |
1751 | cache = outerCache[ type ] || []; |
1974 | nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
1752 | nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
1975 | diff = nodeIndex && cache[ 2 ]; |
1753 | diff = nodeIndex && cache[ 2 ]; |
1976 | node = nodeIndex && parent.childNodes[ nodeIndex ]; |
1754 | node = nodeIndex && parent.childNodes[ nodeIndex ]; |
1977 | 1755 | ||
1978 | while ( ( node = ++nodeIndex && node && node[ dir ] || |
1756 | while ( ( node = ++nodeIndex && node && node[ dir ] || |
Line 1980... | Line 1758... | ||
1980 | // Fallback to seeking `elem` from the start |
1758 | // Fallback to seeking `elem` from the start |
1981 | ( diff = nodeIndex = 0 ) || start.pop() ) ) { |
1759 | ( diff = nodeIndex = 0 ) || start.pop() ) ) { |
1982 | 1760 | ||
1983 | // When found, cache indexes on `parent` and break |
1761 | // When found, cache indexes on `parent` and break |
1984 | if ( node.nodeType === 1 && ++diff && node === elem ) { |
1762 | if ( node.nodeType === 1 && ++diff && node === elem ) { |
1985 | uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; |
1763 | outerCache[ type ] = [ dirruns, nodeIndex, diff ]; |
1986 | break; |
1764 | break; |
1987 | } |
1765 | } |
1988 | } |
1766 | } |
1989 | 1767 | ||
1990 | } else { |
1768 | } else { |
1991 | 1769 | ||
1992 | // Use previously-cached element index if available |
1770 | // Use previously-cached element index if available |
1993 | if ( useCache ) { |
1771 | if ( useCache ) { |
1994 | - | ||
1995 | // ...in a gzip-friendly way |
- | |
1996 | node = elem; |
- | |
1997 | outerCache = node[ expando ] || ( node[ expando ] = {} ); |
1772 | outerCache = elem[ expando ] || ( elem[ expando ] = {} ); |
1998 | - | ||
1999 | // Support: IE <9 only |
- | |
2000 | // Defend against cloned attroperties (jQuery gh-1709) |
- | |
2001 | uniqueCache = outerCache[ node.uniqueID ] || |
- | |
2002 | ( outerCache[ node.uniqueID ] = {} ); |
- | |
2003 | - | ||
2004 | cache = uniqueCache[ type ] || []; |
1773 | cache = outerCache[ type ] || []; |
2005 | nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
1774 | nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; |
2006 | diff = nodeIndex; |
1775 | diff = nodeIndex; |
2007 | } |
1776 | } |
2008 | 1777 | ||
2009 | // xml :nth-child(...) |
1778 | // xml :nth-child(...) |
Line 2013... | Line 1782... | ||
2013 | // Use the same loop as above to seek `elem` from the start |
1782 | // Use the same loop as above to seek `elem` from the start |
2014 | while ( ( node = ++nodeIndex && node && node[ dir ] || |
1783 | while ( ( node = ++nodeIndex && node && node[ dir ] || |
2015 | ( diff = nodeIndex = 0 ) || start.pop() ) ) { |
1784 | ( diff = nodeIndex = 0 ) || start.pop() ) ) { |
2016 | 1785 | ||
2017 | if ( ( ofType ? |
1786 | if ( ( ofType ? |
2018 | node.nodeName.toLowerCase() === name : |
1787 | nodeName( node, name ) : |
2019 | node.nodeType === 1 ) && |
1788 | node.nodeType === 1 ) && |
2020 | ++diff ) { |
1789 | ++diff ) { |
2021 | 1790 | ||
2022 | // Cache the index of each encountered element |
1791 | // Cache the index of each encountered element |
2023 | if ( useCache ) { |
1792 | if ( useCache ) { |
2024 | outerCache = node[ expando ] || |
1793 | outerCache = node[ expando ] || |
2025 | ( node[ expando ] = {} ); |
1794 | ( node[ expando ] = {} ); |
2026 | - | ||
2027 | // Support: IE <9 only |
- | |
2028 | // Defend against cloned attroperties (jQuery gh-1709) |
- | |
2029 | uniqueCache = outerCache[ node.uniqueID ] || |
- | |
2030 | ( outerCache[ node.uniqueID ] = {} ); |
- | |
2031 | - | ||
2032 | uniqueCache[ type ] = [ dirruns, diff ]; |
1795 | outerCache[ type ] = [ dirruns, diff ]; |
2033 | } |
1796 | } |
2034 | 1797 | ||
2035 | if ( node === elem ) { |
1798 | if ( node === elem ) { |
2036 | break; |
1799 | break; |
2037 | } |
1800 | } |
Line 2045... | Line 1808... | ||
2045 | return diff === first || ( diff % first === 0 && diff / first >= 0 ); |
1808 | return diff === first || ( diff % first === 0 && diff / first >= 0 ); |
2046 | } |
1809 | } |
2047 | }; |
1810 | }; |
2048 | }, |
1811 | }, |
2049 | 1812 | ||
2050 | "PSEUDO": function( pseudo, argument ) { |
1813 | PSEUDO: function( pseudo, argument ) { |
2051 | 1814 | ||
2052 | // pseudo-class names are case-insensitive |
1815 | // pseudo-class names are case-insensitive |
2053 | // http://www.w3.org/TR/selectors/#pseudo-classes |
1816 | // https://www.w3.org/TR/selectors/#pseudo-classes |
2054 | // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters |
1817 | // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters |
2055 | // Remember that setFilters inherits from pseudos |
1818 | // Remember that setFilters inherits from pseudos |
2056 | var args, |
1819 | var args, |
2057 | fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || |
1820 | fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || |
2058 | Sizzle.error( "unsupported pseudo: " + pseudo ); |
1821 | find.error( "unsupported pseudo: " + pseudo ); |
2059 | 1822 | ||
2060 | // The user may use createPseudo to indicate that |
1823 | // The user may use createPseudo to indicate that |
2061 | // arguments are needed to create the filter function |
1824 | // arguments are needed to create the filter function |
2062 | // just as Sizzle does |
1825 | // just as jQuery does |
2063 | if ( fn[ expando ] ) { |
1826 | if ( fn[ expando ] ) { |
2064 | return fn( argument ); |
1827 | return fn( argument ); |
2065 | } |
1828 | } |
2066 | 1829 | ||
2067 | // But maintain support for old signatures |
1830 | // But maintain support for old signatures |
Line 2071... | Line 1834... | ||
2071 | markFunction( function( seed, matches ) { |
1834 | markFunction( function( seed, matches ) { |
2072 | var idx, |
1835 | var idx, |
2073 | matched = fn( seed, argument ), |
1836 | matched = fn( seed, argument ), |
2074 | i = matched.length; |
1837 | i = matched.length; |
2075 | while ( i-- ) { |
1838 | while ( i-- ) { |
2076 | idx = indexOf( seed, matched[ i ] ); |
1839 | idx = indexOf.call( seed, matched[ i ] ); |
2077 | seed[ idx ] = !( matches[ idx ] = matched[ i ] ); |
1840 | seed[ idx ] = !( matches[ idx ] = matched[ i ] ); |
2078 | } |
1841 | } |
2079 | } ) : |
1842 | } ) : |
2080 | function( elem ) { |
1843 | function( elem ) { |
2081 | return fn( elem, 0, args ); |
1844 | return fn( elem, 0, args ); |
Line 2087... | Line 1850... | ||
2087 | }, |
1850 | }, |
2088 | 1851 | ||
2089 | pseudos: { |
1852 | pseudos: { |
2090 | 1853 | ||
2091 | // Potentially complex pseudos |
1854 | // Potentially complex pseudos |
2092 | "not": markFunction( function( selector ) { |
1855 | not: markFunction( function( selector ) { |
2093 | 1856 | ||
2094 | // Trim the selector passed to compile |
1857 | // Trim the selector passed to compile |
2095 | // to avoid treating leading and trailing |
1858 | // to avoid treating leading and trailing |
2096 | // spaces as combinators |
1859 | // spaces as combinators |
2097 | var input = [], |
1860 | var input = [], |
2098 | results = [], |
1861 | results = [], |
2099 | matcher = compile( selector.replace( rtrim, "$1" ) ); |
1862 | matcher = compile( selector.replace( rtrimCSS, "$1" ) ); |
2100 | 1863 | ||
2101 | return matcher[ expando ] ? |
1864 | return matcher[ expando ] ? |
2102 | markFunction( function( seed, matches, _context, xml ) { |
1865 | markFunction( function( seed, matches, _context, xml ) { |
2103 | var elem, |
1866 | var elem, |
2104 | unmatched = matcher( seed, null, xml, [] ), |
1867 | unmatched = matcher( seed, null, xml, [] ), |
Line 2113... | Line 1876... | ||
2113 | } ) : |
1876 | } ) : |
2114 | function( elem, _context, xml ) { |
1877 | function( elem, _context, xml ) { |
2115 | input[ 0 ] = elem; |
1878 | input[ 0 ] = elem; |
2116 | matcher( input, null, xml, results ); |
1879 | matcher( input, null, xml, results ); |
2117 | 1880 | ||
2118 | // Don't keep the element (issue #299) |
1881 | // Don't keep the element |
- | 1882 | // (see https://github.com/jquery/sizzle/issues/299) |
|
2119 | input[ 0 ] = null; |
1883 | input[ 0 ] = null; |
2120 | return !results.pop(); |
1884 | return !results.pop(); |
2121 | }; |
1885 | }; |
2122 | } ), |
1886 | } ), |
2123 | 1887 | ||
2124 | "has": markFunction( function( selector ) { |
1888 | has: markFunction( function( selector ) { |
2125 | return function( elem ) { |
1889 | return function( elem ) { |
2126 | return Sizzle( selector, elem ).length > 0; |
1890 | return find( selector, elem ).length > 0; |
2127 | }; |
1891 | }; |
2128 | } ), |
1892 | } ), |
2129 | 1893 | ||
2130 | "contains": markFunction( function( text ) { |
1894 | contains: markFunction( function( text ) { |
2131 | text = text.replace( runescape, funescape ); |
1895 | text = text.replace( runescape, funescape ); |
2132 | return function( elem ) { |
1896 | return function( elem ) { |
2133 | return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; |
1897 | return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1; |
2134 | }; |
1898 | }; |
2135 | } ), |
1899 | } ), |
2136 | 1900 | ||
2137 | // "Whether an element is represented by a :lang() selector |
1901 | // "Whether an element is represented by a :lang() selector |
2138 | // is based solely on the element's language value |
1902 | // is based solely on the element's language value |
2139 | // being equal to the identifier C, |
1903 | // being equal to the identifier C, |
2140 | // or beginning with the identifier C immediately followed by "-". |
1904 | // or beginning with the identifier C immediately followed by "-". |
2141 | // The matching of C against the element's language value is performed case-insensitively. |
1905 | // The matching of C against the element's language value is performed case-insensitively. |
2142 | // The identifier C does not have to be a valid language name." |
1906 | // The identifier C does not have to be a valid language name." |
2143 | // http://www.w3.org/TR/selectors/#lang-pseudo |
1907 | // https://www.w3.org/TR/selectors/#lang-pseudo |
2144 | "lang": markFunction( function( lang ) { |
1908 | lang: markFunction( function( lang ) { |
2145 | 1909 | ||
2146 | // lang value must be a valid identifier |
1910 | // lang value must be a valid identifier |
2147 | if ( !ridentifier.test( lang || "" ) ) { |
1911 | if ( !ridentifier.test( lang || "" ) ) { |
2148 | Sizzle.error( "unsupported lang: " + lang ); |
1912 | find.error( "unsupported lang: " + lang ); |
2149 | } |
1913 | } |
2150 | lang = lang.replace( runescape, funescape ).toLowerCase(); |
1914 | lang = lang.replace( runescape, funescape ).toLowerCase(); |
2151 | return function( elem ) { |
1915 | return function( elem ) { |
2152 | var elemLang; |
1916 | var elemLang; |
2153 | do { |
1917 | do { |
Line 2162... | Line 1926... | ||
2162 | return false; |
1926 | return false; |
2163 | }; |
1927 | }; |
2164 | } ), |
1928 | } ), |
2165 | 1929 | ||
2166 | // Miscellaneous |
1930 | // Miscellaneous |
2167 | "target": function( elem ) { |
1931 | target: function( elem ) { |
2168 | var hash = window.location && window.location.hash; |
1932 | var hash = window.location && window.location.hash; |
2169 | return hash && hash.slice( 1 ) === elem.id; |
1933 | return hash && hash.slice( 1 ) === elem.id; |
2170 | }, |
1934 | }, |
2171 | 1935 | ||
2172 | "root": function( elem ) { |
1936 | root: function( elem ) { |
2173 | return elem === docElem; |
1937 | return elem === documentElement; |
2174 | }, |
1938 | }, |
2175 | 1939 | ||
2176 | "focus": function( elem ) { |
1940 | focus: function( elem ) { |
2177 | return elem === document.activeElement && |
1941 | return elem === safeActiveElement() && |
2178 | ( !document.hasFocus || document.hasFocus() ) && |
1942 | document.hasFocus() && |
2179 | !!( elem.type || elem.href || ~elem.tabIndex ); |
1943 | !!( elem.type || elem.href || ~elem.tabIndex ); |
2180 | }, |
1944 | }, |
2181 | 1945 | ||
2182 | // Boolean properties |
1946 | // Boolean properties |
2183 | "enabled": createDisabledPseudo( false ), |
1947 | enabled: createDisabledPseudo( false ), |
2184 | "disabled": createDisabledPseudo( true ), |
1948 | disabled: createDisabledPseudo( true ), |
2185 | 1949 | ||
2186 | "checked": function( elem ) { |
1950 | checked: function( elem ) { |
2187 | 1951 | ||
2188 | // In CSS3, :checked should return both checked and selected elements |
1952 | // In CSS3, :checked should return both checked and selected elements |
2189 | // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
1953 | // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
2190 | var nodeName = elem.nodeName.toLowerCase(); |
- | |
2191 | return ( nodeName === "input" && !!elem.checked ) || |
1954 | return ( nodeName( elem, "input" ) && !!elem.checked ) || |
2192 | ( nodeName === "option" && !!elem.selected ); |
1955 | ( nodeName( elem, "option" ) && !!elem.selected ); |
2193 | }, |
1956 | }, |
2194 | 1957 | ||
2195 | "selected": function( elem ) { |
1958 | selected: function( elem ) { |
2196 | 1959 | ||
- | 1960 | // Support: IE <=11+ |
|
2197 | // Accessing this property makes selected-by-default |
1961 | // Accessing the selectedIndex property |
- | 1962 | // forces the browser to treat the default option as |
|
2198 | // options in Safari work properly |
1963 | // selected when in an optgroup. |
2199 | if ( elem.parentNode ) { |
1964 | if ( elem.parentNode ) { |
2200 | // eslint-disable-next-line no-unused-expressions |
1965 | // eslint-disable-next-line no-unused-expressions |
2201 | elem.parentNode.selectedIndex; |
1966 | elem.parentNode.selectedIndex; |
2202 | } |
1967 | } |
2203 | 1968 | ||
2204 | return elem.selected === true; |
1969 | return elem.selected === true; |
2205 | }, |
1970 | }, |
2206 | 1971 | ||
2207 | // Contents |
1972 | // Contents |
2208 | "empty": function( elem ) { |
1973 | empty: function( elem ) { |
2209 | 1974 | ||
2210 | // http://www.w3.org/TR/selectors/#empty-pseudo |
1975 | // https://www.w3.org/TR/selectors/#empty-pseudo |
2211 | // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), |
1976 | // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), |
2212 | // but not by others (comment: 8; processing instruction: 7; etc.) |
1977 | // but not by others (comment: 8; processing instruction: 7; etc.) |
2213 | // nodeType < 6 works because attributes (2) do not appear as children |
1978 | // nodeType < 6 works because attributes (2) do not appear as children |
2214 | for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
1979 | for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
2215 | if ( elem.nodeType < 6 ) { |
1980 | if ( elem.nodeType < 6 ) { |
Line 2217... | Line 1982... | ||
2217 | } |
1982 | } |
2218 | } |
1983 | } |
2219 | return true; |
1984 | return true; |
2220 | }, |
1985 | }, |
2221 | 1986 | ||
2222 | "parent": function( elem ) { |
1987 | parent: function( elem ) { |
2223 | return !Expr.pseudos[ "empty" ]( elem ); |
1988 | return !Expr.pseudos.empty( elem ); |
2224 | }, |
1989 | }, |
2225 | 1990 | ||
2226 | // Element/input types |
1991 | // Element/input types |
2227 | "header": function( elem ) { |
1992 | header: function( elem ) { |
2228 | return rheader.test( elem.nodeName ); |
1993 | return rheader.test( elem.nodeName ); |
2229 | }, |
1994 | }, |
2230 | 1995 | ||
2231 | "input": function( elem ) { |
1996 | input: function( elem ) { |
2232 | return rinputs.test( elem.nodeName ); |
1997 | return rinputs.test( elem.nodeName ); |
2233 | }, |
1998 | }, |
2234 | 1999 | ||
2235 | "button": function( elem ) { |
2000 | button: function( elem ) { |
2236 | var name = elem.nodeName.toLowerCase(); |
2001 | return nodeName( elem, "input" ) && elem.type === "button" || |
2237 | return name === "input" && elem.type === "button" || name === "button"; |
2002 | nodeName( elem, "button" ); |
2238 | }, |
2003 | }, |
2239 | 2004 | ||
2240 | "text": function( elem ) { |
2005 | text: function( elem ) { |
2241 | var attr; |
2006 | var attr; |
2242 | return elem.nodeName.toLowerCase() === "input" && |
2007 | return nodeName( elem, "input" ) && elem.type === "text" && |
2243 | elem.type === "text" && |
- | |
2244 | 2008 | ||
2245 | // Support: IE<8 |
2009 | // Support: IE <10 only |
2246 | // 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" |
|
2247 | ( ( attr = elem.getAttribute( "type" ) ) == null || |
2012 | ( ( attr = elem.getAttribute( "type" ) ) == null || |
2248 | attr.toLowerCase() === "text" ); |
2013 | attr.toLowerCase() === "text" ); |
2249 | }, |
2014 | }, |
2250 | 2015 | ||
2251 | // Position-in-collection |
2016 | // Position-in-collection |
2252 | "first": createPositionalPseudo( function() { |
2017 | first: createPositionalPseudo( function() { |
2253 | return [ 0 ]; |
2018 | return [ 0 ]; |
2254 | } ), |
2019 | } ), |
2255 | 2020 | ||
2256 | "last": createPositionalPseudo( function( _matchIndexes, length ) { |
2021 | last: createPositionalPseudo( function( _matchIndexes, length ) { |
2257 | return [ length - 1 ]; |
2022 | return [ length - 1 ]; |
2258 | } ), |
2023 | } ), |
2259 | 2024 | ||
2260 | "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) { |
2025 | eq: createPositionalPseudo( function( _matchIndexes, length, argument ) { |
2261 | return [ argument < 0 ? argument + length : argument ]; |
2026 | return [ argument < 0 ? argument + length : argument ]; |
2262 | } ), |
2027 | } ), |
2263 | 2028 | ||
2264 | "even": createPositionalPseudo( function( matchIndexes, length ) { |
2029 | even: createPositionalPseudo( function( matchIndexes, length ) { |
2265 | var i = 0; |
2030 | var i = 0; |
2266 | for ( ; i < length; i += 2 ) { |
2031 | for ( ; i < length; i += 2 ) { |
2267 | matchIndexes.push( i ); |
2032 | matchIndexes.push( i ); |
2268 | } |
2033 | } |
2269 | return matchIndexes; |
2034 | return matchIndexes; |
2270 | } ), |
2035 | } ), |
2271 | 2036 | ||
2272 | "odd": createPositionalPseudo( function( matchIndexes, length ) { |
2037 | odd: createPositionalPseudo( function( matchIndexes, length ) { |
2273 | var i = 1; |
2038 | var i = 1; |
2274 | for ( ; i < length; i += 2 ) { |
2039 | for ( ; i < length; i += 2 ) { |
2275 | matchIndexes.push( i ); |
2040 | matchIndexes.push( i ); |
2276 | } |
2041 | } |
2277 | return matchIndexes; |
2042 | return matchIndexes; |
2278 | } ), |
2043 | } ), |
2279 | 2044 | ||
2280 | "lt": createPositionalPseudo( function( matchIndexes, length, argument ) { |
2045 | lt: createPositionalPseudo( function( matchIndexes, length, argument ) { |
- | 2046 | var i; |
|
- | 2047 | ||
2281 | var i = argument < 0 ? |
2048 | if ( argument < 0 ) { |
2282 | argument + length : |
2049 | i = argument + length; |
2283 | argument > length ? |
2050 | } else if ( argument > length ) { |
2284 | length : |
2051 | i = length; |
- | 2052 | } else { |
|
2285 | argument; |
2053 | i = argument; |
- | 2054 | } |
|
- | 2055 | ||
2286 | for ( ; --i >= 0; ) { |
2056 | for ( ; --i >= 0; ) { |
2287 | matchIndexes.push( i ); |
2057 | matchIndexes.push( i ); |
2288 | } |
2058 | } |
2289 | return matchIndexes; |
2059 | return matchIndexes; |
2290 | } ), |
2060 | } ), |
2291 | 2061 | ||
2292 | "gt": createPositionalPseudo( function( matchIndexes, length, argument ) { |
2062 | gt: createPositionalPseudo( function( matchIndexes, length, argument ) { |
2293 | var i = argument < 0 ? argument + length : argument; |
2063 | var i = argument < 0 ? argument + length : argument; |
2294 | for ( ; ++i < length; ) { |
2064 | for ( ; ++i < length; ) { |
2295 | matchIndexes.push( i ); |
2065 | matchIndexes.push( i ); |
2296 | } |
2066 | } |
2297 | return matchIndexes; |
2067 | return matchIndexes; |
2298 | } ) |
2068 | } ) |
2299 | } |
2069 | } |
2300 | }; |
2070 | }; |
2301 | 2071 | ||
2302 | Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ]; |
2072 | Expr.pseudos.nth = Expr.pseudos.eq; |
2303 | 2073 | ||
2304 | // Add button/input type pseudos |
2074 | // Add button/input type pseudos |
2305 | for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { |
2075 | for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { |
2306 | Expr.pseudos[ i ] = createInputPseudo( i ); |
2076 | Expr.pseudos[ i ] = createInputPseudo( i ); |
2307 | } |
2077 | } |
Line 2312... | Line 2082... | ||
2312 | // Easy API for creating new setFilters |
2082 | // Easy API for creating new setFilters |
2313 | function setFilters() {} |
2083 | function setFilters() {} |
2314 | setFilters.prototype = Expr.filters = Expr.pseudos; |
2084 | setFilters.prototype = Expr.filters = Expr.pseudos; |
2315 | Expr.setFilters = new setFilters(); |
2085 | Expr.setFilters = new setFilters(); |
2316 | 2086 | ||
2317 | tokenize = Sizzle.tokenize = function( selector, parseOnly ) { |
2087 | function tokenize( selector, parseOnly ) { |
2318 | var matched, match, tokens, type, |
2088 | var matched, match, tokens, type, |
2319 | soFar, groups, preFilters, |
2089 | soFar, groups, preFilters, |
2320 | cached = tokenCache[ selector + " " ]; |
2090 | cached = tokenCache[ selector + " " ]; |
2321 | 2091 | ||
2322 | if ( cached ) { |
2092 | if ( cached ) { |
Line 2340... | Line 2110... | ||
2340 | } |
2110 | } |
2341 | 2111 | ||
2342 | matched = false; |
2112 | matched = false; |
2343 | 2113 | ||
2344 | // Combinators |
2114 | // Combinators |
2345 | if ( ( match = rcombinators.exec( soFar ) ) ) { |
2115 | if ( ( match = rleadingCombinator.exec( soFar ) ) ) { |
2346 | matched = match.shift(); |
2116 | matched = match.shift(); |
2347 | tokens.push( { |
2117 | tokens.push( { |
2348 | value: matched, |
2118 | value: matched, |
2349 | 2119 | ||
2350 | // Cast descendant combinators to space |
2120 | // Cast descendant combinators to space |
2351 | type: match[ 0 ].replace( rtrim, " " ) |
2121 | type: match[ 0 ].replace( rtrimCSS, " " ) |
2352 | } ); |
2122 | } ); |
2353 | soFar = soFar.slice( matched.length ); |
2123 | soFar = soFar.slice( matched.length ); |
2354 | } |
2124 | } |
2355 | 2125 | ||
2356 | // Filters |
2126 | // Filters |
Line 2373... | Line 2143... | ||
2373 | } |
2143 | } |
2374 | 2144 | ||
2375 | // Return the length of the invalid excess |
2145 | // Return the length of the invalid excess |
2376 | // if we're just parsing |
2146 | // if we're just parsing |
2377 | // Otherwise, throw an error or return tokens |
2147 | // Otherwise, throw an error or return tokens |
2378 | return parseOnly ? |
2148 | if ( parseOnly ) { |
2379 | soFar.length : |
2149 | return soFar.length; |
- | 2150 | } |
|
- | 2151 | ||
2380 | soFar ? |
2152 | return soFar ? |
2381 | Sizzle.error( selector ) : |
2153 | find.error( selector ) : |
2382 | 2154 | ||
2383 | // Cache the tokens |
2155 | // Cache the tokens |
2384 | tokenCache( selector, groups ).slice( 0 ); |
2156 | tokenCache( selector, groups ).slice( 0 ); |
2385 | }; |
2157 | } |
2386 | 2158 | ||
2387 | function toSelector( tokens ) { |
2159 | function toSelector( tokens ) { |
2388 | var i = 0, |
2160 | var i = 0, |
2389 | len = tokens.length, |
2161 | len = tokens.length, |
2390 | selector = ""; |
2162 | selector = ""; |
Line 2413... | Line 2185... | ||
2413 | return false; |
2185 | return false; |
2414 | } : |
2186 | } : |
2415 | 2187 | ||
2416 | // Check against all ancestor/preceding elements |
2188 | // Check against all ancestor/preceding elements |
2417 | function( elem, context, xml ) { |
2189 | function( elem, context, xml ) { |
2418 | var oldCache, uniqueCache, outerCache, |
2190 | var oldCache, outerCache, |
2419 | newCache = [ dirruns, doneName ]; |
2191 | newCache = [ dirruns, doneName ]; |
2420 | 2192 | ||
2421 | // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching |
2193 | // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching |
2422 | if ( xml ) { |
2194 | if ( xml ) { |
2423 | while ( ( elem = elem[ dir ] ) ) { |
2195 | while ( ( elem = elem[ dir ] ) ) { |
Line 2430... | Line 2202... | ||
2430 | } else { |
2202 | } else { |
2431 | while ( ( elem = elem[ dir ] ) ) { |
2203 | while ( ( elem = elem[ dir ] ) ) { |
2432 | if ( elem.nodeType === 1 || checkNonElements ) { |
2204 | if ( elem.nodeType === 1 || checkNonElements ) { |
2433 | outerCache = elem[ expando ] || ( elem[ expando ] = {} ); |
2205 | outerCache = elem[ expando ] || ( elem[ expando ] = {} ); |
2434 | 2206 | ||
2435 | // Support: IE <9 only |
- | |
2436 | // Defend against cloned attroperties (jQuery gh-1709) |
- | |
2437 | uniqueCache = outerCache[ elem.uniqueID ] || |
- | |
2438 | ( outerCache[ elem.uniqueID ] = {} ); |
- | |
2439 | - | ||
2440 | if ( skip && skip === elem.nodeName.toLowerCase() ) { |
2207 | if ( skip && nodeName( elem, skip ) ) { |
2441 | elem = elem[ dir ] || elem; |
2208 | elem = elem[ dir ] || elem; |
2442 | } else if ( ( oldCache = uniqueCache[ key ] ) && |
2209 | } else if ( ( oldCache = outerCache[ key ] ) && |
2443 | oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { |
2210 | oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { |
2444 | 2211 | ||
2445 | // Assign to newCache so results back-propagate to previous elements |
2212 | // Assign to newCache so results back-propagate to previous elements |
2446 | return ( newCache[ 2 ] = oldCache[ 2 ] ); |
2213 | return ( newCache[ 2 ] = oldCache[ 2 ] ); |
2447 | } else { |
2214 | } else { |
2448 | 2215 | ||
2449 | // Reuse newcache so results back-propagate to previous elements |
2216 | // Reuse newcache so results back-propagate to previous elements |
2450 | uniqueCache[ key ] = newCache; |
2217 | outerCache[ key ] = newCache; |
2451 | 2218 | ||
2452 | // A match means we're done; a fail means we have to keep checking |
2219 | // A match means we're done; a fail means we have to keep checking |
2453 | if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { |
2220 | if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { |
2454 | return true; |
2221 | return true; |
2455 | } |
2222 | } |
Line 2477... | Line 2244... | ||
2477 | 2244 | ||
2478 | function multipleContexts( selector, contexts, results ) { |
2245 | function multipleContexts( selector, contexts, results ) { |
2479 | var i = 0, |
2246 | var i = 0, |
2480 | len = contexts.length; |
2247 | len = contexts.length; |
2481 | for ( ; i < len; i++ ) { |
2248 | for ( ; i < len; i++ ) { |
2482 | Sizzle( selector, contexts[ i ], results ); |
2249 | find( selector, contexts[ i ], results ); |
2483 | } |
2250 | } |
2484 | return results; |
2251 | return results; |
2485 | } |
2252 | } |
2486 | 2253 | ||
2487 | function condense( unmatched, map, filter, context, xml ) { |
2254 | function condense( unmatched, map, filter, context, xml ) { |
Line 2511... | Line 2278... | ||
2511 | } |
2278 | } |
2512 | if ( postFinder && !postFinder[ expando ] ) { |
2279 | if ( postFinder && !postFinder[ expando ] ) { |
2513 | postFinder = setMatcher( postFinder, postSelector ); |
2280 | postFinder = setMatcher( postFinder, postSelector ); |
2514 | } |
2281 | } |
2515 | return markFunction( function( seed, results, context, xml ) { |
2282 | return markFunction( function( seed, results, context, xml ) { |
2516 | var temp, i, elem, |
2283 | var temp, i, elem, matcherOut, |
2517 | preMap = [], |
2284 | preMap = [], |
2518 | postMap = [], |
2285 | postMap = [], |
2519 | preexisting = results.length, |
2286 | preexisting = results.length, |
2520 | 2287 | ||
2521 | // Get initial elements from seed or context |
2288 | // Get initial elements from seed or context |
2522 | elems = seed || multipleContexts( |
2289 | elems = seed || |
2523 | selector || "*", |
2290 | multipleContexts( selector || "*", |
2524 | context.nodeType ? [ context ] : context, |
2291 | context.nodeType ? [ context ] : context, [] ), |
2525 | [] |
- | |
2526 | ), |
- | |
2527 | 2292 | ||
2528 | // Prefilter to get matcher input, preserving a map for seed-results synchronization |
2293 | // Prefilter to get matcher input, preserving a map for seed-results synchronization |
2529 | matcherIn = preFilter && ( seed || !selector ) ? |
2294 | matcherIn = preFilter && ( seed || !selector ) ? |
2530 | condense( elems, preMap, preFilter, context, xml ) : |
2295 | condense( elems, preMap, preFilter, context, xml ) : |
2531 | elems, |
2296 | elems; |
2532 | 2297 | ||
2533 | matcherOut = matcher ? |
2298 | if ( matcher ) { |
2534 | 2299 | ||
2535 | // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, |
2300 | // If we have a postFinder, or filtered seed, or non-seed postFilter |
- | 2301 | // or preexisting results, |
|
2536 | postFinder || ( seed ? preFilter : preexisting || postFilter ) ? |
2302 | matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ? |
2537 | 2303 | ||
2538 | // ...intermediate processing is necessary |
2304 | // ...intermediate processing is necessary |
2539 | [] : |
2305 | [] : |
2540 | 2306 | ||
2541 | // ...otherwise use results directly |
2307 | // ...otherwise use results directly |
2542 | results : |
2308 | results; |
2543 | matcherIn; |
- | |
2544 | 2309 | ||
2545 | // Find primary matches |
2310 | // Find primary matches |
2546 | if ( matcher ) { |
- | |
2547 | matcher( matcherIn, matcherOut, context, xml ); |
2311 | matcher( matcherIn, matcherOut, context, xml ); |
- | 2312 | } else { |
|
- | 2313 | matcherOut = matcherIn; |
|
2548 | } |
2314 | } |
2549 | 2315 | ||
2550 | // Apply postFilter |
2316 | // Apply postFilter |
2551 | if ( postFilter ) { |
2317 | if ( postFilter ) { |
2552 | temp = condense( matcherOut, postMap ); |
2318 | temp = condense( matcherOut, postMap ); |
Line 2580... | Line 2346... | ||
2580 | 2346 | ||
2581 | // Move matched elements from seed to results to keep them synchronized |
2347 | // Move matched elements from seed to results to keep them synchronized |
2582 | i = matcherOut.length; |
2348 | i = matcherOut.length; |
2583 | while ( i-- ) { |
2349 | while ( i-- ) { |
2584 | if ( ( elem = matcherOut[ i ] ) && |
2350 | if ( ( elem = matcherOut[ i ] ) && |
2585 | ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) { |
2351 | ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) { |
2586 | 2352 | ||
2587 | seed[ temp ] = !( results[ temp ] = elem ); |
2353 | seed[ temp ] = !( results[ temp ] = elem ); |
2588 | } |
2354 | } |
2589 | } |
2355 | } |
2590 | } |
2356 | } |
Line 2615... | Line 2381... | ||
2615 | // The foundational matcher ensures that elements are reachable from top-level context(s) |
2381 | // The foundational matcher ensures that elements are reachable from top-level context(s) |
2616 | matchContext = addCombinator( function( elem ) { |
2382 | matchContext = addCombinator( function( elem ) { |
2617 | return elem === checkContext; |
2383 | return elem === checkContext; |
2618 | }, implicitRelative, true ), |
2384 | }, implicitRelative, true ), |
2619 | matchAnyContext = addCombinator( function( elem ) { |
2385 | matchAnyContext = addCombinator( function( elem ) { |
2620 | return indexOf( checkContext, elem ) > -1; |
2386 | return indexOf.call( checkContext, elem ) > -1; |
2621 | }, implicitRelative, true ), |
2387 | }, implicitRelative, true ), |
2622 | matchers = [ function( elem, context, xml ) { |
2388 | matchers = [ function( elem, context, xml ) { |
- | 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 |
|
2623 | var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( |
2394 | var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || ( |
2624 | ( checkContext = context ).nodeType ? |
2395 | ( checkContext = context ).nodeType ? |
2625 | matchContext( elem, context, xml ) : |
2396 | matchContext( elem, context, xml ) : |
2626 | matchAnyContext( elem, context, xml ) ); |
2397 | matchAnyContext( elem, context, xml ) ); |
2627 | 2398 | ||
2628 | // Avoid hanging onto element (issue #299) |
2399 | // Avoid hanging onto element |
- | 2400 | // (see https://github.com/jquery/sizzle/issues/299) |
|
2629 | checkContext = null; |
2401 | checkContext = null; |
2630 | return ret; |
2402 | return ret; |
2631 | } ]; |
2403 | } ]; |
2632 | 2404 | ||
2633 | for ( ; i < len; i++ ) { |
2405 | for ( ; i < len; i++ ) { |
Line 2649... | Line 2421... | ||
2649 | return setMatcher( |
2421 | return setMatcher( |
2650 | i > 1 && elementMatcher( matchers ), |
2422 | i > 1 && elementMatcher( matchers ), |
2651 | i > 1 && toSelector( |
2423 | i > 1 && toSelector( |
2652 | 2424 | ||
2653 | // If the preceding token was a descendant combinator, insert an implicit any-element `*` |
2425 | // If the preceding token was a descendant combinator, insert an implicit any-element `*` |
2654 | tokens |
- | |
2655 | .slice( 0, i - 1 ) |
2426 | tokens.slice( 0, i - 1 ) |
2656 | .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) |
2427 | .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) |
2657 | ).replace( rtrim, "$1" ), |
2428 | ).replace( rtrimCSS, "$1" ), |
2658 | matcher, |
2429 | matcher, |
2659 | i < j && matcherFromTokens( tokens.slice( i, j ) ), |
2430 | i < j && matcherFromTokens( tokens.slice( i, j ) ), |
2660 | j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), |
2431 | j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), |
2661 | j < len && toSelector( tokens ) |
2432 | j < len && toSelector( tokens ) |
2662 | ); |
2433 | ); |
Line 2678... | Line 2449... | ||
2678 | unmatched = seed && [], |
2449 | unmatched = seed && [], |
2679 | setMatched = [], |
2450 | setMatched = [], |
2680 | contextBackup = outermostContext, |
2451 | contextBackup = outermostContext, |
2681 | 2452 | ||
2682 | // We must always have either seed elements or outermost context |
2453 | // We must always have either seed elements or outermost context |
2683 | elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ), |
2454 | elems = seed || byElement && Expr.find.TAG( "*", outermost ), |
2684 | 2455 | ||
2685 | // Use integer dirruns iff this is the outermost matcher |
2456 | // Use integer dirruns iff this is the outermost matcher |
2686 | dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), |
2457 | dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), |
2687 | len = elems.length; |
2458 | len = elems.length; |
2688 | 2459 | ||
Line 2694... | Line 2465... | ||
2694 | // eslint-disable-next-line eqeqeq |
2465 | // eslint-disable-next-line eqeqeq |
2695 | outermostContext = context == document || context || outermost; |
2466 | outermostContext = context == document || context || outermost; |
2696 | } |
2467 | } |
2697 | 2468 | ||
2698 | // Add elements passing elementMatchers directly to results |
2469 | // Add elements passing elementMatchers directly to results |
2699 | // Support: IE<9, Safari |
2470 | // Support: iOS <=7 - 9 only |
2700 | // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id |
2471 | // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching |
- | 2472 | // elements by id. (see trac-14142) |
|
2701 | for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { |
2473 | for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { |
2702 | if ( byElement && elem ) { |
2474 | if ( byElement && elem ) { |
2703 | j = 0; |
2475 | j = 0; |
2704 | 2476 | ||
2705 | // Support: IE 11+, Edge 17 - 18+ |
2477 | // Support: IE 11+, Edge 17 - 18+ |
Line 2710... | Line 2482... | ||
2710 | setDocument( elem ); |
2482 | setDocument( elem ); |
2711 | xml = !documentIsHTML; |
2483 | xml = !documentIsHTML; |
2712 | } |
2484 | } |
2713 | while ( ( matcher = elementMatchers[ j++ ] ) ) { |
2485 | while ( ( matcher = elementMatchers[ j++ ] ) ) { |
2714 | if ( matcher( elem, context || document, xml ) ) { |
2486 | if ( matcher( elem, context || document, xml ) ) { |
2715 | results.push( elem ); |
2487 | push.call( results, elem ); |
2716 | break; |
2488 | break; |
2717 | } |
2489 | } |
2718 | } |
2490 | } |
2719 | if ( outermost ) { |
2491 | if ( outermost ) { |
2720 | dirruns = dirrunsUnique; |
2492 | dirruns = dirrunsUnique; |
Line 2773... | Line 2545... | ||
2773 | 2545 | ||
2774 | // Seedless set matches succeeding multiple successful matchers stipulate sorting |
2546 | // Seedless set matches succeeding multiple successful matchers stipulate sorting |
2775 | if ( outermost && !seed && setMatched.length > 0 && |
2547 | if ( outermost && !seed && setMatched.length > 0 && |
2776 | ( matchedCount + setMatchers.length ) > 1 ) { |
2548 | ( matchedCount + setMatchers.length ) > 1 ) { |
2777 | 2549 | ||
2778 | Sizzle.uniqueSort( results ); |
2550 | jQuery.uniqueSort( results ); |
2779 | } |
2551 | } |
2780 | } |
2552 | } |
2781 | 2553 | ||
2782 | // Override manipulation of globals by nested matchers |
2554 | // Override manipulation of globals by nested matchers |
2783 | if ( outermost ) { |
2555 | if ( outermost ) { |
Line 2791... | Line 2563... | ||
2791 | return bySet ? |
2563 | return bySet ? |
2792 | markFunction( superMatcher ) : |
2564 | markFunction( superMatcher ) : |
2793 | superMatcher; |
2565 | superMatcher; |
2794 | } |
2566 | } |
2795 | 2567 | ||
2796 | compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { |
2568 | function compile( selector, match /* Internal Use Only */ ) { |
2797 | var i, |
2569 | var i, |
2798 | setMatchers = [], |
2570 | setMatchers = [], |
2799 | elementMatchers = [], |
2571 | elementMatchers = [], |
2800 | cached = compilerCache[ selector + " " ]; |
2572 | cached = compilerCache[ selector + " " ]; |
2801 | 2573 | ||
Line 2814... | Line 2586... | ||
2814 | elementMatchers.push( cached ); |
2586 | elementMatchers.push( cached ); |
2815 | } |
2587 | } |
2816 | } |
2588 | } |
2817 | 2589 | ||
2818 | // Cache the compiled function |
2590 | // Cache the compiled function |
2819 | cached = compilerCache( |
2591 | cached = compilerCache( selector, |
2820 | selector, |
- | |
2821 | matcherFromGroupMatchers( elementMatchers, setMatchers ) |
2592 | matcherFromGroupMatchers( elementMatchers, setMatchers ) ); |
2822 | ); |
- | |
2823 | 2593 | ||
2824 | // Save selector and tokenization |
2594 | // Save selector and tokenization |
2825 | cached.selector = selector; |
2595 | cached.selector = selector; |
2826 | } |
2596 | } |
2827 | return cached; |
2597 | return cached; |
2828 | }; |
2598 | } |
2829 | 2599 | ||
2830 | /** |
2600 | /** |
2831 | * A low-level selection function that works with Sizzle's compiled |
2601 | * A low-level selection function that works with jQuery's compiled |
2832 | * selector functions |
2602 | * selector functions |
2833 | * @param {String|Function} selector A selector or a pre-compiled |
2603 | * @param {String|Function} selector A selector or a pre-compiled |
2834 | * selector function built with Sizzle.compile |
2604 | * selector function built with jQuery selector compile |
2835 | * @param {Element} context |
2605 | * @param {Element} context |
2836 | * @param {Array} [results] |
2606 | * @param {Array} [results] |
2837 | * @param {Array} [seed] A set of elements to match against |
2607 | * @param {Array} [seed] A set of elements to match against |
2838 | */ |
2608 | */ |
2839 | select = Sizzle.select = function( selector, context, results, seed ) { |
2609 | function select( selector, context, results, seed ) { |
2840 | var i, tokens, token, type, find, |
2610 | var i, tokens, token, type, find, |
2841 | compiled = typeof selector === "function" && selector, |
2611 | compiled = typeof selector === "function" && selector, |
2842 | match = !seed && tokenize( ( selector = compiled.selector || selector ) ); |
2612 | match = !seed && tokenize( ( selector = compiled.selector || selector ) ); |
2843 | 2613 | ||
2844 | results = results || []; |
2614 | results = results || []; |
Line 2850... | Line 2620... | ||
2850 | // Reduce context if the leading compound selector is an ID |
2620 | // Reduce context if the leading compound selector is an ID |
2851 | tokens = match[ 0 ] = match[ 0 ].slice( 0 ); |
2621 | tokens = match[ 0 ] = match[ 0 ].slice( 0 ); |
2852 | if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && |
2622 | if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && |
2853 | context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { |
2623 | context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { |
2854 | 2624 | ||
2855 | context = ( Expr.find[ "ID" ]( token.matches[ 0 ] |
2625 | context = ( Expr.find.ID( |
2856 | .replace( runescape, funescape ), context ) || [] )[ 0 ]; |
2626 | token.matches[ 0 ].replace( runescape, funescape ), |
- | 2627 | context |
|
- | 2628 | ) || [] )[ 0 ]; |
|
2857 | if ( !context ) { |
2629 | if ( !context ) { |
2858 | return results; |
2630 | return results; |
2859 | 2631 | ||
2860 | // Precompiled matchers will still verify ancestry, so step up a level |
2632 | // Precompiled matchers will still verify ancestry, so step up a level |
2861 | } else if ( compiled ) { |
2633 | } else if ( compiled ) { |
Line 2864... | Line 2636... | ||
2864 | 2636 | ||
2865 | selector = selector.slice( tokens.shift().value.length ); |
2637 | selector = selector.slice( tokens.shift().value.length ); |
2866 | } |
2638 | } |
2867 | 2639 | ||
2868 | // Fetch a seed set for right-to-left matching |
2640 | // Fetch a seed set for right-to-left matching |
2869 | i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length; |
2641 | i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length; |
2870 | while ( i-- ) { |
2642 | while ( i-- ) { |
2871 | token = tokens[ i ]; |
2643 | token = tokens[ i ]; |
2872 | 2644 | ||
2873 | // Abort if we hit a combinator |
2645 | // Abort if we hit a combinator |
2874 | if ( Expr.relative[ ( type = token.type ) ] ) { |
2646 | if ( Expr.relative[ ( type = token.type ) ] ) { |
Line 2877... | Line 2649... | ||
2877 | if ( ( find = Expr.find[ type ] ) ) { |
2649 | if ( ( find = Expr.find[ type ] ) ) { |
2878 | 2650 | ||
2879 | // Search, expanding context for leading sibling combinators |
2651 | // Search, expanding context for leading sibling combinators |
2880 | if ( ( seed = find( |
2652 | if ( ( seed = find( |
2881 | token.matches[ 0 ].replace( runescape, funescape ), |
2653 | token.matches[ 0 ].replace( runescape, funescape ), |
2882 | rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) || |
2654 | rsibling.test( tokens[ 0 ].type ) && |
2883 | context |
2655 | testContext( context.parentNode ) || context |
2884 | ) ) ) { |
2656 | ) ) ) { |
2885 | 2657 | ||
2886 | // If seed is empty or no tokens remain, we can return early |
2658 | // If seed is empty or no tokens remain, we can return early |
2887 | tokens.splice( i, 1 ); |
2659 | tokens.splice( i, 1 ); |
2888 | selector = seed.length && toSelector( tokens ); |
2660 | selector = seed.length && toSelector( tokens ); |
Line 2905... | Line 2677... | ||
2905 | !documentIsHTML, |
2677 | !documentIsHTML, |
2906 | results, |
2678 | results, |
2907 | !context || rsibling.test( selector ) && testContext( context.parentNode ) || context |
2679 | !context || rsibling.test( selector ) && testContext( context.parentNode ) || context |
2908 | ); |
2680 | ); |
2909 | return results; |
2681 | return results; |
2910 | }; |
2682 | } |
2911 | 2683 | ||
2912 | // One-time assignments |
2684 | // One-time assignments |
2913 | 2685 | ||
- | 2686 | // Support: Android <=4.0 - 4.1+ |
|
2914 | // Sort stability |
2687 | // Sort stability |
2915 | support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; |
2688 | support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; |
2916 | 2689 | ||
2917 | // Support: Chrome 14-35+ |
- | |
2918 | // Always assume duplicates if they aren't passed to the comparison function |
- | |
2919 | support.detectDuplicates = !!hasDuplicate; |
- | |
2920 | - | ||
2921 | // Initialize against the default document |
2690 | // Initialize against the default document |
2922 | setDocument(); |
2691 | setDocument(); |
2923 | 2692 | ||
2924 | // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) |
2693 | // Support: Android <=4.0 - 4.1+ |
2925 | // Detached nodes confoundingly follow *each other* |
2694 | // Detached nodes confoundingly follow *each other* |
2926 | support.sortDetached = assert( function( el ) { |
2695 | support.sortDetached = assert( function( el ) { |
2927 | 2696 | ||
2928 | // Should return 1, but returns 4 (following) |
2697 | // Should return 1, but returns 4 (following) |
2929 | return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; |
2698 | return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; |
2930 | } ); |
2699 | } ); |
2931 | 2700 | ||
2932 | // Support: IE<8 |
- | |
2933 | // Prevent attribute/property "interpolation" |
- | |
2934 | // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx |
- | |
2935 | if ( !assert( function( el ) { |
- | |
2936 | el.innerHTML = "<a href='#'></a>"; |
- | |
2937 | return el.firstChild.getAttribute( "href" ) === "#"; |
- | |
2938 | } ) ) { |
- | |
2939 | addHandle( "type|href|height|width", function( elem, name, isXML ) { |
- | |
2940 | if ( !isXML ) { |
- | |
2941 | return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); |
- | |
2942 | } |
- | |
2943 | } ); |
- | |
2944 | } |
- | |
2945 | - | ||
2946 | // Support: IE<9 |
- | |
2947 | // Use defaultValue in place of getAttribute("value") |
- | |
2948 | if ( !support.attributes || !assert( function( el ) { |
- | |
2949 | el.innerHTML = "<input/>"; |
- | |
2950 | el.firstChild.setAttribute( "value", "" ); |
- | |
2951 | return el.firstChild.getAttribute( "value" ) === ""; |
- | |
2952 | } ) ) { |
- | |
2953 | addHandle( "value", function( elem, _name, isXML ) { |
- | |
2954 | if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { |
- | |
2955 | return elem.defaultValue; |
- | |
2956 | } |
- | |
2957 | } ); |
- | |
2958 | } |
- | |
2959 | - | ||
2960 | // Support: IE<9 |
- | |
2961 | // Use getAttributeNode to fetch booleans when getAttribute lies |
- | |
2962 | if ( !assert( function( el ) { |
- | |
2963 | return el.getAttribute( "disabled" ) == null; |
- | |
2964 | } ) ) { |
- | |
2965 | addHandle( booleans, function( elem, name, isXML ) { |
- | |
2966 | var val; |
- | |
2967 | if ( !isXML ) { |
- | |
2968 | return elem[ name ] === true ? name.toLowerCase() : |
- | |
2969 | ( val = elem.getAttributeNode( name ) ) && val.specified ? |
- | |
2970 | val.value : |
- | |
2971 | null; |
- | |
2972 | } |
- | |
2973 | } ); |
- | |
2974 | } |
- | |
2975 | - | ||
2976 | return Sizzle; |
- | |
2977 | - | ||
2978 | } )( window ); |
- | |
2979 | - | ||
2980 | - | ||
2981 | - | ||
2982 | jQuery.find = Sizzle; |
2701 | jQuery.find = find; |
2983 | jQuery.expr = Sizzle.selectors; |
- | |
2984 | 2702 | ||
2985 | // Deprecated |
2703 | // Deprecated |
2986 | jQuery.expr[ ":" ] = jQuery.expr.pseudos; |
2704 | jQuery.expr[ ":" ] = jQuery.expr.pseudos; |
2987 | jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; |
2705 | jQuery.unique = jQuery.uniqueSort; |
- | 2706 | ||
- | 2707 | // These have always been private, but they used to be documented as part of |
|
- | 2708 | // Sizzle so let's maintain them for now for backwards compatibility purposes. |
|
- | 2709 | find.compile = compile; |
|
- | 2710 | find.select = select; |
|
- | 2711 | find.setDocument = setDocument; |
|
- | 2712 | find.tokenize = tokenize; |
|
- | 2713 | ||
- | 2714 | find.escape = jQuery.escapeSelector; |
|
2988 | jQuery.text = Sizzle.getText; |
2715 | find.getText = jQuery.text; |
2989 | jQuery.isXMLDoc = Sizzle.isXML; |
2716 | find.isXML = jQuery.isXMLDoc; |
2990 | jQuery.contains = Sizzle.contains; |
2717 | find.selectors = jQuery.expr; |
2991 | jQuery.escapeSelector = Sizzle.escape; |
2718 | find.support = jQuery.support; |
- | 2719 | find.uniqueSort = jQuery.uniqueSort; |
|
2992 | 2720 | ||
- | 2721 | /* eslint-enable */ |
|
2993 | 2722 | ||
- | 2723 | } )(); |
|
2994 | 2724 | ||
2995 | 2725 | ||
2996 | var dir = function( elem, dir, until ) { |
2726 | var dir = function( elem, dir, until ) { |
2997 | var matched = [], |
2727 | var matched = [], |
2998 | truncate = until !== undefined; |
2728 | truncate = until !== undefined; |
Line 3022... | Line 2752... | ||
3022 | }; |
2752 | }; |
3023 | 2753 | ||
3024 | 2754 | ||
3025 | var rneedsContext = jQuery.expr.match.needsContext; |
2755 | var rneedsContext = jQuery.expr.match.needsContext; |
3026 | 2756 | ||
3027 | - | ||
3028 | - | ||
3029 | function nodeName( elem, name ) { |
- | |
3030 | - | ||
3031 | return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); |
- | |
3032 | - | ||
3033 | } |
- | |
3034 | var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); |
2757 | var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); |
3035 | 2758 | ||
3036 | 2759 | ||
3037 | 2760 | ||
3038 | // Implement the identical functionality for filter and not |
2761 | // Implement the identical functionality for filter and not |
Line 3127... | Line 2850... | ||
3127 | 2850 | ||
3128 | // A central reference to the root jQuery(document) |
2851 | // A central reference to the root jQuery(document) |
3129 | var rootjQuery, |
2852 | var rootjQuery, |
3130 | 2853 | ||
3131 | // A simple way to check for HTML strings |
2854 | // A simple way to check for HTML strings |
3132 | // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) |
2855 | // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521) |
3133 | // Strict HTML recognition (#11290: must start with <) |
2856 | // Strict HTML recognition (trac-11290: must start with <) |
3134 | // Shortcut simple #id case for speed |
2857 | // Shortcut simple #id case for speed |
3135 | rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, |
2858 | rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, |
3136 | 2859 | ||
3137 | init = jQuery.fn.init = function( selector, context, root ) { |
2860 | init = jQuery.fn.init = function( selector, context, root ) { |
3138 | var match, elem; |
2861 | var match, elem; |
Line 3279... | Line 3002... | ||
3279 | 3002 | ||
3280 | // Always skip document fragments |
3003 | // Always skip document fragments |
3281 | if ( cur.nodeType < 11 && ( targets ? |
3004 | if ( cur.nodeType < 11 && ( targets ? |
3282 | targets.index( cur ) > -1 : |
3005 | targets.index( cur ) > -1 : |
3283 | 3006 | ||
3284 | // Don't pass non-elements to Sizzle |
3007 | // Don't pass non-elements to jQuery#find |
3285 | cur.nodeType === 1 && |
3008 | cur.nodeType === 1 && |
3286 | jQuery.find.matchesSelector( cur, selectors ) ) ) { |
3009 | jQuery.find.matchesSelector( cur, selectors ) ) ) { |
3287 | 3010 | ||
3288 | matched.push( cur ); |
3011 | matched.push( cur ); |
3289 | break; |
3012 | break; |
Line 3834... | Line 3557... | ||
3834 | mightThrow(); |
3557 | mightThrow(); |
3835 | } catch ( e ) { |
3558 | } catch ( e ) { |
3836 | 3559 | ||
3837 | if ( jQuery.Deferred.exceptionHook ) { |
3560 | if ( jQuery.Deferred.exceptionHook ) { |
3838 | jQuery.Deferred.exceptionHook( e, |
3561 | jQuery.Deferred.exceptionHook( e, |
3839 | process.stackTrace ); |
3562 | process.error ); |
3840 | } |
3563 | } |
3841 | 3564 | ||
3842 | // Support: Promises/A+ section 2.3.3.3.4.1 |
3565 | // Support: Promises/A+ section 2.3.3.3.4.1 |
3843 | // https://promisesaplus.com/#point-61 |
3566 | // https://promisesaplus.com/#point-61 |
3844 | // Ignore post-resolution exceptions |
3567 | // Ignore post-resolution exceptions |
Line 3862... | Line 3585... | ||
3862 | // subsequent errors |
3585 | // subsequent errors |
3863 | if ( depth ) { |
3586 | if ( depth ) { |
3864 | process(); |
3587 | process(); |
3865 | } else { |
3588 | } else { |
3866 | 3589 | ||
3867 | // Call an optional hook to record the stack, in case of exception |
3590 | // Call an optional hook to record the error, in case of exception |
3868 | // since it's otherwise lost when execution goes async |
3591 | // since it's otherwise lost when execution goes async |
3869 | if ( jQuery.Deferred.getStackHook ) { |
3592 | if ( jQuery.Deferred.getErrorHook ) { |
- | 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 ) { |
|
3870 | process.stackTrace = jQuery.Deferred.getStackHook(); |
3600 | process.error = jQuery.Deferred.getStackHook(); |
3871 | } |
3601 | } |
3872 | window.setTimeout( process ); |
3602 | window.setTimeout( process ); |
3873 | } |
3603 | } |
3874 | }; |
3604 | }; |
3875 | } |
3605 | } |
Line 4040... | Line 3770... | ||
4040 | 3770 | ||
4041 | // These usually indicate a programmer mistake during development, |
3771 | // These usually indicate a programmer mistake during development, |
4042 | // warn about them ASAP rather than swallowing them by default. |
3772 | // warn about them ASAP rather than swallowing them by default. |
4043 | var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; |
3773 | var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; |
4044 | 3774 | ||
- | 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. |
|
4045 | jQuery.Deferred.exceptionHook = function( error, stack ) { |
3778 | jQuery.Deferred.exceptionHook = function( error, asyncError ) { |
4046 | 3779 | ||
4047 | // Support: IE 8 - 9 only |
3780 | // Support: IE 8 - 9 only |
4048 | // Console exists when dev tools are open, which can happen at any time |
3781 | // Console exists when dev tools are open, which can happen at any time |
4049 | if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { |
3782 | if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { |
4050 | window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); |
3783 | window.console.warn( "jQuery.Deferred exception: " + error.message, |
- | 3784 | error.stack, asyncError ); |
|
4051 | } |
3785 | } |
4052 | }; |
3786 | }; |
4053 | 3787 | ||
4054 | 3788 | ||
4055 | 3789 | ||
Line 4085... | Line 3819... | ||
4085 | 3819 | ||
4086 | // Is the DOM ready to be used? Set to true once it occurs. |
3820 | // Is the DOM ready to be used? Set to true once it occurs. |
4087 | isReady: false, |
3821 | isReady: false, |
4088 | 3822 | ||
4089 | // A counter to track how many items to wait for before |
3823 | // A counter to track how many items to wait for before |
4090 | // the ready event fires. See #6781 |
3824 | // the ready event fires. See trac-6781 |
4091 | readyWait: 1, |
3825 | readyWait: 1, |
4092 | 3826 | ||
4093 | // Handle when the DOM is ready |
3827 | // Handle when the DOM is ready |
4094 | ready: function( wait ) { |
3828 | ready: function( wait ) { |
4095 | 3829 | ||
Line 4213... | Line 3947... | ||
4213 | return letter.toUpperCase(); |
3947 | return letter.toUpperCase(); |
4214 | } |
3948 | } |
4215 | 3949 | ||
4216 | // Convert dashed to camelCase; used by the css and data modules |
3950 | // Convert dashed to camelCase; used by the css and data modules |
4217 | // Support: IE <=9 - 11, Edge 12 - 15 |
3951 | // Support: IE <=9 - 11, Edge 12 - 15 |
4218 | // Microsoft forgot to hump their vendor prefix (#9572) |
3952 | // Microsoft forgot to hump their vendor prefix (trac-9572) |
4219 | function camelCase( string ) { |
3953 | function camelCase( string ) { |
4220 | return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); |
3954 | return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); |
4221 | } |
3955 | } |
4222 | var acceptData = function( owner ) { |
3956 | var acceptData = function( owner ) { |
4223 | 3957 | ||
Line 4249... | Line 3983... | ||
4249 | // If not, create one |
3983 | // If not, create one |
4250 | if ( !value ) { |
3984 | if ( !value ) { |
4251 | value = {}; |
3985 | value = {}; |
4252 | 3986 | ||
4253 | // We can accept data for non-element nodes in modern browsers, |
3987 | // We can accept data for non-element nodes in modern browsers, |
4254 | // but we should not, see #8335. |
3988 | // but we should not, see trac-8335. |
4255 | // Always return an empty object. |
3989 | // Always return an empty object. |
4256 | if ( acceptData( owner ) ) { |
3990 | if ( acceptData( owner ) ) { |
4257 | 3991 | ||
4258 | // If it is a node unlikely to be stringify-ed or looped over |
3992 | // If it is a node unlikely to be stringify-ed or looped over |
4259 | // use plain assignment |
3993 | // use plain assignment |
Line 4488... | Line 4222... | ||
4488 | if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { |
4222 | if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { |
4489 | i = attrs.length; |
4223 | i = attrs.length; |
4490 | while ( i-- ) { |
4224 | while ( i-- ) { |
4491 | 4225 | ||
4492 | // Support: IE 11 only |
4226 | // Support: IE 11 only |
4493 | // The attrs elements can be null (#14894) |
4227 | // The attrs elements can be null (trac-14894) |
4494 | if ( attrs[ i ] ) { |
4228 | if ( attrs[ i ] ) { |
4495 | name = attrs[ i ].name; |
4229 | name = attrs[ i ].name; |
4496 | if ( name.indexOf( "data-" ) === 0 ) { |
4230 | if ( name.indexOf( "data-" ) === 0 ) { |
4497 | name = camelCase( name.slice( 5 ) ); |
4231 | name = camelCase( name.slice( 5 ) ); |
4498 | dataAttr( elem, name, data[ name ] ); |
4232 | dataAttr( elem, name, data[ name ] ); |
Line 4911... | Line 4645... | ||
4911 | var fragment = document.createDocumentFragment(), |
4645 | var fragment = document.createDocumentFragment(), |
4912 | div = fragment.appendChild( document.createElement( "div" ) ), |
4646 | div = fragment.appendChild( document.createElement( "div" ) ), |
4913 | input = document.createElement( "input" ); |
4647 | input = document.createElement( "input" ); |
4914 | 4648 | ||
4915 | // Support: Android 4.0 - 4.3 only |
4649 | // Support: Android 4.0 - 4.3 only |
4916 | // Check state lost if the name is set (#11217) |
4650 | // Check state lost if the name is set (trac-11217) |
4917 | // Support: Windows Web Apps (WWA) |
4651 | // Support: Windows Web Apps (WWA) |
4918 | // `name` and `type` must use .setAttribute for WWA (#14901) |
4652 | // `name` and `type` must use .setAttribute for WWA (trac-14901) |
4919 | input.setAttribute( "type", "radio" ); |
4653 | input.setAttribute( "type", "radio" ); |
4920 | input.setAttribute( "checked", "checked" ); |
4654 | input.setAttribute( "checked", "checked" ); |
4921 | input.setAttribute( "name", "t" ); |
4655 | input.setAttribute( "name", "t" ); |
4922 | 4656 | ||
4923 | div.appendChild( input ); |
4657 | div.appendChild( input ); |
Line 4937... | Line 4671... | ||
4937 | div.innerHTML = "<option></option>"; |
4671 | div.innerHTML = "<option></option>"; |
4938 | support.option = !!div.lastChild; |
4672 | support.option = !!div.lastChild; |
4939 | } )(); |
4673 | } )(); |
4940 | 4674 | ||
4941 | 4675 | ||
4942 | // We have to close these tags to support XHTML (#13200) |
4676 | // We have to close these tags to support XHTML (trac-13200) |
4943 | var wrapMap = { |
4677 | var wrapMap = { |
4944 | 4678 | ||
4945 | // XHTML parsers do not magically insert elements in the |
4679 | // XHTML parsers do not magically insert elements in the |
4946 | // same way that tag soup parsers do. So we cannot shorten |
4680 | // same way that tag soup parsers do. So we cannot shorten |
4947 | // this by omitting <tbody> or other required elements. |
4681 | // this by omitting <tbody> or other required elements. |
Line 4963... | Line 4697... | ||
4963 | 4697 | ||
4964 | 4698 | ||
4965 | function getAll( context, tag ) { |
4699 | function getAll( context, tag ) { |
4966 | 4700 | ||
4967 | // Support: IE <=9 - 11 only |
4701 | // Support: IE <=9 - 11 only |
4968 | // Use typeof to avoid zero-argument method invocation on host objects (#15151) |
4702 | // Use typeof to avoid zero-argument method invocation on host objects (trac-15151) |
4969 | var ret; |
4703 | var ret; |
4970 | 4704 | ||
4971 | if ( typeof context.getElementsByTagName !== "undefined" ) { |
4705 | if ( typeof context.getElementsByTagName !== "undefined" ) { |
4972 | ret = context.getElementsByTagName( tag || "*" ); |
4706 | ret = context.getElementsByTagName( tag || "*" ); |
4973 | 4707 | ||
Line 5046... | Line 4780... | ||
5046 | jQuery.merge( nodes, tmp.childNodes ); |
4780 | jQuery.merge( nodes, tmp.childNodes ); |
5047 | 4781 | ||
5048 | // Remember the top-level container |
4782 | // Remember the top-level container |
5049 | tmp = fragment.firstChild; |
4783 | tmp = fragment.firstChild; |
5050 | 4784 | ||
5051 | // Ensure the created nodes are orphaned (#12392) |
4785 | // Ensure the created nodes are orphaned (trac-12392) |
5052 | tmp.textContent = ""; |
4786 | tmp.textContent = ""; |
5053 | } |
4787 | } |
5054 | } |
4788 | } |
5055 | } |
4789 | } |
5056 | 4790 | ||
Line 5101... | Line 4835... | ||
5101 | 4835 | ||
5102 | function returnFalse() { |
4836 | function returnFalse() { |
5103 | return false; |
4837 | return false; |
5104 | } |
4838 | } |
5105 | 4839 | ||
5106 | // Support: IE <=9 - 11+ |
- | |
5107 | // focus() and blur() are asynchronous, except when they are no-op. |
- | |
5108 | // So expect focus to be synchronous when the element is already active, |
- | |
5109 | // and blur to be synchronous when the element is not already active. |
- | |
5110 | // (focus and blur are always synchronous in other supported browsers, |
- | |
5111 | // this just defines when we can count on it). |
- | |
5112 | function expectSync( elem, type ) { |
- | |
5113 | return ( elem === safeActiveElement() ) === ( type === "focus" ); |
- | |
5114 | } |
- | |
5115 | - | ||
5116 | // Support: IE <=9 only |
- | |
5117 | // Accessing document.activeElement can throw unexpectedly |
- | |
5118 | // https://bugs.jquery.com/ticket/13393 |
- | |
5119 | function safeActiveElement() { |
- | |
5120 | try { |
- | |
5121 | return document.activeElement; |
- | |
5122 | } catch ( err ) { } |
- | |
5123 | } |
- | |
5124 | - | ||
5125 | function on( elem, types, selector, data, fn, one ) { |
4840 | function on( elem, types, selector, data, fn, one ) { |
5126 | var origFn, type; |
4841 | var origFn, type; |
5127 | 4842 | ||
5128 | // Types can be a map of types/handlers |
4843 | // Types can be a map of types/handlers |
5129 | if ( typeof types === "object" ) { |
4844 | if ( typeof types === "object" ) { |
Line 5467... | Line 5182... | ||
5467 | // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) |
5182 | // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) |
5468 | !( event.type === "click" && event.button >= 1 ) ) { |
5183 | !( event.type === "click" && event.button >= 1 ) ) { |
5469 | 5184 | ||
5470 | for ( ; cur !== this; cur = cur.parentNode || this ) { |
5185 | for ( ; cur !== this; cur = cur.parentNode || this ) { |
5471 | 5186 | ||
5472 | // Don't check non-elements (#13208) |
5187 | // Don't check non-elements (trac-13208) |
5473 | // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) |
5188 | // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764) |
5474 | if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { |
5189 | if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { |
5475 | matchedHandlers = []; |
5190 | matchedHandlers = []; |
5476 | matchedSelectors = {}; |
5191 | matchedSelectors = {}; |
5477 | for ( i = 0; i < delegateCount; i++ ) { |
5192 | for ( i = 0; i < delegateCount; i++ ) { |
5478 | handleObj = handlers[ i ]; |
5193 | handleObj = handlers[ i ]; |
5479 | 5194 | ||
5480 | // Don't conflict with Object.prototype properties (#13203) |
5195 | // Don't conflict with Object.prototype properties (trac-13203) |
5481 | sel = handleObj.selector + " "; |
5196 | sel = handleObj.selector + " "; |
5482 | 5197 | ||
5483 | if ( matchedSelectors[ sel ] === undefined ) { |
5198 | if ( matchedSelectors[ sel ] === undefined ) { |
5484 | matchedSelectors[ sel ] = handleObj.needsContext ? |
5199 | matchedSelectors[ sel ] = handleObj.needsContext ? |
5485 | jQuery( sel, this ).index( cur ) > -1 : |
5200 | jQuery( sel, this ).index( cur ) > -1 : |
Line 5557... | Line 5272... | ||
5557 | // Claim the first handler |
5272 | // Claim the first handler |
5558 | if ( rcheckableType.test( el.type ) && |
5273 | if ( rcheckableType.test( el.type ) && |
5559 | el.click && nodeName( el, "input" ) ) { |
5274 | el.click && nodeName( el, "input" ) ) { |
5560 | 5275 | ||
5561 | // dataPriv.set( el, "click", ... ) |
5276 | // dataPriv.set( el, "click", ... ) |
5562 | leverageNative( el, "click", returnTrue ); |
5277 | leverageNative( el, "click", true ); |
5563 | } |
5278 | } |
5564 | 5279 | ||
5565 | // Return false to allow normal processing in the caller |
5280 | // Return false to allow normal processing in the caller |
5566 | return false; |
5281 | return false; |
5567 | }, |
5282 | }, |
Line 5608... | Line 5323... | ||
5608 | 5323 | ||
5609 | // Ensure the presence of an event listener that handles manually-triggered |
5324 | // Ensure the presence of an event listener that handles manually-triggered |
5610 | // synthetic events by interrupting progress until reinvoked in response to |
5325 | // synthetic events by interrupting progress until reinvoked in response to |
5611 | // *native* events that it fires directly, ensuring that state changes have |
5326 | // *native* events that it fires directly, ensuring that state changes have |
5612 | // already occurred before other listeners are invoked. |
5327 | // already occurred before other listeners are invoked. |
5613 | function leverageNative( el, type, expectSync ) { |
5328 | function leverageNative( el, type, isSetup ) { |
5614 | 5329 | ||
5615 | // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add |
5330 | // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add |
5616 | if ( !expectSync ) { |
5331 | if ( !isSetup ) { |
5617 | if ( dataPriv.get( el, type ) === undefined ) { |
5332 | if ( dataPriv.get( el, type ) === undefined ) { |
5618 | jQuery.event.add( el, type, returnTrue ); |
5333 | jQuery.event.add( el, type, returnTrue ); |
5619 | } |
5334 | } |
5620 | return; |
5335 | return; |
5621 | } |
5336 | } |
Line 5623... | Line 5338... | ||
5623 | // Register the controller as a special universal handler for all event namespaces |
5338 | // Register the controller as a special universal handler for all event namespaces |
5624 | dataPriv.set( el, type, false ); |
5339 | dataPriv.set( el, type, false ); |
5625 | jQuery.event.add( el, type, { |
5340 | jQuery.event.add( el, type, { |
5626 | namespace: false, |
5341 | namespace: false, |
5627 | handler: function( event ) { |
5342 | handler: function( event ) { |
5628 | var notAsync, result, |
5343 | var result, |
5629 | saved = dataPriv.get( this, type ); |
5344 | saved = dataPriv.get( this, type ); |
5630 | 5345 | ||
5631 | if ( ( event.isTrigger & 1 ) && this[ type ] ) { |
5346 | if ( ( event.isTrigger & 1 ) && this[ type ] ) { |
5632 | 5347 | ||
5633 | // Interrupt processing of the outer synthetic .trigger()ed event |
5348 | // Interrupt processing of the outer synthetic .trigger()ed event |
5634 | // Saved data should be false in such cases, but might be a leftover capture object |
- | |
5635 | // from an async native handler (gh-4350) |
- | |
5636 | if ( !saved.length ) { |
5349 | if ( !saved ) { |
5637 | 5350 | ||
5638 | // Store arguments for use when handling the inner native event |
5351 | // Store arguments for use when handling the inner native event |
5639 | // There will always be at least one argument (an event object), so this array |
5352 | // There will always be at least one argument (an event object), so this array |
5640 | // will not be confused with a leftover capture object. |
5353 | // will not be confused with a leftover capture object. |
5641 | saved = slice.call( arguments ); |
5354 | saved = slice.call( arguments ); |
5642 | dataPriv.set( this, type, saved ); |
5355 | dataPriv.set( this, type, saved ); |
5643 | 5356 | ||
5644 | // Trigger the native event and capture its result |
5357 | // Trigger the native event and capture its result |
5645 | // Support: IE <=9 - 11+ |
- | |
5646 | // focus() and blur() are asynchronous |
- | |
5647 | notAsync = expectSync( this, type ); |
- | |
5648 | this[ type ](); |
5358 | this[ type ](); |
5649 | result = dataPriv.get( this, type ); |
5359 | result = dataPriv.get( this, type ); |
5650 | if ( saved !== result || notAsync ) { |
- | |
5651 | dataPriv.set( this, type, false ); |
5360 | dataPriv.set( this, type, false ); |
5652 | } else { |
- | |
5653 | result = {}; |
- | |
5654 | } |
5361 | |
5655 | if ( saved !== result ) { |
5362 | if ( saved !== result ) { |
5656 | 5363 | ||
5657 | // Cancel the outer synthetic event |
5364 | // Cancel the outer synthetic event |
5658 | event.stopImmediatePropagation(); |
5365 | event.stopImmediatePropagation(); |
5659 | event.preventDefault(); |
5366 | event.preventDefault(); |
5660 | 5367 | ||
5661 | // Support: Chrome 86+ |
- | |
5662 | // In Chrome, if an element having a focusout handler is blurred by |
- | |
5663 | // clicking outside of it, it invokes the handler synchronously. If |
- | |
5664 | // that handler calls `.remove()` on the element, the data is cleared, |
- | |
5665 | // leaving `result` undefined. We need to guard against this. |
- | |
5666 | return result && result.value; |
5368 | return result; |
5667 | } |
5369 | } |
5668 | 5370 | ||
5669 | // If this is an inner synthetic event for an event with a bubbling surrogate |
5371 | // If this is an inner synthetic event for an event with a bubbling surrogate |
5670 | // (focus or blur), assume that the surrogate already propagated from triggering the |
5372 | // (focus or blur), assume that the surrogate already propagated from triggering |
5671 | // native event and prevent that from happening again here. |
5373 | // the native event and prevent that from happening again here. |
5672 | // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the |
5374 | // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the |
5673 | // bubbling surrogate propagates *after* the non-bubbling base), but that seems |
5375 | // bubbling surrogate propagates *after* the non-bubbling base), but that seems |
5674 | // less bad than duplication. |
5376 | // less bad than duplication. |
5675 | } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { |
5377 | } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { |
5676 | event.stopPropagation(); |
5378 | event.stopPropagation(); |
5677 | } |
5379 | } |
5678 | 5380 | ||
5679 | // If this is a native event triggered above, everything is now in order |
5381 | // If this is a native event triggered above, everything is now in order |
5680 | // Fire an inner synthetic event with the original arguments |
5382 | // Fire an inner synthetic event with the original arguments |
5681 | } else if ( saved.length ) { |
5383 | } else if ( saved ) { |
5682 | 5384 | ||
5683 | // ...and capture the result |
5385 | // ...and capture the result |
5684 | dataPriv.set( this, type, { |
5386 | dataPriv.set( this, type, jQuery.event.trigger( |
5685 | value: jQuery.event.trigger( |
- | |
5686 | - | ||
5687 | // Support: IE <=9 - 11+ |
5387 | saved[ 0 ], |
5688 | // Extend with the prototype to reset the above stopImmediatePropagation() |
- | |
5689 | jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), |
- | |
5690 | saved.slice( 1 ), |
5388 | saved.slice( 1 ), |
5691 | this |
5389 | this |
5692 | ) |
- | |
5693 | } ); |
5390 | ) ); |
5694 | 5391 | ||
5695 | // Abort handling of the native event |
5392 | // Abort handling of the native event by all jQuery handlers while allowing |
- | 5393 | // native handlers on the same element to run. On target, this is achieved |
|
- | 5394 | // by stopping immediate propagation just on the jQuery event. However, |
|
- | 5395 | // the native event is re-wrapped by a jQuery one on each level of the |
|
- | 5396 | // propagation so the only way to stop it for jQuery is to stop it for |
|
- | 5397 | // everyone via native `stopPropagation()`. This is not a problem for |
|
- | 5398 | // focus/blur which don't bubble, but it does also stop click on checkboxes |
|
- | 5399 | // and radios. We accept this limitation. |
|
5696 | event.stopImmediatePropagation(); |
5400 | event.stopPropagation(); |
- | 5401 | event.isImmediatePropagationStopped = returnTrue; |
|
5697 | } |
5402 | } |
5698 | } |
5403 | } |
5699 | } ); |
5404 | } ); |
5700 | } |
5405 | } |
5701 | 5406 | ||
Line 5729... | Line 5434... | ||
5729 | returnTrue : |
5434 | returnTrue : |
5730 | returnFalse; |
5435 | returnFalse; |
5731 | 5436 | ||
5732 | // Create target properties |
5437 | // Create target properties |
5733 | // Support: Safari <=6 - 7 only |
5438 | // Support: Safari <=6 - 7 only |
5734 | // Target should not be a text node (#504, #13143) |
5439 | // Target should not be a text node (trac-504, trac-13143) |
5735 | this.target = ( src.target && src.target.nodeType === 3 ) ? |
5440 | this.target = ( src.target && src.target.nodeType === 3 ) ? |
5736 | src.target.parentNode : |
5441 | src.target.parentNode : |
5737 | src.target; |
5442 | src.target; |
5738 | 5443 | ||
5739 | this.currentTarget = src.currentTarget; |
5444 | this.currentTarget = src.currentTarget; |
Line 5830... | Line 5535... | ||
5830 | touches: true, |
5535 | touches: true, |
5831 | which: true |
5536 | which: true |
5832 | }, jQuery.event.addProp ); |
5537 | }, jQuery.event.addProp ); |
5833 | 5538 | ||
5834 | jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { |
5539 | jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { |
- | 5540 | ||
- | 5541 | function focusMappedHandler( nativeEvent ) { |
|
- | 5542 | if ( document.documentMode ) { |
|
- | 5543 | ||
- | 5544 | // Support: IE 11+ |
|
- | 5545 | // Attach a single focusin/focusout handler on the document while someone wants |
|
- | 5546 | // focus/blur. This is because the former are synchronous in IE while the latter |
|
- | 5547 | // are async. In other browsers, all those handlers are invoked synchronously. |
|
- | 5548 | ||
- | 5549 | // `handle` from private data would already wrap the event, but we need |
|
- | 5550 | // to change the `type` here. |
|
- | 5551 | var handle = dataPriv.get( this, "handle" ), |
|
- | 5552 | event = jQuery.event.fix( nativeEvent ); |
|
- | 5553 | event.type = nativeEvent.type === "focusin" ? "focus" : "blur"; |
|
- | 5554 | event.isSimulated = true; |
|
- | 5555 | ||
- | 5556 | // First, handle focusin/focusout |
|
- | 5557 | handle( nativeEvent ); |
|
- | 5558 | ||
- | 5559 | // ...then, handle focus/blur |
|
- | 5560 | // |
|
- | 5561 | // focus/blur don't bubble while focusin/focusout do; simulate the former by only |
|
- | 5562 | // invoking the handler at the lower level. |
|
- | 5563 | if ( event.target === event.currentTarget ) { |
|
- | 5564 | ||
- | 5565 | // The setup part calls `leverageNative`, which, in turn, calls |
|
- | 5566 | // `jQuery.event.add`, so event handle will already have been set |
|
- | 5567 | // by this point. |
|
- | 5568 | handle( event ); |
|
- | 5569 | } |
|
- | 5570 | } else { |
|
- | 5571 | ||
- | 5572 | // For non-IE browsers, attach a single capturing handler on the document |
|
- | 5573 | // while someone wants focusin/focusout. |
|
- | 5574 | jQuery.event.simulate( delegateType, nativeEvent.target, |
|
- | 5575 | jQuery.event.fix( nativeEvent ) ); |
|
- | 5576 | } |
|
- | 5577 | } |
|
- | 5578 | ||
5835 | jQuery.event.special[ type ] = { |
5579 | jQuery.event.special[ type ] = { |
5836 | 5580 | ||
5837 | // Utilize native event if possible so blur/focus sequence is correct |
5581 | // Utilize native event if possible so blur/focus sequence is correct |
5838 | setup: function() { |
5582 | setup: function() { |
5839 | 5583 | ||
- | 5584 | var attaches; |
|
- | 5585 | ||
5840 | // Claim the first handler |
5586 | // Claim the first handler |
5841 | // dataPriv.set( this, "focus", ... ) |
5587 | // dataPriv.set( this, "focus", ... ) |
5842 | // dataPriv.set( this, "blur", ... ) |
5588 | // dataPriv.set( this, "blur", ... ) |
5843 | leverageNative( this, type, expectSync ); |
5589 | leverageNative( this, type, true ); |
- | 5590 | ||
- | 5591 | if ( document.documentMode ) { |
|
- | 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 { |
|
5844 | 5603 | ||
5845 | // Return false to allow normal processing in the caller |
5604 | // Return false to allow normal processing in the caller |
5846 | return false; |
5605 | return false; |
- | 5606 | } |
|
5847 | }, |
5607 | }, |
5848 | trigger: function() { |
5608 | trigger: function() { |
5849 | 5609 | ||
5850 | // Force setup before trigger |
5610 | // Force setup before trigger |
5851 | leverageNative( this, type ); |
5611 | leverageNative( this, type ); |
5852 | 5612 | ||
5853 | // Return non-false to allow normal event-path propagation |
5613 | // Return non-false to allow normal event-path propagation |
5854 | return true; |
5614 | return true; |
5855 | }, |
5615 | }, |
5856 | 5616 | ||
- | 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 | } |
|
- | 5633 | }, |
|
- | 5634 | ||
5857 | // Suppress native focus or blur as it's already being fired |
5635 | // Suppress native focus or blur if we're currently inside |
5858 | // in leverageNative. |
5636 | // a leveraged native-event stack |
5859 | _default: function() { |
5637 | _default: function( event ) { |
5860 | return true; |
5638 | return dataPriv.get( event.target, type ); |
5861 | }, |
5639 | }, |
5862 | 5640 | ||
5863 | delegateType: delegateType |
5641 | delegateType: delegateType |
5864 | }; |
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 | } |
|
- | 5694 | }; |
|
5865 | } ); |
5695 | } ); |
5866 | 5696 | ||
5867 | // Create mouseenter/leave events using mouseover/out and event-time checks |
5697 | // Create mouseenter/leave events using mouseover/out and event-time checks |
5868 | // so that event delegation works in jQuery. |
5698 | // so that event delegation works in jQuery. |
5869 | // Do the same for pointerenter/pointerleave and pointerover/pointerout |
5699 | // Do the same for pointerenter/pointerleave and pointerover/pointerout |
Line 5954... | Line 5784... | ||
5954 | // See https://connect.microsoft.com/IE/feedback/details/1736512/ |
5784 | // See https://connect.microsoft.com/IE/feedback/details/1736512/ |
5955 | rnoInnerhtml = /<script|<style|<link/i, |
5785 | rnoInnerhtml = /<script|<style|<link/i, |
5956 | 5786 | ||
5957 | // checked="checked" or checked |
5787 | // checked="checked" or checked |
5958 | rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, |
5788 | rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, |
- | 5789 | ||
5959 | rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; |
5790 | rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g; |
5960 | 5791 | ||
5961 | // Prefer a tbody over its parent table for containing new rows |
5792 | // Prefer a tbody over its parent table for containing new rows |
5962 | function manipulationTarget( elem, content ) { |
5793 | function manipulationTarget( elem, content ) { |
5963 | if ( nodeName( elem, "table" ) && |
5794 | if ( nodeName( elem, "table" ) && |
5964 | nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { |
5795 | nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { |
Line 6068... | Line 5899... | ||
6068 | scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); |
5899 | scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); |
6069 | hasScripts = scripts.length; |
5900 | hasScripts = scripts.length; |
6070 | 5901 | ||
6071 | // Use the original fragment for the last item |
5902 | // Use the original fragment for the last item |
6072 | // instead of the first because it can end up |
5903 | // instead of the first because it can end up |
6073 | // being emptied incorrectly in certain situations (#8070). |
5904 | // being emptied incorrectly in certain situations (trac-8070). |
6074 | for ( ; i < l; i++ ) { |
5905 | for ( ; i < l; i++ ) { |
6075 | node = fragment; |
5906 | node = fragment; |
6076 | 5907 | ||
6077 | if ( i !== iNoClone ) { |
5908 | if ( i !== iNoClone ) { |
6078 | node = jQuery.clone( node, true, true ); |
5909 | node = jQuery.clone( node, true, true ); |
Line 6090... | Line 5921... | ||
6090 | } |
5921 | } |
6091 | 5922 | ||
6092 | if ( hasScripts ) { |
5923 | if ( hasScripts ) { |
6093 | doc = scripts[ scripts.length - 1 ].ownerDocument; |
5924 | doc = scripts[ scripts.length - 1 ].ownerDocument; |
6094 | 5925 | ||
6095 | // Reenable scripts |
5926 | // Re-enable scripts |
6096 | jQuery.map( scripts, restoreScript ); |
5927 | jQuery.map( scripts, restoreScript ); |
6097 | 5928 | ||
6098 | // Evaluate executable scripts on first document insertion |
5929 | // Evaluate executable scripts on first document insertion |
6099 | for ( i = 0; i < hasScripts; i++ ) { |
5930 | for ( i = 0; i < hasScripts; i++ ) { |
6100 | node = scripts[ i ]; |
5931 | node = scripts[ i ]; |
Line 6109... | Line 5940... | ||
6109 | jQuery._evalUrl( node.src, { |
5940 | jQuery._evalUrl( node.src, { |
6110 | nonce: node.nonce || node.getAttribute( "nonce" ) |
5941 | nonce: node.nonce || node.getAttribute( "nonce" ) |
6111 | }, doc ); |
5942 | }, doc ); |
6112 | } |
5943 | } |
6113 | } else { |
5944 | } else { |
- | 5945 | ||
- | 5946 | // Unwrap a CDATA section containing script contents. This shouldn't be |
|
- | 5947 | // needed as in XML documents they're already not visible when |
|
- | 5948 | // inspecting element contents and in HTML documents they have no |
|
- | 5949 | // meaning but we're preserving that logic for backwards compatibility. |
|
- | 5950 | // This will be removed completely in 4.0. See gh-4904. |
|
6114 | DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); |
5951 | DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); |
6115 | } |
5952 | } |
6116 | } |
5953 | } |
6117 | } |
5954 | } |
6118 | } |
5955 | } |
Line 6155... | Line 5992... | ||
6155 | 5992 | ||
6156 | // Fix IE cloning issues |
5993 | // Fix IE cloning issues |
6157 | if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && |
5994 | if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && |
6158 | !jQuery.isXMLDoc( elem ) ) { |
5995 | !jQuery.isXMLDoc( elem ) ) { |
6159 | 5996 | ||
6160 | // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 |
5997 | // We eschew jQuery#find here for performance reasons: |
- | 5998 | // https://jsperf.com/getall-vs-sizzle/2 |
|
6161 | destElements = getAll( clone ); |
5999 | destElements = getAll( clone ); |
6162 | srcElements = getAll( elem ); |
6000 | srcElements = getAll( elem ); |
6163 | 6001 | ||
6164 | for ( i = 0, l = srcElements.length; i < l; i++ ) { |
6002 | for ( i = 0, l = srcElements.length; i < l; i++ ) { |
6165 | fixInput( srcElements[ i ], destElements[ i ] ); |
6003 | fixInput( srcElements[ i ], destElements[ i ] ); |
Line 6391... | Line 6229... | ||
6391 | return this.pushStack( ret ); |
6229 | return this.pushStack( ret ); |
6392 | }; |
6230 | }; |
6393 | } ); |
6231 | } ); |
6394 | var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); |
6232 | var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); |
6395 | 6233 | ||
- | 6234 | var rcustomProp = /^--/; |
|
- | 6235 | ||
- | 6236 | ||
6396 | var getStyles = function( elem ) { |
6237 | var getStyles = function( elem ) { |
6397 | 6238 | ||
6398 | // Support: IE <=11 only, Firefox <=30 (#15098, #14150) |
6239 | // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150) |
6399 | // IE throws on elements created in popups |
6240 | // IE throws on elements created in popups |
6400 | // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" |
6241 | // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" |
6401 | var view = elem.ownerDocument.defaultView; |
6242 | var view = elem.ownerDocument.defaultView; |
6402 | 6243 | ||
6403 | if ( !view || !view.opener ) { |
6244 | if ( !view || !view.opener ) { |
Line 6493... | Line 6334... | ||
6493 | if ( !div.style ) { |
6334 | if ( !div.style ) { |
6494 | return; |
6335 | return; |
6495 | } |
6336 | } |
6496 | 6337 | ||
6497 | // Support: IE <=9 - 11 only |
6338 | // Support: IE <=9 - 11 only |
6498 | // Style of cloned element affects source element cloned (#8908) |
6339 | // Style of cloned element affects source element cloned (trac-8908) |
6499 | div.style.backgroundClip = "content-box"; |
6340 | div.style.backgroundClip = "content-box"; |
6500 | div.cloneNode( true ).style.backgroundClip = ""; |
6341 | div.cloneNode( true ).style.backgroundClip = ""; |
6501 | support.clearCloneStyle = div.style.backgroundClip === "content-box"; |
6342 | support.clearCloneStyle = div.style.backgroundClip === "content-box"; |
6502 | 6343 | ||
6503 | jQuery.extend( support, { |
6344 | jQuery.extend( support, { |
Line 6537... | Line 6378... | ||
6537 | table = document.createElement( "table" ); |
6378 | table = document.createElement( "table" ); |
6538 | tr = document.createElement( "tr" ); |
6379 | tr = document.createElement( "tr" ); |
6539 | trChild = document.createElement( "div" ); |
6380 | trChild = document.createElement( "div" ); |
6540 | 6381 | ||
6541 | table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; |
6382 | table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; |
6542 | tr.style.cssText = "border:1px solid"; |
6383 | tr.style.cssText = "box-sizing:content-box;border:1px solid"; |
6543 | 6384 | ||
6544 | // Support: Chrome 86+ |
6385 | // Support: Chrome 86+ |
6545 | // Height set through cssText does not get applied. |
6386 | // Height set through cssText does not get applied. |
6546 | // Computed height then comes back as 0. |
6387 | // Computed height then comes back as 0. |
6547 | tr.style.height = "1px"; |
6388 | tr.style.height = "1px"; |
Line 6549... | Line 6390... | ||
6549 | 6390 | ||
6550 | // Support: Android 8 Chrome 86+ |
6391 | // Support: Android 8 Chrome 86+ |
6551 | // In our bodyBackground.html iframe, |
6392 | // In our bodyBackground.html iframe, |
6552 | // display for all div elements is set to "inline", |
6393 | // display for all div elements is set to "inline", |
6553 | // which causes a problem only in Android 8 Chrome 86. |
6394 | // which causes a problem only in Android 8 Chrome 86. |
6554 | // Ensuring the div is display: block |
6395 | // Ensuring the div is `display: block` |
6555 | // gets around this issue. |
6396 | // gets around this issue. |
6556 | trChild.style.display = "block"; |
6397 | trChild.style.display = "block"; |
6557 | 6398 | ||
6558 | documentElement |
6399 | documentElement |
6559 | .appendChild( table ) |
6400 | .appendChild( table ) |
Line 6573... | Line 6414... | ||
6573 | } )(); |
6414 | } )(); |
6574 | 6415 | ||
6575 | 6416 | ||
6576 | function curCSS( elem, name, computed ) { |
6417 | function curCSS( elem, name, computed ) { |
6577 | var width, minWidth, maxWidth, ret, |
6418 | var width, minWidth, maxWidth, ret, |
- | 6419 | isCustomProp = rcustomProp.test( name ), |
|
6578 | 6420 | ||
6579 | // Support: Firefox 51+ |
6421 | // Support: Firefox 51+ |
6580 | // Retrieving style before computed somehow |
6422 | // Retrieving style before computed somehow |
6581 | // fixes an issue with getting wrong values |
6423 | // fixes an issue with getting wrong values |
6582 | // on detached elements |
6424 | // on detached elements |
6583 | style = elem.style; |
6425 | style = elem.style; |
6584 | 6426 | ||
6585 | computed = computed || getStyles( elem ); |
6427 | computed = computed || getStyles( elem ); |
6586 | 6428 | ||
6587 | // getPropertyValue is needed for: |
6429 | // getPropertyValue is needed for: |
6588 | // .css('filter') (IE 9 only, #12537) |
6430 | // .css('filter') (IE 9 only, trac-12537) |
6589 | // .css('--customProperty) (#3144) |
6431 | // .css('--customProperty) (gh-3144) |
6590 | if ( computed ) { |
6432 | if ( computed ) { |
- | 6433 | ||
- | 6434 | // Support: IE <=9 - 11+ |
|
- | 6435 | // IE only supports `"float"` in `getPropertyValue`; in computed styles |
|
- | 6436 | // it's only available as `"cssFloat"`. We no longer modify properties |
|
- | 6437 | // sent to `.css()` apart from camelCasing, so we need to check both. |
|
- | 6438 | // Normally, this would create difference in behavior: if |
|
- | 6439 | // `getPropertyValue` returns an empty string, the value returned |
|
- | 6440 | // by `.css()` would be `undefined`. This is usually the case for |
|
- | 6441 | // disconnected elements. However, in IE even disconnected elements |
|
- | 6442 | // with no styles return `"none"` for `getPropertyValue( "float" )` |
|
6591 | ret = computed.getPropertyValue( name ) || computed[ name ]; |
6443 | ret = computed.getPropertyValue( name ) || computed[ name ]; |
6592 | 6444 | ||
- | 6445 | if ( isCustomProp && ret ) { |
|
- | 6446 | ||
- | 6447 | // Support: Firefox 105+, Chrome <=105+ |
|
- | 6448 | // Spec requires trimming whitespace for custom properties (gh-4926). |
|
- | 6449 | // Firefox only trims leading whitespace. Chrome just collapses |
|
- | 6450 | // both leading & trailing whitespace to a single space. |
|
- | 6451 | // |
|
- | 6452 | // Fall back to `undefined` if empty string returned. |
|
- | 6453 | // This collapses a missing definition with property defined |
|
- | 6454 | // and set to an empty string but there's no standard API |
|
- | 6455 | // allowing us to differentiate them without a performance penalty |
|
- | 6456 | // and returning `undefined` aligns with older jQuery. |
|
- | 6457 | // |
|
- | 6458 | // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED |
|
- | 6459 | // as whitespace while CSS does not, but this is not a problem |
|
- | 6460 | // because CSS preprocessing replaces them with U+000A LINE FEED |
|
- | 6461 | // (which *is* CSS whitespace) |
|
- | 6462 | // https://www.w3.org/TR/css-syntax-3/#input-preprocessing |
|
- | 6463 | ret = ret.replace( rtrimCSS, "$1" ) || undefined; |
|
- | 6464 | } |
|
- | 6465 | ||
6593 | if ( ret === "" && !isAttached( elem ) ) { |
6466 | if ( ret === "" && !isAttached( elem ) ) { |
6594 | ret = jQuery.style( elem, name ); |
6467 | ret = jQuery.style( elem, name ); |
6595 | } |
6468 | } |
6596 | 6469 | ||
6597 | // A tribute to the "awesome hack by Dean Edwards" |
6470 | // A tribute to the "awesome hack by Dean Edwards" |
Line 6683... | Line 6556... | ||
6683 | 6556 | ||
6684 | // Swappable if display is none or starts with table |
6557 | // Swappable if display is none or starts with table |
6685 | // except "table", "table-cell", or "table-caption" |
6558 | // except "table", "table-cell", or "table-caption" |
6686 | // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display |
6559 | // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display |
6687 | rdisplayswap = /^(none|table(?!-c[ea]).+)/, |
6560 | rdisplayswap = /^(none|table(?!-c[ea]).+)/, |
6688 | rcustomProp = /^--/, |
- | |
6689 | cssShow = { position: "absolute", visibility: "hidden", display: "block" }, |
6561 | cssShow = { position: "absolute", visibility: "hidden", display: "block" }, |
6690 | cssNormalTransform = { |
6562 | cssNormalTransform = { |
6691 | letterSpacing: "0", |
6563 | letterSpacing: "0", |
6692 | fontWeight: "400" |
6564 | fontWeight: "400" |
6693 | }; |
6565 | }; |
Line 6705... | Line 6577... | ||
6705 | } |
6577 | } |
6706 | 6578 | ||
6707 | function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { |
6579 | function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { |
6708 | var i = dimension === "width" ? 1 : 0, |
6580 | var i = dimension === "width" ? 1 : 0, |
6709 | extra = 0, |
6581 | extra = 0, |
6710 | delta = 0; |
6582 | delta = 0, |
- | 6583 | marginDelta = 0; |
|
6711 | 6584 | ||
6712 | // Adjustment may not be necessary |
6585 | // Adjustment may not be necessary |
6713 | if ( box === ( isBorderBox ? "border" : "content" ) ) { |
6586 | if ( box === ( isBorderBox ? "border" : "content" ) ) { |
6714 | return 0; |
6587 | return 0; |
6715 | } |
6588 | } |
6716 | 6589 | ||
6717 | for ( ; i < 4; i += 2 ) { |
6590 | for ( ; i < 4; i += 2 ) { |
6718 | 6591 | ||
6719 | // Both box models exclude margin |
6592 | // Both box models exclude margin |
- | 6593 | // Count margin delta separately to only add it after scroll gutter adjustment. |
|
- | 6594 | // This is needed to make negative margins work with `outerHeight( true )` (gh-3982). |
|
6720 | if ( box === "margin" ) { |
6595 | if ( box === "margin" ) { |
6721 | delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); |
6596 | marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); |
6722 | } |
6597 | } |
6723 | 6598 | ||
6724 | // If we get here with a content-box, we're seeking "padding" or "border" or "margin" |
6599 | // If we get here with a content-box, we're seeking "padding" or "border" or "margin" |
6725 | if ( !isBorderBox ) { |
6600 | if ( !isBorderBox ) { |
6726 | 6601 | ||
Line 6767... | Line 6642... | ||
6767 | // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter |
6642 | // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter |
6768 | // Use an explicit zero to avoid NaN (gh-3964) |
6643 | // Use an explicit zero to avoid NaN (gh-3964) |
6769 | ) ) || 0; |
6644 | ) ) || 0; |
6770 | } |
6645 | } |
6771 | 6646 | ||
6772 | return delta; |
6647 | return delta + marginDelta; |
6773 | } |
6648 | } |
6774 | 6649 | ||
6775 | function getWidthOrHeight( elem, dimension, extra ) { |
6650 | function getWidthOrHeight( elem, dimension, extra ) { |
6776 | 6651 | ||
6777 | // Start with computed style |
6652 | // Start with computed style |
Line 6865... | Line 6740... | ||
6865 | } |
6740 | } |
6866 | }, |
6741 | }, |
6867 | 6742 | ||
6868 | // Don't automatically add "px" to these possibly-unitless properties |
6743 | // Don't automatically add "px" to these possibly-unitless properties |
6869 | cssNumber: { |
6744 | cssNumber: { |
6870 | "animationIterationCount": true, |
6745 | animationIterationCount: true, |
6871 | "columnCount": true, |
6746 | aspectRatio: true, |
- | 6747 | borderImageSlice: true, |
|
6872 | "fillOpacity": true, |
6748 | columnCount: true, |
6873 | "flexGrow": true, |
6749 | flexGrow: true, |
6874 | "flexShrink": true, |
6750 | flexShrink: true, |
6875 | "fontWeight": true, |
6751 | fontWeight: true, |
6876 | "gridArea": true, |
6752 | gridArea: true, |
6877 | "gridColumn": true, |
6753 | gridColumn: true, |
6878 | "gridColumnEnd": true, |
6754 | gridColumnEnd: true, |
6879 | "gridColumnStart": true, |
6755 | gridColumnStart: true, |
6880 | "gridRow": true, |
6756 | gridRow: true, |
6881 | "gridRowEnd": true, |
6757 | gridRowEnd: true, |
6882 | "gridRowStart": true, |
6758 | gridRowStart: true, |
6883 | "lineHeight": true, |
6759 | lineHeight: true, |
6884 | "opacity": true, |
6760 | opacity: true, |
6885 | "order": true, |
6761 | order: true, |
6886 | "orphans": true, |
6762 | orphans: true, |
- | 6763 | scale: true, |
|
6887 | "widows": true, |
6764 | widows: true, |
6888 | "zIndex": true, |
6765 | zIndex: true, |
6889 | "zoom": true |
6766 | zoom: true, |
- | 6767 | ||
- | 6768 | // SVG-related |
|
- | 6769 | fillOpacity: true, |
|
- | 6770 | floodOpacity: true, |
|
- | 6771 | stopOpacity: true, |
|
- | 6772 | strokeMiterlimit: true, |
|
- | 6773 | strokeOpacity: true |
|
6890 | }, |
6774 | }, |
6891 | 6775 | ||
6892 | // Add in properties whose names you wish to fix before |
6776 | // Add in properties whose names you wish to fix before |
6893 | // setting or getting the value |
6777 | // setting or getting the value |
6894 | cssProps: {}, |
6778 | cssProps: {}, |
Line 6919... | Line 6803... | ||
6919 | 6803 | ||
6920 | // Check if we're setting a value |
6804 | // Check if we're setting a value |
6921 | if ( value !== undefined ) { |
6805 | if ( value !== undefined ) { |
6922 | type = typeof value; |
6806 | type = typeof value; |
6923 | 6807 | ||
6924 | // Convert "+=" or "-=" to relative numbers (#7345) |
6808 | // Convert "+=" or "-=" to relative numbers (trac-7345) |
6925 | if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { |
6809 | if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { |
6926 | value = adjustCSS( elem, name, ret ); |
6810 | value = adjustCSS( elem, name, ret ); |
6927 | 6811 | ||
6928 | // Fixes bug #9237 |
6812 | // Fixes bug trac-9237 |
6929 | type = "number"; |
6813 | type = "number"; |
6930 | } |
6814 | } |
6931 | 6815 | ||
6932 | // Make sure that null and NaN values aren't set (#7116) |
6816 | // Make sure that null and NaN values aren't set (trac-7116) |
6933 | if ( value == null || value !== value ) { |
6817 | if ( value == null || value !== value ) { |
6934 | return; |
6818 | return; |
6935 | } |
6819 | } |
6936 | 6820 | ||
6937 | // If a number was passed in, add the unit (except for certain CSS properties) |
6821 | // If a number was passed in, add the unit (except for certain CSS properties) |
Line 7147... | Line 7031... | ||
7147 | } |
7031 | } |
7148 | } ); |
7032 | } ); |
7149 | 7033 | ||
7150 | 7034 | ||
7151 | // Based off of the plugin by Clint Helfers, with permission. |
7035 | // Based off of the plugin by Clint Helfers, with permission. |
7152 | // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ |
- | |
7153 | jQuery.fn.delay = function( time, type ) { |
7036 | jQuery.fn.delay = function( time, type ) { |
7154 | time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; |
7037 | time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; |
7155 | type = type || "fx"; |
7038 | type = type || "fx"; |
7156 | 7039 | ||
7157 | return this.queue( type, function( next, hooks ) { |
7040 | return this.queue( type, function( next, hooks ) { |
Line 7372... | Line 7255... | ||
7372 | get: function( elem ) { |
7255 | get: function( elem ) { |
7373 | 7256 | ||
7374 | // Support: IE <=9 - 11 only |
7257 | // Support: IE <=9 - 11 only |
7375 | // elem.tabIndex doesn't always return the |
7258 | // elem.tabIndex doesn't always return the |
7376 | // correct value when it hasn't been explicitly set |
7259 | // correct value when it hasn't been explicitly set |
7377 | // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ |
- | |
7378 | // Use proper attribute retrieval(#12072) |
7260 | // Use proper attribute retrieval (trac-12072) |
7379 | var tabindex = jQuery.find.attr( elem, "tabindex" ); |
7261 | var tabindex = jQuery.find.attr( elem, "tabindex" ); |
7380 | 7262 | ||
7381 | if ( tabindex ) { |
7263 | if ( tabindex ) { |
7382 | return parseInt( tabindex, 10 ); |
7264 | return parseInt( tabindex, 10 ); |
7383 | } |
7265 | } |
Line 7477... | Line 7359... | ||
7477 | return []; |
7359 | return []; |
7478 | } |
7360 | } |
7479 | 7361 | ||
7480 | jQuery.fn.extend( { |
7362 | jQuery.fn.extend( { |
7481 | addClass: function( value ) { |
7363 | addClass: function( value ) { |
7482 | var classes, elem, cur, curValue, clazz, j, finalValue, |
7364 | var classNames, cur, curValue, className, i, finalValue; |
7483 | i = 0; |
- | |
7484 | 7365 | ||
7485 | if ( isFunction( value ) ) { |
7366 | if ( isFunction( value ) ) { |
7486 | return this.each( function( j ) { |
7367 | return this.each( function( j ) { |
7487 | jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); |
7368 | jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); |
7488 | } ); |
7369 | } ); |
7489 | } |
7370 | } |
7490 | 7371 | ||
7491 | classes = classesToArray( value ); |
7372 | classNames = classesToArray( value ); |
7492 | 7373 | ||
7493 | if ( classes.length ) { |
7374 | if ( classNames.length ) { |
7494 | while ( ( elem = this[ i++ ] ) ) { |
7375 | return this.each( function() { |
7495 | curValue = getClass( elem ); |
7376 | curValue = getClass( this ); |
7496 | cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); |
7377 | cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); |
7497 | 7378 | ||
7498 | if ( cur ) { |
7379 | if ( cur ) { |
7499 | j = 0; |
7380 | for ( i = 0; i < classNames.length; i++ ) { |
7500 | while ( ( clazz = classes[ j++ ] ) ) { |
7381 | className = classNames[ i ]; |
7501 | if ( cur.indexOf( " " + clazz + " " ) < 0 ) { |
7382 | if ( cur.indexOf( " " + className + " " ) < 0 ) { |
7502 | cur += clazz + " "; |
7383 | cur += className + " "; |
7503 | } |
7384 | } |
7504 | } |
7385 | } |
7505 | 7386 | ||
7506 | // Only assign if different to avoid unneeded rendering. |
7387 | // Only assign if different to avoid unneeded rendering. |
7507 | finalValue = stripAndCollapse( cur ); |
7388 | finalValue = stripAndCollapse( cur ); |
7508 | if ( curValue !== finalValue ) { |
7389 | if ( curValue !== finalValue ) { |
7509 | elem.setAttribute( "class", finalValue ); |
7390 | this.setAttribute( "class", finalValue ); |
7510 | } |
- | |
7511 | } |
7391 | } |
7512 | } |
7392 | } |
- | 7393 | } ); |
|
7513 | } |
7394 | } |
7514 | 7395 | ||
7515 | return this; |
7396 | return this; |
7516 | }, |
7397 | }, |
7517 | 7398 | ||
7518 | removeClass: function( value ) { |
7399 | removeClass: function( value ) { |
7519 | var classes, elem, cur, curValue, clazz, j, finalValue, |
7400 | var classNames, cur, curValue, className, i, finalValue; |
7520 | i = 0; |
- | |
7521 | 7401 | ||
7522 | if ( isFunction( value ) ) { |
7402 | if ( isFunction( value ) ) { |
7523 | return this.each( function( j ) { |
7403 | return this.each( function( j ) { |
7524 | jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); |
7404 | jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); |
7525 | } ); |
7405 | } ); |
Line 7527... | Line 7407... | ||
7527 | 7407 | ||
7528 | if ( !arguments.length ) { |
7408 | if ( !arguments.length ) { |
7529 | return this.attr( "class", "" ); |
7409 | return this.attr( "class", "" ); |
7530 | } |
7410 | } |
7531 | 7411 | ||
7532 | classes = classesToArray( value ); |
7412 | classNames = classesToArray( value ); |
7533 | 7413 | ||
7534 | if ( classes.length ) { |
7414 | if ( classNames.length ) { |
7535 | while ( ( elem = this[ i++ ] ) ) { |
7415 | return this.each( function() { |
7536 | curValue = getClass( elem ); |
7416 | curValue = getClass( this ); |
7537 | 7417 | ||
7538 | // This expression is here for better compressibility (see addClass) |
7418 | // This expression is here for better compressibility (see addClass) |
7539 | cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); |
7419 | cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); |
7540 | 7420 | ||
7541 | if ( cur ) { |
7421 | if ( cur ) { |
7542 | j = 0; |
7422 | for ( i = 0; i < classNames.length; i++ ) { |
7543 | while ( ( clazz = classes[ j++ ] ) ) { |
7423 | className = classNames[ i ]; |
7544 | 7424 | ||
7545 | // Remove *all* instances |
7425 | // Remove *all* instances |
7546 | while ( cur.indexOf( " " + clazz + " " ) > -1 ) { |
7426 | while ( cur.indexOf( " " + className + " " ) > -1 ) { |
7547 | cur = cur.replace( " " + clazz + " ", " " ); |
7427 | cur = cur.replace( " " + className + " ", " " ); |
7548 | } |
7428 | } |
7549 | } |
7429 | } |
7550 | 7430 | ||
7551 | // Only assign if different to avoid unneeded rendering. |
7431 | // Only assign if different to avoid unneeded rendering. |
7552 | finalValue = stripAndCollapse( cur ); |
7432 | finalValue = stripAndCollapse( cur ); |
7553 | if ( curValue !== finalValue ) { |
7433 | if ( curValue !== finalValue ) { |
7554 | elem.setAttribute( "class", finalValue ); |
7434 | this.setAttribute( "class", finalValue ); |
7555 | } |
- | |
7556 | } |
7435 | } |
7557 | } |
7436 | } |
- | 7437 | } ); |
|
7558 | } |
7438 | } |
7559 | 7439 | ||
7560 | return this; |
7440 | return this; |
7561 | }, |
7441 | }, |
7562 | 7442 | ||
7563 | toggleClass: function( value, stateVal ) { |
7443 | toggleClass: function( value, stateVal ) { |
- | 7444 | var classNames, className, i, self, |
|
7564 | var type = typeof value, |
7445 | type = typeof value, |
7565 | isValidValue = type === "string" || Array.isArray( value ); |
7446 | isValidValue = type === "string" || Array.isArray( value ); |
7566 | 7447 | ||
7567 | if ( typeof stateVal === "boolean" && isValidValue ) { |
- | |
7568 | return stateVal ? this.addClass( value ) : this.removeClass( value ); |
- | |
7569 | } |
- | |
7570 | - | ||
7571 | if ( isFunction( value ) ) { |
7448 | if ( isFunction( value ) ) { |
7572 | return this.each( function( i ) { |
7449 | return this.each( function( i ) { |
7573 | jQuery( this ).toggleClass( |
7450 | jQuery( this ).toggleClass( |
7574 | value.call( this, i, getClass( this ), stateVal ), |
7451 | value.call( this, i, getClass( this ), stateVal ), |
7575 | stateVal |
7452 | stateVal |
7576 | ); |
7453 | ); |
7577 | } ); |
7454 | } ); |
7578 | } |
7455 | } |
7579 | 7456 | ||
- | 7457 | if ( typeof stateVal === "boolean" && isValidValue ) { |
|
7580 | return this.each( function() { |
7458 | return stateVal ? this.addClass( value ) : this.removeClass( value ); |
- | 7459 | } |
|
- | 7460 | ||
7581 | var className, i, self, classNames; |
7461 | classNames = classesToArray( value ); |
7582 | 7462 | ||
- | 7463 | return this.each( function() { |
|
7583 | if ( isValidValue ) { |
7464 | if ( isValidValue ) { |
7584 | 7465 | ||
7585 | // Toggle individual class names |
7466 | // Toggle individual class names |
7586 | i = 0; |
- | |
7587 | self = jQuery( this ); |
7467 | self = jQuery( this ); |
7588 | classNames = classesToArray( value ); |
- | |
7589 | 7468 | ||
- | 7469 | for ( i = 0; i < classNames.length; i++ ) { |
|
7590 | while ( ( className = classNames[ i++ ] ) ) { |
7470 | className = classNames[ i ]; |
7591 | 7471 | ||
7592 | // Check each className given, space separated list |
7472 | // Check each className given, space separated list |
7593 | if ( self.hasClass( className ) ) { |
7473 | if ( self.hasClass( className ) ) { |
7594 | self.removeClass( className ); |
7474 | self.removeClass( className ); |
7595 | } else { |
7475 | } else { |
Line 7719... | Line 7599... | ||
7719 | var val = jQuery.find.attr( elem, "value" ); |
7599 | var val = jQuery.find.attr( elem, "value" ); |
7720 | return val != null ? |
7600 | return val != null ? |
7721 | val : |
7601 | val : |
7722 | 7602 | ||
7723 | // Support: IE <=10 - 11 only |
7603 | // Support: IE <=10 - 11 only |
7724 | // option.text throws exceptions (#14686, #14858) |
7604 | // option.text throws exceptions (trac-14686, trac-14858) |
7725 | // Strip and collapse whitespace |
7605 | // Strip and collapse whitespace |
7726 | // https://html.spec.whatwg.org/#strip-and-collapse-whitespace |
7606 | // https://html.spec.whatwg.org/#strip-and-collapse-whitespace |
7727 | stripAndCollapse( jQuery.text( elem ) ); |
7607 | stripAndCollapse( jQuery.text( elem ) ); |
7728 | } |
7608 | } |
7729 | }, |
7609 | }, |
Line 7746... | Line 7626... | ||
7746 | // Loop through all the selected options |
7626 | // Loop through all the selected options |
7747 | for ( ; i < max; i++ ) { |
7627 | for ( ; i < max; i++ ) { |
7748 | option = options[ i ]; |
7628 | option = options[ i ]; |
7749 | 7629 | ||
7750 | // Support: IE <=9 only |
7630 | // Support: IE <=9 only |
7751 | // IE8-9 doesn't update selected after form reset (#2551) |
7631 | // IE8-9 doesn't update selected after form reset (trac-2551) |
7752 | if ( ( option.selected || i === index ) && |
7632 | if ( ( option.selected || i === index ) && |
7753 | 7633 | ||
7754 | // Don't return options that are disabled or in a disabled optgroup |
7634 | // Don't return options that are disabled or in a disabled optgroup |
7755 | !option.disabled && |
7635 | !option.disabled && |
7756 | ( !option.parentNode.disabled || |
7636 | ( !option.parentNode.disabled || |
Line 7822... | Line 7702... | ||
7822 | 7702 | ||
7823 | 7703 | ||
7824 | // Return jQuery for attributes-only inclusion |
7704 | // Return jQuery for attributes-only inclusion |
7825 | 7705 | ||
7826 | 7706 | ||
- | 7707 | // Cross-browser xml parsing |
|
7827 | support.focusin = "onfocusin" in window; |
7708 | jQuery.parseXML = function( data ) { |
- | 7709 | var xml, parserErrorElem; |
|
- | 7710 | if ( !data || typeof data !== "string" ) { |
|
- | 7711 | return null; |
|
- | 7712 | } |
|
- | 7713 | ||
- | 7714 | // Support: IE 9 - 11 only |
|
- | 7715 | // IE throws on parseFromString with invalid input. |
|
- | 7716 | try { |
|
- | 7717 | xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); |
|
- | 7718 | } catch ( e ) {} |
|
- | 7719 | ||
- | 7720 | parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; |
|
- | 7721 | if ( !xml || parserErrorElem ) { |
|
- | 7722 | jQuery.error( "Invalid XML: " + ( |
|
- | 7723 | parserErrorElem ? |
|
- | 7724 | jQuery.map( parserErrorElem.childNodes, function( el ) { |
|
- | 7725 | return el.textContent; |
|
- | 7726 | } ).join( "\n" ) : |
|
- | 7727 | data |
|
- | 7728 | ) ); |
|
- | 7729 | } |
|
- | 7730 | return xml; |
|
- | 7731 | }; |
|
7828 | 7732 | ||
7829 | 7733 | ||
7830 | var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, |
7734 | var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, |
7831 | stopPropagationCallback = function( e ) { |
7735 | stopPropagationCallback = function( e ) { |
7832 | e.stopPropagation(); |
7736 | e.stopPropagation(); |
Line 7889... | Line 7793... | ||
7889 | special = jQuery.event.special[ type ] || {}; |
7793 | special = jQuery.event.special[ type ] || {}; |
7890 | if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { |
7794 | if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { |
7891 | return; |
7795 | return; |
7892 | } |
7796 | } |
7893 | 7797 | ||
7894 | // Determine event propagation path in advance, per W3C events spec (#9951) |
7798 | // Determine event propagation path in advance, per W3C events spec (trac-9951) |
7895 | // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) |
7799 | // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724) |
7896 | if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { |
7800 | if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { |
7897 | 7801 | ||
7898 | bubbleType = special.delegateType || type; |
7802 | bubbleType = special.delegateType || type; |
7899 | if ( !rfocusMorph.test( bubbleType + type ) ) { |
7803 | if ( !rfocusMorph.test( bubbleType + type ) ) { |
7900 | cur = cur.parentNode; |
7804 | cur = cur.parentNode; |
Line 7942... | Line 7846... | ||
7942 | if ( ( !special._default || |
7846 | if ( ( !special._default || |
7943 | special._default.apply( eventPath.pop(), data ) === false ) && |
7847 | special._default.apply( eventPath.pop(), data ) === false ) && |
7944 | acceptData( elem ) ) { |
7848 | acceptData( elem ) ) { |
7945 | 7849 | ||
7946 | // Call a native DOM method on the target with the same name as the event. |
7850 | // Call a native DOM method on the target with the same name as the event. |
7947 | // Don't do default actions on window, that's where global variables be (#6170) |
7851 | // Don't do default actions on window, that's where global variables be (trac-6170) |
7948 | if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { |
7852 | if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { |
7949 | 7853 | ||
7950 | // Don't re-trigger an onFOO event when we call its FOO() method |
7854 | // Don't re-trigger an onFOO event when we call its FOO() method |
7951 | tmp = elem[ ontype ]; |
7855 | tmp = elem[ ontype ]; |
7952 | 7856 | ||
Line 8010... | Line 7914... | ||
8010 | } |
7914 | } |
8011 | } |
7915 | } |
8012 | } ); |
7916 | } ); |
8013 | 7917 | ||
8014 | 7918 | ||
8015 | // Support: Firefox <=44 |
- | |
8016 | // Firefox doesn't have focus(in | out) events |
- | |
8017 | // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 |
- | |
8018 | // |
- | |
8019 | // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 |
- | |
8020 | // focus(in | out) events fire after focus & blur events, |
- | |
8021 | // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order |
- | |
8022 | // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 |
- | |
8023 | if ( !support.focusin ) { |
- | |
8024 | jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { |
- | |
8025 | - | ||
8026 | // Attach a single capturing handler on the document while someone wants focusin/focusout |
- | |
8027 | var handler = function( event ) { |
- | |
8028 | jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); |
- | |
8029 | }; |
- | |
8030 | - | ||
8031 | jQuery.event.special[ fix ] = { |
- | |
8032 | setup: function() { |
- | |
8033 | - | ||
8034 | // Handle: regular nodes (via `this.ownerDocument`), window |
- | |
8035 | // (via `this.document`) & document (via `this`). |
- | |
8036 | var doc = this.ownerDocument || this.document || this, |
- | |
8037 | attaches = dataPriv.access( doc, fix ); |
- | |
8038 | - | ||
8039 | if ( !attaches ) { |
- | |
8040 | doc.addEventListener( orig, handler, true ); |
- | |
8041 | } |
- | |
8042 | dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); |
- | |
8043 | }, |
- | |
8044 | teardown: function() { |
- | |
8045 | var doc = this.ownerDocument || this.document || this, |
- | |
8046 | attaches = dataPriv.access( doc, fix ) - 1; |
- | |
8047 | - | ||
8048 | if ( !attaches ) { |
- | |
8049 | doc.removeEventListener( orig, handler, true ); |
- | |
8050 | dataPriv.remove( doc, fix ); |
- | |
8051 | - | ||
8052 | } else { |
- | |
8053 | dataPriv.access( doc, fix, attaches ); |
- | |
8054 | } |
- | |
8055 | } |
- | |
8056 | }; |
- | |
8057 | } ); |
- | |
8058 | } |
- | |
8059 | - | ||
8060 | - | ||
8061 | // Cross-browser xml parsing |
- | |
8062 | jQuery.parseXML = function( data ) { |
- | |
8063 | var xml, parserErrorElem; |
- | |
8064 | if ( !data || typeof data !== "string" ) { |
- | |
8065 | return null; |
- | |
8066 | } |
- | |
8067 | - | ||
8068 | // Support: IE 9 - 11 only |
- | |
8069 | // IE throws on parseFromString with invalid input. |
- | |
8070 | try { |
- | |
8071 | xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); |
- | |
8072 | } catch ( e ) {} |
- | |
8073 | - | ||
8074 | parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; |
- | |
8075 | if ( !xml || parserErrorElem ) { |
- | |
8076 | jQuery.error( "Invalid XML: " + ( |
- | |
8077 | parserErrorElem ? |
- | |
8078 | jQuery.map( parserErrorElem.childNodes, function( el ) { |
- | |
8079 | return el.textContent; |
- | |
8080 | } ).join( "\n" ) : |
- | |
8081 | data |
- | |
8082 | ) ); |
- | |
8083 | } |
- | |
8084 | return xml; |
- | |
8085 | }; |
- | |
8086 | - | ||
8087 | - | ||
8088 | var |
7919 | var |
8089 | rbracket = /\[\]$/, |
7920 | rbracket = /\[\]$/, |
8090 | rCRLF = /\r?\n/g, |
7921 | rCRLF = /\r?\n/g, |
8091 | rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, |
7922 | rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, |
8092 | rsubmittable = /^(?:input|select|textarea|keygen)/i; |
7923 | rsubmittable = /^(?:input|select|textarea|keygen)/i; |
Line 8628... | Line 8459... | ||
8628 | this.off( selector, "**" ) : |
8459 | this.off( selector, "**" ) : |
8629 | this.off( types, selector || "**", fn ); |
8460 | this.off( types, selector || "**", fn ); |
8630 | }, |
8461 | }, |
8631 | 8462 | ||
8632 | hover: function( fnOver, fnOut ) { |
8463 | hover: function( fnOver, fnOut ) { |
- | 8464 | return this |
|
- | 8465 | .on( "mouseenter", fnOver ) |
|
8633 | return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); |
8466 | .on( "mouseleave", fnOut || fnOver ); |
8634 | } |
8467 | } |
8635 | } ); |
8468 | } ); |
8636 | 8469 | ||
8637 | jQuery.each( |
8470 | jQuery.each( |
8638 | ( "blur focus focusin focusout resize scroll click dblclick " + |
8471 | ( "blur focus focusin focusout resize scroll click dblclick " + |
Line 8652... | Line 8485... | ||
8652 | 8485 | ||
8653 | 8486 | ||
8654 | 8487 | ||
8655 | // Support: Android <=4.0 only |
8488 | // Support: Android <=4.0 only |
8656 | // Make sure we trim BOM and NBSP |
8489 | // Make sure we trim BOM and NBSP |
- | 8490 | // Require that the "whitespace run" starts from a non-whitespace |
|
- | 8491 | // to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position. |
|
8657 | var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; |
8492 | var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; |
8658 | 8493 | ||
8659 | // Bind a function to a context, optionally partially applying any |
8494 | // Bind a function to a context, optionally partially applying any |
8660 | // arguments. |
8495 | // arguments. |
8661 | // jQuery.proxy is deprecated to promote standards (specifically Function#bind) |
8496 | // jQuery.proxy is deprecated to promote standards (specifically Function#bind) |
8662 | // However, it is not slated for removal any time soon |
8497 | // However, it is not slated for removal any time soon |
Line 8719... | Line 8554... | ||
8719 | }; |
8554 | }; |
8720 | 8555 | ||
8721 | jQuery.trim = function( text ) { |
8556 | jQuery.trim = function( text ) { |
8722 | return text == null ? |
8557 | return text == null ? |
8723 | "" : |
8558 | "" : |
8724 | ( text + "" ).replace( rtrim, "" ); |
8559 | ( text + "" ).replace( rtrim, "$1" ); |
8725 | }; |
8560 | }; |
8726 | 8561 | ||
8727 | 8562 | ||
8728 | 8563 | ||
8729 | // Register as a named AMD module, since jQuery can be concatenated with other |
8564 | // Register as a named AMD module, since jQuery can be concatenated with other |
Line 8767... | Line 8602... | ||
8767 | 8602 | ||
8768 | return jQuery; |
8603 | return jQuery; |
8769 | }; |
8604 | }; |
8770 | 8605 | ||
8771 | // Expose jQuery and $ identifiers, even in AMD |
8606 | // Expose jQuery and $ identifiers, even in AMD |
8772 | // (#7102#comment:10, https://github.com/jquery/jquery/pull/557) |
8607 | // (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557) |
8773 | // and CommonJS for browser emulators (#13566) |
8608 | // and CommonJS for browser emulators (trac-13566) |
8774 | if ( typeof noGlobal === "undefined" ) { |
8609 | if ( typeof noGlobal === "undefined" ) { |
8775 | window.jQuery = window.$ = jQuery; |
8610 | window.jQuery = window.$ = jQuery; |
8776 | } |
8611 | } |
8777 | 8612 | ||
8778 | 8613 |