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