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