Merge branch 'wip-mdl-55258-m' of https://github.com/rajeshtaneja/moodle
[moodle.git] / lib / jquery / jquery-3.1.0.js
1 /*eslint-disable no-unused-vars*/
2 /*!
3  * jQuery JavaScript Library v3.1.0
4  * https://jquery.com/
5  *
6  * Includes Sizzle.js
7  * https://sizzlejs.com/
8  *
9  * Copyright jQuery Foundation and other contributors
10  * Released under the MIT license
11  * https://jquery.org/license
12  *
13  * Date: 2016-07-07T21:44Z
14  */
15 ( function( global, factory ) {
17         "use strict";
19         if ( typeof module === "object" && typeof module.exports === "object" ) {
21                 // For CommonJS and CommonJS-like environments where a proper `window`
22                 // is present, execute the factory and get jQuery.
23                 // For environments that do not have a `window` with a `document`
24                 // (such as Node.js), expose a factory as module.exports.
25                 // This accentuates the need for the creation of a real `window`.
26                 // e.g. var jQuery = require("jquery")(window);
27                 // See ticket #14549 for more info.
28                 module.exports = global.document ?
29                         factory( global, true ) :
30                         function( w ) {
31                                 if ( !w.document ) {
32                                         throw new Error( "jQuery requires a window with a document" );
33                                 }
34                                 return factory( w );
35                         };
36         } else {
37                 factory( global );
38         }
40 // Pass this if window is not defined yet
41 } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
43 // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
44 // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
45 // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
46 // enough that all such attempts are guarded in a try block.
47 "use strict";
49 var arr = [];
51 var document = window.document;
53 var getProto = Object.getPrototypeOf;
55 var slice = arr.slice;
57 var concat = arr.concat;
59 var push = arr.push;
61 var indexOf = arr.indexOf;
63 var class2type = {};
65 var toString = class2type.toString;
67 var hasOwn = class2type.hasOwnProperty;
69 var fnToString = hasOwn.toString;
71 var ObjectFunctionString = fnToString.call( Object );
73 var support = {};
77         function DOMEval( code, doc ) {
78                 doc = doc || document;
80                 var script = doc.createElement( "script" );
82                 script.text = code;
83                 doc.head.appendChild( script ).parentNode.removeChild( script );
84         }
85 /* global Symbol */
86 // Defining this global in .eslintrc would create a danger of using the global
87 // unguarded in another place, it seems safer to define global only for this module
91 var
92         version = "3.1.0",
94         // Define a local copy of jQuery
95         jQuery = function( selector, context ) {
97                 // The jQuery object is actually just the init constructor 'enhanced'
98                 // Need init if jQuery is called (just allow error to be thrown if not included)
99                 return new jQuery.fn.init( selector, context );
100         },
102         // Support: Android <=4.0 only
103         // Make sure we trim BOM and NBSP
104         rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
106         // Matches dashed string for camelizing
107         rmsPrefix = /^-ms-/,
108         rdashAlpha = /-([a-z])/g,
110         // Used by jQuery.camelCase as callback to replace()
111         fcamelCase = function( all, letter ) {
112                 return letter.toUpperCase();
113         };
115 jQuery.fn = jQuery.prototype = {
117         // The current version of jQuery being used
118         jquery: version,
120         constructor: jQuery,
122         // The default length of a jQuery object is 0
123         length: 0,
125         toArray: function() {
126                 return slice.call( this );
127         },
129         // Get the Nth element in the matched element set OR
130         // Get the whole matched element set as a clean array
131         get: function( num ) {
132                 return num != null ?
134                         // Return just the one element from the set
135                         ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
137                         // Return all the elements in a clean array
138                         slice.call( this );
139         },
141         // Take an array of elements and push it onto the stack
142         // (returning the new matched element set)
143         pushStack: function( elems ) {
145                 // Build a new jQuery matched element set
146                 var ret = jQuery.merge( this.constructor(), elems );
148                 // Add the old object onto the stack (as a reference)
149                 ret.prevObject = this;
151                 // Return the newly-formed element set
152                 return ret;
153         },
155         // Execute a callback for every element in the matched set.
156         each: function( callback ) {
157                 return jQuery.each( this, callback );
158         },
160         map: function( callback ) {
161                 return this.pushStack( jQuery.map( this, function( elem, i ) {
162                         return callback.call( elem, i, elem );
163                 } ) );
164         },
166         slice: function() {
167                 return this.pushStack( slice.apply( this, arguments ) );
168         },
170         first: function() {
171                 return this.eq( 0 );
172         },
174         last: function() {
175                 return this.eq( -1 );
176         },
178         eq: function( i ) {
179                 var len = this.length,
180                         j = +i + ( i < 0 ? len : 0 );
181                 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
182         },
184         end: function() {
185                 return this.prevObject || this.constructor();
186         },
188         // For internal use only.
189         // Behaves like an Array's method, not like a jQuery method.
190         push: push,
191         sort: arr.sort,
192         splice: arr.splice
193 };
195 jQuery.extend = jQuery.fn.extend = function() {
196         var options, name, src, copy, copyIsArray, clone,
197                 target = arguments[ 0 ] || {},
198                 i = 1,
199                 length = arguments.length,
200                 deep = false;
202         // Handle a deep copy situation
203         if ( typeof target === "boolean" ) {
204                 deep = target;
206                 // Skip the boolean and the target
207                 target = arguments[ i ] || {};
208                 i++;
209         }
211         // Handle case when target is a string or something (possible in deep copy)
212         if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
213                 target = {};
214         }
216         // Extend jQuery itself if only one argument is passed
217         if ( i === length ) {
218                 target = this;
219                 i--;
220         }
222         for ( ; i < length; i++ ) {
224                 // Only deal with non-null/undefined values
225                 if ( ( options = arguments[ i ] ) != null ) {
227                         // Extend the base object
228                         for ( name in options ) {
229                                 src = target[ name ];
230                                 copy = options[ name ];
232                                 // Prevent never-ending loop
233                                 if ( target === copy ) {
234                                         continue;
235                                 }
237                                 // Recurse if we're merging plain objects or arrays
238                                 if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
239                                         ( copyIsArray = jQuery.isArray( copy ) ) ) ) {
241                                         if ( copyIsArray ) {
242                                                 copyIsArray = false;
243                                                 clone = src && jQuery.isArray( src ) ? src : [];
245                                         } else {
246                                                 clone = src && jQuery.isPlainObject( src ) ? src : {};
247                                         }
249                                         // Never move original objects, clone them
250                                         target[ name ] = jQuery.extend( deep, clone, copy );
252                                 // Don't bring in undefined values
253                                 } else if ( copy !== undefined ) {
254                                         target[ name ] = copy;
255                                 }
256                         }
257                 }
258         }
260         // Return the modified object
261         return target;
262 };
264 jQuery.extend( {
266         // Unique for each copy of jQuery on the page
267         expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
269         // Assume jQuery is ready without the ready module
270         isReady: true,
272         error: function( msg ) {
273                 throw new Error( msg );
274         },
276         noop: function() {},
278         isFunction: function( obj ) {
279                 return jQuery.type( obj ) === "function";
280         },
282         isArray: Array.isArray,
284         isWindow: function( obj ) {
285                 return obj != null && obj === obj.window;
286         },
288         isNumeric: function( obj ) {
290                 // As of jQuery 3.0, isNumeric is limited to
291                 // strings and numbers (primitives or objects)
292                 // that can be coerced to finite numbers (gh-2662)
293                 var type = jQuery.type( obj );
294                 return ( type === "number" || type === "string" ) &&
296                         // parseFloat NaNs numeric-cast false positives ("")
297                         // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
298                         // subtraction forces infinities to NaN
299                         !isNaN( obj - parseFloat( obj ) );
300         },
302         isPlainObject: function( obj ) {
303                 var proto, Ctor;
305                 // Detect obvious negatives
306                 // Use toString instead of jQuery.type to catch host objects
307                 if ( !obj || toString.call( obj ) !== "[object Object]" ) {
308                         return false;
309                 }
311                 proto = getProto( obj );
313                 // Objects with no prototype (e.g., `Object.create( null )`) are plain
314                 if ( !proto ) {
315                         return true;
316                 }
318                 // Objects with prototype are plain iff they were constructed by a global Object function
319                 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
320                 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
321         },
323         isEmptyObject: function( obj ) {
325                 /* eslint-disable no-unused-vars */
326                 // See https://github.com/eslint/eslint/issues/6125
327                 var name;
329                 for ( name in obj ) {
330                         return false;
331                 }
332                 return true;
333         },
335         type: function( obj ) {
336                 if ( obj == null ) {
337                         return obj + "";
338                 }
340                 // Support: Android <=2.3 only (functionish RegExp)
341                 return typeof obj === "object" || typeof obj === "function" ?
342                         class2type[ toString.call( obj ) ] || "object" :
343                         typeof obj;
344         },
346         // Evaluates a script in a global context
347         globalEval: function( code ) {
348                 DOMEval( code );
349         },
351         // Convert dashed to camelCase; used by the css and data modules
352         // Support: IE <=9 - 11, Edge 12 - 13
353         // Microsoft forgot to hump their vendor prefix (#9572)
354         camelCase: function( string ) {
355                 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
356         },
358         nodeName: function( elem, name ) {
359                 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
360         },
362         each: function( obj, callback ) {
363                 var length, i = 0;
365                 if ( isArrayLike( obj ) ) {
366                         length = obj.length;
367                         for ( ; i < length; i++ ) {
368                                 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
369                                         break;
370                                 }
371                         }
372                 } else {
373                         for ( i in obj ) {
374                                 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
375                                         break;
376                                 }
377                         }
378                 }
380                 return obj;
381         },
383         // Support: Android <=4.0 only
384         trim: function( text ) {
385                 return text == null ?
386                         "" :
387                         ( text + "" ).replace( rtrim, "" );
388         },
390         // results is for internal usage only
391         makeArray: function( arr, results ) {
392                 var ret = results || [];
394                 if ( arr != null ) {
395                         if ( isArrayLike( Object( arr ) ) ) {
396                                 jQuery.merge( ret,
397                                         typeof arr === "string" ?
398                                         [ arr ] : arr
399                                 );
400                         } else {
401                                 push.call( ret, arr );
402                         }
403                 }
405                 return ret;
406         },
408         inArray: function( elem, arr, i ) {
409                 return arr == null ? -1 : indexOf.call( arr, elem, i );
410         },
412         // Support: Android <=4.0 only, PhantomJS 1 only
413         // push.apply(_, arraylike) throws on ancient WebKit
414         merge: function( first, second ) {
415                 var len = +second.length,
416                         j = 0,
417                         i = first.length;
419                 for ( ; j < len; j++ ) {
420                         first[ i++ ] = second[ j ];
421                 }
423                 first.length = i;
425                 return first;
426         },
428         grep: function( elems, callback, invert ) {
429                 var callbackInverse,
430                         matches = [],
431                         i = 0,
432                         length = elems.length,
433                         callbackExpect = !invert;
435                 // Go through the array, only saving the items
436                 // that pass the validator function
437                 for ( ; i < length; i++ ) {
438                         callbackInverse = !callback( elems[ i ], i );
439                         if ( callbackInverse !== callbackExpect ) {
440                                 matches.push( elems[ i ] );
441                         }
442                 }
444                 return matches;
445         },
447         // arg is for internal usage only
448         map: function( elems, callback, arg ) {
449                 var length, value,
450                         i = 0,
451                         ret = [];
453                 // Go through the array, translating each of the items to their new values
454                 if ( isArrayLike( elems ) ) {
455                         length = elems.length;
456                         for ( ; i < length; i++ ) {
457                                 value = callback( elems[ i ], i, arg );
459                                 if ( value != null ) {
460                                         ret.push( value );
461                                 }
462                         }
464                 // Go through every key on the object,
465                 } else {
466                         for ( i in elems ) {
467                                 value = callback( elems[ i ], i, arg );
469                                 if ( value != null ) {
470                                         ret.push( value );
471                                 }
472                         }
473                 }
475                 // Flatten any nested arrays
476                 return concat.apply( [], ret );
477         },
479         // A global GUID counter for objects
480         guid: 1,
482         // Bind a function to a context, optionally partially applying any
483         // arguments.
484         proxy: function( fn, context ) {
485                 var tmp, args, proxy;
487                 if ( typeof context === "string" ) {
488                         tmp = fn[ context ];
489                         context = fn;
490                         fn = tmp;
491                 }
493                 // Quick check to determine if target is callable, in the spec
494                 // this throws a TypeError, but we will just return undefined.
495                 if ( !jQuery.isFunction( fn ) ) {
496                         return undefined;
497                 }
499                 // Simulated bind
500                 args = slice.call( arguments, 2 );
501                 proxy = function() {
502                         return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
503                 };
505                 // Set the guid of unique handler to the same of original handler, so it can be removed
506                 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
508                 return proxy;
509         },
511         now: Date.now,
513         // jQuery.support is not used in Core but other projects attach their
514         // properties to it so it needs to exist.
515         support: support
516 } );
518 if ( typeof Symbol === "function" ) {
519         jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
522 // Populate the class2type map
523 jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
524 function( i, name ) {
525         class2type[ "[object " + name + "]" ] = name.toLowerCase();
526 } );
528 function isArrayLike( obj ) {
530         // Support: real iOS 8.2 only (not reproducible in simulator)
531         // `in` check used to prevent JIT error (gh-2145)
532         // hasOwn isn't used here due to false negatives
533         // regarding Nodelist length in IE
534         var length = !!obj && "length" in obj && obj.length,
535                 type = jQuery.type( obj );
537         if ( type === "function" || jQuery.isWindow( obj ) ) {
538                 return false;
539         }
541         return type === "array" || length === 0 ||
542                 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
544 var Sizzle =
545 /*!
546  * Sizzle CSS Selector Engine v2.3.0
547  * https://sizzlejs.com/
548  *
549  * Copyright jQuery Foundation and other contributors
550  * Released under the MIT license
551  * http://jquery.org/license
552  *
553  * Date: 2016-01-04
554  */
555 (function( window ) {
557 var i,
558         support,
559         Expr,
560         getText,
561         isXML,
562         tokenize,
563         compile,
564         select,
565         outermostContext,
566         sortInput,
567         hasDuplicate,
569         // Local document vars
570         setDocument,
571         document,
572         docElem,
573         documentIsHTML,
574         rbuggyQSA,
575         rbuggyMatches,
576         matches,
577         contains,
579         // Instance-specific data
580         expando = "sizzle" + 1 * new Date(),
581         preferredDoc = window.document,
582         dirruns = 0,
583         done = 0,
584         classCache = createCache(),
585         tokenCache = createCache(),
586         compilerCache = createCache(),
587         sortOrder = function( a, b ) {
588                 if ( a === b ) {
589                         hasDuplicate = true;
590                 }
591                 return 0;
592         },
594         // Instance methods
595         hasOwn = ({}).hasOwnProperty,
596         arr = [],
597         pop = arr.pop,
598         push_native = arr.push,
599         push = arr.push,
600         slice = arr.slice,
601         // Use a stripped-down indexOf as it's faster than native
602         // https://jsperf.com/thor-indexof-vs-for/5
603         indexOf = function( list, elem ) {
604                 var i = 0,
605                         len = list.length;
606                 for ( ; i < len; i++ ) {
607                         if ( list[i] === elem ) {
608                                 return i;
609                         }
610                 }
611                 return -1;
612         },
614         booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
616         // Regular expressions
618         // http://www.w3.org/TR/css3-selectors/#whitespace
619         whitespace = "[\\x20\\t\\r\\n\\f]",
621         // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
622         identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
624         // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
625         attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
626                 // Operator (capture 2)
627                 "*([*^$|!~]?=)" + whitespace +
628                 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
629                 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
630                 "*\\]",
632         pseudos = ":(" + identifier + ")(?:\\((" +
633                 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
634                 // 1. quoted (capture 3; capture 4 or capture 5)
635                 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
636                 // 2. simple (capture 6)
637                 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
638                 // 3. anything else (capture 2)
639                 ".*" +
640                 ")\\)|)",
642         // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
643         rwhitespace = new RegExp( whitespace + "+", "g" ),
644         rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
646         rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
647         rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
649         rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
651         rpseudo = new RegExp( pseudos ),
652         ridentifier = new RegExp( "^" + identifier + "$" ),
654         matchExpr = {
655                 "ID": new RegExp( "^#(" + identifier + ")" ),
656                 "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
657                 "TAG": new RegExp( "^(" + identifier + "|[*])" ),
658                 "ATTR": new RegExp( "^" + attributes ),
659                 "PSEUDO": new RegExp( "^" + pseudos ),
660                 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
661                         "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
662                         "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
663                 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
664                 // For use in libraries implementing .is()
665                 // We use this for POS matching in `select`
666                 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
667                         whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
668         },
670         rinputs = /^(?:input|select|textarea|button)$/i,
671         rheader = /^h\d$/i,
673         rnative = /^[^{]+\{\s*\[native \w/,
675         // Easily-parseable/retrievable ID or TAG or CLASS selectors
676         rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
678         rsibling = /[+~]/,
680         // CSS escapes
681         // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
682         runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
683         funescape = function( _, escaped, escapedWhitespace ) {
684                 var high = "0x" + escaped - 0x10000;
685                 // NaN means non-codepoint
686                 // Support: Firefox<24
687                 // Workaround erroneous numeric interpretation of +"0x"
688                 return high !== high || escapedWhitespace ?
689                         escaped :
690                         high < 0 ?
691                                 // BMP codepoint
692                                 String.fromCharCode( high + 0x10000 ) :
693                                 // Supplemental Plane codepoint (surrogate pair)
694                                 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
695         },
697         // CSS string/identifier serialization
698         // https://drafts.csswg.org/cssom/#common-serializing-idioms
699         rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,
700         fcssescape = function( ch, asCodePoint ) {
701                 if ( asCodePoint ) {
703                         // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
704                         if ( ch === "\0" ) {
705                                 return "\uFFFD";
706                         }
708                         // Control characters and (dependent upon position) numbers get escaped as code points
709                         return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
710                 }
712                 // Other potentially-special ASCII characters get backslash-escaped
713                 return "\\" + ch;
714         },
716         // Used for iframes
717         // See setDocument()
718         // Removing the function wrapper causes a "Permission Denied"
719         // error in IE
720         unloadHandler = function() {
721                 setDocument();
722         },
724         disabledAncestor = addCombinator(
725                 function( elem ) {
726                         return elem.disabled === true;
727                 },
728                 { dir: "parentNode", next: "legend" }
729         );
731 // Optimize for push.apply( _, NodeList )
732 try {
733         push.apply(
734                 (arr = slice.call( preferredDoc.childNodes )),
735                 preferredDoc.childNodes
736         );
737         // Support: Android<4.0
738         // Detect silently failing push.apply
739         arr[ preferredDoc.childNodes.length ].nodeType;
740 } catch ( e ) {
741         push = { apply: arr.length ?
743                 // Leverage slice if possible
744                 function( target, els ) {
745                         push_native.apply( target, slice.call(els) );
746                 } :
748                 // Support: IE<9
749                 // Otherwise append directly
750                 function( target, els ) {
751                         var j = target.length,
752                                 i = 0;
753                         // Can't trust NodeList.length
754                         while ( (target[j++] = els[i++]) ) {}
755                         target.length = j - 1;
756                 }
757         };
760 function Sizzle( selector, context, results, seed ) {
761         var m, i, elem, nid, match, groups, newSelector,
762                 newContext = context && context.ownerDocument,
764                 // nodeType defaults to 9, since context defaults to document
765                 nodeType = context ? context.nodeType : 9;
767         results = results || [];
769         // Return early from calls with invalid selector or context
770         if ( typeof selector !== "string" || !selector ||
771                 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
773                 return results;
774         }
776         // Try to shortcut find operations (as opposed to filters) in HTML documents
777         if ( !seed ) {
779                 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
780                         setDocument( context );
781                 }
782                 context = context || document;
784                 if ( documentIsHTML ) {
786                         // If the selector is sufficiently simple, try using a "get*By*" DOM method
787                         // (excepting DocumentFragment context, where the methods don't exist)
788                         if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
790                                 // ID selector
791                                 if ( (m = match[1]) ) {
793                                         // Document context
794                                         if ( nodeType === 9 ) {
795                                                 if ( (elem = context.getElementById( m )) ) {
797                                                         // Support: IE, Opera, Webkit
798                                                         // TODO: identify versions
799                                                         // getElementById can match elements by name instead of ID
800                                                         if ( elem.id === m ) {
801                                                                 results.push( elem );
802                                                                 return results;
803                                                         }
804                                                 } else {
805                                                         return results;
806                                                 }
808                                         // Element context
809                                         } else {
811                                                 // Support: IE, Opera, Webkit
812                                                 // TODO: identify versions
813                                                 // getElementById can match elements by name instead of ID
814                                                 if ( newContext && (elem = newContext.getElementById( m )) &&
815                                                         contains( context, elem ) &&
816                                                         elem.id === m ) {
818                                                         results.push( elem );
819                                                         return results;
820                                                 }
821                                         }
823                                 // Type selector
824                                 } else if ( match[2] ) {
825                                         push.apply( results, context.getElementsByTagName( selector ) );
826                                         return results;
828                                 // Class selector
829                                 } else if ( (m = match[3]) && support.getElementsByClassName &&
830                                         context.getElementsByClassName ) {
832                                         push.apply( results, context.getElementsByClassName( m ) );
833                                         return results;
834                                 }
835                         }
837                         // Take advantage of querySelectorAll
838                         if ( support.qsa &&
839                                 !compilerCache[ selector + " " ] &&
840                                 (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
842                                 if ( nodeType !== 1 ) {
843                                         newContext = context;
844                                         newSelector = selector;
846                                 // qSA looks outside Element context, which is not what we want
847                                 // Thanks to Andrew Dupont for this workaround technique
848                                 // Support: IE <=8
849                                 // Exclude object elements
850                                 } else if ( context.nodeName.toLowerCase() !== "object" ) {
852                                         // Capture the context ID, setting it first if necessary
853                                         if ( (nid = context.getAttribute( "id" )) ) {
854                                                 nid = nid.replace( rcssescape, fcssescape );
855                                         } else {
856                                                 context.setAttribute( "id", (nid = expando) );
857                                         }
859                                         // Prefix every selector in the list
860                                         groups = tokenize( selector );
861                                         i = groups.length;
862                                         while ( i-- ) {
863                                                 groups[i] = "#" + nid + " " + toSelector( groups[i] );
864                                         }
865                                         newSelector = groups.join( "," );
867                                         // Expand context for sibling selectors
868                                         newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
869                                                 context;
870                                 }
872                                 if ( newSelector ) {
873                                         try {
874                                                 push.apply( results,
875                                                         newContext.querySelectorAll( newSelector )
876                                                 );
877                                                 return results;
878                                         } catch ( qsaError ) {
879                                         } finally {
880                                                 if ( nid === expando ) {
881                                                         context.removeAttribute( "id" );
882                                                 }
883                                         }
884                                 }
885                         }
886                 }
887         }
889         // All others
890         return select( selector.replace( rtrim, "$1" ), context, results, seed );
893 /**
894  * Create key-value caches of limited size
895  * @returns {function(string, object)} Returns the Object data after storing it on itself with
896  *      property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
897  *      deleting the oldest entry
898  */
899 function createCache() {
900         var keys = [];
902         function cache( key, value ) {
903                 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
904                 if ( keys.push( key + " " ) > Expr.cacheLength ) {
905                         // Only keep the most recent entries
906                         delete cache[ keys.shift() ];
907                 }
908                 return (cache[ key + " " ] = value);
909         }
910         return cache;
913 /**
914  * Mark a function for special use by Sizzle
915  * @param {Function} fn The function to mark
916  */
917 function markFunction( fn ) {
918         fn[ expando ] = true;
919         return fn;
922 /**
923  * Support testing using an element
924  * @param {Function} fn Passed the created element and returns a boolean result
925  */
926 function assert( fn ) {
927         var el = document.createElement("fieldset");
929         try {
930                 return !!fn( el );
931         } catch (e) {
932                 return false;
933         } finally {
934                 // Remove from its parent by default
935                 if ( el.parentNode ) {
936                         el.parentNode.removeChild( el );
937                 }
938                 // release memory in IE
939                 el = null;
940         }
943 /**
944  * Adds the same handler for all of the specified attrs
945  * @param {String} attrs Pipe-separated list of attributes
946  * @param {Function} handler The method that will be applied
947  */
948 function addHandle( attrs, handler ) {
949         var arr = attrs.split("|"),
950                 i = arr.length;
952         while ( i-- ) {
953                 Expr.attrHandle[ arr[i] ] = handler;
954         }
957 /**
958  * Checks document order of two siblings
959  * @param {Element} a
960  * @param {Element} b
961  * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
962  */
963 function siblingCheck( a, b ) {
964         var cur = b && a,
965                 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
966                         a.sourceIndex - b.sourceIndex;
968         // Use IE sourceIndex if available on both nodes
969         if ( diff ) {
970                 return diff;
971         }
973         // Check if b follows a
974         if ( cur ) {
975                 while ( (cur = cur.nextSibling) ) {
976                         if ( cur === b ) {
977                                 return -1;
978                         }
979                 }
980         }
982         return a ? 1 : -1;
985 /**
986  * Returns a function to use in pseudos for input types
987  * @param {String} type
988  */
989 function createInputPseudo( type ) {
990         return function( elem ) {
991                 var name = elem.nodeName.toLowerCase();
992                 return name === "input" && elem.type === type;
993         };
996 /**
997  * Returns a function to use in pseudos for buttons
998  * @param {String} type
999  */
1000 function createButtonPseudo( type ) {
1001         return function( elem ) {
1002                 var name = elem.nodeName.toLowerCase();
1003                 return (name === "input" || name === "button") && elem.type === type;
1004         };
1007 /**
1008  * Returns a function to use in pseudos for :enabled/:disabled
1009  * @param {Boolean} disabled true for :disabled; false for :enabled
1010  */
1011 function createDisabledPseudo( disabled ) {
1012         // Known :disabled false positives:
1013         // IE: *[disabled]:not(button, input, select, textarea, optgroup, option, menuitem, fieldset)
1014         // not IE: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
1015         return function( elem ) {
1017                 // Check form elements and option elements for explicit disabling
1018                 return "label" in elem && elem.disabled === disabled ||
1019                         "form" in elem && elem.disabled === disabled ||
1021                         // Check non-disabled form elements for fieldset[disabled] ancestors
1022                         "form" in elem && elem.disabled === false && (
1023                                 // Support: IE6-11+
1024                                 // Ancestry is covered for us
1025                                 elem.isDisabled === disabled ||
1027                                 // Otherwise, assume any non-<option> under fieldset[disabled] is disabled
1028                                 /* jshint -W018 */
1029                                 elem.isDisabled !== !disabled &&
1030                                         ("label" in elem || !disabledAncestor( elem )) !== disabled
1031                         );
1032         };
1035 /**
1036  * Returns a function to use in pseudos for positionals
1037  * @param {Function} fn
1038  */
1039 function createPositionalPseudo( fn ) {
1040         return markFunction(function( argument ) {
1041                 argument = +argument;
1042                 return markFunction(function( seed, matches ) {
1043                         var j,
1044                                 matchIndexes = fn( [], seed.length, argument ),
1045                                 i = matchIndexes.length;
1047                         // Match elements found at the specified indexes
1048                         while ( i-- ) {
1049                                 if ( seed[ (j = matchIndexes[i]) ] ) {
1050                                         seed[j] = !(matches[j] = seed[j]);
1051                                 }
1052                         }
1053                 });
1054         });
1057 /**
1058  * Checks a node for validity as a Sizzle context
1059  * @param {Element|Object=} context
1060  * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
1061  */
1062 function testContext( context ) {
1063         return context && typeof context.getElementsByTagName !== "undefined" && context;
1066 // Expose support vars for convenience
1067 support = Sizzle.support = {};
1069 /**
1070  * Detects XML nodes
1071  * @param {Element|Object} elem An element or a document
1072  * @returns {Boolean} True iff elem is a non-HTML XML node
1073  */
1074 isXML = Sizzle.isXML = function( elem ) {
1075         // documentElement is verified for cases where it doesn't yet exist
1076         // (such as loading iframes in IE - #4833)
1077         var documentElement = elem && (elem.ownerDocument || elem).documentElement;
1078         return documentElement ? documentElement.nodeName !== "HTML" : false;
1079 };
1081 /**
1082  * Sets document-related variables once based on the current document
1083  * @param {Element|Object} [doc] An element or document object to use to set the document
1084  * @returns {Object} Returns the current document
1085  */
1086 setDocument = Sizzle.setDocument = function( node ) {
1087         var hasCompare, subWindow,
1088                 doc = node ? node.ownerDocument || node : preferredDoc;
1090         // Return early if doc is invalid or already selected
1091         if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
1092                 return document;
1093         }
1095         // Update global variables
1096         document = doc;
1097         docElem = document.documentElement;
1098         documentIsHTML = !isXML( document );
1100         // Support: IE 9-11, Edge
1101         // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
1102         if ( preferredDoc !== document &&
1103                 (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
1105                 // Support: IE 11, Edge
1106                 if ( subWindow.addEventListener ) {
1107                         subWindow.addEventListener( "unload", unloadHandler, false );
1109                 // Support: IE 9 - 10 only
1110                 } else if ( subWindow.attachEvent ) {
1111                         subWindow.attachEvent( "onunload", unloadHandler );
1112                 }
1113         }
1115         /* Attributes
1116         ---------------------------------------------------------------------- */
1118         // Support: IE<8
1119         // Verify that getAttribute really returns attributes and not properties
1120         // (excepting IE8 booleans)
1121         support.attributes = assert(function( el ) {
1122                 el.className = "i";
1123                 return !el.getAttribute("className");
1124         });
1126         /* getElement(s)By*
1127         ---------------------------------------------------------------------- */
1129         // Check if getElementsByTagName("*") returns only elements
1130         support.getElementsByTagName = assert(function( el ) {
1131                 el.appendChild( document.createComment("") );
1132                 return !el.getElementsByTagName("*").length;
1133         });
1135         // Support: IE<9
1136         support.getElementsByClassName = rnative.test( document.getElementsByClassName );
1138         // Support: IE<10
1139         // Check if getElementById returns elements by name
1140         // The broken getElementById methods don't pick up programmatically-set names,
1141         // so use a roundabout getElementsByName test
1142         support.getById = assert(function( el ) {
1143                 docElem.appendChild( el ).id = expando;
1144                 return !document.getElementsByName || !document.getElementsByName( expando ).length;
1145         });
1147         // ID find and filter
1148         if ( support.getById ) {
1149                 Expr.find["ID"] = function( id, context ) {
1150                         if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1151                                 var m = context.getElementById( id );
1152                                 return m ? [ m ] : [];
1153                         }
1154                 };
1155                 Expr.filter["ID"] = function( id ) {
1156                         var attrId = id.replace( runescape, funescape );
1157                         return function( elem ) {
1158                                 return elem.getAttribute("id") === attrId;
1159                         };
1160                 };
1161         } else {
1162                 // Support: IE6/7
1163                 // getElementById is not reliable as a find shortcut
1164                 delete Expr.find["ID"];
1166                 Expr.filter["ID"] =  function( id ) {
1167                         var attrId = id.replace( runescape, funescape );
1168                         return function( elem ) {
1169                                 var node = typeof elem.getAttributeNode !== "undefined" &&
1170                                         elem.getAttributeNode("id");
1171                                 return node && node.value === attrId;
1172                         };
1173                 };
1174         }
1176         // Tag
1177         Expr.find["TAG"] = support.getElementsByTagName ?
1178                 function( tag, context ) {
1179                         if ( typeof context.getElementsByTagName !== "undefined" ) {
1180                                 return context.getElementsByTagName( tag );
1182                         // DocumentFragment nodes don't have gEBTN
1183                         } else if ( support.qsa ) {
1184                                 return context.querySelectorAll( tag );
1185                         }
1186                 } :
1188                 function( tag, context ) {
1189                         var elem,
1190                                 tmp = [],
1191                                 i = 0,
1192                                 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
1193                                 results = context.getElementsByTagName( tag );
1195                         // Filter out possible comments
1196                         if ( tag === "*" ) {
1197                                 while ( (elem = results[i++]) ) {
1198                                         if ( elem.nodeType === 1 ) {
1199                                                 tmp.push( elem );
1200                                         }
1201                                 }
1203                                 return tmp;
1204                         }
1205                         return results;
1206                 };
1208         // Class
1209         Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
1210                 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
1211                         return context.getElementsByClassName( className );
1212                 }
1213         };
1215         /* QSA/matchesSelector
1216         ---------------------------------------------------------------------- */
1218         // QSA and matchesSelector support
1220         // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
1221         rbuggyMatches = [];
1223         // qSa(:focus) reports false when true (Chrome 21)
1224         // We allow this because of a bug in IE8/9 that throws an error
1225         // whenever `document.activeElement` is accessed on an iframe
1226         // So, we allow :focus to pass through QSA all the time to avoid the IE error
1227         // See https://bugs.jquery.com/ticket/13378
1228         rbuggyQSA = [];
1230         if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
1231                 // Build QSA regex
1232                 // Regex strategy adopted from Diego Perini
1233                 assert(function( el ) {
1234                         // Select is set to empty string on purpose
1235                         // This is to test IE's treatment of not explicitly
1236                         // setting a boolean content attribute,
1237                         // since its presence should be enough
1238                         // https://bugs.jquery.com/ticket/12359
1239                         docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
1240                                 "<select id='" + expando + "-\r\\' msallowcapture=''>" +
1241                                 "<option selected=''></option></select>";
1243                         // Support: IE8, Opera 11-12.16
1244                         // Nothing should be selected when empty strings follow ^= or $= or *=
1245                         // The test attribute must be unknown in Opera but "safe" for WinRT
1246                         // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
1247                         if ( el.querySelectorAll("[msallowcapture^='']").length ) {
1248                                 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
1249                         }
1251                         // Support: IE8
1252                         // Boolean attributes and "value" are not treated correctly
1253                         if ( !el.querySelectorAll("[selected]").length ) {
1254                                 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1255                         }
1257                         // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
1258                         if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1259                                 rbuggyQSA.push("~=");
1260                         }
1262                         // Webkit/Opera - :checked should return selected option elements
1263                         // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1264                         // IE8 throws error here and will not see later tests
1265                         if ( !el.querySelectorAll(":checked").length ) {
1266                                 rbuggyQSA.push(":checked");
1267                         }
1269                         // Support: Safari 8+, iOS 8+
1270                         // https://bugs.webkit.org/show_bug.cgi?id=136851
1271                         // In-page `selector#id sibling-combinator selector` fails
1272                         if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
1273                                 rbuggyQSA.push(".#.+[+~]");
1274                         }
1275                 });
1277                 assert(function( el ) {
1278                         el.innerHTML = "<a href='' disabled='disabled'></a>" +
1279                                 "<select disabled='disabled'><option/></select>";
1281                         // Support: Windows 8 Native Apps
1282                         // The type and name attributes are restricted during .innerHTML assignment
1283                         var input = document.createElement("input");
1284                         input.setAttribute( "type", "hidden" );
1285                         el.appendChild( input ).setAttribute( "name", "D" );
1287                         // Support: IE8
1288                         // Enforce case-sensitivity of name attribute
1289                         if ( el.querySelectorAll("[name=d]").length ) {
1290                                 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1291                         }
1293                         // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1294                         // IE8 throws error here and will not see later tests
1295                         if ( el.querySelectorAll(":enabled").length !== 2 ) {
1296                                 rbuggyQSA.push( ":enabled", ":disabled" );
1297                         }
1299                         // Support: IE9-11+
1300                         // IE's :disabled selector does not pick up the children of disabled fieldsets
1301                         docElem.appendChild( el ).disabled = true;
1302                         if ( el.querySelectorAll(":disabled").length !== 2 ) {
1303                                 rbuggyQSA.push( ":enabled", ":disabled" );
1304                         }
1306                         // Opera 10-11 does not throw on post-comma invalid pseudos
1307                         el.querySelectorAll("*,:x");
1308                         rbuggyQSA.push(",.*:");
1309                 });
1310         }
1312         if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
1313                 docElem.webkitMatchesSelector ||
1314                 docElem.mozMatchesSelector ||
1315                 docElem.oMatchesSelector ||
1316                 docElem.msMatchesSelector) )) ) {
1318                 assert(function( el ) {
1319                         // Check to see if it's possible to do matchesSelector
1320                         // on a disconnected node (IE 9)
1321                         support.disconnectedMatch = matches.call( el, "*" );
1323                         // This should fail with an exception
1324                         // Gecko does not error, returns false instead
1325                         matches.call( el, "[s!='']:x" );
1326                         rbuggyMatches.push( "!=", pseudos );
1327                 });
1328         }
1330         rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
1331         rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
1333         /* Contains
1334         ---------------------------------------------------------------------- */
1335         hasCompare = rnative.test( docElem.compareDocumentPosition );
1337         // Element contains another
1338         // Purposefully self-exclusive
1339         // As in, an element does not contain itself
1340         contains = hasCompare || rnative.test( docElem.contains ) ?
1341                 function( a, b ) {
1342                         var adown = a.nodeType === 9 ? a.documentElement : a,
1343                                 bup = b && b.parentNode;
1344                         return a === bup || !!( bup && bup.nodeType === 1 && (
1345                                 adown.contains ?
1346                                         adown.contains( bup ) :
1347                                         a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1348                         ));
1349                 } :
1350                 function( a, b ) {
1351                         if ( b ) {
1352                                 while ( (b = b.parentNode) ) {
1353                                         if ( b === a ) {
1354                                                 return true;
1355                                         }
1356                                 }
1357                         }
1358                         return false;
1359                 };
1361         /* Sorting
1362         ---------------------------------------------------------------------- */
1364         // Document order sorting
1365         sortOrder = hasCompare ?
1366         function( a, b ) {
1368                 // Flag for duplicate removal
1369                 if ( a === b ) {
1370                         hasDuplicate = true;
1371                         return 0;
1372                 }
1374                 // Sort on method existence if only one input has compareDocumentPosition
1375                 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
1376                 if ( compare ) {
1377                         return compare;
1378                 }
1380                 // Calculate position if both inputs belong to the same document
1381                 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
1382                         a.compareDocumentPosition( b ) :
1384                         // Otherwise we know they are disconnected
1385                         1;
1387                 // Disconnected nodes
1388                 if ( compare & 1 ||
1389                         (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
1391                         // Choose the first element that is related to our preferred document
1392                         if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
1393                                 return -1;
1394                         }
1395                         if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
1396                                 return 1;
1397                         }
1399                         // Maintain original order
1400                         return sortInput ?
1401                                 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1402                                 0;
1403                 }
1405                 return compare & 4 ? -1 : 1;
1406         } :
1407         function( a, b ) {
1408                 // Exit early if the nodes are identical
1409                 if ( a === b ) {
1410                         hasDuplicate = true;
1411                         return 0;
1412                 }
1414                 var cur,
1415                         i = 0,
1416                         aup = a.parentNode,
1417                         bup = b.parentNode,
1418                         ap = [ a ],
1419                         bp = [ b ];
1421                 // Parentless nodes are either documents or disconnected
1422                 if ( !aup || !bup ) {
1423                         return a === document ? -1 :
1424                                 b === document ? 1 :
1425                                 aup ? -1 :
1426                                 bup ? 1 :
1427                                 sortInput ?
1428                                 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1429                                 0;
1431                 // If the nodes are siblings, we can do a quick check
1432                 } else if ( aup === bup ) {
1433                         return siblingCheck( a, b );
1434                 }
1436                 // Otherwise we need full lists of their ancestors for comparison
1437                 cur = a;
1438                 while ( (cur = cur.parentNode) ) {
1439                         ap.unshift( cur );
1440                 }
1441                 cur = b;
1442                 while ( (cur = cur.parentNode) ) {
1443                         bp.unshift( cur );
1444                 }
1446                 // Walk down the tree looking for a discrepancy
1447                 while ( ap[i] === bp[i] ) {
1448                         i++;
1449                 }
1451                 return i ?
1452                         // Do a sibling check if the nodes have a common ancestor
1453                         siblingCheck( ap[i], bp[i] ) :
1455                         // Otherwise nodes in our document sort first
1456                         ap[i] === preferredDoc ? -1 :
1457                         bp[i] === preferredDoc ? 1 :
1458                         0;
1459         };
1461         return document;
1462 };
1464 Sizzle.matches = function( expr, elements ) {
1465         return Sizzle( expr, null, null, elements );
1466 };
1468 Sizzle.matchesSelector = function( elem, expr ) {
1469         // Set document vars if needed
1470         if ( ( elem.ownerDocument || elem ) !== document ) {
1471                 setDocument( elem );
1472         }
1474         // Make sure that attribute selectors are quoted
1475         expr = expr.replace( rattributeQuotes, "='$1']" );
1477         if ( support.matchesSelector && documentIsHTML &&
1478                 !compilerCache[ expr + " " ] &&
1479                 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
1480                 ( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {
1482                 try {
1483                         var ret = matches.call( elem, expr );
1485                         // IE 9's matchesSelector returns false on disconnected nodes
1486                         if ( ret || support.disconnectedMatch ||
1487                                         // As well, disconnected nodes are said to be in a document
1488                                         // fragment in IE 9
1489                                         elem.document && elem.document.nodeType !== 11 ) {
1490                                 return ret;
1491                         }
1492                 } catch (e) {}
1493         }
1495         return Sizzle( expr, document, null, [ elem ] ).length > 0;
1496 };
1498 Sizzle.contains = function( context, elem ) {
1499         // Set document vars if needed
1500         if ( ( context.ownerDocument || context ) !== document ) {
1501                 setDocument( context );
1502         }
1503         return contains( context, elem );
1504 };
1506 Sizzle.attr = function( elem, name ) {
1507         // Set document vars if needed
1508         if ( ( elem.ownerDocument || elem ) !== document ) {
1509                 setDocument( elem );
1510         }
1512         var fn = Expr.attrHandle[ name.toLowerCase() ],
1513                 // Don't get fooled by Object.prototype properties (jQuery #13807)
1514                 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1515                         fn( elem, name, !documentIsHTML ) :
1516                         undefined;
1518         return val !== undefined ?
1519                 val :
1520                 support.attributes || !documentIsHTML ?
1521                         elem.getAttribute( name ) :
1522                         (val = elem.getAttributeNode(name)) && val.specified ?
1523                                 val.value :
1524                                 null;
1525 };
1527 Sizzle.escape = function( sel ) {
1528         return (sel + "").replace( rcssescape, fcssescape );
1529 };
1531 Sizzle.error = function( msg ) {
1532         throw new Error( "Syntax error, unrecognized expression: " + msg );
1533 };
1535 /**
1536  * Document sorting and removing duplicates
1537  * @param {ArrayLike} results
1538  */
1539 Sizzle.uniqueSort = function( results ) {
1540         var elem,
1541                 duplicates = [],
1542                 j = 0,
1543                 i = 0;
1545         // Unless we *know* we can detect duplicates, assume their presence
1546         hasDuplicate = !support.detectDuplicates;
1547         sortInput = !support.sortStable && results.slice( 0 );
1548         results.sort( sortOrder );
1550         if ( hasDuplicate ) {
1551                 while ( (elem = results[i++]) ) {
1552                         if ( elem === results[ i ] ) {
1553                                 j = duplicates.push( i );
1554                         }
1555                 }
1556                 while ( j-- ) {
1557                         results.splice( duplicates[ j ], 1 );
1558                 }
1559         }
1561         // Clear input after sorting to release objects
1562         // See https://github.com/jquery/sizzle/pull/225
1563         sortInput = null;
1565         return results;
1566 };
1568 /**
1569  * Utility function for retrieving the text value of an array of DOM nodes
1570  * @param {Array|Element} elem
1571  */
1572 getText = Sizzle.getText = function( elem ) {
1573         var node,
1574                 ret = "",
1575                 i = 0,
1576                 nodeType = elem.nodeType;
1578         if ( !nodeType ) {
1579                 // If no nodeType, this is expected to be an array
1580                 while ( (node = elem[i++]) ) {
1581                         // Do not traverse comment nodes
1582                         ret += getText( node );
1583                 }
1584         } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1585                 // Use textContent for elements
1586                 // innerText usage removed for consistency of new lines (jQuery #11153)
1587                 if ( typeof elem.textContent === "string" ) {
1588                         return elem.textContent;
1589                 } else {
1590                         // Traverse its children
1591                         for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1592                                 ret += getText( elem );
1593                         }
1594                 }
1595         } else if ( nodeType === 3 || nodeType === 4 ) {
1596                 return elem.nodeValue;
1597         }
1598         // Do not include comment or processing instruction nodes
1600         return ret;
1601 };
1603 Expr = Sizzle.selectors = {
1605         // Can be adjusted by the user
1606         cacheLength: 50,
1608         createPseudo: markFunction,
1610         match: matchExpr,
1612         attrHandle: {},
1614         find: {},
1616         relative: {
1617                 ">": { dir: "parentNode", first: true },
1618                 " ": { dir: "parentNode" },
1619                 "+": { dir: "previousSibling", first: true },
1620                 "~": { dir: "previousSibling" }
1621         },
1623         preFilter: {
1624                 "ATTR": function( match ) {
1625                         match[1] = match[1].replace( runescape, funescape );
1627                         // Move the given value to match[3] whether quoted or unquoted
1628                         match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
1630                         if ( match[2] === "~=" ) {
1631                                 match[3] = " " + match[3] + " ";
1632                         }
1634                         return match.slice( 0, 4 );
1635                 },
1637                 "CHILD": function( match ) {
1638                         /* matches from matchExpr["CHILD"]
1639                                 1 type (only|nth|...)
1640                                 2 what (child|of-type)
1641                                 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
1642                                 4 xn-component of xn+y argument ([+-]?\d*n|)
1643                                 5 sign of xn-component
1644                                 6 x of xn-component
1645                                 7 sign of y-component
1646                                 8 y of y-component
1647                         */
1648                         match[1] = match[1].toLowerCase();
1650                         if ( match[1].slice( 0, 3 ) === "nth" ) {
1651                                 // nth-* requires argument
1652                                 if ( !match[3] ) {
1653                                         Sizzle.error( match[0] );
1654                                 }
1656                                 // numeric x and y parameters for Expr.filter.CHILD
1657                                 // remember that false/true cast respectively to 0/1
1658                                 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
1659                                 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
1661                         // other types prohibit arguments
1662                         } else if ( match[3] ) {
1663                                 Sizzle.error( match[0] );
1664                         }
1666                         return match;
1667                 },
1669                 "PSEUDO": function( match ) {
1670                         var excess,
1671                                 unquoted = !match[6] && match[2];
1673                         if ( matchExpr["CHILD"].test( match[0] ) ) {
1674                                 return null;
1675                         }
1677                         // Accept quoted arguments as-is
1678                         if ( match[3] ) {
1679                                 match[2] = match[4] || match[5] || "";
1681                         // Strip excess characters from unquoted arguments
1682                         } else if ( unquoted && rpseudo.test( unquoted ) &&
1683                                 // Get excess from tokenize (recursively)
1684                                 (excess = tokenize( unquoted, true )) &&
1685                                 // advance to the next closing parenthesis
1686                                 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
1688                                 // excess is a negative index
1689                                 match[0] = match[0].slice( 0, excess );
1690                                 match[2] = unquoted.slice( 0, excess );
1691                         }
1693                         // Return only captures needed by the pseudo filter method (type and argument)
1694                         return match.slice( 0, 3 );
1695                 }
1696         },
1698         filter: {
1700                 "TAG": function( nodeNameSelector ) {
1701                         var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1702                         return nodeNameSelector === "*" ?
1703                                 function() { return true; } :
1704                                 function( elem ) {
1705                                         return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1706                                 };
1707                 },
1709                 "CLASS": function( className ) {
1710                         var pattern = classCache[ className + " " ];
1712                         return pattern ||
1713                                 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
1714                                 classCache( className, function( elem ) {
1715                                         return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
1716                                 });
1717                 },
1719                 "ATTR": function( name, operator, check ) {
1720                         return function( elem ) {
1721                                 var result = Sizzle.attr( elem, name );
1723                                 if ( result == null ) {
1724                                         return operator === "!=";
1725                                 }
1726                                 if ( !operator ) {
1727                                         return true;
1728                                 }
1730                                 result += "";
1732                                 return operator === "=" ? result === check :
1733                                         operator === "!=" ? result !== check :
1734                                         operator === "^=" ? check && result.indexOf( check ) === 0 :
1735                                         operator === "*=" ? check && result.indexOf( check ) > -1 :
1736                                         operator === "$=" ? check && result.slice( -check.length ) === check :
1737                                         operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
1738                                         operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
1739                                         false;
1740                         };
1741                 },
1743                 "CHILD": function( type, what, argument, first, last ) {
1744                         var simple = type.slice( 0, 3 ) !== "nth",
1745                                 forward = type.slice( -4 ) !== "last",
1746                                 ofType = what === "of-type";
1748                         return first === 1 && last === 0 ?
1750                                 // Shortcut for :nth-*(n)
1751                                 function( elem ) {
1752                                         return !!elem.parentNode;
1753                                 } :
1755                                 function( elem, context, xml ) {
1756                                         var cache, uniqueCache, outerCache, node, nodeIndex, start,
1757                                                 dir = simple !== forward ? "nextSibling" : "previousSibling",
1758                                                 parent = elem.parentNode,
1759                                                 name = ofType && elem.nodeName.toLowerCase(),
1760                                                 useCache = !xml && !ofType,
1761                                                 diff = false;
1763                                         if ( parent ) {
1765                                                 // :(first|last|only)-(child|of-type)
1766                                                 if ( simple ) {
1767                                                         while ( dir ) {
1768                                                                 node = elem;
1769                                                                 while ( (node = node[ dir ]) ) {
1770                                                                         if ( ofType ?
1771                                                                                 node.nodeName.toLowerCase() === name :
1772                                                                                 node.nodeType === 1 ) {
1774                                                                                 return false;
1775                                                                         }
1776                                                                 }
1777                                                                 // Reverse direction for :only-* (if we haven't yet done so)
1778                                                                 start = dir = type === "only" && !start && "nextSibling";
1779                                                         }
1780                                                         return true;
1781                                                 }
1783                                                 start = [ forward ? parent.firstChild : parent.lastChild ];
1785                                                 // non-xml :nth-child(...) stores cache data on `parent`
1786                                                 if ( forward && useCache ) {
1788                                                         // Seek `elem` from a previously-cached index
1790                                                         // ...in a gzip-friendly way
1791                                                         node = parent;
1792                                                         outerCache = node[ expando ] || (node[ expando ] = {});
1794                                                         // Support: IE <9 only
1795                                                         // Defend against cloned attroperties (jQuery gh-1709)
1796                                                         uniqueCache = outerCache[ node.uniqueID ] ||
1797                                                                 (outerCache[ node.uniqueID ] = {});
1799                                                         cache = uniqueCache[ type ] || [];
1800                                                         nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1801                                                         diff = nodeIndex && cache[ 2 ];
1802                                                         node = nodeIndex && parent.childNodes[ nodeIndex ];
1804                                                         while ( (node = ++nodeIndex && node && node[ dir ] ||
1806                                                                 // Fallback to seeking `elem` from the start
1807                                                                 (diff = nodeIndex = 0) || start.pop()) ) {
1809                                                                 // When found, cache indexes on `parent` and break
1810                                                                 if ( node.nodeType === 1 && ++diff && node === elem ) {
1811                                                                         uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
1812                                                                         break;
1813                                                                 }
1814                                                         }
1816                                                 } else {
1817                                                         // Use previously-cached element index if available
1818                                                         if ( useCache ) {
1819                                                                 // ...in a gzip-friendly way
1820                                                                 node = elem;
1821                                                                 outerCache = node[ expando ] || (node[ expando ] = {});
1823                                                                 // Support: IE <9 only
1824                                                                 // Defend against cloned attroperties (jQuery gh-1709)
1825                                                                 uniqueCache = outerCache[ node.uniqueID ] ||
1826                                                                         (outerCache[ node.uniqueID ] = {});
1828                                                                 cache = uniqueCache[ type ] || [];
1829                                                                 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1830                                                                 diff = nodeIndex;
1831                                                         }
1833                                                         // xml :nth-child(...)
1834                                                         // or :nth-last-child(...) or :nth(-last)?-of-type(...)
1835                                                         if ( diff === false ) {
1836                                                                 // Use the same loop as above to seek `elem` from the start
1837                                                                 while ( (node = ++nodeIndex && node && node[ dir ] ||
1838                                                                         (diff = nodeIndex = 0) || start.pop()) ) {
1840                                                                         if ( ( ofType ?
1841                                                                                 node.nodeName.toLowerCase() === name :
1842                                                                                 node.nodeType === 1 ) &&
1843                                                                                 ++diff ) {
1845                                                                                 // Cache the index of each encountered element
1846                                                                                 if ( useCache ) {
1847                                                                                         outerCache = node[ expando ] || (node[ expando ] = {});
1849                                                                                         // Support: IE <9 only
1850                                                                                         // Defend against cloned attroperties (jQuery gh-1709)
1851                                                                                         uniqueCache = outerCache[ node.uniqueID ] ||
1852                                                                                                 (outerCache[ node.uniqueID ] = {});
1854                                                                                         uniqueCache[ type ] = [ dirruns, diff ];
1855                                                                                 }
1857                                                                                 if ( node === elem ) {
1858                                                                                         break;
1859                                                                                 }
1860                                                                         }
1861                                                                 }
1862                                                         }
1863                                                 }
1865                                                 // Incorporate the offset, then check against cycle size
1866                                                 diff -= last;
1867                                                 return diff === first || ( diff % first === 0 && diff / first >= 0 );
1868                                         }
1869                                 };
1870                 },
1872                 "PSEUDO": function( pseudo, argument ) {
1873                         // pseudo-class names are case-insensitive
1874                         // http://www.w3.org/TR/selectors/#pseudo-classes
1875                         // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
1876                         // Remember that setFilters inherits from pseudos
1877                         var args,
1878                                 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
1879                                         Sizzle.error( "unsupported pseudo: " + pseudo );
1881                         // The user may use createPseudo to indicate that
1882                         // arguments are needed to create the filter function
1883                         // just as Sizzle does
1884                         if ( fn[ expando ] ) {
1885                                 return fn( argument );
1886                         }
1888                         // But maintain support for old signatures
1889                         if ( fn.length > 1 ) {
1890                                 args = [ pseudo, pseudo, "", argument ];
1891                                 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
1892                                         markFunction(function( seed, matches ) {
1893                                                 var idx,
1894                                                         matched = fn( seed, argument ),
1895                                                         i = matched.length;
1896                                                 while ( i-- ) {
1897                                                         idx = indexOf( seed, matched[i] );
1898                                                         seed[ idx ] = !( matches[ idx ] = matched[i] );
1899                                                 }
1900                                         }) :
1901                                         function( elem ) {
1902                                                 return fn( elem, 0, args );
1903                                         };
1904                         }
1906                         return fn;
1907                 }
1908         },
1910         pseudos: {
1911                 // Potentially complex pseudos
1912                 "not": markFunction(function( selector ) {
1913                         // Trim the selector passed to compile
1914                         // to avoid treating leading and trailing
1915                         // spaces as combinators
1916                         var input = [],
1917                                 results = [],
1918                                 matcher = compile( selector.replace( rtrim, "$1" ) );
1920                         return matcher[ expando ] ?
1921                                 markFunction(function( seed, matches, context, xml ) {
1922                                         var elem,
1923                                                 unmatched = matcher( seed, null, xml, [] ),
1924                                                 i = seed.length;
1926                                         // Match elements unmatched by `matcher`
1927                                         while ( i-- ) {
1928                                                 if ( (elem = unmatched[i]) ) {
1929                                                         seed[i] = !(matches[i] = elem);
1930                                                 }
1931                                         }
1932                                 }) :
1933                                 function( elem, context, xml ) {
1934                                         input[0] = elem;
1935                                         matcher( input, null, xml, results );
1936                                         // Don't keep the element (issue #299)
1937                                         input[0] = null;
1938                                         return !results.pop();
1939                                 };
1940                 }),
1942                 "has": markFunction(function( selector ) {
1943                         return function( elem ) {
1944                                 return Sizzle( selector, elem ).length > 0;
1945                         };
1946                 }),
1948                 "contains": markFunction(function( text ) {
1949                         text = text.replace( runescape, funescape );
1950                         return function( elem ) {
1951                                 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
1952                         };
1953                 }),
1955                 // "Whether an element is represented by a :lang() selector
1956                 // is based solely on the element's language value
1957                 // being equal to the identifier C,
1958                 // or beginning with the identifier C immediately followed by "-".
1959                 // The matching of C against the element's language value is performed case-insensitively.
1960                 // The identifier C does not have to be a valid language name."
1961                 // http://www.w3.org/TR/selectors/#lang-pseudo
1962                 "lang": markFunction( function( lang ) {
1963                         // lang value must be a valid identifier
1964                         if ( !ridentifier.test(lang || "") ) {
1965                                 Sizzle.error( "unsupported lang: " + lang );
1966                         }
1967                         lang = lang.replace( runescape, funescape ).toLowerCase();
1968                         return function( elem ) {
1969                                 var elemLang;
1970                                 do {
1971                                         if ( (elemLang = documentIsHTML ?
1972                                                 elem.lang :
1973                                                 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
1975                                                 elemLang = elemLang.toLowerCase();
1976                                                 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
1977                                         }
1978                                 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
1979                                 return false;
1980                         };
1981                 }),
1983                 // Miscellaneous
1984                 "target": function( elem ) {
1985                         var hash = window.location && window.location.hash;
1986                         return hash && hash.slice( 1 ) === elem.id;
1987                 },
1989                 "root": function( elem ) {
1990                         return elem === docElem;
1991                 },
1993                 "focus": function( elem ) {
1994                         return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
1995                 },
1997                 // Boolean properties
1998                 "enabled": createDisabledPseudo( false ),
1999                 "disabled": createDisabledPseudo( true ),
2001                 "checked": function( elem ) {
2002                         // In CSS3, :checked should return both checked and selected elements
2003                         // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
2004                         var nodeName = elem.nodeName.toLowerCase();
2005                         return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
2006                 },
2008                 "selected": function( elem ) {
2009                         // Accessing this property makes selected-by-default
2010                         // options in Safari work properly
2011                         if ( elem.parentNode ) {
2012                                 elem.parentNode.selectedIndex;
2013                         }
2015                         return elem.selected === true;
2016                 },
2018                 // Contents
2019                 "empty": function( elem ) {
2020                         // http://www.w3.org/TR/selectors/#empty-pseudo
2021                         // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
2022                         //   but not by others (comment: 8; processing instruction: 7; etc.)
2023                         // nodeType < 6 works because attributes (2) do not appear as children
2024                         for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
2025                                 if ( elem.nodeType < 6 ) {
2026                                         return false;
2027                                 }
2028                         }
2029                         return true;
2030                 },
2032                 "parent": function( elem ) {
2033                         return !Expr.pseudos["empty"]( elem );
2034                 },
2036                 // Element/input types
2037                 "header": function( elem ) {
2038                         return rheader.test( elem.nodeName );
2039                 },
2041                 "input": function( elem ) {
2042                         return rinputs.test( elem.nodeName );
2043                 },
2045                 "button": function( elem ) {
2046                         var name = elem.nodeName.toLowerCase();
2047                         return name === "input" && elem.type === "button" || name === "button";
2048                 },
2050                 "text": function( elem ) {
2051                         var attr;
2052                         return elem.nodeName.toLowerCase() === "input" &&
2053                                 elem.type === "text" &&
2055                                 // Support: IE<8
2056                                 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
2057                                 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
2058                 },
2060                 // Position-in-collection
2061                 "first": createPositionalPseudo(function() {
2062                         return [ 0 ];
2063                 }),
2065                 "last": createPositionalPseudo(function( matchIndexes, length ) {
2066                         return [ length - 1 ];
2067                 }),
2069                 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
2070                         return [ argument < 0 ? argument + length : argument ];
2071                 }),
2073                 "even": createPositionalPseudo(function( matchIndexes, length ) {
2074                         var i = 0;
2075                         for ( ; i < length; i += 2 ) {
2076                                 matchIndexes.push( i );
2077                         }
2078                         return matchIndexes;
2079                 }),
2081                 "odd": createPositionalPseudo(function( matchIndexes, length ) {
2082                         var i = 1;
2083                         for ( ; i < length; i += 2 ) {
2084                                 matchIndexes.push( i );
2085                         }
2086                         return matchIndexes;
2087                 }),
2089                 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2090                         var i = argument < 0 ? argument + length : argument;
2091                         for ( ; --i >= 0; ) {
2092                                 matchIndexes.push( i );
2093                         }
2094                         return matchIndexes;
2095                 }),
2097                 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2098                         var i = argument < 0 ? argument + length : argument;
2099                         for ( ; ++i < length; ) {
2100                                 matchIndexes.push( i );
2101                         }
2102                         return matchIndexes;
2103                 })
2104         }
2105 };
2107 Expr.pseudos["nth"] = Expr.pseudos["eq"];
2109 // Add button/input type pseudos
2110 for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
2111         Expr.pseudos[ i ] = createInputPseudo( i );
2113 for ( i in { submit: true, reset: true } ) {
2114         Expr.pseudos[ i ] = createButtonPseudo( i );
2117 // Easy API for creating new setFilters
2118 function setFilters() {}
2119 setFilters.prototype = Expr.filters = Expr.pseudos;
2120 Expr.setFilters = new setFilters();
2122 tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2123         var matched, match, tokens, type,
2124                 soFar, groups, preFilters,
2125                 cached = tokenCache[ selector + " " ];
2127         if ( cached ) {
2128                 return parseOnly ? 0 : cached.slice( 0 );
2129         }
2131         soFar = selector;
2132         groups = [];
2133         preFilters = Expr.preFilter;
2135         while ( soFar ) {
2137                 // Comma and first run
2138                 if ( !matched || (match = rcomma.exec( soFar )) ) {
2139                         if ( match ) {
2140                                 // Don't consume trailing commas as valid
2141                                 soFar = soFar.slice( match[0].length ) || soFar;
2142                         }
2143                         groups.push( (tokens = []) );
2144                 }
2146                 matched = false;
2148                 // Combinators
2149                 if ( (match = rcombinators.exec( soFar )) ) {
2150                         matched = match.shift();
2151                         tokens.push({
2152                                 value: matched,
2153                                 // Cast descendant combinators to space
2154                                 type: match[0].replace( rtrim, " " )
2155                         });
2156                         soFar = soFar.slice( matched.length );
2157                 }
2159                 // Filters
2160                 for ( type in Expr.filter ) {
2161                         if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
2162                                 (match = preFilters[ type ]( match ))) ) {
2163                                 matched = match.shift();
2164                                 tokens.push({
2165                                         value: matched,
2166                                         type: type,
2167                                         matches: match
2168                                 });
2169                                 soFar = soFar.slice( matched.length );
2170                         }
2171                 }
2173                 if ( !matched ) {
2174                         break;
2175                 }
2176         }
2178         // Return the length of the invalid excess
2179         // if we're just parsing
2180         // Otherwise, throw an error or return tokens
2181         return parseOnly ?
2182                 soFar.length :
2183                 soFar ?
2184                         Sizzle.error( selector ) :
2185                         // Cache the tokens
2186                         tokenCache( selector, groups ).slice( 0 );
2187 };
2189 function toSelector( tokens ) {
2190         var i = 0,
2191                 len = tokens.length,
2192                 selector = "";
2193         for ( ; i < len; i++ ) {
2194                 selector += tokens[i].value;
2195         }
2196         return selector;
2199 function addCombinator( matcher, combinator, base ) {
2200         var dir = combinator.dir,
2201                 skip = combinator.next,
2202                 key = skip || dir,
2203                 checkNonElements = base && key === "parentNode",
2204                 doneName = done++;
2206         return combinator.first ?
2207                 // Check against closest ancestor/preceding element
2208                 function( elem, context, xml ) {
2209                         while ( (elem = elem[ dir ]) ) {
2210                                 if ( elem.nodeType === 1 || checkNonElements ) {
2211                                         return matcher( elem, context, xml );
2212                                 }
2213                         }
2214                 } :
2216                 // Check against all ancestor/preceding elements
2217                 function( elem, context, xml ) {
2218                         var oldCache, uniqueCache, outerCache,
2219                                 newCache = [ dirruns, doneName ];
2221                         // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
2222                         if ( xml ) {
2223                                 while ( (elem = elem[ dir ]) ) {
2224                                         if ( elem.nodeType === 1 || checkNonElements ) {
2225                                                 if ( matcher( elem, context, xml ) ) {
2226                                                         return true;
2227                                                 }
2228                                         }
2229                                 }
2230                         } else {
2231                                 while ( (elem = elem[ dir ]) ) {
2232                                         if ( elem.nodeType === 1 || checkNonElements ) {
2233                                                 outerCache = elem[ expando ] || (elem[ expando ] = {});
2235                                                 // Support: IE <9 only
2236                                                 // Defend against cloned attroperties (jQuery gh-1709)
2237                                                 uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
2239                                                 if ( skip && skip === elem.nodeName.toLowerCase() ) {
2240                                                         elem = elem[ dir ] || elem;
2241                                                 } else if ( (oldCache = uniqueCache[ key ]) &&
2242                                                         oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2244                                                         // Assign to newCache so results back-propagate to previous elements
2245                                                         return (newCache[ 2 ] = oldCache[ 2 ]);
2246                                                 } else {
2247                                                         // Reuse newcache so results back-propagate to previous elements
2248                                                         uniqueCache[ key ] = newCache;
2250                                                         // A match means we're done; a fail means we have to keep checking
2251                                                         if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
2252                                                                 return true;
2253                                                         }
2254                                                 }
2255                                         }
2256                                 }
2257                         }
2258                 };
2261 function elementMatcher( matchers ) {
2262         return matchers.length > 1 ?
2263                 function( elem, context, xml ) {
2264                         var i = matchers.length;
2265                         while ( i-- ) {
2266                                 if ( !matchers[i]( elem, context, xml ) ) {
2267                                         return false;
2268                                 }
2269                         }
2270                         return true;
2271                 } :
2272                 matchers[0];
2275 function multipleContexts( selector, contexts, results ) {
2276         var i = 0,
2277                 len = contexts.length;
2278         for ( ; i < len; i++ ) {
2279                 Sizzle( selector, contexts[i], results );
2280         }
2281         return results;
2284 function condense( unmatched, map, filter, context, xml ) {
2285         var elem,
2286                 newUnmatched = [],
2287                 i = 0,
2288                 len = unmatched.length,
2289                 mapped = map != null;
2291         for ( ; i < len; i++ ) {
2292                 if ( (elem = unmatched[i]) ) {
2293                         if ( !filter || filter( elem, context, xml ) ) {
2294                                 newUnmatched.push( elem );
2295                                 if ( mapped ) {
2296                                         map.push( i );
2297                                 }
2298                         }
2299                 }
2300         }
2302         return newUnmatched;
2305 function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2306         if ( postFilter && !postFilter[ expando ] ) {
2307                 postFilter = setMatcher( postFilter );
2308         }
2309         if ( postFinder && !postFinder[ expando ] ) {
2310                 postFinder = setMatcher( postFinder, postSelector );
2311         }
2312         return markFunction(function( seed, results, context, xml ) {
2313                 var temp, i, elem,
2314                         preMap = [],
2315                         postMap = [],
2316                         preexisting = results.length,
2318                         // Get initial elements from seed or context
2319                         elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
2321                         // Prefilter to get matcher input, preserving a map for seed-results synchronization
2322                         matcherIn = preFilter && ( seed || !selector ) ?
2323                                 condense( elems, preMap, preFilter, context, xml ) :
2324                                 elems,
2326                         matcherOut = matcher ?
2327                                 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2328                                 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2330                                         // ...intermediate processing is necessary
2331                                         [] :
2333                                         // ...otherwise use results directly
2334                                         results :
2335                                 matcherIn;
2337                 // Find primary matches
2338                 if ( matcher ) {
2339                         matcher( matcherIn, matcherOut, context, xml );
2340                 }
2342                 // Apply postFilter
2343                 if ( postFilter ) {
2344                         temp = condense( matcherOut, postMap );
2345                         postFilter( temp, [], context, xml );
2347                         // Un-match failing elements by moving them back to matcherIn
2348                         i = temp.length;
2349                         while ( i-- ) {
2350                                 if ( (elem = temp[i]) ) {
2351                                         matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
2352                                 }
2353                         }
2354                 }
2356                 if ( seed ) {
2357                         if ( postFinder || preFilter ) {
2358                                 if ( postFinder ) {
2359                                         // Get the final matcherOut by condensing this intermediate into postFinder contexts
2360                                         temp = [];
2361                                         i = matcherOut.length;
2362                                         while ( i-- ) {
2363                                                 if ( (elem = matcherOut[i]) ) {
2364                                                         // Restore matcherIn since elem is not yet a final match
2365                                                         temp.push( (matcherIn[i] = elem) );
2366                                                 }
2367                                         }
2368                                         postFinder( null, (matcherOut = []), temp, xml );
2369                                 }
2371                                 // Move matched elements from seed to results to keep them synchronized
2372                                 i = matcherOut.length;
2373                                 while ( i-- ) {
2374                                         if ( (elem = matcherOut[i]) &&
2375                                                 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
2377                                                 seed[temp] = !(results[temp] = elem);
2378                                         }
2379                                 }
2380                         }
2382                 // Add elements to results, through postFinder if defined
2383                 } else {
2384                         matcherOut = condense(
2385                                 matcherOut === results ?
2386                                         matcherOut.splice( preexisting, matcherOut.length ) :
2387                                         matcherOut
2388                         );
2389                         if ( postFinder ) {
2390                                 postFinder( null, results, matcherOut, xml );
2391                         } else {
2392                                 push.apply( results, matcherOut );
2393                         }
2394                 }
2395         });
2398 function matcherFromTokens( tokens ) {
2399         var checkContext, matcher, j,
2400                 len = tokens.length,
2401                 leadingRelative = Expr.relative[ tokens[0].type ],
2402                 implicitRelative = leadingRelative || Expr.relative[" "],
2403                 i = leadingRelative ? 1 : 0,
2405                 // The foundational matcher ensures that elements are reachable from top-level context(s)
2406                 matchContext = addCombinator( function( elem ) {
2407                         return elem === checkContext;
2408                 }, implicitRelative, true ),
2409                 matchAnyContext = addCombinator( function( elem ) {
2410                         return indexOf( checkContext, elem ) > -1;
2411                 }, implicitRelative, true ),
2412                 matchers = [ function( elem, context, xml ) {
2413                         var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2414                                 (checkContext = context).nodeType ?
2415                                         matchContext( elem, context, xml ) :
2416                                         matchAnyContext( elem, context, xml ) );
2417                         // Avoid hanging onto element (issue #299)
2418                         checkContext = null;
2419                         return ret;
2420                 } ];
2422         for ( ; i < len; i++ ) {
2423                 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
2424                         matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
2425                 } else {
2426                         matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
2428                         // Return special upon seeing a positional matcher
2429                         if ( matcher[ expando ] ) {
2430                                 // Find the next relative operator (if any) for proper handling
2431                                 j = ++i;
2432                                 for ( ; j < len; j++ ) {
2433                                         if ( Expr.relative[ tokens[j].type ] ) {
2434                                                 break;
2435                                         }
2436                                 }
2437                                 return setMatcher(
2438                                         i > 1 && elementMatcher( matchers ),
2439                                         i > 1 && toSelector(
2440                                                 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2441                                                 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
2442                                         ).replace( rtrim, "$1" ),
2443                                         matcher,
2444                                         i < j && matcherFromTokens( tokens.slice( i, j ) ),
2445                                         j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
2446                                         j < len && toSelector( tokens )
2447                                 );
2448                         }
2449                         matchers.push( matcher );
2450                 }
2451         }
2453         return elementMatcher( matchers );
2456 function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2457         var bySet = setMatchers.length > 0,
2458                 byElement = elementMatchers.length > 0,
2459                 superMatcher = function( seed, context, xml, results, outermost ) {
2460                         var elem, j, matcher,
2461                                 matchedCount = 0,
2462                                 i = "0",
2463                                 unmatched = seed && [],
2464                                 setMatched = [],
2465                                 contextBackup = outermostContext,
2466                                 // We must always have either seed elements or outermost context
2467                                 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
2468                                 // Use integer dirruns iff this is the outermost matcher
2469                                 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
2470                                 len = elems.length;
2472                         if ( outermost ) {
2473                                 outermostContext = context === document || context || outermost;
2474                         }
2476                         // Add elements passing elementMatchers directly to results
2477                         // Support: IE<9, Safari
2478                         // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
2479                         for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
2480                                 if ( byElement && elem ) {
2481                                         j = 0;
2482                                         if ( !context && elem.ownerDocument !== document ) {
2483                                                 setDocument( elem );
2484                                                 xml = !documentIsHTML;
2485                                         }
2486                                         while ( (matcher = elementMatchers[j++]) ) {
2487                                                 if ( matcher( elem, context || document, xml) ) {
2488                                                         results.push( elem );
2489                                                         break;
2490                                                 }
2491                                         }
2492                                         if ( outermost ) {
2493                                                 dirruns = dirrunsUnique;
2494                                         }
2495                                 }
2497                                 // Track unmatched elements for set filters
2498                                 if ( bySet ) {
2499                                         // They will have gone through all possible matchers
2500                                         if ( (elem = !matcher && elem) ) {
2501                                                 matchedCount--;
2502                                         }
2504                                         // Lengthen the array for every element, matched or not
2505                                         if ( seed ) {
2506                                                 unmatched.push( elem );
2507                                         }
2508                                 }
2509                         }
2511                         // `i` is now the count of elements visited above, and adding it to `matchedCount`
2512                         // makes the latter nonnegative.
2513                         matchedCount += i;
2515                         // Apply set filters to unmatched elements
2516                         // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
2517                         // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
2518                         // no element matchers and no seed.
2519                         // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
2520                         // case, which will result in a "00" `matchedCount` that differs from `i` but is also
2521                         // numerically zero.
2522                         if ( bySet && i !== matchedCount ) {
2523                                 j = 0;
2524                                 while ( (matcher = setMatchers[j++]) ) {
2525                                         matcher( unmatched, setMatched, context, xml );
2526                                 }
2528                                 if ( seed ) {
2529                                         // Reintegrate element matches to eliminate the need for sorting
2530                                         if ( matchedCount > 0 ) {
2531                                                 while ( i-- ) {
2532                                                         if ( !(unmatched[i] || setMatched[i]) ) {
2533                                                                 setMatched[i] = pop.call( results );
2534                                                         }
2535                                                 }
2536                                         }
2538                                         // Discard index placeholder values to get only actual matches
2539                                         setMatched = condense( setMatched );
2540                                 }
2542                                 // Add matches to results
2543                                 push.apply( results, setMatched );
2545                                 // Seedless set matches succeeding multiple successful matchers stipulate sorting
2546                                 if ( outermost && !seed && setMatched.length > 0 &&
2547                                         ( matchedCount + setMatchers.length ) > 1 ) {
2549                                         Sizzle.uniqueSort( results );
2550                                 }
2551                         }
2553                         // Override manipulation of globals by nested matchers
2554                         if ( outermost ) {
2555                                 dirruns = dirrunsUnique;
2556                                 outermostContext = contextBackup;
2557                         }
2559                         return unmatched;
2560                 };
2562         return bySet ?
2563                 markFunction( superMatcher ) :
2564                 superMatcher;
2567 compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2568         var i,
2569                 setMatchers = [],
2570                 elementMatchers = [],
2571                 cached = compilerCache[ selector + " " ];
2573         if ( !cached ) {
2574                 // Generate a function of recursive functions that can be used to check each element
2575                 if ( !match ) {
2576                         match = tokenize( selector );
2577                 }
2578                 i = match.length;
2579                 while ( i-- ) {
2580                         cached = matcherFromTokens( match[i] );
2581                         if ( cached[ expando ] ) {
2582                                 setMatchers.push( cached );
2583                         } else {
2584                                 elementMatchers.push( cached );
2585                         }
2586                 }
2588                 // Cache the compiled function
2589                 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2591                 // Save selector and tokenization
2592                 cached.selector = selector;
2593         }
2594         return cached;
2595 };
2597 /**
2598  * A low-level selection function that works with Sizzle's compiled
2599  *  selector functions
2600  * @param {String|Function} selector A selector or a pre-compiled
2601  *  selector function built with Sizzle.compile
2602  * @param {Element} context
2603  * @param {Array} [results]
2604  * @param {Array} [seed] A set of elements to match against
2605  */
2606 select = Sizzle.select = function( selector, context, results, seed ) {
2607         var i, tokens, token, type, find,
2608                 compiled = typeof selector === "function" && selector,
2609                 match = !seed && tokenize( (selector = compiled.selector || selector) );
2611         results = results || [];
2613         // Try to minimize operations if there is only one selector in the list and no seed
2614         // (the latter of which guarantees us context)
2615         if ( match.length === 1 ) {
2617                 // Reduce context if the leading compound selector is an ID
2618                 tokens = match[0] = match[0].slice( 0 );
2619                 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
2620                                 support.getById && context.nodeType === 9 && documentIsHTML &&
2621                                 Expr.relative[ tokens[1].type ] ) {
2623                         context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
2624                         if ( !context ) {
2625                                 return results;
2627                         // Precompiled matchers will still verify ancestry, so step up a level
2628                         } else if ( compiled ) {
2629                                 context = context.parentNode;
2630                         }
2632                         selector = selector.slice( tokens.shift().value.length );
2633                 }
2635                 // Fetch a seed set for right-to-left matching
2636                 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
2637                 while ( i-- ) {
2638                         token = tokens[i];
2640                         // Abort if we hit a combinator
2641                         if ( Expr.relative[ (type = token.type) ] ) {
2642                                 break;
2643                         }
2644                         if ( (find = Expr.find[ type ]) ) {
2645                                 // Search, expanding context for leading sibling combinators
2646                                 if ( (seed = find(
2647                                         token.matches[0].replace( runescape, funescape ),
2648                                         rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
2649                                 )) ) {
2651                                         // If seed is empty or no tokens remain, we can return early
2652                                         tokens.splice( i, 1 );
2653                                         selector = seed.length && toSelector( tokens );
2654                                         if ( !selector ) {
2655                                                 push.apply( results, seed );
2656                                                 return results;
2657                                         }
2659                                         break;
2660                                 }
2661                         }
2662                 }
2663         }
2665         // Compile and execute a filtering function if one is not provided
2666         // Provide `match` to avoid retokenization if we modified the selector above
2667         ( compiled || compile( selector, match ) )(
2668                 seed,
2669                 context,
2670                 !documentIsHTML,
2671                 results,
2672                 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
2673         );
2674         return results;
2675 };
2677 // One-time assignments
2679 // Sort stability
2680 support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
2682 // Support: Chrome 14-35+
2683 // Always assume duplicates if they aren't passed to the comparison function
2684 support.detectDuplicates = !!hasDuplicate;
2686 // Initialize against the default document
2687 setDocument();
2689 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
2690 // Detached nodes confoundingly follow *each other*
2691 support.sortDetached = assert(function( el ) {
2692         // Should return 1, but returns 4 (following)
2693         return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
2694 });
2696 // Support: IE<8
2697 // Prevent attribute/property "interpolation"
2698 // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2699 if ( !assert(function( el ) {
2700         el.innerHTML = "<a href='#'></a>";
2701         return el.firstChild.getAttribute("href") === "#" ;
2702 }) ) {
2703         addHandle( "type|href|height|width", function( elem, name, isXML ) {
2704                 if ( !isXML ) {
2705                         return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
2706                 }
2707         });
2710 // Support: IE<9
2711 // Use defaultValue in place of getAttribute("value")
2712 if ( !support.attributes || !assert(function( el ) {
2713         el.innerHTML = "<input/>";
2714         el.firstChild.setAttribute( "value", "" );
2715         return el.firstChild.getAttribute( "value" ) === "";
2716 }) ) {
2717         addHandle( "value", function( elem, name, isXML ) {
2718                 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
2719                         return elem.defaultValue;
2720                 }
2721         });
2724 // Support: IE<9
2725 // Use getAttributeNode to fetch booleans when getAttribute lies
2726 if ( !assert(function( el ) {
2727         return el.getAttribute("disabled") == null;
2728 }) ) {
2729         addHandle( booleans, function( elem, name, isXML ) {
2730                 var val;
2731                 if ( !isXML ) {
2732                         return elem[ name ] === true ? name.toLowerCase() :
2733                                         (val = elem.getAttributeNode( name )) && val.specified ?
2734                                         val.value :
2735                                 null;
2736                 }
2737         });
2740 return Sizzle;
2742 })( window );
2746 jQuery.find = Sizzle;
2747 jQuery.expr = Sizzle.selectors;
2749 // Deprecated
2750 jQuery.expr[ ":" ] = jQuery.expr.pseudos;
2751 jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
2752 jQuery.text = Sizzle.getText;
2753 jQuery.isXMLDoc = Sizzle.isXML;
2754 jQuery.contains = Sizzle.contains;
2755 jQuery.escapeSelector = Sizzle.escape;
2760 var dir = function( elem, dir, until ) {
2761         var matched = [],
2762                 truncate = until !== undefined;
2764         while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
2765                 if ( elem.nodeType === 1 ) {
2766                         if ( truncate && jQuery( elem ).is( until ) ) {
2767                                 break;
2768                         }
2769                         matched.push( elem );
2770                 }
2771         }
2772         return matched;
2773 };
2776 var siblings = function( n, elem ) {
2777         var matched = [];
2779         for ( ; n; n = n.nextSibling ) {
2780                 if ( n.nodeType === 1 && n !== elem ) {
2781                         matched.push( n );
2782                 }
2783         }
2785         return matched;
2786 };
2789 var rneedsContext = jQuery.expr.match.needsContext;
2791 var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
2795 var risSimple = /^.[^:#\[\.,]*$/;
2797 // Implement the identical functionality for filter and not
2798 function winnow( elements, qualifier, not ) {
2799         if ( jQuery.isFunction( qualifier ) ) {
2800                 return jQuery.grep( elements, function( elem, i ) {
2801                         return !!qualifier.call( elem, i, elem ) !== not;
2802                 } );
2804         }
2806         if ( qualifier.nodeType ) {
2807                 return jQuery.grep( elements, function( elem ) {
2808                         return ( elem === qualifier ) !== not;
2809                 } );
2811         }
2813         if ( typeof qualifier === "string" ) {
2814                 if ( risSimple.test( qualifier ) ) {
2815                         return jQuery.filter( qualifier, elements, not );
2816                 }
2818                 qualifier = jQuery.filter( qualifier, elements );
2819         }
2821         return jQuery.grep( elements, function( elem ) {
2822                 return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1;
2823         } );
2826 jQuery.filter = function( expr, elems, not ) {
2827         var elem = elems[ 0 ];
2829         if ( not ) {
2830                 expr = ":not(" + expr + ")";
2831         }
2833         return elems.length === 1 && elem.nodeType === 1 ?
2834                 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
2835                 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
2836                         return elem.nodeType === 1;
2837                 } ) );
2838 };
2840 jQuery.fn.extend( {
2841         find: function( selector ) {
2842                 var i, ret,
2843                         len = this.length,
2844                         self = this;
2846                 if ( typeof selector !== "string" ) {
2847                         return this.pushStack( jQuery( selector ).filter( function() {
2848                                 for ( i = 0; i < len; i++ ) {
2849                                         if ( jQuery.contains( self[ i ], this ) ) {
2850                                                 return true;
2851                                         }
2852                                 }
2853                         } ) );
2854                 }
2856                 ret = this.pushStack( [] );
2858                 for ( i = 0; i < len; i++ ) {
2859                         jQuery.find( selector, self[ i ], ret );
2860                 }
2862                 return len > 1 ? jQuery.uniqueSort( ret ) : ret;
2863         },
2864         filter: function( selector ) {
2865                 return this.pushStack( winnow( this, selector || [], false ) );
2866         },
2867         not: function( selector ) {
2868                 return this.pushStack( winnow( this, selector || [], true ) );
2869         },
2870         is: function( selector ) {
2871                 return !!winnow(
2872                         this,
2874                         // If this is a positional/relative selector, check membership in the returned set
2875                         // so $("p:first").is("p:last") won't return true for a doc with two "p".
2876                         typeof selector === "string" && rneedsContext.test( selector ) ?
2877                                 jQuery( selector ) :
2878                                 selector || [],
2879                         false
2880                 ).length;
2881         }
2882 } );
2885 // Initialize a jQuery object
2888 // A central reference to the root jQuery(document)
2889 var rootjQuery,
2891         // A simple way to check for HTML strings
2892         // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
2893         // Strict HTML recognition (#11290: must start with <)
2894         // Shortcut simple #id case for speed
2895         rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,