/tags/1.1/src/main/webapp/js/jquery-1.4.1.js
JavaScript | 2489 lines | 1946 code | 299 blank | 244 comment | 303 complexity | 2eb478f7885959c6c627422f425c0cf8 MD5 | raw file
Large files files are truncated, but you can click here to view the full file
1/*! 2 * jQuery JavaScript Library v1.4.1 3 * http://jquery.com/ 4 * 5 * Copyright 2010, John Resig 6 * Dual licensed under the MIT or GPL Version 2 licenses. 7 * http://jquery.org/license 8 * 9 * Includes Sizzle.js 10 * http://sizzlejs.com/ 11 * Copyright 2010, The Dojo Foundation 12 * Released under the MIT, BSD, and GPL Licenses. 13 * 14 * Date: Mon Jan 25 19:43:33 2010 -0500 15 */ 16(function( window, undefined ) { 17 18// Define a local copy of jQuery 19var jQuery = function( selector, context ) { 20 // The jQuery object is actually just the init constructor 'enhanced' 21 return new jQuery.fn.init( selector, context ); 22 }, 23 24 // Map over jQuery in case of overwrite 25 _jQuery = window.jQuery, 26 27 // Map over the $ in case of overwrite 28 _$ = window.$, 29 30 // Use the correct document accordingly with window argument (sandbox) 31 document = window.document, 32 33 // A central reference to the root jQuery(document) 34 rootjQuery, 35 36 // A simple way to check for HTML strings or ID strings 37 // (both of which we optimize for) 38 quickExpr = /^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/, 39 40 // Is it a simple selector 41 isSimple = /^.[^:#\[\.,]*$/, 42 43 // Check if a string has a non-whitespace character in it 44 rnotwhite = /\S/, 45 46 // Used for trimming whitespace 47 rtrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g, 48 49 // Match a standalone tag 50 rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, 51 52 // Keep a UserAgent string for use with jQuery.browser 53 userAgent = navigator.userAgent, 54 55 // For matching the engine and version of the browser 56 browserMatch, 57 58 // Has the ready events already been bound? 59 readyBound = false, 60 61 // The functions to execute on DOM ready 62 readyList = [], 63 64 // The ready event handler 65 DOMContentLoaded, 66 67 // Save a reference to some core methods 68 toString = Object.prototype.toString, 69 hasOwnProperty = Object.prototype.hasOwnProperty, 70 push = Array.prototype.push, 71 slice = Array.prototype.slice, 72 indexOf = Array.prototype.indexOf; 73 74jQuery.fn = jQuery.prototype = { 75 init: function( selector, context ) { 76 var match, elem, ret, doc; 77 78 // Handle $(""), $(null), or $(undefined) 79 if ( !selector ) { 80 return this; 81 } 82 83 // Handle $(DOMElement) 84 if ( selector.nodeType ) { 85 this.context = this[0] = selector; 86 this.length = 1; 87 return this; 88 } 89 90 // Handle HTML strings 91 if ( typeof selector === "string" ) { 92 // Are we dealing with HTML string or an ID? 93 match = quickExpr.exec( selector ); 94 95 // Verify a match, and that no context was specified for #id 96 if ( match && (match[1] || !context) ) { 97 98 // HANDLE: $(html) -> $(array) 99 if ( match[1] ) { 100 doc = (context ? context.ownerDocument || context : document); 101 102 // If a single string is passed in and it's a single tag 103 // just do a createElement and skip the rest 104 ret = rsingleTag.exec( selector ); 105 106 if ( ret ) { 107 if ( jQuery.isPlainObject( context ) ) { 108 selector = [ document.createElement( ret[1] ) ]; 109 jQuery.fn.attr.call( selector, context, true ); 110 111 } else { 112 selector = [ doc.createElement( ret[1] ) ]; 113 } 114 115 } else { 116 ret = buildFragment( [ match[1] ], [ doc ] ); 117 selector = (ret.cacheable ? ret.fragment.cloneNode(true) : ret.fragment).childNodes; 118 } 119 120 // HANDLE: $("#id") 121 } else { 122 elem = document.getElementById( match[2] ); 123 124 if ( elem ) { 125 // Handle the case where IE and Opera return items 126 // by name instead of ID 127 if ( elem.id !== match[2] ) { 128 return rootjQuery.find( selector ); 129 } 130 131 // Otherwise, we inject the element directly into the jQuery object 132 this.length = 1; 133 this[0] = elem; 134 } 135 136 this.context = document; 137 this.selector = selector; 138 return this; 139 } 140 141 // HANDLE: $("TAG") 142 } else if ( !context && /^\w+$/.test( selector ) ) { 143 this.selector = selector; 144 this.context = document; 145 selector = document.getElementsByTagName( selector ); 146 147 // HANDLE: $(expr, $(...)) 148 } else if ( !context || context.jquery ) { 149 return (context || rootjQuery).find( selector ); 150 151 // HANDLE: $(expr, context) 152 // (which is just equivalent to: $(context).find(expr) 153 } else { 154 return jQuery( context ).find( selector ); 155 } 156 157 // HANDLE: $(function) 158 // Shortcut for document ready 159 } else if ( jQuery.isFunction( selector ) ) { 160 return rootjQuery.ready( selector ); 161 } 162 163 if (selector.selector !== undefined) { 164 this.selector = selector.selector; 165 this.context = selector.context; 166 } 167 168 return jQuery.isArray( selector ) ? 169 this.setArray( selector ) : 170 jQuery.makeArray( selector, this ); 171 }, 172 173 // Start with an empty selector 174 selector: "", 175 176 // The current version of jQuery being used 177 jquery: "1.4.1", 178 179 // The default length of a jQuery object is 0 180 length: 0, 181 182 // The number of elements contained in the matched element set 183 size: function() { 184 return this.length; 185 }, 186 187 toArray: function() { 188 return slice.call( this, 0 ); 189 }, 190 191 // Get the Nth element in the matched element set OR 192 // Get the whole matched element set as a clean array 193 get: function( num ) { 194 return num == null ? 195 196 // Return a 'clean' array 197 this.toArray() : 198 199 // Return just the object 200 ( num < 0 ? this.slice(num)[ 0 ] : this[ num ] ); 201 }, 202 203 // Take an array of elements and push it onto the stack 204 // (returning the new matched element set) 205 pushStack: function( elems, name, selector ) { 206 // Build a new jQuery matched element set 207 var ret = jQuery( elems || null ); 208 209 // Add the old object onto the stack (as a reference) 210 ret.prevObject = this; 211 212 ret.context = this.context; 213 214 if ( name === "find" ) { 215 ret.selector = this.selector + (this.selector ? " " : "") + selector; 216 } else if ( name ) { 217 ret.selector = this.selector + "." + name + "(" + selector + ")"; 218 } 219 220 // Return the newly-formed element set 221 return ret; 222 }, 223 224 // Force the current matched set of elements to become 225 // the specified array of elements (destroying the stack in the process) 226 // You should use pushStack() in order to do this, but maintain the stack 227 setArray: function( elems ) { 228 // Resetting the length to 0, then using the native Array push 229 // is a super-fast way to populate an object with array-like properties 230 this.length = 0; 231 push.apply( this, elems ); 232 233 return this; 234 }, 235 236 // Execute a callback for every element in the matched set. 237 // (You can seed the arguments with an array of args, but this is 238 // only used internally.) 239 each: function( callback, args ) { 240 return jQuery.each( this, callback, args ); 241 }, 242 243 ready: function( fn ) { 244 // Attach the listeners 245 jQuery.bindReady(); 246 247 // If the DOM is already ready 248 if ( jQuery.isReady ) { 249 // Execute the function immediately 250 fn.call( document, jQuery ); 251 252 // Otherwise, remember the function for later 253 } else if ( readyList ) { 254 // Add the function to the wait list 255 readyList.push( fn ); 256 } 257 258 return this; 259 }, 260 261 eq: function( i ) { 262 return i === -1 ? 263 this.slice( i ) : 264 this.slice( i, +i + 1 ); 265 }, 266 267 first: function() { 268 return this.eq( 0 ); 269 }, 270 271 last: function() { 272 return this.eq( -1 ); 273 }, 274 275 slice: function() { 276 return this.pushStack( slice.apply( this, arguments ), 277 "slice", slice.call(arguments).join(",") ); 278 }, 279 280 map: function( callback ) { 281 return this.pushStack( jQuery.map(this, function( elem, i ) { 282 return callback.call( elem, i, elem ); 283 })); 284 }, 285 286 end: function() { 287 return this.prevObject || jQuery(null); 288 }, 289 290 // For internal use only. 291 // Behaves like an Array's method, not like a jQuery method. 292 push: push, 293 sort: [].sort, 294 splice: [].splice 295}; 296 297// Give the init function the jQuery prototype for later instantiation 298jQuery.fn.init.prototype = jQuery.fn; 299 300jQuery.extend = jQuery.fn.extend = function() { 301 // copy reference to target object 302 var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options, name, src, copy; 303 304 // Handle a deep copy situation 305 if ( typeof target === "boolean" ) { 306 deep = target; 307 target = arguments[1] || {}; 308 // skip the boolean and the target 309 i = 2; 310 } 311 312 // Handle case when target is a string or something (possible in deep copy) 313 if ( typeof target !== "object" && !jQuery.isFunction(target) ) { 314 target = {}; 315 } 316 317 // extend jQuery itself if only one argument is passed 318 if ( length === i ) { 319 target = this; 320 --i; 321 } 322 323 for ( ; i < length; i++ ) { 324 // Only deal with non-null/undefined values 325 if ( (options = arguments[ i ]) != null ) { 326 // Extend the base object 327 for ( name in options ) { 328 src = target[ name ]; 329 copy = options[ name ]; 330 331 // Prevent never-ending loop 332 if ( target === copy ) { 333 continue; 334 } 335 336 // Recurse if we're merging object literal values or arrays 337 if ( deep && copy && ( jQuery.isPlainObject(copy) || jQuery.isArray(copy) ) ) { 338 var clone = src && ( jQuery.isPlainObject(src) || jQuery.isArray(src) ) ? src 339 : jQuery.isArray(copy) ? [] : {}; 340 341 // Never move original objects, clone them 342 target[ name ] = jQuery.extend( deep, clone, copy ); 343 344 // Don't bring in undefined values 345 } else if ( copy !== undefined ) { 346 target[ name ] = copy; 347 } 348 } 349 } 350 } 351 352 // Return the modified object 353 return target; 354}; 355 356jQuery.extend({ 357 noConflict: function( deep ) { 358 window.$ = _$; 359 360 if ( deep ) { 361 window.jQuery = _jQuery; 362 } 363 364 return jQuery; 365 }, 366 367 // Is the DOM ready to be used? Set to true once it occurs. 368 isReady: false, 369 370 // Handle when the DOM is ready 371 ready: function() { 372 // Make sure that the DOM is not already loaded 373 if ( !jQuery.isReady ) { 374 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). 375 if ( !document.body ) { 376 return setTimeout( jQuery.ready, 13 ); 377 } 378 379 // Remember that the DOM is ready 380 jQuery.isReady = true; 381 382 // If there are functions bound, to execute 383 if ( readyList ) { 384 // Execute all of them 385 var fn, i = 0; 386 while ( (fn = readyList[ i++ ]) ) { 387 fn.call( document, jQuery ); 388 } 389 390 // Reset the list of functions 391 readyList = null; 392 } 393 394 // Trigger any bound ready events 395 if ( jQuery.fn.triggerHandler ) { 396 jQuery( document ).triggerHandler( "ready" ); 397 } 398 } 399 }, 400 401 bindReady: function() { 402 if ( readyBound ) { 403 return; 404 } 405 406 readyBound = true; 407 408 // Catch cases where $(document).ready() is called after the 409 // browser event has already occurred. 410 if ( document.readyState === "complete" ) { 411 return jQuery.ready(); 412 } 413 414 // Mozilla, Opera and webkit nightlies currently support this event 415 if ( document.addEventListener ) { 416 // Use the handy event callback 417 document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); 418 419 // A fallback to window.onload, that will always work 420 window.addEventListener( "load", jQuery.ready, false ); 421 422 // If IE event model is used 423 } else if ( document.attachEvent ) { 424 // ensure firing before onload, 425 // maybe late but safe also for iframes 426 document.attachEvent("onreadystatechange", DOMContentLoaded); 427 428 // A fallback to window.onload, that will always work 429 window.attachEvent( "onload", jQuery.ready ); 430 431 // If IE and not a frame 432 // continually check to see if the document is ready 433 var toplevel = false; 434 435 try { 436 toplevel = window.frameElement == null; 437 } catch(e) {} 438 439 if ( document.documentElement.doScroll && toplevel ) { 440 doScrollCheck(); 441 } 442 } 443 }, 444 445 // See test/unit/core.js for details concerning isFunction. 446 // Since version 1.3, DOM methods and functions like alert 447 // aren't supported. They return false on IE (#2968). 448 isFunction: function( obj ) { 449 return toString.call(obj) === "[object Function]"; 450 }, 451 452 isArray: function( obj ) { 453 return toString.call(obj) === "[object Array]"; 454 }, 455 456 isPlainObject: function( obj ) { 457 // Must be an Object. 458 // Because of IE, we also have to check the presence of the constructor property. 459 // Make sure that DOM nodes and window objects don't pass through, as well 460 if ( !obj || toString.call(obj) !== "[object Object]" || obj.nodeType || obj.setInterval ) { 461 return false; 462 } 463 464 // Not own constructor property must be Object 465 if ( obj.constructor 466 && !hasOwnProperty.call(obj, "constructor") 467 && !hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf") ) { 468 return false; 469 } 470 471 // Own properties are enumerated firstly, so to speed up, 472 // if last one is own, then all properties are own. 473 474 var key; 475 for ( key in obj ) {} 476 477 return key === undefined || hasOwnProperty.call( obj, key ); 478 }, 479 480 isEmptyObject: function( obj ) { 481 for ( var name in obj ) { 482 return false; 483 } 484 return true; 485 }, 486 487 error: function( msg ) { 488 throw msg; 489 }, 490 491 parseJSON: function( data ) { 492 if ( typeof data !== "string" || !data ) { 493 return null; 494 } 495 496 // Make sure the incoming data is actual JSON 497 // Logic borrowed from http://json.org/json2.js 498 if ( /^[\],:{}\s]*$/.test(data.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@") 499 .replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]") 500 .replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ) { 501 502 // Try to use the native JSON parser first 503 return window.JSON && window.JSON.parse ? 504 window.JSON.parse( data ) : 505 (new Function("return " + data))(); 506 507 } else { 508 jQuery.error( "Invalid JSON: " + data ); 509 } 510 }, 511 512 noop: function() {}, 513 514 // Evalulates a script in a global context 515 globalEval: function( data ) { 516 if ( data && rnotwhite.test(data) ) { 517 // Inspired by code by Andrea Giammarchi 518 // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html 519 var head = document.getElementsByTagName("head")[0] || document.documentElement, 520 script = document.createElement("script"); 521 522 script.type = "text/javascript"; 523 524 if ( jQuery.support.scriptEval ) { 525 script.appendChild( document.createTextNode( data ) ); 526 } else { 527 script.text = data; 528 } 529 530 // Use insertBefore instead of appendChild to circumvent an IE6 bug. 531 // This arises when a base node is used (#2709). 532 head.insertBefore( script, head.firstChild ); 533 head.removeChild( script ); 534 } 535 }, 536 537 nodeName: function( elem, name ) { 538 return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); 539 }, 540 541 // args is for internal usage only 542 each: function( object, callback, args ) { 543 var name, i = 0, 544 length = object.length, 545 isObj = length === undefined || jQuery.isFunction(object); 546 547 if ( args ) { 548 if ( isObj ) { 549 for ( name in object ) { 550 if ( callback.apply( object[ name ], args ) === false ) { 551 break; 552 } 553 } 554 } else { 555 for ( ; i < length; ) { 556 if ( callback.apply( object[ i++ ], args ) === false ) { 557 break; 558 } 559 } 560 } 561 562 // A special, fast, case for the most common use of each 563 } else { 564 if ( isObj ) { 565 for ( name in object ) { 566 if ( callback.call( object[ name ], name, object[ name ] ) === false ) { 567 break; 568 } 569 } 570 } else { 571 for ( var value = object[0]; 572 i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {} 573 } 574 } 575 576 return object; 577 }, 578 579 trim: function( text ) { 580 return (text || "").replace( rtrim, "" ); 581 }, 582 583 // results is for internal usage only 584 makeArray: function( array, results ) { 585 var ret = results || []; 586 587 if ( array != null ) { 588 // The window, strings (and functions) also have 'length' 589 // The extra typeof function check is to prevent crashes 590 // in Safari 2 (See: #3039) 591 if ( array.length == null || typeof array === "string" || jQuery.isFunction(array) || (typeof array !== "function" && array.setInterval) ) { 592 push.call( ret, array ); 593 } else { 594 jQuery.merge( ret, array ); 595 } 596 } 597 598 return ret; 599 }, 600 601 inArray: function( elem, array ) { 602 if ( array.indexOf ) { 603 return array.indexOf( elem ); 604 } 605 606 for ( var i = 0, length = array.length; i < length; i++ ) { 607 if ( array[ i ] === elem ) { 608 return i; 609 } 610 } 611 612 return -1; 613 }, 614 615 merge: function( first, second ) { 616 var i = first.length, j = 0; 617 618 if ( typeof second.length === "number" ) { 619 for ( var l = second.length; j < l; j++ ) { 620 first[ i++ ] = second[ j ]; 621 } 622 } else { 623 while ( second[j] !== undefined ) { 624 first[ i++ ] = second[ j++ ]; 625 } 626 } 627 628 first.length = i; 629 630 return first; 631 }, 632 633 grep: function( elems, callback, inv ) { 634 var ret = []; 635 636 // Go through the array, only saving the items 637 // that pass the validator function 638 for ( var i = 0, length = elems.length; i < length; i++ ) { 639 if ( !inv !== !callback( elems[ i ], i ) ) { 640 ret.push( elems[ i ] ); 641 } 642 } 643 644 return ret; 645 }, 646 647 // arg is for internal usage only 648 map: function( elems, callback, arg ) { 649 var ret = [], value; 650 651 // Go through the array, translating each of the items to their 652 // new value (or values). 653 for ( var i = 0, length = elems.length; i < length; i++ ) { 654 value = callback( elems[ i ], i, arg ); 655 656 if ( value != null ) { 657 ret[ ret.length ] = value; 658 } 659 } 660 661 return ret.concat.apply( [], ret ); 662 }, 663 664 // A global GUID counter for objects 665 guid: 1, 666 667 proxy: function( fn, proxy, thisObject ) { 668 if ( arguments.length === 2 ) { 669 if ( typeof proxy === "string" ) { 670 thisObject = fn; 671 fn = thisObject[ proxy ]; 672 proxy = undefined; 673 674 } else if ( proxy && !jQuery.isFunction( proxy ) ) { 675 thisObject = proxy; 676 proxy = undefined; 677 } 678 } 679 680 if ( !proxy && fn ) { 681 proxy = function() { 682 return fn.apply( thisObject || this, arguments ); 683 }; 684 } 685 686 // Set the guid of unique handler to the same of original handler, so it can be removed 687 if ( fn ) { 688 proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; 689 } 690 691 // So proxy can be declared as an argument 692 return proxy; 693 }, 694 695 // Use of jQuery.browser is frowned upon. 696 // More details: http://docs.jquery.com/Utilities/jQuery.browser 697 uaMatch: function( ua ) { 698 ua = ua.toLowerCase(); 699 700 var match = /(webkit)[ \/]([\w.]+)/.exec( ua ) || 701 /(opera)(?:.*version)?[ \/]([\w.]+)/.exec( ua ) || 702 /(msie) ([\w.]+)/.exec( ua ) || 703 !/compatible/.test( ua ) && /(mozilla)(?:.*? rv:([\w.]+))?/.exec( ua ) || 704 []; 705 706 return { browser: match[1] || "", version: match[2] || "0" }; 707 }, 708 709 browser: {} 710}); 711 712browserMatch = jQuery.uaMatch( userAgent ); 713if ( browserMatch.browser ) { 714 jQuery.browser[ browserMatch.browser ] = true; 715 jQuery.browser.version = browserMatch.version; 716} 717 718// Deprecated, use jQuery.browser.webkit instead 719if ( jQuery.browser.webkit ) { 720 jQuery.browser.safari = true; 721} 722 723if ( indexOf ) { 724 jQuery.inArray = function( elem, array ) { 725 return indexOf.call( array, elem ); 726 }; 727} 728 729// All jQuery objects should point back to these 730rootjQuery = jQuery(document); 731 732// Cleanup functions for the document ready method 733if ( document.addEventListener ) { 734 DOMContentLoaded = function() { 735 document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); 736 jQuery.ready(); 737 }; 738 739} else if ( document.attachEvent ) { 740 DOMContentLoaded = function() { 741 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). 742 if ( document.readyState === "complete" ) { 743 document.detachEvent( "onreadystatechange", DOMContentLoaded ); 744 jQuery.ready(); 745 } 746 }; 747} 748 749// The DOM ready check for Internet Explorer 750function doScrollCheck() { 751 if ( jQuery.isReady ) { 752 return; 753 } 754 755 try { 756 // If IE is used, use the trick by Diego Perini 757 // http://javascript.nwbox.com/IEContentLoaded/ 758 document.documentElement.doScroll("left"); 759 } catch( error ) { 760 setTimeout( doScrollCheck, 1 ); 761 return; 762 } 763 764 // and execute any waiting functions 765 jQuery.ready(); 766} 767 768function evalScript( i, elem ) { 769 if ( elem.src ) { 770 jQuery.ajax({ 771 url: elem.src, 772 async: false, 773 dataType: "script" 774 }); 775 } else { 776 jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" ); 777 } 778 779 if ( elem.parentNode ) { 780 elem.parentNode.removeChild( elem ); 781 } 782} 783 784// Mutifunctional method to get and set values to a collection 785// The value/s can be optionally by executed if its a function 786function access( elems, key, value, exec, fn, pass ) { 787 var length = elems.length; 788 789 // Setting many attributes 790 if ( typeof key === "object" ) { 791 for ( var k in key ) { 792 access( elems, k, key[k], exec, fn, value ); 793 } 794 return elems; 795 } 796 797 // Setting one attribute 798 if ( value !== undefined ) { 799 // Optionally, function values get executed if exec is true 800 exec = !pass && exec && jQuery.isFunction(value); 801 802 for ( var i = 0; i < length; i++ ) { 803 fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); 804 } 805 806 return elems; 807 } 808 809 // Getting an attribute 810 return length ? fn( elems[0], key ) : null; 811} 812 813function now() { 814 return (new Date).getTime(); 815} 816(function() { 817 818 jQuery.support = {}; 819 820 var root = document.documentElement, 821 script = document.createElement("script"), 822 div = document.createElement("div"), 823 id = "script" + now(); 824 825 div.style.display = "none"; 826 div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; 827 828 var all = div.getElementsByTagName("*"), 829 a = div.getElementsByTagName("a")[0]; 830 831 // Can't get basic test support 832 if ( !all || !all.length || !a ) { 833 return; 834 } 835 836 jQuery.support = { 837 // IE strips leading whitespace when .innerHTML is used 838 leadingWhitespace: div.firstChild.nodeType === 3, 839 840 // Make sure that tbody elements aren't automatically inserted 841 // IE will insert them into empty tables 842 tbody: !div.getElementsByTagName("tbody").length, 843 844 // Make sure that link elements get serialized correctly by innerHTML 845 // This requires a wrapper element in IE 846 htmlSerialize: !!div.getElementsByTagName("link").length, 847 848 // Get the style information from getAttribute 849 // (IE uses .cssText insted) 850 style: /red/.test( a.getAttribute("style") ), 851 852 // Make sure that URLs aren't manipulated 853 // (IE normalizes it by default) 854 hrefNormalized: a.getAttribute("href") === "/a", 855 856 // Make sure that element opacity exists 857 // (IE uses filter instead) 858 // Use a regex to work around a WebKit issue. See #5145 859 opacity: /^0.55$/.test( a.style.opacity ), 860 861 // Verify style float existence 862 // (IE uses styleFloat instead of cssFloat) 863 cssFloat: !!a.style.cssFloat, 864 865 // Make sure that if no value is specified for a checkbox 866 // that it defaults to "on". 867 // (WebKit defaults to "" instead) 868 checkOn: div.getElementsByTagName("input")[0].value === "on", 869 870 // Make sure that a selected-by-default option has a working selected property. 871 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) 872 optSelected: document.createElement("select").appendChild( document.createElement("option") ).selected, 873 874 // Will be defined later 875 checkClone: false, 876 scriptEval: false, 877 noCloneEvent: true, 878 boxModel: null 879 }; 880 881 script.type = "text/javascript"; 882 try { 883 script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); 884 } catch(e) {} 885 886 root.insertBefore( script, root.firstChild ); 887 888 // Make sure that the execution of code works by injecting a script 889 // tag with appendChild/createTextNode 890 // (IE doesn't support this, fails, and uses .text instead) 891 if ( window[ id ] ) { 892 jQuery.support.scriptEval = true; 893 delete window[ id ]; 894 } 895 896 root.removeChild( script ); 897 898 if ( div.attachEvent && div.fireEvent ) { 899 div.attachEvent("onclick", function click() { 900 // Cloning a node shouldn't copy over any 901 // bound event handlers (IE does this) 902 jQuery.support.noCloneEvent = false; 903 div.detachEvent("onclick", click); 904 }); 905 div.cloneNode(true).fireEvent("onclick"); 906 } 907 908 div = document.createElement("div"); 909 div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>"; 910 911 var fragment = document.createDocumentFragment(); 912 fragment.appendChild( div.firstChild ); 913 914 // WebKit doesn't clone checked state correctly in fragments 915 jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked; 916 917 // Figure out if the W3C box model works as expected 918 // document.body must exist before we can do this 919 jQuery(function() { 920 var div = document.createElement("div"); 921 div.style.width = div.style.paddingLeft = "1px"; 922 923 document.body.appendChild( div ); 924 jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; 925 document.body.removeChild( div ).style.display = 'none'; 926 div = null; 927 }); 928 929 // Technique from Juriy Zaytsev 930 // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ 931 var eventSupported = function( eventName ) { 932 var el = document.createElement("div"); 933 eventName = "on" + eventName; 934 935 var isSupported = (eventName in el); 936 if ( !isSupported ) { 937 el.setAttribute(eventName, "return;"); 938 isSupported = typeof el[eventName] === "function"; 939 } 940 el = null; 941 942 return isSupported; 943 }; 944 945 jQuery.support.submitBubbles = eventSupported("submit"); 946 jQuery.support.changeBubbles = eventSupported("change"); 947 948 // release memory in IE 949 root = script = div = all = a = null; 950})(); 951 952jQuery.props = { 953 "for": "htmlFor", 954 "class": "className", 955 readonly: "readOnly", 956 maxlength: "maxLength", 957 cellspacing: "cellSpacing", 958 rowspan: "rowSpan", 959 colspan: "colSpan", 960 tabindex: "tabIndex", 961 usemap: "useMap", 962 frameborder: "frameBorder" 963}; 964var expando = "jQuery" + now(), uuid = 0, windowData = {}; 965var emptyObject = {}; 966 967jQuery.extend({ 968 cache: {}, 969 970 expando:expando, 971 972 // The following elements throw uncatchable exceptions if you 973 // attempt to add expando properties to them. 974 noData: { 975 "embed": true, 976 "object": true, 977 "applet": true 978 }, 979 980 data: function( elem, name, data ) { 981 if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { 982 return; 983 } 984 985 elem = elem == window ? 986 windowData : 987 elem; 988 989 var id = elem[ expando ], cache = jQuery.cache, thisCache; 990 991 // Handle the case where there's no name immediately 992 if ( !name && !id ) { 993 return null; 994 } 995 996 // Compute a unique ID for the element 997 if ( !id ) { 998 id = ++uuid; 999 } 1000 1001 // Avoid generating a new cache unless none exists and we 1002 // want to manipulate it. 1003 if ( typeof name === "object" ) { 1004 elem[ expando ] = id; 1005 thisCache = cache[ id ] = jQuery.extend(true, {}, name); 1006 } else if ( cache[ id ] ) { 1007 thisCache = cache[ id ]; 1008 } else if ( typeof data === "undefined" ) { 1009 thisCache = emptyObject; 1010 } else { 1011 thisCache = cache[ id ] = {}; 1012 } 1013 1014 // Prevent overriding the named cache with undefined values 1015 if ( data !== undefined ) { 1016 elem[ expando ] = id; 1017 thisCache[ name ] = data; 1018 } 1019 1020 return typeof name === "string" ? thisCache[ name ] : thisCache; 1021 }, 1022 1023 removeData: function( elem, name ) { 1024 if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) { 1025 return; 1026 } 1027 1028 elem = elem == window ? 1029 windowData : 1030 elem; 1031 1032 var id = elem[ expando ], cache = jQuery.cache, thisCache = cache[ id ]; 1033 1034 // If we want to remove a specific section of the element's data 1035 if ( name ) { 1036 if ( thisCache ) { 1037 // Remove the section of cache data 1038 delete thisCache[ name ]; 1039 1040 // If we've removed all the data, remove the element's cache 1041 if ( jQuery.isEmptyObject(thisCache) ) { 1042 jQuery.removeData( elem ); 1043 } 1044 } 1045 1046 // Otherwise, we want to remove all of the element's data 1047 } else { 1048 // Clean up the element expando 1049 try { 1050 delete elem[ expando ]; 1051 } catch( e ) { 1052 // IE has trouble directly removing the expando 1053 // but it's ok with using removeAttribute 1054 if ( elem.removeAttribute ) { 1055 elem.removeAttribute( expando ); 1056 } 1057 } 1058 1059 // Completely remove the data cache 1060 delete cache[ id ]; 1061 } 1062 } 1063}); 1064 1065jQuery.fn.extend({ 1066 data: function( key, value ) { 1067 if ( typeof key === "undefined" && this.length ) { 1068 return jQuery.data( this[0] ); 1069 1070 } else if ( typeof key === "object" ) { 1071 return this.each(function() { 1072 jQuery.data( this, key ); 1073 }); 1074 } 1075 1076 var parts = key.split("."); 1077 parts[1] = parts[1] ? "." + parts[1] : ""; 1078 1079 if ( value === undefined ) { 1080 var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); 1081 1082 if ( data === undefined && this.length ) { 1083 data = jQuery.data( this[0], key ); 1084 } 1085 return data === undefined && parts[1] ? 1086 this.data( parts[0] ) : 1087 data; 1088 } else { 1089 return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function() { 1090 jQuery.data( this, key, value ); 1091 }); 1092 } 1093 }, 1094 1095 removeData: function( key ) { 1096 return this.each(function() { 1097 jQuery.removeData( this, key ); 1098 }); 1099 } 1100}); 1101jQuery.extend({ 1102 queue: function( elem, type, data ) { 1103 if ( !elem ) { 1104 return; 1105 } 1106 1107 type = (type || "fx") + "queue"; 1108 var q = jQuery.data( elem, type ); 1109 1110 // Speed up dequeue by getting out quickly if this is just a lookup 1111 if ( !data ) { 1112 return q || []; 1113 } 1114 1115 if ( !q || jQuery.isArray(data) ) { 1116 q = jQuery.data( elem, type, jQuery.makeArray(data) ); 1117 1118 } else { 1119 q.push( data ); 1120 } 1121 1122 return q; 1123 }, 1124 1125 dequeue: function( elem, type ) { 1126 type = type || "fx"; 1127 1128 var queue = jQuery.queue( elem, type ), fn = queue.shift(); 1129 1130 // If the fx queue is dequeued, always remove the progress sentinel 1131 if ( fn === "inprogress" ) { 1132 fn = queue.shift(); 1133 } 1134 1135 if ( fn ) { 1136 // Add a progress sentinel to prevent the fx queue from being 1137 // automatically dequeued 1138 if ( type === "fx" ) { 1139 queue.unshift("inprogress"); 1140 } 1141 1142 fn.call(elem, function() { 1143 jQuery.dequeue(elem, type); 1144 }); 1145 } 1146 } 1147}); 1148 1149jQuery.fn.extend({ 1150 queue: function( type, data ) { 1151 if ( typeof type !== "string" ) { 1152 data = type; 1153 type = "fx"; 1154 } 1155 1156 if ( data === undefined ) { 1157 return jQuery.queue( this[0], type ); 1158 } 1159 return this.each(function( i, elem ) { 1160 var queue = jQuery.queue( this, type, data ); 1161 1162 if ( type === "fx" && queue[0] !== "inprogress" ) { 1163 jQuery.dequeue( this, type ); 1164 } 1165 }); 1166 }, 1167 dequeue: function( type ) { 1168 return this.each(function() { 1169 jQuery.dequeue( this, type ); 1170 }); 1171 }, 1172 1173 // Based off of the plugin by Clint Helfers, with permission. 1174 // http://blindsignals.com/index.php/2009/07/jquery-delay/ 1175 delay: function( time, type ) { 1176 time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; 1177 type = type || "fx"; 1178 1179 return this.queue( type, function() { 1180 var elem = this; 1181 setTimeout(function() { 1182 jQuery.dequeue( elem, type ); 1183 }, time ); 1184 }); 1185 }, 1186 1187 clearQueue: function( type ) { 1188 return this.queue( type || "fx", [] ); 1189 } 1190}); 1191var rclass = /[\n\t]/g, 1192 rspace = /\s+/, 1193 rreturn = /\r/g, 1194 rspecialurl = /href|src|style/, 1195 rtype = /(button|input)/i, 1196 rfocusable = /(button|input|object|select|textarea)/i, 1197 rclickable = /^(a|area)$/i, 1198 rradiocheck = /radio|checkbox/; 1199 1200jQuery.fn.extend({ 1201 attr: function( name, value ) { 1202 return access( this, name, value, true, jQuery.attr ); 1203 }, 1204 1205 removeAttr: function( name, fn ) { 1206 return this.each(function(){ 1207 jQuery.attr( this, name, "" ); 1208 if ( this.nodeType === 1 ) { 1209 this.removeAttribute( name ); 1210 } 1211 }); 1212 }, 1213 1214 addClass: function( value ) { 1215 if ( jQuery.isFunction(value) ) { 1216 return this.each(function(i) { 1217 var self = jQuery(this); 1218 self.addClass( value.call(this, i, self.attr("class")) ); 1219 }); 1220 } 1221 1222 if ( value && typeof value === "string" ) { 1223 var classNames = (value || "").split( rspace ); 1224 1225 for ( var i = 0, l = this.length; i < l; i++ ) { 1226 var elem = this[i]; 1227 1228 if ( elem.nodeType === 1 ) { 1229 if ( !elem.className ) { 1230 elem.className = value; 1231 1232 } else { 1233 var className = " " + elem.className + " "; 1234 for ( var c = 0, cl = classNames.length; c < cl; c++ ) { 1235 if ( className.indexOf( " " + classNames[c] + " " ) < 0 ) { 1236 elem.className += " " + classNames[c]; 1237 } 1238 } 1239 } 1240 } 1241 } 1242 } 1243 1244 return this; 1245 }, 1246 1247 removeClass: function( value ) { 1248 if ( jQuery.isFunction(value) ) { 1249 return this.each(function(i) { 1250 var self = jQuery(this); 1251 self.removeClass( value.call(this, i, self.attr("class")) ); 1252 }); 1253 } 1254 1255 if ( (value && typeof value === "string") || value === undefined ) { 1256 var classNames = (value || "").split(rspace); 1257 1258 for ( var i = 0, l = this.length; i < l; i++ ) { 1259 var elem = this[i]; 1260 1261 if ( elem.nodeType === 1 && elem.className ) { 1262 if ( value ) { 1263 var className = (" " + elem.className + " ").replace(rclass, " "); 1264 for ( var c = 0, cl = classNames.length; c < cl; c++ ) { 1265 className = className.replace(" " + classNames[c] + " ", " "); 1266 } 1267 elem.className = className.substring(1, className.length - 1); 1268 1269 } else { 1270 elem.className = ""; 1271 } 1272 } 1273 } 1274 } 1275 1276 return this; 1277 }, 1278 1279 toggleClass: function( value, stateVal ) { 1280 var type = typeof value, isBool = typeof stateVal === "boolean"; 1281 1282 if ( jQuery.isFunction( value ) ) { 1283 return this.each(function(i) { 1284 var self = jQuery(this); 1285 self.toggleClass( value.call(this, i, self.attr("class"), stateVal), stateVal ); 1286 }); 1287 } 1288 1289 return this.each(function() { 1290 if ( type === "string" ) { 1291 // toggle individual class names 1292 var className, i = 0, self = jQuery(this), 1293 state = stateVal, 1294 classNames = value.split( rspace ); 1295 1296 while ( (className = classNames[ i++ ]) ) { 1297 // check each className given, space seperated list 1298 state = isBool ? state : !self.hasClass( className ); 1299 self[ state ? "addClass" : "removeClass" ]( className ); 1300 } 1301 1302 } else if ( type === "undefined" || type === "boolean" ) { 1303 if ( this.className ) { 1304 // store className if set 1305 jQuery.data( this, "__className__", this.className ); 1306 } 1307 1308 // toggle whole className 1309 this.className = this.className || value === false ? "" : jQuery.data( this, "__className__" ) || ""; 1310 } 1311 }); 1312 }, 1313 1314 hasClass: function( selector ) { 1315 var className = " " + selector + " "; 1316 for ( var i = 0, l = this.length; i < l; i++ ) { 1317 if ( (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { 1318 return true; 1319 } 1320 } 1321 1322 return false; 1323 }, 1324 1325 val: function( value ) { 1326 if ( value === undefined ) { 1327 var elem = this[0]; 1328 1329 if ( elem ) { 1330 if ( jQuery.nodeName( elem, "option" ) ) { 1331 return (elem.attributes.value || {}).specified ? elem.value : elem.text; 1332 } 1333 1334 // We need to handle select boxes special 1335 if ( jQuery.nodeName( elem, "select" ) ) { 1336 var index = elem.selectedIndex, 1337 values = [], 1338 options = elem.options, 1339 one = elem.type === "select-one"; 1340 1341 // Nothing was selected 1342 if ( index < 0 ) { 1343 return null; 1344 } 1345 1346 // Loop through all the selected options 1347 for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { 1348 var option = options[ i ]; 1349 1350 if ( option.selected ) { 1351 // Get the specifc value for the option 1352 value = jQuery(option).val(); 1353 1354 // We don't need an array for one selects 1355 if ( one ) { 1356 return value; 1357 } 1358 1359 // Multi-Selects return an array 1360 values.push( value ); 1361 } 1362 } 1363 1364 return values; 1365 } 1366 1367 // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified 1368 if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) { 1369 return elem.getAttribute("value") === null ? "on" : elem.value; 1370 } 1371 1372 1373 // Everything else, we just grab the value 1374 return (elem.value || "").replace(rreturn, ""); 1375 1376 } 1377 1378 return undefined; 1379 } 1380 1381 var isFunction = jQuery.isFunction(value); 1382 1383 return this.each(function(i) { 1384 var self = jQuery(this), val = value; 1385 1386 if ( this.nodeType !== 1 ) { 1387 return; 1388 } 1389 1390 if ( isFunction ) { 1391 val = value.call(this, i, self.val()); 1392 } 1393 1394 // Typecast each time if the value is a Function and the appended 1395 // value is therefore different each time. 1396 if ( typeof val === "number" ) { 1397 val += ""; 1398 } 1399 1400 if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) { 1401 this.checked = jQuery.inArray( self.val(), val ) >= 0; 1402 1403 } else if ( jQuery.nodeName( this, "select" ) ) { 1404 var values = jQuery.makeArray(val); 1405 1406 jQuery( "option", this ).each(function() { 1407 this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; 1408 }); 1409 1410 if ( !values.length ) { 1411 this.selectedIndex = -1; 1412 } 1413 1414 } else { 1415 this.value = val; 1416 } 1417 }); 1418 } 1419}); 1420 1421jQuery.extend({ 1422 attrFn: { 1423 val: true, 1424 css: true, 1425 html: true, 1426 text: true, 1427 data: true, 1428 width: true, 1429 height: true, 1430 offset: true 1431 }, 1432 1433 attr: function( elem, name, value, pass ) { 1434 // don't set attributes on text and comment nodes 1435 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { 1436 return undefined; 1437 } 1438 1439 if ( pass && name in jQuery.attrFn ) { 1440 return jQuery(elem)[name](value); 1441 } 1442 1443 var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ), 1444 // Whether we are setting (or getting) 1445 set = value !== undefined; 1446 1447 // Try to normalize/fix the name 1448 name = notxml && jQuery.props[ name ] || name; 1449 1450 // Only do all the following if this is a node (faster for style) 1451 if ( elem.nodeType === 1 ) { 1452 // These attributes require special treatment 1453 var special = rspecialurl.test( name ); 1454 1455 // Safari mis-reports the default selected property of an option 1456 // Accessing the parent's selectedIndex property fixes it 1457 if ( name === "selected" && !jQuery.support.optSelected ) { 1458 var parent = elem.parentNode; 1459 if ( parent ) { 1460 parent.selectedIndex; 1461 1462 // Make sure that it also works with optgroups, see #5701 1463 if ( parent.parentNode ) { 1464 parent.parentNode.selectedIndex; 1465 } 1466 } 1467 } 1468 1469 // If applicable, access the attribute via the DOM 0 way 1470 if ( name in elem && notxml && !special ) { 1471 if ( set ) { 1472 // We can't allow the type property to be changed (since it causes problems in IE) 1473 if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) { 1474 jQuery.error( "type property can't be changed" ); 1475 } 1476 1477 elem[ name ] = value; 1478 } 1479 1480 // browsers index elements by id/name on forms, give priority to attributes. 1481 if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) { 1482 return elem.getAttributeNode( name ).nodeValue; 1483 } 1484 1485 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set 1486 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 1487 if ( name === "tabIndex" ) { 1488 var attributeNode = elem.getAttributeNode( "tabIndex" ); 1489 1490 return attributeNode && attributeNode.specified ? 1491 attributeNode.value : 1492 rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? 1493 0 : 1494 undefined; 1495 } 1496 1497 return elem[ name ]; 1498 } 1499 1500 if ( !jQuery.support.style && notxml && name === "style" ) { 1501 if ( set ) { 1502 elem.style.cssText = "" + value; 1503 } 1504 1505 return elem.style.cssText; 1506 } 1507 1508 if ( set ) { 1509 // convert the value to a string (all browsers do this but IE) see #1070 1510 elem.setAttribute( name, "" + value ); 1511 } 1512 1513 var attr = !jQuery.support.hrefNormalized && notxml && special ? 1514 // Some attributes require a special call on IE 1515 elem.getAttribute( name, 2 ) : 1516 elem.getAttribute( name ); 1517 1518 // Non-existent attributes return null, we normalize to undefined 1519 return attr === null ? undefined : attr; 1520 } 1521 1522 // elem is actually elem.style ... set the style 1523 // Using attr for specific style information is now deprecated. Use style insead. 1524 return jQuery.style( elem, name, value ); 1525 } 1526}); 1527var fcleanup = function( nm ) { 1528 return nm.replace(/[^\w\s\.\|`]/g, function( ch ) { 1529 return "\\" + ch; 1530 }); 1531}; 1532 1533/* 1534 * A number of helper functions used for managing events. 1535 * Many of the ideas behind this code originated from 1536 * Dean Edwards' addEvent library. 1537 */ 1538jQuery.event = { 1539 1540 // Bind an event to an element 1541 // Original by Dean Edwards 1542 add: function( elem, types, handler, data ) { 1543 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 1544 return; 1545 } 1546 1547 // For whatever reason, IE has trouble passing the window object 1548 // around, causing it to be cloned in the process 1549 if ( elem.setInterval && ( elem !== window && !elem.frameElement ) ) { 1550 elem = window; 1551 } 1552 1553 // Make sure that the function being executed has a unique ID 1554 if ( !handler.guid ) { 1555 handler.guid = jQuery.guid++; 1556 } 1557 1558 // if data is passed, bind to handler 1559 if ( data !== undefined ) { 1560 // Create temporary function pointer to original handler 1561 var fn = handler; 1562 1563 // Create unique handler function, wrapped around original handler 1564 handler = jQuery.proxy( fn ); 1565 1566 // Store data in unique handler 1567 handler.data = data; 1568 } 1569 1570 // Init the element's event structure 1571 var events = jQuery.data( elem, "events" ) || jQuery.data( elem, "events", {} ), 1572 handle = jQuery.data( elem, "handle" ), eventHandle; 1573 1574 if ( !handle ) { 1575 eventHandle = function() { 1576 // Handle the second event of a trigger and when 1577 // an event is called after a page has unloaded 1578 return typeof jQuery !== "undefined" && !jQuery.event.triggered ? 1579 jQuery.event.handle.apply( eventHandle.elem, arguments ) : 1580 undefined; 1581 }; 1582 1583 handle = jQuery.data( elem, "handle", eventHandle ); 1584 } 1585 1586 // If no handle is found then we must be trying to bind to one of the 1587 // banned noData elements 1588 if ( !handle ) { 1589 return; 1590 } 1591 1592 // Add elem as a property of the handle function 1593 // This is to prevent a memory leak with non-native 1594 // event in IE. 1595 handle.elem = elem; 1596 1597 // Handle multiple events separated by a space 1598 // jQuery(...).bind("mouseover mouseout", fn); 1599 types = types.split( /\s+/ ); 1600 1601 var type, i = 0; 1602 1603 while ( (type = types[ i++ ]) ) { 1604 // Namespaced event handlers 1605 var namespaces = type.split("."); 1606 type = namespaces.shift(); 1607 1608 if ( i > 1 ) { 1609 handler = jQuery.proxy( handler ); 1610 1611 if ( data !== undefined ) { 1612 handler.data = data; 1613 } 1614 } 1615 1616 handler.type = namespaces.slice(0).sort().join("."); 1617 1618 // Get the current list of functions bound to this event 1619 var handlers = events[ type ], 1620 special = this.special[ type ] || {}; 1621 1622 // Init the event handler queue 1623 if ( !handlers ) { 1624 handlers = events[ type ] = {}; 1625 1626 // Check for a special event handler 1627 // Only use addEventListener/attachEvent if the special 1628 // events handler returns false 1629 if ( !special.setup || special.setup.call( elem, data, namespaces, handler) === false ) { 1630 // Bind the global event handler to the element 1631 if ( elem.addEventListener ) { 1632 elem.addEventListener( type, handle, false ); 1633 } else if ( elem.attachEvent ) { 1634 elem.attachEvent( "on" + type, handle ); 1635 } 1636 } 1637 } 1638 1639 if ( special.add ) { 1640 var modifiedHandler = special.add.call( elem, handler, data, namespaces, handlers ); 1641 if ( modifiedHandler && jQuery.isFunction( modifiedHandler ) ) { 1642 modifiedHandler.guid = modifiedHandler.guid || handler.guid; 1643 modifiedHandler.data = modifiedHandler.data || handler.data; 1644 modifiedHandler.type = modifiedHandler.type || handler.type; 1645 handler = modifiedHandler; 1646 } 1647 } 1648 1649 // Add the function to the element's handler list 1650 handlers[ handler.guid ] = handler; 1651 1652 // Keep track of which events have been used, for global triggering 1653 this.global[ type ] = true; 1654 } 1655 1656 // Nullify elem to prevent memory leaks in IE 1657 elem = null; 1658 }, 1659 1660 global: {}, 1661 1662 // Detach an event or set of events from an element 1663 remove: function( elem, types, handler ) { 1664 // don't do events on text and comment nodes 1665 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 1666 return; 1667 } 1668 1669 var events = jQuery.data( elem, "events" ), ret, type, fn; 1670 1671 if ( events ) { 1672 // Unbind all events for the element 1673 if ( types === undefined || (typeof types === "string" && types.charAt(0) === ".") ) { 1674 for ( type in events ) { 1675 this.remove( elem, type + (types || "") ); 1676 } 1677 } else { 1678 // types is actually an event object here 1679 if ( types.type ) { 1680 handler = types.handler; 1681 types = types.type; 1682 } 1683 1684 // Handle multiple events separated by a space 1685 // jQuery(...).unbind("mouseover mouseout", fn); 1686 types = types.split(/\s+/); 1687 var i = 0; 1688 while ( (type = types[ i++ ]) ) { 1689 // Namespaced event handlers 1690 var namespaces = type.split("."); 1691 type = namespaces.shift(); 1692 var all = !namespaces.length, 1693 cleaned = jQuery.map( namespaces.slice(0).sort(), fcleanup ), 1694 namespace = new RegExp("(^|\\.)" + cleaned.join("\\.(?:.*\\.)?") + "(\\.|$)"), 1695 special = this.special[ type ] || {}; 1696 1697 if ( events[ type ] ) { 1698 // remove the given handler for the given type 1699 if ( handler ) { 1700 fn = events[ type ][ handler.guid ]; 1701 delete events[ type ][ handler.guid ]; 1702 1703 // remove all handlers for the given type 1704 } else { 1705 for ( var handle in events[ type ] ) { 1706 // Handle the removal of namespaced events 1707 if ( all || namespace.test( events[ type ][ handle ].type ) ) { 1708 delete events[ type ][ handle ]; 1709 } 1710 } 1711 } 1712 1713 if ( special.remove ) { 1714 special.remove.call( elem, namespaces, fn); 1715 } 1716 1717 // remove generic event handler if no more handlers exist 1718 for ( ret in events[ type ] ) { 1719 break; 1720 } 1721 if ( !ret ) { 1722 if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { 1723 if ( elem.removeEventListener ) { 1724 elem.removeEventListener( type, jQuery.data( elem, "handle" ), false ); 1725 } else if ( elem.detachEvent ) { 1726 elem.detachEvent( "on" + type, jQuery.data( elem, "handle" ) ); 1727 } 1728 } 1729 ret = null; 1730 delete events[ type ]; 1731 } 1732 } 1733 } 1734 } 1735 1736 // Remove the expando if it's no longer used 1737 for ( ret in events ) { 1738 break; 1739 } 1740 if ( !ret ) { 1741 var handle = jQuery.data( elem, "handle" ); 1742 if ( handle ) { 1743 handle.elem = null; 1744 } 1745 jQuery.removeData( elem, "events" ); 1746 jQuery.removeData( elem, "handle" ); 1747 } 1748 } 1749 }, 1750 1751 // bubbling is internal 1752 trigger: function( event, data, elem /*, bubbling */ ) { 1753 // Event object or event type 1754 var type = event.type || event, 1755 bubbling = arguments[3]; 1756 1757 if ( !bubbling ) { 1758 event = typeof event === "object" ? 1759 // jQuery.Event object 1760 event[expando] ? event : 1761 // Object literal 1762 jQuery.extend( jQuery.Event(type), event ) : 1763 // Just the event type (string) 1764 jQuery.Event(type); 1765 1766 if ( type.indexOf("!") >= 0 ) { 1767 event.type = type = type.slice(0, -1); 1768 event.exclusive = true; 1769 } 1770 1771 // Handle a global trigger 1772 if ( !elem ) { 1773 // Don't bubble custom events when global (to avoid too much overhead) 1774 event.stopPropagation(); 1775 1776 // Only trigger if we've ever bound an event for it 1777 if ( this.global[ type ] ) { 1778 jQuery.each( jQuery.cache, function() { 1779 if ( this.events && this.events[type] ) { 1780 jQuery.event.trigger( event, data, this.handle.elem ); 1781 } 1782 }); 1783 } 1784 } 1785 1786 // Handle triggering a single element 1787 1788 // don't do events on text and comment nodes 1789 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { 1790 return undefined; 1791 } 1792 1793 // Clean up in case it is reused 1794 event.result = undefined; 1795 event.target = elem; 1796 1797 // Clone the incoming data, if any 1798 data = jQuery.makeArray( data ); 1799 data.unshift( event ); 1800 } 1801 1802 event.currentTarget = elem; 1803 1804 // Trigger the event, it is assumed that "handle" is a function 1805 var handle = jQuery.data( elem, "handle" ); 1806 if ( handle ) { 1807 handle.apply( elem, data ); 1808 } 1809 1810 var parent = elem.parentNode || elem.ownerDocument; 1811 1812 // Trigger an inline bound script 1813 try { 1814 if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) { 1815 if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) { 1816 event.result = false; 1817 } 1818 } 1819 1820 // prevent IE from throwing an error for some elements with some event types, see #3533 1821 } catch (e) {} 1822 1823 if ( !event.isPropagationStopped() && parent ) { 1824 jQuery.event.trigger( event, data, parent, true ); 1825 1826 } else if ( !event.isDefaultPrevented() ) { 1827 var target = event.target, old, 1828 isClick = jQuery.nodeName(target, "a") && type === "click"; 1829 1830 if ( !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) { 1831 try { 1832 if ( target[ type ] ) { 1833 // Make sure that we don't accidentally re-trigger the onFOO events 1834 old = target[ "on" + type ]; 1835 1836 if ( old ) { 1837 target[ "on" + type ] = null; 1838 } 1839 1840 this.triggered = true; 1841 target[ type ](); 1842 } 1843 1844 // prevent IE from throwing an error for some elements with some event types, see #3533 1845 } catch (e) {} 1846 1847 if ( old ) { 1848 target[ "on" + type ] = old; 1849 } 1850 1851 this.triggered = false; 1852 } 1853 } 1854 }, 1855 1856 handle: function( event ) { 1857 // returned undefined or false 1858 var all, handlers; 1859 1860 event = arguments[0] = jQuery.event.fix( event || window.event ); 1861 event.currentTarget = this; 1862 1863 // Namespaced event handlers 1864 var namespaces = event.type.split("."); 1865 event.type = namespaces.shift(); 1866 1867 // Cache this now, all = true means, any handler 1868 all = !namespaces.length && !event.exclusive; 1869 1870 var namespace = new RegExp("(^|\\.)" + namespaces.slice(0).sort().join("\\.(?:.*\\.)?") + "(\\.|$)"); 1871 1872 handlers = ( jQuery.data(this, "events") || {} )[ event.type ]; 1873 1874 for ( var j in handlers ) { 1875 var handler = handlers[ j ]; 1876 1877 // Filter the functions by class 1878 if ( all || namespace.test(handler.type) ) { 1879 // Pass in a reference to the handler function itself 1880 // So that we can later remove it 1881 event.handler = handler; 1882 event.data = handler.data; 1883 1884 var ret = handler.apply( this, arguments ); 1885 1886 if ( ret !== undefined ) { 1887 event.result = ret; 1888 if ( ret === false ) { 1889 event.preventDefault(); 1890 event.stopPropagation(); 1891 } 1892 } 1893 1894 if ( event.isImmediatePropagationStopped() ) { 1895 break; 1896 } 1897 1898 } 1899 } 1900 1901 return event.result; 1902 }, 1903 1904 props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget scree…
Large files files are truncated, but you can click here to view the full file