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