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