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