1/*! 2 * jQuery JavaScript Library v3.6.0 3 * https://jquery.com/ 4 * 5 * Includes Sizzle.js 6 * https://sizzlejs.com/ 7 * 8 * Copyright OpenJS Foundation and other contributors 9 * Released under the MIT license 10 * https://jquery.org/license 11 */ 12( function( global, factory ) { 13 14 "use strict"; 15 16 if ( typeof module === "object" && typeof module.exports === "object" ) { 17 18 // For CommonJS and CommonJS-like environments where a proper `window` 19 // is present, execute the factory and get jQuery. 20 // For environments that do not have a `window` with a `document` 21 // (such as Node.js), expose a factory as module.exports. 22 // This accentuates the need for the creation of a real `window`. 23 // e.g. var jQuery = require("jquery")(window); 24 // See ticket #14549 for more info. 25 module.exports = global.document ? 26 factory( global, true ) : 27 function( w ) { 28 if ( !w.document ) { 29 throw new Error( "jQuery requires a window with a document" ); 30 } 31 return factory( w ); 32 }; 33 } else { 34 factory( global ); 35 } 36 37// Pass this if window is not defined yet 38} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 39 40// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 41// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 42// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common 43// enough that all such attempts are guarded in a try block. 44"use strict"; 45 46var arr = []; 47 48var getProto = Object.getPrototypeOf; 49 50var slice = arr.slice; 51 52var flat = arr.flat ? function( array ) { 53 return arr.flat.call( array ); 54} : function( array ) { 55 return arr.concat.apply( [], array ); 56}; 57 58 59var push = arr.push; 60 61var indexOf = arr.indexOf; 62 63var class2type = {}; 64 65var toString = class2type.toString; 66 67var hasOwn = class2type.hasOwnProperty; 68 69var fnToString = hasOwn.toString; 70 71var ObjectFunctionString = fnToString.call( Object ); 72 73var support = {}; 74 75var isFunction = function isFunction( obj ) { 76 77 // Support: Chrome <=57, Firefox <=52 78 // In some browsers, typeof returns "function" for HTML <object> elements 79 // (i.e., `typeof document.createElement( "object" ) === "function"`). 80 // We don't want to classify *any* DOM node as a function. 81 // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 82 // Plus for old WebKit, typeof returns "function" for HTML collections 83 // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) 84 return typeof obj === "function" && typeof obj.nodeType !== "number" && 85 typeof obj.item !== "function"; 86 }; 87 88 89var isWindow = function isWindow( obj ) { 90 return obj != null && obj === obj.window; 91 }; 92 93 94var document = window.document; 95 96 97 98 var preservedScriptAttributes = { 99 type: true, 100 src: true, 101 nonce: true, 102 noModule: true 103 }; 104 105 function DOMEval( code, node, doc ) { 106 doc = doc || document; 107 108 var i, val, 109 script = doc.createElement( "script" ); 110 111 script.text = code; 112 if ( node ) { 113 for ( i in preservedScriptAttributes ) { 114 115 // Support: Firefox 64+, Edge 18+ 116 // Some browsers don't support the "nonce" property on scripts. 117 // On the other hand, just using `getAttribute` is not enough as 118 // the `nonce` attribute is reset to an empty string whenever it 119 // becomes browsing-context connected. 120 // See https://github.com/whatwg/html/issues/2369 121 // See https://html.spec.whatwg.org/#nonce-attributes 122 // The `node.getAttribute` check was added for the sake of 123 // `jQuery.globalEval` so that it can fake a nonce-containing node 124 // via an object. 125 val = node[ i ] || node.getAttribute && node.getAttribute( i ); 126 if ( val ) { 127 script.setAttribute( i, val ); 128 } 129 } 130 } 131 doc.head.appendChild( script ).parentNode.removeChild( script ); 132 } 133 134 135function toType( obj ) { 136 if ( obj == null ) { 137 return obj + ""; 138 } 139 140 // Support: Android <=2.3 only (functionish RegExp) 141 return typeof obj === "object" || typeof obj === "function" ? 142 class2type[ toString.call( obj ) ] || "object" : 143 typeof obj; 144} 145/* global Symbol */ 146// Defining this global in .eslintrc.json would create a danger of using the global 147// unguarded in another place, it seems safer to define global only for this module 148 149 150 151var 152 version = "3.6.0", 153 154 // Define a local copy of jQuery 155 jQuery = function( selector, context ) { 156 157 // The jQuery object is actually just the init constructor 'enhanced' 158 // Need init if jQuery is called (just allow error to be thrown if not included) 159 return new jQuery.fn.init( selector, context ); 160 }; 161 162jQuery.fn = jQuery.prototype = { 163 164 // The current version of jQuery being used 165 jquery: version, 166 167 constructor: jQuery, 168 169 // The default length of a jQuery object is 0 170 length: 0, 171 172 toArray: function() { 173 return slice.call( this ); 174 }, 175 176 // Get the Nth element in the matched element set OR 177 // Get the whole matched element set as a clean array 178 get: function( num ) { 179 180 // Return all the elements in a clean array 181 if ( num == null ) { 182 return slice.call( this ); 183 } 184 185 // Return just the one element from the set 186 return num < 0 ? this[ num + this.length ] : this[ num ]; 187 }, 188 189 // Take an array of elements and push it onto the stack 190 // (returning the new matched element set) 191 pushStack: function( elems ) { 192 193 // Build a new jQuery matched element set 194 var ret = jQuery.merge( this.constructor(), elems ); 195 196 // Add the old object onto the stack (as a reference) 197 ret.prevObject = this; 198 199 // Return the newly-formed element set 200 return ret; 201 }, 202 203 // Execute a callback for every element in the matched set. 204 each: function( callback ) { 205 return jQuery.each( this, callback ); 206 }, 207 208 map: function( callback ) { 209 return this.pushStack( jQuery.map( this, function( elem, i ) { 210 return callback.call( elem, i, elem ); 211 } ) ); 212 }, 213 214 slice: function() { 215 return this.pushStack( slice.apply( this, arguments ) ); 216 }, 217 218 first: function() { 219 return this.eq( 0 ); 220 }, 221 222 last: function() { 223 return this.eq( -1 ); 224 }, 225 226 even: function() { 227 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 228 return ( i + 1 ) % 2; 229 } ) ); 230 }, 231 232 odd: function() { 233 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 234 return i % 2; 235 } ) ); 236 }, 237 238 eq: function( i ) { 239 var len = this.length, 240 j = +i + ( i < 0 ? len : 0 ); 241 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 242 }, 243 244 end: function() { 245 return this.prevObject || this.constructor(); 246 }, 247 248 // For internal use only. 249 // Behaves like an Array's method, not like a jQuery method. 250 push: push, 251 sort: arr.sort, 252 splice: arr.splice 253}; 254 255jQuery.extend = jQuery.fn.extend = function() { 256 var options, name, src, copy, copyIsArray, clone, 257 target = arguments[ 0 ] || {}, 258 i = 1, 259 length = arguments.length, 260 deep = false; 261 262 // Handle a deep copy situation 263 if ( typeof target === "boolean" ) { 264 deep = target; 265 266 // Skip the boolean and the target 267 target = arguments[ i ] || {}; 268 i++; 269 } 270 271 // Handle case when target is a string or something (possible in deep copy) 272 if ( typeof target !== "object" && !isFunction( target ) ) { 273 target = {}; 274 } 275 276 // Extend jQuery itself if only one argument is passed 277 if ( i === length ) { 278 target = this; 279 i--; 280 } 281 282 for ( ; i < length; i++ ) { 283 284 // Only deal with non-null/undefined values 285 if ( ( options = arguments[ i ] ) != null ) { 286 287 // Extend the base object 288 for ( name in options ) { 289 copy = options[ name ]; 290 291 // Prevent Object.prototype pollution 292 // Prevent never-ending loop 293 if ( name === "__proto__" || target === copy ) { 294 continue; 295 } 296 297 // Recurse if we're merging plain objects or arrays 298 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 299 ( copyIsArray = Array.isArray( copy ) ) ) ) { 300 src = target[ name ]; 301 302 // Ensure proper type for the source value 303 if ( copyIsArray && !Array.isArray( src ) ) { 304 clone = []; 305 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { 306 clone = {}; 307 } else { 308 clone = src; 309 } 310 copyIsArray = false; 311 312 // Never move original objects, clone them 313 target[ name ] = jQuery.extend( deep, clone, copy ); 314 315 // Don't bring in undefined values 316 } else if ( copy !== undefined ) { 317 target[ name ] = copy; 318 } 319 } 320 } 321 } 322 323 // Return the modified object 324 return target; 325}; 326 327jQuery.extend( { 328 329 // Unique for each copy of jQuery on the page 330 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 331 332 // Assume jQuery is ready without the ready module 333 isReady: true, 334 335 error: function( msg ) { 336 throw new Error( msg ); 337 }, 338 339 noop: function() {}, 340 341 isPlainObject: function( obj ) { 342 var proto, Ctor; 343 344 // Detect obvious negatives 345 // Use toString instead of jQuery.type to catch host objects 346 if ( !obj || toString.call( obj ) !== "[object Object]" ) { 347 return false; 348 } 349 350 proto = getProto( obj ); 351 352 // Objects with no prototype (e.g., `Object.create( null )`) are plain 353 if ( !proto ) { 354 return true; 355 } 356 357 // Objects with prototype are plain iff they were constructed by a global Object function 358 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; 359 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; 360 }, 361 362 isEmptyObject: function( obj ) { 363 var name; 364 365 for ( name in obj ) { 366 return false; 367 } 368 return true; 369 }, 370 371 // Evaluates a script in a provided context; falls back to the global one 372 // if not specified. 373 globalEval: function( code, options, doc ) { 374 DOMEval( code, { nonce: options && options.nonce }, doc ); 375 }, 376 377 each: function( obj, callback ) { 378 var length, i = 0; 379 380 if ( isArrayLike( obj ) ) { 381 length = obj.length; 382 for ( ; i < length; i++ ) { 383 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 384 break; 385 } 386 } 387 } else { 388 for ( i in obj ) { 389 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 390 break; 391 } 392 } 393 } 394 395 return obj; 396 }, 397 398 // results is for internal usage only 399 makeArray: function( arr, results ) { 400 var ret = results || []; 401 402 if ( arr != null ) { 403 if ( isArrayLike( Object( arr ) ) ) { 404 jQuery.merge( ret, 405 typeof arr === "string" ? 406 [ arr ] : arr 407 ); 408 } else { 409 push.call( ret, arr ); 410 } 411 } 412 413 return ret; 414 }, 415 416 inArray: function( elem, arr, i ) { 417 return arr == null ? -1 : indexOf.call( arr, elem, i ); 418 }, 419 420 // Support: Android <=4.0 only, PhantomJS 1 only 421 // push.apply(_, arraylike) throws on ancient WebKit 422 merge: function( first, second ) { 423 var len = +second.length, 424 j = 0, 425 i = first.length; 426 427 for ( ; j < len; j++ ) { 428 first[ i++ ] = second[ j ]; 429 } 430 431 first.length = i; 432 433 return first; 434 }, 435 436 grep: function( elems, callback, invert ) { 437 var callbackInverse, 438 matches = [], 439 i = 0, 440 length = elems.length, 441 callbackExpect = !invert; 442 443 // Go through the array, only saving the items 444 // that pass the validator function 445 for ( ; i < length; i++ ) { 446 callbackInverse = !callback( elems[ i ], i ); 447 if ( callbackInverse !== callbackExpect ) { 448 matches.push( elems[ i ] ); 449 } 450 } 451 452 return matches; 453 }, 454 455 // arg is for internal usage only 456 map: function( elems, callback, arg ) { 457 var length, value, 458 i = 0, 459 ret = []; 460 461 // Go through the array, translating each of the items to their new values 462 if ( isArrayLike( elems ) ) { 463 length = elems.length; 464 for ( ; i < length; i++ ) { 465 value = callback( elems[ i ], i, arg ); 466 467 if ( value != null ) { 468 ret.push( value ); 469 } 470 } 471 472 // Go through every key on the object, 473 } else { 474 for ( i in elems ) { 475 value = callback( elems[ i ], i, arg ); 476 477 if ( value != null ) { 478 ret.push( value ); 479 } 480 } 481 } 482 483 // Flatten any nested arrays 484 return flat( ret ); 485 }, 486 487 // A global GUID counter for objects 488 guid: 1, 489 490 // jQuery.support is not used in Core but other projects attach their 491 // properties to it so it needs to exist. 492 support: support 493} ); 494 495if ( typeof Symbol === "function" ) { 496 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 497} 498 499// Populate the class2type map 500jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 501 function( _i, name ) { 502 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 503 } ); 504 505function isArrayLike( obj ) { 506 507 // Support: real iOS 8.2 only (not reproducible in simulator) 508 // `in` check used to prevent JIT error (gh-2145) 509 // hasOwn isn't used here due to false negatives 510 // regarding Nodelist length in IE 511 var length = !!obj && "length" in obj && obj.length, 512 type = toType( obj ); 513 514 if ( isFunction( obj ) || isWindow( obj ) ) { 515 return false; 516 } 517 518 return type === "array" || length === 0 || 519 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 520} 521var Sizzle = 522/*! 523 * Sizzle CSS Selector Engine v2.3.6 524 * https://sizzlejs.com/ 525 * 526 * Copyright JS Foundation and other contributors 527 * Released under the MIT license 528 * https://js.foundation/ 529 * 530 * Date: 2021-02-16 531 */ 532( function( window ) { 533var i, 534 support, 535 Expr, 536 getText, 537 isXML, 538 tokenize, 539 compile, 540 select, 541 outermostContext, 542 sortInput, 543 hasDuplicate, 544 545 // Local document vars 546 setDocument, 547 document, 548 docElem, 549 documentIsHTML, 550 rbuggyQSA, 551 rbuggyMatches, 552 matches, 553 contains, 554 555 // Instance-specific data 556 expando = "sizzle" + 1 * new Date(), 557 preferredDoc = window.document, 558 dirruns = 0, 559 done = 0, 560 classCache = createCache(), 561 tokenCache = createCache(), 562 compilerCache = createCache(), 563 nonnativeSelectorCache = createCache(), 564 sortOrder = function( a, b ) { 565 if ( a === b ) { 566 hasDuplicate = true; 567 } 568 return 0; 569 }, 570 571 // Instance methods 572 hasOwn = ( {} ).hasOwnProperty, 573 arr = [], 574 pop = arr.pop, 575 pushNative = arr.push, 576 push = arr.push, 577 slice = arr.slice, 578 579 // Use a stripped-down indexOf as it's faster than native 580 // https://jsperf.com/thor-indexof-vs-for/5 581 indexOf = function( list, elem ) { 582 var i = 0, 583 len = list.length; 584 for ( ; i < len; i++ ) { 585 if ( list[ i ] === elem ) { 586 return i; 587 } 588 } 589 return -1; 590 }, 591 592 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" + 593 "ismap|loop|multiple|open|readonly|required|scoped", 594 595 // Regular expressions 596 597 // http://www.w3.org/TR/css3-selectors/#whitespace 598 whitespace = "[\\x20\\t\\r\\n\\f]", 599 600 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram 601 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + 602 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", 603 604 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors 605 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 606 607 // Operator (capture 2) 608 "*([*^$|!~]?=)" + whitespace + 609 610 // "Attribute values must be CSS identifiers [capture 5] 611 // or strings [capture 3 or capture 4]" 612 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + 613 whitespace + "*\\]", 614 615 pseudos = ":(" + identifier + ")(?:\\((" + 616 617 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 618 // 1. quoted (capture 3; capture 4 or capture 5) 619 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 620 621 // 2. simple (capture 6) 622 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 623 624 // 3. anything else (capture 2) 625 ".*" + 626 ")\\)|)", 627 628 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 629 rwhitespace = new RegExp( whitespace + "+", "g" ), 630 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + 631 whitespace + "+$", "g" ), 632 633 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 634 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + 635 "*" ), 636 rdescend = new RegExp( whitespace + "|>" ), 637 638 rpseudo = new RegExp( pseudos ), 639 ridentifier = new RegExp( "^" + identifier + "$" ), 640 641 matchExpr = { 642 "ID": new RegExp( "^#(" + identifier + ")" ), 643 "CLASS": new RegExp( "^\\.(" + identifier + ")" ), 644 "TAG": new RegExp( "^(" + identifier + "|[*])" ), 645 "ATTR": new RegExp( "^" + attributes ), 646 "PSEUDO": new RegExp( "^" + pseudos ), 647 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + 648 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + 649 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 650 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), 651 652 // For use in libraries implementing .is() 653 // We use this for POS matching in `select` 654 "needsContext": new RegExp( "^" + whitespace + 655 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + 656 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 657 }, 658 659 rhtml = /HTML$/i, 660 rinputs = /^(?:input|select|textarea|button)$/i, 661 rheader = /^h\d$/i, 662 663 rnative = /^[^{]+\{\s*\[native \w/, 664 665 // Easily-parseable/retrievable ID or TAG or CLASS selectors 666 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 667 668 rsibling = /[+~]/, 669 670 // CSS escapes 671 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters 672 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ), 673 funescape = function( escape, nonHex ) { 674 var high = "0x" + escape.slice( 1 ) - 0x10000; 675 676 return nonHex ? 677 678 // Strip the backslash prefix from a non-hex escape sequence 679 nonHex : 680 681 // Replace a hexadecimal escape sequence with the encoded Unicode code point 682 // Support: IE <=11+ 683 // For values outside the Basic Multilingual Plane (BMP), manually construct a 684 // surrogate pair 685 high < 0 ? 686 String.fromCharCode( high + 0x10000 ) : 687 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 688 }, 689 690 // CSS string/identifier serialization 691 // https://drafts.csswg.org/cssom/#common-serializing-idioms 692 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, 693 fcssescape = function( ch, asCodePoint ) { 694 if ( asCodePoint ) { 695 696 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 697 if ( ch === "\0" ) { 698 return "\uFFFD"; 699 } 700 701 // Control characters and (dependent upon position) numbers get escaped as code points 702 return ch.slice( 0, -1 ) + "\\" + 703 ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 704 } 705 706 // Other potentially-special ASCII characters get backslash-escaped 707 return "\\" + ch; 708 }, 709 710 // Used for iframes 711 // See setDocument() 712 // Removing the function wrapper causes a "Permission Denied" 713 // error in IE 714 unloadHandler = function() { 715 setDocument(); 716 }, 717 718 inDisabledFieldset = addCombinator( 719 function( elem ) { 720 return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; 721 }, 722 { dir: "parentNode", next: "legend" } 723 ); 724 725// Optimize for push.apply( _, NodeList ) 726try { 727 push.apply( 728 ( arr = slice.call( preferredDoc.childNodes ) ), 729 preferredDoc.childNodes 730 ); 731 732 // Support: Android<4.0 733 // Detect silently failing push.apply 734 // eslint-disable-next-line no-unused-expressions 735 arr[ preferredDoc.childNodes.length ].nodeType; 736} catch ( e ) { 737 push = { apply: arr.length ? 738 739 // Leverage slice if possible 740 function( target, els ) { 741 pushNative.apply( target, slice.call( els ) ); 742 } : 743 744 // Support: IE<9 745 // Otherwise append directly 746 function( target, els ) { 747 var j = target.length, 748 i = 0; 749 750 // Can't trust NodeList.length 751 while ( ( target[ j++ ] = els[ i++ ] ) ) {} 752 target.length = j - 1; 753 } 754 }; 755} 756 757function Sizzle( selector, context, results, seed ) { 758 var m, i, elem, nid, match, groups, newSelector, 759 newContext = context && context.ownerDocument, 760 761 // nodeType defaults to 9, since context defaults to document 762 nodeType = context ? context.nodeType : 9; 763 764 results = results || []; 765 766 // Return early from calls with invalid selector or context 767 if ( typeof selector !== "string" || !selector || 768 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 769 770 return results; 771 } 772 773 // Try to shortcut find operations (as opposed to filters) in HTML documents 774 if ( !seed ) { 775 setDocument( context ); 776 context = context || document; 777 778 if ( documentIsHTML ) { 779 780 // If the selector is sufficiently simple, try using a "get*By*" DOM method 781 // (excepting DocumentFragment context, where the methods don't exist) 782 if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { 783 784 // ID selector 785 if ( ( m = match[ 1 ] ) ) { 786 787 // Document context 788 if ( nodeType === 9 ) { 789 if ( ( elem = context.getElementById( m ) ) ) { 790 791 // Support: IE, Opera, Webkit 792 // TODO: identify versions 793 // getElementById can match elements by name instead of ID 794 if ( elem.id === m ) { 795 results.push( elem ); 796 return results; 797 } 798 } else { 799 return results; 800 } 801 802 // Element context 803 } else { 804 805 // Support: IE, Opera, Webkit 806 // TODO: identify versions 807 // getElementById can match elements by name instead of ID 808 if ( newContext && ( elem = newContext.getElementById( m ) ) && 809 contains( context, elem ) && 810 elem.id === m ) { 811 812 results.push( elem ); 813 return results; 814 } 815 } 816 817 // Type selector 818 } else if ( match[ 2 ] ) { 819 push.apply( results, context.getElementsByTagName( selector ) ); 820 return results; 821 822 // Class selector 823 } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName && 824 context.getElementsByClassName ) { 825 826 push.apply( results, context.getElementsByClassName( m ) ); 827 return results; 828 } 829 } 830 831 // Take advantage of querySelectorAll 832 if ( support.qsa && 833 !nonnativeSelectorCache[ selector + " " ] && 834 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) && 835 836 // Support: IE 8 only 837 // Exclude object elements 838 ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) { 839 840 newSelector = selector; 841 newContext = context; 842 843 // qSA considers elements outside a scoping root when evaluating child or 844 // descendant combinators, which is not what we want. 845 // In such cases, we work around the behavior by prefixing every selector in the 846 // list with an ID selector referencing the scope context. 847 // The technique has to be used as well when a leading combinator is used 848 // as such selectors are not recognized by querySelectorAll. 849 // Thanks to Andrew Dupont for this technique. 850 if ( nodeType === 1 && 851 ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) { 852 853 // Expand context for sibling selectors 854 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 855 context; 856 857 // We can use :scope instead of the ID hack if the browser 858 // supports it & if we're not changing the context. 859 if ( newContext !== context || !support.scope ) { 860 861 // Capture the context ID, setting it first if necessary 862 if ( ( nid = context.getAttribute( "id" ) ) ) { 863 nid = nid.replace( rcssescape, fcssescape ); 864 } else { 865 context.setAttribute( "id", ( nid = expando ) ); 866 } 867 } 868 869 // Prefix every selector in the list 870 groups = tokenize( selector ); 871 i = groups.length; 872 while ( i-- ) { 873 groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + 874 toSelector( groups[ i ] ); 875 } 876 newSelector = groups.join( "," ); 877 } 878 879 try { 880 push.apply( results, 881 newContext.querySelectorAll( newSelector ) 882 ); 883 return results; 884 } catch ( qsaError ) { 885 nonnativeSelectorCache( selector, true ); 886 } finally { 887 if ( nid === expando ) { 888 context.removeAttribute( "id" ); 889 } 890 } 891 } 892 } 893 } 894 895 // All others 896 return select( selector.replace( rtrim, "$1" ), context, results, seed ); 897} 898 899/** 900 * Create key-value caches of limited size 901 * @returns {function(string, object)} Returns the Object data after storing it on itself with 902 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 903 * deleting the oldest entry 904 */ 905function createCache() { 906 var keys = []; 907 908 function cache( key, value ) { 909 910 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) 911 if ( keys.push( key + " " ) > Expr.cacheLength ) { 912 913 // Only keep the most recent entries 914 delete cache[ keys.shift() ]; 915 } 916 return ( cache[ key + " " ] = value ); 917 } 918 return cache; 919} 920 921/** 922 * Mark a function for special use by Sizzle 923 * @param {Function} fn The function to mark 924 */ 925function markFunction( fn ) { 926 fn[ expando ] = true; 927 return fn; 928} 929 930/** 931 * Support testing using an element 932 * @param {Function} fn Passed the created element and returns a boolean result 933 */ 934function assert( fn ) { 935 var el = document.createElement( "fieldset" ); 936 937 try { 938 return !!fn( el ); 939 } catch ( e ) { 940 return false; 941 } finally { 942 943 // Remove from its parent by default 944 if ( el.parentNode ) { 945 el.parentNode.removeChild( el ); 946 } 947 948 // release memory in IE 949 el = null; 950 } 951} 952 953/** 954 * Adds the same handler for all of the specified attrs 955 * @param {String} attrs Pipe-separated list of attributes 956 * @param {Function} handler The method that will be applied 957 */ 958function addHandle( attrs, handler ) { 959 var arr = attrs.split( "|" ), 960 i = arr.length; 961 962 while ( i-- ) { 963 Expr.attrHandle[ arr[ i ] ] = handler; 964 } 965} 966 967/** 968 * Checks document order of two siblings 969 * @param {Element} a 970 * @param {Element} b 971 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 972 */ 973function siblingCheck( a, b ) { 974 var cur = b && a, 975 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 976 a.sourceIndex - b.sourceIndex; 977 978 // Use IE sourceIndex if available on both nodes 979 if ( diff ) { 980 return diff; 981 } 982 983 // Check if b follows a 984 if ( cur ) { 985 while ( ( cur = cur.nextSibling ) ) { 986 if ( cur === b ) { 987 return -1; 988 } 989 } 990 } 991 992 return a ? 1 : -1; 993} 994 995/** 996 * Returns a function to use in pseudos for input types 997 * @param {String} type 998 */ 999function createInputPseudo( type ) { 1000 return function( elem ) { 1001 var name = elem.nodeName.toLowerCase(); 1002 return name === "input" && elem.type === type; 1003 }; 1004} 1005 1006/** 1007 * Returns a function to use in pseudos for buttons 1008 * @param {String} type 1009 */ 1010function createButtonPseudo( type ) { 1011 return function( elem ) { 1012 var name = elem.nodeName.toLowerCase(); 1013 return ( name === "input" || name === "button" ) && elem.type === type; 1014 }; 1015} 1016 1017/** 1018 * Returns a function to use in pseudos for :enabled/:disabled 1019 * @param {Boolean} disabled true for :disabled; false for :enabled 1020 */ 1021function createDisabledPseudo( disabled ) { 1022 1023 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 1024 return function( elem ) { 1025 1026 // Only certain elements can match :enabled or :disabled 1027 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 1028 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 1029 if ( "form" in elem ) { 1030 1031 // Check for inherited disabledness on relevant non-disabled elements: 1032 // * listed form-associated elements in a disabled fieldset 1033 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 1034 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 1035 // * option elements in a disabled optgroup 1036 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 1037 // All such elements have a "form" property. 1038 if ( elem.parentNode && elem.disabled === false ) { 1039 1040 // Option elements defer to a parent optgroup if present 1041 if ( "label" in elem ) { 1042 if ( "label" in elem.parentNode ) { 1043 return elem.parentNode.disabled === disabled; 1044 } else { 1045 return elem.disabled === disabled; 1046 } 1047 } 1048 1049 // Support: IE 6 - 11 1050 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 1051 return elem.isDisabled === disabled || 1052 1053 // Where there is no isDisabled, check manually 1054 /* jshint -W018 */ 1055 elem.isDisabled !== !disabled && 1056 inDisabledFieldset( elem ) === disabled; 1057 } 1058 1059 return elem.disabled === disabled; 1060 1061 // Try to winnow out elements that can't be disabled before trusting the disabled property. 1062 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 1063 // even exist on them, let alone have a boolean value. 1064 } else if ( "label" in elem ) { 1065 return elem.disabled === disabled; 1066 } 1067 1068 // Remaining elements are neither :enabled nor :disabled 1069 return false; 1070 }; 1071} 1072 1073/** 1074 * Returns a function to use in pseudos for positionals 1075 * @param {Function} fn 1076 */ 1077function createPositionalPseudo( fn ) { 1078 return markFunction( function( argument ) { 1079 argument = +argument; 1080 return markFunction( function( seed, matches ) { 1081 var j, 1082 matchIndexes = fn( [], seed.length, argument ), 1083 i = matchIndexes.length; 1084 1085 // Match elements found at the specified indexes 1086 while ( i-- ) { 1087 if ( seed[ ( j = matchIndexes[ i ] ) ] ) { 1088 seed[ j ] = !( matches[ j ] = seed[ j ] ); 1089 } 1090 } 1091 } ); 1092 } ); 1093} 1094 1095/** 1096 * Checks a node for validity as a Sizzle context 1097 * @param {Element|Object=} context 1098 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 1099 */ 1100function testContext( context ) { 1101 return context && typeof context.getElementsByTagName !== "undefined" && context; 1102} 1103 1104// Expose support vars for convenience 1105support = Sizzle.support = {}; 1106 1107/** 1108 * Detects XML nodes 1109 * @param {Element|Object} elem An element or a document 1110 * @returns {Boolean} True iff elem is a non-HTML XML node 1111 */ 1112isXML = Sizzle.isXML = function( elem ) { 1113 var namespace = elem && elem.namespaceURI, 1114 docElem = elem && ( elem.ownerDocument || elem ).documentElement; 1115 1116 // Support: IE <=8 1117 // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes 1118 // https://bugs.jquery.com/ticket/4833 1119 return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); 1120}; 1121 1122/** 1123 * Sets document-related variables once based on the current document 1124 * @param {Element|Object} [doc] An element or document object to use to set the document 1125 * @returns {Object} Returns the current document 1126 */ 1127setDocument = Sizzle.setDocument = function( node ) { 1128 var hasCompare, subWindow, 1129 doc = node ? node.ownerDocument || node : preferredDoc; 1130 1131 // Return early if doc is invalid or already selected 1132 // Support: IE 11+, Edge 17 - 18+ 1133 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1134 // two documents; shallow comparisons work. 1135 // eslint-disable-next-line eqeqeq 1136 if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { 1137 return document; 1138 } 1139 1140 // Update global variables 1141 document = doc; 1142 docElem = document.documentElement; 1143 documentIsHTML = !isXML( document ); 1144 1145 // Support: IE 9 - 11+, Edge 12 - 18+ 1146 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) 1147 // Support: IE 11+, Edge 17 - 18+ 1148 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1149 // two documents; shallow comparisons work. 1150 // eslint-disable-next-line eqeqeq 1151 if ( preferredDoc != document && 1152 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { 1153 1154 // Support: IE 11, Edge 1155 if ( subWindow.addEventListener ) { 1156 subWindow.addEventListener( "unload", unloadHandler, false ); 1157 1158 // Support: IE 9 - 10 only 1159 } else if ( subWindow.attachEvent ) { 1160 subWindow.attachEvent( "onunload", unloadHandler ); 1161 } 1162 } 1163 1164 // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only, 1165 // Safari 4 - 5 only, Opera <=11.6 - 12.x only 1166 // IE/Edge & older browsers don't support the :scope pseudo-class. 1167 // Support: Safari 6.0 only 1168 // Safari 6.0 supports :scope but it's an alias of :root there. 1169 support.scope = assert( function( el ) { 1170 docElem.appendChild( el ).appendChild( document.createElement( "div" ) ); 1171 return typeof el.querySelectorAll !== "undefined" && 1172 !el.querySelectorAll( ":scope fieldset div" ).length; 1173 } ); 1174 1175 /* Attributes 1176 ---------------------------------------------------------------------- */ 1177 1178 // Support: IE<8 1179 // Verify that getAttribute really returns attributes and not properties 1180 // (excepting IE8 booleans) 1181 support.attributes = assert( function( el ) { 1182 el.className = "i"; 1183 return !el.getAttribute( "className" ); 1184 } ); 1185 1186 /* getElement(s)By* 1187 ---------------------------------------------------------------------- */ 1188 1189 // Check if getElementsByTagName("*") returns only elements 1190 support.getElementsByTagName = assert( function( el ) { 1191 el.appendChild( document.createComment( "" ) ); 1192 return !el.getElementsByTagName( "*" ).length; 1193 } ); 1194 1195 // Support: IE<9 1196 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); 1197 1198 // Support: IE<10 1199 // Check if getElementById returns elements by name 1200 // The broken getElementById methods don't pick up programmatically-set names, 1201 // so use a roundabout getElementsByName test 1202 support.getById = assert( function( el ) { 1203 docElem.appendChild( el ).id = expando; 1204 return !document.getElementsByName || !document.getElementsByName( expando ).length; 1205 } ); 1206 1207 // ID filter and find 1208 if ( support.getById ) { 1209 Expr.filter[ "ID" ] = function( id ) { 1210 var attrId = id.replace( runescape, funescape ); 1211 return function( elem ) { 1212 return elem.getAttribute( "id" ) === attrId; 1213 }; 1214 }; 1215 Expr.find[ "ID" ] = function( id, context ) { 1216 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1217 var elem = context.getElementById( id ); 1218 return elem ? [ elem ] : []; 1219 } 1220 }; 1221 } else { 1222 Expr.filter[ "ID" ] = function( id ) { 1223 var attrId = id.replace( runescape, funescape ); 1224 return function( elem ) { 1225 var node = typeof elem.getAttributeNode !== "undefined" && 1226 elem.getAttributeNode( "id" ); 1227 return node && node.value === attrId; 1228 }; 1229 }; 1230 1231 // Support: IE 6 - 7 only 1232 // getElementById is not reliable as a find shortcut 1233 Expr.find[ "ID" ] = function( id, context ) { 1234 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1235 var node, i, elems, 1236 elem = context.getElementById( id ); 1237 1238 if ( elem ) { 1239 1240 // Verify the id attribute 1241 node = elem.getAttributeNode( "id" ); 1242 if ( node && node.value === id ) { 1243 return [ elem ]; 1244 } 1245 1246 // Fall back on getElementsByName 1247 elems = context.getElementsByName( id ); 1248 i = 0; 1249 while ( ( elem = elems[ i++ ] ) ) { 1250 node = elem.getAttributeNode( "id" ); 1251 if ( node && node.value === id ) { 1252 return [ elem ]; 1253 } 1254 } 1255 } 1256 1257 return []; 1258 } 1259 }; 1260 } 1261 1262 // Tag 1263 Expr.find[ "TAG" ] = support.getElementsByTagName ? 1264 function( tag, context ) { 1265 if ( typeof context.getElementsByTagName !== "undefined" ) { 1266 return context.getElementsByTagName( tag ); 1267 1268 // DocumentFragment nodes don't have gEBTN 1269 } else if ( support.qsa ) { 1270 return context.querySelectorAll( tag ); 1271 } 1272 } : 1273 1274 function( tag, context ) { 1275 var elem, 1276 tmp = [], 1277 i = 0, 1278 1279 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too 1280 results = context.getElementsByTagName( tag ); 1281 1282 // Filter out possible comments 1283 if ( tag === "*" ) { 1284 while ( ( elem = results[ i++ ] ) ) { 1285 if ( elem.nodeType === 1 ) { 1286 tmp.push( elem ); 1287 } 1288 } 1289 1290 return tmp; 1291 } 1292 return results; 1293 }; 1294 1295 // Class 1296 Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) { 1297 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 1298 return context.getElementsByClassName( className ); 1299 } 1300 }; 1301 1302 /* QSA/matchesSelector 1303 ---------------------------------------------------------------------- */ 1304 1305 // QSA and matchesSelector support 1306 1307 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 1308 rbuggyMatches = []; 1309 1310 // qSa(:focus) reports false when true (Chrome 21) 1311 // We allow this because of a bug in IE8/9 that throws an error 1312 // whenever `document.activeElement` is accessed on an iframe 1313 // So, we allow :focus to pass through QSA all the time to avoid the IE error 1314 // See https://bugs.jquery.com/ticket/13378 1315 rbuggyQSA = []; 1316 1317 if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) { 1318 1319 // Build QSA regex 1320 // Regex strategy adopted from Diego Perini 1321 assert( function( el ) { 1322 1323 var input; 1324 1325 // Select is set to empty string on purpose 1326 // This is to test IE's treatment of not explicitly 1327 // setting a boolean content attribute, 1328 // since its presence should be enough 1329 // https://bugs.jquery.com/ticket/12359 1330 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + 1331 "<select id='" + expando + "-\r\\' msallowcapture=''>" + 1332 "<option selected=''></option></select>"; 1333 1334 // Support: IE8, Opera 11-12.16 1335 // Nothing should be selected when empty strings follow ^= or $= or *= 1336 // The test attribute must be unknown in Opera but "safe" for WinRT 1337 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section 1338 if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) { 1339 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); 1340 } 1341 1342 // Support: IE8 1343 // Boolean attributes and "value" are not treated correctly 1344 if ( !el.querySelectorAll( "[selected]" ).length ) { 1345 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 1346 } 1347 1348 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ 1349 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 1350 rbuggyQSA.push( "~=" ); 1351 } 1352 1353 // Support: IE 11+, Edge 15 - 18+ 1354 // IE 11/Edge don't find elements on a `[name='']` query in some cases. 1355 // Adding a temporary attribute to the document before the selection works 1356 // around the issue. 1357 // Interestingly, IE 10 & older don't seem to have the issue. 1358 input = document.createElement( "input" ); 1359 input.setAttribute( "name", "" ); 1360 el.appendChild( input ); 1361 if ( !el.querySelectorAll( "[name='']" ).length ) { 1362 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + 1363 whitespace + "*(?:''|\"\")" ); 1364 } 1365 1366 // Webkit/Opera - :checked should return selected option elements 1367 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 1368 // IE8 throws error here and will not see later tests 1369 if ( !el.querySelectorAll( ":checked" ).length ) { 1370 rbuggyQSA.push( ":checked" ); 1371 } 1372 1373 // Support: Safari 8+, iOS 8+ 1374 // https://bugs.webkit.org/show_bug.cgi?id=136851 1375 // In-page `selector#id sibling-combinator selector` fails 1376 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 1377 rbuggyQSA.push( ".#.+[+~]" ); 1378 } 1379 1380 // Support: Firefox <=3.6 - 5 only 1381 // Old Firefox doesn't throw on a badly-escaped identifier. 1382 el.querySelectorAll( "\\\f" ); 1383 rbuggyQSA.push( "[\\r\\n\\f]" ); 1384 } ); 1385 1386 assert( function( el ) { 1387 el.innerHTML = "<a href='' disabled='disabled'></a>" + 1388 "<select disabled='disabled'><option/></select>"; 1389 1390 // Support: Windows 8 Native Apps 1391 // The type and name attributes are restricted during .innerHTML assignment 1392 var input = document.createElement( "input" ); 1393 input.setAttribute( "type", "hidden" ); 1394 el.appendChild( input ).setAttribute( "name", "D" ); 1395 1396 // Support: IE8 1397 // Enforce case-sensitivity of name attribute 1398 if ( el.querySelectorAll( "[name=d]" ).length ) { 1399 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); 1400 } 1401 1402 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 1403 // IE8 throws error here and will not see later tests 1404 if ( el.querySelectorAll( ":enabled" ).length !== 2 ) { 1405 rbuggyQSA.push( ":enabled", ":disabled" ); 1406 } 1407 1408 // Support: IE9-11+ 1409 // IE's :disabled selector does not pick up the children of disabled fieldsets 1410 docElem.appendChild( el ).disabled = true; 1411 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { 1412 rbuggyQSA.push( ":enabled", ":disabled" ); 1413 } 1414 1415 // Support: Opera 10 - 11 only 1416 // Opera 10-11 does not throw on post-comma invalid pseudos 1417 el.querySelectorAll( "*,:x" ); 1418 rbuggyQSA.push( ",.*:" ); 1419 } ); 1420 } 1421 1422 if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches || 1423 docElem.webkitMatchesSelector || 1424 docElem.mozMatchesSelector || 1425 docElem.oMatchesSelector || 1426 docElem.msMatchesSelector ) ) ) ) { 1427 1428 assert( function( el ) { 1429 1430 // Check to see if it's possible to do matchesSelector 1431 // on a disconnected node (IE 9) 1432 support.disconnectedMatch = matches.call( el, "*" ); 1433 1434 // This should fail with an exception 1435 // Gecko does not error, returns false instead 1436 matches.call( el, "[s!='']:x" ); 1437 rbuggyMatches.push( "!=", pseudos ); 1438 } ); 1439 } 1440 1441 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); 1442 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) ); 1443 1444 /* Contains 1445 ---------------------------------------------------------------------- */ 1446 hasCompare = rnative.test( docElem.compareDocumentPosition ); 1447 1448 // Element contains another 1449 // Purposefully self-exclusive 1450 // As in, an element does not contain itself 1451 contains = hasCompare || rnative.test( docElem.contains ) ? 1452 function( a, b ) { 1453 var adown = a.nodeType === 9 ? a.documentElement : a, 1454 bup = b && b.parentNode; 1455 return a === bup || !!( bup && bup.nodeType === 1 && ( 1456 adown.contains ? 1457 adown.contains( bup ) : 1458 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 1459 ) ); 1460 } : 1461 function( a, b ) { 1462 if ( b ) { 1463 while ( ( b = b.parentNode ) ) { 1464 if ( b === a ) { 1465 return true; 1466 } 1467 } 1468 } 1469 return false; 1470 }; 1471 1472 /* Sorting 1473 ---------------------------------------------------------------------- */ 1474 1475 // Document order sorting 1476 sortOrder = hasCompare ? 1477 function( a, b ) { 1478 1479 // Flag for duplicate removal 1480 if ( a === b ) { 1481 hasDuplicate = true; 1482 return 0; 1483 } 1484 1485 // Sort on method existence if only one input has compareDocumentPosition 1486 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 1487 if ( compare ) { 1488 return compare; 1489 } 1490 1491 // Calculate position if both inputs belong to the same document 1492 // Support: IE 11+, Edge 17 - 18+ 1493 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1494 // two documents; shallow comparisons work. 1495 // eslint-disable-next-line eqeqeq 1496 compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? 1497 a.compareDocumentPosition( b ) : 1498 1499 // Otherwise we know they are disconnected 1500 1; 1501 1502 // Disconnected nodes 1503 if ( compare & 1 || 1504 ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { 1505 1506 // Choose the first element that is related to our preferred document 1507 // Support: IE 11+, Edge 17 - 18+ 1508 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1509 // two documents; shallow comparisons work. 1510 // eslint-disable-next-line eqeqeq 1511 if ( a == document || a.ownerDocument == preferredDoc && 1512 contains( preferredDoc, a ) ) { 1513 return -1; 1514 } 1515 1516 // Support: IE 11+, Edge 17 - 18+ 1517 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1518 // two documents; shallow comparisons work. 1519 // eslint-disable-next-line eqeqeq 1520 if ( b == document || b.ownerDocument == preferredDoc && 1521 contains( preferredDoc, b ) ) { 1522 return 1; 1523 } 1524 1525 // Maintain original order 1526 return sortInput ? 1527 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 1528 0; 1529 } 1530 1531 return compare & 4 ? -1 : 1; 1532 } : 1533 function( a, b ) { 1534 1535 // Exit early if the nodes are identical 1536 if ( a === b ) { 1537 hasDuplicate = true; 1538 return 0; 1539 } 1540 1541 var cur, 1542 i = 0, 1543 aup = a.parentNode, 1544 bup = b.parentNode, 1545 ap = [ a ], 1546 bp = [ b ]; 1547 1548 // Parentless nodes are either documents or disconnected 1549 if ( !aup || !bup ) { 1550 1551 // Support: IE 11+, Edge 17 - 18+ 1552 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1553 // two documents; shallow comparisons work. 1554 /* eslint-disable eqeqeq */ 1555 return a == document ? -1 : 1556 b == document ? 1 : 1557 /* eslint-enable eqeqeq */ 1558 aup ? -1 : 1559 bup ? 1 : 1560 sortInput ? 1561 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 1562 0; 1563 1564 // If the nodes are siblings, we can do a quick check 1565 } else if ( aup === bup ) { 1566 return siblingCheck( a, b ); 1567 } 1568 1569 // Otherwise we need full lists of their ancestors for comparison 1570 cur = a; 1571 while ( ( cur = cur.parentNode ) ) { 1572 ap.unshift( cur ); 1573 } 1574 cur = b; 1575 while ( ( cur = cur.parentNode ) ) { 1576 bp.unshift( cur ); 1577 } 1578 1579 // Walk down the tree looking for a discrepancy 1580 while ( ap[ i ] === bp[ i ] ) { 1581 i++; 1582 } 1583 1584 return i ? 1585 1586 // Do a sibling check if the nodes have a common ancestor 1587 siblingCheck( ap[ i ], bp[ i ] ) : 1588 1589 // Otherwise nodes in our document sort first 1590 // Support: IE 11+, Edge 17 - 18+ 1591 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1592 // two documents; shallow comparisons work. 1593 /* eslint-disable eqeqeq */ 1594 ap[ i ] == preferredDoc ? -1 : 1595 bp[ i ] == preferredDoc ? 1 : 1596 /* eslint-enable eqeqeq */ 1597 0; 1598 }; 1599 1600 return document; 1601}; 1602 1603Sizzle.matches = function( expr, elements ) { 1604 return Sizzle( expr, null, null, elements ); 1605}; 1606 1607Sizzle.matchesSelector = function( elem, expr ) { 1608 setDocument( elem ); 1609 1610 if ( support.matchesSelector && documentIsHTML && 1611 !nonnativeSelectorCache[ expr + " " ] && 1612 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && 1613 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 1614 1615 try { 1616 var ret = matches.call( elem, expr ); 1617 1618 // IE 9's matchesSelector returns false on disconnected nodes 1619 if ( ret || support.disconnectedMatch || 1620 1621 // As well, disconnected nodes are said to be in a document 1622 // fragment in IE 9 1623 elem.document && elem.document.nodeType !== 11 ) { 1624 return ret; 1625 } 1626 } catch ( e ) { 1627 nonnativeSelectorCache( expr, true ); 1628 } 1629 } 1630 1631 return Sizzle( expr, document, null, [ elem ] ).length > 0; 1632}; 1633 1634Sizzle.contains = function( context, elem ) { 1635 1636 // Set document vars if needed 1637 // Support: IE 11+, Edge 17 - 18+ 1638 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1639 // two documents; shallow comparisons work. 1640 // eslint-disable-next-line eqeqeq 1641 if ( ( context.ownerDocument || context ) != document ) { 1642 setDocument( context ); 1643 } 1644 return contains( context, elem ); 1645}; 1646 1647Sizzle.attr = function( elem, name ) { 1648 1649 // Set document vars if needed 1650 // Support: IE 11+, Edge 17 - 18+ 1651 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1652 // two documents; shallow comparisons work. 1653 // eslint-disable-next-line eqeqeq 1654 if ( ( elem.ownerDocument || elem ) != document ) { 1655 setDocument( elem ); 1656 } 1657 1658 var fn = Expr.attrHandle[ name.toLowerCase() ], 1659 1660 // Don't get fooled by Object.prototype properties (jQuery #13807) 1661 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 1662 fn( elem, name, !documentIsHTML ) : 1663 undefined; 1664 1665 return val !== undefined ? 1666 val : 1667 support.attributes || !documentIsHTML ? 1668 elem.getAttribute( name ) : 1669 ( val = elem.getAttributeNode( name ) ) && val.specified ? 1670 val.value : 1671 null; 1672}; 1673 1674Sizzle.escape = function( sel ) { 1675 return ( sel + "" ).replace( rcssescape, fcssescape ); 1676}; 1677 1678Sizzle.error = function( msg ) { 1679 throw new Error( "Syntax error, unrecognized expression: " + msg ); 1680}; 1681 1682/** 1683 * Document sorting and removing duplicates 1684 * @param {ArrayLike} results 1685 */ 1686Sizzle.uniqueSort = function( results ) { 1687 var elem, 1688 duplicates = [], 1689 j = 0, 1690 i = 0; 1691 1692 // Unless we *know* we can detect duplicates, assume their presence 1693 hasDuplicate = !support.detectDuplicates; 1694 sortInput = !support.sortStable && results.slice( 0 ); 1695 results.sort( sortOrder ); 1696 1697 if ( hasDuplicate ) { 1698 while ( ( elem = results[ i++ ] ) ) { 1699 if ( elem === results[ i ] ) { 1700 j = duplicates.push( i ); 1701 } 1702 } 1703 while ( j-- ) { 1704 results.splice( duplicates[ j ], 1 ); 1705 } 1706 } 1707 1708 // Clear input after sorting to release objects 1709 // See https://github.com/jquery/sizzle/pull/225 1710 sortInput = null; 1711 1712 return results; 1713}; 1714 1715/** 1716 * Utility function for retrieving the text value of an array of DOM nodes 1717 * @param {Array|Element} elem 1718 */ 1719getText = Sizzle.getText = function( elem ) { 1720 var node, 1721 ret = "", 1722 i = 0, 1723 nodeType = elem.nodeType; 1724 1725 if ( !nodeType ) { 1726 1727 // If no nodeType, this is expected to be an array 1728 while ( ( node = elem[ i++ ] ) ) { 1729 1730 // Do not traverse comment nodes 1731 ret += getText( node ); 1732 } 1733 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 1734 1735 // Use textContent for elements 1736 // innerText usage removed for consistency of new lines (jQuery #11153) 1737 if ( typeof elem.textContent === "string" ) { 1738 return elem.textContent; 1739 } else { 1740 1741 // Traverse its children 1742 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 1743 ret += getText( elem ); 1744 } 1745 } 1746 } else if ( nodeType === 3 || nodeType === 4 ) { 1747 return elem.nodeValue; 1748 } 1749 1750 // Do not include comment or processing instruction nodes 1751 1752 return ret; 1753}; 1754 1755Expr = Sizzle.selectors = { 1756 1757 // Can be adjusted by the user 1758 cacheLength: 50, 1759 1760 createPseudo: markFunction, 1761 1762 match: matchExpr, 1763 1764 attrHandle: {}, 1765 1766 find: {}, 1767 1768 relative: { 1769 ">": { dir: "parentNode", first: true }, 1770 " ": { dir: "parentNode" }, 1771 "+": { dir: "previousSibling", first: true }, 1772 "~": { dir: "previousSibling" } 1773 }, 1774 1775 preFilter: { 1776 "ATTR": function( match ) { 1777 match[ 1 ] = match[ 1 ].replace( runescape, funescape ); 1778 1779 // Move the given value to match[3] whether quoted or unquoted 1780 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || 1781 match[ 5 ] || "" ).replace( runescape, funescape ); 1782 1783 if ( match[ 2 ] === "~=" ) { 1784 match[ 3 ] = " " + match[ 3 ] + " "; 1785 } 1786 1787 return match.slice( 0, 4 ); 1788 }, 1789 1790 "CHILD": function( match ) { 1791 1792 /* matches from matchExpr["CHILD"] 1793 1 type (only|nth|...) 1794 2 what (child|of-type) 1795 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 1796 4 xn-component of xn+y argument ([+-]?\d*n|) 1797 5 sign of xn-component 1798 6 x of xn-component 1799 7 sign of y-component 1800 8 y of y-component 1801 */ 1802 match[ 1 ] = match[ 1 ].toLowerCase(); 1803 1804 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { 1805 1806 // nth-* requires argument 1807 if ( !match[ 3 ] ) { 1808 Sizzle.error( match[ 0 ] ); 1809 } 1810 1811 // numeric x and y parameters for Expr.filter.CHILD 1812 // remember that false/true cast respectively to 0/1 1813 match[ 4 ] = +( match[ 4 ] ? 1814 match[ 5 ] + ( match[ 6 ] || 1 ) : 1815 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) ); 1816 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); 1817 1818 // other types prohibit arguments 1819 } else if ( match[ 3 ] ) { 1820 Sizzle.error( match[ 0 ] ); 1821 } 1822 1823 return match; 1824 }, 1825 1826 "PSEUDO": function( match ) { 1827 var excess, 1828 unquoted = !match[ 6 ] && match[ 2 ]; 1829 1830 if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) { 1831 return null; 1832 } 1833 1834 // Accept quoted arguments as-is 1835 if ( match[ 3 ] ) { 1836 match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; 1837 1838 // Strip excess characters from unquoted arguments 1839 } else if ( unquoted && rpseudo.test( unquoted ) && 1840 1841 // Get excess from tokenize (recursively) 1842 ( excess = tokenize( unquoted, true ) ) && 1843 1844 // advance to the next closing parenthesis 1845 ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { 1846 1847 // excess is a negative index 1848 match[ 0 ] = match[ 0 ].slice( 0, excess ); 1849 match[ 2 ] = unquoted.slice( 0, excess ); 1850 } 1851 1852 // Return only captures needed by the pseudo filter method (type and argument) 1853 return match.slice( 0, 3 ); 1854 } 1855 }, 1856 1857 filter: { 1858 1859 "TAG": function( nodeNameSelector ) { 1860 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 1861 return nodeNameSelector === "*" ? 1862 function() { 1863 return true; 1864 } : 1865 function( elem ) { 1866 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 1867 }; 1868 }, 1869 1870 "CLASS": function( className ) { 1871 var pattern = classCache[ className + " " ]; 1872 1873 return pattern || 1874 ( pattern = new RegExp( "(^|" + whitespace + 1875 ")" + className + "(" + whitespace + "|$)" ) ) && classCache( 1876 className, function( elem ) { 1877 return pattern.test( 1878 typeof elem.className === "string" && elem.className || 1879 typeof elem.getAttribute !== "undefined" && 1880 elem.getAttribute( "class" ) || 1881 "" 1882 ); 1883 } ); 1884 }, 1885 1886 "ATTR": function( name, operator, check ) { 1887 return function( elem ) { 1888 var result = Sizzle.attr( elem, name ); 1889 1890 if ( result == null ) { 1891 return operator === "!="; 1892 } 1893 if ( !operator ) { 1894 return true; 1895 } 1896 1897 result += ""; 1898 1899 /* eslint-disable max-len */ 1900 1901 return operator === "=" ? result === check : 1902 operator === "!=" ? result !== check : 1903 operator === "^=" ? check && result.indexOf( check ) === 0 : 1904 operator === "*=" ? check && result.indexOf( check ) > -1 : 1905 operator === "$=" ? check && result.slice( -check.length ) === check : 1906 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : 1907 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : 1908 false; 1909 /* eslint-enable max-len */ 1910 1911 }; 1912 }, 1913 1914 "CHILD": function( type, what, _argument, first, last ) { 1915 var simple = type.slice( 0, 3 ) !== "nth", 1916 forward = type.slice( -4 ) !== "last", 1917 ofType = what === "of-type"; 1918 1919 return first === 1 && last === 0 ? 1920 1921 // Shortcut for :nth-*(n) 1922 function( elem ) { 1923 return !!elem.parentNode; 1924 } : 1925 1926 function( elem, _context, xml ) { 1927 var cache, uniqueCache, outerCache, node, nodeIndex, start, 1928 dir = simple !== forward ? "nextSibling" : "previousSibling", 1929 parent = elem.parentNode, 1930 name = ofType && elem.nodeName.toLowerCase(), 1931 useCache = !xml && !ofType, 1932 diff = false; 1933 1934 if ( parent ) { 1935 1936 // :(first|last|only)-(child|of-type) 1937 if ( simple ) { 1938 while ( dir ) { 1939 node = elem; 1940 while ( ( node = node[ dir ] ) ) { 1941 if ( ofType ? 1942 node.nodeName.toLowerCase() === name : 1943 node.nodeType === 1 ) { 1944 1945 return false; 1946 } 1947 } 1948 1949 // Reverse direction for :only-* (if we haven't yet done so) 1950 start = dir = type === "only" && !start && "nextSibling"; 1951 } 1952 return true; 1953 } 1954 1955 start = [ forward ? parent.firstChild : parent.lastChild ]; 1956 1957 // non-xml :nth-child(...) stores cache data on `parent` 1958 if ( forward && useCache ) { 1959 1960 // Seek `elem` from a previously-cached index 1961 1962 // ...in a gzip-friendly way 1963 node = parent; 1964 outerCache = node[ expando ] || ( node[ expando ] = {} ); 1965 1966 // Support: IE <9 only 1967 // Defend against cloned attroperties (jQuery gh-1709) 1968 uniqueCache = outerCache[ node.uniqueID ] || 1969 ( outerCache[ node.uniqueID ] = {} ); 1970 1971 cache = uniqueCache[ type ] || []; 1972 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1973 diff = nodeIndex && cache[ 2 ]; 1974 node = nodeIndex && parent.childNodes[ nodeIndex ]; 1975 1976 while ( ( node = ++nodeIndex && node && node[ dir ] || 1977 1978 // Fallback to seeking `elem` from the start 1979 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 1980 1981 // When found, cache indexes on `parent` and break 1982 if ( node.nodeType === 1 && ++diff && node === elem ) { 1983 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; 1984 break; 1985 } 1986 } 1987 1988 } else { 1989 1990 // Use previously-cached element index if available 1991 if ( useCache ) { 1992 1993 // ...in a gzip-friendly way 1994 node = elem; 1995 outerCache = node[ expando ] || ( node[ expando ] = {} ); 1996 1997 // Support: IE <9 only 1998 // Defend against cloned attroperties (jQuery gh-1709) 1999 uniqueCache = outerCache[ node.uniqueID ] || 2000 ( outerCache[ node.uniqueID ] = {} ); 2001 2002 cache = uniqueCache[ type ] || []; 2003 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 2004 diff = nodeIndex; 2005 } 2006 2007 // xml :nth-child(...) 2008 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 2009 if ( diff === false ) { 2010 2011 // Use the same loop as above to seek `elem` from the start 2012 while ( ( node = ++nodeIndex && node && node[ dir ] || 2013 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 2014 2015 if ( ( ofType ? 2016 node.nodeName.toLowerCase() === name : 2017 node.nodeType === 1 ) && 2018 ++diff ) { 2019 2020 // Cache the index of each encountered element 2021 if ( useCache ) { 2022 outerCache = node[ expando ] || 2023 ( node[ expando ] = {} ); 2024 2025 // Support: IE <9 only 2026 // Defend against cloned attroperties (jQuery gh-1709) 2027 uniqueCache = outerCache[ node.uniqueID ] || 2028 ( outerCache[ node.uniqueID ] = {} ); 2029 2030 uniqueCache[ type ] = [ dirruns, diff ]; 2031 } 2032 2033 if ( node === elem ) { 2034 break; 2035 } 2036 } 2037 } 2038 } 2039 } 2040 2041 // Incorporate the offset, then check against cycle size 2042 diff -= last; 2043 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 2044 } 2045 }; 2046 }, 2047 2048 "PSEUDO": function( pseudo, argument ) { 2049 2050 // pseudo-class names are case-insensitive 2051 // http://www.w3.org/TR/selectors/#pseudo-classes 2052 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 2053 // Remember that setFilters inherits from pseudos 2054 var args, 2055 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 2056 Sizzle.error( "unsupported pseudo: " + pseudo ); 2057 2058 // The user may use createPseudo to indicate that 2059 // arguments are needed to create the filter function 2060 // just as Sizzle does 2061 if ( fn[ expando ] ) { 2062 return fn( argument ); 2063 } 2064 2065 // But maintain support for old signatures 2066 if ( fn.length > 1 ) { 2067 args = [ pseudo, pseudo, "", argument ]; 2068 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 2069 markFunction( function( seed, matches ) { 2070 var idx, 2071 matched = fn( seed, argument ), 2072 i = matched.length; 2073 while ( i-- ) { 2074 idx = indexOf( seed, matched[ i ] ); 2075 seed[ idx ] = !( matches[ idx ] = matched[ i ] ); 2076 } 2077 } ) : 2078 function( elem ) { 2079 return fn( elem, 0, args ); 2080 }; 2081 } 2082 2083 return fn; 2084 } 2085 }, 2086 2087 pseudos: { 2088 2089 // Potentially complex pseudos 2090 "not": markFunction( function( selector ) { 2091 2092 // Trim the selector passed to compile 2093 // to avoid treating leading and trailing 2094 // spaces as combinators 2095 var input = [], 2096 results = [], 2097 matcher = compile( selector.replace( rtrim, "$1" ) ); 2098 2099 return matcher[ expando ] ? 2100 markFunction( function( seed, matches, _context, xml ) { 2101 var elem, 2102 unmatched = matcher( seed, null, xml, [] ), 2103 i = seed.length; 2104 2105 // Match elements unmatched by `matcher` 2106 while ( i-- ) { 2107 if ( ( elem = unmatched[ i ] ) ) { 2108 seed[ i ] = !( matches[ i ] = elem ); 2109 } 2110 } 2111 } ) : 2112 function( elem, _context, xml ) { 2113 input[ 0 ] = elem; 2114 matcher( input, null, xml, results ); 2115 2116 // Don't keep the element (issue #299) 2117 input[ 0 ] = null; 2118 return !results.pop(); 2119 }; 2120 } ), 2121 2122 "has": markFunction( function( selector ) { 2123 return function( elem ) { 2124 return Sizzle( selector, elem ).length > 0; 2125 }; 2126 } ), 2127 2128 "contains": markFunction( function( text ) { 2129 text = text.replace( runescape, funescape ); 2130 return function( elem ) { 2131 return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; 2132 }; 2133 } ), 2134 2135 // "Whether an element is represented by a :lang() selector 2136 // is based solely on the element's language value 2137 // being equal to the identifier C, 2138 // or beginning with the identifier C immediately followed by "-". 2139 // The matching of C against the element's language value is performed case-insensitively. 2140 // The identifier C does not have to be a valid language name." 2141 // http://www.w3.org/TR/selectors/#lang-pseudo 2142 "lang": markFunction( function( lang ) { 2143 2144 // lang value must be a valid identifier 2145 if ( !ridentifier.test( lang || "" ) ) { 2146 Sizzle.error( "unsupported lang: " + lang ); 2147 } 2148 lang = lang.replace( runescape, funescape ).toLowerCase(); 2149 return function( elem ) { 2150 var elemLang; 2151 do { 2152 if ( ( elemLang = documentIsHTML ? 2153 elem.lang : 2154 elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { 2155 2156 elemLang = elemLang.toLowerCase(); 2157 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 2158 } 2159 } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); 2160 return false; 2161 }; 2162 } ), 2163 2164 // Miscellaneous 2165 "target": function( elem ) { 2166 var hash = window.location && window.location.hash; 2167 return hash && hash.slice( 1 ) === elem.id; 2168 }, 2169 2170 "root": function( elem ) { 2171 return elem === docElem; 2172 }, 2173 2174 "focus": function( elem ) { 2175 return elem === document.activeElement && 2176 ( !document.hasFocus || document.hasFocus() ) && 2177 !!( elem.type || elem.href || ~elem.tabIndex ); 2178 }, 2179 2180 // Boolean properties 2181 "enabled": createDisabledPseudo( false ), 2182 "disabled": createDisabledPseudo( true ), 2183 2184 "checked": function( elem ) { 2185 2186 // In CSS3, :checked should return both checked and selected elements 2187 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 2188 var nodeName = elem.nodeName.toLowerCase(); 2189 return ( nodeName === "input" && !!elem.checked ) || 2190 ( nodeName === "option" && !!elem.selected ); 2191 }, 2192 2193 "selected": function( elem ) { 2194 2195 // Accessing this property makes selected-by-default 2196 // options in Safari work properly 2197 if ( elem.parentNode ) { 2198 // eslint-disable-next-line no-unused-expressions 2199 elem.parentNode.selectedIndex; 2200 } 2201 2202 return elem.selected === true; 2203 }, 2204 2205 // Contents 2206 "empty": function( elem ) { 2207 2208 // http://www.w3.org/TR/selectors/#empty-pseudo 2209 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 2210 // but not by others (comment: 8; processing instruction: 7; etc.) 2211 // nodeType < 6 works because attributes (2) do not appear as children 2212 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 2213 if ( elem.nodeType < 6 ) { 2214 return false; 2215 } 2216 } 2217 return true; 2218 }, 2219 2220 "parent": function( elem ) { 2221 return !Expr.pseudos[ "empty" ]( elem ); 2222 }, 2223 2224 // Element/input types 2225 "header": function( elem ) { 2226 return rheader.test( elem.nodeName ); 2227 }, 2228 2229 "input": function( elem ) { 2230 return rinputs.test( elem.nodeName ); 2231 }, 2232 2233 "button": function( elem ) { 2234 var name = elem.nodeName.toLowerCase(); 2235 return name === "input" && elem.type === "button" || name === "button"; 2236 }, 2237 2238 "text": function( elem ) { 2239 var attr; 2240 return elem.nodeName.toLowerCase() === "input" && 2241 elem.type === "text" && 2242 2243 // Support: IE<8 2244 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 2245 ( ( attr = elem.getAttribute( "type" ) ) == null || 2246 attr.toLowerCase() === "text" ); 2247 }, 2248 2249 // Position-in-collection 2250 "first": createPositionalPseudo( function() { 2251 return [ 0 ]; 2252 } ), 2253 2254 "last": createPositionalPseudo( function( _matchIndexes, length ) { 2255 return [ length - 1 ]; 2256 } ), 2257 2258 "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) { 2259 return [ argument < 0 ? argument + length : argument ]; 2260 } ), 2261 2262 "even": createPositionalPseudo( function( matchIndexes, length ) { 2263 var i = 0; 2264 for ( ; i < length; i += 2 ) { 2265 matchIndexes.push( i ); 2266 } 2267 return matchIndexes; 2268 } ), 2269 2270 "odd": createPositionalPseudo( function( matchIndexes, length ) { 2271 var i = 1; 2272 for ( ; i < length; i += 2 ) { 2273 matchIndexes.push( i ); 2274 } 2275 return matchIndexes; 2276 } ), 2277 2278 "lt": createPositionalPseudo( function( matchIndexes, length, argument ) { 2279 var i = argument < 0 ? 2280 argument + length : 2281 argument > length ? 2282 length : 2283 argument; 2284 for ( ; --i >= 0; ) { 2285 matchIndexes.push( i ); 2286 } 2287 return matchIndexes; 2288 } ), 2289 2290 "gt": createPositionalPseudo( function( matchIndexes, length, argument ) { 2291 var i = argument < 0 ? argument + length : argument; 2292 for ( ; ++i < length; ) { 2293 matchIndexes.push( i ); 2294 } 2295 return matchIndexes; 2296 } ) 2297 } 2298}; 2299 2300Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ]; 2301 2302// Add button/input type pseudos 2303for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 2304 Expr.pseudos[ i ] = createInputPseudo( i ); 2305} 2306for ( i in { submit: true, reset: true } ) { 2307 Expr.pseudos[ i ] = createButtonPseudo( i ); 2308} 2309 2310// Easy API for creating new setFilters 2311function setFilters() {} 2312setFilters.prototype = Expr.filters = Expr.pseudos; 2313Expr.setFilters = new setFilters(); 2314 2315tokenize = Sizzle.tokenize = function( selector, parseOnly ) { 2316 var matched, match, tokens, type, 2317 soFar, groups, preFilters, 2318 cached = tokenCache[ selector + " " ]; 2319 2320 if ( cached ) { 2321 return parseOnly ? 0 : cached.slice( 0 ); 2322 } 2323 2324 soFar = selector; 2325 groups = []; 2326 preFilters = Expr.preFilter; 2327 2328 while ( soFar ) { 2329 2330 // Comma and first run 2331 if ( !matched || ( match = rcomma.exec( soFar ) ) ) { 2332 if ( match ) { 2333 2334 // Don't consume trailing commas as valid 2335 soFar = soFar.slice( match[ 0 ].length ) || soFar; 2336 } 2337 groups.push( ( tokens = [] ) ); 2338 } 2339 2340 matched = false; 2341 2342 // Combinators 2343 if ( ( match = rcombinators.exec( soFar ) ) ) { 2344 matched = match.shift(); 2345 tokens.push( { 2346 value: matched, 2347 2348 // Cast descendant combinators to space 2349 type: match[ 0 ].replace( rtrim, " " ) 2350 } ); 2351 soFar = soFar.slice( matched.length ); 2352 } 2353 2354 // Filters 2355 for ( type in Expr.filter ) { 2356 if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || 2357 ( match = preFilters[ type ]( match ) ) ) ) { 2358 matched = match.shift(); 2359 tokens.push( { 2360 value: matched, 2361 type: type, 2362 matches: match 2363 } ); 2364 soFar = soFar.slice( matched.length ); 2365 } 2366 } 2367 2368 if ( !matched ) { 2369 break; 2370 } 2371 } 2372 2373 // Return the length of the invalid excess 2374 // if we're just parsing 2375 // Otherwise, throw an error or return tokens 2376 return parseOnly ? 2377 soFar.length : 2378 soFar ? 2379 Sizzle.error( selector ) : 2380 2381 // Cache the tokens 2382 tokenCache( selector, groups ).slice( 0 ); 2383}; 2384 2385function toSelector( tokens ) { 2386 var i = 0, 2387 len = tokens.length, 2388 selector = ""; 2389 for ( ; i < len; i++ ) { 2390 selector += tokens[ i ].value; 2391 } 2392 return selector; 2393} 2394 2395function addCombinator( matcher, combinator, base ) { 2396 var dir = combinator.dir, 2397 skip = combinator.next, 2398 key = skip || dir, 2399 checkNonElements = base && key === "parentNode", 2400 doneName = done++; 2401 2402 return combinator.first ? 2403 2404 // Check against closest ancestor/preceding element 2405 function( elem, context, xml ) { 2406 while ( ( elem = elem[ dir ] ) ) { 2407 if ( elem.nodeType === 1 || checkNonElements ) { 2408 return matcher( elem, context, xml ); 2409 } 2410 } 2411 return false; 2412 } : 2413 2414 // Check against all ancestor/preceding elements 2415 function( elem, context, xml ) { 2416 var oldCache, uniqueCache, outerCache, 2417 newCache = [ dirruns, doneName ]; 2418 2419 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 2420 if ( xml ) { 2421 while ( ( elem = elem[ dir ] ) ) { 2422 if ( elem.nodeType === 1 || checkNonElements ) { 2423 if ( matcher( elem, context, xml ) ) { 2424 return true; 2425 } 2426 } 2427 } 2428 } else { 2429 while ( ( elem = elem[ dir ] ) ) { 2430 if ( elem.nodeType === 1 || checkNonElements ) { 2431 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 2432 2433 // Support: IE <9 only 2434 // Defend against cloned attroperties (jQuery gh-1709) 2435 uniqueCache = outerCache[ elem.uniqueID ] || 2436 ( outerCache[ elem.uniqueID ] = {} ); 2437 2438 if ( skip && skip === elem.nodeName.toLowerCase() ) { 2439 elem = elem[ dir ] || elem; 2440 } else if ( ( oldCache = uniqueCache[ key ] ) && 2441 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 2442 2443 // Assign to newCache so results back-propagate to previous elements 2444 return ( newCache[ 2 ] = oldCache[ 2 ] ); 2445 } else { 2446 2447 // Reuse newcache so results back-propagate to previous elements 2448 uniqueCache[ key ] = newCache; 2449 2450 // A match means we're done; a fail means we have to keep checking 2451 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { 2452 return true; 2453 } 2454 } 2455 } 2456 } 2457 } 2458 return false; 2459 }; 2460} 2461 2462function elementMatcher( matchers ) { 2463 return matchers.length > 1 ? 2464 function( elem, context, xml ) { 2465 var i = matchers.length; 2466 while ( i-- ) { 2467 if ( !matchers[ i ]( elem, context, xml ) ) { 2468 return false; 2469 } 2470 } 2471 return true; 2472 } : 2473 matchers[ 0 ]; 2474} 2475 2476function multipleContexts( selector, contexts, results ) { 2477 var i = 0, 2478 len = contexts.length; 2479 for ( ; i < len; i++ ) { 2480 Sizzle( selector, contexts[ i ], results ); 2481 } 2482 return results; 2483} 2484 2485function condense( unmatched, map, filter, context, xml ) { 2486 var elem, 2487 newUnmatched = [], 2488 i = 0, 2489 len = unmatched.length, 2490 mapped = map != null; 2491 2492 for ( ; i < len; i++ ) { 2493 if ( ( elem = unmatched[ i ] ) ) { 2494 if ( !filter || filter( elem, context, xml ) ) { 2495 newUnmatched.push( elem ); 2496 if ( mapped ) { 2497 map.push( i ); 2498 } 2499 } 2500 } 2501 } 2502 2503 return newUnmatched; 2504} 2505 2506function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 2507 if ( postFilter && !postFilter[ expando ] ) { 2508 postFilter = setMatcher( postFilter ); 2509 } 2510 if ( postFinder && !postFinder[ expando ] ) { 2511 postFinder = setMatcher( postFinder, postSelector ); 2512 } 2513 return markFunction( function( seed, results, context, xml ) { 2514 var temp, i, elem, 2515 preMap = [], 2516 postMap = [], 2517 preexisting = results.length, 2518 2519 // Get initial elements from seed or context 2520 elems = seed || multipleContexts( 2521 selector || "*", 2522 context.nodeType ? [ context ] : context, 2523 [] 2524 ), 2525 2526 // Prefilter to get matcher input, preserving a map for seed-results synchronization 2527 matcherIn = preFilter && ( seed || !selector ) ? 2528 condense( elems, preMap, preFilter, context, xml ) : 2529 elems, 2530 2531 matcherOut = matcher ? 2532 2533 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 2534 postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 2535 2536 // ...intermediate processing is necessary 2537 [] : 2538 2539 // ...otherwise use results directly 2540 results : 2541 matcherIn; 2542 2543 // Find primary matches 2544 if ( matcher ) { 2545 matcher( matcherIn, matcherOut, context, xml ); 2546 } 2547 2548 // Apply postFilter 2549 if ( postFilter ) { 2550 temp = condense( matcherOut, postMap ); 2551 postFilter( temp, [], context, xml ); 2552 2553 // Un-match failing elements by moving them back to matcherIn 2554 i = temp.length; 2555 while ( i-- ) { 2556 if ( ( elem = temp[ i ] ) ) { 2557 matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); 2558 } 2559 } 2560 } 2561 2562 if ( seed ) { 2563 if ( postFinder || preFilter ) { 2564 if ( postFinder ) { 2565 2566 // Get the final matcherOut by condensing this intermediate into postFinder contexts 2567 temp = []; 2568 i = matcherOut.length; 2569 while ( i-- ) { 2570 if ( ( elem = matcherOut[ i ] ) ) { 2571 2572 // Restore matcherIn since elem is not yet a final match 2573 temp.push( ( matcherIn[ i ] = elem ) ); 2574 } 2575 } 2576 postFinder( null, ( matcherOut = [] ), temp, xml ); 2577 } 2578 2579 // Move matched elements from seed to results to keep them synchronized 2580 i = matcherOut.length; 2581 while ( i-- ) { 2582 if ( ( elem = matcherOut[ i ] ) && 2583 ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) { 2584 2585 seed[ temp ] = !( results[ temp ] = elem ); 2586 } 2587 } 2588 } 2589 2590 // Add elements to results, through postFinder if defined 2591 } else { 2592 matcherOut = condense( 2593 matcherOut === results ? 2594 matcherOut.splice( preexisting, matcherOut.length ) : 2595 matcherOut 2596 ); 2597 if ( postFinder ) { 2598 postFinder( null, results, matcherOut, xml ); 2599 } else { 2600 push.apply( results, matcherOut ); 2601 } 2602 } 2603 } ); 2604} 2605 2606function matcherFromTokens( tokens ) { 2607 var checkContext, matcher, j, 2608 len = tokens.length, 2609 leadingRelative = Expr.relative[ tokens[ 0 ].type ], 2610 implicitRelative = leadingRelative || Expr.relative[ " " ], 2611 i = leadingRelative ? 1 : 0, 2612 2613 // The foundational matcher ensures that elements are reachable from top-level context(s) 2614 matchContext = addCombinator( function( elem ) { 2615 return elem === checkContext; 2616 }, implicitRelative, true ), 2617 matchAnyContext = addCombinator( function( elem ) { 2618 return indexOf( checkContext, elem ) > -1; 2619 }, implicitRelative, true ), 2620 matchers = [ function( elem, context, xml ) { 2621 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( 2622 ( checkContext = context ).nodeType ? 2623 matchContext( elem, context, xml ) : 2624 matchAnyContext( elem, context, xml ) ); 2625 2626 // Avoid hanging onto element (issue #299) 2627 checkContext = null; 2628 return ret; 2629 } ]; 2630 2631 for ( ; i < len; i++ ) { 2632 if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { 2633 matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; 2634 } else { 2635 matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); 2636 2637 // Return special upon seeing a positional matcher 2638 if ( matcher[ expando ] ) { 2639 2640 // Find the next relative operator (if any) for proper handling 2641 j = ++i; 2642 for ( ; j < len; j++ ) { 2643 if ( Expr.relative[ tokens[ j ].type ] ) { 2644 break; 2645 } 2646 } 2647 return setMatcher( 2648 i > 1 && elementMatcher( matchers ), 2649 i > 1 && toSelector( 2650 2651 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 2652 tokens 2653 .slice( 0, i - 1 ) 2654 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) 2655 ).replace( rtrim, "$1" ), 2656 matcher, 2657 i < j && matcherFromTokens( tokens.slice( i, j ) ), 2658 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), 2659 j < len && toSelector( tokens ) 2660 ); 2661 } 2662 matchers.push( matcher ); 2663 } 2664 } 2665 2666 return elementMatcher( matchers ); 2667} 2668 2669function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 2670 var bySet = setMatchers.length > 0, 2671 byElement = elementMatchers.length > 0, 2672 superMatcher = function( seed, context, xml, results, outermost ) { 2673 var elem, j, matcher, 2674 matchedCount = 0, 2675 i = "0", 2676 unmatched = seed && [], 2677 setMatched = [], 2678 contextBackup = outermostContext, 2679 2680 // We must always have either seed elements or outermost context 2681 elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ), 2682 2683 // Use integer dirruns iff this is the outermost matcher 2684 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), 2685 len = elems.length; 2686 2687 if ( outermost ) { 2688 2689 // Support: IE 11+, Edge 17 - 18+ 2690 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2691 // two documents; shallow comparisons work. 2692 // eslint-disable-next-line eqeqeq 2693 outermostContext = context == document || context || outermost; 2694 } 2695 2696 // Add elements passing elementMatchers directly to results 2697 // Support: IE<9, Safari 2698 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 2699 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { 2700 if ( byElement && elem ) { 2701 j = 0; 2702 2703 // Support: IE 11+, Edge 17 - 18+ 2704 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2705 // two documents; shallow comparisons work. 2706 // eslint-disable-next-line eqeqeq 2707 if ( !context && elem.ownerDocument != document ) { 2708 setDocument( elem ); 2709 xml = !documentIsHTML; 2710 } 2711 while ( ( matcher = elementMatchers[ j++ ] ) ) { 2712 if ( matcher( elem, context || document, xml ) ) { 2713 results.push( elem ); 2714 break; 2715 } 2716 } 2717 if ( outermost ) { 2718 dirruns = dirrunsUnique; 2719 } 2720 } 2721 2722 // Track unmatched elements for set filters 2723 if ( bySet ) { 2724 2725 // They will have gone through all possible matchers 2726 if ( ( elem = !matcher && elem ) ) { 2727 matchedCount--; 2728 } 2729 2730 // Lengthen the array for every element, matched or not 2731 if ( seed ) { 2732 unmatched.push( elem ); 2733 } 2734 } 2735 } 2736 2737 // `i` is now the count of elements visited above, and adding it to `matchedCount` 2738 // makes the latter nonnegative. 2739 matchedCount += i; 2740 2741 // Apply set filters to unmatched elements 2742 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 2743 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 2744 // no element matchers and no seed. 2745 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 2746 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 2747 // numerically zero. 2748 if ( bySet && i !== matchedCount ) { 2749 j = 0; 2750 while ( ( matcher = setMatchers[ j++ ] ) ) { 2751 matcher( unmatched, setMatched, context, xml ); 2752 } 2753 2754 if ( seed ) { 2755 2756 // Reintegrate element matches to eliminate the need for sorting 2757 if ( matchedCount > 0 ) { 2758 while ( i-- ) { 2759 if ( !( unmatched[ i ] || setMatched[ i ] ) ) { 2760 setMatched[ i ] = pop.call( results ); 2761 } 2762 } 2763 } 2764 2765 // Discard index placeholder values to get only actual matches 2766 setMatched = condense( setMatched ); 2767 } 2768 2769 // Add matches to results 2770 push.apply( results, setMatched ); 2771 2772 // Seedless set matches succeeding multiple successful matchers stipulate sorting 2773 if ( outermost && !seed && setMatched.length > 0 && 2774 ( matchedCount + setMatchers.length ) > 1 ) { 2775 2776 Sizzle.uniqueSort( results ); 2777 } 2778 } 2779 2780 // Override manipulation of globals by nested matchers 2781 if ( outermost ) { 2782 dirruns = dirrunsUnique; 2783 outermostContext = contextBackup; 2784 } 2785 2786 return unmatched; 2787 }; 2788 2789 return bySet ? 2790 markFunction( superMatcher ) : 2791 superMatcher; 2792} 2793 2794compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { 2795 var i, 2796 setMatchers = [], 2797 elementMatchers = [], 2798 cached = compilerCache[ selector + " " ]; 2799 2800 if ( !cached ) { 2801 2802 // Generate a function of recursive functions that can be used to check each element 2803 if ( !match ) { 2804 match = tokenize( selector ); 2805 } 2806 i = match.length; 2807 while ( i-- ) { 2808 cached = matcherFromTokens( match[ i ] ); 2809 if ( cached[ expando ] ) { 2810 setMatchers.push( cached ); 2811 } else { 2812 elementMatchers.push( cached ); 2813 } 2814 } 2815 2816 // Cache the compiled function 2817 cached = compilerCache( 2818 selector, 2819 matcherFromGroupMatchers( elementMatchers, setMatchers ) 2820 ); 2821 2822 // Save selector and tokenization 2823 cached.selector = selector; 2824 } 2825 return cached; 2826}; 2827 2828/** 2829 * A low-level selection function that works with Sizzle's compiled 2830 * selector functions 2831 * @param {String|Function} selector A selector or a pre-compiled 2832 * selector function built with Sizzle.compile 2833 * @param {Element} context 2834 * @param {Array} [results] 2835 * @param {Array} [seed] A set of elements to match against 2836 */ 2837select = Sizzle.select = function( selector, context, results, seed ) { 2838 var i, tokens, token, type, find, 2839 compiled = typeof selector === "function" && selector, 2840 match = !seed && tokenize( ( selector = compiled.selector || selector ) ); 2841 2842 results = results || []; 2843 2844 // Try to minimize operations if there is only one selector in the list and no seed 2845 // (the latter of which guarantees us context) 2846 if ( match.length === 1 ) { 2847 2848 // Reduce context if the leading compound selector is an ID 2849 tokens = match[ 0 ] = match[ 0 ].slice( 0 ); 2850 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && 2851 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { 2852 2853 context = ( Expr.find[ "ID" ]( token.matches[ 0 ] 2854 .replace( runescape, funescape ), context ) || [] )[ 0 ]; 2855 if ( !context ) { 2856 return results; 2857 2858 // Precompiled matchers will still verify ancestry, so step up a level 2859 } else if ( compiled ) { 2860 context = context.parentNode; 2861 } 2862 2863 selector = selector.slice( tokens.shift().value.length ); 2864 } 2865 2866 // Fetch a seed set for right-to-left matching 2867 i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length; 2868 while ( i-- ) { 2869 token = tokens[ i ]; 2870 2871 // Abort if we hit a combinator 2872 if ( Expr.relative[ ( type = token.type ) ] ) { 2873 break; 2874 } 2875 if ( ( find = Expr.find[ type ] ) ) { 2876 2877 // Search, expanding context for leading sibling combinators 2878 if ( ( seed = find( 2879 token.matches[ 0 ].replace( runescape, funescape ), 2880 rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) || 2881 context 2882 ) ) ) { 2883 2884 // If seed is empty or no tokens remain, we can return early 2885 tokens.splice( i, 1 ); 2886 selector = seed.length && toSelector( tokens ); 2887 if ( !selector ) { 2888 push.apply( results, seed ); 2889 return results; 2890 } 2891 2892 break; 2893 } 2894 } 2895 } 2896 } 2897 2898 // Compile and execute a filtering function if one is not provided 2899 // Provide `match` to avoid retokenization if we modified the selector above 2900 ( compiled || compile( selector, match ) )( 2901 seed, 2902 context, 2903 !documentIsHTML, 2904 results, 2905 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 2906 ); 2907 return results; 2908}; 2909 2910// One-time assignments 2911 2912// Sort stability 2913support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; 2914 2915// Support: Chrome 14-35+ 2916// Always assume duplicates if they aren't passed to the comparison function 2917support.detectDuplicates = !!hasDuplicate; 2918 2919// Initialize against the default document 2920setDocument(); 2921 2922// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 2923// Detached nodes confoundingly follow *each other* 2924support.sortDetached = assert( function( el ) { 2925 2926 // Should return 1, but returns 4 (following) 2927 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; 2928} ); 2929 2930// Support: IE<8 2931// Prevent attribute/property "interpolation" 2932// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 2933if ( !assert( function( el ) { 2934 el.innerHTML = "<a href='#'></a>"; 2935 return el.firstChild.getAttribute( "href" ) === "#"; 2936} ) ) { 2937 addHandle( "type|href|height|width", function( elem, name, isXML ) { 2938 if ( !isXML ) { 2939 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); 2940 } 2941 } ); 2942} 2943 2944// Support: IE<9 2945// Use defaultValue in place of getAttribute("value") 2946if ( !support.attributes || !assert( function( el ) { 2947 el.innerHTML = "<input/>"; 2948 el.firstChild.setAttribute( "value", "" ); 2949 return el.firstChild.getAttribute( "value" ) === ""; 2950} ) ) { 2951 addHandle( "value", function( elem, _name, isXML ) { 2952 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { 2953 return elem.defaultValue; 2954 } 2955 } ); 2956} 2957 2958// Support: IE<9 2959// Use getAttributeNode to fetch booleans when getAttribute lies 2960if ( !assert( function( el ) { 2961 return el.getAttribute( "disabled" ) == null; 2962} ) ) { 2963 addHandle( booleans, function( elem, name, isXML ) { 2964 var val; 2965 if ( !isXML ) { 2966 return elem[ name ] === true ? name.toLowerCase() : 2967 ( val = elem.getAttributeNode( name ) ) && val.specified ? 2968 val.value : 2969 null; 2970 } 2971 } ); 2972} 2973 2974return Sizzle; 2975 2976} )( window ); 2977 2978 2979 2980jQuery.find = Sizzle; 2981jQuery.expr = Sizzle.selectors; 2982 2983// Deprecated 2984jQuery.expr[ ":" ] = jQuery.expr.pseudos; 2985jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; 2986jQuery.text = Sizzle.getText; 2987jQuery.isXMLDoc = Sizzle.isXML; 2988jQuery.contains = Sizzle.contains; 2989jQuery.escapeSelector = Sizzle.escape; 2990 2991 2992 2993 2994var dir = function( elem, dir, until ) { 2995 var matched = [], 2996 truncate = until !== undefined; 2997 2998 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 2999 if ( elem.nodeType === 1 ) { 3000 if ( truncate && jQuery( elem ).is( until ) ) { 3001 break; 3002 } 3003 matched.push( elem ); 3004 } 3005 } 3006 return matched; 3007}; 3008 3009 3010var siblings = function( n, elem ) { 3011 var matched = []; 3012 3013 for ( ; n; n = n.nextSibling ) { 3014 if ( n.nodeType === 1 && n !== elem ) { 3015 matched.push( n ); 3016 } 3017 } 3018 3019 return matched; 3020}; 3021 3022 3023var rneedsContext = jQuery.expr.match.needsContext; 3024 3025 3026 3027function nodeName( elem, name ) { 3028 3029 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 3030 3031} 3032var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); 3033 3034 3035 3036// Implement the identical functionality for filter and not 3037function winnow( elements, qualifier, not ) { 3038 if ( isFunction( qualifier ) ) { 3039 return jQuery.grep( elements, function( elem, i ) { 3040 return !!qualifier.call( elem, i, elem ) !== not; 3041 } ); 3042 } 3043 3044 // Single element 3045 if ( qualifier.nodeType ) { 3046 return jQuery.grep( elements, function( elem ) { 3047 return ( elem === qualifier ) !== not; 3048 } ); 3049 } 3050 3051 // Arraylike of elements (jQuery, arguments, Array) 3052 if ( typeof qualifier !== "string" ) { 3053 return jQuery.grep( elements, function( elem ) { 3054 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 3055 } ); 3056 } 3057 3058 // Filtered directly for both simple and complex selectors 3059 return jQuery.filter( qualifier, elements, not ); 3060} 3061 3062jQuery.filter = function( expr, elems, not ) { 3063 var elem = elems[ 0 ]; 3064 3065 if ( not ) { 3066 expr = ":not(" + expr + ")"; 3067 } 3068 3069 if ( elems.length === 1 && elem.nodeType === 1 ) { 3070 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; 3071 } 3072 3073 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 3074 return elem.nodeType === 1; 3075 } ) ); 3076}; 3077 3078jQuery.fn.extend( { 3079 find: function( selector ) { 3080 var i, ret, 3081 len = this.length, 3082 self = this; 3083 3084 if ( typeof selector !== "string" ) { 3085 return this.pushStack( jQuery( selector ).filter( function() { 3086 for ( i = 0; i < len; i++ ) { 3087 if ( jQuery.contains( self[ i ], this ) ) { 3088 return true; 3089 } 3090 } 3091 } ) ); 3092 } 3093 3094 ret = this.pushStack( [] ); 3095 3096 for ( i = 0; i < len; i++ ) { 3097 jQuery.find( selector, self[ i ], ret ); 3098 } 3099 3100 return len > 1 ? jQuery.uniqueSort( ret ) : ret; 3101 }, 3102 filter: function( selector ) { 3103 return this.pushStack( winnow( this, selector || [], false ) ); 3104 }, 3105 not: function( selector ) { 3106 return this.pushStack( winnow( this, selector || [], true ) ); 3107 }, 3108 is: function( selector ) { 3109 return !!winnow( 3110 this, 3111 3112 // If this is a positional/relative selector, check membership in the returned set 3113 // so $("p:first").is("p:last") won't return true for a doc with two "p". 3114 typeof selector === "string" && rneedsContext.test( selector ) ? 3115 jQuery( selector ) : 3116 selector || [], 3117 false 3118 ).length; 3119 } 3120} ); 3121 3122 3123// Initialize a jQuery object 3124 3125 3126// A central reference to the root jQuery(document) 3127var rootjQuery, 3128 3129 // A simple way to check for HTML strings 3130 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 3131 // Strict HTML recognition (#11290: must start with <) 3132 // Shortcut simple #id case for speed 3133 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 3134 3135 init = jQuery.fn.init = function( selector, context, root ) { 3136 var match, elem; 3137 3138 // HANDLE: $(""), $(null), $(undefined), $(false) 3139 if ( !selector ) { 3140 return this; 3141 } 3142 3143 // Method init() accepts an alternate rootjQuery 3144 // so migrate can support jQuery.sub (gh-2101) 3145 root = root || rootjQuery; 3146 3147 // Handle HTML strings 3148 if ( typeof selector === "string" ) { 3149 if ( selector[ 0 ] === "<" && 3150 selector[ selector.length - 1 ] === ">" && 3151 selector.length >= 3 ) { 3152 3153 // Assume that strings that start and end with <> are HTML and skip the regex check 3154 match = [ null, selector, null ]; 3155 3156 } else { 3157 match = rquickExpr.exec( selector ); 3158 } 3159 3160 // Match html or make sure no context is specified for #id 3161 if ( match && ( match[ 1 ] || !context ) ) { 3162 3163 // HANDLE: $(html) -> $(array) 3164 if ( match[ 1 ] ) { 3165 context = context instanceof jQuery ? context[ 0 ] : context; 3166 3167 // Option to run scripts is true for back-compat 3168 // Intentionally let the error be thrown if parseHTML is not present 3169 jQuery.merge( this, jQuery.parseHTML( 3170 match[ 1 ], 3171 context && context.nodeType ? context.ownerDocument || context : document, 3172 true 3173 ) ); 3174 3175 // HANDLE: $(html, props) 3176 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 3177 for ( match in context ) { 3178 3179 // Properties of context are called as methods if possible 3180 if ( isFunction( this[ match ] ) ) { 3181 this[ match ]( context[ match ] ); 3182 3183 // ...and otherwise set as attributes 3184 } else { 3185 this.attr( match, context[ match ] ); 3186 } 3187 } 3188 } 3189 3190 return this; 3191 3192 // HANDLE: $(#id) 3193 } else { 3194 elem = document.getElementById( match[ 2 ] ); 3195 3196 if ( elem ) { 3197 3198 // Inject the element directly into the jQuery object 3199 this[ 0 ] = elem; 3200 this.length = 1; 3201 } 3202 return this; 3203 } 3204 3205 // HANDLE: $(expr, $(...)) 3206 } else if ( !context || context.jquery ) { 3207 return ( context || root ).find( selector ); 3208 3209 // HANDLE: $(expr, context) 3210 // (which is just equivalent to: $(context).find(expr) 3211 } else { 3212 return this.constructor( context ).find( selector ); 3213 } 3214 3215 // HANDLE: $(DOMElement) 3216 } else if ( selector.nodeType ) { 3217 this[ 0 ] = selector; 3218 this.length = 1; 3219 return this; 3220 3221 // HANDLE: $(function) 3222 // Shortcut for document ready 3223 } else if ( isFunction( selector ) ) { 3224 return root.ready !== undefined ? 3225 root.ready( selector ) : 3226 3227 // Execute immediately if ready is not present 3228 selector( jQuery ); 3229 } 3230 3231 return jQuery.makeArray( selector, this ); 3232 }; 3233 3234// Give the init function the jQuery prototype for later instantiation 3235init.prototype = jQuery.fn; 3236 3237// Initialize central reference 3238rootjQuery = jQuery( document ); 3239 3240 3241var rparentsprev = /^(?:parents|prev(?:Until|All))/, 3242 3243 // Methods guaranteed to produce a unique set when starting from a unique set 3244 guaranteedUnique = { 3245 children: true, 3246 contents: true, 3247 next: true, 3248 prev: true 3249 }; 3250 3251jQuery.fn.extend( { 3252 has: function( target ) { 3253 var targets = jQuery( target, this ), 3254 l = targets.length; 3255 3256 return this.filter( function() { 3257 var i = 0; 3258 for ( ; i < l; i++ ) { 3259 if ( jQuery.contains( this, targets[ i ] ) ) { 3260 return true; 3261 } 3262 } 3263 } ); 3264 }, 3265 3266 closest: function( selectors, context ) { 3267 var cur, 3268 i = 0, 3269 l = this.length, 3270 matched = [], 3271 targets = typeof selectors !== "string" && jQuery( selectors ); 3272 3273 // Positional selectors never match, since there's no _selection_ context 3274 if ( !rneedsContext.test( selectors ) ) { 3275 for ( ; i < l; i++ ) { 3276 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 3277 3278 // Always skip document fragments 3279 if ( cur.nodeType < 11 && ( targets ? 3280 targets.index( cur ) > -1 : 3281 3282 // Don't pass non-elements to Sizzle 3283 cur.nodeType === 1 && 3284 jQuery.find.matchesSelector( cur, selectors ) ) ) { 3285 3286 matched.push( cur ); 3287 break; 3288 } 3289 } 3290 } 3291 } 3292 3293 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 3294 }, 3295 3296 // Determine the position of an element within the set 3297 index: function( elem ) { 3298 3299 // No argument, return index in parent 3300 if ( !elem ) { 3301 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 3302 } 3303 3304 // Index in selector 3305 if ( typeof elem === "string" ) { 3306 return indexOf.call( jQuery( elem ), this[ 0 ] ); 3307 } 3308 3309 // Locate the position of the desired element 3310 return indexOf.call( this, 3311 3312 // If it receives a jQuery object, the first element is used 3313 elem.jquery ? elem[ 0 ] : elem 3314 ); 3315 }, 3316 3317 add: function( selector, context ) { 3318 return this.pushStack( 3319 jQuery.uniqueSort( 3320 jQuery.merge( this.get(), jQuery( selector, context ) ) 3321 ) 3322 ); 3323 }, 3324 3325 addBack: function( selector ) { 3326 return this.add( selector == null ? 3327 this.prevObject : this.prevObject.filter( selector ) 3328 ); 3329 } 3330} ); 3331 3332function sibling( cur, dir ) { 3333 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 3334 return cur; 3335} 3336 3337jQuery.each( { 3338 parent: function( elem ) { 3339 var parent = elem.parentNode; 3340 return parent && parent.nodeType !== 11 ? parent : null; 3341 }, 3342 parents: function( elem ) { 3343 return dir( elem, "parentNode" ); 3344 }, 3345 parentsUntil: function( elem, _i, until ) { 3346 return dir( elem, "parentNode", until ); 3347 }, 3348 next: function( elem ) { 3349 return sibling( elem, "nextSibling" ); 3350 }, 3351 prev: function( elem ) { 3352 return sibling( elem, "previousSibling" ); 3353 }, 3354 nextAll: function( elem ) { 3355 return dir( elem, "nextSibling" ); 3356 }, 3357 prevAll: function( elem ) { 3358 return dir( elem, "previousSibling" ); 3359 }, 3360 nextUntil: function( elem, _i, until ) { 3361 return dir( elem, "nextSibling", until ); 3362 }, 3363 prevUntil: function( elem, _i, until ) { 3364 return dir( elem, "previousSibling", until ); 3365 }, 3366 siblings: function( elem ) { 3367 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 3368 }, 3369 children: function( elem ) { 3370 return siblings( elem.firstChild ); 3371 }, 3372 contents: function( elem ) { 3373 if ( elem.contentDocument != null && 3374 3375 // Support: IE 11+ 3376 // <object> elements with no `data` attribute has an object 3377 // `contentDocument` with a `null` prototype. 3378 getProto( elem.contentDocument ) ) { 3379 3380 return elem.contentDocument; 3381 } 3382 3383 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 3384 // Treat the template element as a regular one in browsers that 3385 // don't support it. 3386 if ( nodeName( elem, "template" ) ) { 3387 elem = elem.content || elem; 3388 } 3389 3390 return jQuery.merge( [], elem.childNodes ); 3391 } 3392}, function( name, fn ) { 3393 jQuery.fn[ name ] = function( until, selector ) { 3394 var matched = jQuery.map( this, fn, until ); 3395 3396 if ( name.slice( -5 ) !== "Until" ) { 3397 selector = until; 3398 } 3399 3400 if ( selector && typeof selector === "string" ) { 3401 matched = jQuery.filter( selector, matched ); 3402 } 3403 3404 if ( this.length > 1 ) { 3405 3406 // Remove duplicates 3407 if ( !guaranteedUnique[ name ] ) { 3408 jQuery.uniqueSort( matched ); 3409 } 3410 3411 // Reverse order for parents* and prev-derivatives 3412 if ( rparentsprev.test( name ) ) { 3413 matched.reverse(); 3414 } 3415 } 3416 3417 return this.pushStack( matched ); 3418 }; 3419} ); 3420var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); 3421 3422 3423 3424// Convert String-formatted options into Object-formatted ones 3425function createOptions( options ) { 3426 var object = {}; 3427 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { 3428 object[ flag ] = true; 3429 } ); 3430 return object; 3431} 3432 3433/* 3434 * Create a callback list using the following parameters: 3435 * 3436 * options: an optional list of space-separated options that will change how 3437 * the callback list behaves or a more traditional option object 3438 * 3439 * By default a callback list will act like an event callback list and can be 3440 * "fired" multiple times. 3441 * 3442 * Possible options: 3443 * 3444 * once: will ensure the callback list can only be fired once (like a Deferred) 3445 * 3446 * memory: will keep track of previous values and will call any callback added 3447 * after the list has been fired right away with the latest "memorized" 3448 * values (like a Deferred) 3449 * 3450 * unique: will ensure a callback can only be added once (no duplicate in the list) 3451 * 3452 * stopOnFalse: interrupt callings when a callback returns false 3453 * 3454 */ 3455jQuery.Callbacks = function( options ) { 3456 3457 // Convert options from String-formatted to Object-formatted if needed 3458 // (we check in cache first) 3459 options = typeof options === "string" ? 3460 createOptions( options ) : 3461 jQuery.extend( {}, options ); 3462 3463 var // Flag to know if list is currently firing 3464 firing, 3465 3466 // Last fire value for non-forgettable lists 3467 memory, 3468 3469 // Flag to know if list was already fired 3470 fired, 3471 3472 // Flag to prevent firing 3473 locked, 3474 3475 // Actual callback list 3476 list = [], 3477 3478 // Queue of execution data for repeatable lists 3479 queue = [], 3480 3481 // Index of currently firing callback (modified by add/remove as needed) 3482 firingIndex = -1, 3483 3484 // Fire callbacks 3485 fire = function() { 3486 3487 // Enforce single-firing 3488 locked = locked || options.once; 3489 3490 // Execute callbacks for all pending executions, 3491 // respecting firingIndex overrides and runtime changes 3492 fired = firing = true; 3493 for ( ; queue.length; firingIndex = -1 ) { 3494 memory = queue.shift(); 3495 while ( ++firingIndex < list.length ) { 3496 3497 // Run callback and check for early termination 3498 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 3499 options.stopOnFalse ) { 3500 3501 // Jump to end and forget the data so .add doesn't re-fire 3502 firingIndex = list.length; 3503 memory = false; 3504 } 3505 } 3506 } 3507 3508 // Forget the data if we're done with it 3509 if ( !options.memory ) { 3510 memory = false; 3511 } 3512 3513 firing = false; 3514 3515 // Clean up if we're done firing for good 3516 if ( locked ) { 3517 3518 // Keep an empty list if we have data for future add calls 3519 if ( memory ) { 3520 list = []; 3521 3522 // Otherwise, this object is spent 3523 } else { 3524 list = ""; 3525 } 3526 } 3527 }, 3528 3529 // Actual Callbacks object 3530 self = { 3531 3532 // Add a callback or a collection of callbacks to the list 3533 add: function() { 3534 if ( list ) { 3535 3536 // If we have memory from a past run, we should fire after adding 3537 if ( memory && !firing ) { 3538 firingIndex = list.length - 1; 3539 queue.push( memory ); 3540 } 3541 3542 ( function add( args ) { 3543 jQuery.each( args, function( _, arg ) { 3544 if ( isFunction( arg ) ) { 3545 if ( !options.unique || !self.has( arg ) ) { 3546 list.push( arg ); 3547 } 3548 } else if ( arg && arg.length && toType( arg ) !== "string" ) { 3549 3550 // Inspect recursively 3551 add( arg ); 3552 } 3553 } ); 3554 } )( arguments ); 3555 3556 if ( memory && !firing ) { 3557 fire(); 3558 } 3559 } 3560 return this; 3561 }, 3562 3563 // Remove a callback from the list 3564 remove: function() { 3565 jQuery.each( arguments, function( _, arg ) { 3566 var index; 3567 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 3568 list.splice( index, 1 ); 3569 3570 // Handle firing indexes 3571 if ( index <= firingIndex ) { 3572 firingIndex--; 3573 } 3574 } 3575 } ); 3576 return this; 3577 }, 3578 3579 // Check if a given callback is in the list. 3580 // If no argument is given, return whether or not list has callbacks attached. 3581 has: function( fn ) { 3582 return fn ? 3583 jQuery.inArray( fn, list ) > -1 : 3584 list.length > 0; 3585 }, 3586 3587 // Remove all callbacks from the list 3588 empty: function() { 3589 if ( list ) { 3590 list = []; 3591 } 3592 return this; 3593 }, 3594 3595 // Disable .fire and .add 3596 // Abort any current/pending executions 3597 // Clear all callbacks and values 3598 disable: function() { 3599 locked = queue = []; 3600 list = memory = ""; 3601 return this; 3602 }, 3603 disabled: function() { 3604 return !list; 3605 }, 3606 3607 // Disable .fire 3608 // Also disable .add unless we have memory (since it would have no effect) 3609 // Abort any pending executions 3610 lock: function() { 3611 locked = queue = []; 3612 if ( !memory && !firing ) { 3613 list = memory = ""; 3614 } 3615 return this; 3616 }, 3617 locked: function() { 3618 return !!locked; 3619 }, 3620 3621 // Call all callbacks with the given context and arguments 3622 fireWith: function( context, args ) { 3623 if ( !locked ) { 3624 args = args || []; 3625 args = [ context, args.slice ? args.slice() : args ]; 3626 queue.push( args ); 3627 if ( !firing ) { 3628 fire(); 3629 } 3630 } 3631 return this; 3632 }, 3633 3634 // Call all the callbacks with the given arguments 3635 fire: function() { 3636 self.fireWith( this, arguments ); 3637 return this; 3638 }, 3639 3640 // To know if the callbacks have already been called at least once 3641 fired: function() { 3642 return !!fired; 3643 } 3644 }; 3645 3646 return self; 3647}; 3648 3649 3650function Identity( v ) { 3651 return v; 3652} 3653function Thrower( ex ) { 3654 throw ex; 3655} 3656 3657function adoptValue( value, resolve, reject, noValue ) { 3658 var method; 3659 3660 try { 3661 3662 // Check for promise aspect first to privilege synchronous behavior 3663 if ( value && isFunction( ( method = value.promise ) ) ) { 3664 method.call( value ).done( resolve ).fail( reject ); 3665 3666 // Other thenables 3667 } else if ( value && isFunction( ( method = value.then ) ) ) { 3668 method.call( value, resolve, reject ); 3669 3670 // Other non-thenables 3671 } else { 3672 3673 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 3674 // * false: [ value ].slice( 0 ) => resolve( value ) 3675 // * true: [ value ].slice( 1 ) => resolve() 3676 resolve.apply( undefined, [ value ].slice( noValue ) ); 3677 } 3678 3679 // For Promises/A+, convert exceptions into rejections 3680 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 3681 // Deferred#then to conditionally suppress rejection. 3682 } catch ( value ) { 3683 3684 // Support: Android 4.0 only 3685 // Strict mode functions invoked without .call/.apply get global-object context 3686 reject.apply( undefined, [ value ] ); 3687 } 3688} 3689 3690jQuery.extend( { 3691 3692 Deferred: function( func ) { 3693 var tuples = [ 3694 3695 // action, add listener, callbacks, 3696 // ... .then handlers, argument index, [final state] 3697 [ "notify", "progress", jQuery.Callbacks( "memory" ), 3698 jQuery.Callbacks( "memory" ), 2 ], 3699 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 3700 jQuery.Callbacks( "once memory" ), 0, "resolved" ], 3701 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 3702 jQuery.Callbacks( "once memory" ), 1, "rejected" ] 3703 ], 3704 state = "pending", 3705 promise = { 3706 state: function() { 3707 return state; 3708 }, 3709 always: function() { 3710 deferred.done( arguments ).fail( arguments ); 3711 return this; 3712 }, 3713 "catch": function( fn ) { 3714 return promise.then( null, fn ); 3715 }, 3716 3717 // Keep pipe for back-compat 3718 pipe: function( /* fnDone, fnFail, fnProgress */ ) { 3719 var fns = arguments; 3720 3721 return jQuery.Deferred( function( newDefer ) { 3722 jQuery.each( tuples, function( _i, tuple ) { 3723 3724 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 3725 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; 3726 3727 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 3728 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 3729 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 3730 deferred[ tuple[ 1 ] ]( function() { 3731 var returned = fn && fn.apply( this, arguments ); 3732 if ( returned && isFunction( returned.promise ) ) { 3733 returned.promise() 3734 .progress( newDefer.notify ) 3735 .done( newDefer.resolve ) 3736 .fail( newDefer.reject ); 3737 } else { 3738 newDefer[ tuple[ 0 ] + "With" ]( 3739 this, 3740 fn ? [ returned ] : arguments 3741 ); 3742 } 3743 } ); 3744 } ); 3745 fns = null; 3746 } ).promise(); 3747 }, 3748 then: function( onFulfilled, onRejected, onProgress ) { 3749 var maxDepth = 0; 3750 function resolve( depth, deferred, handler, special ) { 3751 return function() { 3752 var that = this, 3753 args = arguments, 3754 mightThrow = function() { 3755 var returned, then; 3756 3757 // Support: Promises/A+ section 2.3.3.3.3 3758 // https://promisesaplus.com/#point-59 3759 // Ignore double-resolution attempts 3760 if ( depth < maxDepth ) { 3761 return; 3762 } 3763 3764 returned = handler.apply( that, args ); 3765 3766 // Support: Promises/A+ section 2.3.1 3767 // https://promisesaplus.com/#point-48 3768 if ( returned === deferred.promise() ) { 3769 throw new TypeError( "Thenable self-resolution" ); 3770 } 3771 3772 // Support: Promises/A+ sections 2.3.3.1, 3.5 3773 // https://promisesaplus.com/#point-54 3774 // https://promisesaplus.com/#point-75 3775 // Retrieve `then` only once 3776 then = returned && 3777 3778 // Support: Promises/A+ section 2.3.4 3779 // https://promisesaplus.com/#point-64 3780 // Only check objects and functions for thenability 3781 ( typeof returned === "object" || 3782 typeof returned === "function" ) && 3783 returned.then; 3784 3785 // Handle a returned thenable 3786 if ( isFunction( then ) ) { 3787 3788 // Special processors (notify) just wait for resolution 3789 if ( special ) { 3790 then.call( 3791 returned, 3792 resolve( maxDepth, deferred, Identity, special ), 3793 resolve( maxDepth, deferred, Thrower, special ) 3794 ); 3795 3796 // Normal processors (resolve) also hook into progress 3797 } else { 3798 3799 // ...and disregard older resolution values 3800 maxDepth++; 3801 3802 then.call( 3803 returned, 3804 resolve( maxDepth, deferred, Identity, special ), 3805 resolve( maxDepth, deferred, Thrower, special ), 3806 resolve( maxDepth, deferred, Identity, 3807 deferred.notifyWith ) 3808 ); 3809 } 3810 3811 // Handle all other returned values 3812 } else { 3813 3814 // Only substitute handlers pass on context 3815 // and multiple values (non-spec behavior) 3816 if ( handler !== Identity ) { 3817 that = undefined; 3818 args = [ returned ]; 3819 } 3820 3821 // Process the value(s) 3822 // Default process is resolve 3823 ( special || deferred.resolveWith )( that, args ); 3824 } 3825 }, 3826 3827 // Only normal processors (resolve) catch and reject exceptions 3828 process = special ? 3829 mightThrow : 3830 function() { 3831 try { 3832 mightThrow(); 3833 } catch ( e ) { 3834 3835 if ( jQuery.Deferred.exceptionHook ) { 3836 jQuery.Deferred.exceptionHook( e, 3837 process.stackTrace ); 3838 } 3839 3840 // Support: Promises/A+ section 2.3.3.3.4.1 3841 // https://promisesaplus.com/#point-61 3842 // Ignore post-resolution exceptions 3843 if ( depth + 1 >= maxDepth ) { 3844 3845 // Only substitute handlers pass on context 3846 // and multiple values (non-spec behavior) 3847 if ( handler !== Thrower ) { 3848 that = undefined; 3849 args = [ e ]; 3850 } 3851 3852 deferred.rejectWith( that, args ); 3853 } 3854 } 3855 }; 3856 3857 // Support: Promises/A+ section 2.3.3.3.1 3858 // https://promisesaplus.com/#point-57 3859 // Re-resolve promises immediately to dodge false rejection from 3860 // subsequent errors 3861 if ( depth ) { 3862 process(); 3863 } else { 3864 3865 // Call an optional hook to record the stack, in case of exception 3866 // since it's otherwise lost when execution goes async 3867 if ( jQuery.Deferred.getStackHook ) { 3868 process.stackTrace = jQuery.Deferred.getStackHook(); 3869 } 3870 window.setTimeout( process ); 3871 } 3872 }; 3873 } 3874 3875 return jQuery.Deferred( function( newDefer ) { 3876 3877 // progress_handlers.add( ... ) 3878 tuples[ 0 ][ 3 ].add( 3879 resolve( 3880 0, 3881 newDefer, 3882 isFunction( onProgress ) ? 3883 onProgress : 3884 Identity, 3885 newDefer.notifyWith 3886 ) 3887 ); 3888 3889 // fulfilled_handlers.add( ... ) 3890 tuples[ 1 ][ 3 ].add( 3891 resolve( 3892 0, 3893 newDefer, 3894 isFunction( onFulfilled ) ? 3895 onFulfilled : 3896 Identity 3897 ) 3898 ); 3899 3900 // rejected_handlers.add( ... ) 3901 tuples[ 2 ][ 3 ].add( 3902 resolve( 3903 0, 3904 newDefer, 3905 isFunction( onRejected ) ? 3906 onRejected : 3907 Thrower 3908 ) 3909 ); 3910 } ).promise(); 3911 }, 3912 3913 // Get a promise for this deferred 3914 // If obj is provided, the promise aspect is added to the object 3915 promise: function( obj ) { 3916 return obj != null ? jQuery.extend( obj, promise ) : promise; 3917 } 3918 }, 3919 deferred = {}; 3920 3921 // Add list-specific methods 3922 jQuery.each( tuples, function( i, tuple ) { 3923 var list = tuple[ 2 ], 3924 stateString = tuple[ 5 ]; 3925 3926 // promise.progress = list.add 3927 // promise.done = list.add 3928 // promise.fail = list.add 3929 promise[ tuple[ 1 ] ] = list.add; 3930 3931 // Handle state 3932 if ( stateString ) { 3933 list.add( 3934 function() { 3935 3936 // state = "resolved" (i.e., fulfilled) 3937 // state = "rejected" 3938 state = stateString; 3939 }, 3940 3941 // rejected_callbacks.disable 3942 // fulfilled_callbacks.disable 3943 tuples[ 3 - i ][ 2 ].disable, 3944 3945 // rejected_handlers.disable 3946 // fulfilled_handlers.disable 3947 tuples[ 3 - i ][ 3 ].disable, 3948 3949 // progress_callbacks.lock 3950 tuples[ 0 ][ 2 ].lock, 3951 3952 // progress_handlers.lock 3953 tuples[ 0 ][ 3 ].lock 3954 ); 3955 } 3956 3957 // progress_handlers.fire 3958 // fulfilled_handlers.fire 3959 // rejected_handlers.fire 3960 list.add( tuple[ 3 ].fire ); 3961 3962 // deferred.notify = function() { deferred.notifyWith(...) } 3963 // deferred.resolve = function() { deferred.resolveWith(...) } 3964 // deferred.reject = function() { deferred.rejectWith(...) } 3965 deferred[ tuple[ 0 ] ] = function() { 3966 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); 3967 return this; 3968 }; 3969 3970 // deferred.notifyWith = list.fireWith 3971 // deferred.resolveWith = list.fireWith 3972 // deferred.rejectWith = list.fireWith 3973 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 3974 } ); 3975 3976 // Make the deferred a promise 3977 promise.promise( deferred ); 3978 3979 // Call given func if any 3980 if ( func ) { 3981 func.call( deferred, deferred ); 3982 } 3983 3984 // All done! 3985 return deferred; 3986 }, 3987 3988 // Deferred helper 3989 when: function( singleValue ) { 3990 var 3991 3992 // count of uncompleted subordinates 3993 remaining = arguments.length, 3994 3995 // count of unprocessed arguments 3996 i = remaining, 3997 3998 // subordinate fulfillment data 3999 resolveContexts = Array( i ), 4000 resolveValues = slice.call( arguments ), 4001 4002 // the primary Deferred 4003 primary = jQuery.Deferred(), 4004 4005 // subordinate callback factory 4006 updateFunc = function( i ) { 4007 return function( value ) { 4008 resolveContexts[ i ] = this; 4009 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 4010 if ( !( --remaining ) ) { 4011 primary.resolveWith( resolveContexts, resolveValues ); 4012 } 4013 }; 4014 }; 4015 4016 // Single- and empty arguments are adopted like Promise.resolve 4017 if ( remaining <= 1 ) { 4018 adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, 4019 !remaining ); 4020 4021 // Use .then() to unwrap secondary thenables (cf. gh-3000) 4022 if ( primary.state() === "pending" || 4023 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { 4024 4025 return primary.then(); 4026 } 4027 } 4028 4029 // Multiple arguments are aggregated like Promise.all array elements 4030 while ( i-- ) { 4031 adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); 4032 } 4033 4034 return primary.promise(); 4035 } 4036} ); 4037 4038 4039// These usually indicate a programmer mistake during development, 4040// warn about them ASAP rather than swallowing them by default. 4041var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 4042 4043jQuery.Deferred.exceptionHook = function( error, stack ) { 4044 4045 // Support: IE 8 - 9 only 4046 // Console exists when dev tools are open, which can happen at any time 4047 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 4048 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); 4049 } 4050}; 4051 4052 4053 4054 4055jQuery.readyException = function( error ) { 4056 window.setTimeout( function() { 4057 throw error; 4058 } ); 4059}; 4060 4061 4062 4063 4064// The deferred used on DOM ready 4065var readyList = jQuery.Deferred(); 4066 4067jQuery.fn.ready = function( fn ) { 4068 4069 readyList 4070 .then( fn ) 4071 4072 // Wrap jQuery.readyException in a function so that the lookup 4073 // happens at the time of error handling instead of callback 4074 // registration. 4075 .catch( function( error ) { 4076 jQuery.readyException( error ); 4077 } ); 4078 4079 return this; 4080}; 4081 4082jQuery.extend( { 4083 4084 // Is the DOM ready to be used? Set to true once it occurs. 4085 isReady: false, 4086 4087 // A counter to track how many items to wait for before 4088 // the ready event fires. See #6781 4089 readyWait: 1, 4090 4091 // Handle when the DOM is ready 4092 ready: function( wait ) { 4093 4094 // Abort if there are pending holds or we're already ready 4095 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 4096 return; 4097 } 4098 4099 // Remember that the DOM is ready 4100 jQuery.isReady = true; 4101 4102 // If a normal DOM Ready event fired, decrement, and wait if need be 4103 if ( wait !== true && --jQuery.readyWait > 0 ) { 4104 return; 4105 } 4106 4107 // If there are functions bound, to execute 4108 readyList.resolveWith( document, [ jQuery ] ); 4109 } 4110} ); 4111 4112jQuery.ready.then = readyList.then; 4113 4114// The ready event handler and self cleanup method 4115function completed() { 4116 document.removeEventListener( "DOMContentLoaded", completed ); 4117 window.removeEventListener( "load", completed ); 4118 jQuery.ready(); 4119} 4120 4121// Catch cases where $(document).ready() is called 4122// after the browser event has already occurred. 4123// Support: IE <=9 - 10 only 4124// Older IE sometimes signals "interactive" too soon 4125if ( document.readyState === "complete" || 4126 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 4127 4128 // Handle it asynchronously to allow scripts the opportunity to delay ready 4129 window.setTimeout( jQuery.ready ); 4130 4131} else { 4132 4133 // Use the handy event callback 4134 document.addEventListener( "DOMContentLoaded", completed ); 4135 4136 // A fallback to window.onload, that will always work 4137 window.addEventListener( "load", completed ); 4138} 4139 4140 4141 4142 4143// Multifunctional method to get and set values of a collection 4144// The value/s can optionally be executed if it's a function 4145var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 4146 var i = 0, 4147 len = elems.length, 4148 bulk = key == null; 4149 4150 // Sets many values 4151 if ( toType( key ) === "object" ) { 4152 chainable = true; 4153 for ( i in key ) { 4154 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 4155 } 4156 4157 // Sets one value 4158 } else if ( value !== undefined ) { 4159 chainable = true; 4160 4161 if ( !isFunction( value ) ) { 4162 raw = true; 4163 } 4164 4165 if ( bulk ) { 4166 4167 // Bulk operations run against the entire set 4168 if ( raw ) { 4169 fn.call( elems, value ); 4170 fn = null; 4171 4172 // ...except when executing function values 4173 } else { 4174 bulk = fn; 4175 fn = function( elem, _key, value ) { 4176 return bulk.call( jQuery( elem ), value ); 4177 }; 4178 } 4179 } 4180 4181 if ( fn ) { 4182 for ( ; i < len; i++ ) { 4183 fn( 4184 elems[ i ], key, raw ? 4185 value : 4186 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 4187 ); 4188 } 4189 } 4190 } 4191 4192 if ( chainable ) { 4193 return elems; 4194 } 4195 4196 // Gets 4197 if ( bulk ) { 4198 return fn.call( elems ); 4199 } 4200 4201 return len ? fn( elems[ 0 ], key ) : emptyGet; 4202}; 4203 4204 4205// Matches dashed string for camelizing 4206var rmsPrefix = /^-ms-/, 4207 rdashAlpha = /-([a-z])/g; 4208 4209// Used by camelCase as callback to replace() 4210function fcamelCase( _all, letter ) { 4211 return letter.toUpperCase(); 4212} 4213 4214// Convert dashed to camelCase; used by the css and data modules 4215// Support: IE <=9 - 11, Edge 12 - 15 4216// Microsoft forgot to hump their vendor prefix (#9572) 4217function camelCase( string ) { 4218 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 4219} 4220var acceptData = function( owner ) { 4221 4222 // Accepts only: 4223 // - Node 4224 // - Node.ELEMENT_NODE 4225 // - Node.DOCUMENT_NODE 4226 // - Object 4227 // - Any 4228 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 4229}; 4230 4231 4232 4233 4234function Data() { 4235 this.expando = jQuery.expando + Data.uid++; 4236} 4237 4238Data.uid = 1; 4239 4240Data.prototype = { 4241 4242 cache: function( owner ) { 4243 4244 // Check if the owner object already has a cache 4245 var value = owner[ this.expando ]; 4246 4247 // If not, create one 4248 if ( !value ) { 4249 value = {}; 4250 4251 // We can accept data for non-element nodes in modern browsers, 4252 // but we should not, see #8335. 4253 // Always return an empty object. 4254 if ( acceptData( owner ) ) { 4255 4256 // If it is a node unlikely to be stringify-ed or looped over 4257 // use plain assignment 4258 if ( owner.nodeType ) { 4259 owner[ this.expando ] = value; 4260 4261 // Otherwise secure it in a non-enumerable property 4262 // configurable must be true to allow the property to be 4263 // deleted when data is removed 4264 } else { 4265 Object.defineProperty( owner, this.expando, { 4266 value: value, 4267 configurable: true 4268 } ); 4269 } 4270 } 4271 } 4272 4273 return value; 4274 }, 4275 set: function( owner, data, value ) { 4276 var prop, 4277 cache = this.cache( owner ); 4278 4279 // Handle: [ owner, key, value ] args 4280 // Always use camelCase key (gh-2257) 4281 if ( typeof data === "string" ) { 4282 cache[ camelCase( data ) ] = value; 4283 4284 // Handle: [ owner, { properties } ] args 4285 } else { 4286 4287 // Copy the properties one-by-one to the cache object 4288 for ( prop in data ) { 4289 cache[ camelCase( prop ) ] = data[ prop ]; 4290 } 4291 } 4292 return cache; 4293 }, 4294 get: function( owner, key ) { 4295 return key === undefined ? 4296 this.cache( owner ) : 4297 4298 // Always use camelCase key (gh-2257) 4299 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; 4300 }, 4301 access: function( owner, key, value ) { 4302 4303 // In cases where either: 4304 // 4305 // 1. No key was specified 4306 // 2. A string key was specified, but no value provided 4307 // 4308 // Take the "read" path and allow the get method to determine 4309 // which value to return, respectively either: 4310 // 4311 // 1. The entire cache object 4312 // 2. The data stored at the key 4313 // 4314 if ( key === undefined || 4315 ( ( key && typeof key === "string" ) && value === undefined ) ) { 4316 4317 return this.get( owner, key ); 4318 } 4319 4320 // When the key is not a string, or both a key and value 4321 // are specified, set or extend (existing objects) with either: 4322 // 4323 // 1. An object of properties 4324 // 2. A key and value 4325 // 4326 this.set( owner, key, value ); 4327 4328 // Since the "set" path can have two possible entry points 4329 // return the expected data based on which path was taken[*] 4330 return value !== undefined ? value : key; 4331 }, 4332 remove: function( owner, key ) { 4333 var i, 4334 cache = owner[ this.expando ]; 4335 4336 if ( cache === undefined ) { 4337 return; 4338 } 4339 4340 if ( key !== undefined ) { 4341 4342 // Support array or space separated string of keys 4343 if ( Array.isArray( key ) ) { 4344 4345 // If key is an array of keys... 4346 // We always set camelCase keys, so remove that. 4347 key = key.map( camelCase ); 4348 } else { 4349 key = camelCase( key ); 4350 4351 // If a key with the spaces exists, use it. 4352 // Otherwise, create an array by matching non-whitespace 4353 key = key in cache ? 4354 [ key ] : 4355 ( key.match( rnothtmlwhite ) || [] ); 4356 } 4357 4358 i = key.length; 4359 4360 while ( i-- ) { 4361 delete cache[ key[ i ] ]; 4362 } 4363 } 4364 4365 // Remove the expando if there's no more data 4366 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 4367 4368 // Support: Chrome <=35 - 45 4369 // Webkit & Blink performance suffers when deleting properties 4370 // from DOM nodes, so set to undefined instead 4371 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 4372 if ( owner.nodeType ) { 4373 owner[ this.expando ] = undefined; 4374 } else { 4375 delete owner[ this.expando ]; 4376 } 4377 } 4378 }, 4379 hasData: function( owner ) { 4380 var cache = owner[ this.expando ]; 4381 return cache !== undefined && !jQuery.isEmptyObject( cache ); 4382 } 4383}; 4384var dataPriv = new Data(); 4385 4386var dataUser = new Data(); 4387 4388 4389 4390// Implementation Summary 4391// 4392// 1. Enforce API surface and semantic compatibility with 1.9.x branch 4393// 2. Improve the module's maintainability by reducing the storage 4394// paths to a single mechanism. 4395// 3. Use the same single mechanism to support "private" and "user" data. 4396// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 4397// 5. Avoid exposing implementation details on user objects (eg. expando properties) 4398// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 4399 4400var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 4401 rmultiDash = /[A-Z]/g; 4402 4403function getData( data ) { 4404 if ( data === "true" ) { 4405 return true; 4406 } 4407 4408 if ( data === "false" ) { 4409 return false; 4410 } 4411 4412 if ( data === "null" ) { 4413 return null; 4414 } 4415 4416 // Only convert to a number if it doesn't change the string 4417 if ( data === +data + "" ) { 4418 return +data; 4419 } 4420 4421 if ( rbrace.test( data ) ) { 4422 return JSON.parse( data ); 4423 } 4424 4425 return data; 4426} 4427 4428function dataAttr( elem, key, data ) { 4429 var name; 4430 4431 // If nothing was found internally, try to fetch any 4432 // data from the HTML5 data-* attribute 4433 if ( data === undefined && elem.nodeType === 1 ) { 4434 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 4435 data = elem.getAttribute( name ); 4436 4437 if ( typeof data === "string" ) { 4438 try { 4439 data = getData( data ); 4440 } catch ( e ) {} 4441 4442 // Make sure we set the data so it isn't changed later 4443 dataUser.set( elem, key, data ); 4444 } else { 4445 data = undefined; 4446 } 4447 } 4448 return data; 4449} 4450 4451jQuery.extend( { 4452 hasData: function( elem ) { 4453 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 4454 }, 4455 4456 data: function( elem, name, data ) { 4457 return dataUser.access( elem, name, data ); 4458 }, 4459 4460 removeData: function( elem, name ) { 4461 dataUser.remove( elem, name ); 4462 }, 4463 4464 // TODO: Now that all calls to _data and _removeData have been replaced 4465 // with direct calls to dataPriv methods, these can be deprecated. 4466 _data: function( elem, name, data ) { 4467 return dataPriv.access( elem, name, data ); 4468 }, 4469 4470 _removeData: function( elem, name ) { 4471 dataPriv.remove( elem, name ); 4472 } 4473} ); 4474 4475jQuery.fn.extend( { 4476 data: function( key, value ) { 4477 var i, name, data, 4478 elem = this[ 0 ], 4479 attrs = elem && elem.attributes; 4480 4481 // Gets all values 4482 if ( key === undefined ) { 4483 if ( this.length ) { 4484 data = dataUser.get( elem ); 4485 4486 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 4487 i = attrs.length; 4488 while ( i-- ) { 4489 4490 // Support: IE 11 only 4491 // The attrs elements can be null (#14894) 4492 if ( attrs[ i ] ) { 4493 name = attrs[ i ].name; 4494 if ( name.indexOf( "data-" ) === 0 ) { 4495 name = camelCase( name.slice( 5 ) ); 4496 dataAttr( elem, name, data[ name ] ); 4497 } 4498 } 4499 } 4500 dataPriv.set( elem, "hasDataAttrs", true ); 4501 } 4502 } 4503 4504 return data; 4505 } 4506 4507 // Sets multiple values 4508 if ( typeof key === "object" ) { 4509 return this.each( function() { 4510 dataUser.set( this, key ); 4511 } ); 4512 } 4513 4514 return access( this, function( value ) { 4515 var data; 4516 4517 // The calling jQuery object (element matches) is not empty 4518 // (and therefore has an element appears at this[ 0 ]) and the 4519 // `value` parameter was not undefined. An empty jQuery object 4520 // will result in `undefined` for elem = this[ 0 ] which will 4521 // throw an exception if an attempt to read a data cache is made. 4522 if ( elem && value === undefined ) { 4523 4524 // Attempt to get data from the cache 4525 // The key will always be camelCased in Data 4526 data = dataUser.get( elem, key ); 4527 if ( data !== undefined ) { 4528 return data; 4529 } 4530 4531 // Attempt to "discover" the data in 4532 // HTML5 custom data-* attrs 4533 data = dataAttr( elem, key ); 4534 if ( data !== undefined ) { 4535 return data; 4536 } 4537 4538 // We tried really hard, but the data doesn't exist. 4539 return; 4540 } 4541 4542 // Set the data... 4543 this.each( function() { 4544 4545 // We always store the camelCased key 4546 dataUser.set( this, key, value ); 4547 } ); 4548 }, null, value, arguments.length > 1, null, true ); 4549 }, 4550 4551 removeData: function( key ) { 4552 return this.each( function() { 4553 dataUser.remove( this, key ); 4554 } ); 4555 } 4556} ); 4557 4558 4559jQuery.extend( { 4560 queue: function( elem, type, data ) { 4561 var queue; 4562 4563 if ( elem ) { 4564 type = ( type || "fx" ) + "queue"; 4565 queue = dataPriv.get( elem, type ); 4566 4567 // Speed up dequeue by getting out quickly if this is just a lookup 4568 if ( data ) { 4569 if ( !queue || Array.isArray( data ) ) { 4570 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 4571 } else { 4572 queue.push( data ); 4573 } 4574 } 4575 return queue || []; 4576 } 4577 }, 4578 4579 dequeue: function( elem, type ) { 4580 type = type || "fx"; 4581 4582 var queue = jQuery.queue( elem, type ), 4583 startLength = queue.length, 4584 fn = queue.shift(), 4585 hooks = jQuery._queueHooks( elem, type ), 4586 next = function() { 4587 jQuery.dequeue( elem, type ); 4588 }; 4589 4590 // If the fx queue is dequeued, always remove the progress sentinel 4591 if ( fn === "inprogress" ) { 4592 fn = queue.shift(); 4593 startLength--; 4594 } 4595 4596 if ( fn ) { 4597 4598 // Add a progress sentinel to prevent the fx queue from being 4599 // automatically dequeued 4600 if ( type === "fx" ) { 4601 queue.unshift( "inprogress" ); 4602 } 4603 4604 // Clear up the last queue stop function 4605 delete hooks.stop; 4606 fn.call( elem, next, hooks ); 4607 } 4608 4609 if ( !startLength && hooks ) { 4610 hooks.empty.fire(); 4611 } 4612 }, 4613 4614 // Not public - generate a queueHooks object, or return the current one 4615 _queueHooks: function( elem, type ) { 4616 var key = type + "queueHooks"; 4617 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 4618 empty: jQuery.Callbacks( "once memory" ).add( function() { 4619 dataPriv.remove( elem, [ type + "queue", key ] ); 4620 } ) 4621 } ); 4622 } 4623} ); 4624 4625jQuery.fn.extend( { 4626 queue: function( type, data ) { 4627 var setter = 2; 4628 4629 if ( typeof type !== "string" ) { 4630 data = type; 4631 type = "fx"; 4632 setter--; 4633 } 4634 4635 if ( arguments.length < setter ) { 4636 return jQuery.queue( this[ 0 ], type ); 4637 } 4638 4639 return data === undefined ? 4640 this : 4641 this.each( function() { 4642 var queue = jQuery.queue( this, type, data ); 4643 4644 // Ensure a hooks for this queue 4645 jQuery._queueHooks( this, type ); 4646 4647 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 4648 jQuery.dequeue( this, type ); 4649 } 4650 } ); 4651 }, 4652 dequeue: function( type ) { 4653 return this.each( function() { 4654 jQuery.dequeue( this, type ); 4655 } ); 4656 }, 4657 clearQueue: function( type ) { 4658 return this.queue( type || "fx", [] ); 4659 }, 4660 4661 // Get a promise resolved when queues of a certain type 4662 // are emptied (fx is the type by default) 4663 promise: function( type, obj ) { 4664 var tmp, 4665 count = 1, 4666 defer = jQuery.Deferred(), 4667 elements = this, 4668 i = this.length, 4669 resolve = function() { 4670 if ( !( --count ) ) { 4671 defer.resolveWith( elements, [ elements ] ); 4672 } 4673 }; 4674 4675 if ( typeof type !== "string" ) { 4676 obj = type; 4677 type = undefined; 4678 } 4679 type = type || "fx"; 4680 4681 while ( i-- ) { 4682 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 4683 if ( tmp && tmp.empty ) { 4684 count++; 4685 tmp.empty.add( resolve ); 4686 } 4687 } 4688 resolve(); 4689 return defer.promise( obj ); 4690 } 4691} ); 4692var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 4693 4694var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 4695 4696 4697var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 4698 4699var documentElement = document.documentElement; 4700 4701 4702 4703 var isAttached = function( elem ) { 4704 return jQuery.contains( elem.ownerDocument, elem ); 4705 }, 4706 composed = { composed: true }; 4707 4708 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only 4709 // Check attachment across shadow DOM boundaries when possible (gh-3504) 4710 // Support: iOS 10.0-10.2 only 4711 // Early iOS 10 versions support `attachShadow` but not `getRootNode`, 4712 // leading to errors. We need to check for `getRootNode`. 4713 if ( documentElement.getRootNode ) { 4714 isAttached = function( elem ) { 4715 return jQuery.contains( elem.ownerDocument, elem ) || 4716 elem.getRootNode( composed ) === elem.ownerDocument; 4717 }; 4718 } 4719var isHiddenWithinTree = function( elem, el ) { 4720 4721 // isHiddenWithinTree might be called from jQuery#filter function; 4722 // in that case, element will be second argument 4723 elem = el || elem; 4724 4725 // Inline style trumps all 4726 return elem.style.display === "none" || 4727 elem.style.display === "" && 4728 4729 // Otherwise, check computed style 4730 // Support: Firefox <=43 - 45 4731 // Disconnected elements can have computed display: none, so first confirm that elem is 4732 // in the document. 4733 isAttached( elem ) && 4734 4735 jQuery.css( elem, "display" ) === "none"; 4736 }; 4737 4738 4739 4740function adjustCSS( elem, prop, valueParts, tween ) { 4741 var adjusted, scale, 4742 maxIterations = 20, 4743 currentValue = tween ? 4744 function() { 4745 return tween.cur(); 4746 } : 4747 function() { 4748 return jQuery.css( elem, prop, "" ); 4749 }, 4750 initial = currentValue(), 4751 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 4752 4753 // Starting value computation is required for potential unit mismatches 4754 initialInUnit = elem.nodeType && 4755 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 4756 rcssNum.exec( jQuery.css( elem, prop ) ); 4757 4758 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 4759 4760 // Support: Firefox <=54 4761 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 4762 initial = initial / 2; 4763 4764 // Trust units reported by jQuery.css 4765 unit = unit || initialInUnit[ 3 ]; 4766 4767 // Iteratively approximate from a nonzero starting point 4768 initialInUnit = +initial || 1; 4769 4770 while ( maxIterations-- ) { 4771 4772 // Evaluate and update our best guess (doubling guesses that zero out). 4773 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 4774 jQuery.style( elem, prop, initialInUnit + unit ); 4775 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { 4776 maxIterations = 0; 4777 } 4778 initialInUnit = initialInUnit / scale; 4779 4780 } 4781 4782 initialInUnit = initialInUnit * 2; 4783 jQuery.style( elem, prop, initialInUnit + unit ); 4784 4785 // Make sure we update the tween properties later on 4786 valueParts = valueParts || []; 4787 } 4788 4789 if ( valueParts ) { 4790 initialInUnit = +initialInUnit || +initial || 0; 4791 4792 // Apply relative offset (+=/-=) if specified 4793 adjusted = valueParts[ 1 ] ? 4794 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 4795 +valueParts[ 2 ]; 4796 if ( tween ) { 4797 tween.unit = unit; 4798 tween.start = initialInUnit; 4799 tween.end = adjusted; 4800 } 4801 } 4802 return adjusted; 4803} 4804 4805 4806var defaultDisplayMap = {}; 4807 4808function getDefaultDisplay( elem ) { 4809 var temp, 4810 doc = elem.ownerDocument, 4811 nodeName = elem.nodeName, 4812 display = defaultDisplayMap[ nodeName ]; 4813 4814 if ( display ) { 4815 return display; 4816 } 4817 4818 temp = doc.body.appendChild( doc.createElement( nodeName ) ); 4819 display = jQuery.css( temp, "display" ); 4820 4821 temp.parentNode.removeChild( temp ); 4822 4823 if ( display === "none" ) { 4824 display = "block"; 4825 } 4826 defaultDisplayMap[ nodeName ] = display; 4827 4828 return display; 4829} 4830 4831function showHide( elements, show ) { 4832 var display, elem, 4833 values = [], 4834 index = 0, 4835 length = elements.length; 4836 4837 // Determine new display value for elements that need to change 4838 for ( ; index < length; index++ ) { 4839 elem = elements[ index ]; 4840 if ( !elem.style ) { 4841 continue; 4842 } 4843 4844 display = elem.style.display; 4845 if ( show ) { 4846 4847 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 4848 // check is required in this first loop unless we have a nonempty display value (either 4849 // inline or about-to-be-restored) 4850 if ( display === "none" ) { 4851 values[ index ] = dataPriv.get( elem, "display" ) || null; 4852 if ( !values[ index ] ) { 4853 elem.style.display = ""; 4854 } 4855 } 4856 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { 4857 values[ index ] = getDefaultDisplay( elem ); 4858 } 4859 } else { 4860 if ( display !== "none" ) { 4861 values[ index ] = "none"; 4862 4863 // Remember what we're overwriting 4864 dataPriv.set( elem, "display", display ); 4865 } 4866 } 4867 } 4868 4869 // Set the display of the elements in a second loop to avoid constant reflow 4870 for ( index = 0; index < length; index++ ) { 4871 if ( values[ index ] != null ) { 4872 elements[ index ].style.display = values[ index ]; 4873 } 4874 } 4875 4876 return elements; 4877} 4878 4879jQuery.fn.extend( { 4880 show: function() { 4881 return showHide( this, true ); 4882 }, 4883 hide: function() { 4884 return showHide( this ); 4885 }, 4886 toggle: function( state ) { 4887 if ( typeof state === "boolean" ) { 4888 return state ? this.show() : this.hide(); 4889 } 4890 4891 return this.each( function() { 4892 if ( isHiddenWithinTree( this ) ) { 4893 jQuery( this ).show(); 4894 } else { 4895 jQuery( this ).hide(); 4896 } 4897 } ); 4898 } 4899} ); 4900var rcheckableType = ( /^(?:checkbox|radio)$/i ); 4901 4902var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); 4903 4904var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); 4905 4906 4907 4908( function() { 4909 var fragment = document.createDocumentFragment(), 4910 div = fragment.appendChild( document.createElement( "div" ) ), 4911 input = document.createElement( "input" ); 4912 4913 // Support: Android 4.0 - 4.3 only 4914 // Check state lost if the name is set (#11217) 4915 // Support: Windows Web Apps (WWA) 4916 // `name` and `type` must use .setAttribute for WWA (#14901) 4917 input.setAttribute( "type", "radio" ); 4918 input.setAttribute( "checked", "checked" ); 4919 input.setAttribute( "name", "t" ); 4920 4921 div.appendChild( input ); 4922 4923 // Support: Android <=4.1 only 4924 // Older WebKit doesn't clone checked state correctly in fragments 4925 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 4926 4927 // Support: IE <=11 only 4928 // Make sure textarea (and checkbox) defaultValue is properly cloned 4929 div.innerHTML = "<textarea>x</textarea>"; 4930 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 4931 4932 // Support: IE <=9 only 4933 // IE <=9 replaces <option> tags with their contents when inserted outside of 4934 // the select element. 4935 div.innerHTML = "<option></option>"; 4936 support.option = !!div.lastChild; 4937} )(); 4938 4939 4940// We have to close these tags to support XHTML (#13200) 4941var wrapMap = { 4942 4943 // XHTML parsers do not magically insert elements in the 4944 // same way that tag soup parsers do. So we cannot shorten 4945 // this by omitting <tbody> or other required elements. 4946 thead: [ 1, "<table>", "</table>" ], 4947 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 4948 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 4949 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 4950 4951 _default: [ 0, "", "" ] 4952}; 4953 4954wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 4955wrapMap.th = wrapMap.td; 4956 4957// Support: IE <=9 only 4958if ( !support.option ) { 4959 wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ]; 4960} 4961 4962 4963function getAll( context, tag ) { 4964 4965 // Support: IE <=9 - 11 only 4966 // Use typeof to avoid zero-argument method invocation on host objects (#15151) 4967 var ret; 4968 4969 if ( typeof context.getElementsByTagName !== "undefined" ) { 4970 ret = context.getElementsByTagName( tag || "*" ); 4971 4972 } else if ( typeof context.querySelectorAll !== "undefined" ) { 4973 ret = context.querySelectorAll( tag || "*" ); 4974 4975 } else { 4976 ret = []; 4977 } 4978 4979 if ( tag === undefined || tag && nodeName( context, tag ) ) { 4980 return jQuery.merge( [ context ], ret ); 4981 } 4982 4983 return ret; 4984} 4985 4986 4987// Mark scripts as having already been evaluated 4988function setGlobalEval( elems, refElements ) { 4989 var i = 0, 4990 l = elems.length; 4991 4992 for ( ; i < l; i++ ) { 4993 dataPriv.set( 4994 elems[ i ], 4995 "globalEval", 4996 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 4997 ); 4998 } 4999} 5000 5001 5002var rhtml = /<|&#?\w+;/; 5003 5004function buildFragment( elems, context, scripts, selection, ignored ) { 5005 var elem, tmp, tag, wrap, attached, j, 5006 fragment = context.createDocumentFragment(), 5007 nodes = [], 5008 i = 0, 5009 l = elems.length; 5010 5011 for ( ; i < l; i++ ) { 5012 elem = elems[ i ]; 5013 5014 if ( elem || elem === 0 ) { 5015 5016 // Add nodes directly 5017 if ( toType( elem ) === "object" ) { 5018 5019 // Support: Android <=4.0 only, PhantomJS 1 only 5020 // push.apply(_, arraylike) throws on ancient WebKit 5021 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 5022 5023 // Convert non-html into a text node 5024 } else if ( !rhtml.test( elem ) ) { 5025 nodes.push( context.createTextNode( elem ) ); 5026 5027 // Convert html into DOM nodes 5028 } else { 5029 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 5030 5031 // Deserialize a standard representation 5032 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 5033 wrap = wrapMap[ tag ] || wrapMap._default; 5034 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 5035 5036 // Descend through wrappers to the right content 5037 j = wrap[ 0 ]; 5038 while ( j-- ) { 5039 tmp = tmp.lastChild; 5040 } 5041 5042 // Support: Android <=4.0 only, PhantomJS 1 only 5043 // push.apply(_, arraylike) throws on ancient WebKit 5044 jQuery.merge( nodes, tmp.childNodes ); 5045 5046 // Remember the top-level container 5047 tmp = fragment.firstChild; 5048 5049 // Ensure the created nodes are orphaned (#12392) 5050 tmp.textContent = ""; 5051 } 5052 } 5053 } 5054 5055 // Remove wrapper from fragment 5056 fragment.textContent = ""; 5057 5058 i = 0; 5059 while ( ( elem = nodes[ i++ ] ) ) { 5060 5061 // Skip elements already in the context collection (trac-4087) 5062 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 5063 if ( ignored ) { 5064 ignored.push( elem ); 5065 } 5066 continue; 5067 } 5068 5069 attached = isAttached( elem ); 5070 5071 // Append to fragment 5072 tmp = getAll( fragment.appendChild( elem ), "script" ); 5073 5074 // Preserve script evaluation history 5075 if ( attached ) { 5076 setGlobalEval( tmp ); 5077 } 5078 5079 // Capture executables 5080 if ( scripts ) { 5081 j = 0; 5082 while ( ( elem = tmp[ j++ ] ) ) { 5083 if ( rscriptType.test( elem.type || "" ) ) { 5084 scripts.push( elem ); 5085 } 5086 } 5087 } 5088 } 5089 5090 return fragment; 5091} 5092 5093 5094var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 5095 5096function returnTrue() { 5097 return true; 5098} 5099 5100function returnFalse() { 5101 return false; 5102} 5103 5104// Support: IE <=9 - 11+ 5105// focus() and blur() are asynchronous, except when they are no-op. 5106// So expect focus to be synchronous when the element is already active, 5107// and blur to be synchronous when the element is not already active. 5108// (focus and blur are always synchronous in other supported browsers, 5109// this just defines when we can count on it). 5110function expectSync( elem, type ) { 5111 return ( elem === safeActiveElement() ) === ( type === "focus" ); 5112} 5113 5114// Support: IE <=9 only 5115// Accessing document.activeElement can throw unexpectedly 5116// https://bugs.jquery.com/ticket/13393 5117function safeActiveElement() { 5118 try { 5119 return document.activeElement; 5120 } catch ( err ) { } 5121} 5122 5123function on( elem, types, selector, data, fn, one ) { 5124 var origFn, type; 5125 5126 // Types can be a map of types/handlers 5127 if ( typeof types === "object" ) { 5128 5129 // ( types-Object, selector, data ) 5130 if ( typeof selector !== "string" ) { 5131 5132 // ( types-Object, data ) 5133 data = data || selector; 5134 selector = undefined; 5135 } 5136 for ( type in types ) { 5137 on( elem, type, selector, data, types[ type ], one ); 5138 } 5139 return elem; 5140 } 5141 5142 if ( data == null && fn == null ) { 5143 5144 // ( types, fn ) 5145 fn = selector; 5146 data = selector = undefined; 5147 } else if ( fn == null ) { 5148 if ( typeof selector === "string" ) { 5149 5150 // ( types, selector, fn ) 5151 fn = data; 5152 data = undefined; 5153 } else { 5154 5155 // ( types, data, fn ) 5156 fn = data; 5157 data = selector; 5158 selector = undefined; 5159 } 5160 } 5161 if ( fn === false ) { 5162 fn = returnFalse; 5163 } else if ( !fn ) { 5164 return elem; 5165 } 5166 5167 if ( one === 1 ) { 5168 origFn = fn; 5169 fn = function( event ) { 5170 5171 // Can use an empty set, since event contains the info 5172 jQuery().off( event ); 5173 return origFn.apply( this, arguments ); 5174 }; 5175 5176 // Use same guid so caller can remove using origFn 5177 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 5178 } 5179 return elem.each( function() { 5180 jQuery.event.add( this, types, fn, data, selector ); 5181 } ); 5182} 5183 5184/* 5185 * Helper functions for managing events -- not part of the public interface. 5186 * Props to Dean Edwards' addEvent library for many of the ideas. 5187 */ 5188jQuery.event = { 5189 5190 global: {}, 5191 5192 add: function( elem, types, handler, data, selector ) { 5193 5194 var handleObjIn, eventHandle, tmp, 5195 events, t, handleObj, 5196 special, handlers, type, namespaces, origType, 5197 elemData = dataPriv.get( elem ); 5198 5199 // Only attach events to objects that accept data 5200 if ( !acceptData( elem ) ) { 5201 return; 5202 } 5203 5204 // Caller can pass in an object of custom data in lieu of the handler 5205 if ( handler.handler ) { 5206 handleObjIn = handler; 5207 handler = handleObjIn.handler; 5208 selector = handleObjIn.selector; 5209 } 5210 5211 // Ensure that invalid selectors throw exceptions at attach time 5212 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 5213 if ( selector ) { 5214 jQuery.find.matchesSelector( documentElement, selector ); 5215 } 5216 5217 // Make sure that the handler has a unique ID, used to find/remove it later 5218 if ( !handler.guid ) { 5219 handler.guid = jQuery.guid++; 5220 } 5221 5222 // Init the element's event structure and main handler, if this is the first 5223 if ( !( events = elemData.events ) ) { 5224 events = elemData.events = Object.create( null ); 5225 } 5226 if ( !( eventHandle = elemData.handle ) ) { 5227 eventHandle = elemData.handle = function( e ) { 5228 5229 // Discard the second event of a jQuery.event.trigger() and 5230 // when an event is called after a page has unloaded 5231 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 5232 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 5233 }; 5234 } 5235 5236 // Handle multiple events separated by a space 5237 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 5238 t = types.length; 5239 while ( t-- ) { 5240 tmp = rtypenamespace.exec( types[ t ] ) || []; 5241 type = origType = tmp[ 1 ]; 5242 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 5243 5244 // There *must* be a type, no attaching namespace-only handlers 5245 if ( !type ) { 5246 continue; 5247 } 5248 5249 // If event changes its type, use the special event handlers for the changed type 5250 special = jQuery.event.special[ type ] || {}; 5251 5252 // If selector defined, determine special event api type, otherwise given type 5253 type = ( selector ? special.delegateType : special.bindType ) || type; 5254 5255 // Update special based on newly reset type 5256 special = jQuery.event.special[ type ] || {}; 5257 5258 // handleObj is passed to all event handlers 5259 handleObj = jQuery.extend( { 5260 type: type, 5261 origType: origType, 5262 data: data, 5263 handler: handler, 5264 guid: handler.guid, 5265 selector: selector, 5266 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 5267 namespace: namespaces.join( "." ) 5268 }, handleObjIn ); 5269 5270 // Init the event handler queue if we're the first 5271 if ( !( handlers = events[ type ] ) ) { 5272 handlers = events[ type ] = []; 5273 handlers.delegateCount = 0; 5274 5275 // Only use addEventListener if the special events handler returns false 5276 if ( !special.setup || 5277 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 5278 5279 if ( elem.addEventListener ) { 5280 elem.addEventListener( type, eventHandle ); 5281 } 5282 } 5283 } 5284 5285 if ( special.add ) { 5286 special.add.call( elem, handleObj ); 5287 5288 if ( !handleObj.handler.guid ) { 5289 handleObj.handler.guid = handler.guid; 5290 } 5291 } 5292 5293 // Add to the element's handler list, delegates in front 5294 if ( selector ) { 5295 handlers.splice( handlers.delegateCount++, 0, handleObj ); 5296 } else { 5297 handlers.push( handleObj ); 5298 } 5299 5300 // Keep track of which events have ever been used, for event optimization 5301 jQuery.event.global[ type ] = true; 5302 } 5303 5304 }, 5305 5306 // Detach an event or set of events from an element 5307 remove: function( elem, types, handler, selector, mappedTypes ) { 5308 5309 var j, origCount, tmp, 5310 events, t, handleObj, 5311 special, handlers, type, namespaces, origType, 5312 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 5313 5314 if ( !elemData || !( events = elemData.events ) ) { 5315 return; 5316 } 5317 5318 // Once for each type.namespace in types; type may be omitted 5319 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 5320 t = types.length; 5321 while ( t-- ) { 5322 tmp = rtypenamespace.exec( types[ t ] ) || []; 5323 type = origType = tmp[ 1 ]; 5324 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 5325 5326 // Unbind all events (on this namespace, if provided) for the element 5327 if ( !type ) { 5328 for ( type in events ) { 5329 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 5330 } 5331 continue; 5332 } 5333 5334 special = jQuery.event.special[ type ] || {}; 5335 type = ( selector ? special.delegateType : special.bindType ) || type; 5336 handlers = events[ type ] || []; 5337 tmp = tmp[ 2 ] && 5338 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 5339 5340 // Remove matching events 5341 origCount = j = handlers.length; 5342 while ( j-- ) { 5343 handleObj = handlers[ j ]; 5344 5345 if ( ( mappedTypes || origType === handleObj.origType ) && 5346 ( !handler || handler.guid === handleObj.guid ) && 5347 ( !tmp || tmp.test( handleObj.namespace ) ) && 5348 ( !selector || selector === handleObj.selector || 5349 selector === "**" && handleObj.selector ) ) { 5350 handlers.splice( j, 1 ); 5351 5352 if ( handleObj.selector ) { 5353 handlers.delegateCount--; 5354 } 5355 if ( special.remove ) { 5356 special.remove.call( elem, handleObj ); 5357 } 5358 } 5359 } 5360 5361 // Remove generic event handler if we removed something and no more handlers exist 5362 // (avoids potential for endless recursion during removal of special event handlers) 5363 if ( origCount && !handlers.length ) { 5364 if ( !special.teardown || 5365 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 5366 5367 jQuery.removeEvent( elem, type, elemData.handle ); 5368 } 5369 5370 delete events[ type ]; 5371 } 5372 } 5373 5374 // Remove data and the expando if it's no longer used 5375 if ( jQuery.isEmptyObject( events ) ) { 5376 dataPriv.remove( elem, "handle events" ); 5377 } 5378 }, 5379 5380 dispatch: function( nativeEvent ) { 5381 5382 var i, j, ret, matched, handleObj, handlerQueue, 5383 args = new Array( arguments.length ), 5384 5385 // Make a writable jQuery.Event from the native event object 5386 event = jQuery.event.fix( nativeEvent ), 5387 5388 handlers = ( 5389 dataPriv.get( this, "events" ) || Object.create( null ) 5390 )[ event.type ] || [], 5391 special = jQuery.event.special[ event.type ] || {}; 5392 5393 // Use the fix-ed jQuery.Event rather than the (read-only) native event 5394 args[ 0 ] = event; 5395 5396 for ( i = 1; i < arguments.length; i++ ) { 5397 args[ i ] = arguments[ i ]; 5398 } 5399 5400 event.delegateTarget = this; 5401 5402 // Call the preDispatch hook for the mapped type, and let it bail if desired 5403 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 5404 return; 5405 } 5406 5407 // Determine handlers 5408 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 5409 5410 // Run delegates first; they may want to stop propagation beneath us 5411 i = 0; 5412 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 5413 event.currentTarget = matched.elem; 5414 5415 j = 0; 5416 while ( ( handleObj = matched.handlers[ j++ ] ) && 5417 !event.isImmediatePropagationStopped() ) { 5418 5419 // If the event is namespaced, then each handler is only invoked if it is 5420 // specially universal or its namespaces are a superset of the event's. 5421 if ( !event.rnamespace || handleObj.namespace === false || 5422 event.rnamespace.test( handleObj.namespace ) ) { 5423 5424 event.handleObj = handleObj; 5425 event.data = handleObj.data; 5426 5427 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 5428 handleObj.handler ).apply( matched.elem, args ); 5429 5430 if ( ret !== undefined ) { 5431 if ( ( event.result = ret ) === false ) { 5432 event.preventDefault(); 5433 event.stopPropagation(); 5434 } 5435 } 5436 } 5437 } 5438 } 5439 5440 // Call the postDispatch hook for the mapped type 5441 if ( special.postDispatch ) { 5442 special.postDispatch.call( this, event ); 5443 } 5444 5445 return event.result; 5446 }, 5447 5448 handlers: function( event, handlers ) { 5449 var i, handleObj, sel, matchedHandlers, matchedSelectors, 5450 handlerQueue = [], 5451 delegateCount = handlers.delegateCount, 5452 cur = event.target; 5453 5454 // Find delegate handlers 5455 if ( delegateCount && 5456 5457 // Support: IE <=9 5458 // Black-hole SVG <use> instance trees (trac-13180) 5459 cur.nodeType && 5460 5461 // Support: Firefox <=42 5462 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 5463 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 5464 // Support: IE 11 only 5465 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 5466 !( event.type === "click" && event.button >= 1 ) ) { 5467 5468 for ( ; cur !== this; cur = cur.parentNode || this ) { 5469 5470 // Don't check non-elements (#13208) 5471 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) 5472 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { 5473 matchedHandlers = []; 5474 matchedSelectors = {}; 5475 for ( i = 0; i < delegateCount; i++ ) { 5476 handleObj = handlers[ i ]; 5477 5478 // Don't conflict with Object.prototype properties (#13203) 5479 sel = handleObj.selector + " "; 5480 5481 if ( matchedSelectors[ sel ] === undefined ) { 5482 matchedSelectors[ sel ] = handleObj.needsContext ? 5483 jQuery( sel, this ).index( cur ) > -1 : 5484 jQuery.find( sel, this, null, [ cur ] ).length; 5485 } 5486 if ( matchedSelectors[ sel ] ) { 5487 matchedHandlers.push( handleObj ); 5488 } 5489 } 5490 if ( matchedHandlers.length ) { 5491 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); 5492 } 5493 } 5494 } 5495 } 5496 5497 // Add the remaining (directly-bound) handlers 5498 cur = this; 5499 if ( delegateCount < handlers.length ) { 5500 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); 5501 } 5502 5503 return handlerQueue; 5504 }, 5505 5506 addProp: function( name, hook ) { 5507 Object.defineProperty( jQuery.Event.prototype, name, { 5508 enumerable: true, 5509 configurable: true, 5510 5511 get: isFunction( hook ) ? 5512 function() { 5513 if ( this.originalEvent ) { 5514 return hook( this.originalEvent ); 5515 } 5516 } : 5517 function() { 5518 if ( this.originalEvent ) { 5519 return this.originalEvent[ name ]; 5520 } 5521 }, 5522 5523 set: function( value ) { 5524 Object.defineProperty( this, name, { 5525 enumerable: true, 5526 configurable: true, 5527 writable: true, 5528 value: value 5529 } ); 5530 } 5531 } ); 5532 }, 5533 5534 fix: function( originalEvent ) { 5535 return originalEvent[ jQuery.expando ] ? 5536 originalEvent : 5537 new jQuery.Event( originalEvent ); 5538 }, 5539 5540 special: { 5541 load: { 5542 5543 // Prevent triggered image.load events from bubbling to window.load 5544 noBubble: true 5545 }, 5546 click: { 5547 5548 // Utilize native event to ensure correct state for checkable inputs 5549 setup: function( data ) { 5550 5551 // For mutual compressibility with _default, replace `this` access with a local var. 5552 // `|| data` is dead code meant only to preserve the variable through minification. 5553 var el = this || data; 5554 5555 // Claim the first handler 5556 if ( rcheckableType.test( el.type ) && 5557 el.click && nodeName( el, "input" ) ) { 5558 5559 // dataPriv.set( el, "click", ... ) 5560 leverageNative( el, "click", returnTrue ); 5561 } 5562 5563 // Return false to allow normal processing in the caller 5564 return false; 5565 }, 5566 trigger: function( data ) { 5567 5568 // For mutual compressibility with _default, replace `this` access with a local var. 5569 // `|| data` is dead code meant only to preserve the variable through minification. 5570 var el = this || data; 5571 5572 // Force setup before triggering a click 5573 if ( rcheckableType.test( el.type ) && 5574 el.click && nodeName( el, "input" ) ) { 5575 5576 leverageNative( el, "click" ); 5577 } 5578 5579 // Return non-false to allow normal event-path propagation 5580 return true; 5581 }, 5582 5583 // For cross-browser consistency, suppress native .click() on links 5584 // Also prevent it if we're currently inside a leveraged native-event stack 5585 _default: function( event ) { 5586 var target = event.target; 5587 return rcheckableType.test( target.type ) && 5588 target.click && nodeName( target, "input" ) && 5589 dataPriv.get( target, "click" ) || 5590 nodeName( target, "a" ); 5591 } 5592 }, 5593 5594 beforeunload: { 5595 postDispatch: function( event ) { 5596 5597 // Support: Firefox 20+ 5598 // Firefox doesn't alert if the returnValue field is not set. 5599 if ( event.result !== undefined && event.originalEvent ) { 5600 event.originalEvent.returnValue = event.result; 5601 } 5602 } 5603 } 5604 } 5605}; 5606 5607// Ensure the presence of an event listener that handles manually-triggered 5608// synthetic events by interrupting progress until reinvoked in response to 5609// *native* events that it fires directly, ensuring that state changes have 5610// already occurred before other listeners are invoked. 5611function leverageNative( el, type, expectSync ) { 5612 5613 // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add 5614 if ( !expectSync ) { 5615 if ( dataPriv.get( el, type ) === undefined ) { 5616 jQuery.event.add( el, type, returnTrue ); 5617 } 5618 return; 5619 } 5620 5621 // Register the controller as a special universal handler for all event namespaces 5622 dataPriv.set( el, type, false ); 5623 jQuery.event.add( el, type, { 5624 namespace: false, 5625 handler: function( event ) { 5626 var notAsync, result, 5627 saved = dataPriv.get( this, type ); 5628 5629 if ( ( event.isTrigger & 1 ) && this[ type ] ) { 5630 5631 // Interrupt processing of the outer synthetic .trigger()ed event 5632 // Saved data should be false in such cases, but might be a leftover capture object 5633 // from an async native handler (gh-4350) 5634 if ( !saved.length ) { 5635 5636 // Store arguments for use when handling the inner native event 5637 // There will always be at least one argument (an event object), so this array 5638 // will not be confused with a leftover capture object. 5639 saved = slice.call( arguments ); 5640 dataPriv.set( this, type, saved ); 5641 5642 // Trigger the native event and capture its result 5643 // Support: IE <=9 - 11+ 5644 // focus() and blur() are asynchronous 5645 notAsync = expectSync( this, type ); 5646 this[ type ](); 5647 result = dataPriv.get( this, type ); 5648 if ( saved !== result || notAsync ) { 5649 dataPriv.set( this, type, false ); 5650 } else { 5651 result = {}; 5652 } 5653 if ( saved !== result ) { 5654 5655 // Cancel the outer synthetic event 5656 event.stopImmediatePropagation(); 5657 event.preventDefault(); 5658 5659 // Support: Chrome 86+ 5660 // In Chrome, if an element having a focusout handler is blurred by 5661 // clicking outside of it, it invokes the handler synchronously. If 5662 // that handler calls `.remove()` on the element, the data is cleared, 5663 // leaving `result` undefined. We need to guard against this. 5664 return result && result.value; 5665 } 5666 5667 // If this is an inner synthetic event for an event with a bubbling surrogate 5668 // (focus or blur), assume that the surrogate already propagated from triggering the 5669 // native event and prevent that from happening again here. 5670 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the 5671 // bubbling surrogate propagates *after* the non-bubbling base), but that seems 5672 // less bad than duplication. 5673 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { 5674 event.stopPropagation(); 5675 } 5676 5677 // If this is a native event triggered above, everything is now in order 5678 // Fire an inner synthetic event with the original arguments 5679 } else if ( saved.length ) { 5680 5681 // ...and capture the result 5682 dataPriv.set( this, type, { 5683 value: jQuery.event.trigger( 5684 5685 // Support: IE <=9 - 11+ 5686 // Extend with the prototype to reset the above stopImmediatePropagation() 5687 jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), 5688 saved.slice( 1 ), 5689 this 5690 ) 5691 } ); 5692 5693 // Abort handling of the native event 5694 event.stopImmediatePropagation(); 5695 } 5696 } 5697 } ); 5698} 5699 5700jQuery.removeEvent = function( elem, type, handle ) { 5701 5702 // This "if" is needed for plain objects 5703 if ( elem.removeEventListener ) { 5704 elem.removeEventListener( type, handle ); 5705 } 5706}; 5707 5708jQuery.Event = function( src, props ) { 5709 5710 // Allow instantiation without the 'new' keyword 5711 if ( !( this instanceof jQuery.Event ) ) { 5712 return new jQuery.Event( src, props ); 5713 } 5714 5715 // Event object 5716 if ( src && src.type ) { 5717 this.originalEvent = src; 5718 this.type = src.type; 5719 5720 // Events bubbling up the document may have been marked as prevented 5721 // by a handler lower down the tree; reflect the correct value. 5722 this.isDefaultPrevented = src.defaultPrevented || 5723 src.defaultPrevented === undefined && 5724 5725 // Support: Android <=2.3 only 5726 src.returnValue === false ? 5727 returnTrue : 5728 returnFalse; 5729 5730 // Create target properties 5731 // Support: Safari <=6 - 7 only 5732 // Target should not be a text node (#504, #13143) 5733 this.target = ( src.target && src.target.nodeType === 3 ) ? 5734 src.target.parentNode : 5735 src.target; 5736 5737 this.currentTarget = src.currentTarget; 5738 this.relatedTarget = src.relatedTarget; 5739 5740 // Event type 5741 } else { 5742 this.type = src; 5743 } 5744 5745 // Put explicitly provided properties onto the event object 5746 if ( props ) { 5747 jQuery.extend( this, props ); 5748 } 5749 5750 // Create a timestamp if incoming event doesn't have one 5751 this.timeStamp = src && src.timeStamp || Date.now(); 5752 5753 // Mark it as fixed 5754 this[ jQuery.expando ] = true; 5755}; 5756 5757// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 5758// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 5759jQuery.Event.prototype = { 5760 constructor: jQuery.Event, 5761 isDefaultPrevented: returnFalse, 5762 isPropagationStopped: returnFalse, 5763 isImmediatePropagationStopped: returnFalse, 5764 isSimulated: false, 5765 5766 preventDefault: function() { 5767 var e = this.originalEvent; 5768 5769 this.isDefaultPrevented = returnTrue; 5770 5771 if ( e && !this.isSimulated ) { 5772 e.preventDefault(); 5773 } 5774 }, 5775 stopPropagation: function() { 5776 var e = this.originalEvent; 5777 5778 this.isPropagationStopped = returnTrue; 5779 5780 if ( e && !this.isSimulated ) { 5781 e.stopPropagation(); 5782 } 5783 }, 5784 stopImmediatePropagation: function() { 5785 var e = this.originalEvent; 5786 5787 this.isImmediatePropagationStopped = returnTrue; 5788 5789 if ( e && !this.isSimulated ) { 5790 e.stopImmediatePropagation(); 5791 } 5792 5793 this.stopPropagation(); 5794 } 5795}; 5796 5797// Includes all common event props including KeyEvent and MouseEvent specific props 5798jQuery.each( { 5799 altKey: true, 5800 bubbles: true, 5801 cancelable: true, 5802 changedTouches: true, 5803 ctrlKey: true, 5804 detail: true, 5805 eventPhase: true, 5806 metaKey: true, 5807 pageX: true, 5808 pageY: true, 5809 shiftKey: true, 5810 view: true, 5811 "char": true, 5812 code: true, 5813 charCode: true, 5814 key: true, 5815 keyCode: true, 5816 button: true, 5817 buttons: true, 5818 clientX: true, 5819 clientY: true, 5820 offsetX: true, 5821 offsetY: true, 5822 pointerId: true, 5823 pointerType: true, 5824 screenX: true, 5825 screenY: true, 5826 targetTouches: true, 5827 toElement: true, 5828 touches: true, 5829 which: true 5830}, jQuery.event.addProp ); 5831 5832jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { 5833 jQuery.event.special[ type ] = { 5834 5835 // Utilize native event if possible so blur/focus sequence is correct 5836 setup: function() { 5837 5838 // Claim the first handler 5839 // dataPriv.set( this, "focus", ... ) 5840 // dataPriv.set( this, "blur", ... ) 5841 leverageNative( this, type, expectSync ); 5842 5843 // Return false to allow normal processing in the caller 5844 return false; 5845 }, 5846 trigger: function() { 5847 5848 // Force setup before trigger 5849 leverageNative( this, type ); 5850 5851 // Return non-false to allow normal event-path propagation 5852 return true; 5853 }, 5854 5855 // Suppress native focus or blur as it's already being fired 5856 // in leverageNative. 5857 _default: function() { 5858 return true; 5859 }, 5860 5861 delegateType: delegateType 5862 }; 5863} ); 5864 5865// Create mouseenter/leave events using mouseover/out and event-time checks 5866// so that event delegation works in jQuery. 5867// Do the same for pointerenter/pointerleave and pointerover/pointerout 5868// 5869// Support: Safari 7 only 5870// Safari sends mouseenter too often; see: 5871// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 5872// for the description of the bug (it existed in older Chrome versions as well). 5873jQuery.each( { 5874 mouseenter: "mouseover", 5875 mouseleave: "mouseout", 5876 pointerenter: "pointerover", 5877 pointerleave: "pointerout" 5878}, function( orig, fix ) { 5879 jQuery.event.special[ orig ] = { 5880 delegateType: fix, 5881 bindType: fix, 5882 5883 handle: function( event ) { 5884 var ret, 5885 target = this, 5886 related = event.relatedTarget, 5887 handleObj = event.handleObj; 5888 5889 // For mouseenter/leave call the handler if related is outside the target. 5890 // NB: No relatedTarget if the mouse left/entered the browser window 5891 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 5892 event.type = handleObj.origType; 5893 ret = handleObj.handler.apply( this, arguments ); 5894 event.type = fix; 5895 } 5896 return ret; 5897 } 5898 }; 5899} ); 5900 5901jQuery.fn.extend( { 5902 5903 on: function( types, selector, data, fn ) { 5904 return on( this, types, selector, data, fn ); 5905 }, 5906 one: function( types, selector, data, fn ) { 5907 return on( this, types, selector, data, fn, 1 ); 5908 }, 5909 off: function( types, selector, fn ) { 5910 var handleObj, type; 5911 if ( types && types.preventDefault && types.handleObj ) { 5912 5913 // ( event ) dispatched jQuery.Event 5914 handleObj = types.handleObj; 5915 jQuery( types.delegateTarget ).off( 5916 handleObj.namespace ? 5917 handleObj.origType + "." + handleObj.namespace : 5918 handleObj.origType, 5919 handleObj.selector, 5920 handleObj.handler 5921 ); 5922 return this; 5923 } 5924 if ( typeof types === "object" ) { 5925 5926 // ( types-object [, selector] ) 5927 for ( type in types ) { 5928 this.off( type, selector, types[ type ] ); 5929 } 5930 return this; 5931 } 5932 if ( selector === false || typeof selector === "function" ) { 5933 5934 // ( types [, fn] ) 5935 fn = selector; 5936 selector = undefined; 5937 } 5938 if ( fn === false ) { 5939 fn = returnFalse; 5940 } 5941 return this.each( function() { 5942 jQuery.event.remove( this, types, fn, selector ); 5943 } ); 5944 } 5945} ); 5946 5947 5948var 5949 5950 // Support: IE <=10 - 11, Edge 12 - 13 only 5951 // In IE/Edge using regex groups here causes severe slowdowns. 5952 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 5953 rnoInnerhtml = /<script|<style|<link/i, 5954 5955 // checked="checked" or checked 5956 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 5957 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; 5958 5959// Prefer a tbody over its parent table for containing new rows 5960function manipulationTarget( elem, content ) { 5961 if ( nodeName( elem, "table" ) && 5962 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { 5963 5964 return jQuery( elem ).children( "tbody" )[ 0 ] || elem; 5965 } 5966 5967 return elem; 5968} 5969 5970// Replace/restore the type attribute of script elements for safe DOM manipulation 5971function disableScript( elem ) { 5972 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 5973 return elem; 5974} 5975function restoreScript( elem ) { 5976 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { 5977 elem.type = elem.type.slice( 5 ); 5978 } else { 5979 elem.removeAttribute( "type" ); 5980 } 5981 5982 return elem; 5983} 5984 5985function cloneCopyEvent( src, dest ) { 5986 var i, l, type, pdataOld, udataOld, udataCur, events; 5987 5988 if ( dest.nodeType !== 1 ) { 5989 return; 5990 } 5991 5992 // 1. Copy private data: events, handlers, etc. 5993 if ( dataPriv.hasData( src ) ) { 5994 pdataOld = dataPriv.get( src ); 5995 events = pdataOld.events; 5996 5997 if ( events ) { 5998 dataPriv.remove( dest, "handle events" ); 5999 6000 for ( type in events ) { 6001 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 6002 jQuery.event.add( dest, type, events[ type ][ i ] ); 6003 } 6004 } 6005 } 6006 } 6007 6008 // 2. Copy user data 6009 if ( dataUser.hasData( src ) ) { 6010 udataOld = dataUser.access( src ); 6011 udataCur = jQuery.extend( {}, udataOld ); 6012 6013 dataUser.set( dest, udataCur ); 6014 } 6015} 6016 6017// Fix IE bugs, see support tests 6018function fixInput( src, dest ) { 6019 var nodeName = dest.nodeName.toLowerCase(); 6020 6021 // Fails to persist the checked state of a cloned checkbox or radio button. 6022 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 6023 dest.checked = src.checked; 6024 6025 // Fails to return the selected option to the default selected state when cloning options 6026 } else if ( nodeName === "input" || nodeName === "textarea" ) { 6027 dest.defaultValue = src.defaultValue; 6028 } 6029} 6030 6031function domManip( collection, args, callback, ignored ) { 6032 6033 // Flatten any nested arrays 6034 args = flat( args ); 6035 6036 var fragment, first, scripts, hasScripts, node, doc, 6037 i = 0, 6038 l = collection.length, 6039 iNoClone = l - 1, 6040 value = args[ 0 ], 6041 valueIsFunction = isFunction( value ); 6042 6043 // We can't cloneNode fragments that contain checked, in WebKit 6044 if ( valueIsFunction || 6045 ( l > 1 && typeof value === "string" && 6046 !support.checkClone && rchecked.test( value ) ) ) { 6047 return collection.each( function( index ) { 6048 var self = collection.eq( index ); 6049 if ( valueIsFunction ) { 6050 args[ 0 ] = value.call( this, index, self.html() ); 6051 } 6052 domManip( self, args, callback, ignored ); 6053 } ); 6054 } 6055 6056 if ( l ) { 6057 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 6058 first = fragment.firstChild; 6059 6060 if ( fragment.childNodes.length === 1 ) { 6061 fragment = first; 6062 } 6063 6064 // Require either new content or an interest in ignored elements to invoke the callback 6065 if ( first || ignored ) { 6066 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 6067 hasScripts = scripts.length; 6068 6069 // Use the original fragment for the last item 6070 // instead of the first because it can end up 6071 // being emptied incorrectly in certain situations (#8070). 6072 for ( ; i < l; i++ ) { 6073 node = fragment; 6074 6075 if ( i !== iNoClone ) { 6076 node = jQuery.clone( node, true, true ); 6077 6078 // Keep references to cloned scripts for later restoration 6079 if ( hasScripts ) { 6080 6081 // Support: Android <=4.0 only, PhantomJS 1 only 6082 // push.apply(_, arraylike) throws on ancient WebKit 6083 jQuery.merge( scripts, getAll( node, "script" ) ); 6084 } 6085 } 6086 6087 callback.call( collection[ i ], node, i ); 6088 } 6089 6090 if ( hasScripts ) { 6091 doc = scripts[ scripts.length - 1 ].ownerDocument; 6092 6093 // Reenable scripts 6094 jQuery.map( scripts, restoreScript ); 6095 6096 // Evaluate executable scripts on first document insertion 6097 for ( i = 0; i < hasScripts; i++ ) { 6098 node = scripts[ i ]; 6099 if ( rscriptType.test( node.type || "" ) && 6100 !dataPriv.access( node, "globalEval" ) && 6101 jQuery.contains( doc, node ) ) { 6102 6103 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { 6104 6105 // Optional AJAX dependency, but won't run scripts if not present 6106 if ( jQuery._evalUrl && !node.noModule ) { 6107 jQuery._evalUrl( node.src, { 6108 nonce: node.nonce || node.getAttribute( "nonce" ) 6109 }, doc ); 6110 } 6111 } else { 6112 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); 6113 } 6114 } 6115 } 6116 } 6117 } 6118 } 6119 6120 return collection; 6121} 6122 6123function remove( elem, selector, keepData ) { 6124 var node, 6125 nodes = selector ? jQuery.filter( selector, elem ) : elem, 6126 i = 0; 6127 6128 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 6129 if ( !keepData && node.nodeType === 1 ) { 6130 jQuery.cleanData( getAll( node ) ); 6131 } 6132 6133 if ( node.parentNode ) { 6134 if ( keepData && isAttached( node ) ) { 6135 setGlobalEval( getAll( node, "script" ) ); 6136 } 6137 node.parentNode.removeChild( node ); 6138 } 6139 } 6140 6141 return elem; 6142} 6143 6144jQuery.extend( { 6145 htmlPrefilter: function( html ) { 6146 return html; 6147 }, 6148 6149 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 6150 var i, l, srcElements, destElements, 6151 clone = elem.cloneNode( true ), 6152 inPage = isAttached( elem ); 6153 6154 // Fix IE cloning issues 6155 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 6156 !jQuery.isXMLDoc( elem ) ) { 6157 6158 // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 6159 destElements = getAll( clone ); 6160 srcElements = getAll( elem ); 6161 6162 for ( i = 0, l = srcElements.length; i < l; i++ ) { 6163 fixInput( srcElements[ i ], destElements[ i ] ); 6164 } 6165 } 6166 6167 // Copy the events from the original to the clone 6168 if ( dataAndEvents ) { 6169 if ( deepDataAndEvents ) { 6170 srcElements = srcElements || getAll( elem ); 6171 destElements = destElements || getAll( clone ); 6172 6173 for ( i = 0, l = srcElements.length; i < l; i++ ) { 6174 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 6175 } 6176 } else { 6177 cloneCopyEvent( elem, clone ); 6178 } 6179 } 6180 6181 // Preserve script evaluation history 6182 destElements = getAll( clone, "script" ); 6183 if ( destElements.length > 0 ) { 6184 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 6185 } 6186 6187 // Return the cloned set 6188 return clone; 6189 }, 6190 6191 cleanData: function( elems ) { 6192 var data, elem, type, 6193 special = jQuery.event.special, 6194 i = 0; 6195 6196 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 6197 if ( acceptData( elem ) ) { 6198 if ( ( data = elem[ dataPriv.expando ] ) ) { 6199 if ( data.events ) { 6200 for ( type in data.events ) { 6201 if ( special[ type ] ) { 6202 jQuery.event.remove( elem, type ); 6203 6204 // This is a shortcut to avoid jQuery.event.remove's overhead 6205 } else { 6206 jQuery.removeEvent( elem, type, data.handle ); 6207 } 6208 } 6209 } 6210 6211 // Support: Chrome <=35 - 45+ 6212 // Assign undefined instead of using delete, see Data#remove 6213 elem[ dataPriv.expando ] = undefined; 6214 } 6215 if ( elem[ dataUser.expando ] ) { 6216 6217 // Support: Chrome <=35 - 45+ 6218 // Assign undefined instead of using delete, see Data#remove 6219 elem[ dataUser.expando ] = undefined; 6220 } 6221 } 6222 } 6223 } 6224} ); 6225 6226jQuery.fn.extend( { 6227 detach: function( selector ) { 6228 return remove( this, selector, true ); 6229 }, 6230 6231 remove: function( selector ) { 6232 return remove( this, selector ); 6233 }, 6234 6235 text: function( value ) { 6236 return access( this, function( value ) { 6237 return value === undefined ? 6238 jQuery.text( this ) : 6239 this.empty().each( function() { 6240 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6241 this.textContent = value; 6242 } 6243 } ); 6244 }, null, value, arguments.length ); 6245 }, 6246 6247 append: function() { 6248 return domManip( this, arguments, function( elem ) { 6249 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6250 var target = manipulationTarget( this, elem ); 6251 target.appendChild( elem ); 6252 } 6253 } ); 6254 }, 6255 6256 prepend: function() { 6257 return domManip( this, arguments, function( elem ) { 6258 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6259 var target = manipulationTarget( this, elem ); 6260 target.insertBefore( elem, target.firstChild ); 6261 } 6262 } ); 6263 }, 6264 6265 before: function() { 6266 return domManip( this, arguments, function( elem ) { 6267 if ( this.parentNode ) { 6268 this.parentNode.insertBefore( elem, this ); 6269 } 6270 } ); 6271 }, 6272 6273 after: function() { 6274 return domManip( this, arguments, function( elem ) { 6275 if ( this.parentNode ) { 6276 this.parentNode.insertBefore( elem, this.nextSibling ); 6277 } 6278 } ); 6279 }, 6280 6281 empty: function() { 6282 var elem, 6283 i = 0; 6284 6285 for ( ; ( elem = this[ i ] ) != null; i++ ) { 6286 if ( elem.nodeType === 1 ) { 6287 6288 // Prevent memory leaks 6289 jQuery.cleanData( getAll( elem, false ) ); 6290 6291 // Remove any remaining nodes 6292 elem.textContent = ""; 6293 } 6294 } 6295 6296 return this; 6297 }, 6298 6299 clone: function( dataAndEvents, deepDataAndEvents ) { 6300 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 6301 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 6302 6303 return this.map( function() { 6304 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 6305 } ); 6306 }, 6307 6308 html: function( value ) { 6309 return access( this, function( value ) { 6310 var elem = this[ 0 ] || {}, 6311 i = 0, 6312 l = this.length; 6313 6314 if ( value === undefined && elem.nodeType === 1 ) { 6315 return elem.innerHTML; 6316 } 6317 6318 // See if we can take a shortcut and just use innerHTML 6319 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 6320 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 6321 6322 value = jQuery.htmlPrefilter( value ); 6323 6324 try { 6325 for ( ; i < l; i++ ) { 6326 elem = this[ i ] || {}; 6327 6328 // Remove element nodes and prevent memory leaks 6329 if ( elem.nodeType === 1 ) { 6330 jQuery.cleanData( getAll( elem, false ) ); 6331 elem.innerHTML = value; 6332 } 6333 } 6334 6335 elem = 0; 6336 6337 // If using innerHTML throws an exception, use the fallback method 6338 } catch ( e ) {} 6339 } 6340 6341 if ( elem ) { 6342 this.empty().append( value ); 6343 } 6344 }, null, value, arguments.length ); 6345 }, 6346 6347 replaceWith: function() { 6348 var ignored = []; 6349 6350 // Make the changes, replacing each non-ignored context element with the new content 6351 return domManip( this, arguments, function( elem ) { 6352 var parent = this.parentNode; 6353 6354 if ( jQuery.inArray( this, ignored ) < 0 ) { 6355 jQuery.cleanData( getAll( this ) ); 6356 if ( parent ) { 6357 parent.replaceChild( elem, this ); 6358 } 6359 } 6360 6361 // Force callback invocation 6362 }, ignored ); 6363 } 6364} ); 6365 6366jQuery.each( { 6367 appendTo: "append", 6368 prependTo: "prepend", 6369 insertBefore: "before", 6370 insertAfter: "after", 6371 replaceAll: "replaceWith" 6372}, function( name, original ) { 6373 jQuery.fn[ name ] = function( selector ) { 6374 var elems, 6375 ret = [], 6376 insert = jQuery( selector ), 6377 last = insert.length - 1, 6378 i = 0; 6379 6380 for ( ; i <= last; i++ ) { 6381 elems = i === last ? this : this.clone( true ); 6382 jQuery( insert[ i ] )[ original ]( elems ); 6383 6384 // Support: Android <=4.0 only, PhantomJS 1 only 6385 // .get() because push.apply(_, arraylike) throws on ancient WebKit 6386 push.apply( ret, elems.get() ); 6387 } 6388 6389 return this.pushStack( ret ); 6390 }; 6391} ); 6392var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 6393 6394var getStyles = function( elem ) { 6395 6396 // Support: IE <=11 only, Firefox <=30 (#15098, #14150) 6397 // IE throws on elements created in popups 6398 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 6399 var view = elem.ownerDocument.defaultView; 6400 6401 if ( !view || !view.opener ) { 6402 view = window; 6403 } 6404 6405 return view.getComputedStyle( elem ); 6406 }; 6407 6408var swap = function( elem, options, callback ) { 6409 var ret, name, 6410 old = {}; 6411 6412 // Remember the old values, and insert the new ones 6413 for ( name in options ) { 6414 old[ name ] = elem.style[ name ]; 6415 elem.style[ name ] = options[ name ]; 6416 } 6417 6418 ret = callback.call( elem ); 6419 6420 // Revert the old values 6421 for ( name in options ) { 6422 elem.style[ name ] = old[ name ]; 6423 } 6424 6425 return ret; 6426}; 6427 6428 6429var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); 6430 6431 6432 6433( function() { 6434 6435 // Executing both pixelPosition & boxSizingReliable tests require only one layout 6436 // so they're executed at the same time to save the second computation. 6437 function computeStyleTests() { 6438 6439 // This is a singleton, we need to execute it only once 6440 if ( !div ) { 6441 return; 6442 } 6443 6444 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + 6445 "margin-top:1px;padding:0;border:0"; 6446 div.style.cssText = 6447 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 6448 "margin:auto;border:1px;padding:1px;" + 6449 "width:60%;top:1%"; 6450 documentElement.appendChild( container ).appendChild( div ); 6451 6452 var divStyle = window.getComputedStyle( div ); 6453 pixelPositionVal = divStyle.top !== "1%"; 6454 6455 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 6456 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; 6457 6458 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 6459 // Some styles come back with percentage values, even though they shouldn't 6460 div.style.right = "60%"; 6461 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; 6462 6463 // Support: IE 9 - 11 only 6464 // Detect misreporting of content dimensions for box-sizing:border-box elements 6465 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; 6466 6467 // Support: IE 9 only 6468 // Detect overflow:scroll screwiness (gh-3699) 6469 // Support: Chrome <=64 6470 // Don't get tricked when zoom affects offsetWidth (gh-4029) 6471 div.style.position = "absolute"; 6472 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; 6473 6474 documentElement.removeChild( container ); 6475 6476 // Nullify the div so it wouldn't be stored in the memory and 6477 // it will also be a sign that checks already performed 6478 div = null; 6479 } 6480 6481 function roundPixelMeasures( measure ) { 6482 return Math.round( parseFloat( measure ) ); 6483 } 6484 6485 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 6486 reliableTrDimensionsVal, reliableMarginLeftVal, 6487 container = document.createElement( "div" ), 6488 div = document.createElement( "div" ); 6489 6490 // Finish early in limited (non-browser) environments 6491 if ( !div.style ) { 6492 return; 6493 } 6494 6495 // Support: IE <=9 - 11 only 6496 // Style of cloned element affects source element cloned (#8908) 6497 div.style.backgroundClip = "content-box"; 6498 div.cloneNode( true ).style.backgroundClip = ""; 6499 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 6500 6501 jQuery.extend( support, { 6502 boxSizingReliable: function() { 6503 computeStyleTests(); 6504 return boxSizingReliableVal; 6505 }, 6506 pixelBoxStyles: function() { 6507 computeStyleTests(); 6508 return pixelBoxStylesVal; 6509 }, 6510 pixelPosition: function() { 6511 computeStyleTests(); 6512 return pixelPositionVal; 6513 }, 6514 reliableMarginLeft: function() { 6515 computeStyleTests(); 6516 return reliableMarginLeftVal; 6517 }, 6518 scrollboxSize: function() { 6519 computeStyleTests(); 6520 return scrollboxSizeVal; 6521 }, 6522 6523 // Support: IE 9 - 11+, Edge 15 - 18+ 6524 // IE/Edge misreport `getComputedStyle` of table rows with width/height 6525 // set in CSS while `offset*` properties report correct values. 6526 // Behavior in IE 9 is more subtle than in newer versions & it passes 6527 // some versions of this test; make sure not to make it pass there! 6528 // 6529 // Support: Firefox 70+ 6530 // Only Firefox includes border widths 6531 // in computed dimensions. (gh-4529) 6532 reliableTrDimensions: function() { 6533 var table, tr, trChild, trStyle; 6534 if ( reliableTrDimensionsVal == null ) { 6535 table = document.createElement( "table" ); 6536 tr = document.createElement( "tr" ); 6537 trChild = document.createElement( "div" ); 6538 6539 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; 6540 tr.style.cssText = "border:1px solid"; 6541 6542 // Support: Chrome 86+ 6543 // Height set through cssText does not get applied. 6544 // Computed height then comes back as 0. 6545 tr.style.height = "1px"; 6546 trChild.style.height = "9px"; 6547 6548 // Support: Android 8 Chrome 86+ 6549 // In our bodyBackground.html iframe, 6550 // display for all div elements is set to "inline", 6551 // which causes a problem only in Android 8 Chrome 86. 6552 // Ensuring the div is display: block 6553 // gets around this issue. 6554 trChild.style.display = "block"; 6555 6556 documentElement 6557 .appendChild( table ) 6558 .appendChild( tr ) 6559 .appendChild( trChild ); 6560 6561 trStyle = window.getComputedStyle( tr ); 6562 reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + 6563 parseInt( trStyle.borderTopWidth, 10 ) + 6564 parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; 6565 6566 documentElement.removeChild( table ); 6567 } 6568 return reliableTrDimensionsVal; 6569 } 6570 } ); 6571} )(); 6572 6573 6574function curCSS( elem, name, computed ) { 6575 var width, minWidth, maxWidth, ret, 6576 6577 // Support: Firefox 51+ 6578 // Retrieving style before computed somehow 6579 // fixes an issue with getting wrong values 6580 // on detached elements 6581 style = elem.style; 6582 6583 computed = computed || getStyles( elem ); 6584 6585 // getPropertyValue is needed for: 6586 // .css('filter') (IE 9 only, #12537) 6587 // .css('--customProperty) (#3144) 6588 if ( computed ) { 6589 ret = computed.getPropertyValue( name ) || computed[ name ]; 6590 6591 if ( ret === "" && !isAttached( elem ) ) { 6592 ret = jQuery.style( elem, name ); 6593 } 6594 6595 // A tribute to the "awesome hack by Dean Edwards" 6596 // Android Browser returns percentage for some values, 6597 // but width seems to be reliably pixels. 6598 // This is against the CSSOM draft spec: 6599 // https://drafts.csswg.org/cssom/#resolved-values 6600 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { 6601 6602 // Remember the original values 6603 width = style.width; 6604 minWidth = style.minWidth; 6605 maxWidth = style.maxWidth; 6606 6607 // Put in the new values to get a computed value out 6608 style.minWidth = style.maxWidth = style.width = ret; 6609 ret = computed.width; 6610 6611 // Revert the changed values 6612 style.width = width; 6613 style.minWidth = minWidth; 6614 style.maxWidth = maxWidth; 6615 } 6616 } 6617 6618 return ret !== undefined ? 6619 6620 // Support: IE <=9 - 11 only 6621 // IE returns zIndex value as an integer. 6622 ret + "" : 6623 ret; 6624} 6625 6626 6627function addGetHookIf( conditionFn, hookFn ) { 6628 6629 // Define the hook, we'll check on the first run if it's really needed. 6630 return { 6631 get: function() { 6632 if ( conditionFn() ) { 6633 6634 // Hook not needed (or it's not possible to use it due 6635 // to missing dependency), remove it. 6636 delete this.get; 6637 return; 6638 } 6639 6640 // Hook needed; redefine it so that the support test is not executed again. 6641 return ( this.get = hookFn ).apply( this, arguments ); 6642 } 6643 }; 6644} 6645 6646 6647var cssPrefixes = [ "Webkit", "Moz", "ms" ], 6648 emptyStyle = document.createElement( "div" ).style, 6649 vendorProps = {}; 6650 6651// Return a vendor-prefixed property or undefined 6652function vendorPropName( name ) { 6653 6654 // Check for vendor prefixed names 6655 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 6656 i = cssPrefixes.length; 6657 6658 while ( i-- ) { 6659 name = cssPrefixes[ i ] + capName; 6660 if ( name in emptyStyle ) { 6661 return name; 6662 } 6663 } 6664} 6665 6666// Return a potentially-mapped jQuery.cssProps or vendor prefixed property 6667function finalPropName( name ) { 6668 var final = jQuery.cssProps[ name ] || vendorProps[ name ]; 6669 6670 if ( final ) { 6671 return final; 6672 } 6673 if ( name in emptyStyle ) { 6674 return name; 6675 } 6676 return vendorProps[ name ] = vendorPropName( name ) || name; 6677} 6678 6679 6680var 6681 6682 // Swappable if display is none or starts with table 6683 // except "table", "table-cell", or "table-caption" 6684 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 6685 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 6686 rcustomProp = /^--/, 6687 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 6688 cssNormalTransform = { 6689 letterSpacing: "0", 6690 fontWeight: "400" 6691 }; 6692 6693function setPositiveNumber( _elem, value, subtract ) { 6694 6695 // Any relative (+/-) values have already been 6696 // normalized at this point 6697 var matches = rcssNum.exec( value ); 6698 return matches ? 6699 6700 // Guard against undefined "subtract", e.g., when used as in cssHooks 6701 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 6702 value; 6703} 6704 6705function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { 6706 var i = dimension === "width" ? 1 : 0, 6707 extra = 0, 6708 delta = 0; 6709 6710 // Adjustment may not be necessary 6711 if ( box === ( isBorderBox ? "border" : "content" ) ) { 6712 return 0; 6713 } 6714 6715 for ( ; i < 4; i += 2 ) { 6716 6717 // Both box models exclude margin 6718 if ( box === "margin" ) { 6719 delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); 6720 } 6721 6722 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 6723 if ( !isBorderBox ) { 6724 6725 // Add padding 6726 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6727 6728 // For "border" or "margin", add border 6729 if ( box !== "padding" ) { 6730 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6731 6732 // But still keep track of it otherwise 6733 } else { 6734 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6735 } 6736 6737 // If we get here with a border-box (content + padding + border), we're seeking "content" or 6738 // "padding" or "margin" 6739 } else { 6740 6741 // For "content", subtract padding 6742 if ( box === "content" ) { 6743 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6744 } 6745 6746 // For "content" or "padding", subtract border 6747 if ( box !== "margin" ) { 6748 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6749 } 6750 } 6751 } 6752 6753 // Account for positive content-box scroll gutter when requested by providing computedVal 6754 if ( !isBorderBox && computedVal >= 0 ) { 6755 6756 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 6757 // Assuming integer scroll gutter, subtract the rest and round down 6758 delta += Math.max( 0, Math.ceil( 6759 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 6760 computedVal - 6761 delta - 6762 extra - 6763 0.5 6764 6765 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 6766 // Use an explicit zero to avoid NaN (gh-3964) 6767 ) ) || 0; 6768 } 6769 6770 return delta; 6771} 6772 6773function getWidthOrHeight( elem, dimension, extra ) { 6774 6775 // Start with computed style 6776 var styles = getStyles( elem ), 6777 6778 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). 6779 // Fake content-box until we know it's needed to know the true value. 6780 boxSizingNeeded = !support.boxSizingReliable() || extra, 6781 isBorderBox = boxSizingNeeded && 6782 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 6783 valueIsBorderBox = isBorderBox, 6784 6785 val = curCSS( elem, dimension, styles ), 6786 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); 6787 6788 // Support: Firefox <=54 6789 // Return a confounding non-pixel value or feign ignorance, as appropriate. 6790 if ( rnumnonpx.test( val ) ) { 6791 if ( !extra ) { 6792 return val; 6793 } 6794 val = "auto"; 6795 } 6796 6797 6798 // Support: IE 9 - 11 only 6799 // Use offsetWidth/offsetHeight for when box sizing is unreliable. 6800 // In those cases, the computed value can be trusted to be border-box. 6801 if ( ( !support.boxSizingReliable() && isBorderBox || 6802 6803 // Support: IE 10 - 11+, Edge 15 - 18+ 6804 // IE/Edge misreport `getComputedStyle` of table rows with width/height 6805 // set in CSS while `offset*` properties report correct values. 6806 // Interestingly, in some cases IE 9 doesn't suffer from this issue. 6807 !support.reliableTrDimensions() && nodeName( elem, "tr" ) || 6808 6809 // Fall back to offsetWidth/offsetHeight when value is "auto" 6810 // This happens for inline elements with no explicit setting (gh-3571) 6811 val === "auto" || 6812 6813 // Support: Android <=4.1 - 4.3 only 6814 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 6815 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && 6816 6817 // Make sure the element is visible & connected 6818 elem.getClientRects().length ) { 6819 6820 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 6821 6822 // Where available, offsetWidth/offsetHeight approximate border box dimensions. 6823 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the 6824 // retrieved value as a content box dimension. 6825 valueIsBorderBox = offsetProp in elem; 6826 if ( valueIsBorderBox ) { 6827 val = elem[ offsetProp ]; 6828 } 6829 } 6830 6831 // Normalize "" and auto 6832 val = parseFloat( val ) || 0; 6833 6834 // Adjust for the element's box model 6835 return ( val + 6836 boxModelAdjustment( 6837 elem, 6838 dimension, 6839 extra || ( isBorderBox ? "border" : "content" ), 6840 valueIsBorderBox, 6841 styles, 6842 6843 // Provide the current computed size to request scroll gutter calculation (gh-3589) 6844 val 6845 ) 6846 ) + "px"; 6847} 6848 6849jQuery.extend( { 6850 6851 // Add in style property hooks for overriding the default 6852 // behavior of getting and setting a style property 6853 cssHooks: { 6854 opacity: { 6855 get: function( elem, computed ) { 6856 if ( computed ) { 6857 6858 // We should always get a number back from opacity 6859 var ret = curCSS( elem, "opacity" ); 6860 return ret === "" ? "1" : ret; 6861 } 6862 } 6863 } 6864 }, 6865 6866 // Don't automatically add "px" to these possibly-unitless properties 6867 cssNumber: { 6868 "animationIterationCount": true, 6869 "columnCount": true, 6870 "fillOpacity": true, 6871 "flexGrow": true, 6872 "flexShrink": true, 6873 "fontWeight": true, 6874 "gridArea": true, 6875 "gridColumn": true, 6876 "gridColumnEnd": true, 6877 "gridColumnStart": true, 6878 "gridRow": true, 6879 "gridRowEnd": true, 6880 "gridRowStart": true, 6881 "lineHeight": true, 6882 "opacity": true, 6883 "order": true, 6884 "orphans": true, 6885 "widows": true, 6886 "zIndex": true, 6887 "zoom": true 6888 }, 6889 6890 // Add in properties whose names you wish to fix before 6891 // setting or getting the value 6892 cssProps: {}, 6893 6894 // Get and set the style property on a DOM Node 6895 style: function( elem, name, value, extra ) { 6896 6897 // Don't set styles on text and comment nodes 6898 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 6899 return; 6900 } 6901 6902 // Make sure that we're working with the right name 6903 var ret, type, hooks, 6904 origName = camelCase( name ), 6905 isCustomProp = rcustomProp.test( name ), 6906 style = elem.style; 6907 6908 // Make sure that we're working with the right name. We don't 6909 // want to query the value if it is a CSS custom property 6910 // since they are user-defined. 6911 if ( !isCustomProp ) { 6912 name = finalPropName( origName ); 6913 } 6914 6915 // Gets hook for the prefixed version, then unprefixed version 6916 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 6917 6918 // Check if we're setting a value 6919 if ( value !== undefined ) { 6920 type = typeof value; 6921 6922 // Convert "+=" or "-=" to relative numbers (#7345) 6923 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 6924 value = adjustCSS( elem, name, ret ); 6925 6926 // Fixes bug #9237 6927 type = "number"; 6928 } 6929 6930 // Make sure that null and NaN values aren't set (#7116) 6931 if ( value == null || value !== value ) { 6932 return; 6933 } 6934 6935 // If a number was passed in, add the unit (except for certain CSS properties) 6936 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append 6937 // "px" to a few hardcoded values. 6938 if ( type === "number" && !isCustomProp ) { 6939 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 6940 } 6941 6942 // background-* props affect original clone's values 6943 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 6944 style[ name ] = "inherit"; 6945 } 6946 6947 // If a hook was provided, use that value, otherwise just set the specified value 6948 if ( !hooks || !( "set" in hooks ) || 6949 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 6950 6951 if ( isCustomProp ) { 6952 style.setProperty( name, value ); 6953 } else { 6954 style[ name ] = value; 6955 } 6956 } 6957 6958 } else { 6959 6960 // If a hook was provided get the non-computed value from there 6961 if ( hooks && "get" in hooks && 6962 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 6963 6964 return ret; 6965 } 6966 6967 // Otherwise just get the value from the style object 6968 return style[ name ]; 6969 } 6970 }, 6971 6972 css: function( elem, name, extra, styles ) { 6973 var val, num, hooks, 6974 origName = camelCase( name ), 6975 isCustomProp = rcustomProp.test( name ); 6976 6977 // Make sure that we're working with the right name. We don't 6978 // want to modify the value if it is a CSS custom property 6979 // since they are user-defined. 6980 if ( !isCustomProp ) { 6981 name = finalPropName( origName ); 6982 } 6983 6984 // Try prefixed name followed by the unprefixed name 6985 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 6986 6987 // If a hook was provided get the computed value from there 6988 if ( hooks && "get" in hooks ) { 6989 val = hooks.get( elem, true, extra ); 6990 } 6991 6992 // Otherwise, if a way to get the computed value exists, use that 6993 if ( val === undefined ) { 6994 val = curCSS( elem, name, styles ); 6995 } 6996 6997 // Convert "normal" to computed value 6998 if ( val === "normal" && name in cssNormalTransform ) { 6999 val = cssNormalTransform[ name ]; 7000 } 7001 7002 // Make numeric if forced or a qualifier was provided and val looks numeric 7003 if ( extra === "" || extra ) { 7004 num = parseFloat( val ); 7005 return extra === true || isFinite( num ) ? num || 0 : val; 7006 } 7007 7008 return val; 7009 } 7010} ); 7011 7012jQuery.each( [ "height", "width" ], function( _i, dimension ) { 7013 jQuery.cssHooks[ dimension ] = { 7014 get: function( elem, computed, extra ) { 7015 if ( computed ) { 7016 7017 // Certain elements can have dimension info if we invisibly show them 7018 // but it must have a current display style that would benefit 7019 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 7020 7021 // Support: Safari 8+ 7022 // Table columns in Safari have non-zero offsetWidth & zero 7023 // getBoundingClientRect().width unless display is changed. 7024 // Support: IE <=11 only 7025 // Running getBoundingClientRect on a disconnected node 7026 // in IE throws an error. 7027 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? 7028 swap( elem, cssShow, function() { 7029 return getWidthOrHeight( elem, dimension, extra ); 7030 } ) : 7031 getWidthOrHeight( elem, dimension, extra ); 7032 } 7033 }, 7034 7035 set: function( elem, value, extra ) { 7036 var matches, 7037 styles = getStyles( elem ), 7038 7039 // Only read styles.position if the test has a chance to fail 7040 // to avoid forcing a reflow. 7041 scrollboxSizeBuggy = !support.scrollboxSize() && 7042 styles.position === "absolute", 7043 7044 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) 7045 boxSizingNeeded = scrollboxSizeBuggy || extra, 7046 isBorderBox = boxSizingNeeded && 7047 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 7048 subtract = extra ? 7049 boxModelAdjustment( 7050 elem, 7051 dimension, 7052 extra, 7053 isBorderBox, 7054 styles 7055 ) : 7056 0; 7057 7058 // Account for unreliable border-box dimensions by comparing offset* to computed and 7059 // faking a content-box to get border and padding (gh-3699) 7060 if ( isBorderBox && scrollboxSizeBuggy ) { 7061 subtract -= Math.ceil( 7062 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 7063 parseFloat( styles[ dimension ] ) - 7064 boxModelAdjustment( elem, dimension, "border", false, styles ) - 7065 0.5 7066 ); 7067 } 7068 7069 // Convert to pixels if value adjustment is needed 7070 if ( subtract && ( matches = rcssNum.exec( value ) ) && 7071 ( matches[ 3 ] || "px" ) !== "px" ) { 7072 7073 elem.style[ dimension ] = value; 7074 value = jQuery.css( elem, dimension ); 7075 } 7076 7077 return setPositiveNumber( elem, value, subtract ); 7078 } 7079 }; 7080} ); 7081 7082jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 7083 function( elem, computed ) { 7084 if ( computed ) { 7085 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 7086 elem.getBoundingClientRect().left - 7087 swap( elem, { marginLeft: 0 }, function() { 7088 return elem.getBoundingClientRect().left; 7089 } ) 7090 ) + "px"; 7091 } 7092 } 7093); 7094 7095// These hooks are used by animate to expand properties 7096jQuery.each( { 7097 margin: "", 7098 padding: "", 7099 border: "Width" 7100}, function( prefix, suffix ) { 7101 jQuery.cssHooks[ prefix + suffix ] = { 7102 expand: function( value ) { 7103 var i = 0, 7104 expanded = {}, 7105 7106 // Assumes a single number if not a string 7107 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 7108 7109 for ( ; i < 4; i++ ) { 7110 expanded[ prefix + cssExpand[ i ] + suffix ] = 7111 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 7112 } 7113 7114 return expanded; 7115 } 7116 }; 7117 7118 if ( prefix !== "margin" ) { 7119 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 7120 } 7121} ); 7122 7123jQuery.fn.extend( { 7124 css: function( name, value ) { 7125 return access( this, function( elem, name, value ) { 7126 var styles, len, 7127 map = {}, 7128 i = 0; 7129 7130 if ( Array.isArray( name ) ) { 7131 styles = getStyles( elem ); 7132 len = name.length; 7133 7134 for ( ; i < len; i++ ) { 7135 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 7136 } 7137 7138 return map; 7139 } 7140 7141 return value !== undefined ? 7142 jQuery.style( elem, name, value ) : 7143 jQuery.css( elem, name ); 7144 }, name, value, arguments.length > 1 ); 7145 } 7146} ); 7147 7148 7149function Tween( elem, options, prop, end, easing ) { 7150 return new Tween.prototype.init( elem, options, prop, end, easing ); 7151} 7152jQuery.Tween = Tween; 7153 7154Tween.prototype = { 7155 constructor: Tween, 7156 init: function( elem, options, prop, end, easing, unit ) { 7157 this.elem = elem; 7158 this.prop = prop; 7159 this.easing = easing || jQuery.easing._default; 7160 this.options = options; 7161 this.start = this.now = this.cur(); 7162 this.end = end; 7163 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 7164 }, 7165 cur: function() { 7166 var hooks = Tween.propHooks[ this.prop ]; 7167 7168 return hooks && hooks.get ? 7169 hooks.get( this ) : 7170 Tween.propHooks._default.get( this ); 7171 }, 7172 run: function( percent ) { 7173 var eased, 7174 hooks = Tween.propHooks[ this.prop ]; 7175 7176 if ( this.options.duration ) { 7177 this.pos = eased = jQuery.easing[ this.easing ]( 7178 percent, this.options.duration * percent, 0, 1, this.options.duration 7179 ); 7180 } else { 7181 this.pos = eased = percent; 7182 } 7183 this.now = ( this.end - this.start ) * eased + this.start; 7184 7185 if ( this.options.step ) { 7186 this.options.step.call( this.elem, this.now, this ); 7187 } 7188 7189 if ( hooks && hooks.set ) { 7190 hooks.set( this ); 7191 } else { 7192 Tween.propHooks._default.set( this ); 7193 } 7194 return this; 7195 } 7196}; 7197 7198Tween.prototype.init.prototype = Tween.prototype; 7199 7200Tween.propHooks = { 7201 _default: { 7202 get: function( tween ) { 7203 var result; 7204 7205 // Use a property on the element directly when it is not a DOM element, 7206 // or when there is no matching style property that exists. 7207 if ( tween.elem.nodeType !== 1 || 7208 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 7209 return tween.elem[ tween.prop ]; 7210 } 7211 7212 // Passing an empty string as a 3rd parameter to .css will automatically 7213 // attempt a parseFloat and fallback to a string if the parse fails. 7214 // Simple values such as "10px" are parsed to Float; 7215 // complex values such as "rotate(1rad)" are returned as-is. 7216 result = jQuery.css( tween.elem, tween.prop, "" ); 7217 7218 // Empty strings, null, undefined and "auto" are converted to 0. 7219 return !result || result === "auto" ? 0 : result; 7220 }, 7221 set: function( tween ) { 7222 7223 // Use step hook for back compat. 7224 // Use cssHook if its there. 7225 // Use .style if available and use plain properties where available. 7226 if ( jQuery.fx.step[ tween.prop ] ) { 7227 jQuery.fx.step[ tween.prop ]( tween ); 7228 } else if ( tween.elem.nodeType === 1 && ( 7229 jQuery.cssHooks[ tween.prop ] || 7230 tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { 7231 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 7232 } else { 7233 tween.elem[ tween.prop ] = tween.now; 7234 } 7235 } 7236 } 7237}; 7238 7239// Support: IE <=9 only 7240// Panic based approach to setting things on disconnected nodes 7241Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 7242 set: function( tween ) { 7243 if ( tween.elem.nodeType && tween.elem.parentNode ) { 7244 tween.elem[ tween.prop ] = tween.now; 7245 } 7246 } 7247}; 7248 7249jQuery.easing = { 7250 linear: function( p ) { 7251 return p; 7252 }, 7253 swing: function( p ) { 7254 return 0.5 - Math.cos( p * Math.PI ) / 2; 7255 }, 7256 _default: "swing" 7257}; 7258 7259jQuery.fx = Tween.prototype.init; 7260 7261// Back compat <1.8 extension point 7262jQuery.fx.step = {}; 7263 7264 7265 7266 7267var 7268 fxNow, inProgress, 7269 rfxtypes = /^(?:toggle|show|hide)$/, 7270 rrun = /queueHooks$/; 7271 7272function schedule() { 7273 if ( inProgress ) { 7274 if ( document.hidden === false && window.requestAnimationFrame ) { 7275 window.requestAnimationFrame( schedule ); 7276 } else { 7277 window.setTimeout( schedule, jQuery.fx.interval ); 7278 } 7279 7280 jQuery.fx.tick(); 7281 } 7282} 7283 7284// Animations created synchronously will run synchronously 7285function createFxNow() { 7286 window.setTimeout( function() { 7287 fxNow = undefined; 7288 } ); 7289 return ( fxNow = Date.now() ); 7290} 7291 7292// Generate parameters to create a standard animation 7293function genFx( type, includeWidth ) { 7294 var which, 7295 i = 0, 7296 attrs = { height: type }; 7297 7298 // If we include width, step value is 1 to do all cssExpand values, 7299 // otherwise step value is 2 to skip over Left and Right 7300 includeWidth = includeWidth ? 1 : 0; 7301 for ( ; i < 4; i += 2 - includeWidth ) { 7302 which = cssExpand[ i ]; 7303 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 7304 } 7305 7306 if ( includeWidth ) { 7307 attrs.opacity = attrs.width = type; 7308 } 7309 7310 return attrs; 7311} 7312 7313function createTween( value, prop, animation ) { 7314 var tween, 7315 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 7316 index = 0, 7317 length = collection.length; 7318 for ( ; index < length; index++ ) { 7319 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 7320 7321 // We're done with this property 7322 return tween; 7323 } 7324 } 7325} 7326 7327function defaultPrefilter( elem, props, opts ) { 7328 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 7329 isBox = "width" in props || "height" in props, 7330 anim = this, 7331 orig = {}, 7332 style = elem.style, 7333 hidden = elem.nodeType && isHiddenWithinTree( elem ), 7334 dataShow = dataPriv.get( elem, "fxshow" ); 7335 7336 // Queue-skipping animations hijack the fx hooks 7337 if ( !opts.queue ) { 7338 hooks = jQuery._queueHooks( elem, "fx" ); 7339 if ( hooks.unqueued == null ) { 7340 hooks.unqueued = 0; 7341 oldfire = hooks.empty.fire; 7342 hooks.empty.fire = function() { 7343 if ( !hooks.unqueued ) { 7344 oldfire(); 7345 } 7346 }; 7347 } 7348 hooks.unqueued++; 7349 7350 anim.always( function() { 7351 7352 // Ensure the complete handler is called before this completes 7353 anim.always( function() { 7354 hooks.unqueued--; 7355 if ( !jQuery.queue( elem, "fx" ).length ) { 7356 hooks.empty.fire(); 7357 } 7358 } ); 7359 } ); 7360 } 7361 7362 // Detect show/hide animations 7363 for ( prop in props ) { 7364 value = props[ prop ]; 7365 if ( rfxtypes.test( value ) ) { 7366 delete props[ prop ]; 7367 toggle = toggle || value === "toggle"; 7368 if ( value === ( hidden ? "hide" : "show" ) ) { 7369 7370 // Pretend to be hidden if this is a "show" and 7371 // there is still data from a stopped show/hide 7372 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 7373 hidden = true; 7374 7375 // Ignore all other no-op show/hide data 7376 } else { 7377 continue; 7378 } 7379 } 7380 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 7381 } 7382 } 7383 7384 // Bail out if this is a no-op like .hide().hide() 7385 propTween = !jQuery.isEmptyObject( props ); 7386 if ( !propTween && jQuery.isEmptyObject( orig ) ) { 7387 return; 7388 } 7389 7390 // Restrict "overflow" and "display" styles during box animations 7391 if ( isBox && elem.nodeType === 1 ) { 7392 7393 // Support: IE <=9 - 11, Edge 12 - 15 7394 // Record all 3 overflow attributes because IE does not infer the shorthand 7395 // from identically-valued overflowX and overflowY and Edge just mirrors 7396 // the overflowX value there. 7397 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 7398 7399 // Identify a display type, preferring old show/hide data over the CSS cascade 7400 restoreDisplay = dataShow && dataShow.display; 7401 if ( restoreDisplay == null ) { 7402 restoreDisplay = dataPriv.get( elem, "display" ); 7403 } 7404 display = jQuery.css( elem, "display" ); 7405 if ( display === "none" ) { 7406 if ( restoreDisplay ) { 7407 display = restoreDisplay; 7408 } else { 7409 7410 // Get nonempty value(s) by temporarily forcing visibility 7411 showHide( [ elem ], true ); 7412 restoreDisplay = elem.style.display || restoreDisplay; 7413 display = jQuery.css( elem, "display" ); 7414 showHide( [ elem ] ); 7415 } 7416 } 7417 7418 // Animate inline elements as inline-block 7419 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { 7420 if ( jQuery.css( elem, "float" ) === "none" ) { 7421 7422 // Restore the original display value at the end of pure show/hide animations 7423 if ( !propTween ) { 7424 anim.done( function() { 7425 style.display = restoreDisplay; 7426 } ); 7427 if ( restoreDisplay == null ) { 7428 display = style.display; 7429 restoreDisplay = display === "none" ? "" : display; 7430 } 7431 } 7432 style.display = "inline-block"; 7433 } 7434 } 7435 } 7436 7437 if ( opts.overflow ) { 7438 style.overflow = "hidden"; 7439 anim.always( function() { 7440 style.overflow = opts.overflow[ 0 ]; 7441 style.overflowX = opts.overflow[ 1 ]; 7442 style.overflowY = opts.overflow[ 2 ]; 7443 } ); 7444 } 7445 7446 // Implement show/hide animations 7447 propTween = false; 7448 for ( prop in orig ) { 7449 7450 // General show/hide setup for this element animation 7451 if ( !propTween ) { 7452 if ( dataShow ) { 7453 if ( "hidden" in dataShow ) { 7454 hidden = dataShow.hidden; 7455 } 7456 } else { 7457 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); 7458 } 7459 7460 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 7461 if ( toggle ) { 7462 dataShow.hidden = !hidden; 7463 } 7464 7465 // Show elements before animating them 7466 if ( hidden ) { 7467 showHide( [ elem ], true ); 7468 } 7469 7470 /* eslint-disable no-loop-func */ 7471 7472 anim.done( function() { 7473 7474 /* eslint-enable no-loop-func */ 7475 7476 // The final step of a "hide" animation is actually hiding the element 7477 if ( !hidden ) { 7478 showHide( [ elem ] ); 7479 } 7480 dataPriv.remove( elem, "fxshow" ); 7481 for ( prop in orig ) { 7482 jQuery.style( elem, prop, orig[ prop ] ); 7483 } 7484 } ); 7485 } 7486 7487 // Per-property setup 7488 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 7489 if ( !( prop in dataShow ) ) { 7490 dataShow[ prop ] = propTween.start; 7491 if ( hidden ) { 7492 propTween.end = propTween.start; 7493 propTween.start = 0; 7494 } 7495 } 7496 } 7497} 7498 7499function propFilter( props, specialEasing ) { 7500 var index, name, easing, value, hooks; 7501 7502 // camelCase, specialEasing and expand cssHook pass 7503 for ( index in props ) { 7504 name = camelCase( index ); 7505 easing = specialEasing[ name ]; 7506 value = props[ index ]; 7507 if ( Array.isArray( value ) ) { 7508 easing = value[ 1 ]; 7509 value = props[ index ] = value[ 0 ]; 7510 } 7511 7512 if ( index !== name ) { 7513 props[ name ] = value; 7514 delete props[ index ]; 7515 } 7516 7517 hooks = jQuery.cssHooks[ name ]; 7518 if ( hooks && "expand" in hooks ) { 7519 value = hooks.expand( value ); 7520 delete props[ name ]; 7521 7522 // Not quite $.extend, this won't overwrite existing keys. 7523 // Reusing 'index' because we have the correct "name" 7524 for ( index in value ) { 7525 if ( !( index in props ) ) { 7526 props[ index ] = value[ index ]; 7527 specialEasing[ index ] = easing; 7528 } 7529 } 7530 } else { 7531 specialEasing[ name ] = easing; 7532 } 7533 } 7534} 7535 7536function Animation( elem, properties, options ) { 7537 var result, 7538 stopped, 7539 index = 0, 7540 length = Animation.prefilters.length, 7541 deferred = jQuery.Deferred().always( function() { 7542 7543 // Don't match elem in the :animated selector 7544 delete tick.elem; 7545 } ), 7546 tick = function() { 7547 if ( stopped ) { 7548 return false; 7549 } 7550 var currentTime = fxNow || createFxNow(), 7551 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 7552 7553 // Support: Android 2.3 only 7554 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) 7555 temp = remaining / animation.duration || 0, 7556 percent = 1 - temp, 7557 index = 0, 7558 length = animation.tweens.length; 7559 7560 for ( ; index < length; index++ ) { 7561 animation.tweens[ index ].run( percent ); 7562 } 7563 7564 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 7565 7566 // If there's more to do, yield 7567 if ( percent < 1 && length ) { 7568 return remaining; 7569 } 7570 7571 // If this was an empty animation, synthesize a final progress notification 7572 if ( !length ) { 7573 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7574 } 7575 7576 // Resolve the animation and report its conclusion 7577 deferred.resolveWith( elem, [ animation ] ); 7578 return false; 7579 }, 7580 animation = deferred.promise( { 7581 elem: elem, 7582 props: jQuery.extend( {}, properties ), 7583 opts: jQuery.extend( true, { 7584 specialEasing: {}, 7585 easing: jQuery.easing._default 7586 }, options ), 7587 originalProperties: properties, 7588 originalOptions: options, 7589 startTime: fxNow || createFxNow(), 7590 duration: options.duration, 7591 tweens: [], 7592 createTween: function( prop, end ) { 7593 var tween = jQuery.Tween( elem, animation.opts, prop, end, 7594 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 7595 animation.tweens.push( tween ); 7596 return tween; 7597 }, 7598 stop: function( gotoEnd ) { 7599 var index = 0, 7600 7601 // If we are going to the end, we want to run all the tweens 7602 // otherwise we skip this part 7603 length = gotoEnd ? animation.tweens.length : 0; 7604 if ( stopped ) { 7605 return this; 7606 } 7607 stopped = true; 7608 for ( ; index < length; index++ ) { 7609 animation.tweens[ index ].run( 1 ); 7610 } 7611 7612 // Resolve when we played the last frame; otherwise, reject 7613 if ( gotoEnd ) { 7614 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7615 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 7616 } else { 7617 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 7618 } 7619 return this; 7620 } 7621 } ), 7622 props = animation.props; 7623 7624 propFilter( props, animation.opts.specialEasing ); 7625 7626 for ( ; index < length; index++ ) { 7627 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 7628 if ( result ) { 7629 if ( isFunction( result.stop ) ) { 7630 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 7631 result.stop.bind( result ); 7632 } 7633 return result; 7634 } 7635 } 7636 7637 jQuery.map( props, createTween, animation ); 7638 7639 if ( isFunction( animation.opts.start ) ) { 7640 animation.opts.start.call( elem, animation ); 7641 } 7642 7643 // Attach callbacks from options 7644 animation 7645 .progress( animation.opts.progress ) 7646 .done( animation.opts.done, animation.opts.complete ) 7647 .fail( animation.opts.fail ) 7648 .always( animation.opts.always ); 7649 7650 jQuery.fx.timer( 7651 jQuery.extend( tick, { 7652 elem: elem, 7653 anim: animation, 7654 queue: animation.opts.queue 7655 } ) 7656 ); 7657 7658 return animation; 7659} 7660 7661jQuery.Animation = jQuery.extend( Animation, { 7662 7663 tweeners: { 7664 "*": [ function( prop, value ) { 7665 var tween = this.createTween( prop, value ); 7666 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 7667 return tween; 7668 } ] 7669 }, 7670 7671 tweener: function( props, callback ) { 7672 if ( isFunction( props ) ) { 7673 callback = props; 7674 props = [ "*" ]; 7675 } else { 7676 props = props.match( rnothtmlwhite ); 7677 } 7678 7679 var prop, 7680 index = 0, 7681 length = props.length; 7682 7683 for ( ; index < length; index++ ) { 7684 prop = props[ index ]; 7685 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 7686 Animation.tweeners[ prop ].unshift( callback ); 7687 } 7688 }, 7689 7690 prefilters: [ defaultPrefilter ], 7691 7692 prefilter: function( callback, prepend ) { 7693 if ( prepend ) { 7694 Animation.prefilters.unshift( callback ); 7695 } else { 7696 Animation.prefilters.push( callback ); 7697 } 7698 } 7699} ); 7700 7701jQuery.speed = function( speed, easing, fn ) { 7702 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 7703 complete: fn || !fn && easing || 7704 isFunction( speed ) && speed, 7705 duration: speed, 7706 easing: fn && easing || easing && !isFunction( easing ) && easing 7707 }; 7708 7709 // Go to the end state if fx are off 7710 if ( jQuery.fx.off ) { 7711 opt.duration = 0; 7712 7713 } else { 7714 if ( typeof opt.duration !== "number" ) { 7715 if ( opt.duration in jQuery.fx.speeds ) { 7716 opt.duration = jQuery.fx.speeds[ opt.duration ]; 7717 7718 } else { 7719 opt.duration = jQuery.fx.speeds._default; 7720 } 7721 } 7722 } 7723 7724 // Normalize opt.queue - true/undefined/null -> "fx" 7725 if ( opt.queue == null || opt.queue === true ) { 7726 opt.queue = "fx"; 7727 } 7728 7729 // Queueing 7730 opt.old = opt.complete; 7731 7732 opt.complete = function() { 7733 if ( isFunction( opt.old ) ) { 7734 opt.old.call( this ); 7735 } 7736 7737 if ( opt.queue ) { 7738 jQuery.dequeue( this, opt.queue ); 7739 } 7740 }; 7741 7742 return opt; 7743}; 7744 7745jQuery.fn.extend( { 7746 fadeTo: function( speed, to, easing, callback ) { 7747 7748 // Show any hidden elements after setting opacity to 0 7749 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() 7750 7751 // Animate to the value specified 7752 .end().animate( { opacity: to }, speed, easing, callback ); 7753 }, 7754 animate: function( prop, speed, easing, callback ) { 7755 var empty = jQuery.isEmptyObject( prop ), 7756 optall = jQuery.speed( speed, easing, callback ), 7757 doAnimation = function() { 7758 7759 // Operate on a copy of prop so per-property easing won't be lost 7760 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 7761 7762 // Empty animations, or finishing resolves immediately 7763 if ( empty || dataPriv.get( this, "finish" ) ) { 7764 anim.stop( true ); 7765 } 7766 }; 7767 7768 doAnimation.finish = doAnimation; 7769 7770 return empty || optall.queue === false ? 7771 this.each( doAnimation ) : 7772 this.queue( optall.queue, doAnimation ); 7773 }, 7774 stop: function( type, clearQueue, gotoEnd ) { 7775 var stopQueue = function( hooks ) { 7776 var stop = hooks.stop; 7777 delete hooks.stop; 7778 stop( gotoEnd ); 7779 }; 7780 7781 if ( typeof type !== "string" ) { 7782 gotoEnd = clearQueue; 7783 clearQueue = type; 7784 type = undefined; 7785 } 7786 if ( clearQueue ) { 7787 this.queue( type || "fx", [] ); 7788 } 7789 7790 return this.each( function() { 7791 var dequeue = true, 7792 index = type != null && type + "queueHooks", 7793 timers = jQuery.timers, 7794 data = dataPriv.get( this ); 7795 7796 if ( index ) { 7797 if ( data[ index ] && data[ index ].stop ) { 7798 stopQueue( data[ index ] ); 7799 } 7800 } else { 7801 for ( index in data ) { 7802 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 7803 stopQueue( data[ index ] ); 7804 } 7805 } 7806 } 7807 7808 for ( index = timers.length; index--; ) { 7809 if ( timers[ index ].elem === this && 7810 ( type == null || timers[ index ].queue === type ) ) { 7811 7812 timers[ index ].anim.stop( gotoEnd ); 7813 dequeue = false; 7814 timers.splice( index, 1 ); 7815 } 7816 } 7817 7818 // Start the next in the queue if the last step wasn't forced. 7819 // Timers currently will call their complete callbacks, which 7820 // will dequeue but only if they were gotoEnd. 7821 if ( dequeue || !gotoEnd ) { 7822 jQuery.dequeue( this, type ); 7823 } 7824 } ); 7825 }, 7826 finish: function( type ) { 7827 if ( type !== false ) { 7828 type = type || "fx"; 7829 } 7830 return this.each( function() { 7831 var index, 7832 data = dataPriv.get( this ), 7833 queue = data[ type + "queue" ], 7834 hooks = data[ type + "queueHooks" ], 7835 timers = jQuery.timers, 7836 length = queue ? queue.length : 0; 7837 7838 // Enable finishing flag on private data 7839 data.finish = true; 7840 7841 // Empty the queue first 7842 jQuery.queue( this, type, [] ); 7843 7844 if ( hooks && hooks.stop ) { 7845 hooks.stop.call( this, true ); 7846 } 7847 7848 // Look for any active animations, and finish them 7849 for ( index = timers.length; index--; ) { 7850 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 7851 timers[ index ].anim.stop( true ); 7852 timers.splice( index, 1 ); 7853 } 7854 } 7855 7856 // Look for any animations in the old queue and finish them 7857 for ( index = 0; index < length; index++ ) { 7858 if ( queue[ index ] && queue[ index ].finish ) { 7859 queue[ index ].finish.call( this ); 7860 } 7861 } 7862 7863 // Turn off finishing flag 7864 delete data.finish; 7865 } ); 7866 } 7867} ); 7868 7869jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { 7870 var cssFn = jQuery.fn[ name ]; 7871 jQuery.fn[ name ] = function( speed, easing, callback ) { 7872 return speed == null || typeof speed === "boolean" ? 7873 cssFn.apply( this, arguments ) : 7874 this.animate( genFx( name, true ), speed, easing, callback ); 7875 }; 7876} ); 7877 7878// Generate shortcuts for custom animations 7879jQuery.each( { 7880 slideDown: genFx( "show" ), 7881 slideUp: genFx( "hide" ), 7882 slideToggle: genFx( "toggle" ), 7883 fadeIn: { opacity: "show" }, 7884 fadeOut: { opacity: "hide" }, 7885 fadeToggle: { opacity: "toggle" } 7886}, function( name, props ) { 7887 jQuery.fn[ name ] = function( speed, easing, callback ) { 7888 return this.animate( props, speed, easing, callback ); 7889 }; 7890} ); 7891 7892jQuery.timers = []; 7893jQuery.fx.tick = function() { 7894 var timer, 7895 i = 0, 7896 timers = jQuery.timers; 7897 7898 fxNow = Date.now(); 7899 7900 for ( ; i < timers.length; i++ ) { 7901 timer = timers[ i ]; 7902 7903 // Run the timer and safely remove it when done (allowing for external removal) 7904 if ( !timer() && timers[ i ] === timer ) { 7905 timers.splice( i--, 1 ); 7906 } 7907 } 7908 7909 if ( !timers.length ) { 7910 jQuery.fx.stop(); 7911 } 7912 fxNow = undefined; 7913}; 7914 7915jQuery.fx.timer = function( timer ) { 7916 jQuery.timers.push( timer ); 7917 jQuery.fx.start(); 7918}; 7919 7920jQuery.fx.interval = 13; 7921jQuery.fx.start = function() { 7922 if ( inProgress ) { 7923 return; 7924 } 7925 7926 inProgress = true; 7927 schedule(); 7928}; 7929 7930jQuery.fx.stop = function() { 7931 inProgress = null; 7932}; 7933 7934jQuery.fx.speeds = { 7935 slow: 600, 7936 fast: 200, 7937 7938 // Default speed 7939 _default: 400 7940}; 7941 7942 7943// Based off of the plugin by Clint Helfers, with permission. 7944// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ 7945jQuery.fn.delay = function( time, type ) { 7946 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 7947 type = type || "fx"; 7948 7949 return this.queue( type, function( next, hooks ) { 7950 var timeout = window.setTimeout( next, time ); 7951 hooks.stop = function() { 7952 window.clearTimeout( timeout ); 7953 }; 7954 } ); 7955}; 7956 7957 7958( function() { 7959 var input = document.createElement( "input" ), 7960 select = document.createElement( "select" ), 7961 opt = select.appendChild( document.createElement( "option" ) ); 7962 7963 input.type = "checkbox"; 7964 7965 // Support: Android <=4.3 only 7966 // Default value for a checkbox should be "on" 7967 support.checkOn = input.value !== ""; 7968 7969 // Support: IE <=11 only 7970 // Must access selectedIndex to make default options select 7971 support.optSelected = opt.selected; 7972 7973 // Support: IE <=11 only 7974 // An input loses its value after becoming a radio 7975 input = document.createElement( "input" ); 7976 input.value = "t"; 7977 input.type = "radio"; 7978 support.radioValue = input.value === "t"; 7979} )(); 7980 7981 7982var boolHook, 7983 attrHandle = jQuery.expr.attrHandle; 7984 7985jQuery.fn.extend( { 7986 attr: function( name, value ) { 7987 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 7988 }, 7989 7990 removeAttr: function( name ) { 7991 return this.each( function() { 7992 jQuery.removeAttr( this, name ); 7993 } ); 7994 } 7995} ); 7996 7997jQuery.extend( { 7998 attr: function( elem, name, value ) { 7999 var ret, hooks, 8000 nType = elem.nodeType; 8001 8002 // Don't get/set attributes on text, comment and attribute nodes 8003 if ( nType === 3 || nType === 8 || nType === 2 ) { 8004 return; 8005 } 8006 8007 // Fallback to prop when attributes are not supported 8008 if ( typeof elem.getAttribute === "undefined" ) { 8009 return jQuery.prop( elem, name, value ); 8010 } 8011 8012 // Attribute hooks are determined by the lowercase version 8013 // Grab necessary hook if one is defined 8014 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 8015 hooks = jQuery.attrHooks[ name.toLowerCase() ] || 8016 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 8017 } 8018 8019 if ( value !== undefined ) { 8020 if ( value === null ) { 8021 jQuery.removeAttr( elem, name ); 8022 return; 8023 } 8024 8025 if ( hooks && "set" in hooks && 8026 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 8027 return ret; 8028 } 8029 8030 elem.setAttribute( name, value + "" ); 8031 return value; 8032 } 8033 8034 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 8035 return ret; 8036 } 8037 8038 ret = jQuery.find.attr( elem, name ); 8039 8040 // Non-existent attributes return null, we normalize to undefined 8041 return ret == null ? undefined : ret; 8042 }, 8043 8044 attrHooks: { 8045 type: { 8046 set: function( elem, value ) { 8047 if ( !support.radioValue && value === "radio" && 8048 nodeName( elem, "input" ) ) { 8049 var val = elem.value; 8050 elem.setAttribute( "type", value ); 8051 if ( val ) { 8052 elem.value = val; 8053 } 8054 return value; 8055 } 8056 } 8057 } 8058 }, 8059 8060 removeAttr: function( elem, value ) { 8061 var name, 8062 i = 0, 8063 8064 // Attribute names can contain non-HTML whitespace characters 8065 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 8066 attrNames = value && value.match( rnothtmlwhite ); 8067 8068 if ( attrNames && elem.nodeType === 1 ) { 8069 while ( ( name = attrNames[ i++ ] ) ) { 8070 elem.removeAttribute( name ); 8071 } 8072 } 8073 } 8074} ); 8075 8076// Hooks for boolean attributes 8077boolHook = { 8078 set: function( elem, value, name ) { 8079 if ( value === false ) { 8080 8081 // Remove boolean attributes when set to false 8082 jQuery.removeAttr( elem, name ); 8083 } else { 8084 elem.setAttribute( name, name ); 8085 } 8086 return name; 8087 } 8088}; 8089 8090jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { 8091 var getter = attrHandle[ name ] || jQuery.find.attr; 8092 8093 attrHandle[ name ] = function( elem, name, isXML ) { 8094 var ret, handle, 8095 lowercaseName = name.toLowerCase(); 8096 8097 if ( !isXML ) { 8098 8099 // Avoid an infinite loop by temporarily removing this function from the getter 8100 handle = attrHandle[ lowercaseName ]; 8101 attrHandle[ lowercaseName ] = ret; 8102 ret = getter( elem, name, isXML ) != null ? 8103 lowercaseName : 8104 null; 8105 attrHandle[ lowercaseName ] = handle; 8106 } 8107 return ret; 8108 }; 8109} ); 8110 8111 8112 8113 8114var rfocusable = /^(?:input|select|textarea|button)$/i, 8115 rclickable = /^(?:a|area)$/i; 8116 8117jQuery.fn.extend( { 8118 prop: function( name, value ) { 8119 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 8120 }, 8121 8122 removeProp: function( name ) { 8123 return this.each( function() { 8124 delete this[ jQuery.propFix[ name ] || name ]; 8125 } ); 8126 } 8127} ); 8128 8129jQuery.extend( { 8130 prop: function( elem, name, value ) { 8131 var ret, hooks, 8132 nType = elem.nodeType; 8133 8134 // Don't get/set properties on text, comment and attribute nodes 8135 if ( nType === 3 || nType === 8 || nType === 2 ) { 8136 return; 8137 } 8138 8139 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 8140 8141 // Fix name and attach hooks 8142 name = jQuery.propFix[ name ] || name; 8143 hooks = jQuery.propHooks[ name ]; 8144 } 8145 8146 if ( value !== undefined ) { 8147 if ( hooks && "set" in hooks && 8148 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 8149 return ret; 8150 } 8151 8152 return ( elem[ name ] = value ); 8153 } 8154 8155 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 8156 return ret; 8157 } 8158 8159 return elem[ name ]; 8160 }, 8161 8162 propHooks: { 8163 tabIndex: { 8164 get: function( elem ) { 8165 8166 // Support: IE <=9 - 11 only 8167 // elem.tabIndex doesn't always return the 8168 // correct value when it hasn't been explicitly set 8169 // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 8170 // Use proper attribute retrieval(#12072) 8171 var tabindex = jQuery.find.attr( elem, "tabindex" ); 8172 8173 if ( tabindex ) { 8174 return parseInt( tabindex, 10 ); 8175 } 8176 8177 if ( 8178 rfocusable.test( elem.nodeName ) || 8179 rclickable.test( elem.nodeName ) && 8180 elem.href 8181 ) { 8182 return 0; 8183 } 8184 8185 return -1; 8186 } 8187 } 8188 }, 8189 8190 propFix: { 8191 "for": "htmlFor", 8192 "class": "className" 8193 } 8194} ); 8195 8196// Support: IE <=11 only 8197// Accessing the selectedIndex property 8198// forces the browser to respect setting selected 8199// on the option 8200// The getter ensures a default option is selected 8201// when in an optgroup 8202// eslint rule "no-unused-expressions" is disabled for this code 8203// since it considers such accessions noop 8204if ( !support.optSelected ) { 8205 jQuery.propHooks.selected = { 8206 get: function( elem ) { 8207 8208 /* eslint no-unused-expressions: "off" */ 8209 8210 var parent = elem.parentNode; 8211 if ( parent && parent.parentNode ) { 8212 parent.parentNode.selectedIndex; 8213 } 8214 return null; 8215 }, 8216 set: function( elem ) { 8217 8218 /* eslint no-unused-expressions: "off" */ 8219 8220 var parent = elem.parentNode; 8221 if ( parent ) { 8222 parent.selectedIndex; 8223 8224 if ( parent.parentNode ) { 8225 parent.parentNode.selectedIndex; 8226 } 8227 } 8228 } 8229 }; 8230} 8231 8232jQuery.each( [ 8233 "tabIndex", 8234 "readOnly", 8235 "maxLength", 8236 "cellSpacing", 8237 "cellPadding", 8238 "rowSpan", 8239 "colSpan", 8240 "useMap", 8241 "frameBorder", 8242 "contentEditable" 8243], function() { 8244 jQuery.propFix[ this.toLowerCase() ] = this; 8245} ); 8246 8247 8248 8249 8250 // Strip and collapse whitespace according to HTML spec 8251 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 8252 function stripAndCollapse( value ) { 8253 var tokens = value.match( rnothtmlwhite ) || []; 8254 return tokens.join( " " ); 8255 } 8256 8257 8258function getClass( elem ) { 8259 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 8260} 8261 8262function classesToArray( value ) { 8263 if ( Array.isArray( value ) ) { 8264 return value; 8265 } 8266 if ( typeof value === "string" ) { 8267 return value.match( rnothtmlwhite ) || []; 8268 } 8269 return []; 8270} 8271 8272jQuery.fn.extend( { 8273 addClass: function( value ) { 8274 var classes, elem, cur, curValue, clazz, j, finalValue, 8275 i = 0; 8276 8277 if ( isFunction( value ) ) { 8278 return this.each( function( j ) { 8279 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 8280 } ); 8281 } 8282 8283 classes = classesToArray( value ); 8284 8285 if ( classes.length ) { 8286 while ( ( elem = this[ i++ ] ) ) { 8287 curValue = getClass( elem ); 8288 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 8289 8290 if ( cur ) { 8291 j = 0; 8292 while ( ( clazz = classes[ j++ ] ) ) { 8293 if ( cur.indexOf( " " + clazz + " " ) < 0 ) { 8294 cur += clazz + " "; 8295 } 8296 } 8297 8298 // Only assign if different to avoid unneeded rendering. 8299 finalValue = stripAndCollapse( cur ); 8300 if ( curValue !== finalValue ) { 8301 elem.setAttribute( "class", finalValue ); 8302 } 8303 } 8304 } 8305 } 8306 8307 return this; 8308 }, 8309 8310 removeClass: function( value ) { 8311 var classes, elem, cur, curValue, clazz, j, finalValue, 8312 i = 0; 8313 8314 if ( isFunction( value ) ) { 8315 return this.each( function( j ) { 8316 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 8317 } ); 8318 } 8319 8320 if ( !arguments.length ) { 8321 return this.attr( "class", "" ); 8322 } 8323 8324 classes = classesToArray( value ); 8325 8326 if ( classes.length ) { 8327 while ( ( elem = this[ i++ ] ) ) { 8328 curValue = getClass( elem ); 8329 8330 // This expression is here for better compressibility (see addClass) 8331 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 8332 8333 if ( cur ) { 8334 j = 0; 8335 while ( ( clazz = classes[ j++ ] ) ) { 8336 8337 // Remove *all* instances 8338 while ( cur.indexOf( " " + clazz + " " ) > -1 ) { 8339 cur = cur.replace( " " + clazz + " ", " " ); 8340 } 8341 } 8342 8343 // Only assign if different to avoid unneeded rendering. 8344 finalValue = stripAndCollapse( cur ); 8345 if ( curValue !== finalValue ) { 8346 elem.setAttribute( "class", finalValue ); 8347 } 8348 } 8349 } 8350 } 8351 8352 return this; 8353 }, 8354 8355 toggleClass: function( value, stateVal ) { 8356 var type = typeof value, 8357 isValidValue = type === "string" || Array.isArray( value ); 8358 8359 if ( typeof stateVal === "boolean" && isValidValue ) { 8360 return stateVal ? this.addClass( value ) : this.removeClass( value ); 8361 } 8362 8363 if ( isFunction( value ) ) { 8364 return this.each( function( i ) { 8365 jQuery( this ).toggleClass( 8366 value.call( this, i, getClass( this ), stateVal ), 8367 stateVal 8368 ); 8369 } ); 8370 } 8371 8372 return this.each( function() { 8373 var className, i, self, classNames; 8374 8375 if ( isValidValue ) { 8376 8377 // Toggle individual class names 8378 i = 0; 8379 self = jQuery( this ); 8380 classNames = classesToArray( value ); 8381 8382 while ( ( className = classNames[ i++ ] ) ) { 8383 8384 // Check each className given, space separated list 8385 if ( self.hasClass( className ) ) { 8386 self.removeClass( className ); 8387 } else { 8388 self.addClass( className ); 8389 } 8390 } 8391 8392 // Toggle whole class name 8393 } else if ( value === undefined || type === "boolean" ) { 8394 className = getClass( this ); 8395 if ( className ) { 8396 8397 // Store className if set 8398 dataPriv.set( this, "__className__", className ); 8399 } 8400 8401 // If the element has a class name or if we're passed `false`, 8402 // then remove the whole classname (if there was one, the above saved it). 8403 // Otherwise bring back whatever was previously saved (if anything), 8404 // falling back to the empty string if nothing was stored. 8405 if ( this.setAttribute ) { 8406 this.setAttribute( "class", 8407 className || value === false ? 8408 "" : 8409 dataPriv.get( this, "__className__" ) || "" 8410 ); 8411 } 8412 } 8413 } ); 8414 }, 8415 8416 hasClass: function( selector ) { 8417 var className, elem, 8418 i = 0; 8419 8420 className = " " + selector + " "; 8421 while ( ( elem = this[ i++ ] ) ) { 8422 if ( elem.nodeType === 1 && 8423 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { 8424 return true; 8425 } 8426 } 8427 8428 return false; 8429 } 8430} ); 8431 8432 8433 8434 8435var rreturn = /\r/g; 8436 8437jQuery.fn.extend( { 8438 val: function( value ) { 8439 var hooks, ret, valueIsFunction, 8440 elem = this[ 0 ]; 8441 8442 if ( !arguments.length ) { 8443 if ( elem ) { 8444 hooks = jQuery.valHooks[ elem.type ] || 8445 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 8446 8447 if ( hooks && 8448 "get" in hooks && 8449 ( ret = hooks.get( elem, "value" ) ) !== undefined 8450 ) { 8451 return ret; 8452 } 8453 8454 ret = elem.value; 8455 8456 // Handle most common string cases 8457 if ( typeof ret === "string" ) { 8458 return ret.replace( rreturn, "" ); 8459 } 8460 8461 // Handle cases where value is null/undef or number 8462 return ret == null ? "" : ret; 8463 } 8464 8465 return; 8466 } 8467 8468 valueIsFunction = isFunction( value ); 8469 8470 return this.each( function( i ) { 8471 var val; 8472 8473 if ( this.nodeType !== 1 ) { 8474 return; 8475 } 8476 8477 if ( valueIsFunction ) { 8478 val = value.call( this, i, jQuery( this ).val() ); 8479 } else { 8480 val = value; 8481 } 8482 8483 // Treat null/undefined as ""; convert numbers to string 8484 if ( val == null ) { 8485 val = ""; 8486 8487 } else if ( typeof val === "number" ) { 8488 val += ""; 8489 8490 } else if ( Array.isArray( val ) ) { 8491 val = jQuery.map( val, function( value ) { 8492 return value == null ? "" : value + ""; 8493 } ); 8494 } 8495 8496 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 8497 8498 // If set returns undefined, fall back to normal setting 8499 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 8500 this.value = val; 8501 } 8502 } ); 8503 } 8504} ); 8505 8506jQuery.extend( { 8507 valHooks: { 8508 option: { 8509 get: function( elem ) { 8510 8511 var val = jQuery.find.attr( elem, "value" ); 8512 return val != null ? 8513 val : 8514 8515 // Support: IE <=10 - 11 only 8516 // option.text throws exceptions (#14686, #14858) 8517 // Strip and collapse whitespace 8518 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 8519 stripAndCollapse( jQuery.text( elem ) ); 8520 } 8521 }, 8522 select: { 8523 get: function( elem ) { 8524 var value, option, i, 8525 options = elem.options, 8526 index = elem.selectedIndex, 8527 one = elem.type === "select-one", 8528 values = one ? null : [], 8529 max = one ? index + 1 : options.length; 8530 8531 if ( index < 0 ) { 8532 i = max; 8533 8534 } else { 8535 i = one ? index : 0; 8536 } 8537 8538 // Loop through all the selected options 8539 for ( ; i < max; i++ ) { 8540 option = options[ i ]; 8541 8542 // Support: IE <=9 only 8543 // IE8-9 doesn't update selected after form reset (#2551) 8544 if ( ( option.selected || i === index ) && 8545 8546 // Don't return options that are disabled or in a disabled optgroup 8547 !option.disabled && 8548 ( !option.parentNode.disabled || 8549 !nodeName( option.parentNode, "optgroup" ) ) ) { 8550 8551 // Get the specific value for the option 8552 value = jQuery( option ).val(); 8553 8554 // We don't need an array for one selects 8555 if ( one ) { 8556 return value; 8557 } 8558 8559 // Multi-Selects return an array 8560 values.push( value ); 8561 } 8562 } 8563 8564 return values; 8565 }, 8566 8567 set: function( elem, value ) { 8568 var optionSet, option, 8569 options = elem.options, 8570 values = jQuery.makeArray( value ), 8571 i = options.length; 8572 8573 while ( i-- ) { 8574 option = options[ i ]; 8575 8576 /* eslint-disable no-cond-assign */ 8577 8578 if ( option.selected = 8579 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 8580 ) { 8581 optionSet = true; 8582 } 8583 8584 /* eslint-enable no-cond-assign */ 8585 } 8586 8587 // Force browsers to behave consistently when non-matching value is set 8588 if ( !optionSet ) { 8589 elem.selectedIndex = -1; 8590 } 8591 return values; 8592 } 8593 } 8594 } 8595} ); 8596 8597// Radios and checkboxes getter/setter 8598jQuery.each( [ "radio", "checkbox" ], function() { 8599 jQuery.valHooks[ this ] = { 8600 set: function( elem, value ) { 8601 if ( Array.isArray( value ) ) { 8602 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 8603 } 8604 } 8605 }; 8606 if ( !support.checkOn ) { 8607 jQuery.valHooks[ this ].get = function( elem ) { 8608 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 8609 }; 8610 } 8611} ); 8612 8613 8614 8615 8616// Return jQuery for attributes-only inclusion 8617 8618 8619support.focusin = "onfocusin" in window; 8620 8621 8622var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 8623 stopPropagationCallback = function( e ) { 8624 e.stopPropagation(); 8625 }; 8626 8627jQuery.extend( jQuery.event, { 8628 8629 trigger: function( event, data, elem, onlyHandlers ) { 8630 8631 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 8632 eventPath = [ elem || document ], 8633 type = hasOwn.call( event, "type" ) ? event.type : event, 8634 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 8635 8636 cur = lastElement = tmp = elem = elem || document; 8637 8638 // Don't do events on text and comment nodes 8639 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 8640 return; 8641 } 8642 8643 // focus/blur morphs to focusin/out; ensure we're not firing them right now 8644 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 8645 return; 8646 } 8647 8648 if ( type.indexOf( "." ) > -1 ) { 8649 8650 // Namespaced trigger; create a regexp to match event type in handle() 8651 namespaces = type.split( "." ); 8652 type = namespaces.shift(); 8653 namespaces.sort(); 8654 } 8655 ontype = type.indexOf( ":" ) < 0 && "on" + type; 8656 8657 // Caller can pass in a jQuery.Event object, Object, or just an event type string 8658 event = event[ jQuery.expando ] ? 8659 event : 8660 new jQuery.Event( type, typeof event === "object" && event ); 8661 8662 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 8663 event.isTrigger = onlyHandlers ? 2 : 3; 8664 event.namespace = namespaces.join( "." ); 8665 event.rnamespace = event.namespace ? 8666 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 8667 null; 8668 8669 // Clean up the event in case it is being reused 8670 event.result = undefined; 8671 if ( !event.target ) { 8672 event.target = elem; 8673 } 8674 8675 // Clone any incoming data and prepend the event, creating the handler arg list 8676 data = data == null ? 8677 [ event ] : 8678 jQuery.makeArray( data, [ event ] ); 8679 8680 // Allow special events to draw outside the lines 8681 special = jQuery.event.special[ type ] || {}; 8682 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 8683 return; 8684 } 8685 8686 // Determine event propagation path in advance, per W3C events spec (#9951) 8687 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 8688 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { 8689 8690 bubbleType = special.delegateType || type; 8691 if ( !rfocusMorph.test( bubbleType + type ) ) { 8692 cur = cur.parentNode; 8693 } 8694 for ( ; cur; cur = cur.parentNode ) { 8695 eventPath.push( cur ); 8696 tmp = cur; 8697 } 8698 8699 // Only add window if we got to document (e.g., not plain obj or detached DOM) 8700 if ( tmp === ( elem.ownerDocument || document ) ) { 8701 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 8702 } 8703 } 8704 8705 // Fire handlers on the event path 8706 i = 0; 8707 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 8708 lastElement = cur; 8709 event.type = i > 1 ? 8710 bubbleType : 8711 special.bindType || type; 8712 8713 // jQuery handler 8714 handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && 8715 dataPriv.get( cur, "handle" ); 8716 if ( handle ) { 8717 handle.apply( cur, data ); 8718 } 8719 8720 // Native handler 8721 handle = ontype && cur[ ontype ]; 8722 if ( handle && handle.apply && acceptData( cur ) ) { 8723 event.result = handle.apply( cur, data ); 8724 if ( event.result === false ) { 8725 event.preventDefault(); 8726 } 8727 } 8728 } 8729 event.type = type; 8730 8731 // If nobody prevented the default action, do it now 8732 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 8733 8734 if ( ( !special._default || 8735 special._default.apply( eventPath.pop(), data ) === false ) && 8736 acceptData( elem ) ) { 8737 8738 // Call a native DOM method on the target with the same name as the event. 8739 // Don't do default actions on window, that's where global variables be (#6170) 8740 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { 8741 8742 // Don't re-trigger an onFOO event when we call its FOO() method 8743 tmp = elem[ ontype ]; 8744 8745 if ( tmp ) { 8746 elem[ ontype ] = null; 8747 } 8748 8749 // Prevent re-triggering of the same event, since we already bubbled it above 8750 jQuery.event.triggered = type; 8751 8752 if ( event.isPropagationStopped() ) { 8753 lastElement.addEventListener( type, stopPropagationCallback ); 8754 } 8755 8756 elem[ type ](); 8757 8758 if ( event.isPropagationStopped() ) { 8759 lastElement.removeEventListener( type, stopPropagationCallback ); 8760 } 8761 8762 jQuery.event.triggered = undefined; 8763 8764 if ( tmp ) { 8765 elem[ ontype ] = tmp; 8766 } 8767 } 8768 } 8769 } 8770 8771 return event.result; 8772 }, 8773 8774 // Piggyback on a donor event to simulate a different one 8775 // Used only for `focus(in | out)` events 8776 simulate: function( type, elem, event ) { 8777 var e = jQuery.extend( 8778 new jQuery.Event(), 8779 event, 8780 { 8781 type: type, 8782 isSimulated: true 8783 } 8784 ); 8785 8786 jQuery.event.trigger( e, null, elem ); 8787 } 8788 8789} ); 8790 8791jQuery.fn.extend( { 8792 8793 trigger: function( type, data ) { 8794 return this.each( function() { 8795 jQuery.event.trigger( type, data, this ); 8796 } ); 8797 }, 8798 triggerHandler: function( type, data ) { 8799 var elem = this[ 0 ]; 8800 if ( elem ) { 8801 return jQuery.event.trigger( type, data, elem, true ); 8802 } 8803 } 8804} ); 8805 8806 8807// Support: Firefox <=44 8808// Firefox doesn't have focus(in | out) events 8809// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 8810// 8811// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 8812// focus(in | out) events fire after focus & blur events, 8813// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 8814// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 8815if ( !support.focusin ) { 8816 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { 8817 8818 // Attach a single capturing handler on the document while someone wants focusin/focusout 8819 var handler = function( event ) { 8820 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); 8821 }; 8822 8823 jQuery.event.special[ fix ] = { 8824 setup: function() { 8825 8826 // Handle: regular nodes (via `this.ownerDocument`), window 8827 // (via `this.document`) & document (via `this`). 8828 var doc = this.ownerDocument || this.document || this, 8829 attaches = dataPriv.access( doc, fix ); 8830 8831 if ( !attaches ) { 8832 doc.addEventListener( orig, handler, true ); 8833 } 8834 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); 8835 }, 8836 teardown: function() { 8837 var doc = this.ownerDocument || this.document || this, 8838 attaches = dataPriv.access( doc, fix ) - 1; 8839 8840 if ( !attaches ) { 8841 doc.removeEventListener( orig, handler, true ); 8842 dataPriv.remove( doc, fix ); 8843 8844 } else { 8845 dataPriv.access( doc, fix, attaches ); 8846 } 8847 } 8848 }; 8849 } ); 8850} 8851var location = window.location; 8852 8853var nonce = { guid: Date.now() }; 8854 8855var rquery = ( /\?/ ); 8856 8857 8858 8859// Cross-browser xml parsing 8860jQuery.parseXML = function( data ) { 8861 var xml, parserErrorElem; 8862 if ( !data || typeof data !== "string" ) { 8863 return null; 8864 } 8865 8866 // Support: IE 9 - 11 only 8867 // IE throws on parseFromString with invalid input. 8868 try { 8869 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 8870 } catch ( e ) {} 8871 8872 parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; 8873 if ( !xml || parserErrorElem ) { 8874 jQuery.error( "Invalid XML: " + ( 8875 parserErrorElem ? 8876 jQuery.map( parserErrorElem.childNodes, function( el ) { 8877 return el.textContent; 8878 } ).join( "\n" ) : 8879 data 8880 ) ); 8881 } 8882 return xml; 8883}; 8884 8885 8886var 8887 rbracket = /\[\]$/, 8888 rCRLF = /\r?\n/g, 8889 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 8890 rsubmittable = /^(?:input|select|textarea|keygen)/i; 8891 8892function buildParams( prefix, obj, traditional, add ) { 8893 var name; 8894 8895 if ( Array.isArray( obj ) ) { 8896 8897 // Serialize array item. 8898 jQuery.each( obj, function( i, v ) { 8899 if ( traditional || rbracket.test( prefix ) ) { 8900 8901 // Treat each array item as a scalar. 8902 add( prefix, v ); 8903 8904 } else { 8905 8906 // Item is non-scalar (array or object), encode its numeric index. 8907 buildParams( 8908 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 8909 v, 8910 traditional, 8911 add 8912 ); 8913 } 8914 } ); 8915 8916 } else if ( !traditional && toType( obj ) === "object" ) { 8917 8918 // Serialize object item. 8919 for ( name in obj ) { 8920 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 8921 } 8922 8923 } else { 8924 8925 // Serialize scalar item. 8926 add( prefix, obj ); 8927 } 8928} 8929 8930// Serialize an array of form elements or a set of 8931// key/values into a query string 8932jQuery.param = function( a, traditional ) { 8933 var prefix, 8934 s = [], 8935 add = function( key, valueOrFunction ) { 8936 8937 // If value is a function, invoke it and use its return value 8938 var value = isFunction( valueOrFunction ) ? 8939 valueOrFunction() : 8940 valueOrFunction; 8941 8942 s[ s.length ] = encodeURIComponent( key ) + "=" + 8943 encodeURIComponent( value == null ? "" : value ); 8944 }; 8945 8946 if ( a == null ) { 8947 return ""; 8948 } 8949 8950 // If an array was passed in, assume that it is an array of form elements. 8951 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 8952 8953 // Serialize the form elements 8954 jQuery.each( a, function() { 8955 add( this.name, this.value ); 8956 } ); 8957 8958 } else { 8959 8960 // If traditional, encode the "old" way (the way 1.3.2 or older 8961 // did it), otherwise encode params recursively. 8962 for ( prefix in a ) { 8963 buildParams( prefix, a[ prefix ], traditional, add ); 8964 } 8965 } 8966 8967 // Return the resulting serialization 8968 return s.join( "&" ); 8969}; 8970 8971jQuery.fn.extend( { 8972 serialize: function() { 8973 return jQuery.param( this.serializeArray() ); 8974 }, 8975 serializeArray: function() { 8976 return this.map( function() { 8977 8978 // Can add propHook for "elements" to filter or add form elements 8979 var elements = jQuery.prop( this, "elements" ); 8980 return elements ? jQuery.makeArray( elements ) : this; 8981 } ).filter( function() { 8982 var type = this.type; 8983 8984 // Use .is( ":disabled" ) so that fieldset[disabled] works 8985 return this.name && !jQuery( this ).is( ":disabled" ) && 8986 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 8987 ( this.checked || !rcheckableType.test( type ) ); 8988 } ).map( function( _i, elem ) { 8989 var val = jQuery( this ).val(); 8990 8991 if ( val == null ) { 8992 return null; 8993 } 8994 8995 if ( Array.isArray( val ) ) { 8996 return jQuery.map( val, function( val ) { 8997 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 8998 } ); 8999 } 9000 9001 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 9002 } ).get(); 9003 } 9004} ); 9005 9006 9007var 9008 r20 = /%20/g, 9009 rhash = /#.*$/, 9010 rantiCache = /([?&])_=[^&]*/, 9011 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 9012 9013 // #7653, #8125, #8152: local protocol detection 9014 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 9015 rnoContent = /^(?:GET|HEAD)$/, 9016 rprotocol = /^\/\//, 9017 9018 /* Prefilters 9019 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 9020 * 2) These are called: 9021 * - BEFORE asking for a transport 9022 * - AFTER param serialization (s.data is a string if s.processData is true) 9023 * 3) key is the dataType 9024 * 4) the catchall symbol "*" can be used 9025 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 9026 */ 9027 prefilters = {}, 9028 9029 /* Transports bindings 9030 * 1) key is the dataType 9031 * 2) the catchall symbol "*" can be used 9032 * 3) selection will start with transport dataType and THEN go to "*" if needed 9033 */ 9034 transports = {}, 9035 9036 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 9037 allTypes = "*/".concat( "*" ), 9038 9039 // Anchor tag for parsing the document origin 9040 originAnchor = document.createElement( "a" ); 9041 9042originAnchor.href = location.href; 9043 9044// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 9045function addToPrefiltersOrTransports( structure ) { 9046 9047 // dataTypeExpression is optional and defaults to "*" 9048 return function( dataTypeExpression, func ) { 9049 9050 if ( typeof dataTypeExpression !== "string" ) { 9051 func = dataTypeExpression; 9052 dataTypeExpression = "*"; 9053 } 9054 9055 var dataType, 9056 i = 0, 9057 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; 9058 9059 if ( isFunction( func ) ) { 9060 9061 // For each dataType in the dataTypeExpression 9062 while ( ( dataType = dataTypes[ i++ ] ) ) { 9063 9064 // Prepend if requested 9065 if ( dataType[ 0 ] === "+" ) { 9066 dataType = dataType.slice( 1 ) || "*"; 9067 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 9068 9069 // Otherwise append 9070 } else { 9071 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 9072 } 9073 } 9074 } 9075 }; 9076} 9077 9078// Base inspection function for prefilters and transports 9079function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 9080 9081 var inspected = {}, 9082 seekingTransport = ( structure === transports ); 9083 9084 function inspect( dataType ) { 9085 var selected; 9086 inspected[ dataType ] = true; 9087 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 9088 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 9089 if ( typeof dataTypeOrTransport === "string" && 9090 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 9091 9092 options.dataTypes.unshift( dataTypeOrTransport ); 9093 inspect( dataTypeOrTransport ); 9094 return false; 9095 } else if ( seekingTransport ) { 9096 return !( selected = dataTypeOrTransport ); 9097 } 9098 } ); 9099 return selected; 9100 } 9101 9102 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 9103} 9104 9105// A special extend for ajax options 9106// that takes "flat" options (not to be deep extended) 9107// Fixes #9887 9108function ajaxExtend( target, src ) { 9109 var key, deep, 9110 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 9111 9112 for ( key in src ) { 9113 if ( src[ key ] !== undefined ) { 9114 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 9115 } 9116 } 9117 if ( deep ) { 9118 jQuery.extend( true, target, deep ); 9119 } 9120 9121 return target; 9122} 9123 9124/* Handles responses to an ajax request: 9125 * - finds the right dataType (mediates between content-type and expected dataType) 9126 * - returns the corresponding response 9127 */ 9128function ajaxHandleResponses( s, jqXHR, responses ) { 9129 9130 var ct, type, finalDataType, firstDataType, 9131 contents = s.contents, 9132 dataTypes = s.dataTypes; 9133 9134 // Remove auto dataType and get content-type in the process 9135 while ( dataTypes[ 0 ] === "*" ) { 9136 dataTypes.shift(); 9137 if ( ct === undefined ) { 9138 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 9139 } 9140 } 9141 9142 // Check if we're dealing with a known content-type 9143 if ( ct ) { 9144 for ( type in contents ) { 9145 if ( contents[ type ] && contents[ type ].test( ct ) ) { 9146 dataTypes.unshift( type ); 9147 break; 9148 } 9149 } 9150 } 9151 9152 // Check to see if we have a response for the expected dataType 9153 if ( dataTypes[ 0 ] in responses ) { 9154 finalDataType = dataTypes[ 0 ]; 9155 } else { 9156 9157 // Try convertible dataTypes 9158 for ( type in responses ) { 9159 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 9160 finalDataType = type; 9161 break; 9162 } 9163 if ( !firstDataType ) { 9164 firstDataType = type; 9165 } 9166 } 9167 9168 // Or just use first one 9169 finalDataType = finalDataType || firstDataType; 9170 } 9171 9172 // If we found a dataType 9173 // We add the dataType to the list if needed 9174 // and return the corresponding response 9175 if ( finalDataType ) { 9176 if ( finalDataType !== dataTypes[ 0 ] ) { 9177 dataTypes.unshift( finalDataType ); 9178 } 9179 return responses[ finalDataType ]; 9180 } 9181} 9182 9183/* Chain conversions given the request and the original response 9184 * Also sets the responseXXX fields on the jqXHR instance 9185 */ 9186function ajaxConvert( s, response, jqXHR, isSuccess ) { 9187 var conv2, current, conv, tmp, prev, 9188 converters = {}, 9189 9190 // Work with a copy of dataTypes in case we need to modify it for conversion 9191 dataTypes = s.dataTypes.slice(); 9192 9193 // Create converters map with lowercased keys 9194 if ( dataTypes[ 1 ] ) { 9195 for ( conv in s.converters ) { 9196 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 9197 } 9198 } 9199 9200 current = dataTypes.shift(); 9201 9202 // Convert to each sequential dataType 9203 while ( current ) { 9204 9205 if ( s.responseFields[ current ] ) { 9206 jqXHR[ s.responseFields[ current ] ] = response; 9207 } 9208 9209 // Apply the dataFilter if provided 9210 if ( !prev && isSuccess && s.dataFilter ) { 9211 response = s.dataFilter( response, s.dataType ); 9212 } 9213 9214 prev = current; 9215 current = dataTypes.shift(); 9216 9217 if ( current ) { 9218 9219 // There's only work to do if current dataType is non-auto 9220 if ( current === "*" ) { 9221 9222 current = prev; 9223 9224 // Convert response if prev dataType is non-auto and differs from current 9225 } else if ( prev !== "*" && prev !== current ) { 9226 9227 // Seek a direct converter 9228 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 9229 9230 // If none found, seek a pair 9231 if ( !conv ) { 9232 for ( conv2 in converters ) { 9233 9234 // If conv2 outputs current 9235 tmp = conv2.split( " " ); 9236 if ( tmp[ 1 ] === current ) { 9237 9238 // If prev can be converted to accepted input 9239 conv = converters[ prev + " " + tmp[ 0 ] ] || 9240 converters[ "* " + tmp[ 0 ] ]; 9241 if ( conv ) { 9242 9243 // Condense equivalence converters 9244 if ( conv === true ) { 9245 conv = converters[ conv2 ]; 9246 9247 // Otherwise, insert the intermediate dataType 9248 } else if ( converters[ conv2 ] !== true ) { 9249 current = tmp[ 0 ]; 9250 dataTypes.unshift( tmp[ 1 ] ); 9251 } 9252 break; 9253 } 9254 } 9255 } 9256 } 9257 9258 // Apply converter (if not an equivalence) 9259 if ( conv !== true ) { 9260 9261 // Unless errors are allowed to bubble, catch and return them 9262 if ( conv && s.throws ) { 9263 response = conv( response ); 9264 } else { 9265 try { 9266 response = conv( response ); 9267 } catch ( e ) { 9268 return { 9269 state: "parsererror", 9270 error: conv ? e : "No conversion from " + prev + " to " + current 9271 }; 9272 } 9273 } 9274 } 9275 } 9276 } 9277 } 9278 9279 return { state: "success", data: response }; 9280} 9281 9282jQuery.extend( { 9283 9284 // Counter for holding the number of active queries 9285 active: 0, 9286 9287 // Last-Modified header cache for next request 9288 lastModified: {}, 9289 etag: {}, 9290 9291 ajaxSettings: { 9292 url: location.href, 9293 type: "GET", 9294 isLocal: rlocalProtocol.test( location.protocol ), 9295 global: true, 9296 processData: true, 9297 async: true, 9298 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 9299 9300 /* 9301 timeout: 0, 9302 data: null, 9303 dataType: null, 9304 username: null, 9305 password: null, 9306 cache: null, 9307 throws: false, 9308 traditional: false, 9309 headers: {}, 9310 */ 9311 9312 accepts: { 9313 "*": allTypes, 9314 text: "text/plain", 9315 html: "text/html", 9316 xml: "application/xml, text/xml", 9317 json: "application/json, text/javascript" 9318 }, 9319 9320 contents: { 9321 xml: /\bxml\b/, 9322 html: /\bhtml/, 9323 json: /\bjson\b/ 9324 }, 9325 9326 responseFields: { 9327 xml: "responseXML", 9328 text: "responseText", 9329 json: "responseJSON" 9330 }, 9331 9332 // Data converters 9333 // Keys separate source (or catchall "*") and destination types with a single space 9334 converters: { 9335 9336 // Convert anything to text 9337 "* text": String, 9338 9339 // Text to html (true = no transformation) 9340 "text html": true, 9341 9342 // Evaluate text as a json expression 9343 "text json": JSON.parse, 9344 9345 // Parse text as xml 9346 "text xml": jQuery.parseXML 9347 }, 9348 9349 // For options that shouldn't be deep extended: 9350 // you can add your own custom options here if 9351 // and when you create one that shouldn't be 9352 // deep extended (see ajaxExtend) 9353 flatOptions: { 9354 url: true, 9355 context: true 9356 } 9357 }, 9358 9359 // Creates a full fledged settings object into target 9360 // with both ajaxSettings and settings fields. 9361 // If target is omitted, writes into ajaxSettings. 9362 ajaxSetup: function( target, settings ) { 9363 return settings ? 9364 9365 // Building a settings object 9366 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 9367 9368 // Extending ajaxSettings 9369 ajaxExtend( jQuery.ajaxSettings, target ); 9370 }, 9371 9372 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 9373 ajaxTransport: addToPrefiltersOrTransports( transports ), 9374 9375 // Main method 9376 ajax: function( url, options ) { 9377 9378 // If url is an object, simulate pre-1.5 signature 9379 if ( typeof url === "object" ) { 9380 options = url; 9381 url = undefined; 9382 } 9383 9384 // Force options to be an object 9385 options = options || {}; 9386 9387 var transport, 9388 9389 // URL without anti-cache param 9390 cacheURL, 9391 9392 // Response headers 9393 responseHeadersString, 9394 responseHeaders, 9395 9396 // timeout handle 9397 timeoutTimer, 9398 9399 // Url cleanup var 9400 urlAnchor, 9401 9402 // Request state (becomes false upon send and true upon completion) 9403 completed, 9404 9405 // To know if global events are to be dispatched 9406 fireGlobals, 9407 9408 // Loop variable 9409 i, 9410 9411 // uncached part of the url 9412 uncached, 9413 9414 // Create the final options object 9415 s = jQuery.ajaxSetup( {}, options ), 9416 9417 // Callbacks context 9418 callbackContext = s.context || s, 9419 9420 // Context for global events is callbackContext if it is a DOM node or jQuery collection 9421 globalEventContext = s.context && 9422 ( callbackContext.nodeType || callbackContext.jquery ) ? 9423 jQuery( callbackContext ) : 9424 jQuery.event, 9425 9426 // Deferreds 9427 deferred = jQuery.Deferred(), 9428 completeDeferred = jQuery.Callbacks( "once memory" ), 9429 9430 // Status-dependent callbacks 9431 statusCode = s.statusCode || {}, 9432 9433 // Headers (they are sent all at once) 9434 requestHeaders = {}, 9435 requestHeadersNames = {}, 9436 9437 // Default abort message 9438 strAbort = "canceled", 9439 9440 // Fake xhr 9441 jqXHR = { 9442 readyState: 0, 9443 9444 // Builds headers hashtable if needed 9445 getResponseHeader: function( key ) { 9446 var match; 9447 if ( completed ) { 9448 if ( !responseHeaders ) { 9449 responseHeaders = {}; 9450 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 9451 responseHeaders[ match[ 1 ].toLowerCase() + " " ] = 9452 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) 9453 .concat( match[ 2 ] ); 9454 } 9455 } 9456 match = responseHeaders[ key.toLowerCase() + " " ]; 9457 } 9458 return match == null ? null : match.join( ", " ); 9459 }, 9460 9461 // Raw string 9462 getAllResponseHeaders: function() { 9463 return completed ? responseHeadersString : null; 9464 }, 9465 9466 // Caches the header 9467 setRequestHeader: function( name, value ) { 9468 if ( completed == null ) { 9469 name = requestHeadersNames[ name.toLowerCase() ] = 9470 requestHeadersNames[ name.toLowerCase() ] || name; 9471 requestHeaders[ name ] = value; 9472 } 9473 return this; 9474 }, 9475 9476 // Overrides response content-type header 9477 overrideMimeType: function( type ) { 9478 if ( completed == null ) { 9479 s.mimeType = type; 9480 } 9481 return this; 9482 }, 9483 9484 // Status-dependent callbacks 9485 statusCode: function( map ) { 9486 var code; 9487 if ( map ) { 9488 if ( completed ) { 9489 9490 // Execute the appropriate callbacks 9491 jqXHR.always( map[ jqXHR.status ] ); 9492 } else { 9493 9494 // Lazy-add the new callbacks in a way that preserves old ones 9495 for ( code in map ) { 9496 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 9497 } 9498 } 9499 } 9500 return this; 9501 }, 9502 9503 // Cancel the request 9504 abort: function( statusText ) { 9505 var finalText = statusText || strAbort; 9506 if ( transport ) { 9507 transport.abort( finalText ); 9508 } 9509 done( 0, finalText ); 9510 return this; 9511 } 9512 }; 9513 9514 // Attach deferreds 9515 deferred.promise( jqXHR ); 9516 9517 // Add protocol if not provided (prefilters might expect it) 9518 // Handle falsy url in the settings object (#10093: consistency with old signature) 9519 // We also use the url parameter if available 9520 s.url = ( ( url || s.url || location.href ) + "" ) 9521 .replace( rprotocol, location.protocol + "//" ); 9522 9523 // Alias method option to type as per ticket #12004 9524 s.type = options.method || options.type || s.method || s.type; 9525 9526 // Extract dataTypes list 9527 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; 9528 9529 // A cross-domain request is in order when the origin doesn't match the current origin. 9530 if ( s.crossDomain == null ) { 9531 urlAnchor = document.createElement( "a" ); 9532 9533 // Support: IE <=8 - 11, Edge 12 - 15 9534 // IE throws exception on accessing the href property if url is malformed, 9535 // e.g. http://example.com:80x/ 9536 try { 9537 urlAnchor.href = s.url; 9538 9539 // Support: IE <=8 - 11 only 9540 // Anchor's host property isn't correctly set when s.url is relative 9541 urlAnchor.href = urlAnchor.href; 9542 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 9543 urlAnchor.protocol + "//" + urlAnchor.host; 9544 } catch ( e ) { 9545 9546 // If there is an error parsing the URL, assume it is crossDomain, 9547 // it can be rejected by the transport if it is invalid 9548 s.crossDomain = true; 9549 } 9550 } 9551 9552 // Convert data if not already a string 9553 if ( s.data && s.processData && typeof s.data !== "string" ) { 9554 s.data = jQuery.param( s.data, s.traditional ); 9555 } 9556 9557 // Apply prefilters 9558 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 9559 9560 // If request was aborted inside a prefilter, stop there 9561 if ( completed ) { 9562 return jqXHR; 9563 } 9564 9565 // We can fire global events as of now if asked to 9566 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) 9567 fireGlobals = jQuery.event && s.global; 9568 9569 // Watch for a new set of requests 9570 if ( fireGlobals && jQuery.active++ === 0 ) { 9571 jQuery.event.trigger( "ajaxStart" ); 9572 } 9573 9574 // Uppercase the type 9575 s.type = s.type.toUpperCase(); 9576 9577 // Determine if request has content 9578 s.hasContent = !rnoContent.test( s.type ); 9579 9580 // Save the URL in case we're toying with the If-Modified-Since 9581 // and/or If-None-Match header later on 9582 // Remove hash to simplify url manipulation 9583 cacheURL = s.url.replace( rhash, "" ); 9584 9585 // More options handling for requests with no content 9586 if ( !s.hasContent ) { 9587 9588 // Remember the hash so we can put it back 9589 uncached = s.url.slice( cacheURL.length ); 9590 9591 // If data is available and should be processed, append data to url 9592 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { 9593 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; 9594 9595 // #9682: remove data so that it's not used in an eventual retry 9596 delete s.data; 9597 } 9598 9599 // Add or update anti-cache param if needed 9600 if ( s.cache === false ) { 9601 cacheURL = cacheURL.replace( rantiCache, "$1" ); 9602 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + 9603 uncached; 9604 } 9605 9606 // Put hash and anti-cache on the URL that will be requested (gh-1732) 9607 s.url = cacheURL + uncached; 9608 9609 // Change '%20' to '+' if this is encoded form body content (gh-2658) 9610 } else if ( s.data && s.processData && 9611 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { 9612 s.data = s.data.replace( r20, "+" ); 9613 } 9614 9615 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9616 if ( s.ifModified ) { 9617 if ( jQuery.lastModified[ cacheURL ] ) { 9618 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 9619 } 9620 if ( jQuery.etag[ cacheURL ] ) { 9621 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 9622 } 9623 } 9624 9625 // Set the correct header, if data is being sent 9626 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 9627 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 9628 } 9629 9630 // Set the Accepts header for the server, depending on the dataType 9631 jqXHR.setRequestHeader( 9632 "Accept", 9633 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 9634 s.accepts[ s.dataTypes[ 0 ] ] + 9635 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 9636 s.accepts[ "*" ] 9637 ); 9638 9639 // Check for headers option 9640 for ( i in s.headers ) { 9641 jqXHR.setRequestHeader( i, s.headers[ i ] ); 9642 } 9643 9644 // Allow custom headers/mimetypes and early abort 9645 if ( s.beforeSend && 9646 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { 9647 9648 // Abort if not done already and return 9649 return jqXHR.abort(); 9650 } 9651 9652 // Aborting is no longer a cancellation 9653 strAbort = "abort"; 9654 9655 // Install callbacks on deferreds 9656 completeDeferred.add( s.complete ); 9657 jqXHR.done( s.success ); 9658 jqXHR.fail( s.error ); 9659 9660 // Get transport 9661 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 9662 9663 // If no transport, we auto-abort 9664 if ( !transport ) { 9665 done( -1, "No Transport" ); 9666 } else { 9667 jqXHR.readyState = 1; 9668 9669 // Send global event 9670 if ( fireGlobals ) { 9671 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 9672 } 9673 9674 // If request was aborted inside ajaxSend, stop there 9675 if ( completed ) { 9676 return jqXHR; 9677 } 9678 9679 // Timeout 9680 if ( s.async && s.timeout > 0 ) { 9681 timeoutTimer = window.setTimeout( function() { 9682 jqXHR.abort( "timeout" ); 9683 }, s.timeout ); 9684 } 9685 9686 try { 9687 completed = false; 9688 transport.send( requestHeaders, done ); 9689 } catch ( e ) { 9690 9691 // Rethrow post-completion exceptions 9692 if ( completed ) { 9693 throw e; 9694 } 9695 9696 // Propagate others as results 9697 done( -1, e ); 9698 } 9699 } 9700 9701 // Callback for when everything is done 9702 function done( status, nativeStatusText, responses, headers ) { 9703 var isSuccess, success, error, response, modified, 9704 statusText = nativeStatusText; 9705 9706 // Ignore repeat invocations 9707 if ( completed ) { 9708 return; 9709 } 9710 9711 completed = true; 9712 9713 // Clear timeout if it exists 9714 if ( timeoutTimer ) { 9715 window.clearTimeout( timeoutTimer ); 9716 } 9717 9718 // Dereference transport for early garbage collection 9719 // (no matter how long the jqXHR object will be used) 9720 transport = undefined; 9721 9722 // Cache response headers 9723 responseHeadersString = headers || ""; 9724 9725 // Set readyState 9726 jqXHR.readyState = status > 0 ? 4 : 0; 9727 9728 // Determine if successful 9729 isSuccess = status >= 200 && status < 300 || status === 304; 9730 9731 // Get response data 9732 if ( responses ) { 9733 response = ajaxHandleResponses( s, jqXHR, responses ); 9734 } 9735 9736 // Use a noop converter for missing script but not if jsonp 9737 if ( !isSuccess && 9738 jQuery.inArray( "script", s.dataTypes ) > -1 && 9739 jQuery.inArray( "json", s.dataTypes ) < 0 ) { 9740 s.converters[ "text script" ] = function() {}; 9741 } 9742 9743 // Convert no matter what (that way responseXXX fields are always set) 9744 response = ajaxConvert( s, response, jqXHR, isSuccess ); 9745 9746 // If successful, handle type chaining 9747 if ( isSuccess ) { 9748 9749 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9750 if ( s.ifModified ) { 9751 modified = jqXHR.getResponseHeader( "Last-Modified" ); 9752 if ( modified ) { 9753 jQuery.lastModified[ cacheURL ] = modified; 9754 } 9755 modified = jqXHR.getResponseHeader( "etag" ); 9756 if ( modified ) { 9757 jQuery.etag[ cacheURL ] = modified; 9758 } 9759 } 9760 9761 // if no content 9762 if ( status === 204 || s.type === "HEAD" ) { 9763 statusText = "nocontent"; 9764 9765 // if not modified 9766 } else if ( status === 304 ) { 9767 statusText = "notmodified"; 9768 9769 // If we have data, let's convert it 9770 } else { 9771 statusText = response.state; 9772 success = response.data; 9773 error = response.error; 9774 isSuccess = !error; 9775 } 9776 } else { 9777 9778 // Extract error from statusText and normalize for non-aborts 9779 error = statusText; 9780 if ( status || !statusText ) { 9781 statusText = "error"; 9782 if ( status < 0 ) { 9783 status = 0; 9784 } 9785 } 9786 } 9787 9788 // Set data for the fake xhr object 9789 jqXHR.status = status; 9790 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 9791 9792 // Success/Error 9793 if ( isSuccess ) { 9794 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 9795 } else { 9796 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 9797 } 9798 9799 // Status-dependent callbacks 9800 jqXHR.statusCode( statusCode ); 9801 statusCode = undefined; 9802 9803 if ( fireGlobals ) { 9804 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 9805 [ jqXHR, s, isSuccess ? success : error ] ); 9806 } 9807 9808 // Complete 9809 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 9810 9811 if ( fireGlobals ) { 9812 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 9813 9814 // Handle the global AJAX counter 9815 if ( !( --jQuery.active ) ) { 9816 jQuery.event.trigger( "ajaxStop" ); 9817 } 9818 } 9819 } 9820 9821 return jqXHR; 9822 }, 9823 9824 getJSON: function( url, data, callback ) { 9825 return jQuery.get( url, data, callback, "json" ); 9826 }, 9827 9828 getScript: function( url, callback ) { 9829 return jQuery.get( url, undefined, callback, "script" ); 9830 } 9831} ); 9832 9833jQuery.each( [ "get", "post" ], function( _i, method ) { 9834 jQuery[ method ] = function( url, data, callback, type ) { 9835 9836 // Shift arguments if data argument was omitted 9837 if ( isFunction( data ) ) { 9838 type = type || callback; 9839 callback = data; 9840 data = undefined; 9841 } 9842 9843 // The url can be an options object (which then must have .url) 9844 return jQuery.ajax( jQuery.extend( { 9845 url: url, 9846 type: method, 9847 dataType: type, 9848 data: data, 9849 success: callback 9850 }, jQuery.isPlainObject( url ) && url ) ); 9851 }; 9852} ); 9853 9854jQuery.ajaxPrefilter( function( s ) { 9855 var i; 9856 for ( i in s.headers ) { 9857 if ( i.toLowerCase() === "content-type" ) { 9858 s.contentType = s.headers[ i ] || ""; 9859 } 9860 } 9861} ); 9862 9863 9864jQuery._evalUrl = function( url, options, doc ) { 9865 return jQuery.ajax( { 9866 url: url, 9867 9868 // Make this explicit, since user can override this through ajaxSetup (#11264) 9869 type: "GET", 9870 dataType: "script", 9871 cache: true, 9872 async: false, 9873 global: false, 9874 9875 // Only evaluate the response if it is successful (gh-4126) 9876 // dataFilter is not invoked for failure responses, so using it instead 9877 // of the default converter is kludgy but it works. 9878 converters: { 9879 "text script": function() {} 9880 }, 9881 dataFilter: function( response ) { 9882 jQuery.globalEval( response, options, doc ); 9883 } 9884 } ); 9885}; 9886 9887 9888jQuery.fn.extend( { 9889 wrapAll: function( html ) { 9890 var wrap; 9891 9892 if ( this[ 0 ] ) { 9893 if ( isFunction( html ) ) { 9894 html = html.call( this[ 0 ] ); 9895 } 9896 9897 // The elements to wrap the target around 9898 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 9899 9900 if ( this[ 0 ].parentNode ) { 9901 wrap.insertBefore( this[ 0 ] ); 9902 } 9903 9904 wrap.map( function() { 9905 var elem = this; 9906 9907 while ( elem.firstElementChild ) { 9908 elem = elem.firstElementChild; 9909 } 9910 9911 return elem; 9912 } ).append( this ); 9913 } 9914 9915 return this; 9916 }, 9917 9918 wrapInner: function( html ) { 9919 if ( isFunction( html ) ) { 9920 return this.each( function( i ) { 9921 jQuery( this ).wrapInner( html.call( this, i ) ); 9922 } ); 9923 } 9924 9925 return this.each( function() { 9926 var self = jQuery( this ), 9927 contents = self.contents(); 9928 9929 if ( contents.length ) { 9930 contents.wrapAll( html ); 9931 9932 } else { 9933 self.append( html ); 9934 } 9935 } ); 9936 }, 9937 9938 wrap: function( html ) { 9939 var htmlIsFunction = isFunction( html ); 9940 9941 return this.each( function( i ) { 9942 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); 9943 } ); 9944 }, 9945 9946 unwrap: function( selector ) { 9947 this.parent( selector ).not( "body" ).each( function() { 9948 jQuery( this ).replaceWith( this.childNodes ); 9949 } ); 9950 return this; 9951 } 9952} ); 9953 9954 9955jQuery.expr.pseudos.hidden = function( elem ) { 9956 return !jQuery.expr.pseudos.visible( elem ); 9957}; 9958jQuery.expr.pseudos.visible = function( elem ) { 9959 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); 9960}; 9961 9962 9963 9964 9965jQuery.ajaxSettings.xhr = function() { 9966 try { 9967 return new window.XMLHttpRequest(); 9968 } catch ( e ) {} 9969}; 9970 9971var xhrSuccessStatus = { 9972 9973 // File protocol always yields status code 0, assume 200 9974 0: 200, 9975 9976 // Support: IE <=9 only 9977 // #1450: sometimes IE returns 1223 when it should be 204 9978 1223: 204 9979 }, 9980 xhrSupported = jQuery.ajaxSettings.xhr(); 9981 9982support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 9983support.ajax = xhrSupported = !!xhrSupported; 9984 9985jQuery.ajaxTransport( function( options ) { 9986 var callback, errorCallback; 9987 9988 // Cross domain only allowed if supported through XMLHttpRequest 9989 if ( support.cors || xhrSupported && !options.crossDomain ) { 9990 return { 9991 send: function( headers, complete ) { 9992 var i, 9993 xhr = options.xhr(); 9994 9995 xhr.open( 9996 options.type, 9997 options.url, 9998 options.async, 9999 options.username, 10000 options.password 10001 ); 10002 10003 // Apply custom fields if provided 10004 if ( options.xhrFields ) { 10005 for ( i in options.xhrFields ) { 10006 xhr[ i ] = options.xhrFields[ i ]; 10007 } 10008 } 10009 10010 // Override mime type if needed 10011 if ( options.mimeType && xhr.overrideMimeType ) { 10012 xhr.overrideMimeType( options.mimeType ); 10013 } 10014 10015 // X-Requested-With header 10016 // For cross-domain requests, seeing as conditions for a preflight are 10017 // akin to a jigsaw puzzle, we simply never set it to be sure. 10018 // (it can always be set on a per-request basis or even using ajaxSetup) 10019 // For same-domain requests, won't change header if already provided. 10020 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 10021 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 10022 } 10023 10024 // Set headers 10025 for ( i in headers ) { 10026 xhr.setRequestHeader( i, headers[ i ] ); 10027 } 10028 10029 // Callback 10030 callback = function( type ) { 10031 return function() { 10032 if ( callback ) { 10033 callback = errorCallback = xhr.onload = 10034 xhr.onerror = xhr.onabort = xhr.ontimeout = 10035 xhr.onreadystatechange = null; 10036 10037 if ( type === "abort" ) { 10038 xhr.abort(); 10039 } else if ( type === "error" ) { 10040 10041 // Support: IE <=9 only 10042 // On a manual native abort, IE9 throws 10043 // errors on any property access that is not readyState 10044 if ( typeof xhr.status !== "number" ) { 10045 complete( 0, "error" ); 10046 } else { 10047 complete( 10048 10049 // File: protocol always yields status 0; see #8605, #14207 10050 xhr.status, 10051 xhr.statusText 10052 ); 10053 } 10054 } else { 10055 complete( 10056 xhrSuccessStatus[ xhr.status ] || xhr.status, 10057 xhr.statusText, 10058 10059 // Support: IE <=9 only 10060 // IE9 has no XHR2 but throws on binary (trac-11426) 10061 // For XHR2 non-text, let the caller handle it (gh-2498) 10062 ( xhr.responseType || "text" ) !== "text" || 10063 typeof xhr.responseText !== "string" ? 10064 { binary: xhr.response } : 10065 { text: xhr.responseText }, 10066 xhr.getAllResponseHeaders() 10067 ); 10068 } 10069 } 10070 }; 10071 }; 10072 10073 // Listen to events 10074 xhr.onload = callback(); 10075 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); 10076 10077 // Support: IE 9 only 10078 // Use onreadystatechange to replace onabort 10079 // to handle uncaught aborts 10080 if ( xhr.onabort !== undefined ) { 10081 xhr.onabort = errorCallback; 10082 } else { 10083 xhr.onreadystatechange = function() { 10084 10085 // Check readyState before timeout as it changes 10086 if ( xhr.readyState === 4 ) { 10087 10088 // Allow onerror to be called first, 10089 // but that will not handle a native abort 10090 // Also, save errorCallback to a variable 10091 // as xhr.onerror cannot be accessed 10092 window.setTimeout( function() { 10093 if ( callback ) { 10094 errorCallback(); 10095 } 10096 } ); 10097 } 10098 }; 10099 } 10100 10101 // Create the abort callback 10102 callback = callback( "abort" ); 10103 10104 try { 10105 10106 // Do send the request (this may raise an exception) 10107 xhr.send( options.hasContent && options.data || null ); 10108 } catch ( e ) { 10109 10110 // #14683: Only rethrow if this hasn't been notified as an error yet 10111 if ( callback ) { 10112 throw e; 10113 } 10114 } 10115 }, 10116 10117 abort: function() { 10118 if ( callback ) { 10119 callback(); 10120 } 10121 } 10122 }; 10123 } 10124} ); 10125 10126 10127 10128 10129// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 10130jQuery.ajaxPrefilter( function( s ) { 10131 if ( s.crossDomain ) { 10132 s.contents.script = false; 10133 } 10134} ); 10135 10136// Install script dataType 10137jQuery.ajaxSetup( { 10138 accepts: { 10139 script: "text/javascript, application/javascript, " + 10140 "application/ecmascript, application/x-ecmascript" 10141 }, 10142 contents: { 10143 script: /\b(?:java|ecma)script\b/ 10144 }, 10145 converters: { 10146 "text script": function( text ) { 10147 jQuery.globalEval( text ); 10148 return text; 10149 } 10150 } 10151} ); 10152 10153// Handle cache's special case and crossDomain 10154jQuery.ajaxPrefilter( "script", function( s ) { 10155 if ( s.cache === undefined ) { 10156 s.cache = false; 10157 } 10158 if ( s.crossDomain ) { 10159 s.type = "GET"; 10160 } 10161} ); 10162 10163// Bind script tag hack transport 10164jQuery.ajaxTransport( "script", function( s ) { 10165 10166 // This transport only deals with cross domain or forced-by-attrs requests 10167 if ( s.crossDomain || s.scriptAttrs ) { 10168 var script, callback; 10169 return { 10170 send: function( _, complete ) { 10171 script = jQuery( "<script>" ) 10172 .attr( s.scriptAttrs || {} ) 10173 .prop( { charset: s.scriptCharset, src: s.url } ) 10174 .on( "load error", callback = function( evt ) { 10175 script.remove(); 10176 callback = null; 10177 if ( evt ) { 10178 complete( evt.type === "error" ? 404 : 200, evt.type ); 10179 } 10180 } ); 10181 10182 // Use native DOM manipulation to avoid our domManip AJAX trickery 10183 document.head.appendChild( script[ 0 ] ); 10184 }, 10185 abort: function() { 10186 if ( callback ) { 10187 callback(); 10188 } 10189 } 10190 }; 10191 } 10192} ); 10193 10194 10195 10196 10197var oldCallbacks = [], 10198 rjsonp = /(=)\?(?=&|$)|\?\?/; 10199 10200// Default jsonp settings 10201jQuery.ajaxSetup( { 10202 jsonp: "callback", 10203 jsonpCallback: function() { 10204 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) ); 10205 this[ callback ] = true; 10206 return callback; 10207 } 10208} ); 10209 10210// Detect, normalize options and install callbacks for jsonp requests 10211jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 10212 10213 var callbackName, overwritten, responseContainer, 10214 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 10215 "url" : 10216 typeof s.data === "string" && 10217 ( s.contentType || "" ) 10218 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 10219 rjsonp.test( s.data ) && "data" 10220 ); 10221 10222 // Handle iff the expected data type is "jsonp" or we have a parameter to set 10223 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 10224 10225 // Get callback name, remembering preexisting value associated with it 10226 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? 10227 s.jsonpCallback() : 10228 s.jsonpCallback; 10229 10230 // Insert callback into url or form data 10231 if ( jsonProp ) { 10232 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 10233 } else if ( s.jsonp !== false ) { 10234 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 10235 } 10236 10237 // Use data converter to retrieve json after script execution 10238 s.converters[ "script json" ] = function() { 10239 if ( !responseContainer ) { 10240 jQuery.error( callbackName + " was not called" ); 10241 } 10242 return responseContainer[ 0 ]; 10243 }; 10244 10245 // Force json dataType 10246 s.dataTypes[ 0 ] = "json"; 10247 10248 // Install callback 10249 overwritten = window[ callbackName ]; 10250 window[ callbackName ] = function() { 10251 responseContainer = arguments; 10252 }; 10253 10254 // Clean-up function (fires after converters) 10255 jqXHR.always( function() { 10256 10257 // If previous value didn't exist - remove it 10258 if ( overwritten === undefined ) { 10259 jQuery( window ).removeProp( callbackName ); 10260 10261 // Otherwise restore preexisting value 10262 } else { 10263 window[ callbackName ] = overwritten; 10264 } 10265 10266 // Save back as free 10267 if ( s[ callbackName ] ) { 10268 10269 // Make sure that re-using the options doesn't screw things around 10270 s.jsonpCallback = originalSettings.jsonpCallback; 10271 10272 // Save the callback name for future use 10273 oldCallbacks.push( callbackName ); 10274 } 10275 10276 // Call if it was a function and we have a response 10277 if ( responseContainer && isFunction( overwritten ) ) { 10278 overwritten( responseContainer[ 0 ] ); 10279 } 10280 10281 responseContainer = overwritten = undefined; 10282 } ); 10283 10284 // Delegate to script 10285 return "script"; 10286 } 10287} ); 10288 10289 10290 10291 10292// Support: Safari 8 only 10293// In Safari 8 documents created via document.implementation.createHTMLDocument 10294// collapse sibling forms: the second one becomes a child of the first one. 10295// Because of that, this security measure has to be disabled in Safari 8. 10296// https://bugs.webkit.org/show_bug.cgi?id=137337 10297support.createHTMLDocument = ( function() { 10298 var body = document.implementation.createHTMLDocument( "" ).body; 10299 body.innerHTML = "<form></form><form></form>"; 10300 return body.childNodes.length === 2; 10301} )(); 10302 10303 10304// Argument "data" should be string of html 10305// context (optional): If specified, the fragment will be created in this context, 10306// defaults to document 10307// keepScripts (optional): If true, will include scripts passed in the html string 10308jQuery.parseHTML = function( data, context, keepScripts ) { 10309 if ( typeof data !== "string" ) { 10310 return []; 10311 } 10312 if ( typeof context === "boolean" ) { 10313 keepScripts = context; 10314 context = false; 10315 } 10316 10317 var base, parsed, scripts; 10318 10319 if ( !context ) { 10320 10321 // Stop scripts or inline event handlers from being executed immediately 10322 // by using document.implementation 10323 if ( support.createHTMLDocument ) { 10324 context = document.implementation.createHTMLDocument( "" ); 10325 10326 // Set the base href for the created document 10327 // so any parsed elements with URLs 10328 // are based on the document's URL (gh-2965) 10329 base = context.createElement( "base" ); 10330 base.href = document.location.href; 10331 context.head.appendChild( base ); 10332 } else { 10333 context = document; 10334 } 10335 } 10336 10337 parsed = rsingleTag.exec( data ); 10338 scripts = !keepScripts && []; 10339 10340 // Single tag 10341 if ( parsed ) { 10342 return [ context.createElement( parsed[ 1 ] ) ]; 10343 } 10344 10345 parsed = buildFragment( [ data ], context, scripts ); 10346 10347 if ( scripts && scripts.length ) { 10348 jQuery( scripts ).remove(); 10349 } 10350 10351 return jQuery.merge( [], parsed.childNodes ); 10352}; 10353 10354 10355/** 10356 * Load a url into a page 10357 */ 10358jQuery.fn.load = function( url, params, callback ) { 10359 var selector, type, response, 10360 self = this, 10361 off = url.indexOf( " " ); 10362 10363 if ( off > -1 ) { 10364 selector = stripAndCollapse( url.slice( off ) ); 10365 url = url.slice( 0, off ); 10366 } 10367 10368 // If it's a function 10369 if ( isFunction( params ) ) { 10370 10371 // We assume that it's the callback 10372 callback = params; 10373 params = undefined; 10374 10375 // Otherwise, build a param string 10376 } else if ( params && typeof params === "object" ) { 10377 type = "POST"; 10378 } 10379 10380 // If we have elements to modify, make the request 10381 if ( self.length > 0 ) { 10382 jQuery.ajax( { 10383 url: url, 10384 10385 // If "type" variable is undefined, then "GET" method will be used. 10386 // Make value of this field explicit since 10387 // user can override it through ajaxSetup method 10388 type: type || "GET", 10389 dataType: "html", 10390 data: params 10391 } ).done( function( responseText ) { 10392 10393 // Save response for use in complete callback 10394 response = arguments; 10395 10396 self.html( selector ? 10397 10398 // If a selector was specified, locate the right elements in a dummy div 10399 // Exclude scripts to avoid IE 'Permission Denied' errors 10400 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 10401 10402 // Otherwise use the full result 10403 responseText ); 10404 10405 // If the request succeeds, this function gets "data", "status", "jqXHR" 10406 // but they are ignored because response was set above. 10407 // If it fails, this function gets "jqXHR", "status", "error" 10408 } ).always( callback && function( jqXHR, status ) { 10409 self.each( function() { 10410 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 10411 } ); 10412 } ); 10413 } 10414 10415 return this; 10416}; 10417 10418 10419 10420 10421jQuery.expr.pseudos.animated = function( elem ) { 10422 return jQuery.grep( jQuery.timers, function( fn ) { 10423 return elem === fn.elem; 10424 } ).length; 10425}; 10426 10427 10428 10429 10430jQuery.offset = { 10431 setOffset: function( elem, options, i ) { 10432 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 10433 position = jQuery.css( elem, "position" ), 10434 curElem = jQuery( elem ), 10435 props = {}; 10436 10437 // Set position first, in-case top/left are set even on static elem 10438 if ( position === "static" ) { 10439 elem.style.position = "relative"; 10440 } 10441 10442 curOffset = curElem.offset(); 10443 curCSSTop = jQuery.css( elem, "top" ); 10444 curCSSLeft = jQuery.css( elem, "left" ); 10445 calculatePosition = ( position === "absolute" || position === "fixed" ) && 10446 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 10447 10448 // Need to be able to calculate position if either 10449 // top or left is auto and position is either absolute or fixed 10450 if ( calculatePosition ) { 10451 curPosition = curElem.position(); 10452 curTop = curPosition.top; 10453 curLeft = curPosition.left; 10454 10455 } else { 10456 curTop = parseFloat( curCSSTop ) || 0; 10457 curLeft = parseFloat( curCSSLeft ) || 0; 10458 } 10459 10460 if ( isFunction( options ) ) { 10461 10462 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 10463 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 10464 } 10465 10466 if ( options.top != null ) { 10467 props.top = ( options.top - curOffset.top ) + curTop; 10468 } 10469 if ( options.left != null ) { 10470 props.left = ( options.left - curOffset.left ) + curLeft; 10471 } 10472 10473 if ( "using" in options ) { 10474 options.using.call( elem, props ); 10475 10476 } else { 10477 curElem.css( props ); 10478 } 10479 } 10480}; 10481 10482jQuery.fn.extend( { 10483 10484 // offset() relates an element's border box to the document origin 10485 offset: function( options ) { 10486 10487 // Preserve chaining for setter 10488 if ( arguments.length ) { 10489 return options === undefined ? 10490 this : 10491 this.each( function( i ) { 10492 jQuery.offset.setOffset( this, options, i ); 10493 } ); 10494 } 10495 10496 var rect, win, 10497 elem = this[ 0 ]; 10498 10499 if ( !elem ) { 10500 return; 10501 } 10502 10503 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 10504 // Support: IE <=11 only 10505 // Running getBoundingClientRect on a 10506 // disconnected node in IE throws an error 10507 if ( !elem.getClientRects().length ) { 10508 return { top: 0, left: 0 }; 10509 } 10510 10511 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 10512 rect = elem.getBoundingClientRect(); 10513 win = elem.ownerDocument.defaultView; 10514 return { 10515 top: rect.top + win.pageYOffset, 10516 left: rect.left + win.pageXOffset 10517 }; 10518 }, 10519 10520 // position() relates an element's margin box to its offset parent's padding box 10521 // This corresponds to the behavior of CSS absolute positioning 10522 position: function() { 10523 if ( !this[ 0 ] ) { 10524 return; 10525 } 10526 10527 var offsetParent, offset, doc, 10528 elem = this[ 0 ], 10529 parentOffset = { top: 0, left: 0 }; 10530 10531 // position:fixed elements are offset from the viewport, which itself always has zero offset 10532 if ( jQuery.css( elem, "position" ) === "fixed" ) { 10533 10534 // Assume position:fixed implies availability of getBoundingClientRect 10535 offset = elem.getBoundingClientRect(); 10536 10537 } else { 10538 offset = this.offset(); 10539 10540 // Account for the *real* offset parent, which can be the document or its root element 10541 // when a statically positioned element is identified 10542 doc = elem.ownerDocument; 10543 offsetParent = elem.offsetParent || doc.documentElement; 10544 while ( offsetParent && 10545 ( offsetParent === doc.body || offsetParent === doc.documentElement ) && 10546 jQuery.css( offsetParent, "position" ) === "static" ) { 10547 10548 offsetParent = offsetParent.parentNode; 10549 } 10550 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { 10551 10552 // Incorporate borders into its offset, since they are outside its content origin 10553 parentOffset = jQuery( offsetParent ).offset(); 10554 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); 10555 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); 10556 } 10557 } 10558 10559 // Subtract parent offsets and element margins 10560 return { 10561 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 10562 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 10563 }; 10564 }, 10565 10566 // This method will return documentElement in the following cases: 10567 // 1) For the element inside the iframe without offsetParent, this method will return 10568 // documentElement of the parent window 10569 // 2) For the hidden or detached element 10570 // 3) For body or html element, i.e. in case of the html node - it will return itself 10571 // 10572 // but those exceptions were never presented as a real life use-cases 10573 // and might be considered as more preferable results. 10574 // 10575 // This logic, however, is not guaranteed and can change at any point in the future 10576 offsetParent: function() { 10577 return this.map( function() { 10578 var offsetParent = this.offsetParent; 10579 10580 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 10581 offsetParent = offsetParent.offsetParent; 10582 } 10583 10584 return offsetParent || documentElement; 10585 } ); 10586 } 10587} ); 10588 10589// Create scrollLeft and scrollTop methods 10590jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 10591 var top = "pageYOffset" === prop; 10592 10593 jQuery.fn[ method ] = function( val ) { 10594 return access( this, function( elem, method, val ) { 10595 10596 // Coalesce documents and windows 10597 var win; 10598 if ( isWindow( elem ) ) { 10599 win = elem; 10600 } else if ( elem.nodeType === 9 ) { 10601 win = elem.defaultView; 10602 } 10603 10604 if ( val === undefined ) { 10605 return win ? win[ prop ] : elem[ method ]; 10606 } 10607 10608 if ( win ) { 10609 win.scrollTo( 10610 !top ? val : win.pageXOffset, 10611 top ? val : win.pageYOffset 10612 ); 10613 10614 } else { 10615 elem[ method ] = val; 10616 } 10617 }, method, val, arguments.length ); 10618 }; 10619} ); 10620 10621// Support: Safari <=7 - 9.1, Chrome <=37 - 49 10622// Add the top/left cssHooks using jQuery.fn.position 10623// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 10624// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 10625// getComputedStyle returns percent when specified for top/left/bottom/right; 10626// rather than make the css module depend on the offset module, just check for it here 10627jQuery.each( [ "top", "left" ], function( _i, prop ) { 10628 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 10629 function( elem, computed ) { 10630 if ( computed ) { 10631 computed = curCSS( elem, prop ); 10632 10633 // If curCSS returns percentage, fallback to offset 10634 return rnumnonpx.test( computed ) ? 10635 jQuery( elem ).position()[ prop ] + "px" : 10636 computed; 10637 } 10638 } 10639 ); 10640} ); 10641 10642 10643// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 10644jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 10645 jQuery.each( { 10646 padding: "inner" + name, 10647 content: type, 10648 "": "outer" + name 10649 }, function( defaultExtra, funcName ) { 10650 10651 // Margin is only for outerHeight, outerWidth 10652 jQuery.fn[ funcName ] = function( margin, value ) { 10653 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 10654 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 10655 10656 return access( this, function( elem, type, value ) { 10657 var doc; 10658 10659 if ( isWindow( elem ) ) { 10660 10661 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 10662 return funcName.indexOf( "outer" ) === 0 ? 10663 elem[ "inner" + name ] : 10664 elem.document.documentElement[ "client" + name ]; 10665 } 10666 10667 // Get document width or height 10668 if ( elem.nodeType === 9 ) { 10669 doc = elem.documentElement; 10670 10671 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 10672 // whichever is greatest 10673 return Math.max( 10674 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 10675 elem.body[ "offset" + name ], doc[ "offset" + name ], 10676 doc[ "client" + name ] 10677 ); 10678 } 10679 10680 return value === undefined ? 10681 10682 // Get width or height on the element, requesting but not forcing parseFloat 10683 jQuery.css( elem, type, extra ) : 10684 10685 // Set width or height on the element 10686 jQuery.style( elem, type, value, extra ); 10687 }, type, chainable ? margin : undefined, chainable ); 10688 }; 10689 } ); 10690} ); 10691 10692 10693jQuery.each( [ 10694 "ajaxStart", 10695 "ajaxStop", 10696 "ajaxComplete", 10697 "ajaxError", 10698 "ajaxSuccess", 10699 "ajaxSend" 10700], function( _i, type ) { 10701 jQuery.fn[ type ] = function( fn ) { 10702 return this.on( type, fn ); 10703 }; 10704} ); 10705 10706 10707 10708 10709jQuery.fn.extend( { 10710 10711 bind: function( types, data, fn ) { 10712 return this.on( types, null, data, fn ); 10713 }, 10714 unbind: function( types, fn ) { 10715 return this.off( types, null, fn ); 10716 }, 10717 10718 delegate: function( selector, types, data, fn ) { 10719 return this.on( types, selector, data, fn ); 10720 }, 10721 undelegate: function( selector, types, fn ) { 10722 10723 // ( namespace ) or ( selector, types [, fn] ) 10724 return arguments.length === 1 ? 10725 this.off( selector, "**" ) : 10726 this.off( types, selector || "**", fn ); 10727 }, 10728 10729 hover: function( fnOver, fnOut ) { 10730 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 10731 } 10732} ); 10733 10734jQuery.each( 10735 ( "blur focus focusin focusout resize scroll click dblclick " + 10736 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 10737 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 10738 function( _i, name ) { 10739 10740 // Handle event binding 10741 jQuery.fn[ name ] = function( data, fn ) { 10742 return arguments.length > 0 ? 10743 this.on( name, null, data, fn ) : 10744 this.trigger( name ); 10745 }; 10746 } 10747); 10748 10749 10750 10751 10752// Support: Android <=4.0 only 10753// Make sure we trim BOM and NBSP 10754var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; 10755 10756// Bind a function to a context, optionally partially applying any 10757// arguments. 10758// jQuery.proxy is deprecated to promote standards (specifically Function#bind) 10759// However, it is not slated for removal any time soon 10760jQuery.proxy = function( fn, context ) { 10761 var tmp, args, proxy; 10762 10763 if ( typeof context === "string" ) { 10764 tmp = fn[ context ]; 10765 context = fn; 10766 fn = tmp; 10767 } 10768 10769 // Quick check to determine if target is callable, in the spec 10770 // this throws a TypeError, but we will just return undefined. 10771 if ( !isFunction( fn ) ) { 10772 return undefined; 10773 } 10774 10775 // Simulated bind 10776 args = slice.call( arguments, 2 ); 10777 proxy = function() { 10778 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 10779 }; 10780 10781 // Set the guid of unique handler to the same of original handler, so it can be removed 10782 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 10783 10784 return proxy; 10785}; 10786 10787jQuery.holdReady = function( hold ) { 10788 if ( hold ) { 10789 jQuery.readyWait++; 10790 } else { 10791 jQuery.ready( true ); 10792 } 10793}; 10794jQuery.isArray = Array.isArray; 10795jQuery.parseJSON = JSON.parse; 10796jQuery.nodeName = nodeName; 10797jQuery.isFunction = isFunction; 10798jQuery.isWindow = isWindow; 10799jQuery.camelCase = camelCase; 10800jQuery.type = toType; 10801 10802jQuery.now = Date.now; 10803 10804jQuery.isNumeric = function( obj ) { 10805 10806 // As of jQuery 3.0, isNumeric is limited to 10807 // strings and numbers (primitives or objects) 10808 // that can be coerced to finite numbers (gh-2662) 10809 var type = jQuery.type( obj ); 10810 return ( type === "number" || type === "string" ) && 10811 10812 // parseFloat NaNs numeric-cast false positives ("") 10813 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 10814 // subtraction forces infinities to NaN 10815 !isNaN( obj - parseFloat( obj ) ); 10816}; 10817 10818jQuery.trim = function( text ) { 10819 return text == null ? 10820 "" : 10821 ( text + "" ).replace( rtrim, "" ); 10822}; 10823 10824 10825 10826// Register as a named AMD module, since jQuery can be concatenated with other 10827// files that may use define, but not via a proper concatenation script that 10828// understands anonymous AMD modules. A named AMD is safest and most robust 10829// way to register. Lowercase jquery is used because AMD module names are 10830// derived from file names, and jQuery is normally delivered in a lowercase 10831// file name. Do this after creating the global so that if an AMD module wants 10832// to call noConflict to hide this version of jQuery, it will work. 10833 10834// Note that for maximum portability, libraries that are not jQuery should 10835// declare themselves as anonymous modules, and avoid setting a global if an 10836// AMD loader is present. jQuery is a special case. For more information, see 10837// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 10838 10839if ( typeof define === "function" && define.amd ) { 10840 define( "jquery", [], function() { 10841 return jQuery; 10842 } ); 10843} 10844 10845 10846 10847 10848var 10849 10850 // Map over jQuery in case of overwrite 10851 _jQuery = window.jQuery, 10852 10853 // Map over the $ in case of overwrite 10854 _$ = window.$; 10855 10856jQuery.noConflict = function( deep ) { 10857 if ( window.$ === jQuery ) { 10858 window.$ = _$; 10859 } 10860 10861 if ( deep && window.jQuery === jQuery ) { 10862 window.jQuery = _jQuery; 10863 } 10864 10865 return jQuery; 10866}; 10867 10868// Expose jQuery and $ identifiers, even in AMD 10869// (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 10870// and CommonJS for browser emulators (#13566) 10871if ( typeof noGlobal === "undefined" ) { 10872 window.jQuery = window.$ = jQuery; 10873} 10874 10875 10876 10877 10878return jQuery; 10879} ); 10880