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