| changeset 101 | 0b8e098398de |
| parent 69 | 4775601a2531 |
| 100:4c15ecd9c154 | 101:0b8e098398de |
|---|---|
1 /*! |
1 /*! |
2 * jQuery JavaScript Library v1.5 |
2 * jQuery JavaScript Library v1.6 |
3 * http://jquery.com/ |
3 * http://jquery.com/ |
4 * |
4 * |
5 * Copyright 2011, John Resig |
5 * Copyright 2011, John Resig |
6 * Dual licensed under the MIT or GPL Version 2 licenses. |
6 * Dual licensed under the MIT or GPL Version 2 licenses. |
7 * http://jquery.org/license |
7 * http://jquery.org/license |
9 * Includes Sizzle.js |
9 * Includes Sizzle.js |
10 * http://sizzlejs.com/ |
10 * http://sizzlejs.com/ |
11 * Copyright 2011, The Dojo Foundation |
11 * Copyright 2011, The Dojo Foundation |
12 * Released under the MIT, BSD, and GPL Licenses. |
12 * Released under the MIT, BSD, and GPL Licenses. |
13 * |
13 * |
14 * Date: Mon Jan 31 08:31:29 2011 -0500 |
14 * Date: Mon May 2 13:50:00 2011 -0400 |
15 */ |
15 */ |
16 (function( window, undefined ) { |
16 (function( window, undefined ) { |
17 |
17 |
18 // Use the correct document accordingly with window argument (sandbox) |
18 // Use the correct document accordingly with window argument (sandbox) |
19 var document = window.document; |
19 var document = window.document, |
20 navigator = window.navigator, |
|
21 location = window.location; |
|
20 var jQuery = (function() { |
22 var jQuery = (function() { |
21 |
23 |
22 // Define a local copy of jQuery |
24 // Define a local copy of jQuery |
23 var jQuery = function( selector, context ) { |
25 var jQuery = function( selector, context ) { |
24 // The jQuery object is actually just the init constructor 'enhanced' |
26 // The jQuery object is actually just the init constructor 'enhanced' |
34 // A central reference to the root jQuery(document) |
36 // A central reference to the root jQuery(document) |
35 rootjQuery, |
37 rootjQuery, |
36 |
38 |
37 // A simple way to check for HTML strings or ID strings |
39 // A simple way to check for HTML strings or ID strings |
38 // (both of which we optimize for) |
40 // (both of which we optimize for) |
39 quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/, |
41 quickExpr = /^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, |
40 |
42 |
41 // Check if a string has a non-whitespace character in it |
43 // Check if a string has a non-whitespace character in it |
42 rnotwhite = /\S/, |
44 rnotwhite = /\S/, |
43 |
45 |
44 // Used for trimming whitespace |
46 // Used for trimming whitespace |
67 userAgent = navigator.userAgent, |
69 userAgent = navigator.userAgent, |
68 |
70 |
69 // For matching the engine and version of the browser |
71 // For matching the engine and version of the browser |
70 browserMatch, |
72 browserMatch, |
71 |
73 |
72 // Has the ready events already been bound? |
|
73 readyBound = false, |
|
74 |
|
75 // The deferred used on DOM ready |
74 // The deferred used on DOM ready |
76 readyList, |
75 readyList, |
77 |
|
78 // Promise methods |
|
79 promiseMethods = "then done fail isResolved isRejected promise".split( " " ), |
|
80 |
76 |
81 // The ready event handler |
77 // The ready event handler |
82 DOMContentLoaded, |
78 DOMContentLoaded, |
83 |
79 |
84 // Save a reference to some core methods |
80 // Save a reference to some core methods |
111 |
107 |
112 // The body element only exists once, optimize finding it |
108 // The body element only exists once, optimize finding it |
113 if ( selector === "body" && !context && document.body ) { |
109 if ( selector === "body" && !context && document.body ) { |
114 this.context = document; |
110 this.context = document; |
115 this[0] = document.body; |
111 this[0] = document.body; |
116 this.selector = "body"; |
112 this.selector = selector; |
117 this.length = 1; |
113 this.length = 1; |
118 return this; |
114 return this; |
119 } |
115 } |
120 |
116 |
121 // Handle HTML strings |
117 // Handle HTML strings |
122 if ( typeof selector === "string" ) { |
118 if ( typeof selector === "string" ) { |
123 // Are we dealing with HTML string or an ID? |
119 // Are we dealing with HTML string or an ID? |
124 match = quickExpr.exec( selector ); |
120 if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { |
121 // Assume that strings that start and end with <> are HTML and skip the regex check |
|
122 match = [ null, selector, null ]; |
|
123 |
|
124 } else { |
|
125 match = quickExpr.exec( selector ); |
|
126 } |
|
125 |
127 |
126 // Verify a match, and that no context was specified for #id |
128 // Verify a match, and that no context was specified for #id |
127 if ( match && (match[1] || !context) ) { |
129 if ( match && (match[1] || !context) ) { |
128 |
130 |
129 // HANDLE: $(html) -> $(array) |
131 // HANDLE: $(html) -> $(array) |
200 |
202 |
201 // Start with an empty selector |
203 // Start with an empty selector |
202 selector: "", |
204 selector: "", |
203 |
205 |
204 // The current version of jQuery being used |
206 // The current version of jQuery being used |
205 jquery: "1.5", |
207 jquery: "1.6", |
206 |
208 |
207 // The default length of a jQuery object is 0 |
209 // The default length of a jQuery object is 0 |
208 length: 0, |
210 length: 0, |
209 |
211 |
210 // The number of elements contained in the matched element set |
212 // The number of elements contained in the matched element set |
311 |
313 |
312 // Give the init function the jQuery prototype for later instantiation |
314 // Give the init function the jQuery prototype for later instantiation |
313 jQuery.fn.init.prototype = jQuery.fn; |
315 jQuery.fn.init.prototype = jQuery.fn; |
314 |
316 |
315 jQuery.extend = jQuery.fn.extend = function() { |
317 jQuery.extend = jQuery.fn.extend = function() { |
316 var options, name, src, copy, copyIsArray, clone, |
318 var options, name, src, copy, copyIsArray, clone, |
317 target = arguments[0] || {}, |
319 target = arguments[0] || {}, |
318 i = 1, |
320 i = 1, |
319 length = arguments.length, |
321 length = arguments.length, |
320 deep = false; |
322 deep = false; |
321 |
323 |
376 return target; |
378 return target; |
377 }; |
379 }; |
378 |
380 |
379 jQuery.extend({ |
381 jQuery.extend({ |
380 noConflict: function( deep ) { |
382 noConflict: function( deep ) { |
381 window.$ = _$; |
383 if ( window.$ === jQuery ) { |
382 |
384 window.$ = _$; |
383 if ( deep ) { |
385 } |
386 |
|
387 if ( deep && window.jQuery === jQuery ) { |
|
384 window.jQuery = _jQuery; |
388 window.jQuery = _jQuery; |
385 } |
389 } |
386 |
390 |
387 return jQuery; |
391 return jQuery; |
388 }, |
392 }, |
392 |
396 |
393 // A counter to track how many items to wait for before |
397 // A counter to track how many items to wait for before |
394 // the ready event fires. See #6781 |
398 // the ready event fires. See #6781 |
395 readyWait: 1, |
399 readyWait: 1, |
396 |
400 |
401 // Hold (or release) the ready event |
|
402 holdReady: function( hold ) { |
|
403 if ( hold ) { |
|
404 jQuery.readyWait++; |
|
405 } else { |
|
406 jQuery.ready( true ); |
|
407 } |
|
408 }, |
|
409 |
|
397 // Handle when the DOM is ready |
410 // Handle when the DOM is ready |
398 ready: function( wait ) { |
411 ready: function( wait ) { |
399 // A third-party is pushing the ready event forwards |
412 // Either a released hold or an DOMready/load event and not yet ready |
400 if ( wait === true ) { |
413 if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { |
401 jQuery.readyWait--; |
|
402 } |
|
403 |
|
404 // Make sure that the DOM is not already loaded |
|
405 if ( !jQuery.readyWait || (wait !== true && !jQuery.isReady) ) { |
|
406 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). |
414 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). |
407 if ( !document.body ) { |
415 if ( !document.body ) { |
408 return setTimeout( jQuery.ready, 1 ); |
416 return setTimeout( jQuery.ready, 1 ); |
409 } |
417 } |
410 |
418 |
425 } |
433 } |
426 } |
434 } |
427 }, |
435 }, |
428 |
436 |
429 bindReady: function() { |
437 bindReady: function() { |
430 if ( readyBound ) { |
438 if ( readyList ) { |
431 return; |
439 return; |
432 } |
440 } |
433 |
441 |
434 readyBound = true; |
442 readyList = jQuery._Deferred(); |
435 |
443 |
436 // Catch cases where $(document).ready() is called after the |
444 // Catch cases where $(document).ready() is called after the |
437 // browser event has already occurred. |
445 // browser event has already occurred. |
438 if ( document.readyState === "complete" ) { |
446 if ( document.readyState === "complete" ) { |
439 // Handle it asynchronously to allow scripts the opportunity to delay ready |
447 // Handle it asynchronously to allow scripts the opportunity to delay ready |
450 |
458 |
451 // If IE event model is used |
459 // If IE event model is used |
452 } else if ( document.attachEvent ) { |
460 } else if ( document.attachEvent ) { |
453 // ensure firing before onload, |
461 // ensure firing before onload, |
454 // maybe late but safe also for iframes |
462 // maybe late but safe also for iframes |
455 document.attachEvent("onreadystatechange", DOMContentLoaded); |
463 document.attachEvent( "onreadystatechange", DOMContentLoaded ); |
456 |
464 |
457 // A fallback to window.onload, that will always work |
465 // A fallback to window.onload, that will always work |
458 window.attachEvent( "onload", jQuery.ready ); |
466 window.attachEvent( "onload", jQuery.ready ); |
459 |
467 |
460 // If IE and not a frame |
468 // If IE and not a frame |
538 } |
546 } |
539 |
547 |
540 // Make sure leading/trailing whitespace is removed (IE can't handle it) |
548 // Make sure leading/trailing whitespace is removed (IE can't handle it) |
541 data = jQuery.trim( data ); |
549 data = jQuery.trim( data ); |
542 |
550 |
551 // Attempt to parse using the native JSON parser first |
|
552 if ( window.JSON && window.JSON.parse ) { |
|
553 return window.JSON.parse( data ); |
|
554 } |
|
555 |
|
543 // Make sure the incoming data is actual JSON |
556 // Make sure the incoming data is actual JSON |
544 // Logic borrowed from http://json.org/json2.js |
557 // Logic borrowed from http://json.org/json2.js |
545 if ( rvalidchars.test(data.replace(rvalidescape, "@") |
558 if ( rvalidchars.test( data.replace( rvalidescape, "@" ) |
546 .replace(rvalidtokens, "]") |
559 .replace( rvalidtokens, "]" ) |
547 .replace(rvalidbraces, "")) ) { |
560 .replace( rvalidbraces, "")) ) { |
548 |
561 |
549 // Try to use the native JSON parser first |
562 return (new Function( "return " + data ))(); |
550 return window.JSON && window.JSON.parse ? |
563 |
551 window.JSON.parse( data ) : |
564 } |
552 (new Function("return " + data))(); |
565 jQuery.error( "Invalid JSON: " + data ); |
553 |
|
554 } else { |
|
555 jQuery.error( "Invalid JSON: " + data ); |
|
556 } |
|
557 }, |
566 }, |
558 |
567 |
559 // Cross-browser xml parsing |
568 // Cross-browser xml parsing |
560 // (xml & tmp used internally) |
569 // (xml & tmp used internally) |
561 parseXML: function( data , xml , tmp ) { |
570 parseXML: function( data , xml , tmp ) { |
578 return xml; |
587 return xml; |
579 }, |
588 }, |
580 |
589 |
581 noop: function() {}, |
590 noop: function() {}, |
582 |
591 |
583 // Evalulates a script in a global context |
592 // Evaluates a script in a global context |
593 // Workarounds based on findings by Jim Driscoll |
|
594 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context |
|
584 globalEval: function( data ) { |
595 globalEval: function( data ) { |
585 if ( data && rnotwhite.test(data) ) { |
596 if ( data && rnotwhite.test( data ) ) { |
586 // Inspired by code by Andrea Giammarchi |
597 // We use execScript on Internet Explorer |
587 // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html |
598 // We use an anonymous function so that context is window |
588 var head = document.getElementsByTagName("head")[0] || document.documentElement, |
599 // rather than jQuery in Firefox |
589 script = document.createElement("script"); |
600 ( window.execScript || function( data ) { |
590 |
601 window[ "eval" ].call( window, data ); |
591 script.type = "text/javascript"; |
602 } )( data ); |
592 |
|
593 if ( jQuery.support.scriptEval() ) { |
|
594 script.appendChild( document.createTextNode( data ) ); |
|
595 } else { |
|
596 script.text = data; |
|
597 } |
|
598 |
|
599 // Use insertBefore instead of appendChild to circumvent an IE6 bug. |
|
600 // This arises when a base node is used (#2709). |
|
601 head.insertBefore( script, head.firstChild ); |
|
602 head.removeChild( script ); |
|
603 } |
603 } |
604 }, |
604 }, |
605 |
605 |
606 nodeName: function( elem, name ) { |
606 nodeName: function( elem, name ) { |
607 return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); |
607 return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); |
609 |
609 |
610 // args is for internal usage only |
610 // args is for internal usage only |
611 each: function( object, callback, args ) { |
611 each: function( object, callback, args ) { |
612 var name, i = 0, |
612 var name, i = 0, |
613 length = object.length, |
613 length = object.length, |
614 isObj = length === undefined || jQuery.isFunction(object); |
614 isObj = length === undefined || jQuery.isFunction( object ); |
615 |
615 |
616 if ( args ) { |
616 if ( args ) { |
617 if ( isObj ) { |
617 if ( isObj ) { |
618 for ( name in object ) { |
618 for ( name in object ) { |
619 if ( callback.apply( object[ name ], args ) === false ) { |
619 if ( callback.apply( object[ name ], args ) === false ) { |
635 if ( callback.call( object[ name ], name, object[ name ] ) === false ) { |
635 if ( callback.call( object[ name ], name, object[ name ] ) === false ) { |
636 break; |
636 break; |
637 } |
637 } |
638 } |
638 } |
639 } else { |
639 } else { |
640 for ( var value = object[0]; |
640 for ( ; i < length; ) { |
641 i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {} |
641 if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { |
642 break; |
|
643 } |
|
644 } |
|
642 } |
645 } |
643 } |
646 } |
644 |
647 |
645 return object; |
648 return object; |
646 }, |
649 }, |
667 if ( array != null ) { |
670 if ( array != null ) { |
668 // The window, strings (and functions) also have 'length' |
671 // The window, strings (and functions) also have 'length' |
669 // The extra typeof function check is to prevent crashes |
672 // The extra typeof function check is to prevent crashes |
670 // in Safari 2 (See: #3039) |
673 // in Safari 2 (See: #3039) |
671 // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 |
674 // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 |
672 var type = jQuery.type(array); |
675 var type = jQuery.type( array ); |
673 |
676 |
674 if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { |
677 if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { |
675 push.call( ret, array ); |
678 push.call( ret, array ); |
676 } else { |
679 } else { |
677 jQuery.merge( ret, array ); |
680 jQuery.merge( ret, array ); |
680 |
683 |
681 return ret; |
684 return ret; |
682 }, |
685 }, |
683 |
686 |
684 inArray: function( elem, array ) { |
687 inArray: function( elem, array ) { |
685 if ( array.indexOf ) { |
688 |
686 return array.indexOf( elem ); |
689 if ( indexOf ) { |
690 return indexOf.call( array, elem ); |
|
687 } |
691 } |
688 |
692 |
689 for ( var i = 0, length = array.length; i < length; i++ ) { |
693 for ( var i = 0, length = array.length; i < length; i++ ) { |
690 if ( array[ i ] === elem ) { |
694 if ( array[ i ] === elem ) { |
691 return i; |
695 return i; |
731 return ret; |
735 return ret; |
732 }, |
736 }, |
733 |
737 |
734 // arg is for internal usage only |
738 // arg is for internal usage only |
735 map: function( elems, callback, arg ) { |
739 map: function( elems, callback, arg ) { |
736 var ret = [], value; |
740 var value, key, ret = [], |
741 i = 0, |
|
742 length = elems.length, |
|
743 // jquery objects are treated as arrays |
|
744 isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; |
|
737 |
745 |
738 // Go through the array, translating each of the items to their |
746 // Go through the array, translating each of the items to their |
739 // new value (or values). |
747 if ( isArray ) { |
740 for ( var i = 0, length = elems.length; i < length; i++ ) { |
748 for ( ; i < length; i++ ) { |
741 value = callback( elems[ i ], i, arg ); |
749 value = callback( elems[ i ], i, arg ); |
742 |
750 |
743 if ( value != null ) { |
751 if ( value != null ) { |
744 ret[ ret.length ] = value; |
752 ret[ ret.length ] = value; |
753 } |
|
754 } |
|
755 |
|
756 // Go through every key on the object, |
|
757 } else { |
|
758 for ( key in elems ) { |
|
759 value = callback( elems[ key ], key, arg ); |
|
760 |
|
761 if ( value != null ) { |
|
762 ret[ ret.length ] = value; |
|
763 } |
|
745 } |
764 } |
746 } |
765 } |
747 |
766 |
748 // Flatten any nested arrays |
767 // Flatten any nested arrays |
749 return ret.concat.apply( [], ret ); |
768 return ret.concat.apply( [], ret ); |
750 }, |
769 }, |
751 |
770 |
752 // A global GUID counter for objects |
771 // A global GUID counter for objects |
753 guid: 1, |
772 guid: 1, |
754 |
773 |
755 proxy: function( fn, proxy, thisObject ) { |
774 // Bind a function to a context, optionally partially applying any |
756 if ( arguments.length === 2 ) { |
775 // arguments. |
757 if ( typeof proxy === "string" ) { |
776 proxy: function( fn, context ) { |
758 thisObject = fn; |
777 if ( typeof context === "string" ) { |
759 fn = thisObject[ proxy ]; |
778 var tmp = fn[ context ]; |
760 proxy = undefined; |
779 context = fn; |
761 |
780 fn = tmp; |
762 } else if ( proxy && !jQuery.isFunction( proxy ) ) { |
781 } |
763 thisObject = proxy; |
782 |
764 proxy = undefined; |
783 // Quick check to determine if target is callable, in the spec |
765 } |
784 // this throws a TypeError, but we will just return undefined. |
766 } |
785 if ( !jQuery.isFunction( fn ) ) { |
767 |
786 return undefined; |
768 if ( !proxy && fn ) { |
787 } |
788 |
|
789 // Simulated bind |
|
790 var args = slice.call( arguments, 2 ), |
|
769 proxy = function() { |
791 proxy = function() { |
770 return fn.apply( thisObject || this, arguments ); |
792 return fn.apply( context, args.concat( slice.call( arguments ) ) ); |
771 }; |
793 }; |
772 } |
|
773 |
794 |
774 // Set the guid of unique handler to the same of original handler, so it can be removed |
795 // Set the guid of unique handler to the same of original handler, so it can be removed |
775 if ( fn ) { |
796 proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; |
776 proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; |
797 |
777 } |
|
778 |
|
779 // So proxy can be declared as an argument |
|
780 return proxy; |
798 return proxy; |
781 }, |
799 }, |
782 |
800 |
783 // Mutifunctional method to get and set values to a collection |
801 // Mutifunctional method to get and set values to a collection |
784 // The value/s can be optionally by executed if its a function |
802 // The value/s can be optionally by executed if its a function |
811 |
829 |
812 now: function() { |
830 now: function() { |
813 return (new Date()).getTime(); |
831 return (new Date()).getTime(); |
814 }, |
832 }, |
815 |
833 |
834 // Use of jQuery.browser is frowned upon. |
|
835 // More details: http://docs.jquery.com/Utilities/jQuery.browser |
|
836 uaMatch: function( ua ) { |
|
837 ua = ua.toLowerCase(); |
|
838 |
|
839 var match = rwebkit.exec( ua ) || |
|
840 ropera.exec( ua ) || |
|
841 rmsie.exec( ua ) || |
|
842 ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || |
|
843 []; |
|
844 |
|
845 return { browser: match[1] || "", version: match[2] || "0" }; |
|
846 }, |
|
847 |
|
848 sub: function() { |
|
849 function jQuerySub( selector, context ) { |
|
850 return new jQuerySub.fn.init( selector, context ); |
|
851 } |
|
852 jQuery.extend( true, jQuerySub, this ); |
|
853 jQuerySub.superclass = this; |
|
854 jQuerySub.fn = jQuerySub.prototype = this(); |
|
855 jQuerySub.fn.constructor = jQuerySub; |
|
856 jQuerySub.sub = this.sub; |
|
857 jQuerySub.fn.init = function init( selector, context ) { |
|
858 if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { |
|
859 context = jQuerySub( context ); |
|
860 } |
|
861 |
|
862 return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); |
|
863 }; |
|
864 jQuerySub.fn.init.prototype = jQuerySub.fn; |
|
865 var rootjQuerySub = jQuerySub(document); |
|
866 return jQuerySub; |
|
867 }, |
|
868 |
|
869 browser: {} |
|
870 }); |
|
871 |
|
872 // Populate the class2type map |
|
873 jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { |
|
874 class2type[ "[object " + name + "]" ] = name.toLowerCase(); |
|
875 }); |
|
876 |
|
877 browserMatch = jQuery.uaMatch( userAgent ); |
|
878 if ( browserMatch.browser ) { |
|
879 jQuery.browser[ browserMatch.browser ] = true; |
|
880 jQuery.browser.version = browserMatch.version; |
|
881 } |
|
882 |
|
883 // Deprecated, use jQuery.browser.webkit instead |
|
884 if ( jQuery.browser.webkit ) { |
|
885 jQuery.browser.safari = true; |
|
886 } |
|
887 |
|
888 // IE doesn't match non-breaking spaces with \s |
|
889 if ( rnotwhite.test( "\xA0" ) ) { |
|
890 trimLeft = /^[\s\xA0]+/; |
|
891 trimRight = /[\s\xA0]+$/; |
|
892 } |
|
893 |
|
894 // All jQuery objects should point back to these |
|
895 rootjQuery = jQuery(document); |
|
896 |
|
897 // Cleanup functions for the document ready method |
|
898 if ( document.addEventListener ) { |
|
899 DOMContentLoaded = function() { |
|
900 document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); |
|
901 jQuery.ready(); |
|
902 }; |
|
903 |
|
904 } else if ( document.attachEvent ) { |
|
905 DOMContentLoaded = function() { |
|
906 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). |
|
907 if ( document.readyState === "complete" ) { |
|
908 document.detachEvent( "onreadystatechange", DOMContentLoaded ); |
|
909 jQuery.ready(); |
|
910 } |
|
911 }; |
|
912 } |
|
913 |
|
914 // The DOM ready check for Internet Explorer |
|
915 function doScrollCheck() { |
|
916 if ( jQuery.isReady ) { |
|
917 return; |
|
918 } |
|
919 |
|
920 try { |
|
921 // If IE is used, use the trick by Diego Perini |
|
922 // http://javascript.nwbox.com/IEContentLoaded/ |
|
923 document.documentElement.doScroll("left"); |
|
924 } catch(e) { |
|
925 setTimeout( doScrollCheck, 1 ); |
|
926 return; |
|
927 } |
|
928 |
|
929 // and execute any waiting functions |
|
930 jQuery.ready(); |
|
931 } |
|
932 |
|
933 // Expose jQuery to the global object |
|
934 return jQuery; |
|
935 |
|
936 })(); |
|
937 |
|
938 |
|
939 var // Promise methods |
|
940 promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ), |
|
941 // Static reference to slice |
|
942 sliceDeferred = [].slice; |
|
943 |
|
944 jQuery.extend({ |
|
816 // Create a simple deferred (one callbacks list) |
945 // Create a simple deferred (one callbacks list) |
817 _Deferred: function() { |
946 _Deferred: function() { |
818 var // callbacks list |
947 var // callbacks list |
819 callbacks = [], |
948 callbacks = [], |
820 // stored [ context , args ] |
949 // stored [ context , args ] |
856 }, |
985 }, |
857 |
986 |
858 // resolve with given context and args |
987 // resolve with given context and args |
859 resolveWith: function( context, args ) { |
988 resolveWith: function( context, args ) { |
860 if ( !cancelled && !fired && !firing ) { |
989 if ( !cancelled && !fired && !firing ) { |
990 // make sure args are available (#8421) |
|
991 args = args || []; |
|
861 firing = 1; |
992 firing = 1; |
862 try { |
993 try { |
863 while( callbacks[ 0 ] ) { |
994 while( callbacks[ 0 ] ) { |
864 callbacks.shift().apply( context, args ); |
995 callbacks.shift().apply( context, args ); |
865 } |
996 } |
872 return this; |
1003 return this; |
873 }, |
1004 }, |
874 |
1005 |
875 // resolve with this as context and given arguments |
1006 // resolve with this as context and given arguments |
876 resolve: function() { |
1007 resolve: function() { |
877 deferred.resolveWith( jQuery.isFunction( this.promise ) ? this.promise() : this, arguments ); |
1008 deferred.resolveWith( this, arguments ); |
878 return this; |
1009 return this; |
879 }, |
1010 }, |
880 |
1011 |
881 // Has this deferred been resolved? |
1012 // Has this deferred been resolved? |
882 isResolved: function() { |
1013 isResolved: function() { |
903 jQuery.extend( deferred, { |
1034 jQuery.extend( deferred, { |
904 then: function( doneCallbacks, failCallbacks ) { |
1035 then: function( doneCallbacks, failCallbacks ) { |
905 deferred.done( doneCallbacks ).fail( failCallbacks ); |
1036 deferred.done( doneCallbacks ).fail( failCallbacks ); |
906 return this; |
1037 return this; |
907 }, |
1038 }, |
1039 always: function() { |
|
1040 return deferred.done.apply( deferred, arguments ).fail.apply( this, arguments ); |
|
1041 }, |
|
908 fail: failDeferred.done, |
1042 fail: failDeferred.done, |
909 rejectWith: failDeferred.resolveWith, |
1043 rejectWith: failDeferred.resolveWith, |
910 reject: failDeferred.resolve, |
1044 reject: failDeferred.resolve, |
911 isRejected: failDeferred.isResolved, |
1045 isRejected: failDeferred.isResolved, |
1046 pipe: function( fnDone, fnFail ) { |
|
1047 return jQuery.Deferred(function( newDefer ) { |
|
1048 jQuery.each( { |
|
1049 done: [ fnDone, "resolve" ], |
|
1050 fail: [ fnFail, "reject" ] |
|
1051 }, function( handler, data ) { |
|
1052 var fn = data[ 0 ], |
|
1053 action = data[ 1 ], |
|
1054 returned; |
|
1055 if ( jQuery.isFunction( fn ) ) { |
|
1056 deferred[ handler ](function() { |
|
1057 returned = fn.apply( this, arguments ); |
|
1058 if ( jQuery.isFunction( returned.promise ) ) { |
|
1059 returned.promise().then( newDefer.resolve, newDefer.reject ); |
|
1060 } else { |
|
1061 newDefer[ action ]( returned ); |
|
1062 } |
|
1063 }); |
|
1064 } else { |
|
1065 deferred[ handler ]( newDefer[ action ] ); |
|
1066 } |
|
1067 }); |
|
1068 }).promise(); |
|
1069 }, |
|
912 // Get a promise for this deferred |
1070 // Get a promise for this deferred |
913 // If obj is provided, the promise aspect is added to the object |
1071 // If obj is provided, the promise aspect is added to the object |
914 promise: function( obj , i /* internal */ ) { |
1072 promise: function( obj ) { |
915 if ( obj == null ) { |
1073 if ( obj == null ) { |
916 if ( promise ) { |
1074 if ( promise ) { |
917 return promise; |
1075 return promise; |
918 } |
1076 } |
919 promise = obj = {}; |
1077 promise = obj = {}; |
920 } |
1078 } |
921 i = promiseMethods.length; |
1079 var i = promiseMethods.length; |
922 while( i-- ) { |
1080 while( i-- ) { |
923 obj[ promiseMethods[ i ] ] = deferred[ promiseMethods[ i ] ]; |
1081 obj[ promiseMethods[i] ] = deferred[ promiseMethods[i] ]; |
924 } |
1082 } |
925 return obj; |
1083 return obj; |
926 } |
1084 } |
927 } ); |
1085 }); |
928 // Make sure only one callback list will be used |
1086 // Make sure only one callback list will be used |
929 deferred.then( failDeferred.cancel, deferred.cancel ); |
1087 deferred.done( failDeferred.cancel ).fail( deferred.cancel ); |
930 // Unexpose cancel |
1088 // Unexpose cancel |
931 delete deferred.cancel; |
1089 delete deferred.cancel; |
932 // Call given func if any |
1090 // Call given func if any |
933 if ( func ) { |
1091 if ( func ) { |
934 func.call( deferred, deferred ); |
1092 func.call( deferred, deferred ); |
935 } |
1093 } |
936 return deferred; |
1094 return deferred; |
937 }, |
1095 }, |
938 |
1096 |
939 // Deferred helper |
1097 // Deferred helper |
940 when: function( object ) { |
1098 when: function( firstParam ) { |
941 var args = arguments, |
1099 var args = arguments, |
1100 i = 0, |
|
942 length = args.length, |
1101 length = args.length, |
943 deferred = length <= 1 && object && jQuery.isFunction( object.promise ) ? |
1102 count = length, |
944 object : |
1103 deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? |
945 jQuery.Deferred(), |
1104 firstParam : |
946 promise = deferred.promise(), |
1105 jQuery.Deferred(); |
947 resolveArray; |
1106 function resolveFunc( i ) { |
948 |
1107 return function( value ) { |
1108 args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; |
|
1109 if ( !( --count ) ) { |
|
1110 // Strange bug in FF4: |
|
1111 // Values changed onto the arguments object sometimes end up as undefined values |
|
1112 // outside the $.when method. Cloning the object into a fresh array solves the issue |
|
1113 deferred.resolveWith( deferred, sliceDeferred.call( args, 0 ) ); |
|
1114 } |
|
1115 }; |
|
1116 } |
|
949 if ( length > 1 ) { |
1117 if ( length > 1 ) { |
950 resolveArray = new Array( length ); |
1118 for( ; i < length; i++ ) { |
951 jQuery.each( args, function( index, element ) { |
1119 if ( args[ i ] && jQuery.isFunction( args[ i ].promise ) ) { |
952 jQuery.when( element ).then( function( value ) { |
1120 args[ i ].promise().then( resolveFunc(i), deferred.reject ); |
953 resolveArray[ index ] = arguments.length > 1 ? slice.call( arguments, 0 ) : value; |
1121 } else { |
954 if( ! --length ) { |
1122 --count; |
955 deferred.resolveWith( promise, resolveArray ); |
1123 } |
956 } |
1124 } |
957 }, deferred.reject ); |
1125 if ( !count ) { |
958 } ); |
1126 deferred.resolveWith( deferred, args ); |
959 } else if ( deferred !== object ) { |
1127 } |
960 deferred.resolve( object ); |
1128 } else if ( deferred !== firstParam ) { |
961 } |
1129 deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); |
962 return promise; |
1130 } |
963 }, |
1131 return deferred.promise(); |
964 |
1132 } |
965 // Use of jQuery.browser is frowned upon. |
|
966 // More details: http://docs.jquery.com/Utilities/jQuery.browser |
|
967 uaMatch: function( ua ) { |
|
968 ua = ua.toLowerCase(); |
|
969 |
|
970 var match = rwebkit.exec( ua ) || |
|
971 ropera.exec( ua ) || |
|
972 rmsie.exec( ua ) || |
|
973 ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || |
|
974 []; |
|
975 |
|
976 return { browser: match[1] || "", version: match[2] || "0" }; |
|
977 }, |
|
978 |
|
979 sub: function() { |
|
980 function jQuerySubclass( selector, context ) { |
|
981 return new jQuerySubclass.fn.init( selector, context ); |
|
982 } |
|
983 jQuery.extend( true, jQuerySubclass, this ); |
|
984 jQuerySubclass.superclass = this; |
|
985 jQuerySubclass.fn = jQuerySubclass.prototype = this(); |
|
986 jQuerySubclass.fn.constructor = jQuerySubclass; |
|
987 jQuerySubclass.subclass = this.subclass; |
|
988 jQuerySubclass.fn.init = function init( selector, context ) { |
|
989 if ( context && context instanceof jQuery && !(context instanceof jQuerySubclass) ) { |
|
990 context = jQuerySubclass(context); |
|
991 } |
|
992 |
|
993 return jQuery.fn.init.call( this, selector, context, rootjQuerySubclass ); |
|
994 }; |
|
995 jQuerySubclass.fn.init.prototype = jQuerySubclass.fn; |
|
996 var rootjQuerySubclass = jQuerySubclass(document); |
|
997 return jQuerySubclass; |
|
998 }, |
|
999 |
|
1000 browser: {} |
|
1001 }); |
1133 }); |
1002 |
1134 |
1003 // Create readyList deferred |
1135 |
1004 readyList = jQuery._Deferred(); |
1136 |
1005 |
1137 jQuery.support = (function() { |
1006 // Populate the class2type map |
1138 |
1007 jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { |
1139 var div = document.createElement( "div" ), |
1008 class2type[ "[object " + name + "]" ] = name.toLowerCase(); |
1140 all, |
1009 }); |
1141 a, |
1010 |
1142 select, |
1011 browserMatch = jQuery.uaMatch( userAgent ); |
1143 opt, |
1012 if ( browserMatch.browser ) { |
1144 input, |
1013 jQuery.browser[ browserMatch.browser ] = true; |
1145 marginDiv, |
1014 jQuery.browser.version = browserMatch.version; |
1146 support, |
1015 } |
1147 fragment, |
1016 |
1148 body, |
1017 // Deprecated, use jQuery.browser.webkit instead |
1149 bodyStyle, |
1018 if ( jQuery.browser.webkit ) { |
1150 tds, |
1019 jQuery.browser.safari = true; |
1151 events, |
1020 } |
1152 eventName, |
1021 |
1153 i, |
1022 if ( indexOf ) { |
1154 isSupported; |
1023 jQuery.inArray = function( elem, array ) { |
1155 |
1024 return indexOf.call( array, elem ); |
1156 // Preliminary tests |
1025 }; |
1157 div.setAttribute("className", "t"); |
1026 } |
1158 div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; |
1027 |
1159 |
1028 // IE doesn't match non-breaking spaces with \s |
1160 all = div.getElementsByTagName( "*" ); |
1029 if ( rnotwhite.test( "\xA0" ) ) { |
1161 a = div.getElementsByTagName( "a" )[ 0 ]; |
1030 trimLeft = /^[\s\xA0]+/; |
|
1031 trimRight = /[\s\xA0]+$/; |
|
1032 } |
|
1033 |
|
1034 // All jQuery objects should point back to these |
|
1035 rootjQuery = jQuery(document); |
|
1036 |
|
1037 // Cleanup functions for the document ready method |
|
1038 if ( document.addEventListener ) { |
|
1039 DOMContentLoaded = function() { |
|
1040 document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); |
|
1041 jQuery.ready(); |
|
1042 }; |
|
1043 |
|
1044 } else if ( document.attachEvent ) { |
|
1045 DOMContentLoaded = function() { |
|
1046 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). |
|
1047 if ( document.readyState === "complete" ) { |
|
1048 document.detachEvent( "onreadystatechange", DOMContentLoaded ); |
|
1049 jQuery.ready(); |
|
1050 } |
|
1051 }; |
|
1052 } |
|
1053 |
|
1054 // The DOM ready check for Internet Explorer |
|
1055 function doScrollCheck() { |
|
1056 if ( jQuery.isReady ) { |
|
1057 return; |
|
1058 } |
|
1059 |
|
1060 try { |
|
1061 // If IE is used, use the trick by Diego Perini |
|
1062 // http://javascript.nwbox.com/IEContentLoaded/ |
|
1063 document.documentElement.doScroll("left"); |
|
1064 } catch(e) { |
|
1065 setTimeout( doScrollCheck, 1 ); |
|
1066 return; |
|
1067 } |
|
1068 |
|
1069 // and execute any waiting functions |
|
1070 jQuery.ready(); |
|
1071 } |
|
1072 |
|
1073 // Expose jQuery to the global object |
|
1074 return (window.jQuery = window.$ = jQuery); |
|
1075 |
|
1076 })(); |
|
1077 |
|
1078 |
|
1079 (function() { |
|
1080 |
|
1081 jQuery.support = {}; |
|
1082 |
|
1083 var div = document.createElement("div"); |
|
1084 |
|
1085 div.style.display = "none"; |
|
1086 div.innerHTML = " <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>"; |
|
1087 |
|
1088 var all = div.getElementsByTagName("*"), |
|
1089 a = div.getElementsByTagName("a")[0], |
|
1090 select = document.createElement("select"), |
|
1091 opt = select.appendChild( document.createElement("option") ); |
|
1092 |
1162 |
1093 // Can't get basic test support |
1163 // Can't get basic test support |
1094 if ( !all || !all.length || !a ) { |
1164 if ( !all || !all.length || !a ) { |
1095 return; |
1165 return {}; |
1096 } |
1166 } |
1097 |
1167 |
1098 jQuery.support = { |
1168 // First batch of supports tests |
1169 select = document.createElement( "select" ); |
|
1170 opt = select.appendChild( document.createElement("option") ); |
|
1171 input = div.getElementsByTagName( "input" )[ 0 ]; |
|
1172 |
|
1173 support = { |
|
1099 // IE strips leading whitespace when .innerHTML is used |
1174 // IE strips leading whitespace when .innerHTML is used |
1100 leadingWhitespace: div.firstChild.nodeType === 3, |
1175 leadingWhitespace: ( div.firstChild.nodeType === 3 ), |
1101 |
1176 |
1102 // Make sure that tbody elements aren't automatically inserted |
1177 // Make sure that tbody elements aren't automatically inserted |
1103 // IE will insert them into empty tables |
1178 // IE will insert them into empty tables |
1104 tbody: !div.getElementsByTagName("tbody").length, |
1179 tbody: !div.getElementsByTagName( "tbody" ).length, |
1105 |
1180 |
1106 // Make sure that link elements get serialized correctly by innerHTML |
1181 // Make sure that link elements get serialized correctly by innerHTML |
1107 // This requires a wrapper element in IE |
1182 // This requires a wrapper element in IE |
1108 htmlSerialize: !!div.getElementsByTagName("link").length, |
1183 htmlSerialize: !!div.getElementsByTagName( "link" ).length, |
1109 |
1184 |
1110 // Get the style information from getAttribute |
1185 // Get the style information from getAttribute |
1111 // (IE uses .cssText insted) |
1186 // (IE uses .cssText instead) |
1112 style: /red/.test( a.getAttribute("style") ), |
1187 style: /top/.test( a.getAttribute("style") ), |
1113 |
1188 |
1114 // Make sure that URLs aren't manipulated |
1189 // Make sure that URLs aren't manipulated |
1115 // (IE normalizes it by default) |
1190 // (IE normalizes it by default) |
1116 hrefNormalized: a.getAttribute("href") === "/a", |
1191 hrefNormalized: ( a.getAttribute( "href" ) === "/a" ), |
1117 |
1192 |
1118 // Make sure that element opacity exists |
1193 // Make sure that element opacity exists |
1119 // (IE uses filter instead) |
1194 // (IE uses filter instead) |
1120 // Use a regex to work around a WebKit issue. See #5145 |
1195 // Use a regex to work around a WebKit issue. See #5145 |
1121 opacity: /^0.55$/.test( a.style.opacity ), |
1196 opacity: /^0.55$/.test( a.style.opacity ), |
1125 cssFloat: !!a.style.cssFloat, |
1200 cssFloat: !!a.style.cssFloat, |
1126 |
1201 |
1127 // Make sure that if no value is specified for a checkbox |
1202 // Make sure that if no value is specified for a checkbox |
1128 // that it defaults to "on". |
1203 // that it defaults to "on". |
1129 // (WebKit defaults to "" instead) |
1204 // (WebKit defaults to "" instead) |
1130 checkOn: div.getElementsByTagName("input")[0].value === "on", |
1205 checkOn: ( input.value === "on" ), |
1131 |
1206 |
1132 // Make sure that a selected-by-default option has a working selected property. |
1207 // Make sure that a selected-by-default option has a working selected property. |
1133 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) |
1208 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) |
1134 optSelected: opt.selected, |
1209 optSelected: opt.selected, |
1135 |
1210 |
1211 // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) |
|
1212 getSetAttribute: div.className !== "t", |
|
1213 |
|
1136 // Will be defined later |
1214 // Will be defined later |
1215 submitBubbles: true, |
|
1216 changeBubbles: true, |
|
1217 focusinBubbles: false, |
|
1137 deleteExpando: true, |
1218 deleteExpando: true, |
1138 optDisabled: false, |
|
1139 checkClone: false, |
|
1140 _scriptEval: null, |
|
1141 noCloneEvent: true, |
1219 noCloneEvent: true, |
1142 boxModel: null, |
|
1143 inlineBlockNeedsLayout: false, |
1220 inlineBlockNeedsLayout: false, |
1144 shrinkWrapBlocks: false, |
1221 shrinkWrapBlocks: false, |
1145 reliableHiddenOffsets: true |
1222 reliableMarginRight: true |
1146 }; |
1223 }; |
1147 |
1224 |
1225 // Make sure checked status is properly cloned |
|
1226 input.checked = true; |
|
1227 support.noCloneChecked = input.cloneNode( true ).checked; |
|
1228 |
|
1148 // Make sure that the options inside disabled selects aren't marked as disabled |
1229 // Make sure that the options inside disabled selects aren't marked as disabled |
1149 // (WebKit marks them as diabled) |
1230 // (WebKit marks them as disabled) |
1150 select.disabled = true; |
1231 select.disabled = true; |
1151 jQuery.support.optDisabled = !opt.disabled; |
1232 support.optDisabled = !opt.disabled; |
1152 |
|
1153 jQuery.support.scriptEval = function() { |
|
1154 if ( jQuery.support._scriptEval === null ) { |
|
1155 var root = document.documentElement, |
|
1156 script = document.createElement("script"), |
|
1157 id = "script" + jQuery.now(); |
|
1158 |
|
1159 script.type = "text/javascript"; |
|
1160 try { |
|
1161 script.appendChild( document.createTextNode( "window." + id + "=1;" ) ); |
|
1162 } catch(e) {} |
|
1163 |
|
1164 root.insertBefore( script, root.firstChild ); |
|
1165 |
|
1166 // Make sure that the execution of code works by injecting a script |
|
1167 // tag with appendChild/createTextNode |
|
1168 // (IE doesn't support this, fails, and uses .text instead) |
|
1169 if ( window[ id ] ) { |
|
1170 jQuery.support._scriptEval = true; |
|
1171 delete window[ id ]; |
|
1172 } else { |
|
1173 jQuery.support._scriptEval = false; |
|
1174 } |
|
1175 |
|
1176 root.removeChild( script ); |
|
1177 // release memory in IE |
|
1178 root = script = id = null; |
|
1179 } |
|
1180 |
|
1181 return jQuery.support._scriptEval; |
|
1182 }; |
|
1183 |
1233 |
1184 // Test to see if it's possible to delete an expando from an element |
1234 // Test to see if it's possible to delete an expando from an element |
1185 // Fails in Internet Explorer |
1235 // Fails in Internet Explorer |
1186 try { |
1236 try { |
1187 delete div.test; |
1237 delete div.test; |
1188 |
1238 } catch( e ) { |
1189 } catch(e) { |
1239 support.deleteExpando = false; |
1190 jQuery.support.deleteExpando = false; |
1240 } |
1191 } |
1241 |
1192 |
1242 if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { |
1193 if ( div.attachEvent && div.fireEvent ) { |
1243 div.attachEvent( "onclick", function click() { |
1194 div.attachEvent("onclick", function click() { |
|
1195 // Cloning a node shouldn't copy over any |
1244 // Cloning a node shouldn't copy over any |
1196 // bound event handlers (IE does this) |
1245 // bound event handlers (IE does this) |
1197 jQuery.support.noCloneEvent = false; |
1246 support.noCloneEvent = false; |
1198 div.detachEvent("onclick", click); |
1247 div.detachEvent( "onclick", click ); |
1199 }); |
1248 }); |
1200 div.cloneNode(true).fireEvent("onclick"); |
1249 div.cloneNode( true ).fireEvent( "onclick" ); |
1201 } |
1250 } |
1202 |
1251 |
1203 div = document.createElement("div"); |
1252 // Check if a radio maintains it's value |
1204 div.innerHTML = "<input type='radio' name='radiotest' checked='checked'/>"; |
1253 // after being appended to the DOM |
1205 |
1254 input = document.createElement("input"); |
1206 var fragment = document.createDocumentFragment(); |
1255 input.value = "t"; |
1256 input.setAttribute("type", "radio"); |
|
1257 support.radioValue = input.value === "t"; |
|
1258 |
|
1259 input.setAttribute("checked", "checked"); |
|
1260 div.appendChild( input ); |
|
1261 fragment = document.createDocumentFragment(); |
|
1207 fragment.appendChild( div.firstChild ); |
1262 fragment.appendChild( div.firstChild ); |
1208 |
1263 |
1209 // WebKit doesn't clone checked state correctly in fragments |
1264 // WebKit doesn't clone checked state correctly in fragments |
1210 jQuery.support.checkClone = fragment.cloneNode(true).cloneNode(true).lastChild.checked; |
1265 support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; |
1266 |
|
1267 div.innerHTML = ""; |
|
1211 |
1268 |
1212 // Figure out if the W3C box model works as expected |
1269 // Figure out if the W3C box model works as expected |
1213 // document.body must exist before we can do this |
1270 div.style.width = div.style.paddingLeft = "1px"; |
1214 jQuery(function() { |
1271 |
1215 var div = document.createElement("div"), |
1272 // We use our own, invisible, body |
1216 body = document.getElementsByTagName("body")[0]; |
1273 body = document.createElement( "body" ); |
1217 |
1274 bodyStyle = { |
1218 // Frameset documents with no body should not run this code |
1275 visibility: "hidden", |
1219 if ( !body ) { |
1276 width: 0, |
1220 return; |
1277 height: 0, |
1221 } |
1278 border: 0, |
1222 |
1279 margin: 0, |
1223 div.style.width = div.style.paddingLeft = "1px"; |
1280 // Set background to avoid IE crashes when removing (#9028) |
1224 body.appendChild( div ); |
1281 background: "none" |
1225 jQuery.boxModel = jQuery.support.boxModel = div.offsetWidth === 2; |
1282 }; |
1226 |
1283 for ( i in bodyStyle ) { |
1227 if ( "zoom" in div.style ) { |
1284 body.style[ i ] = bodyStyle[ i ]; |
1228 // Check if natively block-level elements act like inline-block |
1285 } |
1229 // elements when setting their display to 'inline' and giving |
1286 body.appendChild( div ); |
1230 // them layout |
1287 document.documentElement.appendChild( body ); |
1231 // (IE < 8 does this) |
1288 |
1232 div.style.display = "inline"; |
1289 // Check if a disconnected checkbox will retain its checked |
1233 div.style.zoom = 1; |
1290 // value of true after appended to the DOM (IE6/7) |
1234 jQuery.support.inlineBlockNeedsLayout = div.offsetWidth === 2; |
1291 support.appendChecked = input.checked; |
1235 |
1292 |
1236 // Check if elements with layout shrink-wrap their children |
1293 support.boxModel = div.offsetWidth === 2; |
1237 // (IE 6 does this) |
1294 |
1238 div.style.display = ""; |
1295 if ( "zoom" in div.style ) { |
1239 div.innerHTML = "<div style='width:4px;'></div>"; |
1296 // Check if natively block-level elements act like inline-block |
1240 jQuery.support.shrinkWrapBlocks = div.offsetWidth !== 2; |
1297 // elements when setting their display to 'inline' and giving |
1241 } |
1298 // them layout |
1242 |
1299 // (IE < 8 does this) |
1243 div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>"; |
1300 div.style.display = "inline"; |
1244 var tds = div.getElementsByTagName("td"); |
1301 div.style.zoom = 1; |
1245 |
1302 support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 ); |
1246 // Check if table cells still have offsetWidth/Height when they are set |
1303 |
1247 // to display:none and there are still other visible table cells in a |
1304 // Check if elements with layout shrink-wrap their children |
1248 // table row; if so, offsetWidth/Height are not reliable for use when |
1305 // (IE 6 does this) |
1249 // determining if an element has been hidden directly using |
1306 div.style.display = ""; |
1250 // display:none (it is still safe to use offsets if a parent element is |
1307 div.innerHTML = "<div style='width:4px;'></div>"; |
1251 // hidden; don safety goggles and see bug #4512 for more information). |
1308 support.shrinkWrapBlocks = ( div.offsetWidth !== 2 ); |
1252 // (only IE 8 fails this test) |
1309 } |
1253 jQuery.support.reliableHiddenOffsets = tds[0].offsetHeight === 0; |
1310 |
1254 |
1311 div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>"; |
1255 tds[0].style.display = ""; |
1312 tds = div.getElementsByTagName( "td" ); |
1256 tds[1].style.display = "none"; |
1313 |
1257 |
1314 // Check if table cells still have offsetWidth/Height when they are set |
1258 // Check if empty table cells still have offsetWidth/Height |
1315 // to display:none and there are still other visible table cells in a |
1259 // (IE < 8 fail this test) |
1316 // table row; if so, offsetWidth/Height are not reliable for use when |
1260 jQuery.support.reliableHiddenOffsets = jQuery.support.reliableHiddenOffsets && tds[0].offsetHeight === 0; |
1317 // determining if an element has been hidden directly using |
1261 div.innerHTML = ""; |
1318 // display:none (it is still safe to use offsets if a parent element is |
1262 |
1319 // hidden; don safety goggles and see bug #4512 for more information). |
1263 body.removeChild( div ).style.display = "none"; |
1320 // (only IE 8 fails this test) |
1264 div = tds = null; |
1321 isSupported = ( tds[ 0 ].offsetHeight === 0 ); |
1265 }); |
1322 |
1323 tds[ 0 ].style.display = ""; |
|
1324 tds[ 1 ].style.display = "none"; |
|
1325 |
|
1326 // Check if empty table cells still have offsetWidth/Height |
|
1327 // (IE < 8 fail this test) |
|
1328 support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); |
|
1329 div.innerHTML = ""; |
|
1330 |
|
1331 // Check if div with explicit width and no margin-right incorrectly |
|
1332 // gets computed margin-right based on width of container. For more |
|
1333 // info see bug #3333 |
|
1334 // Fails in WebKit before Feb 2011 nightlies |
|
1335 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right |
|
1336 if ( document.defaultView && document.defaultView.getComputedStyle ) { |
|
1337 marginDiv = document.createElement( "div" ); |
|
1338 marginDiv.style.width = "0"; |
|
1339 marginDiv.style.marginRight = "0"; |
|
1340 div.appendChild( marginDiv ); |
|
1341 support.reliableMarginRight = |
|
1342 ( parseInt( document.defaultView.getComputedStyle( marginDiv, null ).marginRight, 10 ) || 0 ) === 0; |
|
1343 } |
|
1344 |
|
1345 // Remove the body element we added |
|
1346 body.innerHTML = ""; |
|
1347 document.documentElement.removeChild( body ); |
|
1266 |
1348 |
1267 // Technique from Juriy Zaytsev |
1349 // Technique from Juriy Zaytsev |
1268 // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ |
1350 // http://thinkweb2.com/projects/prototype/detecting-event-support-without-browser-sniffing/ |
1269 var eventSupported = function( eventName ) { |
1351 // We only care about the case where non-standard event systems |
1270 var el = document.createElement("div"); |
1352 // are used, namely in IE. Short-circuiting here helps us to |
1271 eventName = "on" + eventName; |
1353 // avoid an eval call (in setAttribute) which can cause CSP |
1272 |
1354 // to go haywire. See: https://developer.mozilla.org/en/Security/CSP |
1273 // We only care about the case where non-standard event systems |
1355 if ( div.attachEvent ) { |
1274 // are used, namely in IE. Short-circuiting here helps us to |
1356 for( i in { |
1275 // avoid an eval call (in setAttribute) which can cause CSP |
1357 submit: 1, |
1276 // to go haywire. See: https://developer.mozilla.org/en/Security/CSP |
1358 change: 1, |
1277 if ( !el.attachEvent ) { |
1359 focusin: 1 |
1278 return true; |
1360 } ) { |
1279 } |
1361 eventName = "on" + i; |
1280 |
1362 isSupported = ( eventName in div ); |
1281 var isSupported = (eventName in el); |
1363 if ( !isSupported ) { |
1282 if ( !isSupported ) { |
1364 div.setAttribute( eventName, "return;" ); |
1283 el.setAttribute(eventName, "return;"); |
1365 isSupported = ( typeof div[ eventName ] === "function" ); |
1284 isSupported = typeof el[eventName] === "function"; |
1366 } |
1285 } |
1367 support[ i + "Bubbles" ] = isSupported; |
1286 el = null; |
1368 } |
1287 |
1369 } |
1288 return isSupported; |
1370 |
1289 }; |
1371 return support; |
1290 |
|
1291 jQuery.support.submitBubbles = eventSupported("submit"); |
|
1292 jQuery.support.changeBubbles = eventSupported("change"); |
|
1293 |
|
1294 // release memory in IE |
|
1295 div = all = a = null; |
|
1296 })(); |
1372 })(); |
1297 |
1373 |
1298 |
1374 // Keep track of boxModel |
1299 |
1375 jQuery.boxModel = jQuery.support.boxModel; |
1300 var rbrace = /^(?:\{.*\}|\[.*\])$/; |
1376 |
1377 |
|
1378 |
|
1379 |
|
1380 var rbrace = /^(?:\{.*\}|\[.*\])$/, |
|
1381 rmultiDash = /([a-z])([A-Z])/g; |
|
1301 |
1382 |
1302 jQuery.extend({ |
1383 jQuery.extend({ |
1303 cache: {}, |
1384 cache: {}, |
1304 |
1385 |
1305 // Please use with caution |
1386 // Please use with caution |
1319 }, |
1400 }, |
1320 |
1401 |
1321 hasData: function( elem ) { |
1402 hasData: function( elem ) { |
1322 elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; |
1403 elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; |
1323 |
1404 |
1324 return !!elem && !jQuery.isEmptyObject(elem); |
1405 return !!elem && !isEmptyDataObject( elem ); |
1325 }, |
1406 }, |
1326 |
1407 |
1327 data: function( elem, name, data, pvt /* Internal Use Only */ ) { |
1408 data: function( elem, name, data, pvt /* Internal Use Only */ ) { |
1328 if ( !jQuery.acceptData( elem ) ) { |
1409 if ( !jQuery.acceptData( elem ) ) { |
1329 return; |
1410 return; |
1359 } |
1440 } |
1360 } |
1441 } |
1361 |
1442 |
1362 if ( !cache[ id ] ) { |
1443 if ( !cache[ id ] ) { |
1363 cache[ id ] = {}; |
1444 cache[ id ] = {}; |
1445 |
|
1446 // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery |
|
1447 // metadata on plain JS objects when the object is serialized using |
|
1448 // JSON.stringify |
|
1449 if ( !isNode ) { |
|
1450 cache[ id ].toJSON = jQuery.noop; |
|
1451 } |
|
1364 } |
1452 } |
1365 |
1453 |
1366 // An object can be passed to jQuery.data instead of a key/value pair; this gets |
1454 // An object can be passed to jQuery.data instead of a key/value pair; this gets |
1367 // shallow copied over onto the existing cache |
1455 // shallow copied over onto the existing cache |
1368 if ( typeof name === "object" ) { |
1456 if ( typeof name === "object" || typeof name === "function" ) { |
1369 if ( pvt ) { |
1457 if ( pvt ) { |
1370 cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name); |
1458 cache[ id ][ internalKey ] = jQuery.extend(cache[ id ][ internalKey ], name); |
1371 } else { |
1459 } else { |
1372 cache[ id ] = jQuery.extend(cache[ id ], name); |
1460 cache[ id ] = jQuery.extend(cache[ id ], name); |
1373 } |
1461 } |
1425 if ( thisCache ) { |
1513 if ( thisCache ) { |
1426 delete thisCache[ name ]; |
1514 delete thisCache[ name ]; |
1427 |
1515 |
1428 // If there is no data left in the cache, we want to continue |
1516 // If there is no data left in the cache, we want to continue |
1429 // and let the cache object itself get destroyed |
1517 // and let the cache object itself get destroyed |
1430 if ( !jQuery.isEmptyObject(thisCache) ) { |
1518 if ( !isEmptyDataObject(thisCache) ) { |
1431 return; |
1519 return; |
1432 } |
1520 } |
1433 } |
1521 } |
1434 } |
1522 } |
1435 |
1523 |
1437 if ( pvt ) { |
1525 if ( pvt ) { |
1438 delete cache[ id ][ internalKey ]; |
1526 delete cache[ id ][ internalKey ]; |
1439 |
1527 |
1440 // Don't destroy the parent cache unless the internal data object |
1528 // Don't destroy the parent cache unless the internal data object |
1441 // had been the only thing left in it |
1529 // had been the only thing left in it |
1442 if ( !jQuery.isEmptyObject(cache[ id ]) ) { |
1530 if ( !isEmptyDataObject(cache[ id ]) ) { |
1443 return; |
1531 return; |
1444 } |
1532 } |
1445 } |
1533 } |
1446 |
1534 |
1447 var internalCache = cache[ id ][ internalKey ]; |
1535 var internalCache = cache[ id ][ internalKey ]; |
1458 // We destroyed the entire user cache at once because it's faster than |
1546 // We destroyed the entire user cache at once because it's faster than |
1459 // iterating through each key, but we need to continue to persist internal |
1547 // iterating through each key, but we need to continue to persist internal |
1460 // data if it existed |
1548 // data if it existed |
1461 if ( internalCache ) { |
1549 if ( internalCache ) { |
1462 cache[ id ] = {}; |
1550 cache[ id ] = {}; |
1551 // TODO: This is a hack for 1.5 ONLY. Avoids exposing jQuery |
|
1552 // metadata on plain JS objects when the object is serialized using |
|
1553 // JSON.stringify |
|
1554 if ( !isNode ) { |
|
1555 cache[ id ].toJSON = jQuery.noop; |
|
1556 } |
|
1557 |
|
1463 cache[ id ][ internalKey ] = internalCache; |
1558 cache[ id ][ internalKey ] = internalCache; |
1464 |
1559 |
1465 // Otherwise, we need to eliminate the expando on the node to avoid |
1560 // Otherwise, we need to eliminate the expando on the node to avoid |
1466 // false lookups in the cache for entries that no longer exist |
1561 // false lookups in the cache for entries that no longer exist |
1467 } else if ( isNode ) { |
1562 } else if ( isNode ) { |
1504 if ( typeof key === "undefined" ) { |
1599 if ( typeof key === "undefined" ) { |
1505 if ( this.length ) { |
1600 if ( this.length ) { |
1506 data = jQuery.data( this[0] ); |
1601 data = jQuery.data( this[0] ); |
1507 |
1602 |
1508 if ( this[0].nodeType === 1 ) { |
1603 if ( this[0].nodeType === 1 ) { |
1509 var attr = this[0].attributes, name; |
1604 var attr = this[0].attributes, name; |
1510 for ( var i = 0, l = attr.length; i < l; i++ ) { |
1605 for ( var i = 0, l = attr.length; i < l; i++ ) { |
1511 name = attr[i].name; |
1606 name = attr[i].name; |
1512 |
1607 |
1513 if ( name.indexOf( "data-" ) === 0 ) { |
1608 if ( name.indexOf( "data-" ) === 0 ) { |
1514 name = name.substr( 5 ); |
1609 name = jQuery.camelCase( name.substring(5) ); |
1610 |
|
1515 dataAttr( this[0], name, data[ name ] ); |
1611 dataAttr( this[0], name, data[ name ] ); |
1516 } |
1612 } |
1517 } |
1613 } |
1518 } |
1614 } |
1519 } |
1615 } |
1563 |
1659 |
1564 function dataAttr( elem, key, data ) { |
1660 function dataAttr( elem, key, data ) { |
1565 // If nothing was found internally, try to fetch any |
1661 // If nothing was found internally, try to fetch any |
1566 // data from the HTML5 data-* attribute |
1662 // data from the HTML5 data-* attribute |
1567 if ( data === undefined && elem.nodeType === 1 ) { |
1663 if ( data === undefined && elem.nodeType === 1 ) { |
1568 data = elem.getAttribute( "data-" + key ); |
1664 name = "data-" + key.replace( rmultiDash, "$1-$2" ).toLowerCase(); |
1665 |
|
1666 data = elem.getAttribute( name ); |
|
1569 |
1667 |
1570 if ( typeof data === "string" ) { |
1668 if ( typeof data === "string" ) { |
1571 try { |
1669 try { |
1572 data = data === "true" ? true : |
1670 data = data === "true" ? true : |
1573 data === "false" ? false : |
1671 data === "false" ? false : |
1586 } |
1684 } |
1587 |
1685 |
1588 return data; |
1686 return data; |
1589 } |
1687 } |
1590 |
1688 |
1591 |
1689 // TODO: This is a hack for 1.5 ONLY to allow objects with a single toJSON |
1592 |
1690 // property to be considered empty objects; this property always exists in |
1691 // order to make sure JSON.stringify does not expose internal metadata |
|
1692 function isEmptyDataObject( obj ) { |
|
1693 for ( var name in obj ) { |
|
1694 if ( name !== "toJSON" ) { |
|
1695 return false; |
|
1696 } |
|
1697 } |
|
1698 |
|
1699 return true; |
|
1700 } |
|
1701 |
|
1702 |
|
1703 |
|
1704 |
|
1705 function handleQueueMarkDefer( elem, type, src ) { |
|
1706 var deferDataKey = type + "defer", |
|
1707 queueDataKey = type + "queue", |
|
1708 markDataKey = type + "mark", |
|
1709 defer = jQuery.data( elem, deferDataKey, undefined, true ); |
|
1710 if ( defer && |
|
1711 ( src === "queue" || !jQuery.data( elem, queueDataKey, undefined, true ) ) && |
|
1712 ( src === "mark" || !jQuery.data( elem, markDataKey, undefined, true ) ) ) { |
|
1713 // Give room for hard-coded callbacks to fire first |
|
1714 // and eventually mark/queue something else on the element |
|
1715 setTimeout( function() { |
|
1716 if ( !jQuery.data( elem, queueDataKey, undefined, true ) && |
|
1717 !jQuery.data( elem, markDataKey, undefined, true ) ) { |
|
1718 jQuery.removeData( elem, deferDataKey, true ); |
|
1719 defer.resolve(); |
|
1720 } |
|
1721 }, 0 ); |
|
1722 } |
|
1723 } |
|
1593 |
1724 |
1594 jQuery.extend({ |
1725 jQuery.extend({ |
1726 |
|
1727 _mark: function( elem, type ) { |
|
1728 if ( elem ) { |
|
1729 type = (type || "fx") + "mark"; |
|
1730 jQuery.data( elem, type, (jQuery.data(elem,type,undefined,true) || 0) + 1, true ); |
|
1731 } |
|
1732 }, |
|
1733 |
|
1734 _unmark: function( force, elem, type ) { |
|
1735 if ( force !== true ) { |
|
1736 type = elem; |
|
1737 elem = force; |
|
1738 force = false; |
|
1739 } |
|
1740 if ( elem ) { |
|
1741 type = type || "fx"; |
|
1742 var key = type + "mark", |
|
1743 count = force ? 0 : ( (jQuery.data( elem, key, undefined, true) || 1 ) - 1 ); |
|
1744 if ( count ) { |
|
1745 jQuery.data( elem, key, count, true ); |
|
1746 } else { |
|
1747 jQuery.removeData( elem, key, true ); |
|
1748 handleQueueMarkDefer( elem, type, "mark" ); |
|
1749 } |
|
1750 } |
|
1751 }, |
|
1752 |
|
1595 queue: function( elem, type, data ) { |
1753 queue: function( elem, type, data ) { |
1596 if ( !elem ) { |
1754 if ( elem ) { |
1597 return; |
1755 type = (type || "fx") + "queue"; |
1598 } |
1756 var q = jQuery.data( elem, type, undefined, true ); |
1599 |
1757 // Speed up dequeue by getting out quickly if this is just a lookup |
1600 type = (type || "fx") + "queue"; |
1758 if ( data ) { |
1601 var q = jQuery._data( elem, type ); |
1759 if ( !q || jQuery.isArray(data) ) { |
1602 |
1760 q = jQuery.data( elem, type, jQuery.makeArray(data), true ); |
1603 // Speed up dequeue by getting out quickly if this is just a lookup |
1761 } else { |
1604 if ( !data ) { |
1762 q.push( data ); |
1763 } |
|
1764 } |
|
1605 return q || []; |
1765 return q || []; |
1606 } |
1766 } |
1607 |
|
1608 if ( !q || jQuery.isArray(data) ) { |
|
1609 q = jQuery._data( elem, type, jQuery.makeArray(data) ); |
|
1610 |
|
1611 } else { |
|
1612 q.push( data ); |
|
1613 } |
|
1614 |
|
1615 return q; |
|
1616 }, |
1767 }, |
1617 |
1768 |
1618 dequeue: function( elem, type ) { |
1769 dequeue: function( elem, type ) { |
1619 type = type || "fx"; |
1770 type = type || "fx"; |
1620 |
1771 |
1621 var queue = jQuery.queue( elem, type ), |
1772 var queue = jQuery.queue( elem, type ), |
1622 fn = queue.shift(); |
1773 fn = queue.shift(), |
1774 defer; |
|
1623 |
1775 |
1624 // If the fx queue is dequeued, always remove the progress sentinel |
1776 // If the fx queue is dequeued, always remove the progress sentinel |
1625 if ( fn === "inprogress" ) { |
1777 if ( fn === "inprogress" ) { |
1626 fn = queue.shift(); |
1778 fn = queue.shift(); |
1627 } |
1779 } |
1638 }); |
1790 }); |
1639 } |
1791 } |
1640 |
1792 |
1641 if ( !queue.length ) { |
1793 if ( !queue.length ) { |
1642 jQuery.removeData( elem, type + "queue", true ); |
1794 jQuery.removeData( elem, type + "queue", true ); |
1795 handleQueueMarkDefer( elem, type, "queue" ); |
|
1643 } |
1796 } |
1644 } |
1797 } |
1645 }); |
1798 }); |
1646 |
1799 |
1647 jQuery.fn.extend({ |
1800 jQuery.fn.extend({ |
1652 } |
1805 } |
1653 |
1806 |
1654 if ( data === undefined ) { |
1807 if ( data === undefined ) { |
1655 return jQuery.queue( this[0], type ); |
1808 return jQuery.queue( this[0], type ); |
1656 } |
1809 } |
1657 return this.each(function( i ) { |
1810 return this.each(function() { |
1658 var queue = jQuery.queue( this, type, data ); |
1811 var queue = jQuery.queue( this, type, data ); |
1659 |
1812 |
1660 if ( type === "fx" && queue[0] !== "inprogress" ) { |
1813 if ( type === "fx" && queue[0] !== "inprogress" ) { |
1661 jQuery.dequeue( this, type ); |
1814 jQuery.dequeue( this, type ); |
1662 } |
1815 } |
1665 dequeue: function( type ) { |
1818 dequeue: function( type ) { |
1666 return this.each(function() { |
1819 return this.each(function() { |
1667 jQuery.dequeue( this, type ); |
1820 jQuery.dequeue( this, type ); |
1668 }); |
1821 }); |
1669 }, |
1822 }, |
1670 |
|
1671 // Based off of the plugin by Clint Helfers, with permission. |
1823 // Based off of the plugin by Clint Helfers, with permission. |
1672 // http://blindsignals.com/index.php/2009/07/jquery-delay/ |
1824 // http://blindsignals.com/index.php/2009/07/jquery-delay/ |
1673 delay: function( time, type ) { |
1825 delay: function( time, type ) { |
1674 time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; |
1826 time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; |
1675 type = type || "fx"; |
1827 type = type || "fx"; |
1679 setTimeout(function() { |
1831 setTimeout(function() { |
1680 jQuery.dequeue( elem, type ); |
1832 jQuery.dequeue( elem, type ); |
1681 }, time ); |
1833 }, time ); |
1682 }); |
1834 }); |
1683 }, |
1835 }, |
1684 |
|
1685 clearQueue: function( type ) { |
1836 clearQueue: function( type ) { |
1686 return this.queue( type || "fx", [] ); |
1837 return this.queue( type || "fx", [] ); |
1838 }, |
|
1839 // Get a promise resolved when queues of a certain type |
|
1840 // are emptied (fx is the type by default) |
|
1841 promise: function( type, object ) { |
|
1842 if ( typeof type !== "string" ) { |
|
1843 object = type; |
|
1844 type = undefined; |
|
1845 } |
|
1846 type = type || "fx"; |
|
1847 var defer = jQuery.Deferred(), |
|
1848 elements = this, |
|
1849 i = elements.length, |
|
1850 count = 1, |
|
1851 deferDataKey = type + "defer", |
|
1852 queueDataKey = type + "queue", |
|
1853 markDataKey = type + "mark"; |
|
1854 function resolve() { |
|
1855 if ( !( --count ) ) { |
|
1856 defer.resolveWith( elements, [ elements ] ); |
|
1857 } |
|
1858 } |
|
1859 while( i-- ) { |
|
1860 if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || |
|
1861 ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || |
|
1862 jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && |
|
1863 jQuery.data( elements[ i ], deferDataKey, jQuery._Deferred(), true ) )) { |
|
1864 count++; |
|
1865 tmp.done( resolve ); |
|
1866 } |
|
1867 } |
|
1868 resolve(); |
|
1869 return defer.promise(); |
|
1687 } |
1870 } |
1688 }); |
1871 }); |
1689 |
1872 |
1690 |
1873 |
1691 |
1874 |
1692 |
1875 |
1693 var rclass = /[\n\t\r]/g, |
1876 var rclass = /[\n\t\r]/g, |
1694 rspaces = /\s+/, |
1877 rspace = /\s+/, |
1695 rreturn = /\r/g, |
1878 rreturn = /\r/g, |
1696 rspecialurl = /^(?:href|src|style)$/, |
|
1697 rtype = /^(?:button|input)$/i, |
1879 rtype = /^(?:button|input)$/i, |
1698 rfocusable = /^(?:button|input|object|select|textarea)$/i, |
1880 rfocusable = /^(?:button|input|object|select|textarea)$/i, |
1699 rclickable = /^a(?:rea)?$/i, |
1881 rclickable = /^a(?:rea)?$/i, |
1700 rradiocheck = /^(?:radio|checkbox)$/i; |
1882 rspecial = /^(?:data-|aria-)/, |
1701 |
1883 rinvalidChar = /\:/, |
1702 jQuery.props = { |
1884 formHook; |
1703 "for": "htmlFor", |
|
1704 "class": "className", |
|
1705 readonly: "readOnly", |
|
1706 maxlength: "maxLength", |
|
1707 cellspacing: "cellSpacing", |
|
1708 rowspan: "rowSpan", |
|
1709 colspan: "colSpan", |
|
1710 tabindex: "tabIndex", |
|
1711 usemap: "useMap", |
|
1712 frameborder: "frameBorder" |
|
1713 }; |
|
1714 |
1885 |
1715 jQuery.fn.extend({ |
1886 jQuery.fn.extend({ |
1716 attr: function( name, value ) { |
1887 attr: function( name, value ) { |
1717 return jQuery.access( this, name, value, true, jQuery.attr ); |
1888 return jQuery.access( this, name, value, true, jQuery.attr ); |
1718 }, |
1889 }, |
1719 |
1890 |
1720 removeAttr: function( name, fn ) { |
1891 removeAttr: function( name ) { |
1721 return this.each(function(){ |
1892 return this.each(function() { |
1722 jQuery.attr( this, name, "" ); |
1893 jQuery.removeAttr( this, name ); |
1723 if ( this.nodeType === 1 ) { |
|
1724 this.removeAttribute( name ); |
|
1725 } |
|
1726 }); |
1894 }); |
1727 }, |
1895 }, |
1896 |
|
1897 prop: function( name, value ) { |
|
1898 return jQuery.access( this, name, value, true, jQuery.prop ); |
|
1899 }, |
|
1900 |
|
1901 removeProp: function( name ) { |
|
1902 return this.each(function() { |
|
1903 // try/catch handles cases where IE balks (such as removing a property on window) |
|
1904 try { |
|
1905 this[ name ] = undefined; |
|
1906 delete this[ name ]; |
|
1907 } catch( e ) {} |
|
1908 }); |
|
1909 }, |
|
1728 |
1910 |
1729 addClass: function( value ) { |
1911 addClass: function( value ) { |
1730 if ( jQuery.isFunction(value) ) { |
1912 if ( jQuery.isFunction( value ) ) { |
1731 return this.each(function(i) { |
1913 return this.each(function(i) { |
1732 var self = jQuery(this); |
1914 var self = jQuery(this); |
1733 self.addClass( value.call(this, i, self.attr("class")) ); |
1915 self.addClass( value.call(this, i, self.attr("class") || "") ); |
1734 }); |
1916 }); |
1735 } |
1917 } |
1736 |
1918 |
1737 if ( value && typeof value === "string" ) { |
1919 if ( value && typeof value === "string" ) { |
1738 var classNames = (value || "").split( rspaces ); |
1920 var classNames = (value || "").split( rspace ); |
1739 |
1921 |
1740 for ( var i = 0, l = this.length; i < l; i++ ) { |
1922 for ( var i = 0, l = this.length; i < l; i++ ) { |
1741 var elem = this[i]; |
1923 var elem = this[i]; |
1742 |
1924 |
1743 if ( elem.nodeType === 1 ) { |
1925 if ( elem.nodeType === 1 ) { |
1769 self.removeClass( value.call(this, i, self.attr("class")) ); |
1951 self.removeClass( value.call(this, i, self.attr("class")) ); |
1770 }); |
1952 }); |
1771 } |
1953 } |
1772 |
1954 |
1773 if ( (value && typeof value === "string") || value === undefined ) { |
1955 if ( (value && typeof value === "string") || value === undefined ) { |
1774 var classNames = (value || "").split( rspaces ); |
1956 var classNames = (value || "").split( rspace ); |
1775 |
1957 |
1776 for ( var i = 0, l = this.length; i < l; i++ ) { |
1958 for ( var i = 0, l = this.length; i < l; i++ ) { |
1777 var elem = this[i]; |
1959 var elem = this[i]; |
1778 |
1960 |
1779 if ( elem.nodeType === 1 && elem.className ) { |
1961 if ( elem.nodeType === 1 && elem.className ) { |
1810 // toggle individual class names |
1992 // toggle individual class names |
1811 var className, |
1993 var className, |
1812 i = 0, |
1994 i = 0, |
1813 self = jQuery( this ), |
1995 self = jQuery( this ), |
1814 state = stateVal, |
1996 state = stateVal, |
1815 classNames = value.split( rspaces ); |
1997 classNames = value.split( rspace ); |
1816 |
1998 |
1817 while ( (className = classNames[ i++ ]) ) { |
1999 while ( (className = classNames[ i++ ]) ) { |
1818 // check each className given, space seperated list |
2000 // check each className given, space seperated list |
1819 state = isBool ? state : !self.hasClass( className ); |
2001 state = isBool ? state : !self.hasClass( className ); |
1820 self[ state ? "addClass" : "removeClass" ]( className ); |
2002 self[ state ? "addClass" : "removeClass" ]( className ); |
1842 |
2024 |
1843 return false; |
2025 return false; |
1844 }, |
2026 }, |
1845 |
2027 |
1846 val: function( value ) { |
2028 val: function( value ) { |
2029 var hooks, ret, |
|
2030 elem = this[0]; |
|
2031 |
|
1847 if ( !arguments.length ) { |
2032 if ( !arguments.length ) { |
1848 var elem = this[0]; |
|
1849 |
|
1850 if ( elem ) { |
2033 if ( elem ) { |
1851 if ( jQuery.nodeName( elem, "option" ) ) { |
2034 hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; |
1852 // attributes.value is undefined in Blackberry 4.7 but |
2035 |
1853 // uses .value. See #6932 |
2036 if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { |
1854 var val = elem.attributes.value; |
2037 return ret; |
1855 return !val || val.specified ? elem.value : elem.text; |
2038 } |
1856 } |
2039 |
1857 |
|
1858 // We need to handle select boxes special |
|
1859 if ( jQuery.nodeName( elem, "select" ) ) { |
|
1860 var index = elem.selectedIndex, |
|
1861 values = [], |
|
1862 options = elem.options, |
|
1863 one = elem.type === "select-one"; |
|
1864 |
|
1865 // Nothing was selected |
|
1866 if ( index < 0 ) { |
|
1867 return null; |
|
1868 } |
|
1869 |
|
1870 // Loop through all the selected options |
|
1871 for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { |
|
1872 var option = options[ i ]; |
|
1873 |
|
1874 // Don't return options that are disabled or in a disabled optgroup |
|
1875 if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && |
|
1876 (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { |
|
1877 |
|
1878 // Get the specific value for the option |
|
1879 value = jQuery(option).val(); |
|
1880 |
|
1881 // We don't need an array for one selects |
|
1882 if ( one ) { |
|
1883 return value; |
|
1884 } |
|
1885 |
|
1886 // Multi-Selects return an array |
|
1887 values.push( value ); |
|
1888 } |
|
1889 } |
|
1890 |
|
1891 return values; |
|
1892 } |
|
1893 |
|
1894 // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified |
|
1895 if ( rradiocheck.test( elem.type ) && !jQuery.support.checkOn ) { |
|
1896 return elem.getAttribute("value") === null ? "on" : elem.value; |
|
1897 } |
|
1898 |
|
1899 // Everything else, we just grab the value |
|
1900 return (elem.value || "").replace(rreturn, ""); |
2040 return (elem.value || "").replace(rreturn, ""); |
1901 |
|
1902 } |
2041 } |
1903 |
2042 |
1904 return undefined; |
2043 return undefined; |
1905 } |
2044 } |
1906 |
2045 |
1907 var isFunction = jQuery.isFunction(value); |
2046 var isFunction = jQuery.isFunction( value ); |
1908 |
2047 |
1909 return this.each(function(i) { |
2048 return this.each(function( i ) { |
1910 var self = jQuery(this), val = value; |
2049 var self = jQuery(this), val; |
1911 |
2050 |
1912 if ( this.nodeType !== 1 ) { |
2051 if ( this.nodeType !== 1 ) { |
1913 return; |
2052 return; |
1914 } |
2053 } |
1915 |
2054 |
1916 if ( isFunction ) { |
2055 if ( isFunction ) { |
1917 val = value.call(this, i, self.val()); |
2056 val = value.call( this, i, self.val() ); |
2057 } else { |
|
2058 val = value; |
|
1918 } |
2059 } |
1919 |
2060 |
1920 // Treat null/undefined as ""; convert numbers to string |
2061 // Treat null/undefined as ""; convert numbers to string |
1921 if ( val == null ) { |
2062 if ( val == null ) { |
1922 val = ""; |
2063 val = ""; |
1923 } else if ( typeof val === "number" ) { |
2064 } else if ( typeof val === "number" ) { |
1924 val += ""; |
2065 val += ""; |
1925 } else if ( jQuery.isArray(val) ) { |
2066 } else if ( jQuery.isArray( val ) ) { |
1926 val = jQuery.map(val, function (value) { |
2067 val = jQuery.map(val, function ( value ) { |
1927 return value == null ? "" : value + ""; |
2068 return value == null ? "" : value + ""; |
1928 }); |
2069 }); |
1929 } |
2070 } |
1930 |
2071 |
1931 if ( jQuery.isArray(val) && rradiocheck.test( this.type ) ) { |
2072 hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ]; |
1932 this.checked = jQuery.inArray( self.val(), val ) >= 0; |
2073 |
1933 |
2074 // If set returns undefined, fall back to normal setting |
1934 } else if ( jQuery.nodeName( this, "select" ) ) { |
2075 if ( !hooks || ("set" in hooks && hooks.set( this, val, "value" ) === undefined) ) { |
1935 var values = jQuery.makeArray(val); |
2076 this.value = val; |
1936 |
2077 } |
1937 jQuery( "option", this ).each(function() { |
2078 }); |
2079 } |
|
2080 }); |
|
2081 |
|
2082 jQuery.extend({ |
|
2083 valHooks: { |
|
2084 option: { |
|
2085 get: function( elem ) { |
|
2086 // attributes.value is undefined in Blackberry 4.7 but |
|
2087 // uses .value. See #6932 |
|
2088 var val = elem.attributes.value; |
|
2089 return !val || val.specified ? elem.value : elem.text; |
|
2090 } |
|
2091 }, |
|
2092 select: { |
|
2093 get: function( elem ) { |
|
2094 var index = elem.selectedIndex, |
|
2095 values = [], |
|
2096 options = elem.options, |
|
2097 one = elem.type === "select-one"; |
|
2098 |
|
2099 // Nothing was selected |
|
2100 if ( index < 0 ) { |
|
2101 return null; |
|
2102 } |
|
2103 |
|
2104 // Loop through all the selected options |
|
2105 for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) { |
|
2106 var option = options[ i ]; |
|
2107 |
|
2108 // Don't return options that are disabled or in a disabled optgroup |
|
2109 if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && |
|
2110 (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { |
|
2111 |
|
2112 // Get the specific value for the option |
|
2113 value = jQuery( option ).val(); |
|
2114 |
|
2115 // We don't need an array for one selects |
|
2116 if ( one ) { |
|
2117 return value; |
|
2118 } |
|
2119 |
|
2120 // Multi-Selects return an array |
|
2121 values.push( value ); |
|
2122 } |
|
2123 } |
|
2124 |
|
2125 // Fixes Bug #2551 -- select.val() broken in IE after form.reset() |
|
2126 if ( one && !values.length && options.length ) { |
|
2127 return jQuery( options[ index ] ).val(); |
|
2128 } |
|
2129 |
|
2130 return values; |
|
2131 }, |
|
2132 |
|
2133 set: function( elem, value ) { |
|
2134 var values = jQuery.makeArray( value ); |
|
2135 |
|
2136 jQuery(elem).find("option").each(function() { |
|
1938 this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; |
2137 this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; |
1939 }); |
2138 }); |
1940 |
2139 |
1941 if ( !values.length ) { |
2140 if ( !values.length ) { |
1942 this.selectedIndex = -1; |
2141 elem.selectedIndex = -1; |
1943 } |
2142 } |
1944 |
2143 return values; |
1945 } else { |
2144 } |
1946 this.value = val; |
2145 } |
1947 } |
2146 }, |
1948 }); |
2147 |
1949 } |
|
1950 }); |
|
1951 |
|
1952 jQuery.extend({ |
|
1953 attrFn: { |
2148 attrFn: { |
1954 val: true, |
2149 val: true, |
1955 css: true, |
2150 css: true, |
1956 html: true, |
2151 html: true, |
1957 text: true, |
2152 text: true, |
1958 data: true, |
2153 data: true, |
1959 width: true, |
2154 width: true, |
1960 height: true, |
2155 height: true, |
1961 offset: true |
2156 offset: true |
1962 }, |
2157 }, |
1963 |
2158 |
2159 attrFix: { |
|
2160 // Always normalize to ensure hook usage |
|
2161 tabindex: "tabIndex", |
|
2162 readonly: "readOnly" |
|
2163 }, |
|
2164 |
|
1964 attr: function( elem, name, value, pass ) { |
2165 attr: function( elem, name, value, pass ) { |
2166 var nType = elem.nodeType; |
|
2167 |
|
1965 // don't get/set attributes on text, comment and attribute nodes |
2168 // don't get/set attributes on text, comment and attribute nodes |
1966 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || elem.nodeType === 2 ) { |
2169 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { |
1967 return undefined; |
2170 return undefined; |
1968 } |
2171 } |
1969 |
2172 |
1970 if ( pass && name in jQuery.attrFn ) { |
2173 if ( pass && name in jQuery.attrFn ) { |
1971 return jQuery(elem)[name](value); |
2174 return jQuery( elem )[ name ]( value ); |
1972 } |
2175 } |
1973 |
2176 |
1974 var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc( elem ), |
2177 var ret, hooks, |
1975 // Whether we are setting (or getting) |
2178 notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); |
1976 set = value !== undefined; |
2179 |
1977 |
2180 // Normalize the name if needed |
1978 // Try to normalize/fix the name |
2181 name = notxml && jQuery.attrFix[ name ] || name; |
1979 name = notxml && jQuery.props[ name ] || name; |
2182 |
1980 |
2183 // Get the appropriate hook, or the formHook |
1981 // Only do all the following if this is a node (faster for style) |
2184 // if getSetAttribute is not supported and we have form objects in IE6/7 |
2185 hooks = jQuery.attrHooks[ name ] || |
|
2186 ( formHook && (jQuery.nodeName( elem, "form" ) || rinvalidChar.test( name )) ? |
|
2187 formHook : |
|
2188 undefined ); |
|
2189 |
|
2190 if ( value !== undefined ) { |
|
2191 |
|
2192 if ( value === null || (value === false && !rspecial.test( name )) ) { |
|
2193 jQuery.removeAttr( elem, name ); |
|
2194 return undefined; |
|
2195 |
|
2196 } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { |
|
2197 return ret; |
|
2198 |
|
2199 } else { |
|
2200 |
|
2201 // Set boolean attributes to the same name |
|
2202 if ( value === true && !rspecial.test( name ) ) { |
|
2203 value = name; |
|
2204 } |
|
2205 |
|
2206 elem.setAttribute( name, "" + value ); |
|
2207 return value; |
|
2208 } |
|
2209 |
|
2210 } else { |
|
2211 |
|
2212 if ( hooks && "get" in hooks && notxml ) { |
|
2213 return hooks.get( elem, name ); |
|
2214 |
|
2215 } else { |
|
2216 |
|
2217 ret = elem.getAttribute( name ); |
|
2218 |
|
2219 // Non-existent attributes return null, we normalize to undefined |
|
2220 return ret === null ? |
|
2221 undefined : |
|
2222 ret; |
|
2223 } |
|
2224 } |
|
2225 }, |
|
2226 |
|
2227 removeAttr: function( elem, name ) { |
|
1982 if ( elem.nodeType === 1 ) { |
2228 if ( elem.nodeType === 1 ) { |
1983 // These attributes require special treatment |
2229 name = jQuery.attrFix[ name ] || name; |
1984 var special = rspecialurl.test( name ); |
2230 |
1985 |
2231 if ( jQuery.support.getSetAttribute ) { |
1986 // Safari mis-reports the default selected property of an option |
2232 // Use removeAttribute in browsers that support it |
1987 // Accessing the parent's selectedIndex property fixes it |
2233 elem.removeAttribute( name ); |
1988 if ( name === "selected" && !jQuery.support.optSelected ) { |
2234 } else { |
1989 var parent = elem.parentNode; |
2235 jQuery.attr( elem, name, "" ); |
1990 if ( parent ) { |
2236 elem.removeAttributeNode( elem.getAttributeNode( name ) ); |
1991 parent.selectedIndex; |
2237 } |
1992 |
2238 } |
1993 // Make sure that it also works with optgroups, see #5701 |
2239 }, |
1994 if ( parent.parentNode ) { |
2240 |
1995 parent.parentNode.selectedIndex; |
2241 attrHooks: { |
1996 } |
2242 type: { |
1997 } |
2243 set: function( elem, value ) { |
1998 } |
2244 // We can't allow the type property to be changed (since it causes problems in IE) |
1999 |
2245 if ( rtype.test( elem.nodeName ) && elem.parentNode ) { |
2000 // If applicable, access the attribute via the DOM 0 way |
2246 jQuery.error( "type property can't be changed" ); |
2001 // 'in' checks fail in Blackberry 4.7 #6931 |
2247 } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { |
2002 if ( (name in elem || elem[ name ] !== undefined) && notxml && !special ) { |
2248 // Setting the type on a radio button after the value resets the value in IE6-9 |
2003 if ( set ) { |
2249 // Reset value to it's default in case type is set after value |
2004 // We can't allow the type property to be changed (since it causes problems in IE) |
2250 // This is for element creation |
2005 if ( name === "type" && rtype.test( elem.nodeName ) && elem.parentNode ) { |
2251 var val = elem.getAttribute("value"); |
2006 jQuery.error( "type property can't be changed" ); |
2252 elem.setAttribute( "type", value ); |
2007 } |
2253 if ( val ) { |
2008 |
2254 elem.value = val; |
2009 if ( value === null ) { |
2255 } |
2010 if ( elem.nodeType === 1 ) { |
2256 return value; |
2011 elem.removeAttribute( name ); |
2257 } |
2012 } |
2258 } |
2013 |
2259 }, |
2014 } else { |
2260 tabIndex: { |
2015 elem[ name ] = value; |
2261 get: function( elem ) { |
2016 } |
|
2017 } |
|
2018 |
|
2019 // browsers index elements by id/name on forms, give priority to attributes. |
|
2020 if ( jQuery.nodeName( elem, "form" ) && elem.getAttributeNode(name) ) { |
|
2021 return elem.getAttributeNode( name ).nodeValue; |
|
2022 } |
|
2023 |
|
2024 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set |
2262 // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set |
2025 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ |
2263 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ |
2026 if ( name === "tabIndex" ) { |
2264 var attributeNode = elem.getAttributeNode("tabIndex"); |
2027 var attributeNode = elem.getAttributeNode( "tabIndex" ); |
2265 |
2028 |
2266 return attributeNode && attributeNode.specified ? |
2029 return attributeNode && attributeNode.specified ? |
2267 parseInt( attributeNode.value, 10 ) : |
2030 attributeNode.value : |
2268 rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? |
2031 rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? |
2269 0 : |
2032 0 : |
2270 undefined; |
2033 undefined; |
2271 } |
2034 } |
2272 } |
2035 |
2273 }, |
2274 |
|
2275 propFix: {}, |
|
2276 |
|
2277 prop: function( elem, name, value ) { |
|
2278 var nType = elem.nodeType; |
|
2279 |
|
2280 // don't get/set properties on text, comment and attribute nodes |
|
2281 if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { |
|
2282 return undefined; |
|
2283 } |
|
2284 |
|
2285 var ret, hooks, |
|
2286 notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); |
|
2287 |
|
2288 // Try to normalize/fix the name |
|
2289 name = notxml && jQuery.propFix[ name ] || name; |
|
2290 |
|
2291 hooks = jQuery.propHooks[ name ]; |
|
2292 |
|
2293 if ( value !== undefined ) { |
|
2294 if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { |
|
2295 return ret; |
|
2296 |
|
2297 } else { |
|
2298 return (elem[ name ] = value); |
|
2299 } |
|
2300 |
|
2301 } else { |
|
2302 if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== undefined ) { |
|
2303 return ret; |
|
2304 |
|
2305 } else { |
|
2036 return elem[ name ]; |
2306 return elem[ name ]; |
2037 } |
2307 } |
2038 |
2308 } |
2039 if ( !jQuery.support.style && notxml && name === "style" ) { |
2309 }, |
2040 if ( set ) { |
2310 |
2041 elem.style.cssText = "" + value; |
2311 propHooks: {} |
2042 } |
|
2043 |
|
2044 return elem.style.cssText; |
|
2045 } |
|
2046 |
|
2047 if ( set ) { |
|
2048 // convert the value to a string (all browsers do this but IE) see #1070 |
|
2049 elem.setAttribute( name, "" + value ); |
|
2050 } |
|
2051 |
|
2052 // Ensure that missing attributes return undefined |
|
2053 // Blackberry 4.7 returns "" from getAttribute #6938 |
|
2054 if ( !elem.attributes[ name ] && (elem.hasAttribute && !elem.hasAttribute( name )) ) { |
|
2055 return undefined; |
|
2056 } |
|
2057 |
|
2058 var attr = !jQuery.support.hrefNormalized && notxml && special ? |
|
2059 // Some attributes require a special call on IE |
|
2060 elem.getAttribute( name, 2 ) : |
|
2061 elem.getAttribute( name ); |
|
2062 |
|
2063 // Non-existent attributes return null, we normalize to undefined |
|
2064 return attr === null ? undefined : attr; |
|
2065 } |
|
2066 // Handle everything which isn't a DOM element node |
|
2067 if ( set ) { |
|
2068 elem[ name ] = value; |
|
2069 } |
|
2070 return elem[ name ]; |
|
2071 } |
|
2072 }); |
2312 }); |
2073 |
2313 |
2074 |
2314 // IE6/7 do not support getting/setting some attributes with get/setAttribute |
2075 |
2315 if ( !jQuery.support.getSetAttribute ) { |
2076 |
2316 jQuery.attrFix = jQuery.extend( jQuery.attrFix, { |
2077 var rnamespaces = /\.(.*)$/, |
2317 "for": "htmlFor", |
2318 "class": "className", |
|
2319 maxlength: "maxLength", |
|
2320 cellspacing: "cellSpacing", |
|
2321 cellpadding: "cellPadding", |
|
2322 rowspan: "rowSpan", |
|
2323 colspan: "colSpan", |
|
2324 usemap: "useMap", |
|
2325 frameborder: "frameBorder" |
|
2326 }); |
|
2327 |
|
2328 // Use this for any attribute on a form in IE6/7 |
|
2329 formHook = jQuery.attrHooks.name = jQuery.attrHooks.value = jQuery.valHooks.button = { |
|
2330 get: function( elem, name ) { |
|
2331 var ret; |
|
2332 if ( name === "value" && !jQuery.nodeName( elem, "button" ) ) { |
|
2333 return elem.getAttribute( name ); |
|
2334 } |
|
2335 ret = elem.getAttributeNode( name ); |
|
2336 // Return undefined if not specified instead of empty string |
|
2337 return ret && ret.specified ? |
|
2338 ret.nodeValue : |
|
2339 undefined; |
|
2340 }, |
|
2341 set: function( elem, value, name ) { |
|
2342 // Check form objects in IE (multiple bugs related) |
|
2343 // Only use nodeValue if the attribute node exists on the form |
|
2344 var ret = elem.getAttributeNode( name ); |
|
2345 if ( ret ) { |
|
2346 ret.nodeValue = value; |
|
2347 return value; |
|
2348 } |
|
2349 } |
|
2350 }; |
|
2351 |
|
2352 // Set width and height to auto instead of 0 on empty string( Bug #8150 ) |
|
2353 // This is for removals |
|
2354 jQuery.each([ "width", "height" ], function( i, name ) { |
|
2355 jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { |
|
2356 set: function( elem, value ) { |
|
2357 if ( value === "" ) { |
|
2358 elem.setAttribute( name, "auto" ); |
|
2359 return value; |
|
2360 } |
|
2361 } |
|
2362 }); |
|
2363 }); |
|
2364 } |
|
2365 |
|
2366 |
|
2367 // Some attributes require a special call on IE |
|
2368 if ( !jQuery.support.hrefNormalized ) { |
|
2369 jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { |
|
2370 jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { |
|
2371 get: function( elem ) { |
|
2372 var ret = elem.getAttribute( name, 2 ); |
|
2373 return ret === null ? undefined : ret; |
|
2374 } |
|
2375 }); |
|
2376 }); |
|
2377 } |
|
2378 |
|
2379 if ( !jQuery.support.style ) { |
|
2380 jQuery.attrHooks.style = { |
|
2381 get: function( elem ) { |
|
2382 // Return undefined in the case of empty string |
|
2383 // Normalize to lowercase since IE uppercases css property names |
|
2384 return elem.style.cssText.toLowerCase() || undefined; |
|
2385 }, |
|
2386 set: function( elem, value ) { |
|
2387 return (elem.style.cssText = "" + value); |
|
2388 } |
|
2389 }; |
|
2390 } |
|
2391 |
|
2392 // Safari mis-reports the default selected property of an option |
|
2393 // Accessing the parent's selectedIndex property fixes it |
|
2394 if ( !jQuery.support.optSelected ) { |
|
2395 jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { |
|
2396 get: function( elem ) { |
|
2397 var parent = elem.parentNode; |
|
2398 |
|
2399 if ( parent ) { |
|
2400 parent.selectedIndex; |
|
2401 |
|
2402 // Make sure that it also works with optgroups, see #5701 |
|
2403 if ( parent.parentNode ) { |
|
2404 parent.parentNode.selectedIndex; |
|
2405 } |
|
2406 } |
|
2407 } |
|
2408 }); |
|
2409 } |
|
2410 |
|
2411 // Radios and checkboxes getter/setter |
|
2412 if ( !jQuery.support.checkOn ) { |
|
2413 jQuery.each([ "radio", "checkbox" ], function() { |
|
2414 jQuery.valHooks[ this ] = { |
|
2415 get: function( elem ) { |
|
2416 // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified |
|
2417 return elem.getAttribute("value") === null ? "on" : elem.value; |
|
2418 } |
|
2419 }; |
|
2420 }); |
|
2421 } |
|
2422 jQuery.each([ "radio", "checkbox" ], function() { |
|
2423 jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { |
|
2424 set: function( elem, value ) { |
|
2425 if ( jQuery.isArray( value ) ) { |
|
2426 return (elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0); |
|
2427 } |
|
2428 } |
|
2429 }); |
|
2430 }); |
|
2431 |
|
2432 |
|
2433 |
|
2434 |
|
2435 var hasOwn = Object.prototype.hasOwnProperty, |
|
2436 rnamespaces = /\.(.*)$/, |
|
2078 rformElems = /^(?:textarea|input|select)$/i, |
2437 rformElems = /^(?:textarea|input|select)$/i, |
2079 rperiod = /\./g, |
2438 rperiod = /\./g, |
2080 rspace = / /g, |
2439 rspaces = / /g, |
2081 rescape = /[^\w\s.|`]/g, |
2440 rescape = /[^\w\s.|`]/g, |
2082 fcleanup = function( nm ) { |
2441 fcleanup = function( nm ) { |
2083 return nm.replace(rescape, "\\$&"); |
2442 return nm.replace(rescape, "\\$&"); |
2084 }, |
2443 }; |
2085 eventKey = "events"; |
|
2086 |
2444 |
2087 /* |
2445 /* |
2088 * A number of helper functions used for managing events. |
2446 * A number of helper functions used for managing events. |
2089 * Many of the ideas behind this code originated from |
2447 * Many of the ideas behind this code originated from |
2090 * Dean Edwards' addEvent library. |
2448 * Dean Edwards' addEvent library. |
2096 add: function( elem, types, handler, data ) { |
2454 add: function( elem, types, handler, data ) { |
2097 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { |
2455 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { |
2098 return; |
2456 return; |
2099 } |
2457 } |
2100 |
2458 |
2101 // For whatever reason, IE has trouble passing the window object |
|
2102 // around, causing it to be cloned in the process |
|
2103 if ( jQuery.isWindow( elem ) && ( elem !== window && !elem.frameElement ) ) { |
|
2104 elem = window; |
|
2105 } |
|
2106 |
|
2107 if ( handler === false ) { |
2459 if ( handler === false ) { |
2108 handler = returnFalse; |
2460 handler = returnFalse; |
2109 } else if ( !handler ) { |
2461 } else if ( !handler ) { |
2110 // Fixes bug #7229. Fix recommended by jdalton |
2462 // Fixes bug #7229. Fix recommended by jdalton |
2111 return; |
2463 return; |
2112 } |
2464 } |
2113 |
2465 |
2114 var handleObjIn, handleObj; |
2466 var handleObjIn, handleObj; |
2115 |
2467 |
2116 if ( handler.handler ) { |
2468 if ( handler.handler ) { |
2130 // banned noData elements |
2482 // banned noData elements |
2131 if ( !elemData ) { |
2483 if ( !elemData ) { |
2132 return; |
2484 return; |
2133 } |
2485 } |
2134 |
2486 |
2135 var events = elemData[ eventKey ], |
2487 var events = elemData.events, |
2136 eventHandle = elemData.handle; |
2488 eventHandle = elemData.handle; |
2137 |
2489 |
2138 if ( typeof events === "function" ) { |
2490 if ( !events ) { |
2139 // On plain objects events is a fn that holds the the data |
|
2140 // which prevents this data from being JSON serialized |
|
2141 // the function does not need to be called, it just contains the data |
|
2142 eventHandle = events.handle; |
|
2143 events = events.events; |
|
2144 |
|
2145 } else if ( !events ) { |
|
2146 if ( !elem.nodeType ) { |
|
2147 // On plain objects, create a fn that acts as the holder |
|
2148 // of the values to avoid JSON serialization of event data |
|
2149 elemData[ eventKey ] = elemData = function(){}; |
|
2150 } |
|
2151 |
|
2152 elemData.events = events = {}; |
2491 elemData.events = events = {}; |
2153 } |
2492 } |
2154 |
2493 |
2155 if ( !eventHandle ) { |
2494 if ( !eventHandle ) { |
2156 elemData.handle = eventHandle = function() { |
2495 elemData.handle = eventHandle = function( e ) { |
2157 // Handle the second event of a trigger and when |
2496 // Discard the second event of a jQuery.event.trigger() and |
2158 // an event is called after a page has unloaded |
2497 // when an event is called after a page has unloaded |
2159 return typeof jQuery !== "undefined" && !jQuery.event.triggered ? |
2498 return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? |
2160 jQuery.event.handle.apply( eventHandle.elem, arguments ) : |
2499 jQuery.event.handle.apply( eventHandle.elem, arguments ) : |
2161 undefined; |
2500 undefined; |
2162 }; |
2501 }; |
2163 } |
2502 } |
2164 |
2503 |
2224 } |
2563 } |
2225 |
2564 |
2226 // Add the function to the element's handler list |
2565 // Add the function to the element's handler list |
2227 handlers.push( handleObj ); |
2566 handlers.push( handleObj ); |
2228 |
2567 |
2229 // Keep track of which events have been used, for global triggering |
2568 // Keep track of which events have been used, for event optimization |
2230 jQuery.event.global[ type ] = true; |
2569 jQuery.event.global[ type ] = true; |
2231 } |
2570 } |
2232 |
2571 |
2233 // Nullify elem to prevent memory leaks in IE |
2572 // Nullify elem to prevent memory leaks in IE |
2234 elem = null; |
2573 elem = null; |
2247 handler = returnFalse; |
2586 handler = returnFalse; |
2248 } |
2587 } |
2249 |
2588 |
2250 var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType, |
2589 var ret, type, fn, j, i = 0, all, namespaces, namespace, special, eventType, handleObj, origType, |
2251 elemData = jQuery.hasData( elem ) && jQuery._data( elem ), |
2590 elemData = jQuery.hasData( elem ) && jQuery._data( elem ), |
2252 events = elemData && elemData[ eventKey ]; |
2591 events = elemData && elemData.events; |
2253 |
2592 |
2254 if ( !elemData || !events ) { |
2593 if ( !elemData || !events ) { |
2255 return; |
2594 return; |
2256 } |
|
2257 |
|
2258 if ( typeof events === "function" ) { |
|
2259 elemData = events; |
|
2260 events = events.events; |
|
2261 } |
2595 } |
2262 |
2596 |
2263 // types is actually an event object here |
2597 // types is actually an event object here |
2264 if ( types && types.type ) { |
2598 if ( types && types.type ) { |
2265 handler = types.handler; |
2599 handler = types.handler; |
2357 } |
2691 } |
2358 |
2692 |
2359 delete elemData.events; |
2693 delete elemData.events; |
2360 delete elemData.handle; |
2694 delete elemData.handle; |
2361 |
2695 |
2362 if ( typeof elemData === "function" ) { |
2696 if ( jQuery.isEmptyObject( elemData ) ) { |
2363 jQuery.removeData( elem, eventKey, true ); |
|
2364 |
|
2365 } else if ( jQuery.isEmptyObject( elemData ) ) { |
|
2366 jQuery.removeData( elem, undefined, true ); |
2697 jQuery.removeData( elem, undefined, true ); |
2367 } |
2698 } |
2368 } |
2699 } |
2369 }, |
2700 }, |
2370 |
2701 |
2371 // bubbling is internal |
2702 // Events that are safe to short-circuit if no handlers are attached. |
2372 trigger: function( event, data, elem /*, bubbling */ ) { |
2703 // Native DOM events should not be added, they may have inline handlers. |
2704 customEvent: { |
|
2705 "getData": true, |
|
2706 "setData": true, |
|
2707 "changeData": true |
|
2708 }, |
|
2709 |
|
2710 trigger: function( event, data, elem, onlyHandlers ) { |
|
2373 // Event object or event type |
2711 // Event object or event type |
2374 var type = event.type || event, |
2712 var type = event.type || event, |
2375 bubbling = arguments[3]; |
2713 namespaces = [], |
2376 |
2714 exclusive; |
2377 if ( !bubbling ) { |
2715 |
2378 event = typeof event === "object" ? |
2716 if ( type.indexOf("!") >= 0 ) { |
2379 // jQuery.Event object |
2717 // Exclusive events trigger only for the exact event (no namespaces) |
2380 event[ jQuery.expando ] ? event : |
2718 type = type.slice(0, -1); |
2381 // Object literal |
2719 exclusive = true; |
2382 jQuery.extend( jQuery.Event(type), event ) : |
2720 } |
2383 // Just the event type (string) |
2721 |
2384 jQuery.Event(type); |
2722 if ( type.indexOf(".") >= 0 ) { |
2385 |
2723 // Namespaced trigger; create a regexp to match event type in handle() |
2386 if ( type.indexOf("!") >= 0 ) { |
2724 namespaces = type.split("."); |
2387 event.type = type = type.slice(0, -1); |
2725 type = namespaces.shift(); |
2388 event.exclusive = true; |
2726 namespaces.sort(); |
2389 } |
2727 } |
2390 |
2728 |
2391 // Handle a global trigger |
2729 if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { |
2392 if ( !elem ) { |
2730 // No jQuery handlers for this event type, and it can't have inline handlers |
2393 // Don't bubble custom events when global (to avoid too much overhead) |
2731 return; |
2394 event.stopPropagation(); |
2732 } |
2395 |
2733 |
2396 // Only trigger if we've ever bound an event for it |
2734 // Caller can pass in an Event, Object, or just an event type string |
2397 if ( jQuery.event.global[ type ] ) { |
2735 event = typeof event === "object" ? |
2398 // XXX This code smells terrible. event.js should not be directly |
2736 // jQuery.Event object |
2399 // inspecting the data cache |
2737 event[ jQuery.expando ] ? event : |
2400 jQuery.each( jQuery.cache, function() { |
2738 // Object literal |
2401 // internalKey variable is just used to make it easier to find |
2739 new jQuery.Event( type, event ) : |
2402 // and potentially change this stuff later; currently it just |
2740 // Just the event type (string) |
2403 // points to jQuery.expando |
2741 new jQuery.Event( type ); |
2404 var internalKey = jQuery.expando, |
2742 |
2405 internalCache = this[ internalKey ]; |
2743 event.type = type; |
2406 if ( internalCache && internalCache.events && internalCache.events[type] ) { |
2744 event.exclusive = exclusive; |
2407 jQuery.event.trigger( event, data, internalCache.handle.elem ); |
2745 event.namespace = namespaces.join("."); |
2746 event.namespace_re = new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)"); |
|
2747 |
|
2748 // triggerHandler() and global events don't bubble or run the default action |
|
2749 if ( onlyHandlers || !elem ) { |
|
2750 event.preventDefault(); |
|
2751 event.stopPropagation(); |
|
2752 } |
|
2753 |
|
2754 // Handle a global trigger |
|
2755 if ( !elem ) { |
|
2756 // TODO: Stop taunting the data cache; remove global events and always attach to document |
|
2757 jQuery.each( jQuery.cache, function() { |
|
2758 // internalKey variable is just used to make it easier to find |
|
2759 // and potentially change this stuff later; currently it just |
|
2760 // points to jQuery.expando |
|
2761 var internalKey = jQuery.expando, |
|
2762 internalCache = this[ internalKey ]; |
|
2763 if ( internalCache && internalCache.events && internalCache.events[ type ] ) { |
|
2764 jQuery.event.trigger( event, data, internalCache.handle.elem ); |
|
2765 } |
|
2766 }); |
|
2767 return; |
|
2768 } |
|
2769 |
|
2770 // Don't do events on text and comment nodes |
|
2771 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { |
|
2772 return; |
|
2773 } |
|
2774 |
|
2775 // Clean up the event in case it is being reused |
|
2776 event.result = undefined; |
|
2777 event.target = elem; |
|
2778 |
|
2779 // Clone any incoming data and prepend the event, creating the handler arg list |
|
2780 data = data ? jQuery.makeArray( data ) : []; |
|
2781 data.unshift( event ); |
|
2782 |
|
2783 var cur = elem, |
|
2784 // IE doesn't like method names with a colon (#3533, #8272) |
|
2785 ontype = type.indexOf(":") < 0 ? "on" + type : ""; |
|
2786 |
|
2787 // Fire event on the current element, then bubble up the DOM tree |
|
2788 do { |
|
2789 var handle = jQuery._data( cur, "handle" ); |
|
2790 |
|
2791 event.currentTarget = cur; |
|
2792 if ( handle ) { |
|
2793 handle.apply( cur, data ); |
|
2794 } |
|
2795 |
|
2796 // Trigger an inline bound script |
|
2797 if ( ontype && jQuery.acceptData( cur ) && cur[ ontype ] && cur[ ontype ].apply( cur, data ) === false ) { |
|
2798 event.result = false; |
|
2799 event.preventDefault(); |
|
2800 } |
|
2801 |
|
2802 // Bubble up to document, then to window |
|
2803 cur = cur.parentNode || cur.ownerDocument || cur === event.target.ownerDocument && window; |
|
2804 } while ( cur && !event.isPropagationStopped() ); |
|
2805 |
|
2806 // If nobody prevented the default action, do it now |
|
2807 if ( !event.isDefaultPrevented() ) { |
|
2808 var old, |
|
2809 special = jQuery.event.special[ type ] || {}; |
|
2810 |
|
2811 if ( (!special._default || special._default.call( elem.ownerDocument, event ) === false) && |
|
2812 !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { |
|
2813 |
|
2814 // Call a native DOM method on the target with the same name name as the event. |
|
2815 // Can't use an .isFunction)() check here because IE6/7 fails that test. |
|
2816 // IE<9 dies on focus to hidden element (#1486), may want to revisit a try/catch. |
|
2817 try { |
|
2818 if ( ontype && elem[ type ] ) { |
|
2819 // Don't re-trigger an onFOO event when we call its FOO() method |
|
2820 old = elem[ ontype ]; |
|
2821 |
|
2822 if ( old ) { |
|
2823 elem[ ontype ] = null; |
|
2408 } |
2824 } |
2409 }); |
2825 |
2410 } |
2826 jQuery.event.triggered = type; |
2411 } |
2827 elem[ type ](); |
2412 |
2828 } |
2413 // Handle triggering a single element |
2829 } catch ( ieError ) {} |
2414 |
|
2415 // don't do events on text and comment nodes |
|
2416 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 ) { |
|
2417 return undefined; |
|
2418 } |
|
2419 |
|
2420 // Clean up in case it is reused |
|
2421 event.result = undefined; |
|
2422 event.target = elem; |
|
2423 |
|
2424 // Clone the incoming data, if any |
|
2425 data = jQuery.makeArray( data ); |
|
2426 data.unshift( event ); |
|
2427 } |
|
2428 |
|
2429 event.currentTarget = elem; |
|
2430 |
|
2431 // Trigger the event, it is assumed that "handle" is a function |
|
2432 var handle = elem.nodeType ? |
|
2433 jQuery._data( elem, "handle" ) : |
|
2434 (jQuery._data( elem, eventKey ) || {}).handle; |
|
2435 |
|
2436 if ( handle ) { |
|
2437 handle.apply( elem, data ); |
|
2438 } |
|
2439 |
|
2440 var parent = elem.parentNode || elem.ownerDocument; |
|
2441 |
|
2442 // Trigger an inline bound script |
|
2443 try { |
|
2444 if ( !(elem && elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) ) { |
|
2445 if ( elem[ "on" + type ] && elem[ "on" + type ].apply( elem, data ) === false ) { |
|
2446 event.result = false; |
|
2447 event.preventDefault(); |
|
2448 } |
|
2449 } |
|
2450 |
|
2451 // prevent IE from throwing an error for some elements with some event types, see #3533 |
|
2452 } catch (inlineError) {} |
|
2453 |
|
2454 if ( !event.isPropagationStopped() && parent ) { |
|
2455 jQuery.event.trigger( event, data, parent, true ); |
|
2456 |
|
2457 } else if ( !event.isDefaultPrevented() ) { |
|
2458 var old, |
|
2459 target = event.target, |
|
2460 targetType = type.replace( rnamespaces, "" ), |
|
2461 isClick = jQuery.nodeName( target, "a" ) && targetType === "click", |
|
2462 special = jQuery.event.special[ targetType ] || {}; |
|
2463 |
|
2464 if ( (!special._default || special._default.call( elem, event ) === false) && |
|
2465 !isClick && !(target && target.nodeName && jQuery.noData[target.nodeName.toLowerCase()]) ) { |
|
2466 |
|
2467 try { |
|
2468 if ( target[ targetType ] ) { |
|
2469 // Make sure that we don't accidentally re-trigger the onFOO events |
|
2470 old = target[ "on" + targetType ]; |
|
2471 |
|
2472 if ( old ) { |
|
2473 target[ "on" + targetType ] = null; |
|
2474 } |
|
2475 |
|
2476 jQuery.event.triggered = true; |
|
2477 target[ targetType ](); |
|
2478 } |
|
2479 |
|
2480 // prevent IE from throwing an error for some elements with some event types, see #3533 |
|
2481 } catch (triggerError) {} |
|
2482 |
2830 |
2483 if ( old ) { |
2831 if ( old ) { |
2484 target[ "on" + targetType ] = old; |
2832 elem[ ontype ] = old; |
2485 } |
2833 } |
2486 |
2834 |
2487 jQuery.event.triggered = false; |
2835 jQuery.event.triggered = undefined; |
2488 } |
2836 } |
2489 } |
2837 } |
2838 |
|
2839 return event.result; |
|
2490 }, |
2840 }, |
2491 |
2841 |
2492 handle: function( event ) { |
2842 handle: function( event ) { |
2493 var all, handlers, namespaces, namespace_re, events, |
2843 event = jQuery.event.fix( event || window.event ); |
2494 namespace_sort = [], |
2844 // Snapshot the handlers list since a called handler may add/remove events. |
2495 args = jQuery.makeArray( arguments ); |
2845 var handlers = ((jQuery._data( this, "events" ) || {})[ event.type ] || []).slice(0), |
2496 |
2846 run_all = !event.exclusive && !event.namespace, |
2497 event = args[0] = jQuery.event.fix( event || window.event ); |
2847 args = Array.prototype.slice.call( arguments, 0 ); |
2848 |
|
2849 // Use the fix-ed Event rather than the (read-only) native event |
|
2850 args[0] = event; |
|
2498 event.currentTarget = this; |
2851 event.currentTarget = this; |
2499 |
2852 |
2500 // Namespaced event handlers |
2853 for ( var j = 0, l = handlers.length; j < l; j++ ) { |
2501 all = event.type.indexOf(".") < 0 && !event.exclusive; |
2854 var handleObj = handlers[ j ]; |
2502 |
2855 |
2503 if ( !all ) { |
2856 // Triggered event must 1) be non-exclusive and have no namespace, or |
2504 namespaces = event.type.split("."); |
2857 // 2) have namespace(s) a subset or equal to those in the bound event. |
2505 event.type = namespaces.shift(); |
2858 if ( run_all || event.namespace_re.test( handleObj.namespace ) ) { |
2506 namespace_sort = namespaces.slice(0).sort(); |
2859 // Pass in a reference to the handler function itself |
2507 namespace_re = new RegExp("(^|\\.)" + namespace_sort.join("\\.(?:.*\\.)?") + "(\\.|$)"); |
2860 // So that we can later remove it |
2508 } |
2861 event.handler = handleObj.handler; |
2509 |
2862 event.data = handleObj.data; |
2510 event.namespace = event.namespace || namespace_sort.join("."); |
2863 event.handleObj = handleObj; |
2511 |
2864 |
2512 events = jQuery._data(this, eventKey); |
2865 var ret = handleObj.handler.apply( this, args ); |
2513 |
2866 |
2514 if ( typeof events === "function" ) { |
2867 if ( ret !== undefined ) { |
2515 events = events.events; |
2868 event.result = ret; |
2516 } |
2869 if ( ret === false ) { |
2517 |
2870 event.preventDefault(); |
2518 handlers = (events || {})[ event.type ]; |
2871 event.stopPropagation(); |
2519 |
2872 } |
2520 if ( events && handlers ) { |
2873 } |
2521 // Clone the handlers to prevent manipulation |
2874 |
2522 handlers = handlers.slice(0); |
2875 if ( event.isImmediatePropagationStopped() ) { |
2523 |
2876 break; |
2524 for ( var j = 0, l = handlers.length; j < l; j++ ) { |
2877 } |
2525 var handleObj = handlers[ j ]; |
2878 } |
2526 |
2879 } |
2527 // Filter the functions by class |
|
2528 if ( all || namespace_re.test( handleObj.namespace ) ) { |
|
2529 // Pass in a reference to the handler function itself |
|
2530 // So that we can later remove it |
|
2531 event.handler = handleObj.handler; |
|
2532 event.data = handleObj.data; |
|
2533 event.handleObj = handleObj; |
|
2534 |
|
2535 var ret = handleObj.handler.apply( this, args ); |
|
2536 |
|
2537 if ( ret !== undefined ) { |
|
2538 event.result = ret; |
|
2539 if ( ret === false ) { |
|
2540 event.preventDefault(); |
|
2541 event.stopPropagation(); |
|
2542 } |
|
2543 } |
|
2544 |
|
2545 if ( event.isImmediatePropagationStopped() ) { |
|
2546 break; |
|
2547 } |
|
2548 } |
|
2549 } |
|
2550 } |
|
2551 |
|
2552 return event.result; |
2880 return event.result; |
2553 }, |
2881 }, |
2554 |
2882 |
2555 props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), |
2883 props: "altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), |
2556 |
2884 |
2585 event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement; |
2913 event.relatedTarget = event.fromElement === event.target ? event.toElement : event.fromElement; |
2586 } |
2914 } |
2587 |
2915 |
2588 // Calculate pageX/Y if missing and clientX/Y available |
2916 // Calculate pageX/Y if missing and clientX/Y available |
2589 if ( event.pageX == null && event.clientX != null ) { |
2917 if ( event.pageX == null && event.clientX != null ) { |
2590 var doc = document.documentElement, |
2918 var eventDocument = event.target.ownerDocument || document, |
2591 body = document.body; |
2919 doc = eventDocument.documentElement, |
2920 body = eventDocument.body; |
|
2592 |
2921 |
2593 event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); |
2922 event.pageX = event.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0); |
2594 event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); |
2923 event.pageY = event.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0); |
2595 } |
2924 } |
2596 |
2925 |
2665 if ( elem.detachEvent ) { |
2994 if ( elem.detachEvent ) { |
2666 elem.detachEvent( "on" + type, handle ); |
2995 elem.detachEvent( "on" + type, handle ); |
2667 } |
2996 } |
2668 }; |
2997 }; |
2669 |
2998 |
2670 jQuery.Event = function( src ) { |
2999 jQuery.Event = function( src, props ) { |
2671 // Allow instantiation without the 'new' keyword |
3000 // Allow instantiation without the 'new' keyword |
2672 if ( !this.preventDefault ) { |
3001 if ( !this.preventDefault ) { |
2673 return new jQuery.Event( src ); |
3002 return new jQuery.Event( src, props ); |
2674 } |
3003 } |
2675 |
3004 |
2676 // Event object |
3005 // Event object |
2677 if ( src && src.type ) { |
3006 if ( src && src.type ) { |
2678 this.originalEvent = src; |
3007 this.originalEvent = src; |
2679 this.type = src.type; |
3008 this.type = src.type; |
2680 |
3009 |
2681 // Events bubbling up the document may have been marked as prevented |
3010 // Events bubbling up the document may have been marked as prevented |
2682 // by a handler lower down the tree; reflect the correct value. |
3011 // by a handler lower down the tree; reflect the correct value. |
2683 this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false || |
3012 this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false || |
2684 src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse; |
3013 src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse; |
2685 |
3014 |
2686 // Event type |
3015 // Event type |
2687 } else { |
3016 } else { |
2688 this.type = src; |
3017 this.type = src; |
3018 } |
|
3019 |
|
3020 // Put explicitly provided properties onto the event object |
|
3021 if ( props ) { |
|
3022 jQuery.extend( this, props ); |
|
2689 } |
3023 } |
2690 |
3024 |
2691 // timeStamp is buggy for some events on Firefox(#3843) |
3025 // timeStamp is buggy for some events on Firefox(#3843) |
2692 // So we won't rely on the native value |
3026 // So we won't rely on the native value |
2693 this.timeStamp = jQuery.now(); |
3027 this.timeStamp = jQuery.now(); |
2753 var parent = event.relatedTarget; |
3087 var parent = event.relatedTarget; |
2754 |
3088 |
2755 // Firefox sometimes assigns relatedTarget a XUL element |
3089 // Firefox sometimes assigns relatedTarget a XUL element |
2756 // which we cannot access the parentNode property of |
3090 // which we cannot access the parentNode property of |
2757 try { |
3091 try { |
3092 |
|
3093 // Chrome does something similar, the parentNode property |
|
3094 // can be accessed but is null. |
|
3095 if ( parent && parent !== document && !parent.parentNode ) { |
|
3096 return; |
|
3097 } |
|
2758 // Traverse up the tree |
3098 // Traverse up the tree |
2759 while ( parent && parent !== this ) { |
3099 while ( parent && parent !== this ) { |
2760 parent = parent.parentNode; |
3100 parent = parent.parentNode; |
2761 } |
3101 } |
2762 |
3102 |
2797 // submit delegation |
3137 // submit delegation |
2798 if ( !jQuery.support.submitBubbles ) { |
3138 if ( !jQuery.support.submitBubbles ) { |
2799 |
3139 |
2800 jQuery.event.special.submit = { |
3140 jQuery.event.special.submit = { |
2801 setup: function( data, namespaces ) { |
3141 setup: function( data, namespaces ) { |
2802 if ( this.nodeName && this.nodeName.toLowerCase() !== "form" ) { |
3142 if ( !jQuery.nodeName( this, "form" ) ) { |
2803 jQuery.event.add(this, "click.specialSubmit", function( e ) { |
3143 jQuery.event.add(this, "click.specialSubmit", function( e ) { |
2804 var elem = e.target, |
3144 var elem = e.target, |
2805 type = elem.type; |
3145 type = elem.type; |
2806 |
3146 |
2807 if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) { |
3147 if ( (type === "submit" || type === "image") && jQuery( elem ).closest("form").length ) { |
2808 e.liveFired = undefined; |
3148 trigger( "submit", this, arguments ); |
2809 return trigger( "submit", this, arguments ); |
|
2810 } |
3149 } |
2811 }); |
3150 }); |
2812 |
3151 |
2813 jQuery.event.add(this, "keypress.specialSubmit", function( e ) { |
3152 jQuery.event.add(this, "keypress.specialSubmit", function( e ) { |
2814 var elem = e.target, |
3153 var elem = e.target, |
2815 type = elem.type; |
3154 type = elem.type; |
2816 |
3155 |
2817 if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) { |
3156 if ( (type === "text" || type === "password") && jQuery( elem ).closest("form").length && e.keyCode === 13 ) { |
2818 e.liveFired = undefined; |
3157 trigger( "submit", this, arguments ); |
2819 return trigger( "submit", this, arguments ); |
|
2820 } |
3158 } |
2821 }); |
3159 }); |
2822 |
3160 |
2823 } else { |
3161 } else { |
2824 return false; |
3162 return false; |
2848 jQuery.map( elem.options, function( elem ) { |
3186 jQuery.map( elem.options, function( elem ) { |
2849 return elem.selected; |
3187 return elem.selected; |
2850 }).join("-") : |
3188 }).join("-") : |
2851 ""; |
3189 ""; |
2852 |
3190 |
2853 } else if ( elem.nodeName.toLowerCase() === "select" ) { |
3191 } else if ( jQuery.nodeName( elem, "select" ) ) { |
2854 val = elem.selectedIndex; |
3192 val = elem.selectedIndex; |
2855 } |
3193 } |
2856 |
3194 |
2857 return val; |
3195 return val; |
2858 }, |
3196 }, |
2877 } |
3215 } |
2878 |
3216 |
2879 if ( data != null || val ) { |
3217 if ( data != null || val ) { |
2880 e.type = "change"; |
3218 e.type = "change"; |
2881 e.liveFired = undefined; |
3219 e.liveFired = undefined; |
2882 return jQuery.event.trigger( e, arguments[1], elem ); |
3220 jQuery.event.trigger( e, arguments[1], elem ); |
2883 } |
3221 } |
2884 }; |
3222 }; |
2885 |
3223 |
2886 jQuery.event.special.change = { |
3224 jQuery.event.special.change = { |
2887 filters: { |
3225 filters: { |
2888 focusout: testChange, |
3226 focusout: testChange, |
2889 |
3227 |
2890 beforedeactivate: testChange, |
3228 beforedeactivate: testChange, |
2891 |
3229 |
2892 click: function( e ) { |
3230 click: function( e ) { |
2893 var elem = e.target, type = elem.type; |
3231 var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : ""; |
2894 |
3232 |
2895 if ( type === "radio" || type === "checkbox" || elem.nodeName.toLowerCase() === "select" ) { |
3233 if ( type === "radio" || type === "checkbox" || jQuery.nodeName( elem, "select" ) ) { |
2896 return testChange.call( this, e ); |
3234 testChange.call( this, e ); |
2897 } |
3235 } |
2898 }, |
3236 }, |
2899 |
3237 |
2900 // Change has to be called before submit |
3238 // Change has to be called before submit |
2901 // Keydown will be called before keypress, which is used in submit-event delegation |
3239 // Keydown will be called before keypress, which is used in submit-event delegation |
2902 keydown: function( e ) { |
3240 keydown: function( e ) { |
2903 var elem = e.target, type = elem.type; |
3241 var elem = e.target, type = jQuery.nodeName( elem, "input" ) ? elem.type : ""; |
2904 |
3242 |
2905 if ( (e.keyCode === 13 && elem.nodeName.toLowerCase() !== "textarea") || |
3243 if ( (e.keyCode === 13 && !jQuery.nodeName( elem, "textarea" ) ) || |
2906 (e.keyCode === 32 && (type === "checkbox" || type === "radio")) || |
3244 (e.keyCode === 32 && (type === "checkbox" || type === "radio")) || |
2907 type === "select-multiple" ) { |
3245 type === "select-multiple" ) { |
2908 return testChange.call( this, e ); |
3246 testChange.call( this, e ); |
2909 } |
3247 } |
2910 }, |
3248 }, |
2911 |
3249 |
2912 // Beforeactivate happens also before the previous element is blurred |
3250 // Beforeactivate happens also before the previous element is blurred |
2913 // with this event you can't trigger a change event, but you can store |
3251 // with this event you can't trigger a change event, but you can store |
2942 // Handle when the input is .focus()'d |
3280 // Handle when the input is .focus()'d |
2943 changeFilters.focus = changeFilters.beforeactivate; |
3281 changeFilters.focus = changeFilters.beforeactivate; |
2944 } |
3282 } |
2945 |
3283 |
2946 function trigger( type, elem, args ) { |
3284 function trigger( type, elem, args ) { |
2947 args[0].type = type; |
3285 // Piggyback on a donor event to simulate a different one. |
2948 return jQuery.event.handle.apply( elem, args ); |
3286 // Fake originalEvent to avoid donor's stopPropagation, but if the |
3287 // simulated event prevents default then we do the same on the donor. |
|
3288 // Don't pass args or remember liveFired; they apply to the donor event. |
|
3289 var event = jQuery.extend( {}, args[ 0 ] ); |
|
3290 event.type = type; |
|
3291 event.originalEvent = {}; |
|
3292 event.liveFired = undefined; |
|
3293 jQuery.event.handle.call( elem, event ); |
|
3294 if ( event.isDefaultPrevented() ) { |
|
3295 args[ 0 ].preventDefault(); |
|
3296 } |
|
2949 } |
3297 } |
2950 |
3298 |
2951 // Create "bubbling" focus and blur events |
3299 // Create "bubbling" focus and blur events |
2952 if ( document.addEventListener ) { |
3300 if ( !jQuery.support.focusinBubbles ) { |
2953 jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { |
3301 jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { |
3302 |
|
3303 // Attach a single capturing handler while someone wants focusin/focusout |
|
3304 var attaches = 0; |
|
3305 |
|
2954 jQuery.event.special[ fix ] = { |
3306 jQuery.event.special[ fix ] = { |
2955 setup: function() { |
3307 setup: function() { |
2956 this.addEventListener( orig, handler, true ); |
3308 if ( attaches++ === 0 ) { |
2957 }, |
3309 document.addEventListener( orig, handler, true ); |
2958 teardown: function() { |
3310 } |
2959 this.removeEventListener( orig, handler, true ); |
3311 }, |
3312 teardown: function() { |
|
3313 if ( --attaches === 0 ) { |
|
3314 document.removeEventListener( orig, handler, true ); |
|
3315 } |
|
2960 } |
3316 } |
2961 }; |
3317 }; |
2962 |
3318 |
2963 function handler( e ) { |
3319 function handler( donor ) { |
2964 e = jQuery.event.fix( e ); |
3320 // Donor event is always a native one; fix it and switch its type. |
3321 // Let focusin/out handler cancel the donor focus/blur event. |
|
3322 var e = jQuery.event.fix( donor ); |
|
2965 e.type = fix; |
3323 e.type = fix; |
2966 return jQuery.event.handle.call( this, e ); |
3324 e.originalEvent = {}; |
3325 jQuery.event.trigger( e, null, e.target ); |
|
3326 if ( e.isDefaultPrevented() ) { |
|
3327 donor.preventDefault(); |
|
3328 } |
|
2967 } |
3329 } |
2968 }); |
3330 }); |
2969 } |
3331 } |
2970 |
3332 |
2971 jQuery.each(["bind", "one"], function( i, name ) { |
3333 jQuery.each(["bind", "one"], function( i, name ) { |
2972 jQuery.fn[ name ] = function( type, data, fn ) { |
3334 jQuery.fn[ name ] = function( type, data, fn ) { |
3335 var handler; |
|
3336 |
|
2973 // Handle object literals |
3337 // Handle object literals |
2974 if ( typeof type === "object" ) { |
3338 if ( typeof type === "object" ) { |
2975 for ( var key in type ) { |
3339 for ( var key in type ) { |
2976 this[ name ](key, data, type[key], fn); |
3340 this[ name ](key, data, type[key], fn); |
2977 } |
3341 } |
2978 return this; |
3342 return this; |
2979 } |
3343 } |
2980 |
3344 |
2981 if ( jQuery.isFunction( data ) || data === false ) { |
3345 if ( arguments.length === 2 || data === false ) { |
2982 fn = data; |
3346 fn = data; |
2983 data = undefined; |
3347 data = undefined; |
2984 } |
3348 } |
2985 |
3349 |
2986 var handler = name === "one" ? jQuery.proxy( fn, function( event ) { |
3350 if ( name === "one" ) { |
2987 jQuery( this ).unbind( event, handler ); |
3351 handler = function( event ) { |
2988 return fn.apply( this, arguments ); |
3352 jQuery( this ).unbind( event, handler ); |
2989 }) : fn; |
3353 return fn.apply( this, arguments ); |
3354 }; |
|
3355 handler.guid = fn.guid || jQuery.guid++; |
|
3356 } else { |
|
3357 handler = fn; |
|
3358 } |
|
2990 |
3359 |
2991 if ( type === "unload" && name !== "one" ) { |
3360 if ( type === "unload" && name !== "one" ) { |
2992 this.one( type, data, fn ); |
3361 this.one( type, data, fn ); |
2993 |
3362 |
2994 } else { |
3363 } else { |
3022 return this.live( types, data, fn, selector ); |
3391 return this.live( types, data, fn, selector ); |
3023 }, |
3392 }, |
3024 |
3393 |
3025 undelegate: function( selector, types, fn ) { |
3394 undelegate: function( selector, types, fn ) { |
3026 if ( arguments.length === 0 ) { |
3395 if ( arguments.length === 0 ) { |
3027 return this.unbind( "live" ); |
3396 return this.unbind( "live" ); |
3028 |
3397 |
3029 } else { |
3398 } else { |
3030 return this.die( types, null, fn, selector ); |
3399 return this.die( types, null, fn, selector ); |
3031 } |
3400 } |
3032 }, |
3401 }, |
3037 }); |
3406 }); |
3038 }, |
3407 }, |
3039 |
3408 |
3040 triggerHandler: function( type, data ) { |
3409 triggerHandler: function( type, data ) { |
3041 if ( this[0] ) { |
3410 if ( this[0] ) { |
3042 var event = jQuery.Event( type ); |
3411 return jQuery.event.trigger( type, data, this[0], true ); |
3043 event.preventDefault(); |
|
3044 event.stopPropagation(); |
|
3045 jQuery.event.trigger( event, data, this[0] ); |
|
3046 return event.result; |
|
3047 } |
3412 } |
3048 }, |
3413 }, |
3049 |
3414 |
3050 toggle: function( fn ) { |
3415 toggle: function( fn ) { |
3051 // Save reference to arguments for access in closure |
3416 // Save reference to arguments for access in closure |
3052 var args = arguments, |
3417 var args = arguments, |
3053 i = 1; |
3418 guid = fn.guid || jQuery.guid++, |
3419 i = 0, |
|
3420 toggler = function( event ) { |
|
3421 // Figure out which function to execute |
|
3422 var lastToggle = ( jQuery.data( this, "lastToggle" + fn.guid ) || 0 ) % i; |
|
3423 jQuery.data( this, "lastToggle" + fn.guid, lastToggle + 1 ); |
|
3424 |
|
3425 // Make sure that clicks stop |
|
3426 event.preventDefault(); |
|
3427 |
|
3428 // and execute the function |
|
3429 return args[ lastToggle ].apply( this, arguments ) || false; |
|
3430 }; |
|
3054 |
3431 |
3055 // link all the functions, so any of them can unbind this click handler |
3432 // link all the functions, so any of them can unbind this click handler |
3433 toggler.guid = guid; |
|
3056 while ( i < args.length ) { |
3434 while ( i < args.length ) { |
3057 jQuery.proxy( fn, args[ i++ ] ); |
3435 args[ i++ ].guid = guid; |
3058 } |
3436 } |
3059 |
3437 |
3060 return this.click( jQuery.proxy( fn, function( event ) { |
3438 return this.click( toggler ); |
3061 // Figure out which function to execute |
|
3062 var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; |
|
3063 jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); |
|
3064 |
|
3065 // Make sure that clicks stop |
|
3066 event.preventDefault(); |
|
3067 |
|
3068 // and execute the function |
|
3069 return args[ lastToggle ].apply( this, arguments ) || false; |
|
3070 })); |
|
3071 }, |
3439 }, |
3072 |
3440 |
3073 hover: function( fnOver, fnOut ) { |
3441 hover: function( fnOver, fnOut ) { |
3074 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); |
3442 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); |
3075 } |
3443 } |
3094 } |
3462 } |
3095 |
3463 |
3096 return this; |
3464 return this; |
3097 } |
3465 } |
3098 |
3466 |
3099 if ( jQuery.isFunction( data ) ) { |
3467 if ( name === "die" && !types && |
3100 fn = data; |
3468 origSelector && origSelector.charAt(0) === "." ) { |
3469 |
|
3470 context.unbind( origSelector ); |
|
3471 |
|
3472 return this; |
|
3473 } |
|
3474 |
|
3475 if ( data === false || jQuery.isFunction( data ) ) { |
|
3476 fn = data || returnFalse; |
|
3101 data = undefined; |
3477 data = undefined; |
3102 } |
3478 } |
3103 |
3479 |
3104 types = (types || "").split(" "); |
3480 types = (types || "").split(" "); |
3105 |
3481 |
3117 continue; |
3493 continue; |
3118 } |
3494 } |
3119 |
3495 |
3120 preType = type; |
3496 preType = type; |
3121 |
3497 |
3122 if ( type === "focus" || type === "blur" ) { |
3498 if ( liveMap[ type ] ) { |
3123 types.push( liveMap[ type ] + namespaces ); |
3499 types.push( liveMap[ type ] + namespaces ); |
3124 type = type + namespaces; |
3500 type = type + namespaces; |
3125 |
3501 |
3126 } else { |
3502 } else { |
3127 type = (liveMap[ type ] || type) + namespaces; |
3503 type = (liveMap[ type ] || type) + namespaces; |
3146 |
3522 |
3147 function liveHandler( event ) { |
3523 function liveHandler( event ) { |
3148 var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret, |
3524 var stop, maxLevel, related, match, handleObj, elem, j, i, l, data, close, namespace, ret, |
3149 elems = [], |
3525 elems = [], |
3150 selectors = [], |
3526 selectors = [], |
3151 events = jQuery._data( this, eventKey ); |
3527 events = jQuery._data( this, "events" ); |
3152 |
|
3153 if ( typeof events === "function" ) { |
|
3154 events = events.events; |
|
3155 } |
|
3156 |
3528 |
3157 // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911) |
3529 // Make sure we avoid non-left-click bubbling in Firefox (#3861) and disabled elements in IE (#6911) |
3158 if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) { |
3530 if ( event.liveFired === this || !events || !events.live || event.target.disabled || event.button && event.type === "click" ) { |
3159 return; |
3531 return; |
3160 } |
3532 } |
3184 close = match[i]; |
3556 close = match[i]; |
3185 |
3557 |
3186 for ( j = 0; j < live.length; j++ ) { |
3558 for ( j = 0; j < live.length; j++ ) { |
3187 handleObj = live[j]; |
3559 handleObj = live[j]; |
3188 |
3560 |
3189 if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) ) { |
3561 if ( close.selector === handleObj.selector && (!namespace || namespace.test( handleObj.namespace )) && !close.elem.disabled ) { |
3190 elem = close.elem; |
3562 elem = close.elem; |
3191 related = null; |
3563 related = null; |
3192 |
3564 |
3193 // Those two events require additional checking |
3565 // Those two events require additional checking |
3194 if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) { |
3566 if ( handleObj.preType === "mouseenter" || handleObj.preType === "mouseleave" ) { |
3195 event.type = handleObj.preType; |
3567 event.type = handleObj.preType; |
3196 related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0]; |
3568 related = jQuery( event.relatedTarget ).closest( handleObj.selector )[0]; |
3569 |
|
3570 // Make sure not to accidentally match a child element with the same selector |
|
3571 if ( related && jQuery.contains( elem, related ) ) { |
|
3572 related = elem; |
|
3573 } |
|
3197 } |
3574 } |
3198 |
3575 |
3199 if ( !related || related !== elem ) { |
3576 if ( !related || related !== elem ) { |
3200 elems.push({ elem: elem, handleObj: handleObj, level: close.level }); |
3577 elems.push({ elem: elem, handleObj: handleObj, level: close.level }); |
3201 } |
3578 } |
3230 |
3607 |
3231 return stop; |
3608 return stop; |
3232 } |
3609 } |
3233 |
3610 |
3234 function liveConvert( type, selector ) { |
3611 function liveConvert( type, selector ) { |
3235 return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspace, "&"); |
3612 return (type && type !== "*" ? type + "." : "") + selector.replace(rperiod, "`").replace(rspaces, "&"); |
3236 } |
3613 } |
3237 |
3614 |
3238 jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + |
3615 jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + |
3239 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + |
3616 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + |
3240 "change select submit keydown keypress keyup error").split(" "), function( i, name ) { |
3617 "change select submit keydown keypress keyup error").split(" "), function( i, name ) { |
3253 |
3630 |
3254 if ( jQuery.attrFn ) { |
3631 if ( jQuery.attrFn ) { |
3255 jQuery.attrFn[ name ] = true; |
3632 jQuery.attrFn[ name ] = true; |
3256 } |
3633 } |
3257 }); |
3634 }); |
3635 |
|
3258 |
3636 |
3259 |
3637 |
3260 /*! |
3638 /*! |
3261 * Sizzle CSS Selector Engine |
3639 * Sizzle CSS Selector Engine |
3262 * Copyright 2011, The Dojo Foundation |
3640 * Copyright 2011, The Dojo Foundation |
3267 |
3645 |
3268 var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, |
3646 var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, |
3269 done = 0, |
3647 done = 0, |
3270 toString = Object.prototype.toString, |
3648 toString = Object.prototype.toString, |
3271 hasDuplicate = false, |
3649 hasDuplicate = false, |
3272 baseHasDuplicate = true; |
3650 baseHasDuplicate = true, |
3651 rBackslash = /\\/g, |
|
3652 rNonWord = /\W/; |
|
3273 |
3653 |
3274 // Here we check if the JavaScript engine is using some sort of |
3654 // Here we check if the JavaScript engine is using some sort of |
3275 // optimization where it does not always call our comparision |
3655 // optimization where it does not always call our comparision |
3276 // function. If that is the case, discard the hasDuplicate value. |
3656 // function. If that is the case, discard the hasDuplicate value. |
3277 // Thus far that includes Google Chrome. |
3657 // Thus far that includes Google Chrome. |
3466 if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { |
3846 if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { |
3467 var left = match[1]; |
3847 var left = match[1]; |
3468 match.splice( 1, 1 ); |
3848 match.splice( 1, 1 ); |
3469 |
3849 |
3470 if ( left.substr( left.length - 1 ) !== "\\" ) { |
3850 if ( left.substr( left.length - 1 ) !== "\\" ) { |
3471 match[1] = (match[1] || "").replace(/\\/g, ""); |
3851 match[1] = (match[1] || "").replace( rBackslash, "" ); |
3472 set = Expr.find[ type ]( match, context, isXML ); |
3852 set = Expr.find[ type ]( match, context, isXML ); |
3473 |
3853 |
3474 if ( set != null ) { |
3854 if ( set != null ) { |
3475 expr = expr.replace( Expr.match[ type ], "" ); |
3855 expr = expr.replace( Expr.match[ type ], "" ); |
3476 break; |
3856 break; |
3605 }, |
3985 }, |
3606 |
3986 |
3607 attrHandle: { |
3987 attrHandle: { |
3608 href: function( elem ) { |
3988 href: function( elem ) { |
3609 return elem.getAttribute( "href" ); |
3989 return elem.getAttribute( "href" ); |
3990 }, |
|
3991 type: function( elem ) { |
|
3992 return elem.getAttribute( "type" ); |
|
3610 } |
3993 } |
3611 }, |
3994 }, |
3612 |
3995 |
3613 relative: { |
3996 relative: { |
3614 "+": function(checkSet, part){ |
3997 "+": function(checkSet, part){ |
3615 var isPartStr = typeof part === "string", |
3998 var isPartStr = typeof part === "string", |
3616 isTag = isPartStr && !/\W/.test( part ), |
3999 isTag = isPartStr && !rNonWord.test( part ), |
3617 isPartStrNotTag = isPartStr && !isTag; |
4000 isPartStrNotTag = isPartStr && !isTag; |
3618 |
4001 |
3619 if ( isTag ) { |
4002 if ( isTag ) { |
3620 part = part.toLowerCase(); |
4003 part = part.toLowerCase(); |
3621 } |
4004 } |
3639 var elem, |
4022 var elem, |
3640 isPartStr = typeof part === "string", |
4023 isPartStr = typeof part === "string", |
3641 i = 0, |
4024 i = 0, |
3642 l = checkSet.length; |
4025 l = checkSet.length; |
3643 |
4026 |
3644 if ( isPartStr && !/\W/.test( part ) ) { |
4027 if ( isPartStr && !rNonWord.test( part ) ) { |
3645 part = part.toLowerCase(); |
4028 part = part.toLowerCase(); |
3646 |
4029 |
3647 for ( ; i < l; i++ ) { |
4030 for ( ; i < l; i++ ) { |
3648 elem = checkSet[i]; |
4031 elem = checkSet[i]; |
3649 |
4032 |
3673 "": function(checkSet, part, isXML){ |
4056 "": function(checkSet, part, isXML){ |
3674 var nodeCheck, |
4057 var nodeCheck, |
3675 doneName = done++, |
4058 doneName = done++, |
3676 checkFn = dirCheck; |
4059 checkFn = dirCheck; |
3677 |
4060 |
3678 if ( typeof part === "string" && !/\W/.test(part) ) { |
4061 if ( typeof part === "string" && !rNonWord.test( part ) ) { |
3679 part = part.toLowerCase(); |
4062 part = part.toLowerCase(); |
3680 nodeCheck = part; |
4063 nodeCheck = part; |
3681 checkFn = dirNodeCheck; |
4064 checkFn = dirNodeCheck; |
3682 } |
4065 } |
3683 |
4066 |
3687 "~": function( checkSet, part, isXML ) { |
4070 "~": function( checkSet, part, isXML ) { |
3688 var nodeCheck, |
4071 var nodeCheck, |
3689 doneName = done++, |
4072 doneName = done++, |
3690 checkFn = dirCheck; |
4073 checkFn = dirCheck; |
3691 |
4074 |
3692 if ( typeof part === "string" && !/\W/.test( part ) ) { |
4075 if ( typeof part === "string" && !rNonWord.test( part ) ) { |
3693 part = part.toLowerCase(); |
4076 part = part.toLowerCase(); |
3694 nodeCheck = part; |
4077 nodeCheck = part; |
3695 checkFn = dirNodeCheck; |
4078 checkFn = dirNodeCheck; |
3696 } |
4079 } |
3697 |
4080 |
3730 } |
4113 } |
3731 } |
4114 } |
3732 }, |
4115 }, |
3733 preFilter: { |
4116 preFilter: { |
3734 CLASS: function( match, curLoop, inplace, result, not, isXML ) { |
4117 CLASS: function( match, curLoop, inplace, result, not, isXML ) { |
3735 match = " " + match[1].replace(/\\/g, "") + " "; |
4118 match = " " + match[1].replace( rBackslash, "" ) + " "; |
3736 |
4119 |
3737 if ( isXML ) { |
4120 if ( isXML ) { |
3738 return match; |
4121 return match; |
3739 } |
4122 } |
3740 |
4123 |
3753 |
4136 |
3754 return false; |
4137 return false; |
3755 }, |
4138 }, |
3756 |
4139 |
3757 ID: function( match ) { |
4140 ID: function( match ) { |
3758 return match[1].replace(/\\/g, ""); |
4141 return match[1].replace( rBackslash, "" ); |
3759 }, |
4142 }, |
3760 |
4143 |
3761 TAG: function( match, curLoop ) { |
4144 TAG: function( match, curLoop ) { |
3762 return match[1].toLowerCase(); |
4145 return match[1].replace( rBackslash, "" ).toLowerCase(); |
3763 }, |
4146 }, |
3764 |
4147 |
3765 CHILD: function( match ) { |
4148 CHILD: function( match ) { |
3766 if ( match[1] === "nth" ) { |
4149 if ( match[1] === "nth" ) { |
3767 if ( !match[2] ) { |
4150 if ( !match[2] ) { |
3788 |
4171 |
3789 return match; |
4172 return match; |
3790 }, |
4173 }, |
3791 |
4174 |
3792 ATTR: function( match, curLoop, inplace, result, not, isXML ) { |
4175 ATTR: function( match, curLoop, inplace, result, not, isXML ) { |
3793 var name = match[1] = match[1].replace(/\\/g, ""); |
4176 var name = match[1] = match[1].replace( rBackslash, "" ); |
3794 |
4177 |
3795 if ( !isXML && Expr.attrMap[name] ) { |
4178 if ( !isXML && Expr.attrMap[name] ) { |
3796 match[1] = Expr.attrMap[name]; |
4179 match[1] = Expr.attrMap[name]; |
3797 } |
4180 } |
3798 |
4181 |
3799 // Handle if an un-quoted value was used |
4182 // Handle if an un-quoted value was used |
3800 match[4] = ( match[4] || match[5] || "" ).replace(/\\/g, ""); |
4183 match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); |
3801 |
4184 |
3802 if ( match[2] === "~=" ) { |
4185 if ( match[2] === "~=" ) { |
3803 match[4] = " " + match[4] + " "; |
4186 match[4] = " " + match[4] + " "; |
3804 } |
4187 } |
3805 |
4188 |
3850 }, |
4233 }, |
3851 |
4234 |
3852 selected: function( elem ) { |
4235 selected: function( elem ) { |
3853 // Accessing this property makes selected-by-default |
4236 // Accessing this property makes selected-by-default |
3854 // options in Safari work properly |
4237 // options in Safari work properly |
3855 elem.parentNode.selectedIndex; |
4238 if ( elem.parentNode ) { |
4239 elem.parentNode.selectedIndex; |
|
4240 } |
|
3856 |
4241 |
3857 return elem.selected === true; |
4242 return elem.selected === true; |
3858 }, |
4243 }, |
3859 |
4244 |
3860 parent: function( elem ) { |
4245 parent: function( elem ) { |
3872 header: function( elem ) { |
4257 header: function( elem ) { |
3873 return (/h\d/i).test( elem.nodeName ); |
4258 return (/h\d/i).test( elem.nodeName ); |
3874 }, |
4259 }, |
3875 |
4260 |
3876 text: function( elem ) { |
4261 text: function( elem ) { |
3877 return "text" === elem.type; |
4262 var attr = elem.getAttribute( "type" ), type = elem.type; |
4263 // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) |
|
4264 // use getAttribute instead to test this case |
|
4265 return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); |
|
3878 }, |
4266 }, |
4267 |
|
3879 radio: function( elem ) { |
4268 radio: function( elem ) { |
3880 return "radio" === elem.type; |
4269 return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; |
3881 }, |
4270 }, |
3882 |
4271 |
3883 checkbox: function( elem ) { |
4272 checkbox: function( elem ) { |
3884 return "checkbox" === elem.type; |
4273 return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; |
3885 }, |
4274 }, |
3886 |
4275 |
3887 file: function( elem ) { |
4276 file: function( elem ) { |
3888 return "file" === elem.type; |
4277 return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; |
3889 }, |
4278 }, |
4279 |
|
3890 password: function( elem ) { |
4280 password: function( elem ) { |
3891 return "password" === elem.type; |
4281 return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; |
3892 }, |
4282 }, |
3893 |
4283 |
3894 submit: function( elem ) { |
4284 submit: function( elem ) { |
3895 return "submit" === elem.type; |
4285 var name = elem.nodeName.toLowerCase(); |
4286 return (name === "input" || name === "button") && "submit" === elem.type; |
|
3896 }, |
4287 }, |
3897 |
4288 |
3898 image: function( elem ) { |
4289 image: function( elem ) { |
3899 return "image" === elem.type; |
4290 return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; |
3900 }, |
4291 }, |
3901 |
4292 |
3902 reset: function( elem ) { |
4293 reset: function( elem ) { |
3903 return "reset" === elem.type; |
4294 return elem.nodeName.toLowerCase() === "input" && "reset" === elem.type; |
3904 }, |
4295 }, |
3905 |
4296 |
3906 button: function( elem ) { |
4297 button: function( elem ) { |
3907 return "button" === elem.type || elem.nodeName.toLowerCase() === "button"; |
4298 var name = elem.nodeName.toLowerCase(); |
4299 return name === "input" && "button" === elem.type || name === "button"; |
|
3908 }, |
4300 }, |
3909 |
4301 |
3910 input: function( elem ) { |
4302 input: function( elem ) { |
3911 return (/input|select|textarea|button/i).test( elem.nodeName ); |
4303 return (/input|select|textarea|button/i).test( elem.nodeName ); |
4304 }, |
|
4305 |
|
4306 focus: function( elem ) { |
|
4307 return elem === elem.ownerDocument.activeElement; |
|
3912 } |
4308 } |
3913 }, |
4309 }, |
3914 setFilters: { |
4310 setFilters: { |
3915 first: function( elem, i ) { |
4311 first: function( elem, i ) { |
3916 return i === 0; |
4312 return i === 0; |
4405 // qSA works strangely on Element-rooted queries |
4801 // qSA works strangely on Element-rooted queries |
4406 // We can work around this by specifying an extra ID on the root |
4802 // We can work around this by specifying an extra ID on the root |
4407 // and working up from there (Thanks to Andrew Dupont for the technique) |
4803 // and working up from there (Thanks to Andrew Dupont for the technique) |
4408 // IE 8 doesn't work on object elements |
4804 // IE 8 doesn't work on object elements |
4409 } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { |
4805 } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { |
4410 var old = context.getAttribute( "id" ), |
4806 var oldContext = context, |
4807 old = context.getAttribute( "id" ), |
|
4411 nid = old || id, |
4808 nid = old || id, |
4412 hasParent = context.parentNode, |
4809 hasParent = context.parentNode, |
4413 relativeHierarchySelector = /^\s*[+~]/.test( query ); |
4810 relativeHierarchySelector = /^\s*[+~]/.test( query ); |
4414 |
4811 |
4415 if ( !old ) { |
4812 if ( !old ) { |
4427 } |
4824 } |
4428 |
4825 |
4429 } catch(pseudoError) { |
4826 } catch(pseudoError) { |
4430 } finally { |
4827 } finally { |
4431 if ( !old ) { |
4828 if ( !old ) { |
4432 context.removeAttribute( "id" ); |
4829 oldContext.removeAttribute( "id" ); |
4433 } |
4830 } |
4434 } |
4831 } |
4435 } |
4832 } |
4436 } |
4833 } |
4437 |
4834 |
4447 })(); |
4844 })(); |
4448 } |
4845 } |
4449 |
4846 |
4450 (function(){ |
4847 (function(){ |
4451 var html = document.documentElement, |
4848 var html = document.documentElement, |
4452 matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector, |
4849 matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; |
4453 pseudoWorks = false; |
4850 |
4454 |
4851 if ( matches ) { |
4455 try { |
4852 // Check to see if it's possible to do matchesSelector |
4456 // This should fail with an exception |
4853 // on a disconnected node (IE 9 fails this) |
4457 // Gecko does not error, returns false instead |
4854 var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), |
4458 matches.call( document.documentElement, "[test!='']:sizzle" ); |
4855 pseudoWorks = false; |
4856 |
|
4857 try { |
|
4858 // This should fail with an exception |
|
4859 // Gecko does not error, returns false instead |
|
4860 matches.call( document.documentElement, "[test!='']:sizzle" ); |
|
4459 |
4861 |
4460 } catch( pseudoError ) { |
4862 } catch( pseudoError ) { |
4461 pseudoWorks = true; |
4863 pseudoWorks = true; |
4462 } |
4864 } |
4463 |
4865 |
4464 if ( matches ) { |
|
4465 Sizzle.matchesSelector = function( node, expr ) { |
4866 Sizzle.matchesSelector = function( node, expr ) { |
4466 // Make sure that attribute selectors are quoted |
4867 // Make sure that attribute selectors are quoted |
4467 expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); |
4868 expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); |
4468 |
4869 |
4469 if ( !Sizzle.isXML( node ) ) { |
4870 if ( !Sizzle.isXML( node ) ) { |
4470 try { |
4871 try { |
4471 if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { |
4872 if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { |
4472 return matches.call( node, expr ); |
4873 var ret = matches.call( node, expr ); |
4874 |
|
4875 // IE 9's matchesSelector returns false on disconnected nodes |
|
4876 if ( ret || !disconnectedMatch || |
|
4877 // As well, disconnected nodes are said to be in a document |
|
4878 // fragment in IE 9, so check for that |
|
4879 node.document && node.document.nodeType !== 11 ) { |
|
4880 return ret; |
|
4881 } |
|
4473 } |
4882 } |
4474 } catch(e) {} |
4883 } catch(e) {} |
4475 } |
4884 } |
4476 |
4885 |
4477 return Sizzle(expr, null, null, [node]).length > 0; |
4886 return Sizzle(expr, null, null, [node]).length > 0; |
4656 prev: true |
5065 prev: true |
4657 }; |
5066 }; |
4658 |
5067 |
4659 jQuery.fn.extend({ |
5068 jQuery.fn.extend({ |
4660 find: function( selector ) { |
5069 find: function( selector ) { |
5070 var self = this, |
|
5071 i, l; |
|
5072 |
|
5073 if ( typeof selector !== "string" ) { |
|
5074 return jQuery( selector ).filter(function() { |
|
5075 for ( i = 0, l = self.length; i < l; i++ ) { |
|
5076 if ( jQuery.contains( self[ i ], this ) ) { |
|
5077 return true; |
|
5078 } |
|
5079 } |
|
5080 }); |
|
5081 } |
|
5082 |
|
4661 var ret = this.pushStack( "", "find", selector ), |
5083 var ret = this.pushStack( "", "find", selector ), |
4662 length = 0; |
5084 length, n, r; |
4663 |
5085 |
4664 for ( var i = 0, l = this.length; i < l; i++ ) { |
5086 for ( i = 0, l = this.length; i < l; i++ ) { |
4665 length = ret.length; |
5087 length = ret.length; |
4666 jQuery.find( selector, this[i], ret ); |
5088 jQuery.find( selector, this[i], ret ); |
4667 |
5089 |
4668 if ( i > 0 ) { |
5090 if ( i > 0 ) { |
4669 // Make sure that the results are unique |
5091 // Make sure that the results are unique |
4670 for ( var n = length; n < ret.length; n++ ) { |
5092 for ( n = length; n < ret.length; n++ ) { |
4671 for ( var r = 0; r < length; r++ ) { |
5093 for ( r = 0; r < length; r++ ) { |
4672 if ( ret[r] === ret[n] ) { |
5094 if ( ret[r] === ret[n] ) { |
4673 ret.splice(n--, 1); |
5095 ret.splice(n--, 1); |
4674 break; |
5096 break; |
4675 } |
5097 } |
4676 } |
5098 } |
4699 filter: function( selector ) { |
5121 filter: function( selector ) { |
4700 return this.pushStack( winnow(this, selector, true), "filter", selector ); |
5122 return this.pushStack( winnow(this, selector, true), "filter", selector ); |
4701 }, |
5123 }, |
4702 |
5124 |
4703 is: function( selector ) { |
5125 is: function( selector ) { |
4704 return !!selector && jQuery.filter( selector, this ).length > 0; |
5126 return !!selector && ( typeof selector === "string" ? |
5127 jQuery.filter( selector, this ).length > 0 : |
|
5128 this.filter( selector ).length > 0 ); |
|
4705 }, |
5129 }, |
4706 |
5130 |
4707 closest: function( selectors, context ) { |
5131 closest: function( selectors, context ) { |
4708 var ret = [], i, l, cur = this[0]; |
5132 var ret = [], i, l, cur = this[0]; |
4709 |
5133 |
5134 // Array |
|
4710 if ( jQuery.isArray( selectors ) ) { |
5135 if ( jQuery.isArray( selectors ) ) { |
4711 var match, selector, |
5136 var match, selector, |
4712 matches = {}, |
5137 matches = {}, |
4713 level = 1; |
5138 level = 1; |
4714 |
5139 |
4715 if ( cur && selectors.length ) { |
5140 if ( cur && selectors.length ) { |
4716 for ( i = 0, l = selectors.length; i < l; i++ ) { |
5141 for ( i = 0, l = selectors.length; i < l; i++ ) { |
4717 selector = selectors[i]; |
5142 selector = selectors[i]; |
4718 |
5143 |
4719 if ( !matches[selector] ) { |
5144 if ( !matches[ selector ] ) { |
4720 matches[selector] = jQuery.expr.match.POS.test( selector ) ? |
5145 matches[ selector ] = POS.test( selector ) ? |
4721 jQuery( selector, context || this.context ) : |
5146 jQuery( selector, context || this.context ) : |
4722 selector; |
5147 selector; |
4723 } |
5148 } |
4724 } |
5149 } |
4725 |
5150 |
4726 while ( cur && cur.ownerDocument && cur !== context ) { |
5151 while ( cur && cur.ownerDocument && cur !== context ) { |
4727 for ( selector in matches ) { |
5152 for ( selector in matches ) { |
4728 match = matches[selector]; |
5153 match = matches[ selector ]; |
4729 |
5154 |
4730 if ( match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match) ) { |
5155 if ( match.jquery ? match.index( cur ) > -1 : jQuery( cur ).is( match ) ) { |
4731 ret.push({ selector: selector, elem: cur, level: level }); |
5156 ret.push({ selector: selector, elem: cur, level: level }); |
4732 } |
5157 } |
4733 } |
5158 } |
4734 |
5159 |
4735 cur = cur.parentNode; |
5160 cur = cur.parentNode; |
4738 } |
5163 } |
4739 |
5164 |
4740 return ret; |
5165 return ret; |
4741 } |
5166 } |
4742 |
5167 |
4743 var pos = POS.test( selectors ) ? |
5168 // String |
4744 jQuery( selectors, context || this.context ) : null; |
5169 var pos = POS.test( selectors ) || typeof selectors !== "string" ? |
5170 jQuery( selectors, context || this.context ) : |
|
5171 0; |
|
4745 |
5172 |
4746 for ( i = 0, l = this.length; i < l; i++ ) { |
5173 for ( i = 0, l = this.length; i < l; i++ ) { |
4747 cur = this[i]; |
5174 cur = this[i]; |
4748 |
5175 |
4749 while ( cur ) { |
5176 while ( cur ) { |
4751 ret.push( cur ); |
5178 ret.push( cur ); |
4752 break; |
5179 break; |
4753 |
5180 |
4754 } else { |
5181 } else { |
4755 cur = cur.parentNode; |
5182 cur = cur.parentNode; |
4756 if ( !cur || !cur.ownerDocument || cur === context ) { |
5183 if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { |
4757 break; |
5184 break; |
4758 } |
5185 } |
4759 } |
5186 } |
4760 } |
5187 } |
4761 } |
5188 } |
4762 |
5189 |
4763 ret = ret.length > 1 ? jQuery.unique(ret) : ret; |
5190 ret = ret.length > 1 ? jQuery.unique( ret ) : ret; |
4764 |
5191 |
4765 return this.pushStack( ret, "closest", selectors ); |
5192 return this.pushStack( ret, "closest", selectors ); |
4766 }, |
5193 }, |
4767 |
5194 |
4768 // Determine the position of an element within |
5195 // Determine the position of an element within |
4781 }, |
5208 }, |
4782 |
5209 |
4783 add: function( selector, context ) { |
5210 add: function( selector, context ) { |
4784 var set = typeof selector === "string" ? |
5211 var set = typeof selector === "string" ? |
4785 jQuery( selector, context ) : |
5212 jQuery( selector, context ) : |
4786 jQuery.makeArray( selector ), |
5213 jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), |
4787 all = jQuery.merge( this.get(), set ); |
5214 all = jQuery.merge( this.get(), set ); |
4788 |
5215 |
4789 return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? |
5216 return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? |
4790 all : |
5217 all : |
4791 jQuery.unique( all ) ); |
5218 jQuery.unique( all ) ); |
4843 jQuery.makeArray( elem.childNodes ); |
5270 jQuery.makeArray( elem.childNodes ); |
4844 } |
5271 } |
4845 }, function( name, fn ) { |
5272 }, function( name, fn ) { |
4846 jQuery.fn[ name ] = function( until, selector ) { |
5273 jQuery.fn[ name ] = function( until, selector ) { |
4847 var ret = jQuery.map( this, fn, until ), |
5274 var ret = jQuery.map( this, fn, until ), |
4848 // The variable 'args' was introduced in |
5275 // The variable 'args' was introduced in |
4849 // https://github.com/jquery/jquery/commit/52a0238 |
5276 // https://github.com/jquery/jquery/commit/52a0238 |
4850 // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed. |
5277 // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed. |
4851 // http://code.google.com/p/v8/issues/detail?id=1050 |
5278 // http://code.google.com/p/v8/issues/detail?id=1050 |
4852 args = slice.call(arguments); |
5279 args = slice.call(arguments); |
4853 |
5280 |
4854 if ( !runtil.test( name ) ) { |
5281 if ( !runtil.test( name ) ) { |
4855 selector = until; |
5282 selector = until; |
4856 } |
5283 } |
4857 |
5284 |
4919 } |
5346 } |
4920 }); |
5347 }); |
4921 |
5348 |
4922 // Implement the identical functionality for filter and not |
5349 // Implement the identical functionality for filter and not |
4923 function winnow( elements, qualifier, keep ) { |
5350 function winnow( elements, qualifier, keep ) { |
5351 |
|
5352 // Can't pass null or undefined to indexOf in Firefox 4 |
|
5353 // Set to 0 to skip string check |
|
5354 qualifier = qualifier || 0; |
|
5355 |
|
4924 if ( jQuery.isFunction( qualifier ) ) { |
5356 if ( jQuery.isFunction( qualifier ) ) { |
4925 return jQuery.grep(elements, function( elem, i ) { |
5357 return jQuery.grep(elements, function( elem, i ) { |
4926 var retVal = !!qualifier.call( elem, i, elem ); |
5358 var retVal = !!qualifier.call( elem, i, elem ); |
4927 return retVal === keep; |
5359 return retVal === keep; |
4928 }); |
5360 }); |
4957 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, |
5389 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, |
4958 rtagName = /<([\w:]+)/, |
5390 rtagName = /<([\w:]+)/, |
4959 rtbody = /<tbody/i, |
5391 rtbody = /<tbody/i, |
4960 rhtml = /<|&#?\w+;/, |
5392 rhtml = /<|&#?\w+;/, |
4961 rnocache = /<(?:script|object|embed|option|style)/i, |
5393 rnocache = /<(?:script|object|embed|option|style)/i, |
4962 // checked="checked" or checked (html5) |
5394 // checked="checked" or checked |
4963 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, |
5395 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, |
5396 rscriptType = /\/(java|ecma)script/i, |
|
4964 wrapMap = { |
5397 wrapMap = { |
4965 option: [ 1, "<select multiple='multiple'>", "</select>" ], |
5398 option: [ 1, "<select multiple='multiple'>", "</select>" ], |
4966 legend: [ 1, "<fieldset>", "</fieldset>" ], |
5399 legend: [ 1, "<fieldset>", "</fieldset>" ], |
4967 thead: [ 1, "<table>", "</table>" ], |
5400 thead: [ 1, "<table>", "</table>" ], |
4968 tr: [ 2, "<table><tbody>", "</tbody></table>" ], |
5401 tr: [ 2, "<table><tbody>", "</tbody></table>" ], |
5019 while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { |
5452 while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { |
5020 elem = elem.firstChild; |
5453 elem = elem.firstChild; |
5021 } |
5454 } |
5022 |
5455 |
5023 return elem; |
5456 return elem; |
5024 }).append(this); |
5457 }).append( this ); |
5025 } |
5458 } |
5026 |
5459 |
5027 return this; |
5460 return this; |
5028 }, |
5461 }, |
5029 |
5462 |
5109 jQuery.cleanData( elem.getElementsByTagName("*") ); |
5542 jQuery.cleanData( elem.getElementsByTagName("*") ); |
5110 jQuery.cleanData( [ elem ] ); |
5543 jQuery.cleanData( [ elem ] ); |
5111 } |
5544 } |
5112 |
5545 |
5113 if ( elem.parentNode ) { |
5546 if ( elem.parentNode ) { |
5114 elem.parentNode.removeChild( elem ); |
5547 elem.parentNode.removeChild( elem ); |
5115 } |
5548 } |
5116 } |
5549 } |
5117 } |
5550 } |
5118 |
5551 |
5119 return this; |
5552 return this; |
5134 |
5567 |
5135 return this; |
5568 return this; |
5136 }, |
5569 }, |
5137 |
5570 |
5138 clone: function( dataAndEvents, deepDataAndEvents ) { |
5571 clone: function( dataAndEvents, deepDataAndEvents ) { |
5139 dataAndEvents = dataAndEvents == null ? true : dataAndEvents; |
5572 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; |
5140 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; |
5573 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; |
5141 |
5574 |
5142 return this.map( function () { |
5575 return this.map( function () { |
5143 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); |
5576 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); |
5144 }); |
5577 }); |
5211 } else { |
5644 } else { |
5212 jQuery(parent).append( value ); |
5645 jQuery(parent).append( value ); |
5213 } |
5646 } |
5214 }); |
5647 }); |
5215 } else { |
5648 } else { |
5216 return this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ); |
5649 return this.length ? |
5650 this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) : |
|
5651 this; |
|
5217 } |
5652 } |
5218 }, |
5653 }, |
5219 |
5654 |
5220 detach: function( selector ) { |
5655 detach: function( selector ) { |
5221 return this.remove( selector, true ); |
5656 return this.remove( selector, true ); |
5303 if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { |
5738 if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { |
5304 return; |
5739 return; |
5305 } |
5740 } |
5306 |
5741 |
5307 var internalKey = jQuery.expando, |
5742 var internalKey = jQuery.expando, |
5308 oldData = jQuery.data( src ), |
5743 oldData = jQuery.data( src ), |
5309 curData = jQuery.data( dest, oldData ); |
5744 curData = jQuery.data( dest, oldData ); |
5310 |
5745 |
5311 // Switch to use the internal data object, if it exists, for the next |
5746 // Switch to use the internal data object, if it exists, for the next |
5312 // stage of data copying |
5747 // stage of data copying |
5313 if ( (oldData = oldData[ internalKey ]) ) { |
5748 if ( (oldData = oldData[ internalKey ]) ) { |
5314 var events = oldData.events; |
5749 var events = oldData.events; |
5318 delete curData.handle; |
5753 delete curData.handle; |
5319 curData.events = {}; |
5754 curData.events = {}; |
5320 |
5755 |
5321 for ( var type in events ) { |
5756 for ( var type in events ) { |
5322 for ( var i = 0, l = events[ type ].length; i < l; i++ ) { |
5757 for ( var i = 0, l = events[ type ].length; i < l; i++ ) { |
5323 jQuery.event.add( dest, type, events[ type ][ i ], events[ type ][ i ].data ); |
5758 jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data ); |
5324 } |
5759 } |
5325 } |
5760 } |
5326 } |
5761 } |
5327 } |
5762 } |
5328 } |
5763 } |
5329 |
5764 |
5330 function cloneFixAttributes(src, dest) { |
5765 function cloneFixAttributes( src, dest ) { |
5766 var nodeName; |
|
5767 |
|
5331 // We do not need to do anything for non-Elements |
5768 // We do not need to do anything for non-Elements |
5332 if ( dest.nodeType !== 1 ) { |
5769 if ( dest.nodeType !== 1 ) { |
5333 return; |
5770 return; |
5334 } |
5771 } |
5335 |
5772 |
5336 var nodeName = dest.nodeName.toLowerCase(); |
|
5337 |
|
5338 // clearAttributes removes the attributes, which we don't want, |
5773 // clearAttributes removes the attributes, which we don't want, |
5339 // but also removes the attachEvent events, which we *do* want |
5774 // but also removes the attachEvent events, which we *do* want |
5340 dest.clearAttributes(); |
5775 if ( dest.clearAttributes ) { |
5776 dest.clearAttributes(); |
|
5777 } |
|
5341 |
5778 |
5342 // mergeAttributes, in contrast, only merges back on the |
5779 // mergeAttributes, in contrast, only merges back on the |
5343 // original attributes, not the events |
5780 // original attributes, not the events |
5344 dest.mergeAttributes(src); |
5781 if ( dest.mergeAttributes ) { |
5782 dest.mergeAttributes( src ); |
|
5783 } |
|
5784 |
|
5785 nodeName = dest.nodeName.toLowerCase(); |
|
5345 |
5786 |
5346 // IE6-8 fail to clone children inside object elements that use |
5787 // IE6-8 fail to clone children inside object elements that use |
5347 // the proprietary classid attribute value (rather than the type |
5788 // the proprietary classid attribute value (rather than the type |
5348 // attribute) to identify the type of content to display |
5789 // attribute) to identify the type of content to display |
5349 if ( nodeName === "object" ) { |
5790 if ( nodeName === "object" ) { |
5389 // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache |
5830 // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache |
5390 if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document && |
5831 if ( args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document && |
5391 args[0].charAt(0) === "<" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) { |
5832 args[0].charAt(0) === "<" && !rnocache.test( args[0] ) && (jQuery.support.checkClone || !rchecked.test( args[0] )) ) { |
5392 |
5833 |
5393 cacheable = true; |
5834 cacheable = true; |
5835 |
|
5394 cacheresults = jQuery.fragments[ args[0] ]; |
5836 cacheresults = jQuery.fragments[ args[0] ]; |
5395 if ( cacheresults ) { |
5837 if ( cacheresults && cacheresults !== 1 ) { |
5396 if ( cacheresults !== 1 ) { |
5838 fragment = cacheresults; |
5397 fragment = cacheresults; |
|
5398 } |
|
5399 } |
5839 } |
5400 } |
5840 } |
5401 |
5841 |
5402 if ( !fragment ) { |
5842 if ( !fragment ) { |
5403 fragment = doc.createDocumentFragment(); |
5843 fragment = doc.createDocumentFragment(); |
5439 return this.pushStack( ret, name, insert.selector ); |
5879 return this.pushStack( ret, name, insert.selector ); |
5440 } |
5880 } |
5441 }; |
5881 }; |
5442 }); |
5882 }); |
5443 |
5883 |
5884 function getAll( elem ) { |
|
5885 if ( "getElementsByTagName" in elem ) { |
|
5886 return elem.getElementsByTagName( "*" ); |
|
5887 |
|
5888 } else if ( "querySelectorAll" in elem ) { |
|
5889 return elem.querySelectorAll( "*" ); |
|
5890 |
|
5891 } else { |
|
5892 return []; |
|
5893 } |
|
5894 } |
|
5895 |
|
5896 // Used in clean, fixes the defaultChecked property |
|
5897 function fixDefaultChecked( elem ) { |
|
5898 if ( elem.type === "checkbox" || elem.type === "radio" ) { |
|
5899 elem.defaultChecked = elem.checked; |
|
5900 } |
|
5901 } |
|
5902 // Finds all inputs and passes them to fixDefaultChecked |
|
5903 function findInputs( elem ) { |
|
5904 if ( jQuery.nodeName( elem, "input" ) ) { |
|
5905 fixDefaultChecked( elem ); |
|
5906 } else if ( elem.getElementsByTagName ) { |
|
5907 jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked ); |
|
5908 } |
|
5909 } |
|
5910 |
|
5444 jQuery.extend({ |
5911 jQuery.extend({ |
5445 clone: function( elem, dataAndEvents, deepDataAndEvents ) { |
5912 clone: function( elem, dataAndEvents, deepDataAndEvents ) { |
5446 var clone = elem.cloneNode(true), |
5913 var clone = elem.cloneNode(true), |
5447 srcElements, |
5914 srcElements, |
5448 destElements, |
5915 destElements, |
5449 i; |
5916 i; |
5450 |
5917 |
5451 if ( !jQuery.support.noCloneEvent && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { |
5918 if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && |
5919 (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { |
|
5452 // IE copies events bound via attachEvent when using cloneNode. |
5920 // IE copies events bound via attachEvent when using cloneNode. |
5453 // Calling detachEvent on the clone will also remove the events |
5921 // Calling detachEvent on the clone will also remove the events |
5454 // from the original. In order to get around this, we use some |
5922 // from the original. In order to get around this, we use some |
5455 // proprietary methods to clear the events. Thanks to MooTools |
5923 // proprietary methods to clear the events. Thanks to MooTools |
5456 // guys for this hotness. |
5924 // guys for this hotness. |
5457 |
5925 |
5926 cloneFixAttributes( elem, clone ); |
|
5927 |
|
5458 // Using Sizzle here is crazy slow, so we use getElementsByTagName |
5928 // Using Sizzle here is crazy slow, so we use getElementsByTagName |
5459 // instead |
5929 // instead |
5460 srcElements = elem.getElementsByTagName("*"); |
5930 srcElements = getAll( elem ); |
5461 destElements = clone.getElementsByTagName("*"); |
5931 destElements = getAll( clone ); |
5462 |
5932 |
5463 // Weird iteration because IE will replace the length property |
5933 // Weird iteration because IE will replace the length property |
5464 // with an element if you are cloning the body and one of the |
5934 // with an element if you are cloning the body and one of the |
5465 // elements on the page has a name or id of "length" |
5935 // elements on the page has a name or id of "length" |
5466 for ( i = 0; srcElements[i]; ++i ) { |
5936 for ( i = 0; srcElements[i]; ++i ) { |
5467 cloneFixAttributes( srcElements[i], destElements[i] ); |
5937 cloneFixAttributes( srcElements[i], destElements[i] ); |
5468 } |
5938 } |
5469 |
|
5470 cloneFixAttributes( elem, clone ); |
|
5471 } |
5939 } |
5472 |
5940 |
5473 // Copy the events from the original to the clone |
5941 // Copy the events from the original to the clone |
5474 if ( dataAndEvents ) { |
5942 if ( dataAndEvents ) { |
5475 |
|
5476 cloneCopyEvent( elem, clone ); |
5943 cloneCopyEvent( elem, clone ); |
5477 |
5944 |
5478 if ( deepDataAndEvents && "getElementsByTagName" in elem ) { |
5945 if ( deepDataAndEvents ) { |
5479 |
5946 srcElements = getAll( elem ); |
5480 srcElements = elem.getElementsByTagName("*"); |
5947 destElements = getAll( clone ); |
5481 destElements = clone.getElementsByTagName("*"); |
5948 |
5482 |
5949 for ( i = 0; srcElements[i]; ++i ) { |
5483 if ( srcElements.length ) { |
5950 cloneCopyEvent( srcElements[i], destElements[i] ); |
5484 for ( i = 0; srcElements[i]; ++i ) { |
5951 } |
5485 cloneCopyEvent( srcElements[i], destElements[i] ); |
5952 } |
5486 } |
5953 } |
5487 } |
5954 |
5488 } |
|
5489 } |
|
5490 // Return the cloned set |
5955 // Return the cloned set |
5491 return clone; |
5956 return clone; |
5492 }, |
5957 }, |
5958 |
|
5493 clean: function( elems, context, fragment, scripts ) { |
5959 clean: function( elems, context, fragment, scripts ) { |
5960 var checkScriptType; |
|
5961 |
|
5494 context = context || document; |
5962 context = context || document; |
5495 |
5963 |
5496 // !context.createElement fails in IE with an error but returns typeof 'object' |
5964 // !context.createElement fails in IE with an error but returns typeof 'object' |
5497 if ( typeof context.createElement === "undefined" ) { |
5965 if ( typeof context.createElement === "undefined" ) { |
5498 context = context.ownerDocument || context[0] && context[0].ownerDocument || document; |
5966 context = context.ownerDocument || context[0] && context[0].ownerDocument || document; |
5508 if ( !elem ) { |
5976 if ( !elem ) { |
5509 continue; |
5977 continue; |
5510 } |
5978 } |
5511 |
5979 |
5512 // Convert html string into DOM nodes |
5980 // Convert html string into DOM nodes |
5513 if ( typeof elem === "string" && !rhtml.test( elem ) ) { |
5981 if ( typeof elem === "string" ) { |
5514 elem = context.createTextNode( elem ); |
5982 if ( !rhtml.test( elem ) ) { |
5515 |
5983 elem = context.createTextNode( elem ); |
5516 } else if ( typeof elem === "string" ) { |
5984 } else { |
5517 // Fix "XHTML"-style tags in all browsers |
5985 // Fix "XHTML"-style tags in all browsers |
5518 elem = elem.replace(rxhtmlTag, "<$1></$2>"); |
5986 elem = elem.replace(rxhtmlTag, "<$1></$2>"); |
5519 |
5987 |
5520 // Trim whitespace, otherwise indexOf won't work as expected |
5988 // Trim whitespace, otherwise indexOf won't work as expected |
5521 var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(), |
5989 var tag = (rtagName.exec( elem ) || ["", ""])[1].toLowerCase(), |
5522 wrap = wrapMap[ tag ] || wrapMap._default, |
5990 wrap = wrapMap[ tag ] || wrapMap._default, |
5523 depth = wrap[0], |
5991 depth = wrap[0], |
5524 div = context.createElement("div"); |
5992 div = context.createElement("div"); |
5525 |
5993 |
5526 // Go to html and back, then peel off extra wrappers |
5994 // Go to html and back, then peel off extra wrappers |
5527 div.innerHTML = wrap[1] + elem + wrap[2]; |
5995 div.innerHTML = wrap[1] + elem + wrap[2]; |
5528 |
5996 |
5529 // Move to the right depth |
5997 // Move to the right depth |
5530 while ( depth-- ) { |
5998 while ( depth-- ) { |
5531 div = div.lastChild; |
5999 div = div.lastChild; |
5532 } |
6000 } |
5533 |
6001 |
5534 // Remove IE's autoinserted <tbody> from table fragments |
6002 // Remove IE's autoinserted <tbody> from table fragments |
5535 if ( !jQuery.support.tbody ) { |
6003 if ( !jQuery.support.tbody ) { |
5536 |
6004 |
5537 // String was a <table>, *may* have spurious <tbody> |
6005 // String was a <table>, *may* have spurious <tbody> |
5538 var hasBody = rtbody.test(elem), |
6006 var hasBody = rtbody.test(elem), |
5539 tbody = tag === "table" && !hasBody ? |
6007 tbody = tag === "table" && !hasBody ? |
5540 div.firstChild && div.firstChild.childNodes : |
6008 div.firstChild && div.firstChild.childNodes : |
5541 |
6009 |
5542 // String was a bare <thead> or <tfoot> |
6010 // String was a bare <thead> or <tfoot> |
5543 wrap[1] === "<table>" && !hasBody ? |
6011 wrap[1] === "<table>" && !hasBody ? |
5544 div.childNodes : |
6012 div.childNodes : |
5545 []; |
6013 []; |
5546 |
6014 |
5547 for ( var j = tbody.length - 1; j >= 0 ; --j ) { |
6015 for ( var j = tbody.length - 1; j >= 0 ; --j ) { |
5548 if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { |
6016 if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) { |
5549 tbody[ j ].parentNode.removeChild( tbody[ j ] ); |
6017 tbody[ j ].parentNode.removeChild( tbody[ j ] ); |
6018 } |
|
5550 } |
6019 } |
5551 } |
6020 } |
5552 |
6021 |
5553 } |
6022 // IE completely kills leading whitespace when innerHTML is used |
5554 |
6023 if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { |
5555 // IE completely kills leading whitespace when innerHTML is used |
6024 div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); |
5556 if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { |
6025 } |
5557 div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild ); |
6026 |
5558 } |
6027 elem = div.childNodes; |
5559 |
6028 } |
5560 elem = div.childNodes; |
6029 } |
6030 |
|
6031 // Resets defaultChecked for any radios and checkboxes |
|
6032 // about to be appended to the DOM in IE 6/7 (#8060) |
|
6033 var len; |
|
6034 if ( !jQuery.support.appendChecked ) { |
|
6035 if ( elem[0] && typeof (len = elem.length) === "number" ) { |
|
6036 for ( i = 0; i < len; i++ ) { |
|
6037 findInputs( elem[i] ); |
|
6038 } |
|
6039 } else { |
|
6040 findInputs( elem ); |
|
6041 } |
|
5561 } |
6042 } |
5562 |
6043 |
5563 if ( elem.nodeType ) { |
6044 if ( elem.nodeType ) { |
5564 ret.push( elem ); |
6045 ret.push( elem ); |
5565 } else { |
6046 } else { |
5566 ret = jQuery.merge( ret, elem ); |
6047 ret = jQuery.merge( ret, elem ); |
5567 } |
6048 } |
5568 } |
6049 } |
5569 |
6050 |
5570 if ( fragment ) { |
6051 if ( fragment ) { |
6052 checkScriptType = function( elem ) { |
|
6053 return !elem.type || rscriptType.test( elem.type ); |
|
6054 }; |
|
5571 for ( i = 0; ret[i]; i++ ) { |
6055 for ( i = 0; ret[i]; i++ ) { |
5572 if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { |
6056 if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) { |
5573 scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); |
6057 scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] ); |
5574 |
6058 |
5575 } else { |
6059 } else { |
5576 if ( ret[i].nodeType === 1 ) { |
6060 if ( ret[i].nodeType === 1 ) { |
5577 ret.splice.apply( ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))) ); |
6061 var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType ); |
6062 |
|
6063 ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) ); |
|
5578 } |
6064 } |
5579 fragment.appendChild( ret[i] ); |
6065 fragment.appendChild( ret[i] ); |
5580 } |
6066 } |
5581 } |
6067 } |
5582 } |
6068 } |
5648 |
6134 |
5649 |
6135 |
5650 var ralpha = /alpha\([^)]*\)/i, |
6136 var ralpha = /alpha\([^)]*\)/i, |
5651 ropacity = /opacity=([^)]*)/, |
6137 ropacity = /opacity=([^)]*)/, |
5652 rdashAlpha = /-([a-z])/ig, |
6138 rdashAlpha = /-([a-z])/ig, |
5653 rupper = /([A-Z])/g, |
6139 // fixed for IE9, see #8346 |
6140 rupper = /([A-Z]|^ms)/g, |
|
5654 rnumpx = /^-?\d+(?:px)?$/i, |
6141 rnumpx = /^-?\d+(?:px)?$/i, |
5655 rnum = /^-?\d/, |
6142 rnum = /^-?\d/, |
6143 rrelNum = /^[+\-]=/, |
|
6144 rrelNumFilter = /[^+\-\.\de]+/g, |
|
5656 |
6145 |
5657 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, |
6146 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, |
5658 cssWidth = [ "Left", "Right" ], |
6147 cssWidth = [ "Left", "Right" ], |
5659 cssHeight = [ "Top", "Bottom" ], |
6148 cssHeight = [ "Top", "Bottom" ], |
5660 curCSS, |
6149 curCSS, |
5701 cssNumber: { |
6190 cssNumber: { |
5702 "zIndex": true, |
6191 "zIndex": true, |
5703 "fontWeight": true, |
6192 "fontWeight": true, |
5704 "opacity": true, |
6193 "opacity": true, |
5705 "zoom": true, |
6194 "zoom": true, |
5706 "lineHeight": true |
6195 "lineHeight": true, |
6196 "widows": true, |
|
6197 "orphans": true |
|
5707 }, |
6198 }, |
5708 |
6199 |
5709 // Add in properties whose names you wish to fix before |
6200 // Add in properties whose names you wish to fix before |
5710 // setting or getting the value |
6201 // setting or getting the value |
5711 cssProps: { |
6202 cssProps: { |
5719 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { |
6210 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { |
5720 return; |
6211 return; |
5721 } |
6212 } |
5722 |
6213 |
5723 // Make sure that we're working with the right name |
6214 // Make sure that we're working with the right name |
5724 var ret, origName = jQuery.camelCase( name ), |
6215 var ret, type, origName = jQuery.camelCase( name ), |
5725 style = elem.style, hooks = jQuery.cssHooks[ origName ]; |
6216 style = elem.style, hooks = jQuery.cssHooks[ origName ]; |
5726 |
6217 |
5727 name = jQuery.cssProps[ origName ] || origName; |
6218 name = jQuery.cssProps[ origName ] || origName; |
5728 |
6219 |
5729 // Check if we're setting a value |
6220 // Check if we're setting a value |
5730 if ( value !== undefined ) { |
6221 if ( value !== undefined ) { |
6222 type = typeof value; |
|
6223 |
|
5731 // Make sure that NaN and null values aren't set. See: #7116 |
6224 // Make sure that NaN and null values aren't set. See: #7116 |
5732 if ( typeof value === "number" && isNaN( value ) || value == null ) { |
6225 if ( type === "number" && isNaN( value ) || value == null ) { |
5733 return; |
6226 return; |
5734 } |
6227 } |
5735 |
6228 |
6229 // convert relative number strings (+= or -=) to relative numbers. #7345 |
|
6230 if ( type === "string" && rrelNum.test( value ) ) { |
|
6231 value = +value.replace( rrelNumFilter, "" ) + parseFloat( jQuery.css( elem, name ) ); |
|
6232 } |
|
6233 |
|
5736 // If a number was passed in, add 'px' to the (except for certain CSS properties) |
6234 // If a number was passed in, add 'px' to the (except for certain CSS properties) |
5737 if ( typeof value === "number" && !jQuery.cssNumber[ origName ] ) { |
6235 if ( type === "number" && !jQuery.cssNumber[ origName ] ) { |
5738 value += "px"; |
6236 value += "px"; |
5739 } |
6237 } |
5740 |
6238 |
5741 // If a hook was provided, use that value, otherwise just set the specified value |
6239 // If a hook was provided, use that value, otherwise just set the specified value |
5742 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) { |
6240 if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) { |
5757 return style[ name ]; |
6255 return style[ name ]; |
5758 } |
6256 } |
5759 }, |
6257 }, |
5760 |
6258 |
5761 css: function( elem, name, extra ) { |
6259 css: function( elem, name, extra ) { |
6260 var ret, hooks; |
|
6261 |
|
5762 // Make sure that we're working with the right name |
6262 // Make sure that we're working with the right name |
5763 var ret, origName = jQuery.camelCase( name ), |
6263 name = jQuery.camelCase( name ); |
5764 hooks = jQuery.cssHooks[ origName ]; |
6264 hooks = jQuery.cssHooks[ name ]; |
5765 |
6265 name = jQuery.cssProps[ name ] || name; |
5766 name = jQuery.cssProps[ origName ] || origName; |
6266 |
6267 // cssFloat needs a special treatment |
|
6268 if ( name === "cssFloat" ) { |
|
6269 name = "float"; |
|
6270 } |
|
5767 |
6271 |
5768 // If a hook was provided get the computed value from there |
6272 // If a hook was provided get the computed value from there |
5769 if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) { |
6273 if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) { |
5770 return ret; |
6274 return ret; |
5771 |
6275 |
5772 // Otherwise, if a way to get the computed value exists, use that |
6276 // Otherwise, if a way to get the computed value exists, use that |
5773 } else if ( curCSS ) { |
6277 } else if ( curCSS ) { |
5774 return curCSS( elem, name, origName ); |
6278 return curCSS( elem, name ); |
5775 } |
6279 } |
5776 }, |
6280 }, |
5777 |
6281 |
5778 // A method for quickly swapping in/out CSS properties to get correct calculations |
6282 // A method for quickly swapping in/out CSS properties to get correct calculations |
5779 swap: function( elem, options, callback ) { |
6283 swap: function( elem, options, callback ) { |
5860 |
6364 |
5861 if ( !jQuery.support.opacity ) { |
6365 if ( !jQuery.support.opacity ) { |
5862 jQuery.cssHooks.opacity = { |
6366 jQuery.cssHooks.opacity = { |
5863 get: function( elem, computed ) { |
6367 get: function( elem, computed ) { |
5864 // IE uses filters for opacity |
6368 // IE uses filters for opacity |
5865 return ropacity.test((computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "") ? |
6369 return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? |
5866 (parseFloat(RegExp.$1) / 100) + "" : |
6370 ( parseFloat( RegExp.$1 ) / 100 ) + "" : |
5867 computed ? "1" : ""; |
6371 computed ? "1" : ""; |
5868 }, |
6372 }, |
5869 |
6373 |
5870 set: function( elem, value ) { |
6374 set: function( elem, value ) { |
5871 var style = elem.style; |
6375 var style = elem.style, |
6376 currentStyle = elem.currentStyle; |
|
5872 |
6377 |
5873 // IE has trouble with opacity if it does not have layout |
6378 // IE has trouble with opacity if it does not have layout |
5874 // Force it by setting the zoom level |
6379 // Force it by setting the zoom level |
5875 style.zoom = 1; |
6380 style.zoom = 1; |
5876 |
6381 |
5877 // Set the alpha filter to set the opacity |
6382 // Set the alpha filter to set the opacity |
5878 var opacity = jQuery.isNaN(value) ? |
6383 var opacity = jQuery.isNaN( value ) ? |
5879 "" : |
6384 "" : |
5880 "alpha(opacity=" + value * 100 + ")", |
6385 "alpha(opacity=" + value * 100 + ")", |
5881 filter = style.filter || ""; |
6386 filter = currentStyle && currentStyle.filter || style.filter || ""; |
5882 |
6387 |
5883 style.filter = ralpha.test(filter) ? |
6388 style.filter = ralpha.test( filter ) ? |
5884 filter.replace(ralpha, opacity) : |
6389 filter.replace( ralpha, opacity ) : |
5885 style.filter + ' ' + opacity; |
6390 filter + " " + opacity; |
5886 } |
6391 } |
5887 }; |
6392 }; |
5888 } |
6393 } |
5889 |
6394 |
6395 jQuery(function() { |
|
6396 // This hook cannot be added until DOM ready because the support test |
|
6397 // for it is not run until after DOM ready |
|
6398 if ( !jQuery.support.reliableMarginRight ) { |
|
6399 jQuery.cssHooks.marginRight = { |
|
6400 get: function( elem, computed ) { |
|
6401 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right |
|
6402 // Work around by temporarily setting element display to inline-block |
|
6403 var ret; |
|
6404 jQuery.swap( elem, { "display": "inline-block" }, function() { |
|
6405 if ( computed ) { |
|
6406 ret = curCSS( elem, "margin-right", "marginRight" ); |
|
6407 } else { |
|
6408 ret = elem.style.marginRight; |
|
6409 } |
|
6410 }); |
|
6411 return ret; |
|
6412 } |
|
6413 }; |
|
6414 } |
|
6415 }); |
|
6416 |
|
5890 if ( document.defaultView && document.defaultView.getComputedStyle ) { |
6417 if ( document.defaultView && document.defaultView.getComputedStyle ) { |
5891 getComputedStyle = function( elem, newName, name ) { |
6418 getComputedStyle = function( elem, name ) { |
5892 var ret, defaultView, computedStyle; |
6419 var ret, defaultView, computedStyle; |
5893 |
6420 |
5894 name = name.replace( rupper, "-$1" ).toLowerCase(); |
6421 name = name.replace( rupper, "-$1" ).toLowerCase(); |
5895 |
6422 |
5896 if ( !(defaultView = elem.ownerDocument.defaultView) ) { |
6423 if ( !(defaultView = elem.ownerDocument.defaultView) ) { |
5908 }; |
6435 }; |
5909 } |
6436 } |
5910 |
6437 |
5911 if ( document.documentElement.currentStyle ) { |
6438 if ( document.documentElement.currentStyle ) { |
5912 currentStyle = function( elem, name ) { |
6439 currentStyle = function( elem, name ) { |
5913 var left, |
6440 var left, |
5914 ret = elem.currentStyle && elem.currentStyle[ name ], |
6441 ret = elem.currentStyle && elem.currentStyle[ name ], |
5915 rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ], |
6442 rsLeft = elem.runtimeStyle && elem.runtimeStyle[ name ], |
5916 style = elem.style; |
6443 style = elem.style; |
5917 |
6444 |
5918 // From the awesome hack by Dean Edwards |
6445 // From the awesome hack by Dean Edwards |
5986 |
6513 |
5987 var r20 = /%20/g, |
6514 var r20 = /%20/g, |
5988 rbracket = /\[\]$/, |
6515 rbracket = /\[\]$/, |
5989 rCRLF = /\r?\n/g, |
6516 rCRLF = /\r?\n/g, |
5990 rhash = /#.*$/, |
6517 rhash = /#.*$/, |
5991 rheaders = /^(.*?):\s*(.*?)\r?$/mg, // IE leaves an \r character at EOL |
6518 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL |
5992 rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, |
6519 rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, |
6520 // #7653, #8125, #8152: local protocol detection |
|
6521 rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|widget):$/, |
|
5993 rnoContent = /^(?:GET|HEAD)$/, |
6522 rnoContent = /^(?:GET|HEAD)$/, |
5994 rprotocol = /^\/\//, |
6523 rprotocol = /^\/\//, |
5995 rquery = /\?/, |
6524 rquery = /\?/, |
5996 rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, |
6525 rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, |
5997 rselectTextarea = /^(?:select|textarea)/i, |
6526 rselectTextarea = /^(?:select|textarea)/i, |
5998 rspacesAjax = /\s+/, |
6527 rspacesAjax = /\s+/, |
5999 rts = /([?&])_=[^&]*/, |
6528 rts = /([?&])_=[^&]*/, |
6000 rurl = /^(\w+:)\/\/([^\/?#:]+)(?::(\d+))?/, |
6529 rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/, |
6001 |
6530 |
6002 // Keep a copy of the old load method |
6531 // Keep a copy of the old load method |
6003 _load = jQuery.fn.load, |
6532 _load = jQuery.fn.load, |
6004 |
6533 |
6005 /* Prefilters |
6534 /* Prefilters |
6016 /* Transports bindings |
6545 /* Transports bindings |
6017 * 1) key is the dataType |
6546 * 1) key is the dataType |
6018 * 2) the catchall symbol "*" can be used |
6547 * 2) the catchall symbol "*" can be used |
6019 * 3) selection will start with transport dataType and THEN go to "*" if needed |
6548 * 3) selection will start with transport dataType and THEN go to "*" if needed |
6020 */ |
6549 */ |
6021 transports = {}; |
6550 transports = {}, |
6551 |
|
6552 // Document location |
|
6553 ajaxLocation, |
|
6554 |
|
6555 // Document location segments |
|
6556 ajaxLocParts; |
|
6557 |
|
6558 // #8138, IE may throw an exception when accessing |
|
6559 // a field from window.location if document.domain has been set |
|
6560 try { |
|
6561 ajaxLocation = location.href; |
|
6562 } catch( e ) { |
|
6563 // Use the href attribute of an A element |
|
6564 // since IE will modify it given document.location |
|
6565 ajaxLocation = document.createElement( "a" ); |
|
6566 ajaxLocation.href = ""; |
|
6567 ajaxLocation = ajaxLocation.href; |
|
6568 } |
|
6569 |
|
6570 // Segment location into parts |
|
6571 ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; |
|
6022 |
6572 |
6023 // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport |
6573 // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport |
6024 function addToPrefiltersOrTransports( structure ) { |
6574 function addToPrefiltersOrTransports( structure ) { |
6025 |
6575 |
6026 // dataTypeExpression is optional and defaults to "*" |
6576 // dataTypeExpression is optional and defaults to "*" |
6054 } |
6604 } |
6055 } |
6605 } |
6056 }; |
6606 }; |
6057 } |
6607 } |
6058 |
6608 |
6059 //Base inspection function for prefilters and transports |
6609 // Base inspection function for prefilters and transports |
6060 function inspectPrefiltersOrTransports( structure, options, originalOptions, jXHR, |
6610 function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR, |
6061 dataType /* internal */, inspected /* internal */ ) { |
6611 dataType /* internal */, inspected /* internal */ ) { |
6062 |
6612 |
6063 dataType = dataType || options.dataTypes[ 0 ]; |
6613 dataType = dataType || options.dataTypes[ 0 ]; |
6064 inspected = inspected || {}; |
6614 inspected = inspected || {}; |
6065 |
6615 |
6070 length = list ? list.length : 0, |
6620 length = list ? list.length : 0, |
6071 executeOnly = ( structure === prefilters ), |
6621 executeOnly = ( structure === prefilters ), |
6072 selection; |
6622 selection; |
6073 |
6623 |
6074 for(; i < length && ( executeOnly || !selection ); i++ ) { |
6624 for(; i < length && ( executeOnly || !selection ); i++ ) { |
6075 selection = list[ i ]( options, originalOptions, jXHR ); |
6625 selection = list[ i ]( options, originalOptions, jqXHR ); |
6076 // If we got redirected to another dataType |
6626 // If we got redirected to another dataType |
6077 // we try there if not done already |
6627 // we try there if executing only and not done already |
6078 if ( typeof selection === "string" ) { |
6628 if ( typeof selection === "string" ) { |
6079 if ( inspected[ selection ] ) { |
6629 if ( !executeOnly || inspected[ selection ] ) { |
6080 selection = undefined; |
6630 selection = undefined; |
6081 } else { |
6631 } else { |
6082 options.dataTypes.unshift( selection ); |
6632 options.dataTypes.unshift( selection ); |
6083 selection = inspectPrefiltersOrTransports( |
6633 selection = inspectPrefiltersOrTransports( |
6084 structure, options, originalOptions, jXHR, selection, inspected ); |
6634 structure, options, originalOptions, jqXHR, selection, inspected ); |
6085 } |
6635 } |
6086 } |
6636 } |
6087 } |
6637 } |
6088 // If we're only executing or nothing was selected |
6638 // If we're only executing or nothing was selected |
6089 // we try the catchall dataType if not done already |
6639 // we try the catchall dataType if not done already |
6090 if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { |
6640 if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) { |
6091 selection = inspectPrefiltersOrTransports( |
6641 selection = inspectPrefiltersOrTransports( |
6092 structure, options, originalOptions, jXHR, "*", inspected ); |
6642 structure, options, originalOptions, jqXHR, "*", inspected ); |
6093 } |
6643 } |
6094 // unnecessary when only executing (prefilters) |
6644 // unnecessary when only executing (prefilters) |
6095 // but it'll be ignored by the caller in that case |
6645 // but it'll be ignored by the caller in that case |
6096 return selection; |
6646 return selection; |
6097 } |
6647 } |
6119 if ( params ) { |
6669 if ( params ) { |
6120 // If it's a function |
6670 // If it's a function |
6121 if ( jQuery.isFunction( params ) ) { |
6671 if ( jQuery.isFunction( params ) ) { |
6122 // We assume that it's the callback |
6672 // We assume that it's the callback |
6123 callback = params; |
6673 callback = params; |
6124 params = null; |
6674 params = undefined; |
6125 |
6675 |
6126 // Otherwise, build a param string |
6676 // Otherwise, build a param string |
6127 } else if ( typeof params === "object" ) { |
6677 } else if ( typeof params === "object" ) { |
6128 params = jQuery.param( params, jQuery.ajaxSettings.traditional ); |
6678 params = jQuery.param( params, jQuery.ajaxSettings.traditional ); |
6129 type = "POST"; |
6679 type = "POST"; |
6137 url: url, |
6687 url: url, |
6138 type: type, |
6688 type: type, |
6139 dataType: "html", |
6689 dataType: "html", |
6140 data: params, |
6690 data: params, |
6141 // Complete callback (responseText is used internally) |
6691 // Complete callback (responseText is used internally) |
6142 complete: function( jXHR, status, responseText ) { |
6692 complete: function( jqXHR, status, responseText ) { |
6143 // Store the response as specified by the jXHR object |
6693 // Store the response as specified by the jqXHR object |
6144 responseText = jXHR.responseText; |
6694 responseText = jqXHR.responseText; |
6145 // If successful, inject the HTML into all the matched elements |
6695 // If successful, inject the HTML into all the matched elements |
6146 if ( jXHR.isResolved() ) { |
6696 if ( jqXHR.isResolved() ) { |
6147 // #4825: Get the actual response in case |
6697 // #4825: Get the actual response in case |
6148 // a dataFilter is present in ajaxSettings |
6698 // a dataFilter is present in ajaxSettings |
6149 jXHR.done(function( r ) { |
6699 jqXHR.done(function( r ) { |
6150 responseText = r; |
6700 responseText = r; |
6151 }); |
6701 }); |
6152 // See if a selector was specified |
6702 // See if a selector was specified |
6153 self.html( selector ? |
6703 self.html( selector ? |
6154 // Create a dummy div to hold the results |
6704 // Create a dummy div to hold the results |
6163 // If not, just inject the full result |
6713 // If not, just inject the full result |
6164 responseText ); |
6714 responseText ); |
6165 } |
6715 } |
6166 |
6716 |
6167 if ( callback ) { |
6717 if ( callback ) { |
6168 self.each( callback, [ responseText, status, jXHR ] ); |
6718 self.each( callback, [ responseText, status, jqXHR ] ); |
6169 } |
6719 } |
6170 } |
6720 } |
6171 }); |
6721 }); |
6172 |
6722 |
6173 return this; |
6723 return this; |
6203 // Attach a bunch of functions for handling common AJAX events |
6753 // Attach a bunch of functions for handling common AJAX events |
6204 jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){ |
6754 jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){ |
6205 jQuery.fn[ o ] = function( f ){ |
6755 jQuery.fn[ o ] = function( f ){ |
6206 return this.bind( o, f ); |
6756 return this.bind( o, f ); |
6207 }; |
6757 }; |
6208 } ); |
6758 }); |
6209 |
6759 |
6210 jQuery.each( [ "get", "post" ], function( i, method ) { |
6760 jQuery.each( [ "get", "post" ], function( i, method ) { |
6211 jQuery[ method ] = function( url, data, callback, type ) { |
6761 jQuery[ method ] = function( url, data, callback, type ) { |
6212 // shift arguments if data argument was omitted |
6762 // shift arguments if data argument was omitted |
6213 if ( jQuery.isFunction( data ) ) { |
6763 if ( jQuery.isFunction( data ) ) { |
6214 type = type || callback; |
6764 type = type || callback; |
6215 callback = data; |
6765 callback = data; |
6216 data = null; |
6766 data = undefined; |
6217 } |
6767 } |
6218 |
6768 |
6219 return jQuery.ajax({ |
6769 return jQuery.ajax({ |
6220 type: method, |
6770 type: method, |
6221 url: url, |
6771 url: url, |
6222 data: data, |
6772 data: data, |
6223 success: callback, |
6773 success: callback, |
6224 dataType: type |
6774 dataType: type |
6225 }); |
6775 }); |
6226 }; |
6776 }; |
6227 } ); |
6777 }); |
6228 |
6778 |
6229 jQuery.extend({ |
6779 jQuery.extend({ |
6230 |
6780 |
6231 getScript: function( url, callback ) { |
6781 getScript: function( url, callback ) { |
6232 return jQuery.get( url, null, callback, "script" ); |
6782 return jQuery.get( url, undefined, callback, "script" ); |
6233 }, |
6783 }, |
6234 |
6784 |
6235 getJSON: function( url, data, callback ) { |
6785 getJSON: function( url, data, callback ) { |
6236 return jQuery.get( url, data, callback, "json" ); |
6786 return jQuery.get( url, data, callback, "json" ); |
6237 }, |
6787 }, |
6238 |
6788 |
6239 ajaxSetup: function( settings ) { |
6789 // Creates a full fledged settings object into target |
6240 jQuery.extend( true, jQuery.ajaxSettings, settings ); |
6790 // with both ajaxSettings and settings fields. |
6241 if ( settings.context ) { |
6791 // If target is omitted, writes into ajaxSettings. |
6242 jQuery.ajaxSettings.context = settings.context; |
6792 ajaxSetup: function ( target, settings ) { |
6243 } |
6793 if ( !settings ) { |
6794 // Only one parameter, we extend ajaxSettings |
|
6795 settings = target; |
|
6796 target = jQuery.extend( true, jQuery.ajaxSettings, settings ); |
|
6797 } else { |
|
6798 // target was provided, we extend into it |
|
6799 jQuery.extend( true, target, jQuery.ajaxSettings, settings ); |
|
6800 } |
|
6801 // Flatten fields we don't want deep extended |
|
6802 for( var field in { context: 1, url: 1 } ) { |
|
6803 if ( field in settings ) { |
|
6804 target[ field ] = settings[ field ]; |
|
6805 } else if( field in jQuery.ajaxSettings ) { |
|
6806 target[ field ] = jQuery.ajaxSettings[ field ]; |
|
6807 } |
|
6808 } |
|
6809 return target; |
|
6244 }, |
6810 }, |
6245 |
6811 |
6246 ajaxSettings: { |
6812 ajaxSettings: { |
6247 url: location.href, |
6813 url: ajaxLocation, |
6814 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), |
|
6248 global: true, |
6815 global: true, |
6249 type: "GET", |
6816 type: "GET", |
6250 contentType: "application/x-www-form-urlencoded", |
6817 contentType: "application/x-www-form-urlencoded", |
6251 processData: true, |
6818 processData: true, |
6252 async: true, |
6819 async: true, |
6257 username: null, |
6824 username: null, |
6258 password: null, |
6825 password: null, |
6259 cache: null, |
6826 cache: null, |
6260 traditional: false, |
6827 traditional: false, |
6261 headers: {}, |
6828 headers: {}, |
6262 crossDomain: null, |
|
6263 */ |
6829 */ |
6264 |
6830 |
6265 accepts: { |
6831 accepts: { |
6266 xml: "application/xml, text/xml", |
6832 xml: "application/xml, text/xml", |
6267 html: "text/html", |
6833 html: "text/html", |
6304 ajaxTransport: addToPrefiltersOrTransports( transports ), |
6870 ajaxTransport: addToPrefiltersOrTransports( transports ), |
6305 |
6871 |
6306 // Main method |
6872 // Main method |
6307 ajax: function( url, options ) { |
6873 ajax: function( url, options ) { |
6308 |
6874 |
6309 // If options is not an object, |
6875 // If url is an object, simulate pre-1.5 signature |
6310 // we simulate pre-1.5 signature |
6876 if ( typeof url === "object" ) { |
6311 if ( typeof options !== "object" ) { |
|
6312 options = url; |
6877 options = url; |
6313 url = undefined; |
6878 url = undefined; |
6314 } |
6879 } |
6315 |
6880 |
6316 // Force options to be an object |
6881 // Force options to be an object |
6317 options = options || {}; |
6882 options = options || {}; |
6318 |
6883 |
6319 var // Create the final options object |
6884 var // Create the final options object |
6320 s = jQuery.extend( true, {}, jQuery.ajaxSettings, options ), |
6885 s = jQuery.ajaxSetup( {}, options ), |
6321 // Callbacks contexts |
6886 // Callbacks context |
6322 // We force the original context if it exists |
6887 callbackContext = s.context || s, |
6323 // or take it from jQuery.ajaxSettings otherwise |
6888 // Context for global events |
6324 // (plain objects used as context get extended) |
6889 // It's the callbackContext if one was provided in the options |
6325 callbackContext = |
6890 // and if it's a DOM node or a jQuery collection |
6326 ( s.context = ( "context" in options ? options : jQuery.ajaxSettings ).context ) || s, |
6891 globalEventContext = callbackContext !== s && |
6327 globalEventContext = callbackContext === s ? jQuery.event : jQuery( callbackContext ), |
6892 ( callbackContext.nodeType || callbackContext instanceof jQuery ) ? |
6893 jQuery( callbackContext ) : jQuery.event, |
|
6328 // Deferreds |
6894 // Deferreds |
6329 deferred = jQuery.Deferred(), |
6895 deferred = jQuery.Deferred(), |
6330 completeDeferred = jQuery._Deferred(), |
6896 completeDeferred = jQuery._Deferred(), |
6331 // Status-dependent callbacks |
6897 // Status-dependent callbacks |
6332 statusCode = s.statusCode || {}, |
6898 statusCode = s.statusCode || {}, |
6899 // ifModified key |
|
6900 ifModifiedKey, |
|
6333 // Headers (they are sent all at once) |
6901 // Headers (they are sent all at once) |
6334 requestHeaders = {}, |
6902 requestHeaders = {}, |
6903 requestHeadersNames = {}, |
|
6335 // Response headers |
6904 // Response headers |
6336 responseHeadersString, |
6905 responseHeadersString, |
6337 responseHeaders, |
6906 responseHeaders, |
6338 // transport |
6907 // transport |
6339 transport, |
6908 transport, |
6340 // timeout handle |
6909 // timeout handle |
6341 timeoutTimer, |
6910 timeoutTimer, |
6342 // Cross-domain detection vars |
6911 // Cross-domain detection vars |
6343 loc = document.location, |
|
6344 protocol = loc.protocol || "http:", |
|
6345 parts, |
6912 parts, |
6346 // The jXHR state |
6913 // The jqXHR state |
6347 state = 0, |
6914 state = 0, |
6915 // To know if global events are to be dispatched |
|
6916 fireGlobals, |
|
6348 // Loop variable |
6917 // Loop variable |
6349 i, |
6918 i, |
6350 // Fake xhr |
6919 // Fake xhr |
6351 jXHR = { |
6920 jqXHR = { |
6352 |
6921 |
6353 readyState: 0, |
6922 readyState: 0, |
6354 |
6923 |
6355 // Caches the header |
6924 // Caches the header |
6356 setRequestHeader: function( name, value ) { |
6925 setRequestHeader: function( name, value ) { |
6357 if ( state === 0 ) { |
6926 if ( !state ) { |
6358 requestHeaders[ name.toLowerCase() ] = value; |
6927 var lname = name.toLowerCase(); |
6928 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; |
|
6929 requestHeaders[ name ] = value; |
|
6359 } |
6930 } |
6360 return this; |
6931 return this; |
6361 }, |
6932 }, |
6362 |
6933 |
6363 // Raw string |
6934 // Raw string |
6375 responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; |
6946 responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; |
6376 } |
6947 } |
6377 } |
6948 } |
6378 match = responseHeaders[ key.toLowerCase() ]; |
6949 match = responseHeaders[ key.toLowerCase() ]; |
6379 } |
6950 } |
6380 return match || null; |
6951 return match === undefined ? null : match; |
6952 }, |
|
6953 |
|
6954 // Overrides response content-type header |
|
6955 overrideMimeType: function( type ) { |
|
6956 if ( !state ) { |
|
6957 s.mimeType = type; |
|
6958 } |
|
6959 return this; |
|
6381 }, |
6960 }, |
6382 |
6961 |
6383 // Cancel the request |
6962 // Cancel the request |
6384 abort: function( statusText ) { |
6963 abort: function( statusText ) { |
6385 statusText = statusText || "abort"; |
6964 statusText = statusText || "abort"; |
6392 }; |
6971 }; |
6393 |
6972 |
6394 // Callback for when everything is done |
6973 // Callback for when everything is done |
6395 // It is defined here because jslint complains if it is declared |
6974 // It is defined here because jslint complains if it is declared |
6396 // at the end of the function (which would be more logical and readable) |
6975 // at the end of the function (which would be more logical and readable) |
6397 function done( status, statusText, responses, headers) { |
6976 function done( status, statusText, responses, headers ) { |
6398 |
6977 |
6399 // Called once |
6978 // Called once |
6400 if ( state === 2 ) { |
6979 if ( state === 2 ) { |
6401 return; |
6980 return; |
6402 } |
6981 } |
6408 if ( timeoutTimer ) { |
6987 if ( timeoutTimer ) { |
6409 clearTimeout( timeoutTimer ); |
6988 clearTimeout( timeoutTimer ); |
6410 } |
6989 } |
6411 |
6990 |
6412 // Dereference transport for early garbage collection |
6991 // Dereference transport for early garbage collection |
6413 // (no matter how long the jXHR object will be used) |
6992 // (no matter how long the jqXHR object will be used) |
6414 transport = undefined; |
6993 transport = undefined; |
6415 |
6994 |
6416 // Cache response headers |
6995 // Cache response headers |
6417 responseHeadersString = headers || ""; |
6996 responseHeadersString = headers || ""; |
6418 |
6997 |
6419 // Set readyState |
6998 // Set readyState |
6420 jXHR.readyState = status ? 4 : 0; |
6999 jqXHR.readyState = status ? 4 : 0; |
6421 |
7000 |
6422 var isSuccess, |
7001 var isSuccess, |
6423 success, |
7002 success, |
6424 error, |
7003 error, |
6425 response = responses ? ajaxHandleResponses( s, jXHR, responses ) : undefined, |
7004 response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined, |
6426 lastModified, |
7005 lastModified, |
6427 etag; |
7006 etag; |
6428 |
7007 |
6429 // If successful, handle type chaining |
7008 // If successful, handle type chaining |
6430 if ( status >= 200 && status < 300 || status === 304 ) { |
7009 if ( status >= 200 && status < 300 || status === 304 ) { |
6431 |
7010 |
6432 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
7011 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
6433 if ( s.ifModified ) { |
7012 if ( s.ifModified ) { |
6434 |
7013 |
6435 if ( ( lastModified = jXHR.getResponseHeader( "Last-Modified" ) ) ) { |
7014 if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) { |
6436 jQuery.lastModified[ s.url ] = lastModified; |
7015 jQuery.lastModified[ ifModifiedKey ] = lastModified; |
6437 } |
7016 } |
6438 if ( ( etag = jXHR.getResponseHeader( "Etag" ) ) ) { |
7017 if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) { |
6439 jQuery.etag[ s.url ] = etag; |
7018 jQuery.etag[ ifModifiedKey ] = etag; |
6440 } |
7019 } |
6441 } |
7020 } |
6442 |
7021 |
6443 // If not modified |
7022 // If not modified |
6444 if ( status === 304 ) { |
7023 if ( status === 304 ) { |
6461 } |
7040 } |
6462 } else { |
7041 } else { |
6463 // We extract error from statusText |
7042 // We extract error from statusText |
6464 // then normalize statusText and status for non-aborts |
7043 // then normalize statusText and status for non-aborts |
6465 error = statusText; |
7044 error = statusText; |
6466 if( status ) { |
7045 if( !statusText || status ) { |
6467 statusText = "error"; |
7046 statusText = "error"; |
6468 if ( status < 0 ) { |
7047 if ( status < 0 ) { |
6469 status = 0; |
7048 status = 0; |
6470 } |
7049 } |
6471 } |
7050 } |
6472 } |
7051 } |
6473 |
7052 |
6474 // Set data for the fake xhr object |
7053 // Set data for the fake xhr object |
6475 jXHR.status = status; |
7054 jqXHR.status = status; |
6476 jXHR.statusText = statusText; |
7055 jqXHR.statusText = statusText; |
6477 |
7056 |
6478 // Success/Error |
7057 // Success/Error |
6479 if ( isSuccess ) { |
7058 if ( isSuccess ) { |
6480 deferred.resolveWith( callbackContext, [ success, statusText, jXHR ] ); |
7059 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); |
6481 } else { |
7060 } else { |
6482 deferred.rejectWith( callbackContext, [ jXHR, statusText, error ] ); |
7061 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); |
6483 } |
7062 } |
6484 |
7063 |
6485 // Status-dependent callbacks |
7064 // Status-dependent callbacks |
6486 jXHR.statusCode( statusCode ); |
7065 jqXHR.statusCode( statusCode ); |
6487 statusCode = undefined; |
7066 statusCode = undefined; |
6488 |
7067 |
6489 if ( s.global ) { |
7068 if ( fireGlobals ) { |
6490 globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), |
7069 globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ), |
6491 [ jXHR, s, isSuccess ? success : error ] ); |
7070 [ jqXHR, s, isSuccess ? success : error ] ); |
6492 } |
7071 } |
6493 |
7072 |
6494 // Complete |
7073 // Complete |
6495 completeDeferred.resolveWith( callbackContext, [ jXHR, statusText ] ); |
7074 completeDeferred.resolveWith( callbackContext, [ jqXHR, statusText ] ); |
6496 |
7075 |
6497 if ( s.global ) { |
7076 if ( fireGlobals ) { |
6498 globalEventContext.trigger( "ajaxComplete", [ jXHR, s] ); |
7077 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s] ); |
6499 // Handle the global AJAX counter |
7078 // Handle the global AJAX counter |
6500 if ( !( --jQuery.active ) ) { |
7079 if ( !( --jQuery.active ) ) { |
6501 jQuery.event.trigger( "ajaxStop" ); |
7080 jQuery.event.trigger( "ajaxStop" ); |
6502 } |
7081 } |
6503 } |
7082 } |
6504 } |
7083 } |
6505 |
7084 |
6506 // Attach deferreds |
7085 // Attach deferreds |
6507 deferred.promise( jXHR ); |
7086 deferred.promise( jqXHR ); |
6508 jXHR.success = jXHR.done; |
7087 jqXHR.success = jqXHR.done; |
6509 jXHR.error = jXHR.fail; |
7088 jqXHR.error = jqXHR.fail; |
6510 jXHR.complete = completeDeferred.done; |
7089 jqXHR.complete = completeDeferred.done; |
6511 |
7090 |
6512 // Status-dependent callbacks |
7091 // Status-dependent callbacks |
6513 jXHR.statusCode = function( map ) { |
7092 jqXHR.statusCode = function( map ) { |
6514 if ( map ) { |
7093 if ( map ) { |
6515 var tmp; |
7094 var tmp; |
6516 if ( state < 2 ) { |
7095 if ( state < 2 ) { |
6517 for( tmp in map ) { |
7096 for( tmp in map ) { |
6518 statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; |
7097 statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ]; |
6519 } |
7098 } |
6520 } else { |
7099 } else { |
6521 tmp = map[ jXHR.status ]; |
7100 tmp = map[ jqXHR.status ]; |
6522 jXHR.then( tmp, tmp ); |
7101 jqXHR.then( tmp, tmp ); |
6523 } |
7102 } |
6524 } |
7103 } |
6525 return this; |
7104 return this; |
6526 }; |
7105 }; |
6527 |
7106 |
6528 // Remove hash character (#7531: and string promotion) |
7107 // Remove hash character (#7531: and string promotion) |
6529 // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) |
7108 // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) |
6530 // We also use the url parameter if available |
7109 // We also use the url parameter if available |
6531 s.url = ( "" + ( url || s.url ) ).replace( rhash, "" ).replace( rprotocol, protocol + "//" ); |
7110 s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); |
6532 |
7111 |
6533 // Extract dataTypes list |
7112 // Extract dataTypes list |
6534 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax ); |
7113 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax ); |
6535 |
7114 |
6536 // Determine if a cross-domain request is in order |
7115 // Determine if a cross-domain request is in order |
6537 if ( !s.crossDomain ) { |
7116 if ( s.crossDomain == null ) { |
6538 parts = rurl.exec( s.url.toLowerCase() ); |
7117 parts = rurl.exec( s.url.toLowerCase() ); |
6539 s.crossDomain = !!( parts && |
7118 s.crossDomain = !!( parts && |
6540 ( parts[ 1 ] != protocol || parts[ 2 ] != loc.hostname || |
7119 ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] || |
6541 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != |
7120 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != |
6542 ( loc.port || ( protocol === "http:" ? 80 : 443 ) ) ) |
7121 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) ) |
6543 ); |
7122 ); |
6544 } |
7123 } |
6545 |
7124 |
6546 // Convert data if not already a string |
7125 // Convert data if not already a string |
6547 if ( s.data && s.processData && typeof s.data !== "string" ) { |
7126 if ( s.data && s.processData && typeof s.data !== "string" ) { |
6548 s.data = jQuery.param( s.data, s.traditional ); |
7127 s.data = jQuery.param( s.data, s.traditional ); |
6549 } |
7128 } |
6550 |
7129 |
6551 // Apply prefilters |
7130 // Apply prefilters |
6552 inspectPrefiltersOrTransports( prefilters, s, options, jXHR ); |
7131 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); |
7132 |
|
7133 // If request was aborted inside a prefiler, stop there |
|
7134 if ( state === 2 ) { |
|
7135 return false; |
|
7136 } |
|
7137 |
|
7138 // We can fire global events as of now if asked to |
|
7139 fireGlobals = s.global; |
|
6553 |
7140 |
6554 // Uppercase the type |
7141 // Uppercase the type |
6555 s.type = s.type.toUpperCase(); |
7142 s.type = s.type.toUpperCase(); |
6556 |
7143 |
6557 // Determine if request has content |
7144 // Determine if request has content |
6558 s.hasContent = !rnoContent.test( s.type ); |
7145 s.hasContent = !rnoContent.test( s.type ); |
6559 |
7146 |
6560 // Watch for a new set of requests |
7147 // Watch for a new set of requests |
6561 if ( s.global && jQuery.active++ === 0 ) { |
7148 if ( fireGlobals && jQuery.active++ === 0 ) { |
6562 jQuery.event.trigger( "ajaxStart" ); |
7149 jQuery.event.trigger( "ajaxStart" ); |
6563 } |
7150 } |
6564 |
7151 |
6565 // More options handling for requests with no content |
7152 // More options handling for requests with no content |
6566 if ( !s.hasContent ) { |
7153 if ( !s.hasContent ) { |
6568 // If data is available, append data to url |
7155 // If data is available, append data to url |
6569 if ( s.data ) { |
7156 if ( s.data ) { |
6570 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; |
7157 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data; |
6571 } |
7158 } |
6572 |
7159 |
7160 // Get ifModifiedKey before adding the anti-cache parameter |
|
7161 ifModifiedKey = s.url; |
|
7162 |
|
6573 // Add anti-cache in url if needed |
7163 // Add anti-cache in url if needed |
6574 if ( s.cache === false ) { |
7164 if ( s.cache === false ) { |
6575 |
7165 |
6576 var ts = jQuery.now(), |
7166 var ts = jQuery.now(), |
6577 // try replacing _= if it is there |
7167 // try replacing _= if it is there |
6582 } |
7172 } |
6583 } |
7173 } |
6584 |
7174 |
6585 // Set the correct header, if data is being sent |
7175 // Set the correct header, if data is being sent |
6586 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { |
7176 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { |
6587 requestHeaders[ "content-type" ] = s.contentType; |
7177 jqXHR.setRequestHeader( "Content-Type", s.contentType ); |
6588 } |
7178 } |
6589 |
7179 |
6590 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
7180 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
6591 if ( s.ifModified ) { |
7181 if ( s.ifModified ) { |
6592 if ( jQuery.lastModified[ s.url ] ) { |
7182 ifModifiedKey = ifModifiedKey || s.url; |
6593 requestHeaders[ "if-modified-since" ] = jQuery.lastModified[ s.url ]; |
7183 if ( jQuery.lastModified[ ifModifiedKey ] ) { |
6594 } |
7184 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] ); |
6595 if ( jQuery.etag[ s.url ] ) { |
7185 } |
6596 requestHeaders[ "if-none-match" ] = jQuery.etag[ s.url ]; |
7186 if ( jQuery.etag[ ifModifiedKey ] ) { |
7187 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] ); |
|
6597 } |
7188 } |
6598 } |
7189 } |
6599 |
7190 |
6600 // Set the Accepts header for the server, depending on the dataType |
7191 // Set the Accepts header for the server, depending on the dataType |
6601 requestHeaders.accept = s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? |
7192 jqXHR.setRequestHeader( |
6602 s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) : |
7193 "Accept", |
6603 s.accepts[ "*" ]; |
7194 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? |
7195 s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) : |
|
7196 s.accepts[ "*" ] |
|
7197 ); |
|
6604 |
7198 |
6605 // Check for headers option |
7199 // Check for headers option |
6606 for ( i in s.headers ) { |
7200 for ( i in s.headers ) { |
6607 requestHeaders[ i.toLowerCase() ] = s.headers[ i ]; |
7201 jqXHR.setRequestHeader( i, s.headers[ i ] ); |
6608 } |
7202 } |
6609 |
7203 |
6610 // Allow custom headers/mimetypes and early abort |
7204 // Allow custom headers/mimetypes and early abort |
6611 if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jXHR, s ) === false || state === 2 ) ) { |
7205 if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { |
6612 // Abort if not done already |
7206 // Abort if not done already |
6613 done( 0, "abort" ); |
7207 jqXHR.abort(); |
6614 // Return false |
7208 return false; |
6615 jXHR = false; |
7209 |
6616 |
7210 } |
7211 |
|
7212 // Install callbacks on deferreds |
|
7213 for ( i in { success: 1, error: 1, complete: 1 } ) { |
|
7214 jqXHR[ i ]( s[ i ] ); |
|
7215 } |
|
7216 |
|
7217 // Get transport |
|
7218 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); |
|
7219 |
|
7220 // If no transport, we auto-abort |
|
7221 if ( !transport ) { |
|
7222 done( -1, "No Transport" ); |
|
6617 } else { |
7223 } else { |
6618 |
7224 jqXHR.readyState = 1; |
6619 // Install callbacks on deferreds |
7225 // Send global event |
6620 for ( i in { success: 1, error: 1, complete: 1 } ) { |
7226 if ( fireGlobals ) { |
6621 jXHR[ i ]( s[ i ] ); |
7227 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); |
6622 } |
7228 } |
6623 |
7229 // Timeout |
6624 // Get transport |
7230 if ( s.async && s.timeout > 0 ) { |
6625 transport = inspectPrefiltersOrTransports( transports, s, options, jXHR ); |
7231 timeoutTimer = setTimeout( function(){ |
6626 |
7232 jqXHR.abort( "timeout" ); |
6627 // If no transport, we auto-abort |
7233 }, s.timeout ); |
6628 if ( !transport ) { |
7234 } |
6629 done( -1, "No Transport" ); |
7235 |
6630 } else { |
7236 try { |
6631 // Set state as sending |
7237 state = 1; |
6632 state = jXHR.readyState = 1; |
7238 transport.send( requestHeaders, done ); |
6633 // Send global event |
7239 } catch (e) { |
6634 if ( s.global ) { |
7240 // Propagate exception as error if not done |
6635 globalEventContext.trigger( "ajaxSend", [ jXHR, s ] ); |
7241 if ( status < 2 ) { |
6636 } |
7242 done( -1, e ); |
6637 // Timeout |
7243 // Simply rethrow otherwise |
6638 if ( s.async && s.timeout > 0 ) { |
7244 } else { |
6639 timeoutTimer = setTimeout( function(){ |
7245 jQuery.error( e ); |
6640 jXHR.abort( "timeout" ); |
7246 } |
6641 }, s.timeout ); |
7247 } |
6642 } |
7248 } |
6643 |
7249 |
6644 try { |
7250 return jqXHR; |
6645 transport.send( requestHeaders, done ); |
|
6646 } catch (e) { |
|
6647 // Propagate exception as error if not done |
|
6648 if ( status < 2 ) { |
|
6649 done( -1, e ); |
|
6650 // Simply rethrow otherwise |
|
6651 } else { |
|
6652 jQuery.error( e ); |
|
6653 } |
|
6654 } |
|
6655 } |
|
6656 } |
|
6657 return jXHR; |
|
6658 }, |
7251 }, |
6659 |
7252 |
6660 // Serialize an array of form elements or a set of |
7253 // Serialize an array of form elements or a set of |
6661 // key/values into a query string |
7254 // key/values into a query string |
6662 param: function( a, traditional ) { |
7255 param: function( a, traditional ) { |
6671 if ( traditional === undefined ) { |
7264 if ( traditional === undefined ) { |
6672 traditional = jQuery.ajaxSettings.traditional; |
7265 traditional = jQuery.ajaxSettings.traditional; |
6673 } |
7266 } |
6674 |
7267 |
6675 // If an array was passed in, assume that it is an array of form elements. |
7268 // If an array was passed in, assume that it is an array of form elements. |
6676 if ( jQuery.isArray( a ) || a.jquery ) { |
7269 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { |
6677 // Serialize the form elements |
7270 // Serialize the form elements |
6678 jQuery.each( a, function() { |
7271 jQuery.each( a, function() { |
6679 add( this.name, this.value ); |
7272 add( this.name, this.value ); |
6680 } ); |
7273 }); |
6681 |
7274 |
6682 } else { |
7275 } else { |
6683 // If traditional, encode the "old" way (the way 1.3.2 or older |
7276 // If traditional, encode the "old" way (the way 1.3.2 or older |
6684 // did it), otherwise encode params recursively. |
7277 // did it), otherwise encode params recursively. |
6685 for ( var prefix in a ) { |
7278 for ( var prefix in a ) { |
6691 return s.join( "&" ).replace( r20, "+" ); |
7284 return s.join( "&" ).replace( r20, "+" ); |
6692 } |
7285 } |
6693 }); |
7286 }); |
6694 |
7287 |
6695 function buildParams( prefix, obj, traditional, add ) { |
7288 function buildParams( prefix, obj, traditional, add ) { |
6696 if ( jQuery.isArray( obj ) && obj.length ) { |
7289 if ( jQuery.isArray( obj ) ) { |
6697 // Serialize array item. |
7290 // Serialize array item. |
6698 jQuery.each( obj, function( i, v ) { |
7291 jQuery.each( obj, function( i, v ) { |
6699 if ( traditional || rbracket.test( prefix ) ) { |
7292 if ( traditional || rbracket.test( prefix ) ) { |
6700 // Treat each array item as a scalar. |
7293 // Treat each array item as a scalar. |
6701 add( prefix, v ); |
7294 add( prefix, v ); |
6711 buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add ); |
7304 buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add ); |
6712 } |
7305 } |
6713 }); |
7306 }); |
6714 |
7307 |
6715 } else if ( !traditional && obj != null && typeof obj === "object" ) { |
7308 } else if ( !traditional && obj != null && typeof obj === "object" ) { |
6716 // If we see an array here, it is empty and should be treated as an empty |
|
6717 // object |
|
6718 if ( jQuery.isArray( obj ) || jQuery.isEmptyObject( obj ) ) { |
|
6719 add( prefix, "" ); |
|
6720 |
|
6721 // Serialize object item. |
7309 // Serialize object item. |
6722 } else { |
7310 for ( var name in obj ) { |
6723 jQuery.each( obj, function( k, v ) { |
7311 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); |
6724 buildParams( prefix + "[" + k + "]", v, traditional, add ); |
|
6725 }); |
|
6726 } |
7312 } |
6727 |
7313 |
6728 } else { |
7314 } else { |
6729 // Serialize scalar item. |
7315 // Serialize scalar item. |
6730 add( prefix, obj ); |
7316 add( prefix, obj ); |
6747 /* Handles responses to an ajax request: |
7333 /* Handles responses to an ajax request: |
6748 * - sets all responseXXX fields accordingly |
7334 * - sets all responseXXX fields accordingly |
6749 * - finds the right dataType (mediates between content-type and expected dataType) |
7335 * - finds the right dataType (mediates between content-type and expected dataType) |
6750 * - returns the corresponding response |
7336 * - returns the corresponding response |
6751 */ |
7337 */ |
6752 function ajaxHandleResponses( s, jXHR, responses ) { |
7338 function ajaxHandleResponses( s, jqXHR, responses ) { |
6753 |
7339 |
6754 var contents = s.contents, |
7340 var contents = s.contents, |
6755 dataTypes = s.dataTypes, |
7341 dataTypes = s.dataTypes, |
6756 responseFields = s.responseFields, |
7342 responseFields = s.responseFields, |
6757 ct, |
7343 ct, |
6760 firstDataType; |
7346 firstDataType; |
6761 |
7347 |
6762 // Fill responseXXX fields |
7348 // Fill responseXXX fields |
6763 for( type in responseFields ) { |
7349 for( type in responseFields ) { |
6764 if ( type in responses ) { |
7350 if ( type in responses ) { |
6765 jXHR[ responseFields[type] ] = responses[ type ]; |
7351 jqXHR[ responseFields[type] ] = responses[ type ]; |
6766 } |
7352 } |
6767 } |
7353 } |
6768 |
7354 |
6769 // Remove auto dataType and get content-type in the process |
7355 // Remove auto dataType and get content-type in the process |
6770 while( dataTypes[ 0 ] === "*" ) { |
7356 while( dataTypes[ 0 ] === "*" ) { |
6771 dataTypes.shift(); |
7357 dataTypes.shift(); |
6772 if ( ct === undefined ) { |
7358 if ( ct === undefined ) { |
6773 ct = jXHR.getResponseHeader( "content-type" ); |
7359 ct = s.mimeType || jqXHR.getResponseHeader( "content-type" ); |
6774 } |
7360 } |
6775 } |
7361 } |
6776 |
7362 |
6777 // Check if we're dealing with a known content-type |
7363 // Check if we're dealing with a known content-type |
6778 if ( ct ) { |
7364 if ( ct ) { |
6820 if ( s.dataFilter ) { |
7406 if ( s.dataFilter ) { |
6821 response = s.dataFilter( response, s.dataType ); |
7407 response = s.dataFilter( response, s.dataType ); |
6822 } |
7408 } |
6823 |
7409 |
6824 var dataTypes = s.dataTypes, |
7410 var dataTypes = s.dataTypes, |
6825 converters = s.converters, |
7411 converters = {}, |
6826 i, |
7412 i, |
7413 key, |
|
6827 length = dataTypes.length, |
7414 length = dataTypes.length, |
6828 tmp, |
7415 tmp, |
6829 // Current and previous dataTypes |
7416 // Current and previous dataTypes |
6830 current = dataTypes[ 0 ], |
7417 current = dataTypes[ 0 ], |
6831 prev, |
7418 prev, |
6837 conv1, |
7424 conv1, |
6838 conv2; |
7425 conv2; |
6839 |
7426 |
6840 // For each dataType in the chain |
7427 // For each dataType in the chain |
6841 for( i = 1; i < length; i++ ) { |
7428 for( i = 1; i < length; i++ ) { |
7429 |
|
7430 // Create converters map |
|
7431 // with lowercased keys |
|
7432 if ( i === 1 ) { |
|
7433 for( key in s.converters ) { |
|
7434 if( typeof key === "string" ) { |
|
7435 converters[ key.toLowerCase() ] = s.converters[ key ]; |
|
7436 } |
|
7437 } |
|
7438 } |
|
6842 |
7439 |
6843 // Get the dataTypes |
7440 // Get the dataTypes |
6844 prev = current; |
7441 prev = current; |
6845 current = dataTypes[ i ]; |
7442 current = dataTypes[ i ]; |
6846 |
7443 |
6889 |
7486 |
6890 |
7487 |
6891 |
7488 |
6892 |
7489 |
6893 var jsc = jQuery.now(), |
7490 var jsc = jQuery.now(), |
6894 jsre = /(\=)\?(&|$)|()\?\?()/i; |
7491 jsre = /(\=)\?(&|$)|\?\?/i; |
6895 |
7492 |
6896 // Default jsonp settings |
7493 // Default jsonp settings |
6897 jQuery.ajaxSetup({ |
7494 jQuery.ajaxSetup({ |
6898 jsonp: "callback", |
7495 jsonp: "callback", |
6899 jsonpCallback: function() { |
7496 jsonpCallback: function() { |
6900 return jQuery.expando + "_" + ( jsc++ ); |
7497 return jQuery.expando + "_" + ( jsc++ ); |
6901 } |
7498 } |
6902 }); |
7499 }); |
6903 |
7500 |
6904 // Detect, normalize options and install callbacks for jsonp requests |
7501 // Detect, normalize options and install callbacks for jsonp requests |
6905 jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, dataIsString /* internal */ ) { |
7502 jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { |
6906 |
7503 |
6907 dataIsString = ( typeof s.data === "string" ); |
7504 var inspectData = s.contentType === "application/x-www-form-urlencoded" && |
7505 ( typeof s.data === "string" ); |
|
6908 |
7506 |
6909 if ( s.dataTypes[ 0 ] === "jsonp" || |
7507 if ( s.dataTypes[ 0 ] === "jsonp" || |
6910 originalSettings.jsonpCallback || |
|
6911 originalSettings.jsonp != null || |
|
6912 s.jsonp !== false && ( jsre.test( s.url ) || |
7508 s.jsonp !== false && ( jsre.test( s.url ) || |
6913 dataIsString && jsre.test( s.data ) ) ) { |
7509 inspectData && jsre.test( s.data ) ) ) { |
6914 |
7510 |
6915 var responseContainer, |
7511 var responseContainer, |
6916 jsonpCallback = s.jsonpCallback = |
7512 jsonpCallback = s.jsonpCallback = |
6917 jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback, |
7513 jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback, |
6918 previous = window[ jsonpCallback ], |
7514 previous = window[ jsonpCallback ], |
6921 replace = "$1" + jsonpCallback + "$2"; |
7517 replace = "$1" + jsonpCallback + "$2"; |
6922 |
7518 |
6923 if ( s.jsonp !== false ) { |
7519 if ( s.jsonp !== false ) { |
6924 url = url.replace( jsre, replace ); |
7520 url = url.replace( jsre, replace ); |
6925 if ( s.url === url ) { |
7521 if ( s.url === url ) { |
6926 if ( dataIsString ) { |
7522 if ( inspectData ) { |
6927 data = data.replace( jsre, replace ); |
7523 data = data.replace( jsre, replace ); |
6928 } |
7524 } |
6929 if ( s.data === data ) { |
7525 if ( s.data === data ) { |
6930 // Add callback manually |
7526 // Add callback manually |
6931 url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback; |
7527 url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback; |
6934 } |
7530 } |
6935 |
7531 |
6936 s.url = url; |
7532 s.url = url; |
6937 s.data = data; |
7533 s.data = data; |
6938 |
7534 |
7535 // Install callback |
|
6939 window[ jsonpCallback ] = function( response ) { |
7536 window[ jsonpCallback ] = function( response ) { |
6940 responseContainer = [ response ]; |
7537 responseContainer = [ response ]; |
6941 }; |
7538 }; |
6942 |
7539 |
6943 s.complete = [ function() { |
7540 // Clean-up function |
6944 |
7541 jqXHR.always(function() { |
6945 // Set callback back to previous value |
7542 // Set callback back to previous value |
6946 window[ jsonpCallback ] = previous; |
7543 window[ jsonpCallback ] = previous; |
6947 |
|
6948 // Call if it was a function and we have a response |
7544 // Call if it was a function and we have a response |
6949 if ( previous) { |
7545 if ( responseContainer && jQuery.isFunction( previous ) ) { |
6950 if ( responseContainer && jQuery.isFunction( previous ) ) { |
7546 window[ jsonpCallback ]( responseContainer[ 0 ] ); |
6951 window[ jsonpCallback ] ( responseContainer[ 0 ] ); |
7547 } |
6952 } |
7548 }); |
6953 } else { |
|
6954 // else, more memory leak avoidance |
|
6955 try{ |
|
6956 delete window[ jsonpCallback ]; |
|
6957 } catch( e ) {} |
|
6958 } |
|
6959 |
|
6960 }, s.complete ]; |
|
6961 |
7549 |
6962 // Use data converter to retrieve json after script execution |
7550 // Use data converter to retrieve json after script execution |
6963 s.converters["script json"] = function() { |
7551 s.converters["script json"] = function() { |
6964 if ( ! responseContainer ) { |
7552 if ( !responseContainer ) { |
6965 jQuery.error( jsonpCallback + " was not called" ); |
7553 jQuery.error( jsonpCallback + " was not called" ); |
6966 } |
7554 } |
6967 return responseContainer[ 0 ]; |
7555 return responseContainer[ 0 ]; |
6968 }; |
7556 }; |
6969 |
7557 |
6971 s.dataTypes[ 0 ] = "json"; |
7559 s.dataTypes[ 0 ] = "json"; |
6972 |
7560 |
6973 // Delegate to script |
7561 // Delegate to script |
6974 return "script"; |
7562 return "script"; |
6975 } |
7563 } |
6976 } ); |
7564 }); |
6977 |
7565 |
6978 |
7566 |
6979 |
7567 |
6980 |
7568 |
6981 // Install script dataType |
7569 // Install script dataType |
6982 jQuery.ajaxSetup({ |
7570 jQuery.ajaxSetup({ |
6983 accepts: { |
7571 accepts: { |
6984 script: "text/javascript, application/javascript" |
7572 script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" |
6985 }, |
7573 }, |
6986 contents: { |
7574 contents: { |
6987 script: /javascript/ |
7575 script: /javascript|ecmascript/ |
6988 }, |
7576 }, |
6989 converters: { |
7577 converters: { |
6990 "text script": function( text ) { |
7578 "text script": function( text ) { |
6991 jQuery.globalEval( text ); |
7579 jQuery.globalEval( text ); |
6992 return text; |
7580 return text; |
7001 } |
7589 } |
7002 if ( s.crossDomain ) { |
7590 if ( s.crossDomain ) { |
7003 s.type = "GET"; |
7591 s.type = "GET"; |
7004 s.global = false; |
7592 s.global = false; |
7005 } |
7593 } |
7006 } ); |
7594 }); |
7007 |
7595 |
7008 // Bind script tag hack transport |
7596 // Bind script tag hack transport |
7009 jQuery.ajaxTransport( "script", function(s) { |
7597 jQuery.ajaxTransport( "script", function(s) { |
7010 |
7598 |
7011 // This transport only deals with cross domain requests |
7599 // This transport only deals with cross domain requests |
7012 if ( s.crossDomain ) { |
7600 if ( s.crossDomain ) { |
7013 |
7601 |
7014 var script, |
7602 var script, |
7015 head = document.getElementsByTagName( "head" )[ 0 ] || document.documentElement; |
7603 head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement; |
7016 |
7604 |
7017 return { |
7605 return { |
7018 |
7606 |
7019 send: function( _, callback ) { |
7607 send: function( _, callback ) { |
7020 |
7608 |
7029 script.src = s.url; |
7617 script.src = s.url; |
7030 |
7618 |
7031 // Attach handlers for all browsers |
7619 // Attach handlers for all browsers |
7032 script.onload = script.onreadystatechange = function( _, isAbort ) { |
7620 script.onload = script.onreadystatechange = function( _, isAbort ) { |
7033 |
7621 |
7034 if ( !script.readyState || /loaded|complete/.test( script.readyState ) ) { |
7622 if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { |
7035 |
7623 |
7036 // Handle memory leak in IE |
7624 // Handle memory leak in IE |
7037 script.onload = script.onreadystatechange = null; |
7625 script.onload = script.onreadystatechange = null; |
7038 |
7626 |
7039 // Remove the script |
7627 // Remove the script |
7060 script.onload( 0, 1 ); |
7648 script.onload( 0, 1 ); |
7061 } |
7649 } |
7062 } |
7650 } |
7063 }; |
7651 }; |
7064 } |
7652 } |
7065 } ); |
7653 }); |
7066 |
7654 |
7067 |
7655 |
7068 |
7656 |
7069 |
7657 |
7070 var // Next active xhr id |
7658 var // #5280: Internet Explorer will keep connections alive if we don't abort on unload |
7071 xhrId = jQuery.now(), |
7659 xhrOnUnloadAbort = window.ActiveXObject ? function() { |
7072 |
7660 // Abort all pending requests |
7073 // active xhrs |
7661 for ( var key in xhrCallbacks ) { |
7074 xhrs = {}, |
7662 xhrCallbacks[ key ]( 0, 1 ); |
7075 |
7663 } |
7076 // #5280: see below |
7664 } : false, |
7077 xhrUnloadAbortInstalled, |
7665 xhrId = 0, |
7078 |
7666 xhrCallbacks; |
7079 // XHR used to determine supports properties |
7667 |
7080 testXHR; |
7668 // Functions to create xhrs |
7669 function createStandardXHR() { |
|
7670 try { |
|
7671 return new window.XMLHttpRequest(); |
|
7672 } catch( e ) {} |
|
7673 } |
|
7674 |
|
7675 function createActiveXHR() { |
|
7676 try { |
|
7677 return new window.ActiveXObject( "Microsoft.XMLHTTP" ); |
|
7678 } catch( e ) {} |
|
7679 } |
|
7081 |
7680 |
7082 // Create the request object |
7681 // Create the request object |
7083 // (This is still attached to ajaxSettings for backward compatibility) |
7682 // (This is still attached to ajaxSettings for backward compatibility) |
7084 jQuery.ajaxSettings.xhr = window.ActiveXObject ? |
7683 jQuery.ajaxSettings.xhr = window.ActiveXObject ? |
7085 /* Microsoft failed to properly |
7684 /* Microsoft failed to properly |
7087 * so we use the ActiveXObject when it is available |
7686 * so we use the ActiveXObject when it is available |
7088 * Additionally XMLHttpRequest can be disabled in IE7/IE8 so |
7687 * Additionally XMLHttpRequest can be disabled in IE7/IE8 so |
7089 * we need a fallback. |
7688 * we need a fallback. |
7090 */ |
7689 */ |
7091 function() { |
7690 function() { |
7092 if ( window.location.protocol !== "file:" ) { |
7691 return !this.isLocal && createStandardXHR() || createActiveXHR(); |
7093 try { |
|
7094 return new window.XMLHttpRequest(); |
|
7095 } catch( xhrError ) {} |
|
7096 } |
|
7097 |
|
7098 try { |
|
7099 return new window.ActiveXObject("Microsoft.XMLHTTP"); |
|
7100 } catch( activeError ) {} |
|
7101 } : |
7692 } : |
7102 // For all other browsers, use the standard XMLHttpRequest object |
7693 // For all other browsers, use the standard XMLHttpRequest object |
7103 function() { |
7694 createStandardXHR; |
7104 return new window.XMLHttpRequest(); |
7695 |
7105 }; |
7696 // Determine support properties |
7106 |
7697 (function( xhr ) { |
7107 // Test if we can create an xhr object |
7698 jQuery.extend( jQuery.support, { |
7108 try { |
7699 ajax: !!xhr, |
7109 testXHR = jQuery.ajaxSettings.xhr(); |
7700 cors: !!xhr && ( "withCredentials" in xhr ) |
7110 } catch( xhrCreationException ) {} |
7701 }); |
7111 |
7702 })( jQuery.ajaxSettings.xhr() ); |
7112 //Does this browser support XHR requests? |
|
7113 jQuery.support.ajax = !!testXHR; |
|
7114 |
|
7115 // Does this browser support crossDomain XHR requests |
|
7116 jQuery.support.cors = testXHR && ( "withCredentials" in testXHR ); |
|
7117 |
|
7118 // No need for the temporary xhr anymore |
|
7119 testXHR = undefined; |
|
7120 |
7703 |
7121 // Create transport if the browser can provide an xhr |
7704 // Create transport if the browser can provide an xhr |
7122 if ( jQuery.support.ajax ) { |
7705 if ( jQuery.support.ajax ) { |
7123 |
7706 |
7124 jQuery.ajaxTransport(function( s ) { |
7707 jQuery.ajaxTransport(function( s ) { |
7128 var callback; |
7711 var callback; |
7129 |
7712 |
7130 return { |
7713 return { |
7131 send: function( headers, complete ) { |
7714 send: function( headers, complete ) { |
7132 |
7715 |
7133 // #5280: we need to abort on unload or IE will keep connections alive |
|
7134 if ( !xhrUnloadAbortInstalled ) { |
|
7135 |
|
7136 xhrUnloadAbortInstalled = 1; |
|
7137 |
|
7138 jQuery(window).bind( "unload", function() { |
|
7139 |
|
7140 // Abort all pending requests |
|
7141 jQuery.each( xhrs, function( _, xhr ) { |
|
7142 if ( xhr.onreadystatechange ) { |
|
7143 xhr.onreadystatechange( 1 ); |
|
7144 } |
|
7145 } ); |
|
7146 |
|
7147 } ); |
|
7148 } |
|
7149 |
|
7150 // Get a new xhr |
7716 // Get a new xhr |
7151 var xhr = s.xhr(), |
7717 var xhr = s.xhr(), |
7152 handle; |
7718 handle, |
7719 i; |
|
7153 |
7720 |
7154 // Open the socket |
7721 // Open the socket |
7155 // Passing null username, generates a login popup on Opera (#2865) |
7722 // Passing null username, generates a login popup on Opera (#2865) |
7156 if ( s.username ) { |
7723 if ( s.username ) { |
7157 xhr.open( s.type, s.url, s.async, s.username, s.password ); |
7724 xhr.open( s.type, s.url, s.async, s.username, s.password ); |
7158 } else { |
7725 } else { |
7159 xhr.open( s.type, s.url, s.async ); |
7726 xhr.open( s.type, s.url, s.async ); |
7160 } |
7727 } |
7161 |
7728 |
7162 // Requested-With header |
7729 // Apply custom fields if provided |
7163 // Not set for crossDomain requests with no content |
7730 if ( s.xhrFields ) { |
7164 // (see why at http://trac.dojotoolkit.org/ticket/9486) |
7731 for ( i in s.xhrFields ) { |
7165 // Won't change header if already provided |
7732 xhr[ i ] = s.xhrFields[ i ]; |
7166 if ( !( s.crossDomain && !s.hasContent ) && !headers["x-requested-with"] ) { |
7733 } |
7167 headers[ "x-requested-with" ] = "XMLHttpRequest"; |
7734 } |
7735 |
|
7736 // Override mime type if needed |
|
7737 if ( s.mimeType && xhr.overrideMimeType ) { |
|
7738 xhr.overrideMimeType( s.mimeType ); |
|
7739 } |
|
7740 |
|
7741 // X-Requested-With header |
|
7742 // For cross-domain requests, seeing as conditions for a preflight are |
|
7743 // akin to a jigsaw puzzle, we simply never set it to be sure. |
|
7744 // (it can always be set on a per-request basis or even using ajaxSetup) |
|
7745 // For same-domain requests, won't change header if already provided. |
|
7746 if ( !s.crossDomain && !headers["X-Requested-With"] ) { |
|
7747 headers[ "X-Requested-With" ] = "XMLHttpRequest"; |
|
7168 } |
7748 } |
7169 |
7749 |
7170 // Need an extra try/catch for cross domain requests in Firefox 3 |
7750 // Need an extra try/catch for cross domain requests in Firefox 3 |
7171 try { |
7751 try { |
7172 jQuery.each( headers, function( key, value ) { |
7752 for ( i in headers ) { |
7173 xhr.setRequestHeader( key, value ); |
7753 xhr.setRequestHeader( i, headers[ i ] ); |
7174 } ); |
7754 } |
7175 } catch( _ ) {} |
7755 } catch( _ ) {} |
7176 |
7756 |
7177 // Do send the request |
7757 // Do send the request |
7178 // This may raise an exception which is actually |
7758 // This may raise an exception which is actually |
7179 // handled in jQuery.ajax (so no try/catch here) |
7759 // handled in jQuery.ajax (so no try/catch here) |
7180 xhr.send( ( s.hasContent && s.data ) || null ); |
7760 xhr.send( ( s.hasContent && s.data ) || null ); |
7181 |
7761 |
7182 // Listener |
7762 // Listener |
7183 callback = function( _, isAbort ) { |
7763 callback = function( _, isAbort ) { |
7184 |
7764 |
7185 // Was never called and is aborted or complete |
7765 var status, |
7186 if ( callback && ( isAbort || xhr.readyState === 4 ) ) { |
7766 statusText, |
7187 |
7767 responseHeaders, |
7188 // Only called once |
7768 responses, |
7189 callback = 0; |
7769 xml; |
7190 |
7770 |
7191 // Do not keep as active anymore |
7771 // Firefox throws exceptions when accessing properties |
7192 if ( handle ) { |
7772 // of an xhr when a network error occured |
7193 xhr.onreadystatechange = jQuery.noop; |
7773 // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) |
7194 delete xhrs[ handle ]; |
7774 try { |
7775 |
|
7776 // Was never called and is aborted or complete |
|
7777 if ( callback && ( isAbort || xhr.readyState === 4 ) ) { |
|
7778 |
|
7779 // Only called once |
|
7780 callback = undefined; |
|
7781 |
|
7782 // Do not keep as active anymore |
|
7783 if ( handle ) { |
|
7784 xhr.onreadystatechange = jQuery.noop; |
|
7785 if ( xhrOnUnloadAbort ) { |
|
7786 delete xhrCallbacks[ handle ]; |
|
7787 } |
|
7788 } |
|
7789 |
|
7790 // If it's an abort |
|
7791 if ( isAbort ) { |
|
7792 // Abort it manually if needed |
|
7793 if ( xhr.readyState !== 4 ) { |
|
7794 xhr.abort(); |
|
7795 } |
|
7796 } else { |
|
7797 status = xhr.status; |
|
7798 responseHeaders = xhr.getAllResponseHeaders(); |
|
7799 responses = {}; |
|
7800 xml = xhr.responseXML; |
|
7801 |
|
7802 // Construct response list |
|
7803 if ( xml && xml.documentElement /* #4958 */ ) { |
|
7804 responses.xml = xml; |
|
7805 } |
|
7806 responses.text = xhr.responseText; |
|
7807 |
|
7808 // Firefox throws an exception when accessing |
|
7809 // statusText for faulty cross-domain requests |
|
7810 try { |
|
7811 statusText = xhr.statusText; |
|
7812 } catch( e ) { |
|
7813 // We normalize with Webkit giving an empty statusText |
|
7814 statusText = ""; |
|
7815 } |
|
7816 |
|
7817 // Filter status for non standard behaviors |
|
7818 |
|
7819 // If the request is local and we have data: assume a success |
|
7820 // (success with no data won't get notified, that's the best we |
|
7821 // can do given current implementations) |
|
7822 if ( !status && s.isLocal && !s.crossDomain ) { |
|
7823 status = responses.text ? 200 : 404; |
|
7824 // IE - #1450: sometimes returns 1223 when it should be 204 |
|
7825 } else if ( status === 1223 ) { |
|
7826 status = 204; |
|
7827 } |
|
7828 } |
|
7195 } |
7829 } |
7196 |
7830 } catch( firefoxAccessException ) { |
7197 // If it's an abort |
7831 if ( !isAbort ) { |
7198 if ( isAbort ) { |
7832 complete( -1, firefoxAccessException ); |
7199 // Abort it manually if needed |
|
7200 if ( xhr.readyState !== 4 ) { |
|
7201 xhr.abort(); |
|
7202 } |
|
7203 } else { |
|
7204 // Get info |
|
7205 var status = xhr.status, |
|
7206 statusText, |
|
7207 responseHeaders = xhr.getAllResponseHeaders(), |
|
7208 responses = {}, |
|
7209 xml = xhr.responseXML; |
|
7210 |
|
7211 // Construct response list |
|
7212 if ( xml && xml.documentElement /* #4958 */ ) { |
|
7213 responses.xml = xml; |
|
7214 } |
|
7215 responses.text = xhr.responseText; |
|
7216 |
|
7217 // Firefox throws an exception when accessing |
|
7218 // statusText for faulty cross-domain requests |
|
7219 try { |
|
7220 statusText = xhr.statusText; |
|
7221 } catch( e ) { |
|
7222 // We normalize with Webkit giving an empty statusText |
|
7223 statusText = ""; |
|
7224 } |
|
7225 |
|
7226 // Filter status for non standard behaviours |
|
7227 status = |
|
7228 // Opera returns 0 when it should be 304 |
|
7229 // Webkit returns 0 for failing cross-domain no matter the real status |
|
7230 status === 0 ? |
|
7231 ( |
|
7232 // Webkit, Firefox: filter out faulty cross-domain requests |
|
7233 !s.crossDomain || statusText ? |
|
7234 ( |
|
7235 // Opera: filter out real aborts #6060 |
|
7236 responseHeaders ? |
|
7237 304 : |
|
7238 0 |
|
7239 ) : |
|
7240 // We assume 302 but could be anything cross-domain related |
|
7241 302 |
|
7242 ) : |
|
7243 ( |
|
7244 // IE sometimes returns 1223 when it should be 204 (see #1450) |
|
7245 status == 1223 ? |
|
7246 204 : |
|
7247 status |
|
7248 ); |
|
7249 |
|
7250 // Call complete |
|
7251 complete( status, statusText, responses, responseHeaders ); |
|
7252 } |
7833 } |
7834 } |
|
7835 |
|
7836 // Call complete if needed |
|
7837 if ( responses ) { |
|
7838 complete( status, statusText, responses, responseHeaders ); |
|
7253 } |
7839 } |
7254 }; |
7840 }; |
7255 |
7841 |
7256 // if we're in sync mode or it's in cache |
7842 // if we're in sync mode or it's in cache |
7257 // and has been retrieved directly (IE6 & IE7) |
7843 // and has been retrieved directly (IE6 & IE7) |
7258 // we need to manually fire the callback |
7844 // we need to manually fire the callback |
7259 if ( !s.async || xhr.readyState === 4 ) { |
7845 if ( !s.async || xhr.readyState === 4 ) { |
7260 callback(); |
7846 callback(); |
7261 } else { |
7847 } else { |
7262 // Add to list of active xhrs |
7848 handle = ++xhrId; |
7263 handle = xhrId++; |
7849 if ( xhrOnUnloadAbort ) { |
7264 xhrs[ handle ] = xhr; |
7850 // Create the active xhrs callbacks list if needed |
7851 // and attach the unload handler |
|
7852 if ( !xhrCallbacks ) { |
|
7853 xhrCallbacks = {}; |
|
7854 jQuery( window ).unload( xhrOnUnloadAbort ); |
|
7855 } |
|
7856 // Add to list of active xhrs callbacks |
|
7857 xhrCallbacks[ handle ] = callback; |
|
7858 } |
|
7265 xhr.onreadystatechange = callback; |
7859 xhr.onreadystatechange = callback; |
7266 } |
7860 } |
7267 }, |
7861 }, |
7268 |
7862 |
7269 abort: function() { |
7863 abort: function() { |
7278 |
7872 |
7279 |
7873 |
7280 |
7874 |
7281 |
7875 |
7282 var elemdisplay = {}, |
7876 var elemdisplay = {}, |
7877 iframe, iframeDoc, |
|
7283 rfxtypes = /^(?:toggle|show|hide)$/, |
7878 rfxtypes = /^(?:toggle|show|hide)$/, |
7284 rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i, |
7879 rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i, |
7285 timerId, |
7880 timerId, |
7286 fxAttrs = [ |
7881 fxAttrs = [ |
7287 // height animations |
7882 // height animations |
7288 [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ], |
7883 [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ], |
7289 // width animations |
7884 // width animations |
7290 [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ], |
7885 [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ], |
7291 // opacity animations |
7886 // opacity animations |
7292 [ "opacity" ] |
7887 [ "opacity" ] |
7293 ]; |
7888 ], |
7889 fxNow, |
|
7890 requestAnimationFrame = window.webkitRequestAnimationFrame || |
|
7891 window.mozRequestAnimationFrame || |
|
7892 window.oRequestAnimationFrame; |
|
7294 |
7893 |
7295 jQuery.fn.extend({ |
7894 jQuery.fn.extend({ |
7296 show: function( speed, easing, callback ) { |
7895 show: function( speed, easing, callback ) { |
7297 var elem, display; |
7896 var elem, display; |
7298 |
7897 |
7300 return this.animate( genFx("show", 3), speed, easing, callback); |
7899 return this.animate( genFx("show", 3), speed, easing, callback); |
7301 |
7900 |
7302 } else { |
7901 } else { |
7303 for ( var i = 0, j = this.length; i < j; i++ ) { |
7902 for ( var i = 0, j = this.length; i < j; i++ ) { |
7304 elem = this[i]; |
7903 elem = this[i]; |
7305 display = elem.style.display; |
7904 |
7306 |
7905 if ( elem.style ) { |
7307 // Reset the inline display of this element to learn if it is |
7906 display = elem.style.display; |
7308 // being hidden by cascaded rules or not |
7907 |
7309 if ( !jQuery._data(elem, "olddisplay") && display === "none" ) { |
7908 // Reset the inline display of this element to learn if it is |
7310 display = elem.style.display = ""; |
7909 // being hidden by cascaded rules or not |
7311 } |
7910 if ( !jQuery._data(elem, "olddisplay") && display === "none" ) { |
7312 |
7911 display = elem.style.display = ""; |
7313 // Set elements which have been overridden with display: none |
7912 } |
7314 // in a stylesheet to whatever the default browser style is |
7913 |
7315 // for such an element |
7914 // Set elements which have been overridden with display: none |
7316 if ( display === "" && jQuery.css( elem, "display" ) === "none" ) { |
7915 // in a stylesheet to whatever the default browser style is |
7317 jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName)); |
7916 // for such an element |
7917 if ( display === "" && jQuery.css( elem, "display" ) === "none" ) { |
|
7918 jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName)); |
|
7919 } |
|
7318 } |
7920 } |
7319 } |
7921 } |
7320 |
7922 |
7321 // Set the display of most of the elements in a second loop |
7923 // Set the display of most of the elements in a second loop |
7322 // to avoid the constant reflow |
7924 // to avoid the constant reflow |
7323 for ( i = 0; i < j; i++ ) { |
7925 for ( i = 0; i < j; i++ ) { |
7324 elem = this[i]; |
7926 elem = this[i]; |
7325 display = elem.style.display; |
7927 |
7326 |
7928 if ( elem.style ) { |
7327 if ( display === "" || display === "none" ) { |
7929 display = elem.style.display; |
7328 elem.style.display = jQuery._data(elem, "olddisplay") || ""; |
7930 |
7931 if ( display === "" || display === "none" ) { |
|
7932 elem.style.display = jQuery._data(elem, "olddisplay") || ""; |
|
7933 } |
|
7329 } |
7934 } |
7330 } |
7935 } |
7331 |
7936 |
7332 return this; |
7937 return this; |
7333 } |
7938 } |
7337 if ( speed || speed === 0 ) { |
7942 if ( speed || speed === 0 ) { |
7338 return this.animate( genFx("hide", 3), speed, easing, callback); |
7943 return this.animate( genFx("hide", 3), speed, easing, callback); |
7339 |
7944 |
7340 } else { |
7945 } else { |
7341 for ( var i = 0, j = this.length; i < j; i++ ) { |
7946 for ( var i = 0, j = this.length; i < j; i++ ) { |
7342 var display = jQuery.css( this[i], "display" ); |
7947 if ( this[i].style ) { |
7343 |
7948 var display = jQuery.css( this[i], "display" ); |
7344 if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) { |
7949 |
7345 jQuery._data( this[i], "olddisplay", display ); |
7950 if ( display !== "none" && !jQuery._data( this[i], "olddisplay" ) ) { |
7951 jQuery._data( this[i], "olddisplay", display ); |
|
7952 } |
|
7346 } |
7953 } |
7347 } |
7954 } |
7348 |
7955 |
7349 // Set the display of the elements in a second loop |
7956 // Set the display of the elements in a second loop |
7350 // to avoid the constant reflow |
7957 // to avoid the constant reflow |
7351 for ( i = 0; i < j; i++ ) { |
7958 for ( i = 0; i < j; i++ ) { |
7352 this[i].style.display = "none"; |
7959 if ( this[i].style ) { |
7960 this[i].style.display = "none"; |
|
7961 } |
|
7353 } |
7962 } |
7354 |
7963 |
7355 return this; |
7964 return this; |
7356 } |
7965 } |
7357 }, |
7966 }, |
7385 |
7994 |
7386 animate: function( prop, speed, easing, callback ) { |
7995 animate: function( prop, speed, easing, callback ) { |
7387 var optall = jQuery.speed(speed, easing, callback); |
7996 var optall = jQuery.speed(speed, easing, callback); |
7388 |
7997 |
7389 if ( jQuery.isEmptyObject( prop ) ) { |
7998 if ( jQuery.isEmptyObject( prop ) ) { |
7390 return this.each( optall.complete ); |
7999 return this.each( optall.complete, [ false ] ); |
7391 } |
8000 } |
7392 |
8001 |
7393 return this[ optall.queue === false ? "each" : "queue" ](function() { |
8002 return this[ optall.queue === false ? "each" : "queue" ](function() { |
7394 // XXX 'this' does not always have a nodeName when running the |
8003 // XXX 'this' does not always have a nodeName when running the |
7395 // test suite |
8004 // test suite |
7396 |
8005 |
7397 var opt = jQuery.extend({}, optall), p, |
8006 if ( optall.queue === false ) { |
8007 jQuery._mark( this ); |
|
8008 } |
|
8009 |
|
8010 var opt = jQuery.extend({}, optall), |
|
7398 isElement = this.nodeType === 1, |
8011 isElement = this.nodeType === 1, |
7399 hidden = isElement && jQuery(this).is(":hidden"), |
8012 hidden = isElement && jQuery(this).is(":hidden"), |
7400 self = this; |
8013 name, val, p, |
8014 display, e, |
|
8015 parts, start, end, unit; |
|
8016 |
|
8017 // will store per property easing and be used to determine when an animation is complete |
|
8018 opt.animatedProperties = {}; |
|
7401 |
8019 |
7402 for ( p in prop ) { |
8020 for ( p in prop ) { |
7403 var name = jQuery.camelCase( p ); |
8021 |
7404 |
8022 // property name normalization |
8023 name = jQuery.camelCase( p ); |
|
7405 if ( p !== name ) { |
8024 if ( p !== name ) { |
7406 prop[ name ] = prop[ p ]; |
8025 prop[ name ] = prop[ p ]; |
7407 delete prop[ p ]; |
8026 delete prop[ p ]; |
7408 p = name; |
8027 } |
7409 } |
8028 |
7410 |
8029 val = prop[name]; |
7411 if ( prop[p] === "hide" && hidden || prop[p] === "show" && !hidden ) { |
8030 |
8031 if ( val === "hide" && hidden || val === "show" && !hidden ) { |
|
7412 return opt.complete.call(this); |
8032 return opt.complete.call(this); |
7413 } |
8033 } |
7414 |
8034 |
7415 if ( isElement && ( p === "height" || p === "width" ) ) { |
8035 if ( isElement && ( name === "height" || name === "width" ) ) { |
7416 // Make sure that nothing sneaks out |
8036 // Make sure that nothing sneaks out |
7417 // Record all 3 overflow attributes because IE does not |
8037 // Record all 3 overflow attributes because IE does not |
7418 // change the overflow attribute when overflowX and |
8038 // change the overflow attribute when overflowX and |
7419 // overflowY are set to the same value |
8039 // overflowY are set to the same value |
7420 opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ]; |
8040 opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ]; |
7426 jQuery.css( this, "float" ) === "none" ) { |
8046 jQuery.css( this, "float" ) === "none" ) { |
7427 if ( !jQuery.support.inlineBlockNeedsLayout ) { |
8047 if ( !jQuery.support.inlineBlockNeedsLayout ) { |
7428 this.style.display = "inline-block"; |
8048 this.style.display = "inline-block"; |
7429 |
8049 |
7430 } else { |
8050 } else { |
7431 var display = defaultDisplay(this.nodeName); |
8051 display = defaultDisplay(this.nodeName); |
7432 |
8052 |
7433 // inline-level elements accept inline-block; |
8053 // inline-level elements accept inline-block; |
7434 // block-level elements need to be inline with layout |
8054 // block-level elements need to be inline with layout |
7435 if ( display === "inline" ) { |
8055 if ( display === "inline" ) { |
7436 this.style.display = "inline-block"; |
8056 this.style.display = "inline-block"; |
7441 } |
8061 } |
7442 } |
8062 } |
7443 } |
8063 } |
7444 } |
8064 } |
7445 |
8065 |
7446 if ( jQuery.isArray( prop[p] ) ) { |
8066 // easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default) |
7447 // Create (if needed) and add to specialEasing |
8067 opt.animatedProperties[name] = jQuery.isArray( val ) ? |
7448 (opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1]; |
8068 val[1]: |
7449 prop[p] = prop[p][0]; |
8069 opt.specialEasing && opt.specialEasing[name] || opt.easing || 'swing'; |
7450 } |
|
7451 } |
8070 } |
7452 |
8071 |
7453 if ( opt.overflow != null ) { |
8072 if ( opt.overflow != null ) { |
7454 this.style.overflow = "hidden"; |
8073 this.style.overflow = "hidden"; |
7455 } |
8074 } |
7456 |
8075 |
7457 opt.curAnim = jQuery.extend({}, prop); |
8076 for ( p in prop ) { |
7458 |
8077 e = new jQuery.fx( this, opt, p ); |
7459 jQuery.each( prop, function( name, val ) { |
8078 |
7460 var e = new jQuery.fx( self, opt, name ); |
8079 val = prop[p]; |
7461 |
8080 |
7462 if ( rfxtypes.test(val) ) { |
8081 if ( rfxtypes.test(val) ) { |
7463 e[ val === "toggle" ? hidden ? "show" : "hide" : val ]( prop ); |
8082 e[ val === "toggle" ? hidden ? "show" : "hide" : val ](); |
7464 |
8083 |
7465 } else { |
8084 } else { |
7466 var parts = rfxnum.exec(val), |
8085 parts = rfxnum.exec(val); |
7467 start = e.cur() || 0; |
8086 start = e.cur(); |
7468 |
8087 |
7469 if ( parts ) { |
8088 if ( parts ) { |
7470 var end = parseFloat( parts[2] ), |
8089 end = parseFloat( parts[2] ); |
7471 unit = parts[3] || "px"; |
8090 unit = parts[3] || ( jQuery.cssNumber[ name ] ? "" : "px" ); |
7472 |
8091 |
7473 // We need to compute starting value |
8092 // We need to compute starting value |
7474 if ( unit !== "px" ) { |
8093 if ( unit !== "px" ) { |
7475 jQuery.style( self, name, (end || 1) + unit); |
8094 jQuery.style( this, p, (end || 1) + unit); |
7476 start = ((end || 1) / e.cur()) * start; |
8095 start = ((end || 1) / e.cur()) * start; |
7477 jQuery.style( self, name, start + unit); |
8096 jQuery.style( this, p, start + unit); |
7478 } |
8097 } |
7479 |
8098 |
7480 // If a +=/-= token was provided, we're doing a relative animation |
8099 // If a +=/-= token was provided, we're doing a relative animation |
7481 if ( parts[1] ) { |
8100 if ( parts[1] ) { |
7482 end = ((parts[1] === "-=" ? -1 : 1) * end) + start; |
8101 end = ((parts[1] === "-=" ? -1 : 1) * end) + start; |
7486 |
8105 |
7487 } else { |
8106 } else { |
7488 e.custom( start, val, "" ); |
8107 e.custom( start, val, "" ); |
7489 } |
8108 } |
7490 } |
8109 } |
7491 }); |
8110 } |
7492 |
8111 |
7493 // For JS strict compliance |
8112 // For JS strict compliance |
7494 return true; |
8113 return true; |
7495 }); |
8114 }); |
7496 }, |
8115 }, |
7497 |
8116 |
7498 stop: function( clearQueue, gotoEnd ) { |
8117 stop: function( clearQueue, gotoEnd ) { |
7499 var timers = jQuery.timers; |
|
7500 |
|
7501 if ( clearQueue ) { |
8118 if ( clearQueue ) { |
7502 this.queue([]); |
8119 this.queue([]); |
7503 } |
8120 } |
7504 |
8121 |
7505 this.each(function() { |
8122 this.each(function() { |
8123 var timers = jQuery.timers, |
|
8124 i = timers.length; |
|
8125 // clear marker counters if we know they won't be |
|
8126 if ( !gotoEnd ) { |
|
8127 jQuery._unmark( true, this ); |
|
8128 } |
|
7506 // go in reverse order so anything added to the queue during the loop is ignored |
8129 // go in reverse order so anything added to the queue during the loop is ignored |
7507 for ( var i = timers.length - 1; i >= 0; i-- ) { |
8130 while ( i-- ) { |
7508 if ( timers[i].elem === this ) { |
8131 if ( timers[i].elem === this ) { |
7509 if (gotoEnd) { |
8132 if (gotoEnd) { |
7510 // force the next step to be the last |
8133 // force the next step to be the last |
7511 timers[i](true); |
8134 timers[i](true); |
7512 } |
8135 } |
7524 return this; |
8147 return this; |
7525 } |
8148 } |
7526 |
8149 |
7527 }); |
8150 }); |
7528 |
8151 |
8152 // Animations created synchronously will run synchronously |
|
8153 function createFxNow() { |
|
8154 setTimeout( clearFxNow, 0 ); |
|
8155 return ( fxNow = jQuery.now() ); |
|
8156 } |
|
8157 |
|
8158 function clearFxNow() { |
|
8159 fxNow = undefined; |
|
8160 } |
|
8161 |
|
8162 // Generate parameters to create a standard animation |
|
7529 function genFx( type, num ) { |
8163 function genFx( type, num ) { |
7530 var obj = {}; |
8164 var obj = {}; |
7531 |
8165 |
7532 jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() { |
8166 jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice(0,num)), function() { |
7533 obj[ this ] = type; |
8167 obj[ this ] = type; |
7562 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : |
8196 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : |
7563 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default; |
8197 opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default; |
7564 |
8198 |
7565 // Queueing |
8199 // Queueing |
7566 opt.old = opt.complete; |
8200 opt.old = opt.complete; |
7567 opt.complete = function() { |
8201 opt.complete = function( noUnmark ) { |
7568 if ( opt.queue !== false ) { |
8202 if ( opt.queue !== false ) { |
7569 jQuery(this).dequeue(); |
8203 jQuery.dequeue( this ); |
7570 } |
8204 } else if ( noUnmark !== false ) { |
8205 jQuery._unmark( this ); |
|
8206 } |
|
8207 |
|
7571 if ( jQuery.isFunction( opt.old ) ) { |
8208 if ( jQuery.isFunction( opt.old ) ) { |
7572 opt.old.call( this ); |
8209 opt.old.call( this ); |
7573 } |
8210 } |
7574 }; |
8211 }; |
7575 |
8212 |
7590 fx: function( elem, options, prop ) { |
8227 fx: function( elem, options, prop ) { |
7591 this.options = options; |
8228 this.options = options; |
7592 this.elem = elem; |
8229 this.elem = elem; |
7593 this.prop = prop; |
8230 this.prop = prop; |
7594 |
8231 |
7595 if ( !options.orig ) { |
8232 options.orig = options.orig || {}; |
7596 options.orig = {}; |
|
7597 } |
|
7598 } |
8233 } |
7599 |
8234 |
7600 }); |
8235 }); |
7601 |
8236 |
7602 jQuery.fx.prototype = { |
8237 jQuery.fx.prototype = { |
7613 cur: function() { |
8248 cur: function() { |
7614 if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) { |
8249 if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) { |
7615 return this.elem[ this.prop ]; |
8250 return this.elem[ this.prop ]; |
7616 } |
8251 } |
7617 |
8252 |
7618 var r = parseFloat( jQuery.css( this.elem, this.prop ) ); |
8253 var parsed, |
7619 return r || 0; |
8254 r = jQuery.css( this.elem, this.prop ); |
8255 // Empty strings, null, undefined and "auto" are converted to 0, |
|
8256 // complex values such as "rotate(1rad)" are returned as is, |
|
8257 // simple values such as "10px" are parsed to Float. |
|
8258 return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed; |
|
7620 }, |
8259 }, |
7621 |
8260 |
7622 // Start an animation from one number to another |
8261 // Start an animation from one number to another |
7623 custom: function( from, to, unit ) { |
8262 custom: function( from, to, unit ) { |
7624 var self = this, |
8263 var self = this, |
7625 fx = jQuery.fx; |
8264 fx = jQuery.fx, |
7626 |
8265 raf; |
7627 this.startTime = jQuery.now(); |
8266 |
8267 this.startTime = fxNow || createFxNow(); |
|
7628 this.start = from; |
8268 this.start = from; |
7629 this.end = to; |
8269 this.end = to; |
7630 this.unit = unit || this.unit || "px"; |
8270 this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" ); |
7631 this.now = this.start; |
8271 this.now = this.start; |
7632 this.pos = this.state = 0; |
8272 this.pos = this.state = 0; |
7633 |
8273 |
7634 function t( gotoEnd ) { |
8274 function t( gotoEnd ) { |
7635 return self.step(gotoEnd); |
8275 return self.step(gotoEnd); |
7636 } |
8276 } |
7637 |
8277 |
7638 t.elem = this.elem; |
8278 t.elem = this.elem; |
7639 |
8279 |
7640 if ( t() && jQuery.timers.push(t) && !timerId ) { |
8280 if ( t() && jQuery.timers.push(t) && !timerId ) { |
7641 timerId = setInterval(fx.tick, fx.interval); |
8281 // Use requestAnimationFrame instead of setInterval if available |
8282 if ( requestAnimationFrame ) { |
|
8283 timerId = 1; |
|
8284 raf = function() { |
|
8285 // When timerId gets set to null at any point, this stops |
|
8286 if ( timerId ) { |
|
8287 requestAnimationFrame( raf ); |
|
8288 fx.tick(); |
|
8289 } |
|
8290 }; |
|
8291 requestAnimationFrame( raf ); |
|
8292 } else { |
|
8293 timerId = setInterval( fx.tick, fx.interval ); |
|
8294 } |
|
7642 } |
8295 } |
7643 }, |
8296 }, |
7644 |
8297 |
7645 // Simple 'show' function |
8298 // Simple 'show' function |
7646 show: function() { |
8299 show: function() { |
7667 this.custom(this.cur(), 0); |
8320 this.custom(this.cur(), 0); |
7668 }, |
8321 }, |
7669 |
8322 |
7670 // Each step of an animation |
8323 // Each step of an animation |
7671 step: function( gotoEnd ) { |
8324 step: function( gotoEnd ) { |
7672 var t = jQuery.now(), done = true; |
8325 var t = fxNow || createFxNow(), |
7673 |
8326 done = true, |
7674 if ( gotoEnd || t >= this.options.duration + this.startTime ) { |
8327 elem = this.elem, |
8328 options = this.options, |
|
8329 i, n; |
|
8330 |
|
8331 if ( gotoEnd || t >= options.duration + this.startTime ) { |
|
7675 this.now = this.end; |
8332 this.now = this.end; |
7676 this.pos = this.state = 1; |
8333 this.pos = this.state = 1; |
7677 this.update(); |
8334 this.update(); |
7678 |
8335 |
7679 this.options.curAnim[ this.prop ] = true; |
8336 options.animatedProperties[ this.prop ] = true; |
7680 |
8337 |
7681 for ( var i in this.options.curAnim ) { |
8338 for ( i in options.animatedProperties ) { |
7682 if ( this.options.curAnim[i] !== true ) { |
8339 if ( options.animatedProperties[i] !== true ) { |
7683 done = false; |
8340 done = false; |
7684 } |
8341 } |
7685 } |
8342 } |
7686 |
8343 |
7687 if ( done ) { |
8344 if ( done ) { |
7688 // Reset the overflow |
8345 // Reset the overflow |
7689 if ( this.options.overflow != null && !jQuery.support.shrinkWrapBlocks ) { |
8346 if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) { |
7690 var elem = this.elem, |
|
7691 options = this.options; |
|
7692 |
8347 |
7693 jQuery.each( [ "", "X", "Y" ], function (index, value) { |
8348 jQuery.each( [ "", "X", "Y" ], function (index, value) { |
7694 elem.style[ "overflow" + value ] = options.overflow[index]; |
8349 elem.style[ "overflow" + value ] = options.overflow[index]; |
7695 } ); |
8350 }); |
7696 } |
8351 } |
7697 |
8352 |
7698 // Hide the element if the "hide" operation was done |
8353 // Hide the element if the "hide" operation was done |
7699 if ( this.options.hide ) { |
8354 if ( options.hide ) { |
7700 jQuery(this.elem).hide(); |
8355 jQuery(elem).hide(); |
7701 } |
8356 } |
7702 |
8357 |
7703 // Reset the properties, if the item has been hidden or shown |
8358 // Reset the properties, if the item has been hidden or shown |
7704 if ( this.options.hide || this.options.show ) { |
8359 if ( options.hide || options.show ) { |
7705 for ( var p in this.options.curAnim ) { |
8360 for ( var p in options.animatedProperties ) { |
7706 jQuery.style( this.elem, p, this.options.orig[p] ); |
8361 jQuery.style( elem, p, options.orig[p] ); |
7707 } |
8362 } |
7708 } |
8363 } |
7709 |
8364 |
7710 // Execute the complete function |
8365 // Execute the complete function |
7711 this.options.complete.call( this.elem ); |
8366 options.complete.call( elem ); |
7712 } |
8367 } |
7713 |
8368 |
7714 return false; |
8369 return false; |
7715 |
8370 |
7716 } else { |
8371 } else { |
7717 var n = t - this.startTime; |
8372 // classical easing cannot be used with an Infinity duration |
7718 this.state = n / this.options.duration; |
8373 if ( options.duration == Infinity ) { |
7719 |
8374 this.now = t; |
7720 // Perform the easing function, defaults to swing |
8375 } else { |
7721 var specialEasing = this.options.specialEasing && this.options.specialEasing[this.prop]; |
8376 n = t - this.startTime; |
7722 var defaultEasing = this.options.easing || (jQuery.easing.swing ? "swing" : "linear"); |
8377 |
7723 this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration); |
8378 this.state = n / options.duration; |
7724 this.now = this.start + ((this.end - this.start) * this.pos); |
8379 // Perform the easing function, defaults to swing |
7725 |
8380 this.pos = jQuery.easing[options.animatedProperties[this.prop]](this.state, n, 0, 1, options.duration); |
8381 this.now = this.start + ((this.end - this.start) * this.pos); |
|
8382 } |
|
7726 // Perform the next step of the animation |
8383 // Perform the next step of the animation |
7727 this.update(); |
8384 this.update(); |
7728 } |
8385 } |
7729 |
8386 |
7730 return true; |
8387 return true; |
7731 } |
8388 } |
7732 }; |
8389 }; |
7733 |
8390 |
7734 jQuery.extend( jQuery.fx, { |
8391 jQuery.extend( jQuery.fx, { |
7735 tick: function() { |
8392 tick: function() { |
7736 var timers = jQuery.timers; |
8393 var timers = jQuery.timers, |
7737 |
8394 i = timers.length; |
7738 for ( var i = 0; i < timers.length; i++ ) { |
8395 while ( i-- ) { |
7739 if ( !timers[i]() ) { |
8396 if ( !timers[i]() ) { |
7740 timers.splice(i--, 1); |
8397 timers.splice(i, 1); |
7741 } |
8398 } |
7742 } |
8399 } |
7743 |
8400 |
7744 if ( !timers.length ) { |
8401 if ( !timers.length ) { |
7745 jQuery.fx.stop(); |
8402 jQuery.fx.stop(); |
7781 return elem === fn.elem; |
8438 return elem === fn.elem; |
7782 }).length; |
8439 }).length; |
7783 }; |
8440 }; |
7784 } |
8441 } |
7785 |
8442 |
8443 // Try to restore the default display value of an element |
|
7786 function defaultDisplay( nodeName ) { |
8444 function defaultDisplay( nodeName ) { |
8445 |
|
7787 if ( !elemdisplay[ nodeName ] ) { |
8446 if ( !elemdisplay[ nodeName ] ) { |
7788 var elem = jQuery("<" + nodeName + ">").appendTo("body"), |
8447 |
7789 display = elem.css("display"); |
8448 var elem = jQuery( "<" + nodeName + ">" ).appendTo( "body" ), |
8449 display = elem.css( "display" ); |
|
7790 |
8450 |
7791 elem.remove(); |
8451 elem.remove(); |
7792 |
8452 |
8453 // If the simple way fails, |
|
8454 // get element's real default display by attaching it to a temp iframe |
|
7793 if ( display === "none" || display === "" ) { |
8455 if ( display === "none" || display === "" ) { |
7794 display = "block"; |
8456 // No iframe to use yet, so create it |
7795 } |
8457 if ( !iframe ) { |
7796 |
8458 iframe = document.createElement( "iframe" ); |
8459 iframe.frameBorder = iframe.width = iframe.height = 0; |
|
8460 } |
|
8461 |
|
8462 document.body.appendChild( iframe ); |
|
8463 |
|
8464 // Create a cacheable copy of the iframe document on first call. |
|
8465 // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake html |
|
8466 // document to it, Webkit & Firefox won't allow reusing the iframe document |
|
8467 if ( !iframeDoc || !iframe.createElement ) { |
|
8468 iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document; |
|
8469 iframeDoc.write( "<!doctype><html><body></body></html>" ); |
|
8470 } |
|
8471 |
|
8472 elem = iframeDoc.createElement( nodeName ); |
|
8473 |
|
8474 iframeDoc.body.appendChild( elem ); |
|
8475 |
|
8476 display = jQuery.css( elem, "display" ); |
|
8477 |
|
8478 document.body.removeChild( iframe ); |
|
8479 } |
|
8480 |
|
8481 // Store the correct default display |
|
7797 elemdisplay[ nodeName ] = display; |
8482 elemdisplay[ nodeName ] = display; |
7798 } |
8483 } |
7799 |
8484 |
7800 return elemdisplay[ nodeName ]; |
8485 return elemdisplay[ nodeName ]; |
7801 } |
8486 } |
7838 |
8523 |
7839 var body = doc.body, |
8524 var body = doc.body, |
7840 win = getWindow(doc), |
8525 win = getWindow(doc), |
7841 clientTop = docElem.clientTop || body.clientTop || 0, |
8526 clientTop = docElem.clientTop || body.clientTop || 0, |
7842 clientLeft = docElem.clientLeft || body.clientLeft || 0, |
8527 clientLeft = docElem.clientLeft || body.clientLeft || 0, |
7843 scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop ), |
8528 scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop, |
7844 scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft), |
8529 scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft, |
7845 top = box.top + scrollTop - clientTop, |
8530 top = box.top + scrollTop - clientTop, |
7846 left = box.left + scrollLeft - clientLeft; |
8531 left = box.left + scrollLeft - clientLeft; |
7847 |
8532 |
7848 return { top: top, left: left }; |
8533 return { top: top, left: left }; |
7849 }; |
8534 }; |
7952 this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5); |
8637 this.subtractsBorderForOverflowNotVisible = (checkDiv.offsetTop === -5); |
7953 |
8638 |
7954 this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop); |
8639 this.doesNotIncludeMarginInBodyOffset = (body.offsetTop !== bodyMarginTop); |
7955 |
8640 |
7956 body.removeChild( container ); |
8641 body.removeChild( container ); |
7957 body = container = innerDiv = checkDiv = table = td = null; |
|
7958 jQuery.offset.initialize = jQuery.noop; |
8642 jQuery.offset.initialize = jQuery.noop; |
7959 }, |
8643 }, |
7960 |
8644 |
7961 bodyOffset: function( body ) { |
8645 bodyOffset: function( body ) { |
7962 var top = body.offsetTop, |
8646 var top = body.offsetTop, |
7982 |
8666 |
7983 var curElem = jQuery( elem ), |
8667 var curElem = jQuery( elem ), |
7984 curOffset = curElem.offset(), |
8668 curOffset = curElem.offset(), |
7985 curCSSTop = jQuery.css( elem, "top" ), |
8669 curCSSTop = jQuery.css( elem, "top" ), |
7986 curCSSLeft = jQuery.css( elem, "left" ), |
8670 curCSSLeft = jQuery.css( elem, "left" ), |
7987 calculatePosition = (position === "absolute" && jQuery.inArray('auto', [curCSSTop, curCSSLeft]) > -1), |
8671 calculatePosition = (position === "absolute" || position === "fixed") && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, |
7988 props = {}, curPosition = {}, curTop, curLeft; |
8672 props = {}, curPosition = {}, curTop, curLeft; |
7989 |
8673 |
7990 // need to be able to calculate position if either top or left is auto and position is absolute |
8674 // need to be able to calculate position if either top or left is auto and position is either absolute or fixed |
7991 if ( calculatePosition ) { |
8675 if ( calculatePosition ) { |
7992 curPosition = curElem.position(); |
8676 curPosition = curElem.position(); |
7993 } |
8677 curTop = curPosition.top; |
7994 |
8678 curLeft = curPosition.left; |
7995 curTop = calculatePosition ? curPosition.top : parseInt( curCSSTop, 10 ) || 0; |
8679 } else { |
7996 curLeft = calculatePosition ? curPosition.left : parseInt( curCSSLeft, 10 ) || 0; |
8680 curTop = parseFloat( curCSSTop ) || 0; |
8681 curLeft = parseFloat( curCSSLeft ) || 0; |
|
8682 } |
|
7997 |
8683 |
7998 if ( jQuery.isFunction( options ) ) { |
8684 if ( jQuery.isFunction( options ) ) { |
7999 options = options.call( elem, i, curOffset ); |
8685 options = options.call( elem, i, curOffset ); |
8000 } |
8686 } |
8001 |
8687 |
8061 |
8747 |
8062 // Create scrollLeft and scrollTop methods |
8748 // Create scrollLeft and scrollTop methods |
8063 jQuery.each( ["Left", "Top"], function( i, name ) { |
8749 jQuery.each( ["Left", "Top"], function( i, name ) { |
8064 var method = "scroll" + name; |
8750 var method = "scroll" + name; |
8065 |
8751 |
8066 jQuery.fn[ method ] = function(val) { |
8752 jQuery.fn[ method ] = function( val ) { |
8067 var elem = this[0], win; |
8753 var elem, win; |
8068 |
8754 |
8069 if ( !elem ) { |
8755 if ( val === undefined ) { |
8070 return null; |
8756 elem = this[ 0 ]; |
8071 } |
8757 |
8072 |
8758 if ( !elem ) { |
8073 if ( val !== undefined ) { |
8759 return null; |
8074 // Set the scroll offset |
8760 } |
8075 return this.each(function() { |
8761 |
8076 win = getWindow( this ); |
|
8077 |
|
8078 if ( win ) { |
|
8079 win.scrollTo( |
|
8080 !i ? val : jQuery(win).scrollLeft(), |
|
8081 i ? val : jQuery(win).scrollTop() |
|
8082 ); |
|
8083 |
|
8084 } else { |
|
8085 this[ method ] = val; |
|
8086 } |
|
8087 }); |
|
8088 } else { |
|
8089 win = getWindow( elem ); |
8762 win = getWindow( elem ); |
8090 |
8763 |
8091 // Return the scroll offset |
8764 // Return the scroll offset |
8092 return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] : |
8765 return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] : |
8093 jQuery.support.boxModel && win.document.documentElement[ method ] || |
8766 jQuery.support.boxModel && win.document.documentElement[ method ] || |
8094 win.document.body[ method ] : |
8767 win.document.body[ method ] : |
8095 elem[ method ]; |
8768 elem[ method ]; |
8096 } |
8769 } |
8770 |
|
8771 // Set the scroll offset |
|
8772 return this.each(function() { |
|
8773 win = getWindow( this ); |
|
8774 |
|
8775 if ( win ) { |
|
8776 win.scrollTo( |
|
8777 !i ? val : jQuery( win ).scrollLeft(), |
|
8778 i ? val : jQuery( win ).scrollTop() |
|
8779 ); |
|
8780 |
|
8781 } else { |
|
8782 this[ method ] = val; |
|
8783 } |
|
8784 }); |
|
8097 }; |
8785 }; |
8098 }); |
8786 }); |
8099 |
8787 |
8100 function getWindow( elem ) { |
8788 function getWindow( elem ) { |
8101 return jQuery.isWindow( elem ) ? |
8789 return jQuery.isWindow( elem ) ? |
8171 }; |
8859 }; |
8172 |
8860 |
8173 }); |
8861 }); |
8174 |
8862 |
8175 |
8863 |
8864 window.jQuery = window.$ = jQuery; |
|
8176 })(window); |
8865 })(window); |