2 * jQuery JavaScript Library v1.12.1
8 * Copyright jQuery Foundation and other contributors
9 * Released under the MIT license
10 * http://jquery.org/license
12 * Date: 2016-02-22T19:07Z
15 (function( global, factory ) {
17 if ( typeof module === "object" && typeof module.exports === "object" ) {
18 // For CommonJS and CommonJS-like environments where a proper `window`
19 // is present, execute the factory and get jQuery.
20 // For environments that do not have a `window` with a `document`
21 // (such as Node.js), expose a factory as module.exports.
22 // This accentuates the need for the creation of a real `window`.
23 // e.g. var jQuery = require("jquery")(window);
24 // See ticket #14549 for more info.
25 module.exports = global.document ?
26 factory( global, true ) :
29 throw new Error( "jQuery requires a window with a document" );
37 // Pass this if window is not defined yet
38 }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
40 // Support: Firefox 18+
41 // Can't be in strict mode, several libs including ASP.NET trace
42 // the stack via arguments.caller.callee and Firefox dies if
43 // you try to trace through "use strict" call chains. (#13335)
47 var document = window.document;
49 var slice = deletedIds.slice;
51 var concat = deletedIds.concat;
53 var push = deletedIds.push;
55 var indexOf = deletedIds.indexOf;
59 var toString = class2type.toString;
61 var hasOwn = class2type.hasOwnProperty;
70 // Define a local copy of jQuery
71 jQuery = function( selector, context ) {
73 // The jQuery object is actually just the init constructor 'enhanced'
74 // Need init if jQuery is called (just allow error to be thrown if not included)
75 return new jQuery.fn.init( selector, context );
78 // Support: Android<4.1, IE<9
79 // Make sure we trim BOM and NBSP
80 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
82 // Matches dashed string for camelizing
84 rdashAlpha = /-([\da-z])/gi,
86 // Used by jQuery.camelCase as callback to replace()
87 fcamelCase = function( all, letter ) {
88 return letter.toUpperCase();
91 jQuery.fn = jQuery.prototype = {
93 // The current version of jQuery being used
98 // Start with an empty selector
101 // The default length of a jQuery object is 0
104 toArray: function() {
105 return slice.call( this );
108 // Get the Nth element in the matched element set OR
109 // Get the whole matched element set as a clean array
110 get: function( num ) {
113 // Return just the one element from the set
114 ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
116 // Return all the elements in a clean array
120 // Take an array of elements and push it onto the stack
121 // (returning the new matched element set)
122 pushStack: function( elems ) {
124 // Build a new jQuery matched element set
125 var ret = jQuery.merge( this.constructor(), elems );
127 // Add the old object onto the stack (as a reference)
128 ret.prevObject = this;
129 ret.context = this.context;
131 // Return the newly-formed element set
135 // Execute a callback for every element in the matched set.
136 each: function( callback ) {
137 return jQuery.each( this, callback );
140 map: function( callback ) {
141 return this.pushStack( jQuery.map( this, function( elem, i ) {
142 return callback.call( elem, i, elem );
147 return this.pushStack( slice.apply( this, arguments ) );
155 return this.eq( -1 );
159 var len = this.length,
160 j = +i + ( i < 0 ? len : 0 );
161 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
165 return this.prevObject || this.constructor();
168 // For internal use only.
169 // Behaves like an Array's method, not like a jQuery method.
171 sort: deletedIds.sort,
172 splice: deletedIds.splice
175 jQuery.extend = jQuery.fn.extend = function() {
176 var src, copyIsArray, copy, name, options, clone,
177 target = arguments[ 0 ] || {},
179 length = arguments.length,
182 // Handle a deep copy situation
183 if ( typeof target === "boolean" ) {
186 // skip the boolean and the target
187 target = arguments[ i ] || {};
191 // Handle case when target is a string or something (possible in deep copy)
192 if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
196 // extend jQuery itself if only one argument is passed
197 if ( i === length ) {
202 for ( ; i < length; i++ ) {
204 // Only deal with non-null/undefined values
205 if ( ( options = arguments[ i ] ) != null ) {
207 // Extend the base object
208 for ( name in options ) {
209 src = target[ name ];
210 copy = options[ name ];
212 // Prevent never-ending loop
213 if ( target === copy ) {
217 // Recurse if we're merging plain objects or arrays
218 if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
219 ( copyIsArray = jQuery.isArray( copy ) ) ) ) {
223 clone = src && jQuery.isArray( src ) ? src : [];
226 clone = src && jQuery.isPlainObject( src ) ? src : {};
229 // Never move original objects, clone them
230 target[ name ] = jQuery.extend( deep, clone, copy );
232 // Don't bring in undefined values
233 } else if ( copy !== undefined ) {
234 target[ name ] = copy;
240 // Return the modified object
246 // Unique for each copy of jQuery on the page
247 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
249 // Assume jQuery is ready without the ready module
252 error: function( msg ) {
253 throw new Error( msg );
258 // See test/unit/core.js for details concerning isFunction.
259 // Since version 1.3, DOM methods and functions like alert
260 // aren't supported. They return false on IE (#2968).
261 isFunction: function( obj ) {
262 return jQuery.type( obj ) === "function";
265 isArray: Array.isArray || function( obj ) {
266 return jQuery.type( obj ) === "array";
269 isWindow: function( obj ) {
270 /* jshint eqeqeq: false */
271 return obj != null && obj == obj.window;
274 isNumeric: function( obj ) {
276 // parseFloat NaNs numeric-cast false positives (null|true|false|"")
277 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
278 // subtraction forces infinities to NaN
279 // adding 1 corrects loss of precision from parseFloat (#15100)
280 var realStringObj = obj && obj.toString();
281 return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0;
284 isEmptyObject: function( obj ) {
286 for ( name in obj ) {
292 isPlainObject: function( obj ) {
295 // Must be an Object.
296 // Because of IE, we also have to check the presence of the constructor property.
297 // Make sure that DOM nodes and window objects don't pass through, as well
298 if ( !obj || jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
304 // Not own constructor property must be Object
305 if ( obj.constructor &&
306 !hasOwn.call( obj, "constructor" ) &&
307 !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) {
312 // IE8,9 Will throw exceptions on certain host objects #9897
317 // Handle iteration over inherited properties before own properties.
318 if ( !support.ownFirst ) {
320 return hasOwn.call( obj, key );
324 // Own properties are enumerated firstly, so to speed up,
325 // if last one is own, then all properties are own.
326 for ( key in obj ) {}
328 return key === undefined || hasOwn.call( obj, key );
331 type: function( obj ) {
335 return typeof obj === "object" || typeof obj === "function" ?
336 class2type[ toString.call( obj ) ] || "object" :
340 // Workarounds based on findings by Jim Driscoll
341 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
342 globalEval: function( data ) {
343 if ( data && jQuery.trim( data ) ) {
345 // We use execScript on Internet Explorer
346 // We use an anonymous function so that context is window
347 // rather than jQuery in Firefox
348 ( window.execScript || function( data ) {
349 window[ "eval" ].call( window, data ); // jscs:ignore requireDotNotation
354 // Convert dashed to camelCase; used by the css and data modules
355 // Microsoft forgot to hump their vendor prefix (#9572)
356 camelCase: function( string ) {
357 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
360 nodeName: function( elem, name ) {
361 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
364 each: function( obj, callback ) {
367 if ( isArrayLike( obj ) ) {
369 for ( ; i < length; i++ ) {
370 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
376 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
385 // Support: Android<4.1, IE<9
386 trim: function( text ) {
387 return text == null ?
389 ( text + "" ).replace( rtrim, "" );
392 // results is for internal usage only
393 makeArray: function( arr, results ) {
394 var ret = results || [];
397 if ( isArrayLike( Object( arr ) ) ) {
399 typeof arr === "string" ?
403 push.call( ret, arr );
410 inArray: function( elem, arr, i ) {
415 return indexOf.call( arr, elem, i );
419 i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
421 for ( ; i < len; i++ ) {
423 // Skip accessing in sparse arrays
424 if ( i in arr && arr[ i ] === elem ) {
433 merge: function( first, second ) {
434 var len = +second.length,
439 first[ i++ ] = second[ j++ ];
443 // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)
445 while ( second[ j ] !== undefined ) {
446 first[ i++ ] = second[ j++ ];
455 grep: function( elems, callback, invert ) {
459 length = elems.length,
460 callbackExpect = !invert;
462 // Go through the array, only saving the items
463 // that pass the validator function
464 for ( ; i < length; i++ ) {
465 callbackInverse = !callback( elems[ i ], i );
466 if ( callbackInverse !== callbackExpect ) {
467 matches.push( elems[ i ] );
474 // arg is for internal usage only
475 map: function( elems, callback, arg ) {
480 // Go through the array, translating each of the items to their new values
481 if ( isArrayLike( elems ) ) {
482 length = elems.length;
483 for ( ; i < length; i++ ) {
484 value = callback( elems[ i ], i, arg );
486 if ( value != null ) {
491 // Go through every key on the object,
494 value = callback( elems[ i ], i, arg );
496 if ( value != null ) {
502 // Flatten any nested arrays
503 return concat.apply( [], ret );
506 // A global GUID counter for objects
509 // Bind a function to a context, optionally partially applying any
511 proxy: function( fn, context ) {
512 var args, proxy, tmp;
514 if ( typeof context === "string" ) {
520 // Quick check to determine if target is callable, in the spec
521 // this throws a TypeError, but we will just return undefined.
522 if ( !jQuery.isFunction( fn ) ) {
527 args = slice.call( arguments, 2 );
529 return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
532 // Set the guid of unique handler to the same of original handler, so it can be removed
533 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
539 return +( new Date() );
542 // jQuery.support is not used in Core but other projects attach their
543 // properties to it so it needs to exist.
547 // JSHint would error on this code due to the Symbol not being defined in ES5.
548 // Defining this global in .jshintrc would create a danger of using the global
549 // unguarded in another place, it seems safer to just disable JSHint for these
551 /* jshint ignore: start */
552 if ( typeof Symbol === "function" ) {
553 jQuery.fn[ Symbol.iterator ] = deletedIds[ Symbol.iterator ];
555 /* jshint ignore: end */
557 // Populate the class2type map
558 jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
559 function( i, name ) {
560 class2type[ "[object " + name + "]" ] = name.toLowerCase();
563 function isArrayLike( obj ) {
565 // Support: iOS 8.2 (not reproducible in simulator)
566 // `in` check used to prevent JIT error (gh-2145)
567 // hasOwn isn't used here due to false negatives
568 // regarding Nodelist length in IE
569 var length = !!obj && "length" in obj && obj.length,
570 type = jQuery.type( obj );
572 if ( type === "function" || jQuery.isWindow( obj ) ) {
576 return type === "array" || length === 0 ||
577 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
581 * Sizzle CSS Selector Engine v2.2.1
582 * http://sizzlejs.com/
584 * Copyright jQuery Foundation and other contributors
585 * Released under the MIT license
586 * http://jquery.org/license
590 (function( window ) {
604 // Local document vars
614 // Instance-specific data
615 expando = "sizzle" + 1 * new Date(),
616 preferredDoc = window.document,
619 classCache = createCache(),
620 tokenCache = createCache(),
621 compilerCache = createCache(),
622 sortOrder = function( a, b ) {
629 // General-purpose constants
630 MAX_NEGATIVE = 1 << 31,
633 hasOwn = ({}).hasOwnProperty,
636 push_native = arr.push,
639 // Use a stripped-down indexOf as it's faster than native
640 // http://jsperf.com/thor-indexof-vs-for/5
641 indexOf = function( list, elem ) {
644 for ( ; i < len; i++ ) {
645 if ( list[i] === elem ) {
652 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
654 // Regular expressions
656 // http://www.w3.org/TR/css3-selectors/#whitespace
657 whitespace = "[\\x20\\t\\r\\n\\f]",
659 // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
660 identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
662 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
663 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
664 // Operator (capture 2)
665 "*([*^$|!~]?=)" + whitespace +
666 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
667 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
670 pseudos = ":(" + identifier + ")(?:\\((" +
671 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
672 // 1. quoted (capture 3; capture 4 or capture 5)
673 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
674 // 2. simple (capture 6)
675 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
676 // 3. anything else (capture 2)
680 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
681 rwhitespace = new RegExp( whitespace + "+", "g" ),
682 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
684 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
685 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
687 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
689 rpseudo = new RegExp( pseudos ),
690 ridentifier = new RegExp( "^" + identifier + "$" ),
693 "ID": new RegExp( "^#(" + identifier + ")" ),
694 "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
695 "TAG": new RegExp( "^(" + identifier + "|[*])" ),
696 "ATTR": new RegExp( "^" + attributes ),
697 "PSEUDO": new RegExp( "^" + pseudos ),
698 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
699 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
700 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
701 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
702 // For use in libraries implementing .is()
703 // We use this for POS matching in `select`
704 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
705 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
708 rinputs = /^(?:input|select|textarea|button)$/i,
711 rnative = /^[^{]+\{\s*\[native \w/,
713 // Easily-parseable/retrievable ID or TAG or CLASS selectors
714 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
719 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
720 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
721 funescape = function( _, escaped, escapedWhitespace ) {
722 var high = "0x" + escaped - 0x10000;
723 // NaN means non-codepoint
724 // Support: Firefox<24
725 // Workaround erroneous numeric interpretation of +"0x"
726 return high !== high || escapedWhitespace ?
730 String.fromCharCode( high + 0x10000 ) :
731 // Supplemental Plane codepoint (surrogate pair)
732 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
737 // Removing the function wrapper causes a "Permission Denied"
739 unloadHandler = function() {
743 // Optimize for push.apply( _, NodeList )
746 (arr = slice.call( preferredDoc.childNodes )),
747 preferredDoc.childNodes
749 // Support: Android<4.0
750 // Detect silently failing push.apply
751 arr[ preferredDoc.childNodes.length ].nodeType;
753 push = { apply: arr.length ?
755 // Leverage slice if possible
756 function( target, els ) {
757 push_native.apply( target, slice.call(els) );
761 // Otherwise append directly
762 function( target, els ) {
763 var j = target.length,
765 // Can't trust NodeList.length
766 while ( (target[j++] = els[i++]) ) {}
767 target.length = j - 1;
772 function Sizzle( selector, context, results, seed ) {
773 var m, i, elem, nid, nidselect, match, groups, newSelector,
774 newContext = context && context.ownerDocument,
776 // nodeType defaults to 9, since context defaults to document
777 nodeType = context ? context.nodeType : 9;
779 results = results || [];
781 // Return early from calls with invalid selector or context
782 if ( typeof selector !== "string" || !selector ||
783 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
788 // Try to shortcut find operations (as opposed to filters) in HTML documents
791 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
792 setDocument( context );
794 context = context || document;
796 if ( documentIsHTML ) {
798 // If the selector is sufficiently simple, try using a "get*By*" DOM method
799 // (excepting DocumentFragment context, where the methods don't exist)
800 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
803 if ( (m = match[1]) ) {
806 if ( nodeType === 9 ) {
807 if ( (elem = context.getElementById( m )) ) {
809 // Support: IE, Opera, Webkit
810 // TODO: identify versions
811 // getElementById can match elements by name instead of ID
812 if ( elem.id === m ) {
813 results.push( elem );
823 // Support: IE, Opera, Webkit
824 // TODO: identify versions
825 // getElementById can match elements by name instead of ID
826 if ( newContext && (elem = newContext.getElementById( m )) &&
827 contains( context, elem ) &&
830 results.push( elem );
836 } else if ( match[2] ) {
837 push.apply( results, context.getElementsByTagName( selector ) );
841 } else if ( (m = match[3]) && support.getElementsByClassName &&
842 context.getElementsByClassName ) {
844 push.apply( results, context.getElementsByClassName( m ) );
849 // Take advantage of querySelectorAll
851 !compilerCache[ selector + " " ] &&
852 (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
854 if ( nodeType !== 1 ) {
855 newContext = context;
856 newSelector = selector;
858 // qSA looks outside Element context, which is not what we want
859 // Thanks to Andrew Dupont for this workaround technique
861 // Exclude object elements
862 } else if ( context.nodeName.toLowerCase() !== "object" ) {
864 // Capture the context ID, setting it first if necessary
865 if ( (nid = context.getAttribute( "id" )) ) {
866 nid = nid.replace( rescape, "\\$&" );
868 context.setAttribute( "id", (nid = expando) );
871 // Prefix every selector in the list
872 groups = tokenize( selector );
874 nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']";
876 groups[i] = nidselect + " " + toSelector( groups[i] );
878 newSelector = groups.join( "," );
880 // Expand context for sibling selectors
881 newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
888 newContext.querySelectorAll( newSelector )
891 } catch ( qsaError ) {
893 if ( nid === expando ) {
894 context.removeAttribute( "id" );
903 return select( selector.replace( rtrim, "$1" ), context, results, seed );
907 * Create key-value caches of limited size
908 * @returns {function(string, object)} Returns the Object data after storing it on itself with
909 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
910 * deleting the oldest entry
912 function createCache() {
915 function cache( key, value ) {
916 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
917 if ( keys.push( key + " " ) > Expr.cacheLength ) {
918 // Only keep the most recent entries
919 delete cache[ keys.shift() ];
921 return (cache[ key + " " ] = value);
927 * Mark a function for special use by Sizzle
928 * @param {Function} fn The function to mark
930 function markFunction( fn ) {
931 fn[ expando ] = true;
936 * Support testing using an element
937 * @param {Function} fn Passed the created div and expects a boolean result
939 function assert( fn ) {
940 var div = document.createElement("div");
947 // Remove from its parent by default
948 if ( div.parentNode ) {
949 div.parentNode.removeChild( div );
951 // release memory in IE
957 * Adds the same handler for all of the specified attrs
958 * @param {String} attrs Pipe-separated list of attributes
959 * @param {Function} handler The method that will be applied
961 function addHandle( attrs, handler ) {
962 var arr = attrs.split("|"),
966 Expr.attrHandle[ arr[i] ] = handler;
971 * Checks document order of two siblings
974 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
976 function siblingCheck( a, b ) {
978 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
979 ( ~b.sourceIndex || MAX_NEGATIVE ) -
980 ( ~a.sourceIndex || MAX_NEGATIVE );
982 // Use IE sourceIndex if available on both nodes
987 // Check if b follows a
989 while ( (cur = cur.nextSibling) ) {
1000 * Returns a function to use in pseudos for input types
1001 * @param {String} type
1003 function createInputPseudo( type ) {
1004 return function( elem ) {
1005 var name = elem.nodeName.toLowerCase();
1006 return name === "input" && elem.type === type;
1011 * Returns a function to use in pseudos for buttons
1012 * @param {String} type
1014 function createButtonPseudo( type ) {
1015 return function( elem ) {
1016 var name = elem.nodeName.toLowerCase();
1017 return (name === "input" || name === "button") && elem.type === type;
1022 * Returns a function to use in pseudos for positionals
1023 * @param {Function} fn
1025 function createPositionalPseudo( fn ) {
1026 return markFunction(function( argument ) {
1027 argument = +argument;
1028 return markFunction(function( seed, matches ) {
1030 matchIndexes = fn( [], seed.length, argument ),
1031 i = matchIndexes.length;
1033 // Match elements found at the specified indexes
1035 if ( seed[ (j = matchIndexes[i]) ] ) {
1036 seed[j] = !(matches[j] = seed[j]);
1044 * Checks a node for validity as a Sizzle context
1045 * @param {Element|Object=} context
1046 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
1048 function testContext( context ) {
1049 return context && typeof context.getElementsByTagName !== "undefined" && context;
1052 // Expose support vars for convenience
1053 support = Sizzle.support = {};
1057 * @param {Element|Object} elem An element or a document
1058 * @returns {Boolean} True iff elem is a non-HTML XML node
1060 isXML = Sizzle.isXML = function( elem ) {
1061 // documentElement is verified for cases where it doesn't yet exist
1062 // (such as loading iframes in IE - #4833)
1063 var documentElement = elem && (elem.ownerDocument || elem).documentElement;
1064 return documentElement ? documentElement.nodeName !== "HTML" : false;
1068 * Sets document-related variables once based on the current document
1069 * @param {Element|Object} [doc] An element or document object to use to set the document
1070 * @returns {Object} Returns the current document
1072 setDocument = Sizzle.setDocument = function( node ) {
1073 var hasCompare, parent,
1074 doc = node ? node.ownerDocument || node : preferredDoc;
1076 // Return early if doc is invalid or already selected
1077 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
1081 // Update global variables
1083 docElem = document.documentElement;
1084 documentIsHTML = !isXML( document );
1086 // Support: IE 9-11, Edge
1087 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
1088 if ( (parent = document.defaultView) && parent.top !== parent ) {
1090 if ( parent.addEventListener ) {
1091 parent.addEventListener( "unload", unloadHandler, false );
1093 // Support: IE 9 - 10 only
1094 } else if ( parent.attachEvent ) {
1095 parent.attachEvent( "onunload", unloadHandler );
1100 ---------------------------------------------------------------------- */
1103 // Verify that getAttribute really returns attributes and not properties
1104 // (excepting IE8 booleans)
1105 support.attributes = assert(function( div ) {
1106 div.className = "i";
1107 return !div.getAttribute("className");
1111 ---------------------------------------------------------------------- */
1113 // Check if getElementsByTagName("*") returns only elements
1114 support.getElementsByTagName = assert(function( div ) {
1115 div.appendChild( document.createComment("") );
1116 return !div.getElementsByTagName("*").length;
1120 support.getElementsByClassName = rnative.test( document.getElementsByClassName );
1123 // Check if getElementById returns elements by name
1124 // The broken getElementById methods don't pick up programatically-set names,
1125 // so use a roundabout getElementsByName test
1126 support.getById = assert(function( div ) {
1127 docElem.appendChild( div ).id = expando;
1128 return !document.getElementsByName || !document.getElementsByName( expando ).length;
1131 // ID find and filter
1132 if ( support.getById ) {
1133 Expr.find["ID"] = function( id, context ) {
1134 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1135 var m = context.getElementById( id );
1136 return m ? [ m ] : [];
1139 Expr.filter["ID"] = function( id ) {
1140 var attrId = id.replace( runescape, funescape );
1141 return function( elem ) {
1142 return elem.getAttribute("id") === attrId;
1147 // getElementById is not reliable as a find shortcut
1148 delete Expr.find["ID"];
1150 Expr.filter["ID"] = function( id ) {
1151 var attrId = id.replace( runescape, funescape );
1152 return function( elem ) {
1153 var node = typeof elem.getAttributeNode !== "undefined" &&
1154 elem.getAttributeNode("id");
1155 return node && node.value === attrId;
1161 Expr.find["TAG"] = support.getElementsByTagName ?
1162 function( tag, context ) {
1163 if ( typeof context.getElementsByTagName !== "undefined" ) {
1164 return context.getElementsByTagName( tag );
1166 // DocumentFragment nodes don't have gEBTN
1167 } else if ( support.qsa ) {
1168 return context.querySelectorAll( tag );
1172 function( tag, context ) {
1176 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
1177 results = context.getElementsByTagName( tag );
1179 // Filter out possible comments
1180 if ( tag === "*" ) {
1181 while ( (elem = results[i++]) ) {
1182 if ( elem.nodeType === 1 ) {
1193 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
1194 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
1195 return context.getElementsByClassName( className );
1199 /* QSA/matchesSelector
1200 ---------------------------------------------------------------------- */
1202 // QSA and matchesSelector support
1204 // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
1207 // qSa(:focus) reports false when true (Chrome 21)
1208 // We allow this because of a bug in IE8/9 that throws an error
1209 // whenever `document.activeElement` is accessed on an iframe
1210 // So, we allow :focus to pass through QSA all the time to avoid the IE error
1211 // See http://bugs.jquery.com/ticket/13378
1214 if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
1216 // Regex strategy adopted from Diego Perini
1217 assert(function( div ) {
1218 // Select is set to empty string on purpose
1219 // This is to test IE's treatment of not explicitly
1220 // setting a boolean content attribute,
1221 // since its presence should be enough
1222 // http://bugs.jquery.com/ticket/12359
1223 docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
1224 "<select id='" + expando + "-\r\\' msallowcapture=''>" +
1225 "<option selected=''></option></select>";
1227 // Support: IE8, Opera 11-12.16
1228 // Nothing should be selected when empty strings follow ^= or $= or *=
1229 // The test attribute must be unknown in Opera but "safe" for WinRT
1230 // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
1231 if ( div.querySelectorAll("[msallowcapture^='']").length ) {
1232 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
1236 // Boolean attributes and "value" are not treated correctly
1237 if ( !div.querySelectorAll("[selected]").length ) {
1238 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1241 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
1242 if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1243 rbuggyQSA.push("~=");
1246 // Webkit/Opera - :checked should return selected option elements
1247 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1248 // IE8 throws error here and will not see later tests
1249 if ( !div.querySelectorAll(":checked").length ) {
1250 rbuggyQSA.push(":checked");
1253 // Support: Safari 8+, iOS 8+
1254 // https://bugs.webkit.org/show_bug.cgi?id=136851
1255 // In-page `selector#id sibing-combinator selector` fails
1256 if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
1257 rbuggyQSA.push(".#.+[+~]");
1261 assert(function( div ) {
1262 // Support: Windows 8 Native Apps
1263 // The type and name attributes are restricted during .innerHTML assignment
1264 var input = document.createElement("input");
1265 input.setAttribute( "type", "hidden" );
1266 div.appendChild( input ).setAttribute( "name", "D" );
1269 // Enforce case-sensitivity of name attribute
1270 if ( div.querySelectorAll("[name=d]").length ) {
1271 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1274 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1275 // IE8 throws error here and will not see later tests
1276 if ( !div.querySelectorAll(":enabled").length ) {
1277 rbuggyQSA.push( ":enabled", ":disabled" );
1280 // Opera 10-11 does not throw on post-comma invalid pseudos
1281 div.querySelectorAll("*,:x");
1282 rbuggyQSA.push(",.*:");
1286 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
1287 docElem.webkitMatchesSelector ||
1288 docElem.mozMatchesSelector ||
1289 docElem.oMatchesSelector ||
1290 docElem.msMatchesSelector) )) ) {
1292 assert(function( div ) {
1293 // Check to see if it's possible to do matchesSelector
1294 // on a disconnected node (IE 9)
1295 support.disconnectedMatch = matches.call( div, "div" );
1297 // This should fail with an exception
1298 // Gecko does not error, returns false instead
1299 matches.call( div, "[s!='']:x" );
1300 rbuggyMatches.push( "!=", pseudos );
1304 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
1305 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
1308 ---------------------------------------------------------------------- */
1309 hasCompare = rnative.test( docElem.compareDocumentPosition );
1311 // Element contains another
1312 // Purposefully self-exclusive
1313 // As in, an element does not contain itself
1314 contains = hasCompare || rnative.test( docElem.contains ) ?
1316 var adown = a.nodeType === 9 ? a.documentElement : a,
1317 bup = b && b.parentNode;
1318 return a === bup || !!( bup && bup.nodeType === 1 && (
1320 adown.contains( bup ) :
1321 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1326 while ( (b = b.parentNode) ) {
1336 ---------------------------------------------------------------------- */
1338 // Document order sorting
1339 sortOrder = hasCompare ?
1342 // Flag for duplicate removal
1344 hasDuplicate = true;
1348 // Sort on method existence if only one input has compareDocumentPosition
1349 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
1354 // Calculate position if both inputs belong to the same document
1355 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
1356 a.compareDocumentPosition( b ) :
1358 // Otherwise we know they are disconnected
1361 // Disconnected nodes
1363 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
1365 // Choose the first element that is related to our preferred document
1366 if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
1369 if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
1373 // Maintain original order
1375 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1379 return compare & 4 ? -1 : 1;
1382 // Exit early if the nodes are identical
1384 hasDuplicate = true;
1395 // Parentless nodes are either documents or disconnected
1396 if ( !aup || !bup ) {
1397 return a === document ? -1 :
1398 b === document ? 1 :
1402 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1405 // If the nodes are siblings, we can do a quick check
1406 } else if ( aup === bup ) {
1407 return siblingCheck( a, b );
1410 // Otherwise we need full lists of their ancestors for comparison
1412 while ( (cur = cur.parentNode) ) {
1416 while ( (cur = cur.parentNode) ) {
1420 // Walk down the tree looking for a discrepancy
1421 while ( ap[i] === bp[i] ) {
1426 // Do a sibling check if the nodes have a common ancestor
1427 siblingCheck( ap[i], bp[i] ) :
1429 // Otherwise nodes in our document sort first
1430 ap[i] === preferredDoc ? -1 :
1431 bp[i] === preferredDoc ? 1 :
1438 Sizzle.matches = function( expr, elements ) {
1439 return Sizzle( expr, null, null, elements );
1442 Sizzle.matchesSelector = function( elem, expr ) {
1443 // Set document vars if needed
1444 if ( ( elem.ownerDocument || elem ) !== document ) {
1445 setDocument( elem );
1448 // Make sure that attribute selectors are quoted
1449 expr = expr.replace( rattributeQuotes, "='$1']" );
1451 if ( support.matchesSelector && documentIsHTML &&
1452 !compilerCache[ expr + " " ] &&
1453 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
1454 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
1457 var ret = matches.call( elem, expr );
1459 // IE 9's matchesSelector returns false on disconnected nodes
1460 if ( ret || support.disconnectedMatch ||
1461 // As well, disconnected nodes are said to be in a document
1463 elem.document && elem.document.nodeType !== 11 ) {
1469 return Sizzle( expr, document, null, [ elem ] ).length > 0;
1472 Sizzle.contains = function( context, elem ) {
1473 // Set document vars if needed
1474 if ( ( context.ownerDocument || context ) !== document ) {
1475 setDocument( context );
1477 return contains( context, elem );
1480 Sizzle.attr = function( elem, name ) {
1481 // Set document vars if needed
1482 if ( ( elem.ownerDocument || elem ) !== document ) {
1483 setDocument( elem );
1486 var fn = Expr.attrHandle[ name.toLowerCase() ],
1487 // Don't get fooled by Object.prototype properties (jQuery #13807)
1488 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1489 fn( elem, name, !documentIsHTML ) :
1492 return val !== undefined ?
1494 support.attributes || !documentIsHTML ?
1495 elem.getAttribute( name ) :
1496 (val = elem.getAttributeNode(name)) && val.specified ?
1501 Sizzle.error = function( msg ) {
1502 throw new Error( "Syntax error, unrecognized expression: " + msg );
1506 * Document sorting and removing duplicates
1507 * @param {ArrayLike} results
1509 Sizzle.uniqueSort = function( results ) {
1515 // Unless we *know* we can detect duplicates, assume their presence
1516 hasDuplicate = !support.detectDuplicates;
1517 sortInput = !support.sortStable && results.slice( 0 );
1518 results.sort( sortOrder );
1520 if ( hasDuplicate ) {
1521 while ( (elem = results[i++]) ) {
1522 if ( elem === results[ i ] ) {
1523 j = duplicates.push( i );
1527 results.splice( duplicates[ j ], 1 );
1531 // Clear input after sorting to release objects
1532 // See https://github.com/jquery/sizzle/pull/225
1539 * Utility function for retrieving the text value of an array of DOM nodes
1540 * @param {Array|Element} elem
1542 getText = Sizzle.getText = function( elem ) {
1546 nodeType = elem.nodeType;
1549 // If no nodeType, this is expected to be an array
1550 while ( (node = elem[i++]) ) {
1551 // Do not traverse comment nodes
1552 ret += getText( node );
1554 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1555 // Use textContent for elements
1556 // innerText usage removed for consistency of new lines (jQuery #11153)
1557 if ( typeof elem.textContent === "string" ) {
1558 return elem.textContent;
1560 // Traverse its children
1561 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1562 ret += getText( elem );
1565 } else if ( nodeType === 3 || nodeType === 4 ) {
1566 return elem.nodeValue;
1568 // Do not include comment or processing instruction nodes
1573 Expr = Sizzle.selectors = {
1575 // Can be adjusted by the user
1578 createPseudo: markFunction,
1587 ">": { dir: "parentNode", first: true },
1588 " ": { dir: "parentNode" },
1589 "+": { dir: "previousSibling", first: true },
1590 "~": { dir: "previousSibling" }
1594 "ATTR": function( match ) {
1595 match[1] = match[1].replace( runescape, funescape );
1597 // Move the given value to match[3] whether quoted or unquoted
1598 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
1600 if ( match[2] === "~=" ) {
1601 match[3] = " " + match[3] + " ";
1604 return match.slice( 0, 4 );
1607 "CHILD": function( match ) {
1608 /* matches from matchExpr["CHILD"]
1609 1 type (only|nth|...)
1610 2 what (child|of-type)
1611 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
1612 4 xn-component of xn+y argument ([+-]?\d*n|)
1613 5 sign of xn-component
1615 7 sign of y-component
1618 match[1] = match[1].toLowerCase();
1620 if ( match[1].slice( 0, 3 ) === "nth" ) {
1621 // nth-* requires argument
1623 Sizzle.error( match[0] );
1626 // numeric x and y parameters for Expr.filter.CHILD
1627 // remember that false/true cast respectively to 0/1
1628 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
1629 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
1631 // other types prohibit arguments
1632 } else if ( match[3] ) {
1633 Sizzle.error( match[0] );
1639 "PSEUDO": function( match ) {
1641 unquoted = !match[6] && match[2];
1643 if ( matchExpr["CHILD"].test( match[0] ) ) {
1647 // Accept quoted arguments as-is
1649 match[2] = match[4] || match[5] || "";
1651 // Strip excess characters from unquoted arguments
1652 } else if ( unquoted && rpseudo.test( unquoted ) &&
1653 // Get excess from tokenize (recursively)
1654 (excess = tokenize( unquoted, true )) &&
1655 // advance to the next closing parenthesis
1656 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
1658 // excess is a negative index
1659 match[0] = match[0].slice( 0, excess );
1660 match[2] = unquoted.slice( 0, excess );
1663 // Return only captures needed by the pseudo filter method (type and argument)
1664 return match.slice( 0, 3 );
1670 "TAG": function( nodeNameSelector ) {
1671 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1672 return nodeNameSelector === "*" ?
1673 function() { return true; } :
1675 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1679 "CLASS": function( className ) {
1680 var pattern = classCache[ className + " " ];
1683 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
1684 classCache( className, function( elem ) {
1685 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
1689 "ATTR": function( name, operator, check ) {
1690 return function( elem ) {
1691 var result = Sizzle.attr( elem, name );
1693 if ( result == null ) {
1694 return operator === "!=";
1702 return operator === "=" ? result === check :
1703 operator === "!=" ? result !== check :
1704 operator === "^=" ? check && result.indexOf( check ) === 0 :
1705 operator === "*=" ? check && result.indexOf( check ) > -1 :
1706 operator === "$=" ? check && result.slice( -check.length ) === check :
1707 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
1708 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
1713 "CHILD": function( type, what, argument, first, last ) {
1714 var simple = type.slice( 0, 3 ) !== "nth",
1715 forward = type.slice( -4 ) !== "last",
1716 ofType = what === "of-type";
1718 return first === 1 && last === 0 ?
1720 // Shortcut for :nth-*(n)
1722 return !!elem.parentNode;
1725 function( elem, context, xml ) {
1726 var cache, uniqueCache, outerCache, node, nodeIndex, start,
1727 dir = simple !== forward ? "nextSibling" : "previousSibling",
1728 parent = elem.parentNode,
1729 name = ofType && elem.nodeName.toLowerCase(),
1730 useCache = !xml && !ofType,
1735 // :(first|last|only)-(child|of-type)
1739 while ( (node = node[ dir ]) ) {
1741 node.nodeName.toLowerCase() === name :
1742 node.nodeType === 1 ) {
1747 // Reverse direction for :only-* (if we haven't yet done so)
1748 start = dir = type === "only" && !start && "nextSibling";
1753 start = [ forward ? parent.firstChild : parent.lastChild ];
1755 // non-xml :nth-child(...) stores cache data on `parent`
1756 if ( forward && useCache ) {
1758 // Seek `elem` from a previously-cached index
1760 // ...in a gzip-friendly way
1762 outerCache = node[ expando ] || (node[ expando ] = {});
1764 // Support: IE <9 only
1765 // Defend against cloned attroperties (jQuery gh-1709)
1766 uniqueCache = outerCache[ node.uniqueID ] ||
1767 (outerCache[ node.uniqueID ] = {});
1769 cache = uniqueCache[ type ] || [];
1770 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1771 diff = nodeIndex && cache[ 2 ];
1772 node = nodeIndex && parent.childNodes[ nodeIndex ];
1774 while ( (node = ++nodeIndex && node && node[ dir ] ||
1776 // Fallback to seeking `elem` from the start
1777 (diff = nodeIndex = 0) || start.pop()) ) {
1779 // When found, cache indexes on `parent` and break
1780 if ( node.nodeType === 1 && ++diff && node === elem ) {
1781 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
1787 // Use previously-cached element index if available
1789 // ...in a gzip-friendly way
1791 outerCache = node[ expando ] || (node[ expando ] = {});
1793 // Support: IE <9 only
1794 // Defend against cloned attroperties (jQuery gh-1709)
1795 uniqueCache = outerCache[ node.uniqueID ] ||
1796 (outerCache[ node.uniqueID ] = {});
1798 cache = uniqueCache[ type ] || [];
1799 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
1803 // xml :nth-child(...)
1804 // or :nth-last-child(...) or :nth(-last)?-of-type(...)
1805 if ( diff === false ) {
1806 // Use the same loop as above to seek `elem` from the start
1807 while ( (node = ++nodeIndex && node && node[ dir ] ||
1808 (diff = nodeIndex = 0) || start.pop()) ) {
1811 node.nodeName.toLowerCase() === name :
1812 node.nodeType === 1 ) &&
1815 // Cache the index of each encountered element
1817 outerCache = node[ expando ] || (node[ expando ] = {});
1819 // Support: IE <9 only
1820 // Defend against cloned attroperties (jQuery gh-1709)
1821 uniqueCache = outerCache[ node.uniqueID ] ||
1822 (outerCache[ node.uniqueID ] = {});
1824 uniqueCache[ type ] = [ dirruns, diff ];
1827 if ( node === elem ) {
1835 // Incorporate the offset, then check against cycle size
1837 return diff === first || ( diff % first === 0 && diff / first >= 0 );
1842 "PSEUDO": function( pseudo, argument ) {
1843 // pseudo-class names are case-insensitive
1844 // http://www.w3.org/TR/selectors/#pseudo-classes
1845 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
1846 // Remember that setFilters inherits from pseudos
1848 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
1849 Sizzle.error( "unsupported pseudo: " + pseudo );
1851 // The user may use createPseudo to indicate that
1852 // arguments are needed to create the filter function
1853 // just as Sizzle does
1854 if ( fn[ expando ] ) {
1855 return fn( argument );
1858 // But maintain support for old signatures
1859 if ( fn.length > 1 ) {
1860 args = [ pseudo, pseudo, "", argument ];
1861 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
1862 markFunction(function( seed, matches ) {
1864 matched = fn( seed, argument ),
1867 idx = indexOf( seed, matched[i] );
1868 seed[ idx ] = !( matches[ idx ] = matched[i] );
1872 return fn( elem, 0, args );
1881 // Potentially complex pseudos
1882 "not": markFunction(function( selector ) {
1883 // Trim the selector passed to compile
1884 // to avoid treating leading and trailing
1885 // spaces as combinators
1888 matcher = compile( selector.replace( rtrim, "$1" ) );
1890 return matcher[ expando ] ?
1891 markFunction(function( seed, matches, context, xml ) {
1893 unmatched = matcher( seed, null, xml, [] ),
1896 // Match elements unmatched by `matcher`
1898 if ( (elem = unmatched[i]) ) {
1899 seed[i] = !(matches[i] = elem);
1903 function( elem, context, xml ) {
1905 matcher( input, null, xml, results );
1906 // Don't keep the element (issue #299)
1908 return !results.pop();
1912 "has": markFunction(function( selector ) {
1913 return function( elem ) {
1914 return Sizzle( selector, elem ).length > 0;
1918 "contains": markFunction(function( text ) {
1919 text = text.replace( runescape, funescape );
1920 return function( elem ) {
1921 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
1925 // "Whether an element is represented by a :lang() selector
1926 // is based solely on the element's language value
1927 // being equal to the identifier C,
1928 // or beginning with the identifier C immediately followed by "-".
1929 // The matching of C against the element's language value is performed case-insensitively.
1930 // The identifier C does not have to be a valid language name."
1931 // http://www.w3.org/TR/selectors/#lang-pseudo
1932 "lang": markFunction( function( lang ) {
1933 // lang value must be a valid identifier
1934 if ( !ridentifier.test(lang || "") ) {
1935 Sizzle.error( "unsupported lang: " + lang );
1937 lang = lang.replace( runescape, funescape ).toLowerCase();
1938 return function( elem ) {
1941 if ( (elemLang = documentIsHTML ?
1943 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
1945 elemLang = elemLang.toLowerCase();
1946 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
1948 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
1954 "target": function( elem ) {
1955 var hash = window.location && window.location.hash;
1956 return hash && hash.slice( 1 ) === elem.id;
1959 "root": function( elem ) {
1960 return elem === docElem;
1963 "focus": function( elem ) {
1964 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
1967 // Boolean properties
1968 "enabled": function( elem ) {
1969 return elem.disabled === false;
1972 "disabled": function( elem ) {
1973 return elem.disabled === true;
1976 "checked": function( elem ) {
1977 // In CSS3, :checked should return both checked and selected elements
1978 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1979 var nodeName = elem.nodeName.toLowerCase();
1980 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
1983 "selected": function( elem ) {
1984 // Accessing this property makes selected-by-default
1985 // options in Safari work properly
1986 if ( elem.parentNode ) {
1987 elem.parentNode.selectedIndex;
1990 return elem.selected === true;
1994 "empty": function( elem ) {
1995 // http://www.w3.org/TR/selectors/#empty-pseudo
1996 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
1997 // but not by others (comment: 8; processing instruction: 7; etc.)
1998 // nodeType < 6 works because attributes (2) do not appear as children
1999 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
2000 if ( elem.nodeType < 6 ) {
2007 "parent": function( elem ) {
2008 return !Expr.pseudos["empty"]( elem );
2011 // Element/input types
2012 "header": function( elem ) {
2013 return rheader.test( elem.nodeName );
2016 "input": function( elem ) {
2017 return rinputs.test( elem.nodeName );
2020 "button": function( elem ) {
2021 var name = elem.nodeName.toLowerCase();
2022 return name === "input" && elem.type === "button" || name === "button";
2025 "text": function( elem ) {
2027 return elem.nodeName.toLowerCase() === "input" &&
2028 elem.type === "text" &&
2031 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
2032 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
2035 // Position-in-collection
2036 "first": createPositionalPseudo(function() {
2040 "last": createPositionalPseudo(function( matchIndexes, length ) {
2041 return [ length - 1 ];
2044 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
2045 return [ argument < 0 ? argument + length : argument ];
2048 "even": createPositionalPseudo(function( matchIndexes, length ) {
2050 for ( ; i < length; i += 2 ) {
2051 matchIndexes.push( i );
2053 return matchIndexes;
2056 "odd": createPositionalPseudo(function( matchIndexes, length ) {
2058 for ( ; i < length; i += 2 ) {
2059 matchIndexes.push( i );
2061 return matchIndexes;
2064 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2065 var i = argument < 0 ? argument + length : argument;
2066 for ( ; --i >= 0; ) {
2067 matchIndexes.push( i );
2069 return matchIndexes;
2072 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2073 var i = argument < 0 ? argument + length : argument;
2074 for ( ; ++i < length; ) {
2075 matchIndexes.push( i );
2077 return matchIndexes;
2082 Expr.pseudos["nth"] = Expr.pseudos["eq"];
2084 // Add button/input type pseudos
2085 for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
2086 Expr.pseudos[ i ] = createInputPseudo( i );
2088 for ( i in { submit: true, reset: true } ) {
2089 Expr.pseudos[ i ] = createButtonPseudo( i );
2092 // Easy API for creating new setFilters
2093 function setFilters() {}
2094 setFilters.prototype = Expr.filters = Expr.pseudos;
2095 Expr.setFilters = new setFilters();
2097 tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2098 var matched, match, tokens, type,
2099 soFar, groups, preFilters,
2100 cached = tokenCache[ selector + " " ];
2103 return parseOnly ? 0 : cached.slice( 0 );
2108 preFilters = Expr.preFilter;
2112 // Comma and first run
2113 if ( !matched || (match = rcomma.exec( soFar )) ) {
2115 // Don't consume trailing commas as valid
2116 soFar = soFar.slice( match[0].length ) || soFar;
2118 groups.push( (tokens = []) );
2124 if ( (match = rcombinators.exec( soFar )) ) {
2125 matched = match.shift();
2128 // Cast descendant combinators to space
2129 type: match[0].replace( rtrim, " " )
2131 soFar = soFar.slice( matched.length );
2135 for ( type in Expr.filter ) {
2136 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
2137 (match = preFilters[ type ]( match ))) ) {
2138 matched = match.shift();
2144 soFar = soFar.slice( matched.length );
2153 // Return the length of the invalid excess
2154 // if we're just parsing
2155 // Otherwise, throw an error or return tokens
2159 Sizzle.error( selector ) :
2161 tokenCache( selector, groups ).slice( 0 );
2164 function toSelector( tokens ) {
2166 len = tokens.length,
2168 for ( ; i < len; i++ ) {
2169 selector += tokens[i].value;
2174 function addCombinator( matcher, combinator, base ) {
2175 var dir = combinator.dir,
2176 checkNonElements = base && dir === "parentNode",
2179 return combinator.first ?
2180 // Check against closest ancestor/preceding element
2181 function( elem, context, xml ) {
2182 while ( (elem = elem[ dir ]) ) {
2183 if ( elem.nodeType === 1 || checkNonElements ) {
2184 return matcher( elem, context, xml );
2189 // Check against all ancestor/preceding elements
2190 function( elem, context, xml ) {
2191 var oldCache, uniqueCache, outerCache,
2192 newCache = [ dirruns, doneName ];
2194 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
2196 while ( (elem = elem[ dir ]) ) {
2197 if ( elem.nodeType === 1 || checkNonElements ) {
2198 if ( matcher( elem, context, xml ) ) {
2204 while ( (elem = elem[ dir ]) ) {
2205 if ( elem.nodeType === 1 || checkNonElements ) {
2206 outerCache = elem[ expando ] || (elem[ expando ] = {});
2208 // Support: IE <9 only
2209 // Defend against cloned attroperties (jQuery gh-1709)
2210 uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
2212 if ( (oldCache = uniqueCache[ dir ]) &&
2213 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2215 // Assign to newCache so results back-propagate to previous elements
2216 return (newCache[ 2 ] = oldCache[ 2 ]);
2218 // Reuse newcache so results back-propagate to previous elements
2219 uniqueCache[ dir ] = newCache;
2221 // A match means we're done; a fail means we have to keep checking
2222 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
2232 function elementMatcher( matchers ) {
2233 return matchers.length > 1 ?
2234 function( elem, context, xml ) {
2235 var i = matchers.length;
2237 if ( !matchers[i]( elem, context, xml ) ) {
2246 function multipleContexts( selector, contexts, results ) {
2248 len = contexts.length;
2249 for ( ; i < len; i++ ) {
2250 Sizzle( selector, contexts[i], results );
2255 function condense( unmatched, map, filter, context, xml ) {
2259 len = unmatched.length,
2260 mapped = map != null;
2262 for ( ; i < len; i++ ) {
2263 if ( (elem = unmatched[i]) ) {
2264 if ( !filter || filter( elem, context, xml ) ) {
2265 newUnmatched.push( elem );
2273 return newUnmatched;
2276 function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2277 if ( postFilter && !postFilter[ expando ] ) {
2278 postFilter = setMatcher( postFilter );
2280 if ( postFinder && !postFinder[ expando ] ) {
2281 postFinder = setMatcher( postFinder, postSelector );
2283 return markFunction(function( seed, results, context, xml ) {
2287 preexisting = results.length,
2289 // Get initial elements from seed or context
2290 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
2292 // Prefilter to get matcher input, preserving a map for seed-results synchronization
2293 matcherIn = preFilter && ( seed || !selector ) ?
2294 condense( elems, preMap, preFilter, context, xml ) :
2297 matcherOut = matcher ?
2298 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2299 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2301 // ...intermediate processing is necessary
2304 // ...otherwise use results directly
2308 // Find primary matches
2310 matcher( matcherIn, matcherOut, context, xml );
2315 temp = condense( matcherOut, postMap );
2316 postFilter( temp, [], context, xml );
2318 // Un-match failing elements by moving them back to matcherIn
2321 if ( (elem = temp[i]) ) {
2322 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
2328 if ( postFinder || preFilter ) {
2330 // Get the final matcherOut by condensing this intermediate into postFinder contexts
2332 i = matcherOut.length;
2334 if ( (elem = matcherOut[i]) ) {
2335 // Restore matcherIn since elem is not yet a final match
2336 temp.push( (matcherIn[i] = elem) );
2339 postFinder( null, (matcherOut = []), temp, xml );
2342 // Move matched elements from seed to results to keep them synchronized
2343 i = matcherOut.length;
2345 if ( (elem = matcherOut[i]) &&
2346 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
2348 seed[temp] = !(results[temp] = elem);
2353 // Add elements to results, through postFinder if defined
2355 matcherOut = condense(
2356 matcherOut === results ?
2357 matcherOut.splice( preexisting, matcherOut.length ) :
2361 postFinder( null, results, matcherOut, xml );
2363 push.apply( results, matcherOut );
2369 function matcherFromTokens( tokens ) {
2370 var checkContext, matcher, j,
2371 len = tokens.length,
2372 leadingRelative = Expr.relative[ tokens[0].type ],
2373 implicitRelative = leadingRelative || Expr.relative[" "],
2374 i = leadingRelative ? 1 : 0,
2376 // The foundational matcher ensures that elements are reachable from top-level context(s)
2377 matchContext = addCombinator( function( elem ) {
2378 return elem === checkContext;
2379 }, implicitRelative, true ),
2380 matchAnyContext = addCombinator( function( elem ) {
2381 return indexOf( checkContext, elem ) > -1;
2382 }, implicitRelative, true ),
2383 matchers = [ function( elem, context, xml ) {
2384 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2385 (checkContext = context).nodeType ?
2386 matchContext( elem, context, xml ) :
2387 matchAnyContext( elem, context, xml ) );
2388 // Avoid hanging onto element (issue #299)
2389 checkContext = null;
2393 for ( ; i < len; i++ ) {
2394 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
2395 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
2397 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
2399 // Return special upon seeing a positional matcher
2400 if ( matcher[ expando ] ) {
2401 // Find the next relative operator (if any) for proper handling
2403 for ( ; j < len; j++ ) {
2404 if ( Expr.relative[ tokens[j].type ] ) {
2409 i > 1 && elementMatcher( matchers ),
2410 i > 1 && toSelector(
2411 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2412 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
2413 ).replace( rtrim, "$1" ),
2415 i < j && matcherFromTokens( tokens.slice( i, j ) ),
2416 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
2417 j < len && toSelector( tokens )
2420 matchers.push( matcher );
2424 return elementMatcher( matchers );
2427 function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2428 var bySet = setMatchers.length > 0,
2429 byElement = elementMatchers.length > 0,
2430 superMatcher = function( seed, context, xml, results, outermost ) {
2431 var elem, j, matcher,
2434 unmatched = seed && [],
2436 contextBackup = outermostContext,
2437 // We must always have either seed elements or outermost context
2438 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
2439 // Use integer dirruns iff this is the outermost matcher
2440 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
2444 outermostContext = context === document || context || outermost;
2447 // Add elements passing elementMatchers directly to results
2448 // Support: IE<9, Safari
2449 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
2450 for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
2451 if ( byElement && elem ) {
2453 if ( !context && elem.ownerDocument !== document ) {
2454 setDocument( elem );
2455 xml = !documentIsHTML;
2457 while ( (matcher = elementMatchers[j++]) ) {
2458 if ( matcher( elem, context || document, xml) ) {
2459 results.push( elem );
2464 dirruns = dirrunsUnique;
2468 // Track unmatched elements for set filters
2470 // They will have gone through all possible matchers
2471 if ( (elem = !matcher && elem) ) {
2475 // Lengthen the array for every element, matched or not
2477 unmatched.push( elem );
2482 // `i` is now the count of elements visited above, and adding it to `matchedCount`
2483 // makes the latter nonnegative.
2486 // Apply set filters to unmatched elements
2487 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
2488 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
2489 // no element matchers and no seed.
2490 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
2491 // case, which will result in a "00" `matchedCount` that differs from `i` but is also
2492 // numerically zero.
2493 if ( bySet && i !== matchedCount ) {
2495 while ( (matcher = setMatchers[j++]) ) {
2496 matcher( unmatched, setMatched, context, xml );
2500 // Reintegrate element matches to eliminate the need for sorting
2501 if ( matchedCount > 0 ) {
2503 if ( !(unmatched[i] || setMatched[i]) ) {
2504 setMatched[i] = pop.call( results );
2509 // Discard index placeholder values to get only actual matches
2510 setMatched = condense( setMatched );
2513 // Add matches to results
2514 push.apply( results, setMatched );
2516 // Seedless set matches succeeding multiple successful matchers stipulate sorting
2517 if ( outermost && !seed && setMatched.length > 0 &&
2518 ( matchedCount + setMatchers.length ) > 1 ) {
2520 Sizzle.uniqueSort( results );
2524 // Override manipulation of globals by nested matchers
2526 dirruns = dirrunsUnique;
2527 outermostContext = contextBackup;
2534 markFunction( superMatcher ) :
2538 compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2541 elementMatchers = [],
2542 cached = compilerCache[ selector + " " ];
2545 // Generate a function of recursive functions that can be used to check each element
2547 match = tokenize( selector );
2551 cached = matcherFromTokens( match[i] );
2552 if ( cached[ expando ] ) {
2553 setMatchers.push( cached );
2555 elementMatchers.push( cached );
2559 // Cache the compiled function
2560 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2562 // Save selector and tokenization
2563 cached.selector = selector;
2569 * A low-level selection function that works with Sizzle's compiled
2570 * selector functions
2571 * @param {String|Function} selector A selector or a pre-compiled
2572 * selector function built with Sizzle.compile
2573 * @param {Element} context
2574 * @param {Array} [results]
2575 * @param {Array} [seed] A set of elements to match against
2577 select = Sizzle.select = function( selector, context, results, seed ) {
2578 var i, tokens, token, type, find,
2579 compiled = typeof selector === "function" && selector,
2580 match = !seed && tokenize( (selector = compiled.selector || selector) );
2582 results = results || [];
2584 // Try to minimize operations if there is only one selector in the list and no seed
2585 // (the latter of which guarantees us context)
2586 if ( match.length === 1 ) {
2588 // Reduce context if the leading compound selector is an ID
2589 tokens = match[0] = match[0].slice( 0 );
2590 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
2591 support.getById && context.nodeType === 9 && documentIsHTML &&
2592 Expr.relative[ tokens[1].type ] ) {
2594 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
2598 // Precompiled matchers will still verify ancestry, so step up a level
2599 } else if ( compiled ) {
2600 context = context.parentNode;
2603 selector = selector.slice( tokens.shift().value.length );
2606 // Fetch a seed set for right-to-left matching
2607 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
2611 // Abort if we hit a combinator
2612 if ( Expr.relative[ (type = token.type) ] ) {
2615 if ( (find = Expr.find[ type ]) ) {
2616 // Search, expanding context for leading sibling combinators
2618 token.matches[0].replace( runescape, funescape ),
2619 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
2622 // If seed is empty or no tokens remain, we can return early
2623 tokens.splice( i, 1 );
2624 selector = seed.length && toSelector( tokens );
2626 push.apply( results, seed );
2636 // Compile and execute a filtering function if one is not provided
2637 // Provide `match` to avoid retokenization if we modified the selector above
2638 ( compiled || compile( selector, match ) )(
2643 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
2648 // One-time assignments
2651 support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
2653 // Support: Chrome 14-35+
2654 // Always assume duplicates if they aren't passed to the comparison function
2655 support.detectDuplicates = !!hasDuplicate;
2657 // Initialize against the default document
2660 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
2661 // Detached nodes confoundingly follow *each other*
2662 support.sortDetached = assert(function( div1 ) {
2663 // Should return 1, but returns 4 (following)
2664 return div1.compareDocumentPosition( document.createElement("div") ) & 1;
2668 // Prevent attribute/property "interpolation"
2669 // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2670 if ( !assert(function( div ) {
2671 div.innerHTML = "<a href='#'></a>";
2672 return div.firstChild.getAttribute("href") === "#" ;
2674 addHandle( "type|href|height|width", function( elem, name, isXML ) {
2676 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
2682 // Use defaultValue in place of getAttribute("value")
2683 if ( !support.attributes || !assert(function( div ) {
2684 div.innerHTML = "<input/>";
2685 div.firstChild.setAttribute( "value", "" );
2686 return div.firstChild.getAttribute( "value" ) === "";
2688 addHandle( "value", function( elem, name, isXML ) {
2689 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
2690 return elem.defaultValue;
2696 // Use getAttributeNode to fetch booleans when getAttribute lies
2697 if ( !assert(function( div ) {
2698 return div.getAttribute("disabled") == null;
2700 addHandle( booleans, function( elem, name, isXML ) {
2703 return elem[ name ] === true ? name.toLowerCase() :
2704 (val = elem.getAttributeNode( name )) && val.specified ?
2717 jQuery.find = Sizzle;
2718 jQuery.expr = Sizzle.selectors;
2719 jQuery.expr[ ":" ] = jQuery.expr.pseudos;
2720 jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
2721 jQuery.text = Sizzle.getText;
2722 jQuery.isXMLDoc = Sizzle.isXML;
2723 jQuery.contains = Sizzle.contains;
2727 var dir = function( elem, dir, until ) {
2729 truncate = until !== undefined;
2731 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
2732 if ( elem.nodeType === 1 ) {
2733 if ( truncate && jQuery( elem ).is( until ) ) {
2736 matched.push( elem );
2743 var siblings = function( n, elem ) {
2746 for ( ; n; n = n.nextSibling ) {
2747 if ( n.nodeType === 1 && n !== elem ) {
2756 var rneedsContext = jQuery.expr.match.needsContext;
2758 var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ );
2762 var risSimple = /^.[^:#\[\.,]*$/;
2764 // Implement the identical functionality for filter and not
2765 function winnow( elements, qualifier, not ) {
2766 if ( jQuery.isFunction( qualifier ) ) {
2767 return jQuery.grep( elements, function( elem, i ) {
2769 return !!qualifier.call( elem, i, elem ) !== not;
2774 if ( qualifier.nodeType ) {
2775 return jQuery.grep( elements, function( elem ) {
2776 return ( elem === qualifier ) !== not;
2781 if ( typeof qualifier === "string" ) {
2782 if ( risSimple.test( qualifier ) ) {
2783 return jQuery.filter( qualifier, elements, not );
2786 qualifier = jQuery.filter( qualifier, elements );
2789 return jQuery.grep( elements, function( elem ) {
2790 return ( jQuery.inArray( elem, qualifier ) > -1 ) !== not;
2794 jQuery.filter = function( expr, elems, not ) {
2795 var elem = elems[ 0 ];
2798 expr = ":not(" + expr + ")";
2801 return elems.length === 1 && elem.nodeType === 1 ?
2802 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
2803 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
2804 return elem.nodeType === 1;
2809 find: function( selector ) {
2815 if ( typeof selector !== "string" ) {
2816 return this.pushStack( jQuery( selector ).filter( function() {
2817 for ( i = 0; i < len; i++ ) {
2818 if ( jQuery.contains( self[ i ], this ) ) {
2825 for ( i = 0; i < len; i++ ) {
2826 jQuery.find( selector, self[ i ], ret );
2829 // Needed because $( selector, context ) becomes $( context ).find( selector )
2830 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
2831 ret.selector = this.selector ? this.selector + " " + selector : selector;
2834 filter: function( selector ) {
2835 return this.pushStack( winnow( this, selector || [], false ) );
2837 not: function( selector ) {
2838 return this.pushStack( winnow( this, selector || [], true ) );
2840 is: function( selector ) {
2844 // If this is a positional/relative selector, check membership in the returned set
2845 // so $("p:first").is("p:last") won't return true for a doc with two "p".
2846 typeof selector === "string" && rneedsContext.test( selector ) ?
2847 jQuery( selector ) :
2855 // Initialize a jQuery object
2858 // A central reference to the root jQuery(document)
2861 // A simple way to check for HTML strings
2862 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
2863 // Strict HTML recognition (#11290: must start with <)
2864 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
2866 init = jQuery.fn.init = function( selector, context, root ) {
2869 // HANDLE: $(""), $(null), $(undefined), $(false)
2874 // init accepts an alternate rootjQuery
2875 // so migrate can support jQuery.sub (gh-2101)
2876 root = root || rootjQuery;
2878 // Handle HTML strings
2879 if ( typeof selector === "string" ) {
2880 if ( selector.charAt( 0 ) === "<" &&