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