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