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