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