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