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