1 /*eslint-disable no-unused-vars*/
3 * jQuery JavaScript Library v3.1.0
7 * https://sizzlejs.com/
9 * Copyright jQuery Foundation and other contributors
10 * Released under the MIT license
11 * https://jquery.org/license
13 * Date: 2016-07-07T21:44Z
15 ( function( global, factory ) {
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 ) :
32 throw new Error( "jQuery requires a window with a document" );
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.
51 var document = window.document;
53 var getProto = Object.getPrototypeOf;
55 var slice = arr.slice;
57 var concat = arr.concat;
61 var indexOf = arr.indexOf;
65 var toString = class2type.toString;
67 var hasOwn = class2type.hasOwnProperty;
69 var fnToString = hasOwn.toString;
71 var ObjectFunctionString = fnToString.call( Object );
77 function DOMEval( code, doc ) {
78 doc = doc || document;
80 var script = doc.createElement( "script" );
83 doc.head.appendChild( script ).parentNode.removeChild( script );
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
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 );
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
108 rdashAlpha = /-([a-z])/g,
110 // Used by jQuery.camelCase as callback to replace()
111 fcamelCase = function( all, letter ) {
112 return letter.toUpperCase();
115 jQuery.fn = jQuery.prototype = {
117 // The current version of jQuery being used
122 // The default length of a jQuery object is 0
125 toArray: function() {
126 return slice.call( this );
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 ) {
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
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
155 // Execute a callback for every element in the matched set.
156 each: function( callback ) {
157 return jQuery.each( this, callback );
160 map: function( callback ) {
161 return this.pushStack( jQuery.map( this, function( elem, i ) {
162 return callback.call( elem, i, elem );
167 return this.pushStack( slice.apply( this, arguments ) );
175 return this.eq( -1 );
179 var len = this.length,
180 j = +i + ( i < 0 ? len : 0 );
181 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
185 return this.prevObject || this.constructor();
188 // For internal use only.
189 // Behaves like an Array's method, not like a jQuery method.
195 jQuery.extend = jQuery.fn.extend = function() {
196 var options, name, src, copy, copyIsArray, clone,
197 target = arguments[ 0 ] || {},
199 length = arguments.length,
202 // Handle a deep copy situation
203 if ( typeof target === "boolean" ) {
206 // Skip the boolean and the target
207 target = arguments[ i ] || {};
211 // Handle case when target is a string or something (possible in deep copy)
212 if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
216 // Extend jQuery itself if only one argument is passed
217 if ( i === length ) {
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 ) {
237 // Recurse if we're merging plain objects or arrays
238 if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
239 ( copyIsArray = jQuery.isArray( copy ) ) ) ) {
243 clone = src && jQuery.isArray( src ) ? src : [];
246 clone = src && jQuery.isPlainObject( src ) ? src : {};
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;
260 // Return the modified object
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
272 error: function( msg ) {
273 throw new Error( msg );
278 isFunction: function( obj ) {
279 return jQuery.type( obj ) === "function";
282 isArray: Array.isArray,
284 isWindow: function( obj ) {
285 return obj != null && obj === obj.window;
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 ) );
302 isPlainObject: function( obj ) {
305 // Detect obvious negatives
306 // Use toString instead of jQuery.type to catch host objects
307 if ( !obj || toString.call( obj ) !== "[object Object]" ) {
311 proto = getProto( obj );
313 // Objects with no prototype (e.g., `Object.create( null )`) are plain
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;
323 isEmptyObject: function( obj ) {
325 /* eslint-disable no-unused-vars */
326 // See https://github.com/eslint/eslint/issues/6125
329 for ( name in obj ) {
335 type: function( obj ) {
340 // Support: Android <=2.3 only (functionish RegExp)
341 return typeof obj === "object" || typeof obj === "function" ?
342 class2type[ toString.call( obj ) ] || "object" :
346 // Evaluates a script in a global context
347 globalEval: function( code ) {
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 );
358 nodeName: function( elem, name ) {
359 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
362 each: function( obj, callback ) {
365 if ( isArrayLike( obj ) ) {
367 for ( ; i < length; i++ ) {
368 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
374 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
383 // Support: Android <=4.0 only
384 trim: function( text ) {
385 return text == null ?
387 ( text + "" ).replace( rtrim, "" );
390 // results is for internal usage only
391 makeArray: function( arr, results ) {
392 var ret = results || [];
395 if ( isArrayLike( Object( arr ) ) ) {
397 typeof arr === "string" ?
401 push.call( ret, arr );
408 inArray: function( elem, arr, i ) {
409 return arr == null ? -1 : indexOf.call( arr, elem, i );
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,
419 for ( ; j < len; j++ ) {
420 first[ i++ ] = second[ j ];
428 grep: function( elems, callback, invert ) {
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 ] );
447 // arg is for internal usage only
448 map: function( elems, callback, arg ) {
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 ) {
464 // Go through every key on the object,
467 value = callback( elems[ i ], i, arg );
469 if ( value != null ) {
475 // Flatten any nested arrays
476 return concat.apply( [], ret );
479 // A global GUID counter for objects
482 // Bind a function to a context, optionally partially applying any
484 proxy: function( fn, context ) {
485 var tmp, args, proxy;
487 if ( typeof context === "string" ) {
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 ) ) {
500 args = slice.call( arguments, 2 );
502 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
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++;
513 // jQuery.support is not used in Core but other projects attach their
514 // properties to it so it needs to exist.
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();
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 ) ) {
541 return type === "array" || length === 0 ||
542 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
546 * Sizzle CSS Selector Engine v2.3.0
547 * https://sizzlejs.com/
549 * Copyright jQuery Foundation and other contributors
550 * Released under the MIT license
551 * http://jquery.org/license
555 (function( window ) {
569 // Local document vars
579 // Instance-specific data
580 expando = "sizzle" + 1 * new Date(),
581 preferredDoc = window.document,
584 classCache = createCache(),
585 tokenCache = createCache(),
586 compilerCache = createCache(),
587 sortOrder = function( a, b ) {
595 hasOwn = ({}).hasOwnProperty,
598 push_native = arr.push,
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 ) {
606 for ( ; i < len; i++ ) {
607 if ( list[i] === elem ) {
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 +
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)
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 + "$" ),
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" )
670 rinputs = /^(?:input|select|textarea|button)$/i,
673 rnative = /^[^{]+\{\s*\[native \w/,
675 // Easily-parseable/retrievable ID or TAG or CLASS selectors
676 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
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 ?
692 String.fromCharCode( high + 0x10000 ) :
693 // Supplemental Plane codepoint (surrogate pair)
694 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
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 ) {
703 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
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 ) + " ";
712 // Other potentially-special ASCII characters get backslash-escaped
718 // Removing the function wrapper causes a "Permission Denied"
720 unloadHandler = function() {
724 disabledAncestor = addCombinator(
726 return elem.disabled === true;
728 { dir: "parentNode", next: "legend" }
731 // Optimize for push.apply( _, NodeList )
734 (arr = slice.call( preferredDoc.childNodes )),
735 preferredDoc.childNodes
737 // Support: Android<4.0
738 // Detect silently failing push.apply
739 arr[ preferredDoc.childNodes.length ].nodeType;
741 push = { apply: arr.length ?
743 // Leverage slice if possible
744 function( target, els ) {
745 push_native.apply( target, slice.call(els) );
749 // Otherwise append directly
750 function( target, els ) {
751 var j = target.length,
753 // Can't trust NodeList.length
754 while ( (target[j++] = els[i++]) ) {}
755 target.length = j - 1;
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 ) {
776 // Try to shortcut find operations (as opposed to filters) in HTML documents
779 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
780 setDocument( context );
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 )) ) {
791 if ( (m = match[1]) ) {
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 );
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 ) &&
818 results.push( elem );
824 } else if ( match[2] ) {
825 push.apply( results, context.getElementsByTagName( selector ) );
829 } else if ( (m = match[3]) && support.getElementsByClassName &&
830 context.getElementsByClassName ) {
832 push.apply( results, context.getElementsByClassName( m ) );
837 // Take advantage of querySelectorAll
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
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 );
856 context.setAttribute( "id", (nid = expando) );
859 // Prefix every selector in the list
860 groups = tokenize( selector );
863 groups[i] = "#" + nid + " " + toSelector( groups[i] );
865 newSelector = groups.join( "," );
867 // Expand context for sibling selectors
868 newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
875 newContext.querySelectorAll( newSelector )
878 } catch ( qsaError ) {
880 if ( nid === expando ) {
881 context.removeAttribute( "id" );
890 return select( selector.replace( rtrim, "$1" ), context, results, seed );
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
899 function createCache() {
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() ];
908 return (cache[ key + " " ] = value);
914 * Mark a function for special use by Sizzle
915 * @param {Function} fn The function to mark
917 function markFunction( fn ) {
918 fn[ expando ] = true;
923 * Support testing using an element
924 * @param {Function} fn Passed the created element and returns a boolean result
926 function assert( fn ) {
927 var el = document.createElement("fieldset");
934 // Remove from its parent by default
935 if ( el.parentNode ) {
936 el.parentNode.removeChild( el );
938 // release memory in IE
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
948 function addHandle( attrs, handler ) {
949 var arr = attrs.split("|"),
953 Expr.attrHandle[ arr[i] ] = handler;
958 * Checks document order of two siblings
961 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
963 function siblingCheck( a, b ) {
965 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
966 a.sourceIndex - b.sourceIndex;
968 // Use IE sourceIndex if available on both nodes
973 // Check if b follows a
975 while ( (cur = cur.nextSibling) ) {
986 * Returns a function to use in pseudos for input types
987 * @param {String} type
989 function createInputPseudo( type ) {
990 return function( elem ) {
991 var name = elem.nodeName.toLowerCase();
992 return name === "input" && elem.type === type;
997 * Returns a function to use in pseudos for buttons
998 * @param {String} type
1000 function createButtonPseudo( type ) {
1001 return function( elem ) {
1002 var name = elem.nodeName.toLowerCase();
1003 return (name === "input" || name === "button") && elem.type === type;
1008 * Returns a function to use in pseudos for :enabled/:disabled
1009 * @param {Boolean} disabled true for :disabled; false for :enabled
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 && (
1024 // Ancestry is covered for us
1025 elem.isDisabled === disabled ||
1027 // Otherwise, assume any non-<option> under fieldset[disabled] is disabled
1029 elem.isDisabled !== !disabled &&
1030 ("label" in elem || !disabledAncestor( elem )) !== disabled
1036 * Returns a function to use in pseudos for positionals
1037 * @param {Function} fn
1039 function createPositionalPseudo( fn ) {
1040 return markFunction(function( argument ) {
1041 argument = +argument;
1042 return markFunction(function( seed, matches ) {
1044 matchIndexes = fn( [], seed.length, argument ),
1045 i = matchIndexes.length;
1047 // Match elements found at the specified indexes
1049 if ( seed[ (j = matchIndexes[i]) ] ) {
1050 seed[j] = !(matches[j] = seed[j]);
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
1062 function testContext( context ) {
1063 return context && typeof context.getElementsByTagName !== "undefined" && context;
1066 // Expose support vars for convenience
1067 support = Sizzle.support = {};
1071 * @param {Element|Object} elem An element or a document
1072 * @returns {Boolean} True iff elem is a non-HTML XML node
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;
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
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 ) {
1095 // Update global variables
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 );
1116 ---------------------------------------------------------------------- */
1119 // Verify that getAttribute really returns attributes and not properties
1120 // (excepting IE8 booleans)
1121 support.attributes = assert(function( el ) {
1123 return !el.getAttribute("className");
1127 ---------------------------------------------------------------------- */
1129 // Check if getElementsByTagName("*") returns only elements
1130 support.getElementsByTagName = assert(function( el ) {
1131 el.appendChild( document.createComment("") );
1132 return !el.getElementsByTagName("*").length;
1136 support.getElementsByClassName = rnative.test( document.getElementsByClassName );
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;
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 ] : [];
1155 Expr.filter["ID"] = function( id ) {
1156 var attrId = id.replace( runescape, funescape );
1157 return function( elem ) {
1158 return elem.getAttribute("id") === attrId;
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;
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 );
1188 function( tag, context ) {
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 ) {
1209 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
1210 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
1211 return context.getElementsByClassName( className );
1215 /* QSA/matchesSelector
1216 ---------------------------------------------------------------------- */
1218 // QSA and matchesSelector support
1220 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
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
1230 if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
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 + "*(?:''|\"\")" );
1252 // Boolean attributes and "value" are not treated correctly
1253 if ( !el.querySelectorAll("[selected]").length ) {
1254 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
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("~=");
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");
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(".#.+[+~]");
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" );
1288 // Enforce case-sensitivity of name attribute
1289 if ( el.querySelectorAll("[name=d]").length ) {
1290 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
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" );
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" );
1306 // Opera 10-11 does not throw on post-comma invalid pseudos
1307 el.querySelectorAll("*,:x");
1308 rbuggyQSA.push(",.*:");
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 );
1330 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
1331 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
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 ) ?
1342 var adown = a.nodeType === 9 ? a.documentElement : a,
1343 bup = b && b.parentNode;
1344 return a === bup || !!( bup && bup.nodeType === 1 && (
1346 adown.contains( bup ) :
1347 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1352 while ( (b = b.parentNode) ) {
1362 ---------------------------------------------------------------------- */
1364 // Document order sorting
1365 sortOrder = hasCompare ?
1368 // Flag for duplicate removal
1370 hasDuplicate = true;
1374 // Sort on method existence if only one input has compareDocumentPosition
1375 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
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
1387 // Disconnected nodes
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) ) {
1395 if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
1399 // Maintain original order
1401 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1405 return compare & 4 ? -1 : 1;
1408 // Exit early if the nodes are identical
1410 hasDuplicate = true;
1421 // Parentless nodes are either documents or disconnected
1422 if ( !aup || !bup ) {
1423 return a === document ? -1 :
1424 b === document ? 1 :
1428 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1431 // If the nodes are siblings, we can do a quick check
1432 } else if ( aup === bup ) {
1433 return siblingCheck( a, b );
1436 // Otherwise we need full lists of their ancestors for comparison
1438 while ( (cur = cur.parentNode) ) {
1442 while ( (cur = cur.parentNode) ) {
1446 // Walk down the tree looking for a discrepancy
1447 while ( ap[i] === bp[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 :
1464 Sizzle.matches = function( expr, elements ) {
1465 return Sizzle( expr, null, null, elements );
1468 Sizzle.matchesSelector = function( elem, expr ) {
1469 // Set document vars if needed
1470 if ( ( elem.ownerDocument || elem ) !== document ) {
1471 setDocument( elem );
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 ) ) ) {
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
1489 elem.document && elem.document.nodeType !== 11 ) {
1495 return Sizzle( expr, document, null, [ elem ] ).length > 0;
1498 Sizzle.contains = function( context, elem ) {
1499 // Set document vars if needed
1500 if ( ( context.ownerDocument || context ) !== document ) {
1501 setDocument( context );
1503 return contains( context, elem );
1506 Sizzle.attr = function( elem, name ) {
1507 // Set document vars if needed
1508 if ( ( elem.ownerDocument || elem ) !== document ) {
1509 setDocument( elem );
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 ) :
1518 return val !== undefined ?
1520 support.attributes || !documentIsHTML ?
1521 elem.getAttribute( name ) :
1522 (val = elem.getAttributeNode(name)) && val.specified ?
1527 Sizzle.escape = function( sel ) {
1528 return (sel + "").replace( rcssescape, fcssescape );
1531 Sizzle.error = function( msg ) {
1532 throw new Error( "Syntax error, unrecognized expression: " + msg );
1536 * Document sorting and removing duplicates
1537 * @param {ArrayLike} results
1539 Sizzle.uniqueSort = function( results ) {
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 );
1557 results.splice( duplicates[ j ], 1 );
1561 // Clear input after sorting to release objects
1562 // See https://github.com/jquery/sizzle/pull/225
1569 * Utility function for retrieving the text value of an array of DOM nodes
1570 * @param {Array|Element} elem
1572 getText = Sizzle.getText = function( elem ) {
1576 nodeType = elem.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 );
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;
1590 // Traverse its children
1591 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1592 ret += getText( elem );
1595 } else if ( nodeType === 3 || nodeType === 4 ) {
1596 return elem.nodeValue;
1598 // Do not include comment or processing instruction nodes
1603 Expr = Sizzle.selectors = {
1605 // Can be adjusted by the user
1608 createPseudo: markFunction,
1617 ">": { dir: "parentNode", first: true },
1618 " ": { dir: "parentNode" },
1619 "+": { dir: "previousSibling", first: true },
1620 "~": { dir: "previousSibling" }
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] + " ";
1634 return match.slice( 0, 4 );
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
1645 7 sign of y-component
1648 match[1] = match[1].toLowerCase();
1650 if ( match[1].slice( 0, 3 ) === "nth" ) {
1651 // nth-* requires argument
1653 Sizzle.error( match[0] );
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] );
1669 "PSEUDO": function( match ) {
1671 unquoted = !match[6] && match[2];
1673 if ( matchExpr["CHILD"].test( match[0] ) ) {
1677 // Accept quoted arguments as-is
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 );
1693 // Return only captures needed by the pseudo filter method (type and argument)
1694 return match.slice( 0, 3 );
1700 "TAG": function( nodeNameSelector ) {
1701 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1702 return nodeNameSelector === "*" ?
1703 function() { return true; } :
1705 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1709 "CLASS": function( className ) {
1710 var pattern = classCache[ className + " " ];
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") || "" );
1719 "ATTR": function( name, operator, check ) {
1720 return function( elem ) {
1721 var result = Sizzle.attr( elem, name );
1723 if ( result == null ) {
1724 return operator === "!=";
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 + "-" :
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)
1752 return !!elem.parentNode;
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,
1765 // :(first|last|only)-(child|of-type)
1769 while ( (node = node[ dir ]) ) {
1771 node.nodeName.toLowerCase() === name :
1772 node.nodeType === 1 ) {
1777 // Reverse direction for :only-* (if we haven't yet done so)
1778 start = dir = type === "only" && !start && "nextSibling";
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
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 ];
1817 // Use previously-cached element index if available
1819 // ...in a gzip-friendly way
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 ];
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()) ) {
1841 node.nodeName.toLowerCase() === name :
1842 node.nodeType === 1 ) &&
1845 // Cache the index of each encountered element
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 ];
1857 if ( node === elem ) {
1865 // Incorporate the offset, then check against cycle size
1867 return diff === first || ( diff % first === 0 && diff / first >= 0 );
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
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 );
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 ) {
1894 matched = fn( seed, argument ),
1897 idx = indexOf( seed, matched[i] );
1898 seed[ idx ] = !( matches[ idx ] = matched[i] );
1902 return fn( elem, 0, args );
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
1918 matcher = compile( selector.replace( rtrim, "$1" ) );
1920 return matcher[ expando ] ?
1921 markFunction(function( seed, matches, context, xml ) {
1923 unmatched = matcher( seed, null, xml, [] ),
1926 // Match elements unmatched by `matcher`
1928 if ( (elem = unmatched[i]) ) {
1929 seed[i] = !(matches[i] = elem);
1933 function( elem, context, xml ) {
1935 matcher( input, null, xml, results );
1936 // Don't keep the element (issue #299)
1938 return !results.pop();
1942 "has": markFunction(function( selector ) {
1943 return function( elem ) {
1944 return Sizzle( selector, elem ).length > 0;
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;
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 );
1967 lang = lang.replace( runescape, funescape ).toLowerCase();
1968 return function( elem ) {
1971 if ( (elemLang = documentIsHTML ?
1973 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
1975 elemLang = elemLang.toLowerCase();
1976 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
1978 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
1984 "target": function( elem ) {
1985 var hash = window.location && window.location.hash;
1986 return hash && hash.slice( 1 ) === elem.id;
1989 "root": function( elem ) {
1990 return elem === docElem;
1993 "focus": function( elem ) {
1994 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
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);
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;
2015 return elem.selected === true;
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 ) {
2032 "parent": function( elem ) {
2033 return !Expr.pseudos["empty"]( elem );
2036 // Element/input types
2037 "header": function( elem ) {
2038 return rheader.test( elem.nodeName );
2041 "input": function( elem ) {
2042 return rinputs.test( elem.nodeName );
2045 "button": function( elem ) {
2046 var name = elem.nodeName.toLowerCase();
2047 return name === "input" && elem.type === "button" || name === "button";
2050 "text": function( elem ) {
2052 return elem.nodeName.toLowerCase() === "input" &&
2053 elem.type === "text" &&
2056 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
2057 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
2060 // Position-in-collection
2061 "first": createPositionalPseudo(function() {
2065 "last": createPositionalPseudo(function( matchIndexes, length ) {
2066 return [ length - 1 ];
2069 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
2070 return [ argument < 0 ? argument + length : argument ];
2073 "even": createPositionalPseudo(function( matchIndexes, length ) {
2075 for ( ; i < length; i += 2 ) {
2076 matchIndexes.push( i );
2078 return matchIndexes;
2081 "odd": createPositionalPseudo(function( matchIndexes, length ) {
2083 for ( ; i < length; i += 2 ) {
2084 matchIndexes.push( i );
2086 return matchIndexes;
2089 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2090 var i = argument < 0 ? argument + length : argument;
2091 for ( ; --i >= 0; ) {
2092 matchIndexes.push( i );
2094 return matchIndexes;
2097 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2098 var i = argument < 0 ? argument + length : argument;
2099 for ( ; ++i < length; ) {
2100 matchIndexes.push( i );
2102 return matchIndexes;
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 + " " ];
2128 return parseOnly ? 0 : cached.slice( 0 );
2133 preFilters = Expr.preFilter;
2137 // Comma and first run
2138 if ( !matched || (match = rcomma.exec( soFar )) ) {
2140 // Don't consume trailing commas as valid
2141 soFar = soFar.slice( match[0].length ) || soFar;
2143 groups.push( (tokens = []) );
2149 if ( (match = rcombinators.exec( soFar )) ) {
2150 matched = match.shift();
2153 // Cast descendant combinators to space
2154 type: match[0].replace( rtrim, " " )
2156 soFar = soFar.slice( matched.length );
2160 for ( type in Expr.filter ) {
2161 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
2162 (match = preFilters[ type ]( match ))) ) {
2163 matched = match.shift();
2169 soFar = soFar.slice( matched.length );
2178 // Return the length of the invalid excess
2179 // if we're just parsing
2180 // Otherwise, throw an error or return tokens
2184 Sizzle.error( selector ) :
2186 tokenCache( selector, groups ).slice( 0 );
2189 function toSelector( tokens ) {
2191 len = tokens.length,
2193 for ( ; i < len; i++ ) {
2194 selector += tokens[i].value;
2199 function addCombinator( matcher, combinator, base ) {
2200 var dir = combinator.dir,
2201 skip = combinator.next,
2203 checkNonElements = base && key === "parentNode",
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 );
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
2223 while ( (elem = elem[ dir ]) ) {
2224 if ( elem.nodeType === 1 || checkNonElements ) {
2225 if ( matcher( elem, context, xml ) ) {
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 ]);
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 )) ) {
2261 function elementMatcher( matchers ) {
2262 return matchers.length > 1 ?
2263 function( elem, context, xml ) {
2264 var i = matchers.length;
2266 if ( !matchers[i]( elem, context, xml ) ) {
2275 function multipleContexts( selector, contexts, results ) {
2277 len = contexts.length;
2278 for ( ; i < len; i++ ) {
2279 Sizzle( selector, contexts[i], results );
2284 function condense( unmatched, map, filter, context, xml ) {
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 );
2302 return newUnmatched;
2305 function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2306 if ( postFilter && !postFilter[ expando ] ) {
2307 postFilter = setMatcher( postFilter );
2309 if ( postFinder && !postFinder[ expando ] ) {
2310 postFinder = setMatcher( postFinder, postSelector );
2312 return markFunction(function( seed, results, context, xml ) {
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 ) :
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
2333 // ...otherwise use results directly
2337 // Find primary matches
2339 matcher( matcherIn, matcherOut, context, xml );
2344 temp = condense( matcherOut, postMap );
2345 postFilter( temp, [], context, xml );
2347 // Un-match failing elements by moving them back to matcherIn
2350 if ( (elem = temp[i]) ) {
2351 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
2357 if ( postFinder || preFilter ) {
2359 // Get the final matcherOut by condensing this intermediate into postFinder contexts
2361 i = matcherOut.length;
2363 if ( (elem = matcherOut[i]) ) {
2364 // Restore matcherIn since elem is not yet a final match
2365 temp.push( (matcherIn[i] = elem) );
2368 postFinder( null, (matcherOut = []), temp, xml );
2371 // Move matched elements from seed to results to keep them synchronized
2372 i = matcherOut.length;
2374 if ( (elem = matcherOut[i]) &&
2375 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
2377 seed[temp] = !(results[temp] = elem);
2382 // Add elements to results, through postFinder if defined
2384 matcherOut = condense(
2385 matcherOut === results ?
2386 matcherOut.splice( preexisting, matcherOut.length ) :
2390 postFinder( null, results, matcherOut, xml );
2392 push.apply( results, matcherOut );
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;
2422 for ( ; i < len; i++ ) {
2423 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
2424 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
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
2432 for ( ; j < len; j++ ) {
2433 if ( Expr.relative[ tokens[j].type ] ) {
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" ),
2444 i < j && matcherFromTokens( tokens.slice( i, j ) ),
2445 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
2446 j < len && toSelector( tokens )
2449 matchers.push( matcher );
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,
2463 unmatched = seed && [],
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),
2473 outermostContext = context === document || context || outermost;
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 ) {
2482 if ( !context && elem.ownerDocument !== document ) {
2483 setDocument( elem );
2484 xml = !documentIsHTML;
2486 while ( (matcher = elementMatchers[j++]) ) {
2487 if ( matcher( elem, context || document, xml) ) {
2488 results.push( elem );
2493 dirruns = dirrunsUnique;
2497 // Track unmatched elements for set filters
2499 // They will have gone through all possible matchers
2500 if ( (elem = !matcher && elem) ) {
2504 // Lengthen the array for every element, matched or not
2506 unmatched.push( elem );
2511 // `i` is now the count of elements visited above, and adding it to `matchedCount`
2512 // makes the latter nonnegative.
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 ) {
2524 while ( (matcher = setMatchers[j++]) ) {
2525 matcher( unmatched, setMatched, context, xml );
2529 // Reintegrate element matches to eliminate the need for sorting
2530 if ( matchedCount > 0 ) {
2532 if ( !(unmatched[i] || setMatched[i]) ) {
2533 setMatched[i] = pop.call( results );
2538 // Discard index placeholder values to get only actual matches
2539 setMatched = condense( setMatched );
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 );
2553 // Override manipulation of globals by nested matchers
2555 dirruns = dirrunsUnique;
2556 outermostContext = contextBackup;
2563 markFunction( superMatcher ) :
2567 compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2570 elementMatchers = [],
2571 cached = compilerCache[ selector + " " ];
2574 // Generate a function of recursive functions that can be used to check each element
2576 match = tokenize( selector );
2580 cached = matcherFromTokens( match[i] );
2581 if ( cached[ expando ] ) {
2582 setMatchers.push( cached );
2584 elementMatchers.push( cached );
2588 // Cache the compiled function
2589 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2591 // Save selector and tokenization
2592 cached.selector = selector;
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
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];
2627 // Precompiled matchers will still verify ancestry, so step up a level
2628 } else if ( compiled ) {
2629 context = context.parentNode;
2632 selector = selector.slice( tokens.shift().value.length );
2635 // Fetch a seed set for right-to-left matching
2636 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
2640 // Abort if we hit a combinator
2641 if ( Expr.relative[ (type = token.type) ] ) {
2644 if ( (find = Expr.find[ type ]) ) {
2645 // Search, expanding context for leading sibling combinators
2647 token.matches[0].replace( runescape, funescape ),
2648 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
2651 // If seed is empty or no tokens remain, we can return early
2652 tokens.splice( i, 1 );
2653 selector = seed.length && toSelector( tokens );
2655 push.apply( results, seed );
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 ) )(
2672 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
2677 // One-time assignments
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
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;
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") === "#" ;
2703 addHandle( "type|href|height|width", function( elem, name, isXML ) {
2705 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
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" ) === "";
2717 addHandle( "value", function( elem, name, isXML ) {
2718 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
2719 return elem.defaultValue;
2725 // Use getAttributeNode to fetch booleans when getAttribute lies
2726 if ( !assert(function( el ) {
2727 return el.getAttribute("disabled") == null;
2729 addHandle( booleans, function( elem, name, isXML ) {
2732 return elem[ name ] === true ? name.toLowerCase() :
2733 (val = elem.getAttributeNode( name )) && val.specified ?
2746 jQuery.find = Sizzle;
2747 jQuery.expr = Sizzle.selectors;
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 ) {
2762 truncate = until !== undefined;
2764 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
2765 if ( elem.nodeType === 1 ) {
2766 if ( truncate && jQuery( elem ).is( until ) ) {
2769 matched.push( elem );
2776 var siblings = function( n, elem ) {
2779 for ( ; n; n = n.nextSibling ) {
2780 if ( n.nodeType === 1 && n !== elem ) {
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;
2806 if ( qualifier.nodeType ) {
2807 return jQuery.grep( elements, function( elem ) {
2808 return ( elem === qualifier ) !== not;
2813 if ( typeof qualifier === "string" ) {
2814 if ( risSimple.test( qualifier ) ) {
2815 return jQuery.filter( qualifier, elements, not );
2818 qualifier = jQuery.filter( qualifier, elements );
2821 return jQuery.grep( elements, function( elem ) {
2822 return ( indexOf.call( qualifier, elem ) > -1 ) !== not && elem.nodeType === 1;
2826 jQuery.filter = function( expr, elems, not ) {
2827 var elem = elems[ 0 ];
2830 expr = ":not(" + expr + ")";
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;
2841 find: function( selector ) {
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 ) ) {
2856 ret = this.pushStack( [] );
2858 for ( i = 0; i < len; i++ ) {
2859 jQuery.find( selector, self[ i ], ret );
2862 return len > 1 ? jQuery.uniqueSort( ret ) : ret;
2864 filter: function( selector ) {
2865 return this.pushStack( winnow( this, selector || [], false ) );
2867 not: function( selector ) {
2868 return this.pushStack( winnow( this, selector || [], true ) );
2870 is: function( selector ) {
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 ) :
2885 // Initialize a jQuery object
2888 // A central reference to the root jQuery(document)
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-]+))$/,