/src/main/webapp/resources/js/jquery-1.7.2.js
JavaScript | 9404 lines | 6619 code | 1558 blank | 1227 comment | 1928 complexity | af693f9aea7dae36fb3bef4c9b6e56fb MD5 | raw file
Large files files are truncated, but you can click here to view the full file
1/*!
2 * jQuery JavaScript Library v1.7.2
3 * http://jquery.com/
4 *
5 * Copyright 2011, John Resig
6 * Dual licensed under the MIT or GPL Version 2 licenses.
7 * http://jquery.org/license
8 *
9 * Includes Sizzle.js
10 * http://sizzlejs.com/
11 * Copyright 2011, The Dojo Foundation
12 * Released under the MIT, BSD, and GPL Licenses.
13 *
14 * Date: Wed Mar 21 12:46:34 2012 -0700
15 */
16(function( window, undefined ) {
17
18// Use the correct document accordingly with window argument (sandbox)
19var document = window.document,
20 navigator = window.navigator,
21 location = window.location;
22var jQuery = (function() {
23
24// Define a local copy of jQuery
25var jQuery = function( selector, context ) {
26 // The jQuery object is actually just the init constructor 'enhanced'
27 return new jQuery.fn.init( selector, context, rootjQuery );
28 },
29
30 // Map over jQuery in case of overwrite
31 _jQuery = window.jQuery,
32
33 // Map over the $ in case of overwrite
34 _$ = window.$,
35
36 // A central reference to the root jQuery(document)
37 rootjQuery,
38
39 // A simple way to check for HTML strings or ID strings
40 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
41 quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
42
43 // Check if a string has a non-whitespace character in it
44 rnotwhite = /\S/,
45
46 // Used for trimming whitespace
47 trimLeft = /^\s+/,
48 trimRight = /\s+$/,
49
50 // Match a standalone tag
51 rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
52
53 // JSON RegExp
54 rvalidchars = /^[\],:{}\s]*$/,
55 rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
56 rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
57 rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
58
59 // Useragent RegExp
60 rwebkit = /(webkit)[ \/]([\w.]+)/,
61 ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
62 rmsie = /(msie) ([\w.]+)/,
63 rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
64
65 // Matches dashed string for camelizing
66 rdashAlpha = /-([a-z]|[0-9])/ig,
67 rmsPrefix = /^-ms-/,
68
69 // Used by jQuery.camelCase as callback to replace()
70 fcamelCase = function( all, letter ) {
71 return ( letter + "" ).toUpperCase();
72 },
73
74 // Keep a UserAgent string for use with jQuery.browser
75 userAgent = navigator.userAgent,
76
77 // For matching the engine and version of the browser
78 browserMatch,
79
80 // The deferred used on DOM ready
81 readyList,
82
83 // The ready event handler
84 DOMContentLoaded,
85
86 // Save a reference to some core methods
87 toString = Object.prototype.toString,
88 hasOwn = Object.prototype.hasOwnProperty,
89 push = Array.prototype.push,
90 slice = Array.prototype.slice,
91 trim = String.prototype.trim,
92 indexOf = Array.prototype.indexOf,
93
94 // [[Class]] -> type pairs
95 class2type = {};
96
97jQuery.fn = jQuery.prototype = {
98 constructor: jQuery,
99 init: function( selector, context, rootjQuery ) {
100 var match, elem, ret, doc;
101
102 // Handle $(""), $(null), or $(undefined)
103 if ( !selector ) {
104 return this;
105 }
106
107 // Handle $(DOMElement)
108 if ( selector.nodeType ) {
109 this.context = this[0] = selector;
110 this.length = 1;
111 return this;
112 }
113
114 // The body element only exists once, optimize finding it
115 if ( selector === "body" && !context && document.body ) {
116 this.context = document;
117 this[0] = document.body;
118 this.selector = selector;
119 this.length = 1;
120 return this;
121 }
122
123 // Handle HTML strings
124 if ( typeof selector === "string" ) {
125 // Are we dealing with HTML string or an ID?
126 if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
127 // Assume that strings that start and end with <> are HTML and skip the regex check
128 match = [ null, selector, null ];
129
130 } else {
131 match = quickExpr.exec( selector );
132 }
133
134 // Verify a match, and that no context was specified for #id
135 if ( match && (match[1] || !context) ) {
136
137 // HANDLE: $(html) -> $(array)
138 if ( match[1] ) {
139 context = context instanceof jQuery ? context[0] : context;
140 doc = ( context ? context.ownerDocument || context : document );
141
142 // If a single string is passed in and it's a single tag
143 // just do a createElement and skip the rest
144 ret = rsingleTag.exec( selector );
145
146 if ( ret ) {
147 if ( jQuery.isPlainObject( context ) ) {
148 selector = [ document.createElement( ret[1] ) ];
149 jQuery.fn.attr.call( selector, context, true );
150
151 } else {
152 selector = [ doc.createElement( ret[1] ) ];
153 }
154
155 } else {
156 ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
157 selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes;
158 }
159
160 return jQuery.merge( this, selector );
161
162 // HANDLE: $("#id")
163 } else {
164 elem = document.getElementById( match[2] );
165
166 // Check parentNode to catch when Blackberry 4.6 returns
167 // nodes that are no longer in the document #6963
168 if ( elem && elem.parentNode ) {
169 // Handle the case where IE and Opera return items
170 // by name instead of ID
171 if ( elem.id !== match[2] ) {
172 return rootjQuery.find( selector );
173 }
174
175 // Otherwise, we inject the element directly into the jQuery object
176 this.length = 1;
177 this[0] = elem;
178 }
179
180 this.context = document;
181 this.selector = selector;
182 return this;
183 }
184
185 // HANDLE: $(expr, $(...))
186 } else if ( !context || context.jquery ) {
187 return ( context || rootjQuery ).find( selector );
188
189 // HANDLE: $(expr, context)
190 // (which is just equivalent to: $(context).find(expr)
191 } else {
192 return this.constructor( context ).find( selector );
193 }
194
195 // HANDLE: $(function)
196 // Shortcut for document ready
197 } else if ( jQuery.isFunction( selector ) ) {
198 return rootjQuery.ready( selector );
199 }
200
201 if ( selector.selector !== undefined ) {
202 this.selector = selector.selector;
203 this.context = selector.context;
204 }
205
206 return jQuery.makeArray( selector, this );
207 },
208
209 // Start with an empty selector
210 selector: "",
211
212 // The current version of jQuery being used
213 jquery: "1.7.2",
214
215 // The default length of a jQuery object is 0
216 length: 0,
217
218 // The number of elements contained in the matched element set
219 size: function() {
220 return this.length;
221 },
222
223 toArray: function() {
224 return slice.call( this, 0 );
225 },
226
227 // Get the Nth element in the matched element set OR
228 // Get the whole matched element set as a clean array
229 get: function( num ) {
230 return num == null ?
231
232 // Return a 'clean' array
233 this.toArray() :
234
235 // Return just the object
236 ( num < 0 ? this[ this.length + num ] : this[ num ] );
237 },
238
239 // Take an array of elements and push it onto the stack
240 // (returning the new matched element set)
241 pushStack: function( elems, name, selector ) {
242 // Build a new jQuery matched element set
243 var ret = this.constructor();
244
245 if ( jQuery.isArray( elems ) ) {
246 push.apply( ret, elems );
247
248 } else {
249 jQuery.merge( ret, elems );
250 }
251
252 // Add the old object onto the stack (as a reference)
253 ret.prevObject = this;
254
255 ret.context = this.context;
256
257 if ( name === "find" ) {
258 ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
259 } else if ( name ) {
260 ret.selector = this.selector + "." + name + "(" + selector + ")";
261 }
262
263 // Return the newly-formed element set
264 return ret;
265 },
266
267 // Execute a callback for every element in the matched set.
268 // (You can seed the arguments with an array of args, but this is
269 // only used internally.)
270 each: function( callback, args ) {
271 return jQuery.each( this, callback, args );
272 },
273
274 ready: function( fn ) {
275 // Attach the listeners
276 jQuery.bindReady();
277
278 // Add the callback
279 readyList.add( fn );
280
281 return this;
282 },
283
284 eq: function( i ) {
285 i = +i;
286 return i === -1 ?
287 this.slice( i ) :
288 this.slice( i, i + 1 );
289 },
290
291 first: function() {
292 return this.eq( 0 );
293 },
294
295 last: function() {
296 return this.eq( -1 );
297 },
298
299 slice: function() {
300 return this.pushStack( slice.apply( this, arguments ),
301 "slice", slice.call(arguments).join(",") );
302 },
303
304 map: function( callback ) {
305 return this.pushStack( jQuery.map(this, function( elem, i ) {
306 return callback.call( elem, i, elem );
307 }));
308 },
309
310 end: function() {
311 return this.prevObject || this.constructor(null);
312 },
313
314 // For internal use only.
315 // Behaves like an Array's method, not like a jQuery method.
316 push: push,
317 sort: [].sort,
318 splice: [].splice
319};
320
321// Give the init function the jQuery prototype for later instantiation
322jQuery.fn.init.prototype = jQuery.fn;
323
324jQuery.extend = jQuery.fn.extend = function() {
325 var options, name, src, copy, copyIsArray, clone,
326 target = arguments[0] || {},
327 i = 1,
328 length = arguments.length,
329 deep = false;
330
331 // Handle a deep copy situation
332 if ( typeof target === "boolean" ) {
333 deep = target;
334 target = arguments[1] || {};
335 // skip the boolean and the target
336 i = 2;
337 }
338
339 // Handle case when target is a string or something (possible in deep copy)
340 if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
341 target = {};
342 }
343
344 // extend jQuery itself if only one argument is passed
345 if ( length === i ) {
346 target = this;
347 --i;
348 }
349
350 for ( ; i < length; i++ ) {
351 // Only deal with non-null/undefined values
352 if ( (options = arguments[ i ]) != null ) {
353 // Extend the base object
354 for ( name in options ) {
355 src = target[ name ];
356 copy = options[ name ];
357
358 // Prevent never-ending loop
359 if ( target === copy ) {
360 continue;
361 }
362
363 // Recurse if we're merging plain objects or arrays
364 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
365 if ( copyIsArray ) {
366 copyIsArray = false;
367 clone = src && jQuery.isArray(src) ? src : [];
368
369 } else {
370 clone = src && jQuery.isPlainObject(src) ? src : {};
371 }
372
373 // Never move original objects, clone them
374 target[ name ] = jQuery.extend( deep, clone, copy );
375
376 // Don't bring in undefined values
377 } else if ( copy !== undefined ) {
378 target[ name ] = copy;
379 }
380 }
381 }
382 }
383
384 // Return the modified object
385 return target;
386};
387
388jQuery.extend({
389 noConflict: function( deep ) {
390 if ( window.$ === jQuery ) {
391 window.$ = _$;
392 }
393
394 if ( deep && window.jQuery === jQuery ) {
395 window.jQuery = _jQuery;
396 }
397
398 return jQuery;
399 },
400
401 // Is the DOM ready to be used? Set to true once it occurs.
402 isReady: false,
403
404 // A counter to track how many items to wait for before
405 // the ready event fires. See #6781
406 readyWait: 1,
407
408 // Hold (or release) the ready event
409 holdReady: function( hold ) {
410 if ( hold ) {
411 jQuery.readyWait++;
412 } else {
413 jQuery.ready( true );
414 }
415 },
416
417 // Handle when the DOM is ready
418 ready: function( wait ) {
419 // Either a released hold or an DOMready/load event and not yet ready
420 if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
421 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
422 if ( !document.body ) {
423 return setTimeout( jQuery.ready, 1 );
424 }
425
426 // Remember that the DOM is ready
427 jQuery.isReady = true;
428
429 // If a normal DOM Ready event fired, decrement, and wait if need be
430 if ( wait !== true && --jQuery.readyWait > 0 ) {
431 return;
432 }
433
434 // If there are functions bound, to execute
435 readyList.fireWith( document, [ jQuery ] );
436
437 // Trigger any bound ready events
438 if ( jQuery.fn.trigger ) {
439 jQuery( document ).trigger( "ready" ).off( "ready" );
440 }
441 }
442 },
443
444 bindReady: function() {
445 if ( readyList ) {
446 return;
447 }
448
449 readyList = jQuery.Callbacks( "once memory" );
450
451 // Catch cases where $(document).ready() is called after the
452 // browser event has already occurred.
453 if ( document.readyState === "complete" ) {
454 // Handle it asynchronously to allow scripts the opportunity to delay ready
455 return setTimeout( jQuery.ready, 1 );
456 }
457
458 // Mozilla, Opera and webkit nightlies currently support this event
459 if ( document.addEventListener ) {
460 // Use the handy event callback
461 document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
462
463 // A fallback to window.onload, that will always work
464 window.addEventListener( "load", jQuery.ready, false );
465
466 // If IE event model is used
467 } else if ( document.attachEvent ) {
468 // ensure firing before onload,
469 // maybe late but safe also for iframes
470 document.attachEvent( "onreadystatechange", DOMContentLoaded );
471
472 // A fallback to window.onload, that will always work
473 window.attachEvent( "onload", jQuery.ready );
474
475 // If IE and not a frame
476 // continually check to see if the document is ready
477 var toplevel = false;
478
479 try {
480 toplevel = window.frameElement == null;
481 } catch(e) {}
482
483 if ( document.documentElement.doScroll && toplevel ) {
484 doScrollCheck();
485 }
486 }
487 },
488
489 // See test/unit/core.js for details concerning isFunction.
490 // Since version 1.3, DOM methods and functions like alert
491 // aren't supported. They return false on IE (#2968).
492 isFunction: function( obj ) {
493 return jQuery.type(obj) === "function";
494 },
495
496 isArray: Array.isArray || function( obj ) {
497 return jQuery.type(obj) === "array";
498 },
499
500 isWindow: function( obj ) {
501 return obj != null && obj == obj.window;
502 },
503
504 isNumeric: function( obj ) {
505 return !isNaN( parseFloat(obj) ) && isFinite( obj );
506 },
507
508 type: function( obj ) {
509 return obj == null ?
510 String( obj ) :
511 class2type[ toString.call(obj) ] || "object";
512 },
513
514 isPlainObject: function( obj ) {
515 // Must be an Object.
516 // Because of IE, we also have to check the presence of the constructor property.
517 // Make sure that DOM nodes and window objects don't pass through, as well
518 if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
519 return false;
520 }
521
522 try {
523 // Not own constructor property must be Object
524 if ( obj.constructor &&
525 !hasOwn.call(obj, "constructor") &&
526 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
527 return false;
528 }
529 } catch ( e ) {
530 // IE8,9 Will throw exceptions on certain host objects #9897
531 return false;
532 }
533
534 // Own properties are enumerated firstly, so to speed up,
535 // if last one is own, then all properties are own.
536
537 var key;
538 for ( key in obj ) {}
539
540 return key === undefined || hasOwn.call( obj, key );
541 },
542
543 isEmptyObject: function( obj ) {
544 for ( var name in obj ) {
545 return false;
546 }
547 return true;
548 },
549
550 error: function( msg ) {
551 throw new Error( msg );
552 },
553
554 parseJSON: function( data ) {
555 if ( typeof data !== "string" || !data ) {
556 return null;
557 }
558
559 // Make sure leading/trailing whitespace is removed (IE can't handle it)
560 data = jQuery.trim( data );
561
562 // Attempt to parse using the native JSON parser first
563 if ( window.JSON && window.JSON.parse ) {
564 return window.JSON.parse( data );
565 }
566
567 // Make sure the incoming data is actual JSON
568 // Logic borrowed from http://json.org/json2.js
569 if ( rvalidchars.test( data.replace( rvalidescape, "@" )
570 .replace( rvalidtokens, "]" )
571 .replace( rvalidbraces, "")) ) {
572
573 return ( new Function( "return " + data ) )();
574
575 }
576 jQuery.error( "Invalid JSON: " + data );
577 },
578
579 // Cross-browser xml parsing
580 parseXML: function( data ) {
581 if ( typeof data !== "string" || !data ) {
582 return null;
583 }
584 var xml, tmp;
585 try {
586 if ( window.DOMParser ) { // Standard
587 tmp = new DOMParser();
588 xml = tmp.parseFromString( data , "text/xml" );
589 } else { // IE
590 xml = new ActiveXObject( "Microsoft.XMLDOM" );
591 xml.async = "false";
592 xml.loadXML( data );
593 }
594 } catch( e ) {
595 xml = undefined;
596 }
597 if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
598 jQuery.error( "Invalid XML: " + data );
599 }
600 return xml;
601 },
602
603 noop: function() {},
604
605 // Evaluates a script in a global context
606 // Workarounds based on findings by Jim Driscoll
607 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
608 globalEval: function( data ) {
609 if ( data && rnotwhite.test( data ) ) {
610 // We use execScript on Internet Explorer
611 // We use an anonymous function so that context is window
612 // rather than jQuery in Firefox
613 ( window.execScript || function( data ) {
614 window[ "eval" ].call( window, data );
615 } )( data );
616 }
617 },
618
619 // Convert dashed to camelCase; used by the css and data modules
620 // Microsoft forgot to hump their vendor prefix (#9572)
621 camelCase: function( string ) {
622 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
623 },
624
625 nodeName: function( elem, name ) {
626 return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
627 },
628
629 // args is for internal usage only
630 each: function( object, callback, args ) {
631 var name, i = 0,
632 length = object.length,
633 isObj = length === undefined || jQuery.isFunction( object );
634
635 if ( args ) {
636 if ( isObj ) {
637 for ( name in object ) {
638 if ( callback.apply( object[ name ], args ) === false ) {
639 break;
640 }
641 }
642 } else {
643 for ( ; i < length; ) {
644 if ( callback.apply( object[ i++ ], args ) === false ) {
645 break;
646 }
647 }
648 }
649
650 // A special, fast, case for the most common use of each
651 } else {
652 if ( isObj ) {
653 for ( name in object ) {
654 if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
655 break;
656 }
657 }
658 } else {
659 for ( ; i < length; ) {
660 if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
661 break;
662 }
663 }
664 }
665 }
666
667 return object;
668 },
669
670 // Use native String.trim function wherever possible
671 trim: trim ?
672 function( text ) {
673 return text == null ?
674 "" :
675 trim.call( text );
676 } :
677
678 // Otherwise use our own trimming functionality
679 function( text ) {
680 return text == null ?
681 "" :
682 text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
683 },
684
685 // results is for internal usage only
686 makeArray: function( array, results ) {
687 var ret = results || [];
688
689 if ( array != null ) {
690 // The window, strings (and functions) also have 'length'
691 // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
692 var type = jQuery.type( array );
693
694 if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
695 push.call( ret, array );
696 } else {
697 jQuery.merge( ret, array );
698 }
699 }
700
701 return ret;
702 },
703
704 inArray: function( elem, array, i ) {
705 var len;
706
707 if ( array ) {
708 if ( indexOf ) {
709 return indexOf.call( array, elem, i );
710 }
711
712 len = array.length;
713 i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
714
715 for ( ; i < len; i++ ) {
716 // Skip accessing in sparse arrays
717 if ( i in array && array[ i ] === elem ) {
718 return i;
719 }
720 }
721 }
722
723 return -1;
724 },
725
726 merge: function( first, second ) {
727 var i = first.length,
728 j = 0;
729
730 if ( typeof second.length === "number" ) {
731 for ( var l = second.length; j < l; j++ ) {
732 first[ i++ ] = second[ j ];
733 }
734
735 } else {
736 while ( second[j] !== undefined ) {
737 first[ i++ ] = second[ j++ ];
738 }
739 }
740
741 first.length = i;
742
743 return first;
744 },
745
746 grep: function( elems, callback, inv ) {
747 var ret = [], retVal;
748 inv = !!inv;
749
750 // Go through the array, only saving the items
751 // that pass the validator function
752 for ( var i = 0, length = elems.length; i < length; i++ ) {
753 retVal = !!callback( elems[ i ], i );
754 if ( inv !== retVal ) {
755 ret.push( elems[ i ] );
756 }
757 }
758
759 return ret;
760 },
761
762 // arg is for internal usage only
763 map: function( elems, callback, arg ) {
764 var value, key, ret = [],
765 i = 0,
766 length = elems.length,
767 // jquery objects are treated as arrays
768 isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
769
770 // Go through the array, translating each of the items to their
771 if ( isArray ) {
772 for ( ; i < length; i++ ) {
773 value = callback( elems[ i ], i, arg );
774
775 if ( value != null ) {
776 ret[ ret.length ] = value;
777 }
778 }
779
780 // Go through every key on the object,
781 } else {
782 for ( key in elems ) {
783 value = callback( elems[ key ], key, arg );
784
785 if ( value != null ) {
786 ret[ ret.length ] = value;
787 }
788 }
789 }
790
791 // Flatten any nested arrays
792 return ret.concat.apply( [], ret );
793 },
794
795 // A global GUID counter for objects
796 guid: 1,
797
798 // Bind a function to a context, optionally partially applying any
799 // arguments.
800 proxy: function( fn, context ) {
801 if ( typeof context === "string" ) {
802 var tmp = fn[ context ];
803 context = fn;
804 fn = tmp;
805 }
806
807 // Quick check to determine if target is callable, in the spec
808 // this throws a TypeError, but we will just return undefined.
809 if ( !jQuery.isFunction( fn ) ) {
810 return undefined;
811 }
812
813 // Simulated bind
814 var args = slice.call( arguments, 2 ),
815 proxy = function() {
816 return fn.apply( context, args.concat( slice.call( arguments ) ) );
817 };
818
819 // Set the guid of unique handler to the same of original handler, so it can be removed
820 proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
821
822 return proxy;
823 },
824
825 // Mutifunctional method to get and set values to a collection
826 // The value/s can optionally be executed if it's a function
827 access: function( elems, fn, key, value, chainable, emptyGet, pass ) {
828 var exec,
829 bulk = key == null,
830 i = 0,
831 length = elems.length;
832
833 // Sets many values
834 if ( key && typeof key === "object" ) {
835 for ( i in key ) {
836 jQuery.access( elems, fn, i, key[i], 1, emptyGet, value );
837 }
838 chainable = 1;
839
840 // Sets one value
841 } else if ( value !== undefined ) {
842 // Optionally, function values get executed if exec is true
843 exec = pass === undefined && jQuery.isFunction( value );
844
845 if ( bulk ) {
846 // Bulk operations only iterate when executing function values
847 if ( exec ) {
848 exec = fn;
849 fn = function( elem, key, value ) {
850 return exec.call( jQuery( elem ), value );
851 };
852
853 // Otherwise they run against the entire set
854 } else {
855 fn.call( elems, value );
856 fn = null;
857 }
858 }
859
860 if ( fn ) {
861 for (; i < length; i++ ) {
862 fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
863 }
864 }
865
866 chainable = 1;
867 }
868
869 return chainable ?
870 elems :
871
872 // Gets
873 bulk ?
874 fn.call( elems ) :
875 length ? fn( elems[0], key ) : emptyGet;
876 },
877
878 now: function() {
879 return ( new Date() ).getTime();
880 },
881
882 // Use of jQuery.browser is frowned upon.
883 // More details: http://docs.jquery.com/Utilities/jQuery.browser
884 uaMatch: function( ua ) {
885 ua = ua.toLowerCase();
886
887 var match = rwebkit.exec( ua ) ||
888 ropera.exec( ua ) ||
889 rmsie.exec( ua ) ||
890 ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
891 [];
892
893 return { browser: match[1] || "", version: match[2] || "0" };
894 },
895
896 sub: function() {
897 function jQuerySub( selector, context ) {
898 return new jQuerySub.fn.init( selector, context );
899 }
900 jQuery.extend( true, jQuerySub, this );
901 jQuerySub.superclass = this;
902 jQuerySub.fn = jQuerySub.prototype = this();
903 jQuerySub.fn.constructor = jQuerySub;
904 jQuerySub.sub = this.sub;
905 jQuerySub.fn.init = function init( selector, context ) {
906 if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
907 context = jQuerySub( context );
908 }
909
910 return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
911 };
912 jQuerySub.fn.init.prototype = jQuerySub.fn;
913 var rootjQuerySub = jQuerySub(document);
914 return jQuerySub;
915 },
916
917 browser: {}
918});
919
920// Populate the class2type map
921jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
922 class2type[ "[object " + name + "]" ] = name.toLowerCase();
923});
924
925browserMatch = jQuery.uaMatch( userAgent );
926if ( browserMatch.browser ) {
927 jQuery.browser[ browserMatch.browser ] = true;
928 jQuery.browser.version = browserMatch.version;
929}
930
931// Deprecated, use jQuery.browser.webkit instead
932if ( jQuery.browser.webkit ) {
933 jQuery.browser.safari = true;
934}
935
936// IE doesn't match non-breaking spaces with \s
937if ( rnotwhite.test( "\xA0" ) ) {
938 trimLeft = /^[\s\xA0]+/;
939 trimRight = /[\s\xA0]+$/;
940}
941
942// All jQuery objects should point back to these
943rootjQuery = jQuery(document);
944
945// Cleanup functions for the document ready method
946if ( document.addEventListener ) {
947 DOMContentLoaded = function() {
948 document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
949 jQuery.ready();
950 };
951
952} else if ( document.attachEvent ) {
953 DOMContentLoaded = function() {
954 // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
955 if ( document.readyState === "complete" ) {
956 document.detachEvent( "onreadystatechange", DOMContentLoaded );
957 jQuery.ready();
958 }
959 };
960}
961
962// The DOM ready check for Internet Explorer
963function doScrollCheck() {
964 if ( jQuery.isReady ) {
965 return;
966 }
967
968 try {
969 // If IE is used, use the trick by Diego Perini
970 // http://javascript.nwbox.com/IEContentLoaded/
971 document.documentElement.doScroll("left");
972 } catch(e) {
973 setTimeout( doScrollCheck, 1 );
974 return;
975 }
976
977 // and execute any waiting functions
978 jQuery.ready();
979}
980
981return jQuery;
982
983})();
984
985
986// String to Object flags format cache
987var flagsCache = {};
988
989// Convert String-formatted flags into Object-formatted ones and store in cache
990function createFlags( flags ) {
991 var object = flagsCache[ flags ] = {},
992 i, length;
993 flags = flags.split( /\s+/ );
994 for ( i = 0, length = flags.length; i < length; i++ ) {
995 object[ flags[i] ] = true;
996 }
997 return object;
998}
999
1000/*
1001 * Create a callback list using the following parameters:
1002 *
1003 * flags: an optional list of space-separated flags that will change how
1004 * the callback list behaves
1005 *
1006 * By default a callback list will act like an event callback list and can be
1007 * "fired" multiple times.
1008 *
1009 * Possible flags:
1010 *
1011 * once: will ensure the callback list can only be fired once (like a Deferred)
1012 *
1013 * memory: will keep track of previous values and will call any callback added
1014 * after the list has been fired right away with the latest "memorized"
1015 * values (like a Deferred)
1016 *
1017 * unique: will ensure a callback can only be added once (no duplicate in the list)
1018 *
1019 * stopOnFalse: interrupt callings when a callback returns false
1020 *
1021 */
1022jQuery.Callbacks = function( flags ) {
1023
1024 // Convert flags from String-formatted to Object-formatted
1025 // (we check in cache first)
1026 flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {};
1027
1028 var // Actual callback list
1029 list = [],
1030 // Stack of fire calls for repeatable lists
1031 stack = [],
1032 // Last fire value (for non-forgettable lists)
1033 memory,
1034 // Flag to know if list was already fired
1035 fired,
1036 // Flag to know if list is currently firing
1037 firing,
1038 // First callback to fire (used internally by add and fireWith)
1039 firingStart,
1040 // End of the loop when firing
1041 firingLength,
1042 // Index of currently firing callback (modified by remove if needed)
1043 firingIndex,
1044 // Add one or several callbacks to the list
1045 add = function( args ) {
1046 var i,
1047 length,
1048 elem,
1049 type,
1050 actual;
1051 for ( i = 0, length = args.length; i < length; i++ ) {
1052 elem = args[ i ];
1053 type = jQuery.type( elem );
1054 if ( type === "array" ) {
1055 // Inspect recursively
1056 add( elem );
1057 } else if ( type === "function" ) {
1058 // Add if not in unique mode and callback is not in
1059 if ( !flags.unique || !self.has( elem ) ) {
1060 list.push( elem );
1061 }
1062 }
1063 }
1064 },
1065 // Fire callbacks
1066 fire = function( context, args ) {
1067 args = args || [];
1068 memory = !flags.memory || [ context, args ];
1069 fired = true;
1070 firing = true;
1071 firingIndex = firingStart || 0;
1072 firingStart = 0;
1073 firingLength = list.length;
1074 for ( ; list && firingIndex < firingLength; firingIndex++ ) {
1075 if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) {
1076 memory = true; // Mark as halted
1077 break;
1078 }
1079 }
1080 firing = false;
1081 if ( list ) {
1082 if ( !flags.once ) {
1083 if ( stack && stack.length ) {
1084 memory = stack.shift();
1085 self.fireWith( memory[ 0 ], memory[ 1 ] );
1086 }
1087 } else if ( memory === true ) {
1088 self.disable();
1089 } else {
1090 list = [];
1091 }
1092 }
1093 },
1094 // Actual Callbacks object
1095 self = {
1096 // Add a callback or a collection of callbacks to the list
1097 add: function() {
1098 if ( list ) {
1099 var length = list.length;
1100 add( arguments );
1101 // Do we need to add the callbacks to the
1102 // current firing batch?
1103 if ( firing ) {
1104 firingLength = list.length;
1105 // With memory, if we're not firing then
1106 // we should call right away, unless previous
1107 // firing was halted (stopOnFalse)
1108 } else if ( memory && memory !== true ) {
1109 firingStart = length;
1110 fire( memory[ 0 ], memory[ 1 ] );
1111 }
1112 }
1113 return this;
1114 },
1115 // Remove a callback from the list
1116 remove: function() {
1117 if ( list ) {
1118 var args = arguments,
1119 argIndex = 0,
1120 argLength = args.length;
1121 for ( ; argIndex < argLength ; argIndex++ ) {
1122 for ( var i = 0; i < list.length; i++ ) {
1123 if ( args[ argIndex ] === list[ i ] ) {
1124 // Handle firingIndex and firingLength
1125 if ( firing ) {
1126 if ( i <= firingLength ) {
1127 firingLength--;
1128 if ( i <= firingIndex ) {
1129 firingIndex--;
1130 }
1131 }
1132 }
1133 // Remove the element
1134 list.splice( i--, 1 );
1135 // If we have some unicity property then
1136 // we only need to do this once
1137 if ( flags.unique ) {
1138 break;
1139 }
1140 }
1141 }
1142 }
1143 }
1144 return this;
1145 },
1146 // Control if a given callback is in the list
1147 has: function( fn ) {
1148 if ( list ) {
1149 var i = 0,
1150 length = list.length;
1151 for ( ; i < length; i++ ) {
1152 if ( fn === list[ i ] ) {
1153 return true;
1154 }
1155 }
1156 }
1157 return false;
1158 },
1159 // Remove all callbacks from the list
1160 empty: function() {
1161 list = [];
1162 return this;
1163 },
1164 // Have the list do nothing anymore
1165 disable: function() {
1166 list = stack = memory = undefined;
1167 return this;
1168 },
1169 // Is it disabled?
1170 disabled: function() {
1171 return !list;
1172 },
1173 // Lock the list in its current state
1174 lock: function() {
1175 stack = undefined;
1176 if ( !memory || memory === true ) {
1177 self.disable();
1178 }
1179 return this;
1180 },
1181 // Is it locked?
1182 locked: function() {
1183 return !stack;
1184 },
1185 // Call all callbacks with the given context and arguments
1186 fireWith: function( context, args ) {
1187 if ( stack ) {
1188 if ( firing ) {
1189 if ( !flags.once ) {
1190 stack.push( [ context, args ] );
1191 }
1192 } else if ( !( flags.once && memory ) ) {
1193 fire( context, args );
1194 }
1195 }
1196 return this;
1197 },
1198 // Call all the callbacks with the given arguments
1199 fire: function() {
1200 self.fireWith( this, arguments );
1201 return this;
1202 },
1203 // To know if the callbacks have already been called at least once
1204 fired: function() {
1205 return !!fired;
1206 }
1207 };
1208
1209 return self;
1210};
1211
1212
1213
1214
1215var // Static reference to slice
1216 sliceDeferred = [].slice;
1217
1218jQuery.extend({
1219
1220 Deferred: function( func ) {
1221 var doneList = jQuery.Callbacks( "once memory" ),
1222 failList = jQuery.Callbacks( "once memory" ),
1223 progressList = jQuery.Callbacks( "memory" ),
1224 state = "pending",
1225 lists = {
1226 resolve: doneList,
1227 reject: failList,
1228 notify: progressList
1229 },
1230 promise = {
1231 done: doneList.add,
1232 fail: failList.add,
1233 progress: progressList.add,
1234
1235 state: function() {
1236 return state;
1237 },
1238
1239 // Deprecated
1240 isResolved: doneList.fired,
1241 isRejected: failList.fired,
1242
1243 then: function( doneCallbacks, failCallbacks, progressCallbacks ) {
1244 deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks );
1245 return this;
1246 },
1247 always: function() {
1248 deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments );
1249 return this;
1250 },
1251 pipe: function( fnDone, fnFail, fnProgress ) {
1252 return jQuery.Deferred(function( newDefer ) {
1253 jQuery.each( {
1254 done: [ fnDone, "resolve" ],
1255 fail: [ fnFail, "reject" ],
1256 progress: [ fnProgress, "notify" ]
1257 }, function( handler, data ) {
1258 var fn = data[ 0 ],
1259 action = data[ 1 ],
1260 returned;
1261 if ( jQuery.isFunction( fn ) ) {
1262 deferred[ handler ](function() {
1263 returned = fn.apply( this, arguments );
1264 if ( returned && jQuery.isFunction( returned.promise ) ) {
1265 returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify );
1266 } else {
1267 newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
1268 }
1269 });
1270 } else {
1271 deferred[ handler ]( newDefer[ action ] );
1272 }
1273 });
1274 }).promise();
1275 },
1276 // Get a promise for this deferred
1277 // If obj is provided, the promise aspect is added to the object
1278 promise: function( obj ) {
1279 if ( obj == null ) {
1280 obj = promise;
1281 } else {
1282 for ( var key in promise ) {
1283 obj[ key ] = promise[ key ];
1284 }
1285 }
1286 return obj;
1287 }
1288 },
1289 deferred = promise.promise({}),
1290 key;
1291
1292 for ( key in lists ) {
1293 deferred[ key ] = lists[ key ].fire;
1294 deferred[ key + "With" ] = lists[ key ].fireWith;
1295 }
1296
1297 // Handle state
1298 deferred.done( function() {
1299 state = "resolved";
1300 }, failList.disable, progressList.lock ).fail( function() {
1301 state = "rejected";
1302 }, doneList.disable, progressList.lock );
1303
1304 // Call given func if any
1305 if ( func ) {
1306 func.call( deferred, deferred );
1307 }
1308
1309 // All done!
1310 return deferred;
1311 },
1312
1313 // Deferred helper
1314 when: function( firstParam ) {
1315 var args = sliceDeferred.call( arguments, 0 ),
1316 i = 0,
1317 length = args.length,
1318 pValues = new Array( length ),
1319 count = length,
1320 pCount = length,
1321 deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
1322 firstParam :
1323 jQuery.Deferred(),
1324 promise = deferred.promise();
1325 function resolveFunc( i ) {
1326 return function( value ) {
1327 args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
1328 if ( !( --count ) ) {
1329 deferred.resolveWith( deferred, args );
1330 }
1331 };
1332 }
1333 function progressFunc( i ) {
1334 return function( value ) {
1335 pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
1336 deferred.notifyWith( promise, pValues );
1337 };
1338 }
1339 if ( length > 1 ) {
1340 for ( ; i < length; i++ ) {
1341 if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) {
1342 args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) );
1343 } else {
1344 --count;
1345 }
1346 }
1347 if ( !count ) {
1348 deferred.resolveWith( deferred, args );
1349 }
1350 } else if ( deferred !== firstParam ) {
1351 deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
1352 }
1353 return promise;
1354 }
1355});
1356
1357
1358
1359
1360jQuery.support = (function() {
1361
1362 var support,
1363 all,
1364 a,
1365 select,
1366 opt,
1367 input,
1368 fragment,
1369 tds,
1370 events,
1371 eventName,
1372 i,
1373 isSupported,
1374 div = document.createElement( "div" ),
1375 documentElement = document.documentElement;
1376
1377 // Preliminary tests
1378 div.setAttribute("className", "t");
1379 div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
1380
1381 all = div.getElementsByTagName( "*" );
1382 a = div.getElementsByTagName( "a" )[ 0 ];
1383
1384 // Can't get basic test support
1385 if ( !all || !all.length || !a ) {
1386 return {};
1387 }
1388
1389 // First batch of supports tests
1390 select = document.createElement( "select" );
1391 opt = select.appendChild( document.createElement("option") );
1392 input = div.getElementsByTagName( "input" )[ 0 ];
1393
1394 support = {
1395 // IE strips leading whitespace when .innerHTML is used
1396 leadingWhitespace: ( div.firstChild.nodeType === 3 ),
1397
1398 // Make sure that tbody elements aren't automatically inserted
1399 // IE will insert them into empty tables
1400 tbody: !div.getElementsByTagName("tbody").length,
1401
1402 // Make sure that link elements get serialized correctly by innerHTML
1403 // This requires a wrapper element in IE
1404 htmlSerialize: !!div.getElementsByTagName("link").length,
1405
1406 // Get the style information from getAttribute
1407 // (IE uses .cssText instead)
1408 style: /top/.test( a.getAttribute("style") ),
1409
1410 // Make sure that URLs aren't manipulated
1411 // (IE normalizes it by default)
1412 hrefNormalized: ( a.getAttribute("href") === "/a" ),
1413
1414 // Make sure that element opacity exists
1415 // (IE uses filter instead)
1416 // Use a regex to work around a WebKit issue. See #5145
1417 opacity: /^0.55/.test( a.style.opacity ),
1418
1419 // Verify style float existence
1420 // (IE uses styleFloat instead of cssFloat)
1421 cssFloat: !!a.style.cssFloat,
1422
1423 // Make sure that if no value is specified for a checkbox
1424 // that it defaults to "on".
1425 // (WebKit defaults to "" instead)
1426 checkOn: ( input.value === "on" ),
1427
1428 // Make sure that a selected-by-default option has a working selected property.
1429 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
1430 optSelected: opt.selected,
1431
1432 // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
1433 getSetAttribute: div.className !== "t",
1434
1435 // Tests for enctype support on a form(#6743)
1436 enctype: !!document.createElement("form").enctype,
1437
1438 // Makes sure cloning an html5 element does not cause problems
1439 // Where outerHTML is undefined, this still works
1440 html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
1441
1442 // Will be defined later
1443 submitBubbles: true,
1444 changeBubbles: true,
1445 focusinBubbles: false,
1446 deleteExpando: true,
1447 noCloneEvent: true,
1448 inlineBlockNeedsLayout: false,
1449 shrinkWrapBlocks: false,
1450 reliableMarginRight: true,
1451 pixelMargin: true
1452 };
1453
1454 // jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead
1455 jQuery.boxModel = support.boxModel = (document.compatMode === "CSS1Compat");
1456
1457 // Make sure checked status is properly cloned
1458 input.checked = true;
1459 support.noCloneChecked = input.cloneNode( true ).checked;
1460
1461 // Make sure that the options inside disabled selects aren't marked as disabled
1462 // (WebKit marks them as disabled)
1463 select.disabled = true;
1464 support.optDisabled = !opt.disabled;
1465
1466 // Test to see if it's possible to delete an expando from an element
1467 // Fails in Internet Explorer
1468 try {
1469 delete div.test;
1470 } catch( e ) {
1471 support.deleteExpando = false;
1472 }
1473
1474 if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
1475 div.attachEvent( "onclick", function() {
1476 // Cloning a node shouldn't copy over any
1477 // bound event handlers (IE does this)
1478 support.noCloneEvent = false;
1479 });
1480 div.cloneNode( true ).fireEvent( "onclick" );
1481 }
1482
1483 // Check if a radio maintains its value
1484 // after being appended to the DOM
1485 input = document.createElement("input");
1486 input.value = "t";
1487 input.setAttribute("type", "radio");
1488 support.radioValue = input.value === "t";
1489
1490 input.setAttribute("checked", "checked");
1491
1492 // #11217 - WebKit loses check when the name is after the checked attribute
1493 input.setAttribute( "name", "t" );
1494
1495 div.appendChild( input );
1496 fragment = document.createDocumentFragment();
1497 fragment.appendChild( div.lastChild );
1498
1499 // WebKit doesn't clone checked state correctly in fragments
1500 support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
1501
1502 // Check if a disconnected checkbox will retain its checked
1503 // value of true after appended to the DOM (IE6/7)
1504 support.appendChecked = input.checked;
1505
1506 fragment.removeChild( input );
1507 fragment.appendChild( div );
1508
1509 // Technique from Juriy Zaytsev
1510 // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
1511 // We only care about the case where non-standard event systems
1512 // are used, namely in IE. Short-circuiting here helps us to
1513 // avoid an eval call (in setAttribute) which can cause CSP
1514 // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
1515 if ( div.attachEvent ) {
1516 for ( i in {
1517 submit: 1,
1518 change: 1,
1519 focusin: 1
1520 }) {
1521 eventName = "on" + i;
1522 isSupported = ( eventName in div );
1523 if ( !isSupported ) {
1524 div.setAttribute( eventName, "return;" );
1525 isSupported = ( typeof div[ eventName ] === "function" );
1526 }
1527 support[ i + "Bubbles" ] = isSupported;
1528 }
1529 }
1530
1531 fragment.removeChild( div );
1532
1533 // Null elements to avoid leaks in IE
1534 fragment = select = opt = div = input = null;
1535
1536 // Run tests that need a body at doc ready
1537 jQuery(function() {
1538 var container, outer, inner, table, td, offsetSupport,
1539 marginDiv, conMarginTop, style, html, positionTopLeftWidthHeight,
1540 paddingMarginBorderVisibility, paddingMarginBorder,
1541 body = document.getElementsByTagName("body")[0];
1542
1543 if ( !body ) {
1544 // Return for frameset docs that don't have a body
1545 return;
1546 }
1547
1548 conMarginTop = 1;
1549 paddingMarginBorder = "padding:0;margin:0;border:";
1550 positionTopLeftWidthHeight = "position:absolute;top:0;left:0;width:1px;height:1px;";
1551 paddingMarginBorderVisibility = paddingMarginBorder + "0;visibility:hidden;";
1552 style = "style='" + positionTopLeftWidthHeight + paddingMarginBorder + "5px solid #000;";
1553 html = "<div " + style + "display:block;'><div style='" + paddingMarginBorder + "0;display:block;overflow:hidden;'></div></div>" +
1554 "<table " + style + "' cellpadding='0' cellspacing='0'>" +
1555 "<tr><td></td></tr></table>";
1556
1557 container = document.createElement("div");
1558 container.style.cssText = paddingMarginBorderVisibility + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";
1559 body.insertBefore( container, body.firstChild );
1560
1561 // Construct the test element
1562 div = document.createElement("div");
1563 container.appendChild( div );
1564
1565 // Check if table cells still have offsetWidth/Height when they are set
1566 // to display:none and there are still other visible table cells in a
1567 // table row; if so, offsetWidth/Height are not reliable for use when
1568 // determining if an element has been hidden directly using
1569 // display:none (it is still safe to use offsets if a parent element is
1570 // hidden; don safety goggles and see bug #4512 for more information).
1571 // (only IE 8 fails this test)
1572 div.innerHTML = "<table><tr><td style='" + paddingMarginBorder + "0;display:none'></td><td>t</td></tr></table>";
1573 tds = div.getElementsByTagName( "td" );
1574 isSupported = ( tds[ 0 ].offsetHeight === 0 );
1575
1576 tds[ 0 ].style.display = "";
1577 tds[ 1 ].style.display = "none";
1578
1579 // Check if empty table cells still have offsetWidth/Height
1580 // (IE <= 8 fail this test)
1581 support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
1582
1583 // Check if div with explicit width and no margin-right incorrectly
1584 // gets computed margin-right based on width of container. For more
1585 // info see bug #3333
1586 // Fails in WebKit before Feb 2011 nightlies
1587 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
1588 if ( window.getComputedStyle ) {
1589 div.innerHTML = "";
1590 marginDiv = document.createElement( "div" );
1591 marginDiv.style.width = "0";
1592 marginDiv.style.marginRight = "0";
1593 div.style.width = "2px";
1594 div.appendChild( marginDiv );
1595 support.reliableMarginRight =
1596 ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
1597 }
1598
1599 if ( typeof div.style.zoom !== "undefined" ) {
1600 // Check if natively block-level elements act like inline-block
1601 // elements when setting their display to 'inline' and giving
1602 // them layout
1603 // (IE < 8 does this)
1604 div.innerHTML = "";
1605 div.style.width = div.style.padding = "1px";
1606 div.style.border = 0;
1607 div.style.overflow = "hidden";
1608 div.style.display = "inline";
1609 div.style.zoom = 1;
1610 support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
1611
1612 // Check if elements with layout shrink-wrap their children
1613 // (IE 6 does this)
1614 div.style.display = "block";
1615 div.style.overflow = "visible";
1616 div.innerHTML = "<div style='width:5px;'></div>";
1617 support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
1618 }
1619
1620 div.style.cssText = positionTopLeftWidthHeight + paddingMarginBorderVisibility;
1621 div.innerHTML = html;
1622
1623 outer = div.firstChild;
1624 inner = outer.firstChild;
1625 td = outer.nextSibling.firstChild.firstChild;
1626
1627 offsetSupport = {
1628 doesNotAddBorder: ( inner.offsetTop !== 5 ),
1629 doesAddBorderForTableAndCells: ( td.offsetTop === 5 )
1630 };
1631
1632 inner.style.position = "fixed";
1633 inner.style.top = "20px";
1634
1635 // safari subtracts parent border width here which is 5px
1636 offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 );
1637 inner.style.position = inner.style.top = "";
1638
1639 outer.style.overflow = "hidden";
1640 outer.style.position = "relative";
1641
1642 offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 );
1643 offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop );
1644
1645 if ( window.getComputedStyle ) {
1646 div.style.marginTop = "1%";
1647 support.pixelMargin = ( window.getComputedStyle( div, null ) || { marginTop: 0 } ).marginTop !== "1%";
1648 }
1649
1650 if ( typeof container.style.zoom !== "undefined" ) {
1651 container.style.zoom = 1;
1652 }
1653
1654 body.removeChild( container );
1655 marginDiv = div = container = null;
1656
1657 jQuery.extend( support, offsetSupport );
1658 });
1659
1660 return support;
1661})();
1662
1663
1664
1665
1666var rbrace = /^(?:\{.*\}|\[.*\])$/,
1667 rmultiDash = /([A-Z])/g;
1668
1669jQuery.extend({
1670 cache: {},
1671
1672 // Please use with caution
1673 uuid: 0,
1674
1675 // Unique for each copy of jQuery on the page
1676 // Non-digits removed to match rinlinejQuery
1677 expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
1678
1679 // The following elements throw uncatchable exceptions if you
1680 // attempt to add expando properties to them.
1681 noData: {
1682 "embed": true,
1683 // Ban all objects except for Flash (which handle expandos)
1684 "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
1685 "applet": true
1686 },
1687
1688 hasData: function( elem ) {
1689 elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
1690 return !!elem && !isEmptyDataObject( elem );
1691 },
1692
1693 data: function( elem, name, data, pvt /* Internal Use Only */ ) {
1694 if ( !jQuery.acceptData( elem ) ) {
1695 return;
1696 }
1697
1698 var privateCache, thisCache, ret,
1699 internalKey = jQuery.expando,
1700 getByName = typeof name === "string",
1701
1702 // We have to handle DOM nodes and JS objects differently because IE6-7
1703 // can't GC object references properly across the DOM-JS boundary
1704 isNode = elem.nodeType,
1705
1706 // Only DOM nodes need the global jQuery cache; JS object data is
1707 // attached directly to the object so GC can occur automatically
1708 cache = isNode ? jQuery.cache : elem,
1709
1710 // Only defining an ID for JS objects if its cache already exists allows
1711 // the code to shortcut on the same path as a DOM node with no cache
1712 id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey,
1713 isEvents = name === "events";
1714
1715 // Avoid doing any more work than we need to when trying to get data on an
1716 // object that has no data at all
1717 if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) {
1718 return;
1719 }
1720
1721 if ( !id ) {
1722 // Only DOM nodes need a new unique ID for each element since their data
1723 // ends up in the global cache
1724 if ( isNode ) {
1725 elem[ internalKey ] = id = ++jQuery.uuid;
1726 } else {
1727 id = internalKey;
1728 }
1729 }
1730
1731 if ( !cache[ id ] ) {
1732 cache[ id ] = {};
1733
1734 // Avoids exposing jQuery metadata on plain JS objects when the object
1735 // is serialized using JSON.stringify
1736 if ( !isNode ) {
1737 cache[ id ].toJSON = jQuery.noop;
1738 }
1739 }
1740
1741 // An object can be passed to jQuery.data instead of a key/value pair; this gets
1742 // shallow copied over onto the existing cache
1743 if ( typeof name === "object" || typeof name === "function" ) {
1744 if ( pvt ) {
1745 cache[ id ] = jQuery.extend( cache[ id ], name );
1746 } else {
1747 cache[ id ].data = jQuery.extend( cache[ id ].data, name );
1748 }
1749 }
1750
1751 privateCache = thisCache = cache[ id ];
1752
1753 // jQuery data() is stored in a separate object inside the object's internal data
1754 // cache in order to avoid key collisions between internal data and user-defined
1755 // data.
1756 if ( !pvt ) {
1757 if ( !thisCache.data ) {
1758 thisCache.data = {};
1759 }
1760
1761 thisCache = thisCache.data;
1762 }
1763
1764 if ( data !== undefined ) {
1765 thisCache[ jQuery.camelCase( name ) ] = data;
1766 }
1767
1768 // Users should not attempt to inspect the internal events object using jQuery.data,
1769 // it is undocumented and subject to change. But does anyone listen? No.
1770 if ( isEvents && !thisCache[ name ] ) {
1771 return privateCache.events;
1772 }
1773
1774 // Check for both converted-to-camel and non-converted data property names
1775 // If a data property was specified
1776 if ( getByName ) {
1777
1778 // First Try to find as-is property data
1779 ret = thisCache[ name ];
1780
1781 // Test for null|undefined property data
1782 if ( ret == null ) {
1783
1784 // Try to find the camelCased property
1785 ret = thisCache[ jQuery.camelCase( name ) ];
1786 }
1787 } else {
1788 ret = thisCache;
1789 }
1790
1791 return ret;
1792 },
1793
1794 removeData: function( elem, name, pvt /* Internal Use Only */ ) {
1795 if ( !jQuery.acceptData( elem ) ) {
1796 return;
1797 }
1798
1799 var thisCache, i, l,
1800
1801 // Reference to internal data cache key
1802 internalKey = jQuery.expando,
1803
1804 isNode = elem.nodeType,
1805
1806 // See jQuery.data for more information
1807 cache = isNode ? jQuery.cache : elem,
1808
1809 // See jQuery.data for more information
1810 id = isNode ? elem[ internalKey ] : internalKey;
1811
1812 // If there is already no cache entry for this object, there is no
1813 // purpose in continuing
1814 if ( !cache[ id ] ) {
1815 return;
1816 }
1817
1818 if ( name ) {
1819
1820 thisCache = pvt ? cache[ id ] : cache[ id ].data;
1821
1822 if ( thisCache ) {
1823
1824 // Support array or space separated string names for data keys
1825 if ( !jQuery.isArray( name ) ) {
1826
1827 // try the string as a key before any manipulation
1828 if ( name in thisCache ) {
1829 name = [ name ];
1830 } else {
1831
1832 // split the camel cased version by spaces unless a key with the spaces exists
1833 name = jQuery.camelCase( name );
1834 if ( name in thisCache ) {
1835 name = [ name ];
1836 } else {
1837 name = name.split( " " );
1838 }
1839 }
1840 }
1841
1842 for ( i = 0, l = name.length; i…
Large files files are truncated, but you can click here to view the full file