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