Merge branch 'MDL-47301-master' of git://github.com/FMCorz/moodle
[moodle.git] / lib / jquery / jquery-1.11.0.js
1 /*!
2  * jQuery JavaScript Library v1.11.0
3  * http://jquery.com/
4  *
5  * Includes Sizzle.js
6  * http://sizzlejs.com/
7  *
8  * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
9  * Released under the MIT license
10  * http://jquery.org/license
11  *
12  * Date: 2014-01-23T21:02Z
13  */
15 (function( global, factory ) {
17         if ( typeof module === "object" && typeof module.exports === "object" ) {
18                 // For CommonJS and CommonJS-like environments where a proper window is present,
19                 // execute the factory and get jQuery
20                 // For environments that do not inherently posses a window with a document
21                 // (such as Node.js), expose a jQuery-making factory as module.exports
22                 // This accentuates the need for the creation of a real window
23                 // e.g. var jQuery = require("jquery")(window);
24                 // See ticket #14549 for more info
25                 module.exports = global.document ?
26                         factory( global, true ) :
27                         function( w ) {
28                                 if ( !w.document ) {
29                                         throw new Error( "jQuery requires a window with a document" );
30                                 }
31                                 return factory( w );
32                         };
33         } else {
34                 factory( global );
35         }
37 // Pass this if window is not defined yet
38 }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
40 // Can't do this because several apps including ASP.NET trace
41 // the stack via arguments.caller.callee and Firefox dies if
42 // you try to trace through "use strict" call chains. (#13335)
43 // Support: Firefox 18+
44 //
46 var deletedIds = [];
48 var slice = deletedIds.slice;
50 var concat = deletedIds.concat;
52 var push = deletedIds.push;
54 var indexOf = deletedIds.indexOf;
56 var class2type = {};
58 var toString = class2type.toString;
60 var hasOwn = class2type.hasOwnProperty;
62 var trim = "".trim;
64 var support = {};
68 var
69         version = "1.11.0",
71         // Define a local copy of jQuery
72         jQuery = function( selector, context ) {
73                 // The jQuery object is actually just the init constructor 'enhanced'
74                 // Need init if jQuery is called (just allow error to be thrown if not included)
75                 return new jQuery.fn.init( selector, context );
76         },
78         // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
79         rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
81         // Matches dashed string for camelizing
82         rmsPrefix = /^-ms-/,
83         rdashAlpha = /-([\da-z])/gi,
85         // Used by jQuery.camelCase as callback to replace()
86         fcamelCase = function( all, letter ) {
87                 return letter.toUpperCase();
88         };
90 jQuery.fn = jQuery.prototype = {
91         // The current version of jQuery being used
92         jquery: version,
94         constructor: jQuery,
96         // Start with an empty selector
97         selector: "",
99         // The default length of a jQuery object is 0
100         length: 0,
102         toArray: function() {
103                 return slice.call( this );
104         },
106         // Get the Nth element in the matched element set OR
107         // Get the whole matched element set as a clean array
108         get: function( num ) {
109                 return num != null ?
111                         // Return a 'clean' array
112                         ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
114                         // Return just the object
115                         slice.call( this );
116         },
118         // Take an array of elements and push it onto the stack
119         // (returning the new matched element set)
120         pushStack: function( elems ) {
122                 // Build a new jQuery matched element set
123                 var ret = jQuery.merge( this.constructor(), elems );
125                 // Add the old object onto the stack (as a reference)
126                 ret.prevObject = this;
127                 ret.context = this.context;
129                 // Return the newly-formed element set
130                 return ret;
131         },
133         // Execute a callback for every element in the matched set.
134         // (You can seed the arguments with an array of args, but this is
135         // only used internally.)
136         each: function( callback, args ) {
137                 return jQuery.each( this, callback, args );
138         },
140         map: function( callback ) {
141                 return this.pushStack( jQuery.map(this, function( elem, i ) {
142                         return callback.call( elem, i, elem );
143                 }));
144         },
146         slice: function() {
147                 return this.pushStack( slice.apply( this, arguments ) );
148         },
150         first: function() {
151                 return this.eq( 0 );
152         },
154         last: function() {
155                 return this.eq( -1 );
156         },
158         eq: function( i ) {
159                 var len = this.length,
160                         j = +i + ( i < 0 ? len : 0 );
161                 return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
162         },
164         end: function() {
165                 return this.prevObject || this.constructor(null);
166         },
168         // For internal use only.
169         // Behaves like an Array's method, not like a jQuery method.
170         push: push,
171         sort: deletedIds.sort,
172         splice: deletedIds.splice
173 };
175 jQuery.extend = jQuery.fn.extend = function() {
176         var src, copyIsArray, copy, name, options, clone,
177                 target = arguments[0] || {},
178                 i = 1,
179                 length = arguments.length,
180                 deep = false;
182         // Handle a deep copy situation
183         if ( typeof target === "boolean" ) {
184                 deep = target;
186                 // skip the boolean and the target
187                 target = arguments[ i ] || {};
188                 i++;
189         }
191         // Handle case when target is a string or something (possible in deep copy)
192         if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
193                 target = {};
194         }
196         // extend jQuery itself if only one argument is passed
197         if ( i === length ) {
198                 target = this;
199                 i--;
200         }
202         for ( ; i < length; i++ ) {
203                 // Only deal with non-null/undefined values
204                 if ( (options = arguments[ i ]) != null ) {
205                         // Extend the base object
206                         for ( name in options ) {
207                                 src = target[ name ];
208                                 copy = options[ name ];
210                                 // Prevent never-ending loop
211                                 if ( target === copy ) {
212                                         continue;
213                                 }
215                                 // Recurse if we're merging plain objects or arrays
216                                 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
217                                         if ( copyIsArray ) {
218                                                 copyIsArray = false;
219                                                 clone = src && jQuery.isArray(src) ? src : [];
221                                         } else {
222                                                 clone = src && jQuery.isPlainObject(src) ? src : {};
223                                         }
225                                         // Never move original objects, clone them
226                                         target[ name ] = jQuery.extend( deep, clone, copy );
228                                 // Don't bring in undefined values
229                                 } else if ( copy !== undefined ) {
230                                         target[ name ] = copy;
231                                 }
232                         }
233                 }
234         }
236         // Return the modified object
237         return target;
238 };
240 jQuery.extend({
241         // Unique for each copy of jQuery on the page
242         expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
244         // Assume jQuery is ready without the ready module
245         isReady: true,
247         error: function( msg ) {
248                 throw new Error( msg );
249         },
251         noop: function() {},
253         // See test/unit/core.js for details concerning isFunction.
254         // Since version 1.3, DOM methods and functions like alert
255         // aren't supported. They return false on IE (#2968).
256         isFunction: function( obj ) {
257                 return jQuery.type(obj) === "function";
258         },
260         isArray: Array.isArray || function( obj ) {
261                 return jQuery.type(obj) === "array";
262         },
264         isWindow: function( obj ) {
265                 /* jshint eqeqeq: false */
266                 return obj != null && obj == obj.window;
267         },
269         isNumeric: function( obj ) {
270                 // parseFloat NaNs numeric-cast false positives (null|true|false|"")
271                 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
272                 // subtraction forces infinities to NaN
273                 return obj - parseFloat( obj ) >= 0;
274         },
276         isEmptyObject: function( obj ) {
277                 var name;
278                 for ( name in obj ) {
279                         return false;
280                 }
281                 return true;
282         },
284         isPlainObject: function( obj ) {
285                 var key;
287                 // Must be an Object.
288                 // Because of IE, we also have to check the presence of the constructor property.
289                 // Make sure that DOM nodes and window objects don't pass through, as well
290                 if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
291                         return false;
292                 }
294                 try {
295                         // Not own constructor property must be Object
296                         if ( obj.constructor &&
297                                 !hasOwn.call(obj, "constructor") &&
298                                 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
299                                 return false;
300                         }
301                 } catch ( e ) {
302                         // IE8,9 Will throw exceptions on certain host objects #9897
303                         return false;
304                 }
306                 // Support: IE<9
307                 // Handle iteration over inherited properties before own properties.
308                 if ( support.ownLast ) {
309                         for ( key in obj ) {
310                                 return hasOwn.call( obj, key );
311                         }
312                 }
314                 // Own properties are enumerated firstly, so to speed up,
315                 // if last one is own, then all properties are own.
316                 for ( key in obj ) {}
318                 return key === undefined || hasOwn.call( obj, key );
319         },
321         type: function( obj ) {
322                 if ( obj == null ) {
323                         return obj + "";
324                 }
325                 return typeof obj === "object" || typeof obj === "function" ?
326                         class2type[ toString.call(obj) ] || "object" :
327                         typeof obj;
328         },
330         // Evaluates a script in a global context
331         // Workarounds based on findings by Jim Driscoll
332         // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
333         globalEval: function( data ) {
334                 if ( data && jQuery.trim( data ) ) {
335                         // We use execScript on Internet Explorer
336                         // We use an anonymous function so that context is window
337                         // rather than jQuery in Firefox
338                         ( window.execScript || function( data ) {
339                                 window[ "eval" ].call( window, data );
340                         } )( data );
341                 }
342         },
344         // Convert dashed to camelCase; used by the css and data modules
345         // Microsoft forgot to hump their vendor prefix (#9572)
346         camelCase: function( string ) {
347                 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
348         },
350         nodeName: function( elem, name ) {
351                 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
352         },
354         // args is for internal usage only
355         each: function( obj, callback, args ) {
356                 var value,
357                         i = 0,
358                         length = obj.length,
359                         isArray = isArraylike( obj );
361                 if ( args ) {
362                         if ( isArray ) {
363                                 for ( ; i < length; i++ ) {
364                                         value = callback.apply( obj[ i ], args );
366                                         if ( value === false ) {
367                                                 break;
368                                         }
369                                 }
370                         } else {
371                                 for ( i in obj ) {
372                                         value = callback.apply( obj[ i ], args );
374                                         if ( value === false ) {
375                                                 break;
376                                         }
377                                 }
378                         }
380                 // A special, fast, case for the most common use of each
381                 } else {
382                         if ( isArray ) {
383                                 for ( ; i < length; i++ ) {
384                                         value = callback.call( obj[ i ], i, obj[ i ] );
386                                         if ( value === false ) {
387                                                 break;
388                                         }
389                                 }
390                         } else {
391                                 for ( i in obj ) {
392                                         value = callback.call( obj[ i ], i, obj[ i ] );
394                                         if ( value === false ) {
395                                                 break;
396                                         }
397                                 }
398                         }
399                 }
401                 return obj;
402         },
404         // Use native String.trim function wherever possible
405         trim: trim && !trim.call("\uFEFF\xA0") ?
406                 function( text ) {
407                         return text == null ?
408                                 "" :
409                                 trim.call( text );
410                 } :
412                 // Otherwise use our own trimming functionality
413                 function( text ) {
414                         return text == null ?
415                                 "" :
416                                 ( text + "" ).replace( rtrim, "" );
417                 },
419         // results is for internal usage only
420         makeArray: function( arr, results ) {
421                 var ret = results || [];
423                 if ( arr != null ) {
424                         if ( isArraylike( Object(arr) ) ) {
425                                 jQuery.merge( ret,
426                                         typeof arr === "string" ?
427                                         [ arr ] : arr
428                                 );
429                         } else {
430                                 push.call( ret, arr );
431                         }
432                 }
434                 return ret;
435         },
437         inArray: function( elem, arr, i ) {
438                 var len;
440                 if ( arr ) {
441                         if ( indexOf ) {
442                                 return indexOf.call( arr, elem, i );
443                         }
445                         len = arr.length;
446                         i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
448                         for ( ; i < len; i++ ) {
449                                 // Skip accessing in sparse arrays
450                                 if ( i in arr && arr[ i ] === elem ) {
451                                         return i;
452                                 }
453                         }
454                 }
456                 return -1;
457         },
459         merge: function( first, second ) {
460                 var len = +second.length,
461                         j = 0,
462                         i = first.length;
464                 while ( j < len ) {
465                         first[ i++ ] = second[ j++ ];
466                 }
468                 // Support: IE<9
469                 // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)
470                 if ( len !== len ) {
471                         while ( second[j] !== undefined ) {
472                                 first[ i++ ] = second[ j++ ];
473                         }
474                 }
476                 first.length = i;
478                 return first;
479         },
481         grep: function( elems, callback, invert ) {
482                 var callbackInverse,
483                         matches = [],
484                         i = 0,
485                         length = elems.length,
486                         callbackExpect = !invert;
488                 // Go through the array, only saving the items
489                 // that pass the validator function
490                 for ( ; i < length; i++ ) {
491                         callbackInverse = !callback( elems[ i ], i );
492                         if ( callbackInverse !== callbackExpect ) {
493                                 matches.push( elems[ i ] );
494                         }
495                 }
497                 return matches;
498         },
500         // arg is for internal usage only
501         map: function( elems, callback, arg ) {
502                 var value,
503                         i = 0,
504                         length = elems.length,
505                         isArray = isArraylike( elems ),
506                         ret = [];
508                 // Go through the array, translating each of the items to their new values
509                 if ( isArray ) {
510                         for ( ; i < length; i++ ) {
511                                 value = callback( elems[ i ], i, arg );
513                                 if ( value != null ) {
514                                         ret.push( value );
515                                 }
516                         }
518                 // Go through every key on the object,
519                 } else {
520                         for ( i in elems ) {
521                                 value = callback( elems[ i ], i, arg );
523                                 if ( value != null ) {
524                                         ret.push( value );
525                                 }
526                         }
527                 }
529                 // Flatten any nested arrays
530                 return concat.apply( [], ret );
531         },
533         // A global GUID counter for objects
534         guid: 1,
536         // Bind a function to a context, optionally partially applying any
537         // arguments.
538         proxy: function( fn, context ) {
539                 var args, proxy, tmp;
541                 if ( typeof context === "string" ) {
542                         tmp = fn[ context ];
543                         context = fn;
544                         fn = tmp;
545                 }
547                 // Quick check to determine if target is callable, in the spec
548                 // this throws a TypeError, but we will just return undefined.
549                 if ( !jQuery.isFunction( fn ) ) {
550                         return undefined;
551                 }
553                 // Simulated bind
554                 args = slice.call( arguments, 2 );
555                 proxy = function() {
556                         return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
557                 };
559                 // Set the guid of unique handler to the same of original handler, so it can be removed
560                 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
562                 return proxy;
563         },
565         now: function() {
566                 return +( new Date() );
567         },
569         // jQuery.support is not used in Core but other projects attach their
570         // properties to it so it needs to exist.
571         support: support
572 });
574 // Populate the class2type map
575 jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
576         class2type[ "[object " + name + "]" ] = name.toLowerCase();
577 });
579 function isArraylike( obj ) {
580         var length = obj.length,
581                 type = jQuery.type( obj );
583         if ( type === "function" || jQuery.isWindow( obj ) ) {
584                 return false;
585         }
587         if ( obj.nodeType === 1 && length ) {
588                 return true;
589         }
591         return type === "array" || length === 0 ||
592                 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
594 var Sizzle =
595 /*!
596  * Sizzle CSS Selector Engine v1.10.16
597  * http://sizzlejs.com/
598  *
599  * Copyright 2013 jQuery Foundation, Inc. and other contributors
600  * Released under the MIT license
601  * http://jquery.org/license
602  *
603  * Date: 2014-01-13
604  */
605 (function( window ) {
607 var i,
608         support,
609         Expr,
610         getText,
611         isXML,
612         compile,
613         outermostContext,
614         sortInput,
615         hasDuplicate,
617         // Local document vars
618         setDocument,
619         document,
620         docElem,
621         documentIsHTML,
622         rbuggyQSA,
623         rbuggyMatches,
624         matches,
625         contains,
627         // Instance-specific data
628         expando = "sizzle" + -(new Date()),
629         preferredDoc = window.document,
630         dirruns = 0,
631         done = 0,
632         classCache = createCache(),
633         tokenCache = createCache(),
634         compilerCache = createCache(),
635         sortOrder = function( a, b ) {
636                 if ( a === b ) {
637                         hasDuplicate = true;
638                 }
639                 return 0;
640         },
642         // General-purpose constants
643         strundefined = typeof undefined,
644         MAX_NEGATIVE = 1 << 31,
646         // Instance methods
647         hasOwn = ({}).hasOwnProperty,
648         arr = [],
649         pop = arr.pop,
650         push_native = arr.push,
651         push = arr.push,
652         slice = arr.slice,
653         // Use a stripped-down indexOf if we can't use a native one
654         indexOf = arr.indexOf || function( elem ) {
655                 var i = 0,
656                         len = this.length;
657                 for ( ; i < len; i++ ) {
658                         if ( this[i] === elem ) {
659                                 return i;
660                         }
661                 }
662                 return -1;
663         },
665         booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
667         // Regular expressions
669         // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
670         whitespace = "[\\x20\\t\\r\\n\\f]",
671         // http://www.w3.org/TR/css3-syntax/#characters
672         characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
674         // Loosely modeled on CSS identifier characters
675         // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
676         // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
677         identifier = characterEncoding.replace( "w", "w#" ),
679         // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors
680         attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace +
681                 "*(?:([*^$|!~]?=)" + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]",
683         // Prefer arguments quoted,
684         //   then not containing pseudos/brackets,
685         //   then attribute selectors/non-parenthetical expressions,
686         //   then anything else
687         // These preferences are here to reduce the number of selectors
688         //   needing tokenize in the PSEUDO preFilter
689         pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)",
691         // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
692         rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
694         rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
695         rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
697         rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
699         rpseudo = new RegExp( pseudos ),
700         ridentifier = new RegExp( "^" + identifier + "$" ),
702         matchExpr = {
703                 "ID": new RegExp( "^#(" + characterEncoding + ")" ),
704                 "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
705                 "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
706                 "ATTR": new RegExp( "^" + attributes ),
707                 "PSEUDO": new RegExp( "^" + pseudos ),
708                 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
709                         "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
710                         "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
711                 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
712                 // For use in libraries implementing .is()
713                 // We use this for POS matching in `select`
714                 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
715                         whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
716         },
718         rinputs = /^(?:input|select|textarea|button)$/i,
719         rheader = /^h\d$/i,
721         rnative = /^[^{]+\{\s*\[native \w/,
723         // Easily-parseable/retrievable ID or TAG or CLASS selectors
724         rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
726         rsibling = /[+~]/,
727         rescape = /'|\\/g,
729         // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
730         runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
731         funescape = function( _, escaped, escapedWhitespace ) {
732                 var high = "0x" + escaped - 0x10000;
733                 // NaN means non-codepoint
734                 // Support: Firefox
735                 // Workaround erroneous numeric interpretation of +"0x"
736                 return high !== high || escapedWhitespace ?
737                         escaped :
738                         high < 0 ?
739                                 // BMP codepoint
740                                 String.fromCharCode( high + 0x10000 ) :
741                                 // Supplemental Plane codepoint (surrogate pair)
742                                 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
743         };
745 // Optimize for push.apply( _, NodeList )
746 try {
747         push.apply(
748                 (arr = slice.call( preferredDoc.childNodes )),
749                 preferredDoc.childNodes
750         );
751         // Support: Android<4.0
752         // Detect silently failing push.apply
753         arr[ preferredDoc.childNodes.length ].nodeType;
754 } catch ( e ) {
755         push = { apply: arr.length ?
757                 // Leverage slice if possible
758                 function( target, els ) {
759                         push_native.apply( target, slice.call(els) );
760                 } :
762                 // Support: IE<9
763                 // Otherwise append directly
764                 function( target, els ) {
765                         var j = target.length,
766                                 i = 0;
767                         // Can't trust NodeList.length
768                         while ( (target[j++] = els[i++]) ) {}
769                         target.length = j - 1;
770                 }
771         };
774 function Sizzle( selector, context, results, seed ) {
775         var match, elem, m, nodeType,
776                 // QSA vars
777                 i, groups, old, nid, newContext, newSelector;
779         if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
780                 setDocument( context );
781         }
783         context = context || document;
784         results = results || [];
786         if ( !selector || typeof selector !== "string" ) {
787                 return results;
788         }
790         if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) {
791                 return [];
792         }
794         if ( documentIsHTML && !seed ) {
796                 // Shortcuts
797                 if ( (match = rquickExpr.exec( selector )) ) {
798                         // Speed-up: Sizzle("#ID")
799                         if ( (m = match[1]) ) {
800                                 if ( nodeType === 9 ) {
801                                         elem = context.getElementById( m );
802                                         // Check parentNode to catch when Blackberry 4.6 returns
803                                         // nodes that are no longer in the document (jQuery #6963)
804                                         if ( elem && elem.parentNode ) {
805                                                 // Handle the case where IE, Opera, and Webkit return items
806                                                 // by name instead of ID
807                                                 if ( elem.id === m ) {
808                                                         results.push( elem );
809                                                         return results;
810                                                 }
811                                         } else {
812                                                 return results;
813                                         }
814                                 } else {
815                                         // Context is not a document
816                                         if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
817                                                 contains( context, elem ) && elem.id === m ) {
818                                                 results.push( elem );
819                                                 return results;
820                                         }
821                                 }
823                         // Speed-up: Sizzle("TAG")
824                         } else if ( match[2] ) {
825                                 push.apply( results, context.getElementsByTagName( selector ) );
826                                 return results;
828                         // Speed-up: Sizzle(".CLASS")
829                         } else if ( (m = match[3]) && support.getElementsByClassName && context.getElementsByClassName ) {
830                                 push.apply( results, context.getElementsByClassName( m ) );
831                                 return results;
832                         }
833                 }
835                 // QSA path
836                 if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
837                         nid = old = expando;
838                         newContext = context;
839                         newSelector = nodeType === 9 && selector;
841                         // qSA works strangely on Element-rooted queries
842                         // We can work around this by specifying an extra ID on the root
843                         // and working up from there (Thanks to Andrew Dupont for the technique)
844                         // IE 8 doesn't work on object elements
845                         if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
846                                 groups = tokenize( selector );
848                                 if ( (old = context.getAttribute("id")) ) {
849                                         nid = old.replace( rescape, "\\$&" );
850                                 } else {
851                                         context.setAttribute( "id", nid );
852                                 }
853                                 nid = "[id='" + nid + "'] ";
855                                 i = groups.length;
856                                 while ( i-- ) {
857                                         groups[i] = nid + toSelector( groups[i] );
858                                 }
859                                 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;
860                                 newSelector = groups.join(",");
861                         }
863                         if ( newSelector ) {
864                                 try {
865                                         push.apply( results,
866                                                 newContext.querySelectorAll( newSelector )
867                                         );
868                                         return results;
869                                 } catch(qsaError) {
870                                 } finally {
871                                         if ( !old ) {
872                                                 context.removeAttribute("id");
873                                         }
874                                 }
875                         }
876                 }
877         }
879         // All others
880         return select( selector.replace( rtrim, "$1" ), context, results, seed );
883 /**
884  * Create key-value caches of limited size
885  * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
886  *      property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
887  *      deleting the oldest entry
888  */
889 function createCache() {
890         var keys = [];
892         function cache( key, value ) {
893                 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
894                 if ( keys.push( key + " " ) > Expr.cacheLength ) {
895                         // Only keep the most recent entries
896                         delete cache[ keys.shift() ];
897                 }
898                 return (cache[ key + " " ] = value);
899         }
900         return cache;
903 /**
904  * Mark a function for special use by Sizzle
905  * @param {Function} fn The function to mark
906  */
907 function markFunction( fn ) {
908         fn[ expando ] = true;
909         return fn;
912 /**
913  * Support testing using an element
914  * @param {Function} fn Passed the created div and expects a boolean result
915  */
916 function assert( fn ) {
917         var div = document.createElement("div");
919         try {
920                 return !!fn( div );
921         } catch (e) {
922                 return false;
923         } finally {
924                 // Remove from its parent by default
925                 if ( div.parentNode ) {
926                         div.parentNode.removeChild( div );
927                 }
928                 // release memory in IE
929                 div = null;
930         }
933 /**
934  * Adds the same handler for all of the specified attrs
935  * @param {String} attrs Pipe-separated list of attributes
936  * @param {Function} handler The method that will be applied
937  */
938 function addHandle( attrs, handler ) {
939         var arr = attrs.split("|"),
940                 i = attrs.length;
942         while ( i-- ) {
943                 Expr.attrHandle[ arr[i] ] = handler;
944         }
947 /**
948  * Checks document order of two siblings
949  * @param {Element} a
950  * @param {Element} b
951  * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
952  */
953 function siblingCheck( a, b ) {
954         var cur = b && a,
955                 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
956                         ( ~b.sourceIndex || MAX_NEGATIVE ) -
957                         ( ~a.sourceIndex || MAX_NEGATIVE );
959         // Use IE sourceIndex if available on both nodes
960         if ( diff ) {
961                 return diff;
962         }
964         // Check if b follows a
965         if ( cur ) {
966                 while ( (cur = cur.nextSibling) ) {
967                         if ( cur === b ) {
968                                 return -1;
969                         }
970                 }
971         }
973         return a ? 1 : -1;
976 /**
977  * Returns a function to use in pseudos for input types
978  * @param {String} type
979  */
980 function createInputPseudo( type ) {
981         return function( elem ) {
982                 var name = elem.nodeName.toLowerCase();
983                 return name === "input" && elem.type === type;
984         };
987 /**
988  * Returns a function to use in pseudos for buttons
989  * @param {String} type
990  */
991 function createButtonPseudo( type ) {
992         return function( elem ) {
993                 var name = elem.nodeName.toLowerCase();
994                 return (name === "input" || name === "button") && elem.type === type;
995         };
998 /**
999  * Returns a function to use in pseudos for positionals
1000  * @param {Function} fn
1001  */
1002 function createPositionalPseudo( fn ) {
1003         return markFunction(function( argument ) {
1004                 argument = +argument;
1005                 return markFunction(function( seed, matches ) {
1006                         var j,
1007                                 matchIndexes = fn( [], seed.length, argument ),
1008                                 i = matchIndexes.length;
1010                         // Match elements found at the specified indexes
1011                         while ( i-- ) {
1012                                 if ( seed[ (j = matchIndexes[i]) ] ) {
1013                                         seed[j] = !(matches[j] = seed[j]);
1014                                 }
1015                         }
1016                 });
1017         });
1020 /**
1021  * Checks a node for validity as a Sizzle context
1022  * @param {Element|Object=} context
1023  * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
1024  */
1025 function testContext( context ) {
1026         return context && typeof context.getElementsByTagName !== strundefined && context;
1029 // Expose support vars for convenience
1030 support = Sizzle.support = {};
1032 /**
1033  * Detects XML nodes
1034  * @param {Element|Object} elem An element or a document
1035  * @returns {Boolean} True iff elem is a non-HTML XML node
1036  */
1037 isXML = Sizzle.isXML = function( elem ) {
1038         // documentElement is verified for cases where it doesn't yet exist
1039         // (such as loading iframes in IE - #4833)
1040         var documentElement = elem && (elem.ownerDocument || elem).documentElement;
1041         return documentElement ? documentElement.nodeName !== "HTML" : false;
1042 };
1044 /**
1045  * Sets document-related variables once based on the current document
1046  * @param {Element|Object} [doc] An element or document object to use to set the document
1047  * @returns {Object} Returns the current document
1048  */
1049 setDocument = Sizzle.setDocument = function( node ) {
1050         var hasCompare,
1051                 doc = node ? node.ownerDocument || node : preferredDoc,
1052                 parent = doc.defaultView;
1054         // If no document and documentElement is available, return
1055         if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
1056                 return document;
1057         }
1059         // Set our document
1060         document = doc;
1061         docElem = doc.documentElement;
1063         // Support tests
1064         documentIsHTML = !isXML( doc );
1066         // Support: IE>8
1067         // If iframe document is assigned to "document" variable and if iframe has been reloaded,
1068         // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
1069         // IE6-8 do not support the defaultView property so parent will be undefined
1070         if ( parent && parent !== parent.top ) {
1071                 // IE11 does not have attachEvent, so all must suffer
1072                 if ( parent.addEventListener ) {
1073                         parent.addEventListener( "unload", function() {
1074                                 setDocument();
1075                         }, false );
1076                 } else if ( parent.attachEvent ) {
1077                         parent.attachEvent( "onunload", function() {
1078                                 setDocument();
1079                         });
1080                 }
1081         }
1083         /* Attributes
1084         ---------------------------------------------------------------------- */
1086         // Support: IE<8
1087         // Verify that getAttribute really returns attributes and not properties (excepting IE8 booleans)
1088         support.attributes = assert(function( div ) {
1089                 div.className = "i";
1090                 return !div.getAttribute("className");
1091         });
1093         /* getElement(s)By*
1094         ---------------------------------------------------------------------- */
1096         // Check if getElementsByTagName("*") returns only elements
1097         support.getElementsByTagName = assert(function( div ) {
1098                 div.appendChild( doc.createComment("") );
1099                 return !div.getElementsByTagName("*").length;
1100         });
1102         // Check if getElementsByClassName can be trusted
1103         support.getElementsByClassName = rnative.test( doc.getElementsByClassName ) && assert(function( div ) {
1104                 div.innerHTML = "<div class='a'></div><div class='a i'></div>";
1106                 // Support: Safari<4
1107                 // Catch class over-caching
1108                 div.firstChild.className = "i";
1109                 // Support: Opera<10
1110                 // Catch gEBCN failure to find non-leading classes
1111                 return div.getElementsByClassName("i").length === 2;
1112         });
1114         // Support: IE<10
1115         // Check if getElementById returns elements by name
1116         // The broken getElementById methods don't pick up programatically-set names,
1117         // so use a roundabout getElementsByName test
1118         support.getById = assert(function( div ) {
1119                 docElem.appendChild( div ).id = expando;
1120                 return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
1121         });
1123         // ID find and filter
1124         if ( support.getById ) {
1125                 Expr.find["ID"] = function( id, context ) {
1126                         if ( typeof context.getElementById !== strundefined && documentIsHTML ) {
1127                                 var m = context.getElementById( id );
1128                                 // Check parentNode to catch when Blackberry 4.6 returns
1129                                 // nodes that are no longer in the document #6963
1130                                 return m && m.parentNode ? [m] : [];
1131                         }
1132                 };
1133                 Expr.filter["ID"] = function( id ) {
1134                         var attrId = id.replace( runescape, funescape );
1135                         return function( elem ) {
1136                                 return elem.getAttribute("id") === attrId;
1137                         };
1138                 };
1139         } else {
1140                 // Support: IE6/7
1141                 // getElementById is not reliable as a find shortcut
1142                 delete Expr.find["ID"];
1144                 Expr.filter["ID"] =  function( id ) {
1145                         var attrId = id.replace( runescape, funescape );
1146                         return function( elem ) {
1147                                 var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id");
1148                                 return node && node.value === attrId;
1149                         };
1150                 };
1151         }
1153         // Tag
1154         Expr.find["TAG"] = support.getElementsByTagName ?
1155                 function( tag, context ) {
1156                         if ( typeof context.getElementsByTagName !== strundefined ) {
1157                                 return context.getElementsByTagName( tag );
1158                         }
1159                 } :
1160                 function( tag, context ) {
1161                         var elem,
1162                                 tmp = [],
1163                                 i = 0,
1164                                 results = context.getElementsByTagName( tag );
1166                         // Filter out possible comments
1167                         if ( tag === "*" ) {
1168                                 while ( (elem = results[i++]) ) {
1169                                         if ( elem.nodeType === 1 ) {
1170                                                 tmp.push( elem );
1171                                         }
1172                                 }
1174                                 return tmp;
1175                         }
1176                         return results;
1177                 };
1179         // Class
1180         Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
1181                 if ( typeof context.getElementsByClassName !== strundefined && documentIsHTML ) {
1182                         return context.getElementsByClassName( className );
1183                 }
1184         };
1186         /* QSA/matchesSelector
1187         ---------------------------------------------------------------------- */
1189         // QSA and matchesSelector support
1191         // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
1192         rbuggyMatches = [];
1194         // qSa(:focus) reports false when true (Chrome 21)
1195         // We allow this because of a bug in IE8/9 that throws an error
1196         // whenever `document.activeElement` is accessed on an iframe
1197         // So, we allow :focus to pass through QSA all the time to avoid the IE error
1198         // See http://bugs.jquery.com/ticket/13378
1199         rbuggyQSA = [];
1201         if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
1202                 // Build QSA regex
1203                 // Regex strategy adopted from Diego Perini
1204                 assert(function( div ) {
1205                         // Select is set to empty string on purpose
1206                         // This is to test IE's treatment of not explicitly
1207                         // setting a boolean content attribute,
1208                         // since its presence should be enough
1209                         // http://bugs.jquery.com/ticket/12359
1210                         div.innerHTML = "<select t=''><option selected=''></option></select>";
1212                         // Support: IE8, Opera 10-12
1213                         // Nothing should be selected when empty strings follow ^= or $= or *=
1214                         if ( div.querySelectorAll("[t^='']").length ) {
1215                                 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
1216                         }
1218                         // Support: IE8
1219                         // Boolean attributes and "value" are not treated correctly
1220                         if ( !div.querySelectorAll("[selected]").length ) {
1221                                 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1222                         }
1224                         // Webkit/Opera - :checked should return selected option elements
1225                         // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1226                         // IE8 throws error here and will not see later tests
1227                         if ( !div.querySelectorAll(":checked").length ) {
1228                                 rbuggyQSA.push(":checked");
1229                         }
1230                 });
1232                 assert(function( div ) {
1233                         // Support: Windows 8 Native Apps
1234                         // The type and name attributes are restricted during .innerHTML assignment
1235                         var input = doc.createElement("input");
1236                         input.setAttribute( "type", "hidden" );
1237                         div.appendChild( input ).setAttribute( "name", "D" );
1239                         // Support: IE8
1240                         // Enforce case-sensitivity of name attribute
1241                         if ( div.querySelectorAll("[name=d]").length ) {
1242                                 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1243                         }
1245                         // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1246                         // IE8 throws error here and will not see later tests
1247                         if ( !div.querySelectorAll(":enabled").length ) {
1248                                 rbuggyQSA.push( ":enabled", ":disabled" );
1249                         }
1251                         // Opera 10-11 does not throw on post-comma invalid pseudos
1252                         div.querySelectorAll("*,:x");
1253                         rbuggyQSA.push(",.*:");
1254                 });
1255         }
1257         if ( (support.matchesSelector = rnative.test( (matches = docElem.webkitMatchesSelector ||
1258                 docElem.mozMatchesSelector ||
1259                 docElem.oMatchesSelector ||
1260                 docElem.msMatchesSelector) )) ) {
1262                 assert(function( div ) {
1263                         // Check to see if it's possible to do matchesSelector
1264                         // on a disconnected node (IE 9)
1265                         support.disconnectedMatch = matches.call( div, "div" );
1267                         // This should fail with an exception
1268                         // Gecko does not error, returns false instead
1269                         matches.call( div, "[s!='']:x" );
1270                         rbuggyMatches.push( "!=", pseudos );
1271                 });
1272         }
1274         rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
1275         rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
1277         /* Contains
1278         ---------------------------------------------------------------------- */
1279         hasCompare = rnative.test( docElem.compareDocumentPosition );
1281         // Element contains another
1282         // Purposefully does not implement inclusive descendent
1283         // As in, an element does not contain itself
1284         contains = hasCompare || rnative.test( docElem.contains ) ?
1285                 function( a, b ) {
1286                         var adown = a.nodeType === 9 ? a.documentElement : a,
1287                                 bup = b && b.parentNode;
1288                         return a === bup || !!( bup && bup.nodeType === 1 && (
1289                                 adown.contains ?
1290                                         adown.contains( bup ) :
1291                                         a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1292                         ));
1293                 } :
1294                 function( a, b ) {
1295                         if ( b ) {
1296                                 while ( (b = b.parentNode) ) {
1297                                         if ( b === a ) {
1298                                                 return true;
1299                                         }
1300                                 }
1301                         }
1302                         return false;
1303                 };
1305         /* Sorting
1306         ---------------------------------------------------------------------- */
1308         // Document order sorting
1309         sortOrder = hasCompare ?
1310         function( a, b ) {
1312                 // Flag for duplicate removal
1313                 if ( a === b ) {
1314                         hasDuplicate = true;
1315                         return 0;
1316                 }
1318                 // Sort on method existence if only one input has compareDocumentPosition
1319                 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
1320                 if ( compare ) {
1321                         return compare;
1322                 }
1324                 // Calculate position if both inputs belong to the same document
1325                 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
1326                         a.compareDocumentPosition( b ) :
1328                         // Otherwise we know they are disconnected
1329                         1;
1331                 // Disconnected nodes
1332                 if ( compare & 1 ||
1333                         (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
1335                         // Choose the first element that is related to our preferred document
1336                         if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
1337                                 return -1;
1338                         }
1339                         if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
1340                                 return 1;
1341                         }
1343                         // Maintain original order
1344                         return sortInput ?
1345                                 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
1346                                 0;
1347                 }
1349                 return compare & 4 ? -1 : 1;
1350         } :
1351         function( a, b ) {
1352                 // Exit early if the nodes are identical
1353                 if ( a === b ) {
1354                         hasDuplicate = true;
1355                         return 0;
1356                 }
1358                 var cur,
1359                         i = 0,
1360                         aup = a.parentNode,
1361                         bup = b.parentNode,
1362                         ap = [ a ],
1363                         bp = [ b ];
1365                 // Parentless nodes are either documents or disconnected
1366                 if ( !aup || !bup ) {
1367                         return a === doc ? -1 :
1368                                 b === doc ? 1 :
1369                                 aup ? -1 :
1370                                 bup ? 1 :
1371                                 sortInput ?
1372                                 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) :
1373                                 0;
1375                 // If the nodes are siblings, we can do a quick check
1376                 } else if ( aup === bup ) {
1377                         return siblingCheck( a, b );
1378                 }
1380                 // Otherwise we need full lists of their ancestors for comparison
1381                 cur = a;
1382                 while ( (cur = cur.parentNode) ) {
1383                         ap.unshift( cur );
1384                 }
1385                 cur = b;
1386                 while ( (cur = cur.parentNode) ) {
1387                         bp.unshift( cur );
1388                 }
1390                 // Walk down the tree looking for a discrepancy
1391                 while ( ap[i] === bp[i] ) {
1392                         i++;
1393                 }
1395                 return i ?
1396                         // Do a sibling check if the nodes have a common ancestor
1397                         siblingCheck( ap[i], bp[i] ) :
1399                         // Otherwise nodes in our document sort first
1400                         ap[i] === preferredDoc ? -1 :
1401                         bp[i] === preferredDoc ? 1 :
1402                         0;
1403         };
1405         return doc;
1406 };
1408 Sizzle.matches = function( expr, elements ) {
1409         return Sizzle( expr, null, null, elements );
1410 };
1412 Sizzle.matchesSelector = function( elem, expr ) {
1413         // Set document vars if needed
1414         if ( ( elem.ownerDocument || elem ) !== document ) {
1415                 setDocument( elem );
1416         }
1418         // Make sure that attribute selectors are quoted
1419         expr = expr.replace( rattributeQuotes, "='$1']" );
1421         if ( support.matchesSelector && documentIsHTML &&
1422                 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
1423                 ( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {
1425                 try {
1426                         var ret = matches.call( elem, expr );
1428                         // IE 9's matchesSelector returns false on disconnected nodes
1429                         if ( ret || support.disconnectedMatch ||
1430                                         // As well, disconnected nodes are said to be in a document
1431                                         // fragment in IE 9
1432                                         elem.document && elem.document.nodeType !== 11 ) {
1433                                 return ret;
1434                         }
1435                 } catch(e) {}
1436         }
1438         return Sizzle( expr, document, null, [elem] ).length > 0;
1439 };
1441 Sizzle.contains = function( context, elem ) {
1442         // Set document vars if needed
1443         if ( ( context.ownerDocument || context ) !== document ) {
1444                 setDocument( context );
1445         }
1446         return contains( context, elem );
1447 };
1449 Sizzle.attr = function( elem, name ) {
1450         // Set document vars if needed
1451         if ( ( elem.ownerDocument || elem ) !== document ) {
1452                 setDocument( elem );
1453         }
1455         var fn = Expr.attrHandle[ name.toLowerCase() ],
1456                 // Don't get fooled by Object.prototype properties (jQuery #13807)
1457                 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1458                         fn( elem, name, !documentIsHTML ) :
1459                         undefined;
1461         return val !== undefined ?
1462                 val :
1463                 support.attributes || !documentIsHTML ?
1464                         elem.getAttribute( name ) :
1465                         (val = elem.getAttributeNode(name)) && val.specified ?
1466                                 val.value :
1467                                 null;
1468 };
1470 Sizzle.error = function( msg ) {
1471         throw new Error( "Syntax error, unrecognized expression: " + msg );
1472 };
1474 /**
1475  * Document sorting and removing duplicates
1476  * @param {ArrayLike} results
1477  */
1478 Sizzle.uniqueSort = function( results ) {
1479         var elem,
1480                 duplicates = [],
1481                 j = 0,
1482                 i = 0;
1484         // Unless we *know* we can detect duplicates, assume their presence
1485         hasDuplicate = !support.detectDuplicates;
1486         sortInput = !support.sortStable && results.slice( 0 );
1487         results.sort( sortOrder );
1489         if ( hasDuplicate ) {
1490                 while ( (elem = results[i++]) ) {
1491                         if ( elem === results[ i ] ) {
1492                                 j = duplicates.push( i );
1493                         }
1494                 }
1495                 while ( j-- ) {
1496                         results.splice( duplicates[ j ], 1 );
1497                 }
1498         }
1500         // Clear input after sorting to release objects
1501         // See https://github.com/jquery/sizzle/pull/225
1502         sortInput = null;
1504         return results;
1505 };
1507 /**
1508  * Utility function for retrieving the text value of an array of DOM nodes
1509  * @param {Array|Element} elem
1510  */
1511 getText = Sizzle.getText = function( elem ) {
1512         var node,
1513                 ret = "",
1514                 i = 0,
1515                 nodeType = elem.nodeType;
1517         if ( !nodeType ) {
1518                 // If no nodeType, this is expected to be an array
1519                 while ( (node = elem[i++]) ) {
1520                         // Do not traverse comment nodes
1521                         ret += getText( node );
1522                 }
1523         } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1524                 // Use textContent for elements
1525                 // innerText usage removed for consistency of new lines (jQuery #11153)
1526                 if ( typeof elem.textContent === "string" ) {
1527                         return elem.textContent;
1528                 } else {
1529                         // Traverse its children
1530                         for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1531                                 ret += getText( elem );
1532                         }
1533                 }
1534         } else if ( nodeType === 3 || nodeType === 4 ) {
1535                 return elem.nodeValue;
1536         }
1537         // Do not include comment or processing instruction nodes
1539         return ret;
1540 };
1542 Expr = Sizzle.selectors = {
1544         // Can be adjusted by the user
1545         cacheLength: 50,
1547         createPseudo: markFunction,
1549         match: matchExpr,
1551         attrHandle: {},
1553         find: {},
1555         relative: {
1556                 ">": { dir: "parentNode", first: true },
1557                 " ": { dir: "parentNode" },
1558                 "+": { dir: "previousSibling", first: true },
1559                 "~": { dir: "previousSibling" }
1560         },
1562         preFilter: {
1563                 "ATTR": function( match ) {
1564                         match[1] = match[1].replace( runescape, funescape );
1566                         // Move the given value to match[3] whether quoted or unquoted
1567                         match[3] = ( match[4] || match[5] || "" ).replace( runescape, funescape );
1569                         if ( match[2] === "~=" ) {
1570                                 match[3] = " " + match[3] + " ";
1571                         }
1573                         return match.slice( 0, 4 );
1574                 },
1576                 "CHILD": function( match ) {
1577                         /* matches from matchExpr["CHILD"]
1578                                 1 type (only|nth|...)
1579                                 2 what (child|of-type)
1580                                 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
1581                                 4 xn-component of xn+y argument ([+-]?\d*n|)
1582                                 5 sign of xn-component
1583                                 6 x of xn-component
1584                                 7 sign of y-component
1585                                 8 y of y-component
1586                         */
1587                         match[1] = match[1].toLowerCase();
1589                         if ( match[1].slice( 0, 3 ) === "nth" ) {
1590                                 // nth-* requires argument
1591                                 if ( !match[3] ) {
1592                                         Sizzle.error( match[0] );
1593                                 }
1595                                 // numeric x and y parameters for Expr.filter.CHILD
1596                                 // remember that false/true cast respectively to 0/1
1597                                 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
1598                                 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
1600                         // other types prohibit arguments
1601                         } else if ( match[3] ) {
1602                                 Sizzle.error( match[0] );
1603                         }
1605                         return match;
1606                 },
1608                 "PSEUDO": function( match ) {
1609                         var excess,
1610                                 unquoted = !match[5] && match[2];
1612                         if ( matchExpr["CHILD"].test( match[0] ) ) {
1613                                 return null;
1614                         }
1616                         // Accept quoted arguments as-is
1617                         if ( match[3] && match[4] !== undefined ) {
1618                                 match[2] = match[4];
1620                         // Strip excess characters from unquoted arguments
1621                         } else if ( unquoted && rpseudo.test( unquoted ) &&
1622                                 // Get excess from tokenize (recursively)
1623                                 (excess = tokenize( unquoted, true )) &&
1624                                 // advance to the next closing parenthesis
1625                                 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
1627                                 // excess is a negative index
1628                                 match[0] = match[0].slice( 0, excess );
1629                                 match[2] = unquoted.slice( 0, excess );
1630                         }
1632                         // Return only captures needed by the pseudo filter method (type and argument)
1633                         return match.slice( 0, 3 );
1634                 }
1635         },
1637         filter: {
1639                 "TAG": function( nodeNameSelector ) {
1640                         var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1641                         return nodeNameSelector === "*" ?
1642                                 function() { return true; } :
1643                                 function( elem ) {
1644                                         return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1645                                 };
1646                 },
1648                 "CLASS": function( className ) {
1649                         var pattern = classCache[ className + " " ];
1651                         return pattern ||
1652                                 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
1653                                 classCache( className, function( elem ) {
1654                                         return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== strundefined && elem.getAttribute("class") || "" );
1655                                 });
1656                 },
1658                 "ATTR": function( name, operator, check ) {
1659                         return function( elem ) {
1660                                 var result = Sizzle.attr( elem, name );
1662                                 if ( result == null ) {
1663                                         return operator === "!=";
1664                                 }
1665                                 if ( !operator ) {
1666                                         return true;
1667                                 }
1669                                 result += "";
1671                                 return operator === "=" ? result === check :
1672                                         operator === "!=" ? result !== check :
1673                                         operator === "^=" ? check && result.indexOf( check ) === 0 :
1674                                         operator === "*=" ? check && result.indexOf( check ) > -1 :
1675                                         operator === "$=" ? check && result.slice( -check.length ) === check :
1676                                         operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 :
1677                                         operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
1678                                         false;
1679                         };
1680                 },
1682                 "CHILD": function( type, what, argument, first, last ) {
1683                         var simple = type.slice( 0, 3 ) !== "nth",
1684                                 forward = type.slice( -4 ) !== "last",
1685                                 ofType = what === "of-type";
1687                         return first === 1 && last === 0 ?
1689                                 // Shortcut for :nth-*(n)
1690                                 function( elem ) {
1691                                         return !!elem.parentNode;
1692                                 } :
1694                                 function( elem, context, xml ) {
1695                                         var cache, outerCache, node, diff, nodeIndex, start,
1696                                                 dir = simple !== forward ? "nextSibling" : "previousSibling",
1697                                                 parent = elem.parentNode,
1698                                                 name = ofType && elem.nodeName.toLowerCase(),
1699                                                 useCache = !xml && !ofType;
1701                                         if ( parent ) {
1703                                                 // :(first|last|only)-(child|of-type)
1704                                                 if ( simple ) {
1705                                                         while ( dir ) {
1706                                                                 node = elem;
1707                                                                 while ( (node = node[ dir ]) ) {
1708                                                                         if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
1709                                                                                 return false;
1710                                                                         }
1711                                                                 }
1712                                                                 // Reverse direction for :only-* (if we haven't yet done so)
1713                                                                 start = dir = type === "only" && !start && "nextSibling";
1714                                                         }
1715                                                         return true;
1716                                                 }
1718                                                 start = [ forward ? parent.firstChild : parent.lastChild ];
1720                                                 // non-xml :nth-child(...) stores cache data on `parent`
1721                                                 if ( forward && useCache ) {
1722                                                         // Seek `elem` from a previously-cached index
1723                                                         outerCache = parent[ expando ] || (parent[ expando ] = {});
1724                                                         cache = outerCache[ type ] || [];
1725                                                         nodeIndex = cache[0] === dirruns && cache[1];
1726                                                         diff = cache[0] === dirruns && cache[2];
1727                                                         node = nodeIndex && parent.childNodes[ nodeIndex ];
1729                                                         while ( (node = ++nodeIndex && node && node[ dir ] ||
1731                                                                 // Fallback to seeking `elem` from the start
1732                                                                 (diff = nodeIndex = 0) || start.pop()) ) {
1734                                                                 // When found, cache indexes on `parent` and break
1735                                                                 if ( node.nodeType === 1 && ++diff && node === elem ) {
1736                                                                         outerCache[ type ] = [ dirruns, nodeIndex, diff ];
1737                                                                         break;
1738                                                                 }
1739                                                         }
1741                                                 // Use previously-cached element index if available
1742                                                 } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
1743                                                         diff = cache[1];
1745                                                 // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
1746                                                 } else {
1747                                                         // Use the same loop as above to seek `elem` from the start
1748                                                         while ( (node = ++nodeIndex && node && node[ dir ] ||
1749                                                                 (diff = nodeIndex = 0) || start.pop()) ) {
1751                                                                 if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
1752                                                                         // Cache the index of each encountered element
1753                                                                         if ( useCache ) {
1754                                                                                 (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
1755                                                                         }
1757                                                                         if ( node === elem ) {
1758                                                                                 break;
1759                                                                         }
1760                                                                 }
1761                                                         }
1762                                                 }
1764                                                 // Incorporate the offset, then check against cycle size
1765                                                 diff -= last;
1766                                                 return diff === first || ( diff % first === 0 && diff / first >= 0 );
1767                                         }
1768                                 };
1769                 },
1771                 "PSEUDO": function( pseudo, argument ) {
1772                         // pseudo-class names are case-insensitive
1773                         // http://www.w3.org/TR/selectors/#pseudo-classes
1774                         // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
1775                         // Remember that setFilters inherits from pseudos
1776                         var args,
1777                                 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
1778                                         Sizzle.error( "unsupported pseudo: " + pseudo );
1780                         // The user may use createPseudo to indicate that
1781                         // arguments are needed to create the filter function
1782                         // just as Sizzle does
1783                         if ( fn[ expando ] ) {
1784                                 return fn( argument );
1785                         }
1787                         // But maintain support for old signatures
1788                         if ( fn.length > 1 ) {
1789                                 args = [ pseudo, pseudo, "", argument ];
1790                                 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
1791                                         markFunction(function( seed, matches ) {
1792                                                 var idx,
1793                                                         matched = fn( seed, argument ),
1794                                                         i = matched.length;
1795                                                 while ( i-- ) {
1796                                                         idx = indexOf.call( seed, matched[i] );
1797                                                         seed[ idx ] = !( matches[ idx ] = matched[i] );
1798                                                 }
1799                                         }) :
1800                                         function( elem ) {
1801                                                 return fn( elem, 0, args );
1802                                         };
1803                         }
1805                         return fn;
1806                 }
1807         },
1809         pseudos: {
1810                 // Potentially complex pseudos
1811                 "not": markFunction(function( selector ) {
1812                         // Trim the selector passed to compile
1813                         // to avoid treating leading and trailing
1814                         // spaces as combinators
1815                         var input = [],
1816                                 results = [],
1817                                 matcher = compile( selector.replace( rtrim, "$1" ) );
1819                         return matcher[ expando ] ?
1820                                 markFunction(function( seed, matches, context, xml ) {
1821                                         var elem,
1822                                                 unmatched = matcher( seed, null, xml, [] ),
1823                                                 i = seed.length;
1825                                         // Match elements unmatched by `matcher`
1826                                         while ( i-- ) {
1827                                                 if ( (elem = unmatched[i]) ) {
1828                                                         seed[i] = !(matches[i] = elem);
1829                                                 }
1830                                         }
1831                                 }) :
1832                                 function( elem, context, xml ) {
1833                                         input[0] = elem;
1834                                         matcher( input, null, xml, results );
1835                                         return !results.pop();
1836                                 };
1837                 }),
1839                 "has": markFunction(function( selector ) {
1840                         return function( elem ) {
1841                                 return Sizzle( selector, elem ).length > 0;
1842                         };
1843                 }),
1845                 "contains": markFunction(function( text ) {
1846                         return function( elem ) {
1847                                 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
1848                         };
1849                 }),
1851                 // "Whether an element is represented by a :lang() selector
1852                 // is based solely on the element's language value
1853                 // being equal to the identifier C,
1854                 // or beginning with the identifier C immediately followed by "-".
1855                 // The matching of C against the element's language value is performed case-insensitively.
1856                 // The identifier C does not have to be a valid language name."
1857                 // http://www.w3.org/TR/selectors/#lang-pseudo
1858                 "lang": markFunction( function( lang ) {
1859                         // lang value must be a valid identifier
1860                         if ( !ridentifier.test(lang || "") ) {
1861                                 Sizzle.error( "unsupported lang: " + lang );
1862                         }
1863                         lang = lang.replace( runescape, funescape ).toLowerCase();
1864                         return function( elem ) {
1865                                 var elemLang;
1866                                 do {
1867                                         if ( (elemLang = documentIsHTML ?
1868                                                 elem.lang :
1869                                                 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
1871                                                 elemLang = elemLang.toLowerCase();
1872                                                 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
1873                                         }
1874                                 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
1875                                 return false;
1876                         };
1877                 }),
1879                 // Miscellaneous
1880                 "target": function( elem ) {
1881                         var hash = window.location && window.location.hash;
1882                         return hash && hash.slice( 1 ) === elem.id;
1883                 },
1885                 "root": function( elem ) {
1886                         return elem === docElem;
1887                 },
1889                 "focus": function( elem ) {
1890                         return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
1891                 },
1893                 // Boolean properties
1894                 "enabled": function( elem ) {
1895                         return elem.disabled === false;
1896                 },
1898                 "disabled": function( elem ) {
1899                         return elem.disabled === true;
1900                 },
1902                 "checked": function( elem ) {
1903                         // In CSS3, :checked should return both checked and selected elements
1904                         // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1905                         var nodeName = elem.nodeName.toLowerCase();
1906                         return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
1907                 },
1909                 "selected": function( elem ) {
1910                         // Accessing this property makes selected-by-default
1911                         // options in Safari work properly
1912                         if ( elem.parentNode ) {
1913                                 elem.parentNode.selectedIndex;
1914                         }
1916                         return elem.selected === true;
1917                 },
1919                 // Contents
1920                 "empty": function( elem ) {
1921                         // http://www.w3.org/TR/selectors/#empty-pseudo
1922                         // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
1923                         //   but not by others (comment: 8; processing instruction: 7; etc.)
1924                         // nodeType < 6 works because attributes (2) do not appear as children
1925                         for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1926                                 if ( elem.nodeType < 6 ) {
1927                                         return false;
1928                                 }
1929                         }
1930                         return true;
1931                 },
1933                 "parent": function( elem ) {
1934                         return !Expr.pseudos["empty"]( elem );
1935                 },
1937                 // Element/input types
1938                 "header": function( elem ) {
1939                         return rheader.test( elem.nodeName );
1940                 },
1942                 "input": function( elem ) {
1943                         return rinputs.test( elem.nodeName );
1944                 },
1946                 "button": function( elem ) {
1947                         var name = elem.nodeName.toLowerCase();
1948                         return name === "input" && elem.type === "button" || name === "button";
1949                 },
1951                 "text": function( elem ) {
1952                         var attr;
1953                         return elem.nodeName.toLowerCase() === "input" &&
1954                                 elem.type === "text" &&
1956                                 // Support: IE<8
1957                                 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
1958                                 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
1959                 },
1961                 // Position-in-collection
1962                 "first": createPositionalPseudo(function() {
1963                         return [ 0 ];
1964                 }),
1966                 "last": createPositionalPseudo(function( matchIndexes, length ) {
1967                         return [ length - 1 ];
1968                 }),
1970                 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
1971                         return [ argument < 0 ? argument + length : argument ];
1972                 }),
1974                 "even": createPositionalPseudo(function( matchIndexes, length ) {
1975                         var i = 0;
1976                         for ( ; i < length; i += 2 ) {
1977                                 matchIndexes.push( i );
1978                         }
1979                         return matchIndexes;
1980                 }),
1982                 "odd": createPositionalPseudo(function( matchIndexes, length ) {
1983                         var i = 1;
1984                         for ( ; i < length; i += 2 ) {
1985                                 matchIndexes.push( i );
1986                         }
1987                         return matchIndexes;
1988                 }),
1990                 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
1991                         var i = argument < 0 ? argument + length : argument;
1992                         for ( ; --i >= 0; ) {
1993                                 matchIndexes.push( i );
1994                         }
1995                         return matchIndexes;
1996                 }),
1998                 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
1999                         var i = argument < 0 ? argument + length : argument;
2000                         for ( ; ++i < length; ) {
2001                                 matchIndexes.push( i );
2002                         }
2003                         return matchIndexes;
2004                 })
2005         }
2006 };
2008 Expr.pseudos["nth"] = Expr.pseudos["eq"];
2010 // Add button/input type pseudos
2011 for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
2012         Expr.pseudos[ i ] = createInputPseudo( i );
2014 for ( i in { submit: true, reset: true } ) {
2015         Expr.pseudos[ i ] = createButtonPseudo( i );
2018 // Easy API for creating new setFilters
2019 function setFilters() {}
2020 setFilters.prototype = Expr.filters = Expr.pseudos;
2021 Expr.setFilters = new setFilters();
2023 function tokenize( selector, parseOnly ) {
2024         var matched, match, tokens, type,
2025                 soFar, groups, preFilters,
2026                 cached = tokenCache[ selector + " " ];
2028         if ( cached ) {
2029                 return parseOnly ? 0 : cached.slice( 0 );
2030         }
2032         soFar = selector;
2033         groups = [];
2034         preFilters = Expr.preFilter;
2036         while ( soFar ) {
2038                 // Comma and first run
2039                 if ( !matched || (match = rcomma.exec( soFar )) ) {
2040                         if ( match ) {
2041                                 // Don't consume trailing commas as valid
2042                                 soFar = soFar.slice( match[0].length ) || soFar;
2043                         }
2044                         groups.push( (tokens = []) );
2045                 }
2047                 matched = false;
2049                 // Combinators
2050                 if ( (match = rcombinators.exec( soFar )) ) {
2051                         matched = match.shift();
2052                         tokens.push({
2053                                 value: matched,
2054                                 // Cast descendant combinators to space
2055                                 type: match[0].replace( rtrim, " " )
2056                         });
2057                         soFar = soFar.slice( matched.length );
2058                 }
2060                 // Filters
2061                 for ( type in Expr.filter ) {
2062                         if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
2063                                 (match = preFilters[ type ]( match ))) ) {
2064                                 matched = match.shift();
2065                                 tokens.push({
2066                                         value: matched,
2067                                         type: type,
2068                                         matches: match
2069                                 });
2070                                 soFar = soFar.slice( matched.length );
2071                         }
2072                 }
2074                 if ( !matched ) {
2075                         break;
2076                 }
2077         }
2079         // Return the length of the invalid excess
2080         // if we're just parsing
2081         // Otherwise, throw an error or return tokens
2082         return parseOnly ?
2083                 soFar.length :
2084                 soFar ?
2085                         Sizzle.error( selector ) :
2086                         // Cache the tokens
2087                         tokenCache( selector, groups ).slice( 0 );
2090 function toSelector( tokens ) {
2091         var i = 0,
2092                 len = tokens.length,
2093                 selector = "";
2094         for ( ; i < len; i++ ) {
2095                 selector += tokens[i].value;
2096         }
2097         return selector;
2100 function addCombinator( matcher, combinator, base ) {
2101         var dir = combinator.dir,
2102                 checkNonElements = base && dir === "parentNode",
2103                 doneName = done++;
2105         return combinator.first ?
2106                 // Check against closest ancestor/preceding element
2107                 function( elem, context, xml ) {
2108                         while ( (elem = elem[ dir ]) ) {
2109                                 if ( elem.nodeType === 1 || checkNonElements ) {
2110                                         return matcher( elem, context, xml );
2111                                 }
2112                         }
2113                 } :
2115                 // Check against all ancestor/preceding elements
2116                 function( elem, context, xml ) {
2117                         var oldCache, outerCache,
2118                                 newCache = [ dirruns, doneName ];
2120                         // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
2121                         if ( xml ) {
2122                                 while ( (elem = elem[ dir ]) ) {
2123                                         if ( elem.nodeType === 1 || checkNonElements ) {
2124                                                 if ( matcher( elem, context, xml ) ) {
2125                                                         return true;
2126                                                 }
2127                                         }
2128                                 }
2129                         } else {
2130                                 while ( (elem = elem[ dir ]) ) {
2131                                         if ( elem.nodeType === 1 || checkNonElements ) {
2132                                                 outerCache = elem[ expando ] || (elem[ expando ] = {});
2133                                                 if ( (oldCache = outerCache[ dir ]) &&
2134                                                         oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2136                                                         // Assign to newCache so results back-propagate to previous elements
2137                                                         return (newCache[ 2 ] = oldCache[ 2 ]);
2138                                                 } else {
2139                                                         // Reuse newcache so results back-propagate to previous elements
2140                                                         outerCache[ dir ] = newCache;
2142                                                         // A match means we're done; a fail means we have to keep checking
2143                                                         if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
2144                                                                 return true;
2145                                                         }
2146                                                 }
2147                                         }
2148                                 }
2149                         }
2150                 };
2153 function elementMatcher( matchers ) {
2154         return matchers.length > 1 ?
2155                 function( elem, context, xml ) {
2156                         var i = matchers.length;
2157                         while ( i-- ) {
2158                                 if ( !matchers[i]( elem, context, xml ) ) {
2159                                         return false;
2160                                 }
2161                         }
2162                         return true;
2163                 } :
2164                 matchers[0];
2167 function condense( unmatched, map, filter, context, xml ) {
2168         var elem,
2169                 newUnmatched = [],
2170                 i = 0,
2171                 len = unmatched.length,
2172                 mapped = map != null;
2174         for ( ; i < len; i++ ) {
2175                 if ( (elem = unmatched[i]) ) {
2176                         if ( !filter || filter( elem, context, xml ) ) {
2177                                 newUnmatched.push( elem );
2178                                 if ( mapped ) {
2179                                         map.push( i );
2180                                 }
2181                         }
2182                 }
2183         }
2185         return newUnmatched;
2188 function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2189         if ( postFilter && !postFilter[ expando ] ) {
2190                 postFilter = setMatcher( postFilter );
2191         }
2192         if ( postFinder && !postFinder[ expando ] ) {
2193                 postFinder = setMatcher( postFinder, postSelector );
2194         }
2195         return markFunction(function( seed, results, context, xml ) {
2196                 var temp, i, elem,
2197                         preMap = [],
2198                         postMap = [],
2199                         preexisting = results.length,
2201                         // Get initial elements from seed or context
2202                         elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
2204                         // Prefilter to get matcher input, preserving a map for seed-results synchronization
2205                         matcherIn = preFilter && ( seed || !selector ) ?
2206                                 condense( elems, preMap, preFilter, context, xml ) :
2207                                 elems,
2209                         matcherOut = matcher ?
2210                                 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2211                                 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2213                                         // ...intermediate processing is necessary
2214                                         [] :
2216                                         // ...otherwise use results directly
2217                                         results :
2218                                 matcherIn;
2220                 // Find primary matches
2221                 if ( matcher ) {
2222                         matcher( matcherIn, matcherOut, context, xml );
2223                 }
2225                 // Apply postFilter
2226                 if ( postFilter ) {
2227                         temp = condense( matcherOut, postMap );
2228                         postFilter( temp, [], context, xml );
2230                         // Un-match failing elements by moving them back to matcherIn
2231                         i = temp.length;
2232                         while ( i-- ) {
2233                                 if ( (elem = temp[i]) ) {
2234                                         matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
2235                                 }
2236                         }
2237                 }
2239                 if ( seed ) {
2240                         if ( postFinder || preFilter ) {
2241                                 if ( postFinder ) {
2242                                         // Get the final matcherOut by condensing this intermediate into postFinder contexts
2243                                         temp = [];
2244                                         i = matcherOut.length;
2245                                         while ( i-- ) {
2246                                                 if ( (elem = matcherOut[i]) ) {
2247                                                         // Restore matcherIn since elem is not yet a final match
2248                                                         temp.push( (matcherIn[i] = elem) );
2249                                                 }
2250                                         }
2251                                         postFinder( null, (matcherOut = []), temp, xml );
2252                                 }
2254                                 // Move matched elements from seed to results to keep them synchronized
2255                                 i = matcherOut.length;
2256                                 while ( i-- ) {
2257                                         if ( (elem = matcherOut[i]) &&
2258                                                 (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) {
2260                                                 seed[temp] = !(results[temp] = elem);
2261                                         }
2262                                 }
2263                         }
2265                 // Add elements to results, through postFinder if defined
2266                 } else {
2267                         matcherOut = condense(
2268                                 matcherOut === results ?
2269                                         matcherOut.splice( preexisting, matcherOut.length ) :
2270                                         matcherOut
2271                         );
2272                         if ( postFinder ) {
2273                                 postFinder( null, results, matcherOut, xml );
2274                         } else {
2275                                 push.apply( results, matcherOut );
2276                         }
2277                 }
2278         });
2281 function matcherFromTokens( tokens ) {
2282         var checkContext, matcher, j,
2283                 len = tokens.length,
2284                 leadingRelative = Expr.relative[ tokens[0].type ],
2285                 implicitRelative = leadingRelative || Expr.relative[" "],
2286                 i = leadingRelative ? 1 : 0,
2288                 // The foundational matcher ensures that elements are reachable from top-level context(s)
2289                 matchContext = addCombinator( function( elem ) {
2290                         return elem === checkContext;
2291                 }, implicitRelative, true ),
2292                 matchAnyContext = addCombinator( function( elem ) {
2293                         return indexOf.call( checkContext, elem ) > -1;
2294                 }, implicitRelative, true ),
2295                 matchers = [ function( elem, context, xml ) {
2296                         return ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2297                                 (checkContext = context).nodeType ?
2298                                         matchContext( elem, context, xml ) :
2299                                         matchAnyContext( elem, context, xml ) );
2300                 } ];
2302         for ( ; i < len; i++ ) {
2303                 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
2304                         matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
2305                 } else {
2306                         matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
2308                         // Return special upon seeing a positional matcher
2309                         if ( matcher[ expando ] ) {
2310                                 // Find the next relative operator (if any) for proper handling
2311                                 j = ++i;
2312                                 for ( ; j < len; j++ ) {
2313                                         if ( Expr.relative[ tokens[j].type ] ) {
2314                                                 break;
2315                                         }
2316                                 }
2317                                 return setMatcher(
2318                                         i > 1 && elementMatcher( matchers ),
2319                                         i > 1 && toSelector(
2320                                                 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2321                                                 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
2322                                         ).replace( rtrim, "$1" ),
2323                                         matcher,
2324                                         i < j && matcherFromTokens( tokens.slice( i, j ) ),
2325                                         j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
2326                                         j < len && toSelector( tokens )
2327                                 );
2328                         }
2329                         matchers.push( matcher );
2330                 }
2331         }
2333         return elementMatcher( matchers );
2336 function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2337         var bySet = setMatchers.length > 0,
2338                 byElement = elementMatchers.length > 0,
2339                 superMatcher = function( seed, context, xml, results, outermost ) {
2340                         var elem, j, matcher,
2341                                 matchedCount = 0,
2342                                 i = "0",
2343                                 unmatched = seed && [],
2344                                 setMatched = [],
2345                                 contextBackup = outermostContext,
2346                                 // We must always have either seed elements or outermost context
2347                                 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
2348                                 // Use integer dirruns iff this is the outermost matcher
2349                                 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
2350                                 len = elems.length;
2352                         if ( outermost ) {
2353                                 outermostContext = context !== document && context;
2354                         }
2356                         // Add elements passing elementMatchers directly to results
2357                         // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
2358                         // Support: IE<9, Safari
2359                         // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
2360                         for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
2361                                 if ( byElement && elem ) {
2362                                         j = 0;
2363                                         while ( (matcher = elementMatchers[j++]) ) {
2364                                                 if ( matcher( elem, context, xml ) ) {
2365                                                         results.push( elem );
2366                                                         break;
2367                                                 }
2368                                         }
2369                                         if ( outermost ) {
2370                                                 dirruns = dirrunsUnique;
2371                                         }
2372                                 }
2374                                 // Track unmatched elements for set filters
2375                                 if ( bySet ) {
2376                                         // They will have gone through all possible matchers
2377                                         if ( (elem = !matcher && elem) ) {
2378                                                 matchedCount--;
2379                                         }
2381                                         // Lengthen the array for every element, matched or not
2382                                         if ( seed ) {
2383                                                 unmatched.push( elem );
2384                                         }
2385                                 }
2386                         }
2388                         // Apply set filters to unmatched elements
2389                         matchedCount += i;
2390                         if ( bySet && i !== matchedCount ) {
2391                                 j = 0;
2392                                 while ( (matcher = setMatchers[j++]) ) {
2393                                         matcher( unmatched, setMatched, context, xml );
2394                                 }
2396                                 if ( seed ) {
2397                                         // Reintegrate element matches to eliminate the need for sorting
2398                                         if ( matchedCount > 0 ) {
2399                                                 while ( i-- ) {
2400                                                         if ( !(unmatched[i] || setMatched[i]) ) {
2401                                                                 setMatched[i] = pop.call( results );
2402                                                         }
2403                                                 }
2404                                         }
2406                                         // Discard index placeholder values to get only actual matches
2407                                         setMatched = condense( setMatched );
2408                                 }
2410                                 // Add matches to results
2411                                 push.apply( results, setMatched );
2413                                 // Seedless set matches succeeding multiple successful matchers stipulate sorting
2414                                 if ( outermost && !seed && setMatched.length > 0 &&
2415                                         ( matchedCount + setMatchers.length ) > 1 ) {
2417                                         Sizzle.uniqueSort( results );
2418                                 }
2419                         }
2421                         // Override manipulation of globals by nested matchers
2422                         if ( outermost ) {
2423                                 dirruns = dirrunsUnique;
2424                                 outermostContext = contextBackup;
2425                         }
2427                         return unmatched;
2428                 };
2430         return bySet ?
2431                 markFunction( superMatcher ) :
2432                 superMatcher;
2435 compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {
2436         var i,
2437                 setMatchers = [],
2438                 elementMatchers = [],
2439                 cached = compilerCache[ selector + " " ];
2441         if ( !cached ) {
2442                 // Generate a function of recursive functions that can be used to check each element
2443                 if ( !group ) {
2444                         group = tokenize( selector );
2445                 }
2446                 i = group.length;
2447                 while ( i-- ) {
2448                         cached = matcherFromTokens( group[i] );
2449                         if ( cached[ expando ] ) {
2450                                 setMatchers.push( cached );
2451                         } else {
2452                                 elementMatchers.push( cached );
2453                         }
2454                 }
2456                 // Cache the compiled function
2457                 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2458         }
2459         return cached;
2460 };
2462 function multipleContexts( selector, contexts, results ) {
2463         var i = 0,
2464                 len = contexts.length;
2465         for ( ; i < len; i++ ) {
2466                 Sizzle( selector, contexts[i], results );
2467         }
2468         return results;
2471 function select( selector, context, results, seed ) {
2472         var i, tokens, token, type, find,
2473                 match = tokenize( selector );
2475         if ( !seed ) {
2476                 // Try to minimize operations if there is only one group
2477                 if ( match.length === 1 ) {
2479                         // Take a shortcut and set the context if the root selector is an ID
2480                         tokens = match[0] = match[0].slice( 0 );
2481                         if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
2482                                         support.getById && context.nodeType === 9 && documentIsHTML &&
2483                                         Expr.relative[ tokens[1].type ] ) {
2485                                 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
2486                                 if ( !context ) {
2487                                         return results;
2488                                 }
2489                                 selector = selector.slice( tokens.shift().value.length );
2490                         }
2492                         // Fetch a seed set for right-to-left matching
2493                         i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
2494                         while ( i-- ) {
2495                                 token = tokens[i];
2497                                 // Abort if we hit a combinator
2498                                 if ( Expr.relative[ (type = token.type) ] ) {
2499                                         break;
2500                                 }
2501                                 if ( (find = Expr.find[ type ]) ) {
2502                                         // Search, expanding context for leading sibling combinators
2503                                         if ( (seed = find(
2504                                                 token.matches[0].replace( runescape, funescape ),
2505                                                 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
2506                                         )) ) {
2508                                                 // If seed is empty or no tokens remain, we can return early
2509                                                 tokens.splice( i, 1 );
2510                                                 selector = seed.length && toSelector( tokens );
2511                                                 if ( !selector ) {
2512                                                         push.apply( results, seed );
2513                                                         return results;
2514                                                 }
2516                                                 break;
2517                                         }
2518                                 }
2519                         }
2520                 }
2521         }
2523         // Compile and execute a filtering function
2524         // Provide `match` to avoid retokenization if we modified the selector above
2525         compile( selector, match )(
2526                 seed,
2527                 context,
2528                 !documentIsHTML,
2529                 results,
2530                 rsibling.test( selector ) && testContext( context.parentNode ) || context
2531         );
2532         return results;
2535 // One-time assignments
2537 // Sort stability
2538 support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
2540 // Support: Chrome<14
2541 // Always assume duplicates if they aren't passed to the comparison function
2542 support.detectDuplicates = !!hasDuplicate;
2544 // Initialize against the default document
2545 setDocument();
2547 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
2548 // Detached nodes confoundingly follow *each other*
2549 support.sortDetached = assert(function( div1 ) {
2550         // Should return 1, but returns 4 (following)
2551         return div1.compareDocumentPosition( document.createElement("div") ) & 1;
2552 });
2554 // Support: IE<8
2555 // Prevent attribute/property "interpolation"
2556 // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2557 if ( !assert(function( div ) {
2558         div.innerHTML = "<a href='#'></a>";
2559         return div.firstChild.getAttribute("href") === "#" ;
2560 }) ) {
2561         addHandle( "type|href|height|width", function( elem, name, isXML ) {
2562                 if ( !isXML ) {
2563                         return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
2564                 }
2565         });
2568 // Support: IE<9
2569 // Use defaultValue in place of getAttribute("value")
2570 if ( !support.attributes || !assert(function( div ) {
2571         div.innerHTML = "<input/>";
2572         div.firstChild.setAttribute( "value", "" );
2573         return div.firstChild.getAttribute( "value" ) === "";
2574 }) ) {
2575         addHandle( "value", function( elem, name, isXML ) {
2576                 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
2577                         return elem.defaultValue;
2578                 }
2579         });
2582 // Support: IE<9
2583 // Use getAttributeNode to fetch booleans when getAttribute lies
2584 if ( !assert(function( div ) {
2585         return div.getAttribute("disabled") == null;
2586 }) ) {
2587         addHandle( booleans, function( elem, name, isXML ) {
2588                 var val;
2589                 if ( !isXML ) {
2590                         return elem[ name ] === true ? name.toLowerCase() :
2591                                         (val = elem.getAttributeNode( name )) && val.specified ?
2592                                         val.value :
2593                                 null;
2594                 }
2595         });
2598 return Sizzle;
2600 })( window );
2604 jQuery.find = Sizzle;
2605 jQuery.expr = Sizzle.selectors;
2606 jQuery.expr[":"] = jQuery.expr.pseudos;
2607 jQuery.unique = Sizzle.uniqueSort;
2608 jQuery.text = Sizzle.getText;
2609 jQuery.isXMLDoc = Sizzle.isXML;
2610 jQuery.contains = Sizzle.contains;
2614 var rneedsContext = jQuery.expr.match.needsContext;
2616 var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
2620 var risSimple = /^.[^:#\[\.,]*$/;
2622 // Implement the identical functionality for filter and not
2623 function winnow( elements, qualifier, not ) {
2624         if ( jQuery.isFunction( qualifier ) ) {
2625                 return jQuery.grep( elements, function( elem, i ) {
2626                         /* jshint -W018 */
2627                         return !!qualifier.call( elem, i, elem ) !== not;
2628                 });
2630         }
2632         if ( qualifier.nodeType ) {
2633                 return jQuery.grep( elements, function( elem ) {
2634                         return ( elem === qualifier ) !== not;
2635                 });
2637         }
2639         if ( typeof qualifier === "string" ) {
2640                 if ( risSimple.test( qualifier ) ) {
2641                         return jQuery.filter( qualifier, elements, not );
2642                 }
2644                 qualifier = jQuery.filter( qualifier, elements );
2645         }
2647         return jQuery.grep( elements, function( elem ) {
2648                 return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not;
2649         });
2652 jQuery.filter = function( expr, elems, not ) {
2653         var elem = elems[ 0 ];
2655         if ( not ) {
2656                 expr = ":not(" + expr + ")";
2657         }
2659         return elems.length === 1 && elem.nodeType === 1 ?
2660                 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
2661                 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
2662                         return elem.nodeType === 1;
2663                 }));
2664 };
2666 jQuery.fn.extend({
2667         find: function( selector ) {
2668                 var i,
2669                         ret = [],
2670                         self = this,
2671                         len = self.length;
2673                 if ( typeof selector !== "string" ) {
2674                         return this.pushStack( jQuery( selector ).filter(function() {
2675                                 for ( i = 0; i < len; i++ ) {
2676                                         if ( jQuery.contains( self[ i ], this ) ) {
2677                                                 return true;
2678                                         }
2679                                 }
2680                         }) );
2681                 }
2683                 for ( i = 0; i < len; i++ ) {
2684                         jQuery.find( selector, self[ i ], ret );
2685                 }
2687                 // Needed because $( selector, context ) becomes $( context ).find( selector )
2688                 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
2689                 ret.selector = this.selector ? this.selector + " " + selector : selector;
2690                 return ret;
2691         },
2692         filter: function( selector ) {
2693                 return this.pushStack( winnow(this, selector || [], false) );
2694         },
2695         not: function( selector ) {
2696                 return this.pushStack( winnow(this, selector || [], true) );
2697         },
2698         is: function( selector ) {
2699                 return !!winnow(
2700                         this,
2702                         // If this is a positional/relative selector, check membership in the returned set
2703                         // so $("p:first").is("p:last") won't return true for a doc with two "p".
2704                         typeof selector === "string" && rneedsContext.test( selector ) ?
2705                                 jQuery( selector ) :
2706                                 selector || [],
2707                         false
2708                 ).length;
2709         }
2710 });
2713 // Initialize a jQuery object
2716 // A central reference to the root jQuery(document)
2717 var rootjQuery,
2719         // Use the correct document accordingly with window argument (sandbox)
2720         document = window.document,
2722         // A simple way to check for HTML strings
2723         // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
2724         // Strict HTML recognition (#11290: must start with <)
2725         rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
2727         init = jQuery.fn.init = function( selector, context ) {
2728                 var match, elem;
2730                 // HANDLE: $(""), $(null), $(undefined), $(false)
2731                 if ( !selector ) {
2732                         return this;
2733                 }
2735                 // Handle HTML strings
2736                 if ( typeof selector === "string" ) {
2737                         if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
2738                                 // Assume that strings that start and end with <> are HTML and skip the regex check
2739                                 match = [ null, selector, null ];
2741                         } else {
2742                                 match = rquickExpr.exec( selector );
2743                         }
2745                         // Match html or make sure no context is specified for #id
2746                         if ( match && (match[1] || !context) ) {
2748                                 // HANDLE: $(html) -> $(array)
2749                                 if ( match[1] ) {
2750                                         context = context instanceof jQuery ? context[0] : context;
2752                                         // scripts is true for back-compat
2753                                         // Intentionally let the error be thrown if parseHTML is not present
2754                                         jQuery.merge( this, jQuery.parseHTML(
2755                                                 match[1],
2756                                                 context && context.nodeType ? context.ownerDocument || context : document,
2757                                                 true
2758                                         ) );
2760                                         // HANDLE: $(html, props)
2761                                         if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
2762                                                 for ( match in context ) {
2763                                                         // Properties of context are called as methods if possible
2764                                                         if ( jQuery.isFunction( this[ match ] ) ) {
2765                                                                 this[ match ]( context[ match ] );
2767                                                         // ...and otherwise set as attributes
2768                                                         } else {
2769                                                                 this.attr( match, context[ match ] );
2770                                                         }
2771                                                 }
2772                                         }
2774                                         return this;
2776                                 // HANDLE: $(#id)
2777                                 } else {
2778                                         elem = document.getElementById( match[2] );
2780                                         // Check parentNode to catch when Blackberry 4.6 returns
2781                                         // nodes that are no longer in the document #6963
2782                                         if ( elem && elem.parentNode ) {
2783                                                 // Handle the case where IE and Opera return items
2784                                                 // by name instead of ID
2785                                                 if ( elem.id !== match[2] ) {
2786                                                         return rootjQuery.find( selector );
2787                                                 }
2789                                                 // Otherwise, we inject the element directly into the jQuery object
2790                                                 this.length = 1;
2791                                                 this[0] = elem;
2792                                         }
2794                                         this.context = document;
2795                                         this.selector = selector;
2796                                         return this;
2797                                 }
2799                         // HANDLE: $(expr, $(...))
2800                         } else if ( !context || context.jquery ) {
2801                                 return ( context || rootjQuery ).find( selector );
2803                         // HANDLE: $(expr, context)
2804                         // (which is just equivalent to: $(context).find(expr)
2805                         } else {
2806                                 return this.constructor( context ).find( selector );
2807                         }
2809                 // HANDLE: $(DOMElement)
2810                 } else if ( selector.nodeType ) {
2811                         this.context = this[0] = selector;
2812                         this.length = 1;
2813                         return this;
2815                 // HANDLE: $(function)
2816                 // Shortcut for document ready
2817                 } else if ( jQuery.isFunction( selector ) ) {
2818                         return typeof rootjQuery.ready !== "undefined" ?
2819                                 rootjQuery.ready( selector ) :
2820                                 // Execute immediately if ready is not present
2821                                 selector( jQuery );
2822                 }
2824                 if ( selector.selector !== undefined ) {
2825                         this.selector = selector.selector;
2826                         this.context = selector.context;
2827                 }
2829                 return jQuery.makeArray( selector, this );
2830         };
2832 // Give the init function the jQuery prototype for later instantiation
2833 init.prototype = jQuery.fn;
2835 // Initialize central reference
2836 rootjQuery = jQuery( document );
2839 var rparentsprev = /^(?:parents|prev(?:Until|All))/,
2840         // methods guaranteed to produce a unique set when starting from a unique set
2841         guaranteedUnique = {
2842                 children: true,
2843                 contents: true,
2844                 next: true,
2845                 prev: true
2846         };
2848 jQuery.extend({
2849         dir: function( elem, dir, until ) {
2850                 var matched = [],
2851                         cur = elem[ dir ];
2853                 while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
2854                         if ( cur.nodeType === 1 ) {
2855                                 matched.push( cur );
2856                         }
2857                         cur = cur[dir];
2858                 }
2859                 return matched;
2860         },
2862         sibling: function( n, elem ) {
2863                 var r = [];
2865                 for ( ; n; n = n.nextSibling ) {
2866                         if ( n.nodeType === 1 && n !== elem ) {
2867                                 r.push( n );
2868                         }
2869                 }
2871                 return r;
2872         }
2873 });
2875 jQuery.fn.extend({
2876         has: function( target ) {
2877                 var i,
2878                         targets = jQuery( target, this ),
2879                         len = targets.length;
2881                 return this.filter(function() {
2882                         for ( i = 0; i < len; i++ ) {
2883                                 if ( jQuery.contains( this, targets[i] ) ) {
2884                                         return true;
2885                                 }
2886                         }
2887                 });
2888         },
2890         closest: function( selectors, context ) {