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