weekly release 3.1dev
[moodle.git] / lib / jquery / jquery-1.11.3.js
1 /*!
2  * jQuery JavaScript Library v1.11.3
3  * http://jquery.com/
4  *
5  * Includes Sizzle.js
6  * http://sizzlejs.com/
7  *
8  * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
9  * Released under the MIT license
10  * http://jquery.org/license
11  *
12  * Date: 2015-04-28T16:19Z
13  */
15 (function( global, factory ) {
17         if ( typeof module === "object" && typeof module.exports === "object" ) {
18                 // For CommonJS and CommonJS-like environments where a proper window is present,
19                 // execute the factory and get jQuery
20                 // For environments that do not inherently posses a window with a document
21                 // (such as Node.js), expose a jQuery-making factory as module.exports
22                 // This accentuates the need for the creation of a real window
23                 // e.g. var jQuery = require("jquery")(window);
24                 // See ticket #14549 for more info
25                 module.exports = global.document ?
26                         factory( global, true ) :
27                         function( w ) {
28                                 if ( !w.document ) {
29                                         throw new Error( "jQuery requires a window with a document" );
30                                 }
31                                 return factory( w );
32                         };
33         } else {
34                 factory( global );
35         }
37 // Pass this if window is not defined yet
38 }(typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
40 // Can't do this because several apps including ASP.NET trace
41 // the stack via arguments.caller.callee and Firefox dies if
42 // you try to trace through "use strict" call chains. (#13335)
43 // Support: Firefox 18+
44 //
46 var deletedIds = [];
48 var slice = deletedIds.slice;
50 var concat = deletedIds.concat;
52 var push = deletedIds.push;
54 var indexOf = deletedIds.indexOf;
56 var class2type = {};
58 var toString = class2type.toString;
60 var hasOwn = class2type.hasOwnProperty;
62 var support = {};
66 var
67         version = "1.11.3",
69         // Define a local copy of jQuery
70         jQuery = function( selector, context ) {
71                 // The jQuery object is actually just the init constructor 'enhanced'
72                 // Need init if jQuery is called (just allow error to be thrown if not included)
73                 return new jQuery.fn.init( selector, context );
74         },
76         // Support: Android<4.1, IE<9
77         // Make sure we trim BOM and NBSP
78         rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
80         // Matches dashed string for camelizing
81         rmsPrefix = /^-ms-/,
82         rdashAlpha = /-([\da-z])/gi,
84         // Used by jQuery.camelCase as callback to replace()
85         fcamelCase = function( all, letter ) {
86                 return letter.toUpperCase();
87         };
89 jQuery.fn = jQuery.prototype = {
90         // The current version of jQuery being used
91         jquery: version,
93         constructor: jQuery,
95         // Start with an empty selector
96         selector: "",
98         // The default length of a jQuery object is 0
99         length: 0,
101         toArray: function() {
102                 return slice.call( this );
103         },
105         // Get the Nth element in the matched element set OR
106         // Get the whole matched element set as a clean array
107         get: function( num ) {
108                 return num != null ?
110                         // Return just the one element from the set
111                         ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
113                         // Return all the elements in a clean array
114                         slice.call( this );
115         },
117         // Take an array of elements and push it onto the stack
118         // (returning the new matched element set)
119         pushStack: function( elems ) {
121                 // Build a new jQuery matched element set
122                 var ret = jQuery.merge( this.constructor(), elems );
124                 // Add the old object onto the stack (as a reference)
125                 ret.prevObject = this;
126                 ret.context = this.context;
128                 // Return the newly-formed element set
129                 return ret;
130         },
132         // Execute a callback for every element in the matched set.
133         // (You can seed the arguments with an array of args, but this is
134         // only used internally.)
135         each: function( callback, args ) {
136                 return jQuery.each( this, callback, args );
137         },
139         map: function( callback ) {
140                 return this.pushStack( jQuery.map(this, function( elem, i ) {
141                         return callback.call( elem, i, elem );
142                 }));
143         },
145         slice: function() {
146                 return this.pushStack( slice.apply( this, arguments ) );
147         },
149         first: function() {
150                 return this.eq( 0 );
151         },
153         last: function() {
154                 return this.eq( -1 );
155         },
157         eq: function( i ) {
158                 var len = this.length,
159                         j = +i + ( i < 0 ? len : 0 );
160                 return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
161         },
163         end: function() {
164                 return this.prevObject || this.constructor(null);
165         },
167         // For internal use only.
168         // Behaves like an Array's method, not like a jQuery method.
169         push: push,
170         sort: deletedIds.sort,
171         splice: deletedIds.splice
172 };
174 jQuery.extend = jQuery.fn.extend = function() {
175         var src, copyIsArray, copy, name, options, clone,
176                 target = arguments[0] || {},
177                 i = 1,
178                 length = arguments.length,
179                 deep = false;
181         // Handle a deep copy situation
182         if ( typeof target === "boolean" ) {
183                 deep = target;
185                 // skip the boolean and the target
186                 target = arguments[ i ] || {};
187                 i++;
188         }
190         // Handle case when target is a string or something (possible in deep copy)
191         if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
192                 target = {};
193         }
195         // extend jQuery itself if only one argument is passed
196         if ( i === length ) {
197                 target = this;
198                 i--;
199         }
201         for ( ; i < length; i++ ) {
202                 // Only deal with non-null/undefined values
203                 if ( (options = arguments[ i ]) != null ) {
204                         // Extend the base object
205                         for ( name in options ) {
206                                 src = target[ name ];
207                                 copy = options[ name ];
209                                 // Prevent never-ending loop
210                                 if ( target === copy ) {
211                                         continue;
212                                 }
214                                 // Recurse if we're merging plain objects or arrays
215                                 if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
216                                         if ( copyIsArray ) {
217                                                 copyIsArray = false;
218                                                 clone = src && jQuery.isArray(src) ? src : [];
220                                         } else {
221                                                 clone = src && jQuery.isPlainObject(src) ? src : {};
222                                         }
224                                         // Never move original objects, clone them
225                                         target[ name ] = jQuery.extend( deep, clone, copy );
227                                 // Don't bring in undefined values
228                                 } else if ( copy !== undefined ) {
229                                         target[ name ] = copy;
230                                 }
231                         }
232                 }
233         }
235         // Return the modified object
236         return target;
237 };
239 jQuery.extend({
240         // Unique for each copy of jQuery on the page
241         expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
243         // Assume jQuery is ready without the ready module
244         isReady: true,
246         error: function( msg ) {
247                 throw new Error( msg );
248         },
250         noop: function() {},
252         // See test/unit/core.js for details concerning isFunction.
253         // Since version 1.3, DOM methods and functions like alert
254         // aren't supported. They return false on IE (#2968).
255         isFunction: function( obj ) {
256                 return jQuery.type(obj) === "function";
257         },
259         isArray: Array.isArray || function( obj ) {
260                 return jQuery.type(obj) === "array";
261         },
263         isWindow: function( obj ) {
264                 /* jshint eqeqeq: false */
265                 return obj != null && obj == obj.window;
266         },
268         isNumeric: function( obj ) {
269                 // parseFloat NaNs numeric-cast false positives (null|true|false|"")
270                 // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
271                 // subtraction forces infinities to NaN
272                 // adding 1 corrects loss of precision from parseFloat (#15100)
273                 return !jQuery.isArray( obj ) && (obj - parseFloat( obj ) + 1) >= 0;
274         },
276         isEmptyObject: function( obj ) {
277                 var name;
278                 for ( name in obj ) {
279                         return false;
280                 }
281                 return true;
282         },
284         isPlainObject: function( obj ) {
285                 var key;
287                 // Must be an Object.
288                 // Because of IE, we also have to check the presence of the constructor property.
289                 // Make sure that DOM nodes and window objects don't pass through, as well
290                 if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
291                         return false;
292                 }
294                 try {
295                         // Not own constructor property must be Object
296                         if ( obj.constructor &&
297                                 !hasOwn.call(obj, "constructor") &&
298                                 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
299                                 return false;
300                         }
301                 } catch ( e ) {
302                         // IE8,9 Will throw exceptions on certain host objects #9897
303                         return false;
304                 }
306                 // Support: IE<9
307                 // Handle iteration over inherited properties before own properties.
308                 if ( support.ownLast ) {
309                         for ( key in obj ) {
310                                 return hasOwn.call( obj, key );
311                         }
312                 }
314                 // Own properties are enumerated firstly, so to speed up,
315                 // if last one is own, then all properties are own.
316                 for ( key in obj ) {}
318                 return key === undefined || hasOwn.call( obj, key );
319         },
321         type: function( obj ) {
322                 if ( obj == null ) {
323                         return obj + "";
324                 }
325                 return typeof obj === "object" || typeof obj === "function" ?
326                         class2type[ toString.call(obj) ] || "object" :
327                         typeof obj;
328         },
330         // Evaluates a script in a global context
331         // Workarounds based on findings by Jim Driscoll
332         // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
333         globalEval: function( data ) {
334                 if ( data && jQuery.trim( data ) ) {
335                         // We use execScript on Internet Explorer
336                         // We use an anonymous function so that context is window
337                         // rather than jQuery in Firefox
338                         ( window.execScript || function( data ) {
339                                 window[ "eval" ].call( window, data );
340                         } )( data );
341                 }
342         },
344         // Convert dashed to camelCase; used by the css and data modules
345         // Microsoft forgot to hump their vendor prefix (#9572)
346         camelCase: function( string ) {
347                 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
348         },
350         nodeName: function( elem, name ) {
351                 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
352         },
354         // args is for internal usage only
355         each: function( obj, callback, args ) {
356                 var value,
357                         i = 0,
358                         length = obj.length,
359                         isArray = isArraylike( obj );
361                 if ( args ) {
362                         if ( isArray ) {
363                                 for ( ; i < length; i++ ) {
364                                         value = callback.apply( obj[ i ], args );
366                                         if ( value === false ) {
367                                                 break;
368                                         }
369                                 }
370                         } else {
371                                 for ( i in obj ) {
372                                         value = callback.apply( obj[ i ], args );
374                                         if ( value === false ) {
375                                                 break;
376                                         }
377                                 }
378                         }
380                 // A special, fast, case for the most common use of each
381                 } else {
382                         if ( isArray ) {
383                                 for ( ; i < length; i++ ) {
384                                         value = callback.call( obj[ i ], i, obj[ i ] );
386                                         if ( value === false ) {
387                                                 break;
388                                         }
389                                 }
390                         } else {
391                                 for ( i in obj ) {
392                                         value = callback.call( obj[ i ], i, obj[ i ] );
394                                         if ( value === false ) {
395                                                 break;
396                                         }
397                                 }
398                         }
399                 }
401                 return obj;
402         },
404         // Support: Android<4.1, IE<9
405         trim: function( text ) {
406                 return text == null ?
407                         "" :
408                         ( text + "" ).replace( rtrim, "" );
409         },
411         // results is for internal usage only
412         makeArray: function( arr, results ) {
413                 var ret = results || [];
415                 if ( arr != null ) {
416                         if ( isArraylike( Object(arr) ) ) {
417                                 jQuery.merge( ret,
418                                         typeof arr === "string" ?
419                                         [ arr ] : arr
420                                 );
421                         } else {
422                                 push.call( ret, arr );
423                         }
424                 }
426                 return ret;
427         },
429         inArray: function( elem, arr, i ) {
430                 var len;
432                 if ( arr ) {
433                         if ( indexOf ) {
434                                 return indexOf.call( arr, elem, i );
435                         }
437                         len = arr.length;
438                         i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
440                         for ( ; i < len; i++ ) {
441                                 // Skip accessing in sparse arrays
442                                 if ( i in arr && arr[ i ] === elem ) {
443                                         return i;
444                                 }
445                         }
446                 }
448                 return -1;
449         },
451         merge: function( first, second ) {
452                 var len = +second.length,
453                         j = 0,
454                         i = first.length;
456                 while ( j < len ) {
457                         first[ i++ ] = second[ j++ ];
458                 }
460                 // Support: IE<9
461                 // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists)
462                 if ( len !== len ) {
463                         while ( second[j] !== undefined ) {
464                                 first[ i++ ] = second[ j++ ];
465                         }
466                 }
468                 first.length = i;
470                 return first;
471         },
473         grep: function( elems, callback, invert ) {
474                 var callbackInverse,
475                         matches = [],
476                         i = 0,
477                         length = elems.length,
478                         callbackExpect = !invert;
480                 // Go through the array, only saving the items
481                 // that pass the validator function
482                 for ( ; i < length; i++ ) {
483                         callbackInverse = !callback( elems[ i ], i );
484                         if ( callbackInverse !== callbackExpect ) {
485                                 matches.push( elems[ i ] );
486                         }
487                 }
489                 return matches;
490         },
492         // arg is for internal usage only
493         map: function( elems, callback, arg ) {
494                 var value,
495                         i = 0,
496                         length = elems.length,
497                         isArray = isArraylike( elems ),
498                         ret = [];
500                 // Go through the array, translating each of the items to their new values
501                 if ( isArray ) {
502                         for ( ; i < length; i++ ) {
503                                 value = callback( elems[ i ], i, arg );
505                                 if ( value != null ) {
506                                         ret.push( value );
507                                 }
508                         }
510                 // Go through every key on the object,
511                 } else {
512                         for ( i in elems ) {
513                                 value = callback( elems[ i ], i, arg );
515                                 if ( value != null ) {
516                                         ret.push( value );
517                                 }
518                         }
519                 }
521                 // Flatten any nested arrays
522                 return concat.apply( [], ret );
523         },
525         // A global GUID counter for objects
526         guid: 1,
528         // Bind a function to a context, optionally partially applying any
529         // arguments.
530         proxy: function( fn, context ) {
531                 var args, proxy, tmp;
533                 if ( typeof context === "string" ) {
534                         tmp = fn[ context ];
535                         context = fn;
536                         fn = tmp;
537                 }
539                 // Quick check to determine if target is callable, in the spec
540                 // this throws a TypeError, but we will just return undefined.
541                 if ( !jQuery.isFunction( fn ) ) {
542                         return undefined;
543                 }
545                 // Simulated bind
546                 args = slice.call( arguments, 2 );
547                 proxy = function() {
548                         return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
549                 };
551                 // Set the guid of unique handler to the same of original handler, so it can be removed
552                 proxy.guid = fn.guid = fn.guid || jQuery.guid++;
554                 return proxy;
555         },
557         now: function() {
558                 return +( new Date() );
559         },
561         // jQuery.support is not used in Core but other projects attach their
562         // properties to it so it needs to exist.
563         support: support
564 });
566 // Populate the class2type map
567 jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
568         class2type[ "[object " + name + "]" ] = name.toLowerCase();
569 });
571 function isArraylike( obj ) {
573         // Support: iOS 8.2 (not reproducible in simulator)
574         // `in` check used to prevent JIT error (gh-2145)
575         // hasOwn isn't used here due to false negatives
576         // regarding Nodelist length in IE
577         var length = "length" in obj && obj.length,
578                 type = jQuery.type( obj );
580         if ( type === "function" || jQuery.isWindow( obj ) ) {
581                 return false;
582         }
584         if ( obj.nodeType === 1 && length ) {
585                 return true;
586         }
588         return type === "array" || length === 0 ||
589                 typeof length === "number" && length > 0 && ( length - 1 ) in obj;
591 var Sizzle =
592 /*!
593  * Sizzle CSS Selector Engine v2.2.0-pre
594  * http://sizzlejs.com/
595  *
596  * Copyright 2008, 2014 jQuery Foundation, Inc. and other contributors
597  * Released under the MIT license
598  * http://jquery.org/license
599  *
600  * Date: 2014-12-16
601  */
602 (function( window ) {
604 var i,
605         support,
606         Expr,
607         getText,
608         isXML,
609         tokenize,
610         compile,
611         select,
612         outermostContext,
613         sortInput,
614         hasDuplicate,
616         // Local document vars
617         setDocument,
618         document,
619         docElem,
620         documentIsHTML,
621         rbuggyQSA,
622         rbuggyMatches,
623         matches,
624         contains,
626         // Instance-specific data
627         expando = "sizzle" + 1 * new Date(),
628         preferredDoc = window.document,
629         dirruns = 0,
630         done = 0,
631         classCache = createCache(),
632         tokenCache = createCache(),
633         compilerCache = createCache(),
634         sortOrder = function( a, b ) {
635                 if ( a === b ) {
636                         hasDuplicate = true;
637                 }
638                 return 0;
639         },
641         // General-purpose constants
642         MAX_NEGATIVE = 1 << 31,
644         // Instance methods
645         hasOwn = ({}).hasOwnProperty,
646         arr = [],
647         pop = arr.pop,
648         push_native = arr.push,
649         push = arr.push,
650         slice = arr.slice,
651         // Use a stripped-down indexOf as it's faster than native
652         // http://jsperf.com/thor-indexof-vs-for/5
653         indexOf = function( list, elem ) {
654                 var i = 0,
655                         len = list.length;
656                 for ( ; i < len; i++ ) {
657                         if ( list[i] === elem ) {
658                                 return i;
659                         }
660                 }
661                 return -1;
662         },
664         booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
666         // Regular expressions
668         // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace
669         whitespace = "[\\x20\\t\\r\\n\\f]",
670         // http://www.w3.org/TR/css3-syntax/#characters
671         characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",
673         // Loosely modeled on CSS identifier characters
674         // An unquoted value should be a CSS identifier http://www.w3.org/TR/css3-selectors/#attribute-selectors
675         // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
676         identifier = characterEncoding.replace( "w", "w#" ),
678         // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
679         attributes = "\\[" + whitespace + "*(" + characterEncoding + ")(?:" + whitespace +
680                 // Operator (capture 2)
681                 "*([*^$|!~]?=)" + whitespace +
682                 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
683                 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
684                 "*\\]",
686         pseudos = ":(" + characterEncoding + ")(?:\\((" +
687                 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
688                 // 1. quoted (capture 3; capture 4 or capture 5)
689                 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
690                 // 2. simple (capture 6)
691                 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
692                 // 3. anything else (capture 2)
693                 ".*" +
694                 ")\\)|)",
696         // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
697         rwhitespace = new RegExp( whitespace + "+", "g" ),
698         rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
700         rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
701         rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
703         rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
705         rpseudo = new RegExp( pseudos ),
706         ridentifier = new RegExp( "^" + identifier + "$" ),
708         matchExpr = {
709                 "ID": new RegExp( "^#(" + characterEncoding + ")" ),
710                 "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ),
711                 "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ),
712                 "ATTR": new RegExp( "^" + attributes ),
713                 "PSEUDO": new RegExp( "^" + pseudos ),
714                 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
715                         "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
716                         "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
717                 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
718                 // For use in libraries implementing .is()
719                 // We use this for POS matching in `select`
720                 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
721                         whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
722         },
724         rinputs = /^(?:input|select|textarea|button)$/i,
725         rheader = /^h\d$/i,
727         rnative = /^[^{]+\{\s*\[native \w/,
729         // Easily-parseable/retrievable ID or TAG or CLASS selectors
730         rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
732         rsibling = /[+~]/,
733         rescape = /'|\\/g,
735         // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
736         runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
737         funescape = function( _, escaped, escapedWhitespace ) {
738                 var high = "0x" + escaped - 0x10000;
739                 // NaN means non-codepoint
740                 // Support: Firefox<24
741                 // Workaround erroneous numeric interpretation of +"0x"
742                 return high !== high || escapedWhitespace ?
743                         escaped :
744                         high < 0 ?
745                                 // BMP codepoint
746                                 String.fromCharCode( high + 0x10000 ) :
747                                 // Supplemental Plane codepoint (surrogate pair)
748                                 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
749         },
751         // Used for iframes
752         // See setDocument()
753         // Removing the function wrapper causes a "Permission Denied"
754         // error in IE
755         unloadHandler = function() {
756                 setDocument();
757         };
759 // Optimize for push.apply( _, NodeList )
760 try {
761         push.apply(
762                 (arr = slice.call( preferredDoc.childNodes )),
763                 preferredDoc.childNodes
764         );
765         // Support: Android<4.0
766         // Detect silently failing push.apply
767         arr[ preferredDoc.childNodes.length ].nodeType;
768 } catch ( e ) {
769         push = { apply: arr.length ?
771                 // Leverage slice if possible
772                 function( target, els ) {
773                         push_native.apply( target, slice.call(els) );
774                 } :
776                 // Support: IE<9
777                 // Otherwise append directly
778                 function( target, els ) {
779                         var j = target.length,
780                                 i = 0;
781                         // Can't trust NodeList.length
782                         while ( (target[j++] = els[i++]) ) {}
783                         target.length = j - 1;
784                 }
785         };
788 function Sizzle( selector, context, results, seed ) {
789         var match, elem, m, nodeType,
790                 // QSA vars
791                 i, groups, old, nid, newContext, newSelector;
793         if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
794                 setDocument( context );
795         }
797         context = context || document;
798         results = results || [];
799         nodeType = context.nodeType;
801         if ( typeof selector !== "string" || !selector ||
802                 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
804                 return results;
805         }
807         if ( !seed && documentIsHTML ) {
809                 // Try to shortcut find operations when possible (e.g., not under DocumentFragment)
810                 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
811                         // Speed-up: Sizzle("#ID")
812                         if ( (m = match[1]) ) {
813                                 if ( nodeType === 9 ) {
814                                         elem = context.getElementById( m );
815                                         // Check parentNode to catch when Blackberry 4.6 returns
816                                         // nodes that are no longer in the document (jQuery #6963)
817                                         if ( elem && elem.parentNode ) {
818                                                 // Handle the case where IE, Opera, and Webkit return items
819                                                 // by name instead of ID
820                                                 if ( elem.id === m ) {
821                                                         results.push( elem );
822                                                         return results;
823                                                 }
824                                         } else {
825                                                 return results;
826                                         }
827                                 } else {
828                                         // Context is not a document
829                                         if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&
830                                                 contains( context, elem ) && elem.id === m ) {
831                                                 results.push( elem );
832                                                 return results;
833                                         }
834                                 }
836                         // Speed-up: Sizzle("TAG")
837                         } else if ( match[2] ) {
838                                 push.apply( results, context.getElementsByTagName( selector ) );
839                                 return results;
841                         // Speed-up: Sizzle(".CLASS")
842                         } else if ( (m = match[3]) && support.getElementsByClassName ) {
843                                 push.apply( results, context.getElementsByClassName( m ) );
844                                 return results;
845                         }
846                 }
848                 // QSA path
849                 if ( support.qsa && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
850                         nid = old = expando;
851                         newContext = context;
852                         newSelector = nodeType !== 1 && selector;
854                         // qSA works strangely on Element-rooted queries
855                         // We can work around this by specifying an extra ID on the root
856                         // and working up from there (Thanks to Andrew Dupont for the technique)
857                         // IE 8 doesn't work on object elements
858                         if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
859                                 groups = tokenize( selector );
861                                 if ( (old = context.getAttribute("id")) ) {
862                                         nid = old.replace( rescape, "\\$&" );
863                                 } else {
864                                         context.setAttribute( "id", nid );
865                                 }
866                                 nid = "[id='" + nid + "'] ";
868                                 i = groups.length;
869                                 while ( i-- ) {
870                                         groups[i] = nid + toSelector( groups[i] );
871                                 }
872                                 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || context;
873                                 newSelector = groups.join(",");
874                         }
876                         if ( newSelector ) {
877                                 try {
878                                         push.apply( results,
879                                                 newContext.querySelectorAll( newSelector )
880                                         );
881                                         return results;
882                                 } catch(qsaError) {
883                                 } finally {
884                                         if ( !old ) {
885                                                 context.removeAttribute("id");
886                                         }
887                                 }
888                         }
889                 }
890         }
892         // All others
893         return select( selector.replace( rtrim, "$1" ), context, results, seed );
896 /**
897  * Create key-value caches of limited size
898  * @returns {Function(string, Object)} Returns the Object data after storing it on itself with
899  *      property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
900  *      deleting the oldest entry
901  */
902 function createCache() {
903         var keys = [];
905         function cache( key, value ) {
906                 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
907                 if ( keys.push( key + " " ) > Expr.cacheLength ) {
908                         // Only keep the most recent entries
909                         delete cache[ keys.shift() ];
910                 }
911                 return (cache[ key + " " ] = value);
912         }
913         return cache;
916 /**
917  * Mark a function for special use by Sizzle
918  * @param {Function} fn The function to mark
919  */
920 function markFunction( fn ) {
921         fn[ expando ] = true;
922         return fn;
925 /**
926  * Support testing using an element
927  * @param {Function} fn Passed the created div and expects a boolean result
928  */
929 function assert( fn ) {
930         var div = document.createElement("div");
932         try {
933                 return !!fn( div );
934         } catch (e) {
935                 return false;
936         } finally {
937                 // Remove from its parent by default
938                 if ( div.parentNode ) {
939                         div.parentNode.removeChild( div );
940                 }
941                 // release memory in IE
942                 div = null;
943         }
946 /**
947  * Adds the same handler for all of the specified attrs
948  * @param {String} attrs Pipe-separated list of attributes
949  * @param {Function} handler The method that will be applied
950  */
951 function addHandle( attrs, handler ) {
952         var arr = attrs.split("|"),
953                 i = attrs.length;
955         while ( i-- ) {
956                 Expr.attrHandle[ arr[i] ] = handler;
957         }
960 /**
961  * Checks document order of two siblings
962  * @param {Element} a
963  * @param {Element} b
964  * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
965  */
966 function siblingCheck( a, b ) {
967         var cur = b && a,
968                 diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
969                         ( ~b.sourceIndex || MAX_NEGATIVE ) -
970                         ( ~a.sourceIndex || MAX_NEGATIVE );
972         // Use IE sourceIndex if available on both nodes
973         if ( diff ) {
974                 return diff;
975         }
977         // Check if b follows a
978         if ( cur ) {
979                 while ( (cur = cur.nextSibling) ) {
980                         if ( cur === b ) {
981                                 return -1;
982                         }
983                 }
984         }
986         return a ? 1 : -1;
989 /**
990  * Returns a function to use in pseudos for input types
991  * @param {String} type
992  */
993 function createInputPseudo( type ) {
994         return function( elem ) {
995                 var name = elem.nodeName.toLowerCase();
996                 return name === "input" && elem.type === type;
997         };
1000 /**
1001  * Returns a function to use in pseudos for buttons
1002  * @param {String} type
1003  */
1004 function createButtonPseudo( type ) {
1005         return function( elem ) {
1006                 var name = elem.nodeName.toLowerCase();
1007                 return (name === "input" || name === "button") && elem.type === type;
1008         };
1011 /**
1012  * Returns a function to use in pseudos for positionals
1013  * @param {Function} fn
1014  */
1015 function createPositionalPseudo( fn ) {
1016         return markFunction(function( argument ) {
1017                 argument = +argument;
1018                 return markFunction(function( seed, matches ) {
1019                         var j,
1020                                 matchIndexes = fn( [], seed.length, argument ),
1021                                 i = matchIndexes.length;
1023                         // Match elements found at the specified indexes
1024                         while ( i-- ) {
1025                                 if ( seed[ (j = matchIndexes[i]) ] ) {
1026                                         seed[j] = !(matches[j] = seed[j]);
1027                                 }
1028                         }
1029                 });
1030         });
1033 /**
1034  * Checks a node for validity as a Sizzle context
1035  * @param {Element|Object=} context
1036  * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
1037  */
1038 function testContext( context ) {
1039         return context && typeof context.getElementsByTagName !== "undefined" && context;
1042 // Expose support vars for convenience
1043 support = Sizzle.support = {};
1045 /**
1046  * Detects XML nodes
1047  * @param {Element|Object} elem An element or a document
1048  * @returns {Boolean} True iff elem is a non-HTML XML node
1049  */
1050 isXML = Sizzle.isXML = function( elem ) {
1051         // documentElement is verified for cases where it doesn't yet exist
1052         // (such as loading iframes in IE - #4833)
1053         var documentElement = elem && (elem.ownerDocument || elem).documentElement;
1054         return documentElement ? documentElement.nodeName !== "HTML" : false;
1055 };
1057 /**
1058  * Sets document-related variables once based on the current document
1059  * @param {Element|Object} [doc] An element or document object to use to set the document
1060  * @returns {Object} Returns the current document
1061  */
1062 setDocument = Sizzle.setDocument = function( node ) {
1063         var hasCompare, parent,
1064                 doc = node ? node.ownerDocument || node : preferredDoc;
1066         // If no document and documentElement is available, return
1067         if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
1068                 return document;
1069         }
1071         // Set our document
1072         document = doc;
1073         docElem = doc.documentElement;
1074         parent = doc.defaultView;
1076         // Support: IE>8
1077         // If iframe document is assigned to "document" variable and if iframe has been reloaded,
1078         // IE will throw "permission denied" error when accessing "document" variable, see jQuery #13936
1079         // IE6-8 do not support the defaultView property so parent will be undefined
1080         if ( parent && parent !== parent.top ) {
1081                 // IE11 does not have attachEvent, so all must suffer
1082                 if ( parent.addEventListener ) {
1083                         parent.addEventListener( "unload", unloadHandler, false );
1084                 } else if ( parent.attachEvent ) {
1085                         parent.attachEvent( "onunload", unloadHandler );
1086                 }
1087         }
1089         /* Support tests
1090         ---------------------------------------------------------------------- */
1091         documentIsHTML = !isXML( doc );
1093         /* Attributes
1094         ---------------------------------------------------------------------- */
1096         // Support: IE<8
1097         // Verify that getAttribute really returns attributes and not properties
1098         // (excepting IE8 booleans)
1099         support.attributes = assert(function( div ) {
1100                 div.className = "i";
1101                 return !div.getAttribute("className");
1102         });
1104         /* getElement(s)By*
1105         ---------------------------------------------------------------------- */
1107         // Check if getElementsByTagName("*") returns only elements
1108         support.getElementsByTagName = assert(function( div ) {
1109                 div.appendChild( doc.createComment("") );
1110                 return !div.getElementsByTagName("*").length;
1111         });
1113         // Support: IE<9
1114         support.getElementsByClassName = rnative.test( doc.getElementsByClassName );
1116         // Support: IE<10
1117         // Check if getElementById returns elements by name
1118         // The broken getElementById methods don't pick up programatically-set names,
1119         // so use a roundabout getElementsByName test
1120         support.getById = assert(function( div ) {
1121                 docElem.appendChild( div ).id = expando;
1122                 return !doc.getElementsByName || !doc.getElementsByName( expando ).length;
1123         });
1125         // ID find and filter
1126         if ( support.getById ) {
1127                 Expr.find["ID"] = function( id, context ) {
1128                         if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
1129                                 var m = context.getElementById( id );
1130                                 // Check parentNode to catch when Blackberry 4.6 returns
1131                                 // nodes that are no longer in the document #6963
1132                                 return m && m.parentNode ? [ m ] : [];
1133                         }
1134                 };
1135                 Expr.filter["ID"] = function( id ) {
1136                         var attrId = id.replace( runescape, funescape );
1137                         return function( elem ) {
1138                                 return elem.getAttribute("id") === attrId;
1139                         };
1140                 };
1141         } else {
1142                 // Support: IE6/7
1143                 // getElementById is not reliable as a find shortcut
1144                 delete Expr.find["ID"];
1146                 Expr.filter["ID"] =  function( id ) {
1147                         var attrId = id.replace( runescape, funescape );
1148                         return function( elem ) {
1149                                 var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
1150                                 return node && node.value === attrId;
1151                         };
1152                 };
1153         }
1155         // Tag
1156         Expr.find["TAG"] = support.getElementsByTagName ?
1157                 function( tag, context ) {
1158                         if ( typeof context.getElementsByTagName !== "undefined" ) {
1159                                 return context.getElementsByTagName( tag );
1161                         // DocumentFragment nodes don't have gEBTN
1162                         } else if ( support.qsa ) {
1163                                 return context.querySelectorAll( tag );
1164                         }
1165                 } :
1167                 function( tag, context ) {
1168                         var elem,
1169                                 tmp = [],
1170                                 i = 0,
1171                                 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
1172                                 results = context.getElementsByTagName( tag );
1174                         // Filter out possible comments
1175                         if ( tag === "*" ) {
1176                                 while ( (elem = results[i++]) ) {
1177                                         if ( elem.nodeType === 1 ) {
1178                                                 tmp.push( elem );
1179                                         }
1180                                 }
1182                                 return tmp;
1183                         }
1184                         return results;
1185                 };
1187         // Class
1188         Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
1189                 if ( documentIsHTML ) {
1190                         return context.getElementsByClassName( className );
1191                 }
1192         };
1194         /* QSA/matchesSelector
1195         ---------------------------------------------------------------------- */
1197         // QSA and matchesSelector support
1199         // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
1200         rbuggyMatches = [];
1202         // qSa(:focus) reports false when true (Chrome 21)
1203         // We allow this because of a bug in IE8/9 that throws an error
1204         // whenever `document.activeElement` is accessed on an iframe
1205         // So, we allow :focus to pass through QSA all the time to avoid the IE error
1206         // See http://bugs.jquery.com/ticket/13378
1207         rbuggyQSA = [];
1209         if ( (support.qsa = rnative.test( doc.querySelectorAll )) ) {
1210                 // Build QSA regex
1211                 // Regex strategy adopted from Diego Perini
1212                 assert(function( div ) {
1213                         // Select is set to empty string on purpose
1214                         // This is to test IE's treatment of not explicitly
1215                         // setting a boolean content attribute,
1216                         // since its presence should be enough
1217                         // http://bugs.jquery.com/ticket/12359
1218                         docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" +
1219                                 "<select id='" + expando + "-\f]' msallowcapture=''>" +
1220                                 "<option selected=''></option></select>";
1222                         // Support: IE8, Opera 11-12.16
1223                         // Nothing should be selected when empty strings follow ^= or $= or *=
1224                         // The test attribute must be unknown in Opera but "safe" for WinRT
1225                         // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
1226                         if ( div.querySelectorAll("[msallowcapture^='']").length ) {
1227                                 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
1228                         }
1230                         // Support: IE8
1231                         // Boolean attributes and "value" are not treated correctly
1232                         if ( !div.querySelectorAll("[selected]").length ) {
1233                                 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
1234                         }
1236                         // Support: Chrome<29, Android<4.2+, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.7+
1237                         if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
1238                                 rbuggyQSA.push("~=");
1239                         }
1241                         // Webkit/Opera - :checked should return selected option elements
1242                         // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1243                         // IE8 throws error here and will not see later tests
1244                         if ( !div.querySelectorAll(":checked").length ) {
1245                                 rbuggyQSA.push(":checked");
1246                         }
1248                         // Support: Safari 8+, iOS 8+
1249                         // https://bugs.webkit.org/show_bug.cgi?id=136851
1250                         // In-page `selector#id sibing-combinator selector` fails
1251                         if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) {
1252                                 rbuggyQSA.push(".#.+[+~]");
1253                         }
1254                 });
1256                 assert(function( div ) {
1257                         // Support: Windows 8 Native Apps
1258                         // The type and name attributes are restricted during .innerHTML assignment
1259                         var input = doc.createElement("input");
1260                         input.setAttribute( "type", "hidden" );
1261                         div.appendChild( input ).setAttribute( "name", "D" );
1263                         // Support: IE8
1264                         // Enforce case-sensitivity of name attribute
1265                         if ( div.querySelectorAll("[name=d]").length ) {
1266                                 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
1267                         }
1269                         // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
1270                         // IE8 throws error here and will not see later tests
1271                         if ( !div.querySelectorAll(":enabled").length ) {
1272                                 rbuggyQSA.push( ":enabled", ":disabled" );
1273                         }
1275                         // Opera 10-11 does not throw on post-comma invalid pseudos
1276                         div.querySelectorAll("*,:x");
1277                         rbuggyQSA.push(",.*:");
1278                 });
1279         }
1281         if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
1282                 docElem.webkitMatchesSelector ||
1283                 docElem.mozMatchesSelector ||
1284                 docElem.oMatchesSelector ||
1285                 docElem.msMatchesSelector) )) ) {
1287                 assert(function( div ) {
1288                         // Check to see if it's possible to do matchesSelector
1289                         // on a disconnected node (IE 9)
1290                         support.disconnectedMatch = matches.call( div, "div" );
1292                         // This should fail with an exception
1293                         // Gecko does not error, returns false instead
1294                         matches.call( div, "[s!='']:x" );
1295                         rbuggyMatches.push( "!=", pseudos );
1296                 });
1297         }
1299         rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
1300         rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
1302         /* Contains
1303         ---------------------------------------------------------------------- */
1304         hasCompare = rnative.test( docElem.compareDocumentPosition );
1306         // Element contains another
1307         // Purposefully does not implement inclusive descendent
1308         // As in, an element does not contain itself
1309         contains = hasCompare || rnative.test( docElem.contains ) ?
1310                 function( a, b ) {
1311                         var adown = a.nodeType === 9 ? a.documentElement : a,
1312                                 bup = b && b.parentNode;
1313                         return a === bup || !!( bup && bup.nodeType === 1 && (
1314                                 adown.contains ?
1315                                         adown.contains( bup ) :
1316                                         a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
1317                         ));
1318                 } :
1319                 function( a, b ) {
1320                         if ( b ) {
1321                                 while ( (b = b.parentNode) ) {
1322                                         if ( b === a ) {
1323                                                 return true;
1324                                         }
1325                                 }
1326                         }
1327                         return false;
1328                 };
1330         /* Sorting
1331         ---------------------------------------------------------------------- */
1333         // Document order sorting
1334         sortOrder = hasCompare ?
1335         function( a, b ) {
1337                 // Flag for duplicate removal
1338                 if ( a === b ) {
1339                         hasDuplicate = true;
1340                         return 0;
1341                 }
1343                 // Sort on method existence if only one input has compareDocumentPosition
1344                 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
1345                 if ( compare ) {
1346                         return compare;
1347                 }
1349                 // Calculate position if both inputs belong to the same document
1350                 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
1351                         a.compareDocumentPosition( b ) :
1353                         // Otherwise we know they are disconnected
1354                         1;
1356                 // Disconnected nodes
1357                 if ( compare & 1 ||
1358                         (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
1360                         // Choose the first element that is related to our preferred document
1361                         if ( a === doc || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
1362                                 return -1;
1363                         }
1364                         if ( b === doc || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
1365                                 return 1;
1366                         }
1368                         // Maintain original order
1369                         return sortInput ?
1370                                 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1371                                 0;
1372                 }
1374                 return compare & 4 ? -1 : 1;
1375         } :
1376         function( a, b ) {
1377                 // Exit early if the nodes are identical
1378                 if ( a === b ) {
1379                         hasDuplicate = true;
1380                         return 0;
1381                 }
1383                 var cur,
1384                         i = 0,
1385                         aup = a.parentNode,
1386                         bup = b.parentNode,
1387                         ap = [ a ],
1388                         bp = [ b ];
1390                 // Parentless nodes are either documents or disconnected
1391                 if ( !aup || !bup ) {
1392                         return a === doc ? -1 :
1393                                 b === doc ? 1 :
1394                                 aup ? -1 :
1395                                 bup ? 1 :
1396                                 sortInput ?
1397                                 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
1398                                 0;
1400                 // If the nodes are siblings, we can do a quick check
1401                 } else if ( aup === bup ) {
1402                         return siblingCheck( a, b );
1403                 }
1405                 // Otherwise we need full lists of their ancestors for comparison
1406                 cur = a;
1407                 while ( (cur = cur.parentNode) ) {
1408                         ap.unshift( cur );
1409                 }
1410                 cur = b;
1411                 while ( (cur = cur.parentNode) ) {
1412                         bp.unshift( cur );
1413                 }
1415                 // Walk down the tree looking for a discrepancy
1416                 while ( ap[i] === bp[i] ) {
1417                         i++;
1418                 }
1420                 return i ?
1421                         // Do a sibling check if the nodes have a common ancestor
1422                         siblingCheck( ap[i], bp[i] ) :
1424                         // Otherwise nodes in our document sort first
1425                         ap[i] === preferredDoc ? -1 :
1426                         bp[i] === preferredDoc ? 1 :
1427                         0;
1428         };
1430         return doc;
1431 };
1433 Sizzle.matches = function( expr, elements ) {
1434         return Sizzle( expr, null, null, elements );
1435 };
1437 Sizzle.matchesSelector = function( elem, expr ) {
1438         // Set document vars if needed
1439         if ( ( elem.ownerDocument || elem ) !== document ) {
1440                 setDocument( elem );
1441         }
1443         // Make sure that attribute selectors are quoted
1444         expr = expr.replace( rattributeQuotes, "='$1']" );
1446         if ( support.matchesSelector && documentIsHTML &&
1447                 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
1448                 ( !rbuggyQSA     || !rbuggyQSA.test( expr ) ) ) {
1450                 try {
1451                         var ret = matches.call( elem, expr );
1453                         // IE 9's matchesSelector returns false on disconnected nodes
1454                         if ( ret || support.disconnectedMatch ||
1455                                         // As well, disconnected nodes are said to be in a document
1456                                         // fragment in IE 9
1457                                         elem.document && elem.document.nodeType !== 11 ) {
1458                                 return ret;
1459                         }
1460                 } catch (e) {}
1461         }
1463         return Sizzle( expr, document, null, [ elem ] ).length > 0;
1464 };
1466 Sizzle.contains = function( context, elem ) {
1467         // Set document vars if needed
1468         if ( ( context.ownerDocument || context ) !== document ) {
1469                 setDocument( context );
1470         }
1471         return contains( context, elem );
1472 };
1474 Sizzle.attr = function( elem, name ) {
1475         // Set document vars if needed
1476         if ( ( elem.ownerDocument || elem ) !== document ) {
1477                 setDocument( elem );
1478         }
1480         var fn = Expr.attrHandle[ name.toLowerCase() ],
1481                 // Don't get fooled by Object.prototype properties (jQuery #13807)
1482                 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
1483                         fn( elem, name, !documentIsHTML ) :
1484                         undefined;
1486         return val !== undefined ?
1487                 val :
1488                 support.attributes || !documentIsHTML ?
1489                         elem.getAttribute( name ) :
1490                         (val = elem.getAttributeNode(name)) && val.specified ?
1491                                 val.value :
1492                                 null;
1493 };
1495 Sizzle.error = function( msg ) {
1496         throw new Error( "Syntax error, unrecognized expression: " + msg );
1497 };
1499 /**
1500  * Document sorting and removing duplicates
1501  * @param {ArrayLike} results
1502  */
1503 Sizzle.uniqueSort = function( results ) {
1504         var elem,
1505                 duplicates = [],
1506                 j = 0,
1507                 i = 0;
1509         // Unless we *know* we can detect duplicates, assume their presence
1510         hasDuplicate = !support.detectDuplicates;
1511         sortInput = !support.sortStable && results.slice( 0 );
1512         results.sort( sortOrder );
1514         if ( hasDuplicate ) {
1515                 while ( (elem = results[i++]) ) {
1516                         if ( elem === results[ i ] ) {
1517                                 j = duplicates.push( i );
1518                         }
1519                 }
1520                 while ( j-- ) {
1521                         results.splice( duplicates[ j ], 1 );
1522                 }
1523         }
1525         // Clear input after sorting to release objects
1526         // See https://github.com/jquery/sizzle/pull/225
1527         sortInput = null;
1529         return results;
1530 };
1532 /**
1533  * Utility function for retrieving the text value of an array of DOM nodes
1534  * @param {Array|Element} elem
1535  */
1536 getText = Sizzle.getText = function( elem ) {
1537         var node,
1538                 ret = "",
1539                 i = 0,
1540                 nodeType = elem.nodeType;
1542         if ( !nodeType ) {
1543                 // If no nodeType, this is expected to be an array
1544                 while ( (node = elem[i++]) ) {
1545                         // Do not traverse comment nodes
1546                         ret += getText( node );
1547                 }
1548         } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
1549                 // Use textContent for elements
1550                 // innerText usage removed for consistency of new lines (jQuery #11153)
1551                 if ( typeof elem.textContent === "string" ) {
1552                         return elem.textContent;
1553                 } else {
1554                         // Traverse its children
1555                         for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1556                                 ret += getText( elem );
1557                         }
1558                 }
1559         } else if ( nodeType === 3 || nodeType === 4 ) {
1560                 return elem.nodeValue;
1561         }
1562         // Do not include comment or processing instruction nodes
1564         return ret;
1565 };
1567 Expr = Sizzle.selectors = {
1569         // Can be adjusted by the user
1570         cacheLength: 50,
1572         createPseudo: markFunction,
1574         match: matchExpr,
1576         attrHandle: {},
1578         find: {},
1580         relative: {
1581                 ">": { dir: "parentNode", first: true },
1582                 " ": { dir: "parentNode" },
1583                 "+": { dir: "previousSibling", first: true },
1584                 "~": { dir: "previousSibling" }
1585         },
1587         preFilter: {
1588                 "ATTR": function( match ) {
1589                         match[1] = match[1].replace( runescape, funescape );
1591                         // Move the given value to match[3] whether quoted or unquoted
1592                         match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
1594                         if ( match[2] === "~=" ) {
1595                                 match[3] = " " + match[3] + " ";
1596                         }
1598                         return match.slice( 0, 4 );
1599                 },
1601                 "CHILD": function( match ) {
1602                         /* matches from matchExpr["CHILD"]
1603                                 1 type (only|nth|...)
1604                                 2 what (child|of-type)
1605                                 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
1606                                 4 xn-component of xn+y argument ([+-]?\d*n|)
1607                                 5 sign of xn-component
1608                                 6 x of xn-component
1609                                 7 sign of y-component
1610                                 8 y of y-component
1611                         */
1612                         match[1] = match[1].toLowerCase();
1614                         if ( match[1].slice( 0, 3 ) === "nth" ) {
1615                                 // nth-* requires argument
1616                                 if ( !match[3] ) {
1617                                         Sizzle.error( match[0] );
1618                                 }
1620                                 // numeric x and y parameters for Expr.filter.CHILD
1621                                 // remember that false/true cast respectively to 0/1
1622                                 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
1623                                 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
1625                         // other types prohibit arguments
1626                         } else if ( match[3] ) {
1627                                 Sizzle.error( match[0] );
1628                         }
1630                         return match;
1631                 },
1633                 "PSEUDO": function( match ) {
1634                         var excess,
1635                                 unquoted = !match[6] && match[2];
1637                         if ( matchExpr["CHILD"].test( match[0] ) ) {
1638                                 return null;
1639                         }
1641                         // Accept quoted arguments as-is
1642                         if ( match[3] ) {
1643                                 match[2] = match[4] || match[5] || "";
1645                         // Strip excess characters from unquoted arguments
1646                         } else if ( unquoted && rpseudo.test( unquoted ) &&
1647                                 // Get excess from tokenize (recursively)
1648                                 (excess = tokenize( unquoted, true )) &&
1649                                 // advance to the next closing parenthesis
1650                                 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
1652                                 // excess is a negative index
1653                                 match[0] = match[0].slice( 0, excess );
1654                                 match[2] = unquoted.slice( 0, excess );
1655                         }
1657                         // Return only captures needed by the pseudo filter method (type and argument)
1658                         return match.slice( 0, 3 );
1659                 }
1660         },
1662         filter: {
1664                 "TAG": function( nodeNameSelector ) {
1665                         var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
1666                         return nodeNameSelector === "*" ?
1667                                 function() { return true; } :
1668                                 function( elem ) {
1669                                         return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
1670                                 };
1671                 },
1673                 "CLASS": function( className ) {
1674                         var pattern = classCache[ className + " " ];
1676                         return pattern ||
1677                                 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
1678                                 classCache( className, function( elem ) {
1679                                         return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
1680                                 });
1681                 },
1683                 "ATTR": function( name, operator, check ) {
1684                         return function( elem ) {
1685                                 var result = Sizzle.attr( elem, name );
1687                                 if ( result == null ) {
1688                                         return operator === "!=";
1689                                 }
1690                                 if ( !operator ) {
1691                                         return true;
1692                                 }
1694                                 result += "";
1696                                 return operator === "=" ? result === check :
1697                                         operator === "!=" ? result !== check :
1698                                         operator === "^=" ? check && result.indexOf( check ) === 0 :
1699                                         operator === "*=" ? check && result.indexOf( check ) > -1 :
1700                                         operator === "$=" ? check && result.slice( -check.length ) === check :
1701                                         operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
1702                                         operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
1703                                         false;
1704                         };
1705                 },
1707                 "CHILD": function( type, what, argument, first, last ) {
1708                         var simple = type.slice( 0, 3 ) !== "nth",
1709                                 forward = type.slice( -4 ) !== "last",
1710                                 ofType = what === "of-type";
1712                         return first === 1 && last === 0 ?
1714                                 // Shortcut for :nth-*(n)
1715                                 function( elem ) {
1716                                         return !!elem.parentNode;
1717                                 } :
1719                                 function( elem, context, xml ) {
1720                                         var cache, outerCache, node, diff, nodeIndex, start,
1721                                                 dir = simple !== forward ? "nextSibling" : "previousSibling",
1722                                                 parent = elem.parentNode,
1723                                                 name = ofType && elem.nodeName.toLowerCase(),
1724                                                 useCache = !xml && !ofType;
1726                                         if ( parent ) {
1728                                                 // :(first|last|only)-(child|of-type)
1729                                                 if ( simple ) {
1730                                                         while ( dir ) {
1731                                                                 node = elem;
1732                                                                 while ( (node = node[ dir ]) ) {
1733                                                                         if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) {
1734                                                                                 return false;
1735                                                                         }
1736                                                                 }
1737                                                                 // Reverse direction for :only-* (if we haven't yet done so)
1738                                                                 start = dir = type === "only" && !start && "nextSibling";
1739                                                         }
1740                                                         return true;
1741                                                 }
1743                                                 start = [ forward ? parent.firstChild : parent.lastChild ];
1745                                                 // non-xml :nth-child(...) stores cache data on `parent`
1746                                                 if ( forward && useCache ) {
1747                                                         // Seek `elem` from a previously-cached index
1748                                                         outerCache = parent[ expando ] || (parent[ expando ] = {});
1749                                                         cache = outerCache[ type ] || [];
1750                                                         nodeIndex = cache[0] === dirruns && cache[1];
1751                                                         diff = cache[0] === dirruns && cache[2];
1752                                                         node = nodeIndex && parent.childNodes[ nodeIndex ];
1754                                                         while ( (node = ++nodeIndex && node && node[ dir ] ||
1756                                                                 // Fallback to seeking `elem` from the start
1757                                                                 (diff = nodeIndex = 0) || start.pop()) ) {
1759                                                                 // When found, cache indexes on `parent` and break
1760                                                                 if ( node.nodeType === 1 && ++diff && node === elem ) {
1761                                                                         outerCache[ type ] = [ dirruns, nodeIndex, diff ];
1762                                                                         break;
1763                                                                 }
1764                                                         }
1766                                                 // Use previously-cached element index if available
1767                                                 } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) {
1768                                                         diff = cache[1];
1770                                                 // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...)
1771                                                 } else {
1772                                                         // Use the same loop as above to seek `elem` from the start
1773                                                         while ( (node = ++nodeIndex && node && node[ dir ] ||
1774                                                                 (diff = nodeIndex = 0) || start.pop()) ) {
1776                                                                 if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) {
1777                                                                         // Cache the index of each encountered element
1778                                                                         if ( useCache ) {
1779                                                                                 (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ];
1780                                                                         }
1782                                                                         if ( node === elem ) {
1783                                                                                 break;
1784                                                                         }
1785                                                                 }
1786                                                         }
1787                                                 }
1789                                                 // Incorporate the offset, then check against cycle size
1790                                                 diff -= last;
1791                                                 return diff === first || ( diff % first === 0 && diff / first >= 0 );
1792                                         }
1793                                 };
1794                 },
1796                 "PSEUDO": function( pseudo, argument ) {
1797                         // pseudo-class names are case-insensitive
1798                         // http://www.w3.org/TR/selectors/#pseudo-classes
1799                         // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
1800                         // Remember that setFilters inherits from pseudos
1801                         var args,
1802                                 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
1803                                         Sizzle.error( "unsupported pseudo: " + pseudo );
1805                         // The user may use createPseudo to indicate that
1806                         // arguments are needed to create the filter function
1807                         // just as Sizzle does
1808                         if ( fn[ expando ] ) {
1809                                 return fn( argument );
1810                         }
1812                         // But maintain support for old signatures
1813                         if ( fn.length > 1 ) {
1814                                 args = [ pseudo, pseudo, "", argument ];
1815                                 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
1816                                         markFunction(function( seed, matches ) {
1817                                                 var idx,
1818                                                         matched = fn( seed, argument ),
1819                                                         i = matched.length;
1820                                                 while ( i-- ) {
1821                                                         idx = indexOf( seed, matched[i] );
1822                                                         seed[ idx ] = !( matches[ idx ] = matched[i] );
1823                                                 }
1824                                         }) :
1825                                         function( elem ) {
1826                                                 return fn( elem, 0, args );
1827                                         };
1828                         }
1830                         return fn;
1831                 }
1832         },
1834         pseudos: {
1835                 // Potentially complex pseudos
1836                 "not": markFunction(function( selector ) {
1837                         // Trim the selector passed to compile
1838                         // to avoid treating leading and trailing
1839                         // spaces as combinators
1840                         var input = [],
1841                                 results = [],
1842                                 matcher = compile( selector.replace( rtrim, "$1" ) );
1844                         return matcher[ expando ] ?
1845                                 markFunction(function( seed, matches, context, xml ) {
1846                                         var elem,
1847                                                 unmatched = matcher( seed, null, xml, [] ),
1848                                                 i = seed.length;
1850                                         // Match elements unmatched by `matcher`
1851                                         while ( i-- ) {
1852                                                 if ( (elem = unmatched[i]) ) {
1853                                                         seed[i] = !(matches[i] = elem);
1854                                                 }
1855                                         }
1856                                 }) :
1857                                 function( elem, context, xml ) {
1858                                         input[0] = elem;
1859                                         matcher( input, null, xml, results );
1860                                         // Don't keep the element (issue #299)
1861                                         input[0] = null;
1862                                         return !results.pop();
1863                                 };
1864                 }),
1866                 "has": markFunction(function( selector ) {
1867                         return function( elem ) {
1868                                 return Sizzle( selector, elem ).length > 0;
1869                         };
1870                 }),
1872                 "contains": markFunction(function( text ) {
1873                         text = text.replace( runescape, funescape );
1874                         return function( elem ) {
1875                                 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
1876                         };
1877                 }),
1879                 // "Whether an element is represented by a :lang() selector
1880                 // is based solely on the element's language value
1881                 // being equal to the identifier C,
1882                 // or beginning with the identifier C immediately followed by "-".
1883                 // The matching of C against the element's language value is performed case-insensitively.
1884                 // The identifier C does not have to be a valid language name."
1885                 // http://www.w3.org/TR/selectors/#lang-pseudo
1886                 "lang": markFunction( function( lang ) {
1887                         // lang value must be a valid identifier
1888                         if ( !ridentifier.test(lang || "") ) {
1889                                 Sizzle.error( "unsupported lang: " + lang );
1890                         }
1891                         lang = lang.replace( runescape, funescape ).toLowerCase();
1892                         return function( elem ) {
1893                                 var elemLang;
1894                                 do {
1895                                         if ( (elemLang = documentIsHTML ?
1896                                                 elem.lang :
1897                                                 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
1899                                                 elemLang = elemLang.toLowerCase();
1900                                                 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
1901                                         }
1902                                 } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
1903                                 return false;
1904                         };
1905                 }),
1907                 // Miscellaneous
1908                 "target": function( elem ) {
1909                         var hash = window.location && window.location.hash;
1910                         return hash && hash.slice( 1 ) === elem.id;
1911                 },
1913                 "root": function( elem ) {
1914                         return elem === docElem;
1915                 },
1917                 "focus": function( elem ) {
1918                         return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
1919                 },
1921                 // Boolean properties
1922                 "enabled": function( elem ) {
1923                         return elem.disabled === false;
1924                 },
1926                 "disabled": function( elem ) {
1927                         return elem.disabled === true;
1928                 },
1930                 "checked": function( elem ) {
1931                         // In CSS3, :checked should return both checked and selected elements
1932                         // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
1933                         var nodeName = elem.nodeName.toLowerCase();
1934                         return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
1935                 },
1937                 "selected": function( elem ) {
1938                         // Accessing this property makes selected-by-default
1939                         // options in Safari work properly
1940                         if ( elem.parentNode ) {
1941                                 elem.parentNode.selectedIndex;
1942                         }
1944                         return elem.selected === true;
1945                 },
1947                 // Contents
1948                 "empty": function( elem ) {
1949                         // http://www.w3.org/TR/selectors/#empty-pseudo
1950                         // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
1951                         //   but not by others (comment: 8; processing instruction: 7; etc.)
1952                         // nodeType < 6 works because attributes (2) do not appear as children
1953                         for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
1954                                 if ( elem.nodeType < 6 ) {
1955                                         return false;
1956                                 }
1957                         }
1958                         return true;
1959                 },
1961                 "parent": function( elem ) {
1962                         return !Expr.pseudos["empty"]( elem );
1963                 },
1965                 // Element/input types
1966                 "header": function( elem ) {
1967                         return rheader.test( elem.nodeName );
1968                 },
1970                 "input": function( elem ) {
1971                         return rinputs.test( elem.nodeName );
1972                 },
1974                 "button": function( elem ) {
1975                         var name = elem.nodeName.toLowerCase();
1976                         return name === "input" && elem.type === "button" || name === "button";
1977                 },
1979                 "text": function( elem ) {
1980                         var attr;
1981                         return elem.nodeName.toLowerCase() === "input" &&
1982                                 elem.type === "text" &&
1984                                 // Support: IE<8
1985                                 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
1986                                 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
1987                 },
1989                 // Position-in-collection
1990                 "first": createPositionalPseudo(function() {
1991                         return [ 0 ];
1992                 }),
1994                 "last": createPositionalPseudo(function( matchIndexes, length ) {
1995                         return [ length - 1 ];
1996                 }),
1998                 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
1999                         return [ argument < 0 ? argument + length : argument ];
2000                 }),
2002                 "even": createPositionalPseudo(function( matchIndexes, length ) {
2003                         var i = 0;
2004                         for ( ; i < length; i += 2 ) {
2005                                 matchIndexes.push( i );
2006                         }
2007                         return matchIndexes;
2008                 }),
2010                 "odd": createPositionalPseudo(function( matchIndexes, length ) {
2011                         var i = 1;
2012                         for ( ; i < length; i += 2 ) {
2013                                 matchIndexes.push( i );
2014                         }
2015                         return matchIndexes;
2016                 }),
2018                 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2019                         var i = argument < 0 ? argument + length : argument;
2020                         for ( ; --i >= 0; ) {
2021                                 matchIndexes.push( i );
2022                         }
2023                         return matchIndexes;
2024                 }),
2026                 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
2027                         var i = argument < 0 ? argument + length : argument;
2028                         for ( ; ++i < length; ) {
2029                                 matchIndexes.push( i );
2030                         }
2031                         return matchIndexes;
2032                 })
2033         }
2034 };
2036 Expr.pseudos["nth"] = Expr.pseudos["eq"];
2038 // Add button/input type pseudos
2039 for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
2040         Expr.pseudos[ i ] = createInputPseudo( i );
2042 for ( i in { submit: true, reset: true } ) {
2043         Expr.pseudos[ i ] = createButtonPseudo( i );
2046 // Easy API for creating new setFilters
2047 function setFilters() {}
2048 setFilters.prototype = Expr.filters = Expr.pseudos;
2049 Expr.setFilters = new setFilters();
2051 tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
2052         var matched, match, tokens, type,
2053                 soFar, groups, preFilters,
2054                 cached = tokenCache[ selector + " " ];
2056         if ( cached ) {
2057                 return parseOnly ? 0 : cached.slice( 0 );
2058         }
2060         soFar = selector;
2061         groups = [];
2062         preFilters = Expr.preFilter;
2064         while ( soFar ) {
2066                 // Comma and first run
2067                 if ( !matched || (match = rcomma.exec( soFar )) ) {
2068                         if ( match ) {
2069                                 // Don't consume trailing commas as valid
2070                                 soFar = soFar.slice( match[0].length ) || soFar;
2071                         }
2072                         groups.push( (tokens = []) );
2073                 }
2075                 matched = false;
2077                 // Combinators
2078                 if ( (match = rcombinators.exec( soFar )) ) {
2079                         matched = match.shift();
2080                         tokens.push({
2081                                 value: matched,
2082                                 // Cast descendant combinators to space
2083                                 type: match[0].replace( rtrim, " " )
2084                         });
2085                         soFar = soFar.slice( matched.length );
2086                 }
2088                 // Filters
2089                 for ( type in Expr.filter ) {
2090                         if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
2091                                 (match = preFilters[ type ]( match ))) ) {
2092                                 matched = match.shift();
2093                                 tokens.push({
2094                                         value: matched,
2095                                         type: type,
2096                                         matches: match
2097                                 });
2098                                 soFar = soFar.slice( matched.length );
2099                         }
2100                 }
2102                 if ( !matched ) {
2103                         break;
2104                 }
2105         }
2107         // Return the length of the invalid excess
2108         // if we're just parsing
2109         // Otherwise, throw an error or return tokens
2110         return parseOnly ?
2111                 soFar.length :
2112                 soFar ?
2113                         Sizzle.error( selector ) :
2114                         // Cache the tokens
2115                         tokenCache( selector, groups ).slice( 0 );
2116 };
2118 function toSelector( tokens ) {
2119         var i = 0,
2120                 len = tokens.length,
2121                 selector = "";
2122         for ( ; i < len; i++ ) {
2123                 selector += tokens[i].value;
2124         }
2125         return selector;
2128 function addCombinator( matcher, combinator, base ) {
2129         var dir = combinator.dir,
2130                 checkNonElements = base && dir === "parentNode",
2131                 doneName = done++;
2133         return combinator.first ?
2134                 // Check against closest ancestor/preceding element
2135                 function( elem, context, xml ) {
2136                         while ( (elem = elem[ dir ]) ) {
2137                                 if ( elem.nodeType === 1 || checkNonElements ) {
2138                                         return matcher( elem, context, xml );
2139                                 }
2140                         }
2141                 } :
2143                 // Check against all ancestor/preceding elements
2144                 function( elem, context, xml ) {
2145                         var oldCache, outerCache,
2146                                 newCache = [ dirruns, doneName ];
2148                         // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching
2149                         if ( xml ) {
2150                                 while ( (elem = elem[ dir ]) ) {
2151                                         if ( elem.nodeType === 1 || checkNonElements ) {
2152                                                 if ( matcher( elem, context, xml ) ) {
2153                                                         return true;
2154                                                 }
2155                                         }
2156                                 }
2157                         } else {
2158                                 while ( (elem = elem[ dir ]) ) {
2159                                         if ( elem.nodeType === 1 || checkNonElements ) {
2160                                                 outerCache = elem[ expando ] || (elem[ expando ] = {});
2161                                                 if ( (oldCache = outerCache[ dir ]) &&
2162                                                         oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
2164                                                         // Assign to newCache so results back-propagate to previous elements
2165                                                         return (newCache[ 2 ] = oldCache[ 2 ]);
2166                                                 } else {
2167                                                         // Reuse newcache so results back-propagate to previous elements
2168                                                         outerCache[ dir ] = newCache;
2170                                                         // A match means we're done; a fail means we have to keep checking
2171                                                         if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
2172                                                                 return true;
2173                                                         }
2174                                                 }
2175                                         }
2176                                 }
2177                         }
2178                 };
2181 function elementMatcher( matchers ) {
2182         return matchers.length > 1 ?
2183                 function( elem, context, xml ) {
2184                         var i = matchers.length;
2185                         while ( i-- ) {
2186                                 if ( !matchers[i]( elem, context, xml ) ) {
2187                                         return false;
2188                                 }
2189                         }
2190                         return true;
2191                 } :
2192                 matchers[0];
2195 function multipleContexts( selector, contexts, results ) {
2196         var i = 0,
2197                 len = contexts.length;
2198         for ( ; i < len; i++ ) {
2199                 Sizzle( selector, contexts[i], results );
2200         }
2201         return results;
2204 function condense( unmatched, map, filter, context, xml ) {
2205         var elem,
2206                 newUnmatched = [],
2207                 i = 0,
2208                 len = unmatched.length,
2209                 mapped = map != null;
2211         for ( ; i < len; i++ ) {
2212                 if ( (elem = unmatched[i]) ) {
2213                         if ( !filter || filter( elem, context, xml ) ) {
2214                                 newUnmatched.push( elem );
2215                                 if ( mapped ) {
2216                                         map.push( i );
2217                                 }
2218                         }
2219                 }
2220         }
2222         return newUnmatched;
2225 function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
2226         if ( postFilter && !postFilter[ expando ] ) {
2227                 postFilter = setMatcher( postFilter );
2228         }
2229         if ( postFinder && !postFinder[ expando ] ) {
2230                 postFinder = setMatcher( postFinder, postSelector );
2231         }
2232         return markFunction(function( seed, results, context, xml ) {
2233                 var temp, i, elem,
2234                         preMap = [],
2235                         postMap = [],
2236                         preexisting = results.length,
2238                         // Get initial elements from seed or context
2239                         elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
2241                         // Prefilter to get matcher input, preserving a map for seed-results synchronization
2242                         matcherIn = preFilter && ( seed || !selector ) ?
2243                                 condense( elems, preMap, preFilter, context, xml ) :
2244                                 elems,
2246                         matcherOut = matcher ?
2247                                 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
2248                                 postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
2250                                         // ...intermediate processing is necessary
2251                                         [] :
2253                                         // ...otherwise use results directly
2254                                         results :
2255                                 matcherIn;
2257                 // Find primary matches
2258                 if ( matcher ) {
2259                         matcher( matcherIn, matcherOut, context, xml );
2260                 }
2262                 // Apply postFilter
2263                 if ( postFilter ) {
2264                         temp = condense( matcherOut, postMap );
2265                         postFilter( temp, [], context, xml );
2267                         // Un-match failing elements by moving them back to matcherIn
2268                         i = temp.length;
2269                         while ( i-- ) {
2270                                 if ( (elem = temp[i]) ) {
2271                                         matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
2272                                 }
2273                         }
2274                 }
2276                 if ( seed ) {
2277                         if ( postFinder || preFilter ) {
2278                                 if ( postFinder ) {
2279                                         // Get the final matcherOut by condensing this intermediate into postFinder contexts
2280                                         temp = [];
2281                                         i = matcherOut.length;
2282                                         while ( i-- ) {
2283                                                 if ( (elem = matcherOut[i]) ) {
2284                                                         // Restore matcherIn since elem is not yet a final match
2285                                                         temp.push( (matcherIn[i] = elem) );
2286                                                 }
2287                                         }
2288                                         postFinder( null, (matcherOut = []), temp, xml );
2289                                 }
2291                                 // Move matched elements from seed to results to keep them synchronized
2292                                 i = matcherOut.length;
2293                                 while ( i-- ) {
2294                                         if ( (elem = matcherOut[i]) &&
2295                                                 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
2297                                                 seed[temp] = !(results[temp] = elem);
2298                                         }
2299                                 }
2300                         }
2302                 // Add elements to results, through postFinder if defined
2303                 } else {
2304                         matcherOut = condense(
2305                                 matcherOut === results ?
2306                                         matcherOut.splice( preexisting, matcherOut.length ) :
2307                                         matcherOut
2308                         );
2309                         if ( postFinder ) {
2310                                 postFinder( null, results, matcherOut, xml );
2311                         } else {
2312                                 push.apply( results, matcherOut );
2313                         }
2314                 }
2315         });
2318 function matcherFromTokens( tokens ) {
2319         var checkContext, matcher, j,
2320                 len = tokens.length,
2321                 leadingRelative = Expr.relative[ tokens[0].type ],
2322                 implicitRelative = leadingRelative || Expr.relative[" "],
2323                 i = leadingRelative ? 1 : 0,
2325                 // The foundational matcher ensures that elements are reachable from top-level context(s)
2326                 matchContext = addCombinator( function( elem ) {
2327                         return elem === checkContext;
2328                 }, implicitRelative, true ),
2329                 matchAnyContext = addCombinator( function( elem ) {
2330                         return indexOf( checkContext, elem ) > -1;
2331                 }, implicitRelative, true ),
2332                 matchers = [ function( elem, context, xml ) {
2333                         var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
2334                                 (checkContext = context).nodeType ?
2335                                         matchContext( elem, context, xml ) :
2336                                         matchAnyContext( elem, context, xml ) );
2337                         // Avoid hanging onto element (issue #299)
2338                         checkContext = null;
2339                         return ret;
2340                 } ];
2342         for ( ; i < len; i++ ) {
2343                 if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
2344                         matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
2345                 } else {
2346                         matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
2348                         // Return special upon seeing a positional matcher
2349                         if ( matcher[ expando ] ) {
2350                                 // Find the next relative operator (if any) for proper handling
2351                                 j = ++i;
2352                                 for ( ; j < len; j++ ) {
2353                                         if ( Expr.relative[ tokens[j].type ] ) {
2354                                                 break;
2355                                         }
2356                                 }
2357                                 return setMatcher(
2358                                         i > 1 && elementMatcher( matchers ),
2359                                         i > 1 && toSelector(
2360                                                 // If the preceding token was a descendant combinator, insert an implicit any-element `*`
2361                                                 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
2362                                         ).replace( rtrim, "$1" ),
2363                                         matcher,
2364                                         i < j && matcherFromTokens( tokens.slice( i, j ) ),
2365                                         j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
2366                                         j < len && toSelector( tokens )
2367                                 );
2368                         }
2369                         matchers.push( matcher );
2370                 }
2371         }
2373         return elementMatcher( matchers );
2376 function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
2377         var bySet = setMatchers.length > 0,
2378                 byElement = elementMatchers.length > 0,
2379                 superMatcher = function( seed, context, xml, results, outermost ) {
2380                         var elem, j, matcher,
2381                                 matchedCount = 0,
2382                                 i = "0",
2383                                 unmatched = seed && [],
2384                                 setMatched = [],
2385                                 contextBackup = outermostContext,
2386                                 // We must always have either seed elements or outermost context
2387                                 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
2388                                 // Use integer dirruns iff this is the outermost matcher
2389                                 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
2390                                 len = elems.length;
2392                         if ( outermost ) {
2393                                 outermostContext = context !== document && context;
2394                         }
2396                         // Add elements passing elementMatchers directly to results
2397                         // Keep `i` a string if there are no elements so `matchedCount` will be "00" below
2398                         // Support: IE<9, Safari
2399                         // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
2400                         for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
2401                                 if ( byElement && elem ) {
2402                                         j = 0;
2403                                         while ( (matcher = elementMatchers[j++]) ) {
2404                                                 if ( matcher( elem, context, xml ) ) {
2405                                                         results.push( elem );
2406                                                         break;
2407                                                 }
2408                                         }
2409                                         if ( outermost ) {
2410                                                 dirruns = dirrunsUnique;
2411                                         }
2412                                 }
2414                                 // Track unmatched elements for set filters
2415                                 if ( bySet ) {
2416                                         // They will have gone through all possible matchers
2417                                         if ( (elem = !matcher && elem) ) {
2418                                                 matchedCount--;
2419                                         }
2421                                         // Lengthen the array for every element, matched or not
2422                                         if ( seed ) {
2423                                                 unmatched.push( elem );
2424                                         }
2425                                 }
2426                         }
2428                         // Apply set filters to unmatched elements
2429                         matchedCount += i;
2430                         if ( bySet && i !== matchedCount ) {
2431                                 j = 0;
2432                                 while ( (matcher = setMatchers[j++]) ) {
2433                                         matcher( unmatched, setMatched, context, xml );
2434                                 }
2436                                 if ( seed ) {
2437                                         // Reintegrate element matches to eliminate the need for sorting
2438                                         if ( matchedCount > 0 ) {
2439                                                 while ( i-- ) {
2440                                                         if ( !(unmatched[i] || setMatched[i]) ) {
2441                                                                 setMatched[i] = pop.call( results );
2442                                                         }
2443                                                 }
2444                                         }
2446                                         // Discard index placeholder values to get only actual matches
2447                                         setMatched = condense( setMatched );
2448                                 }
2450                                 // Add matches to results
2451                                 push.apply( results, setMatched );
2453                                 // Seedless set matches succeeding multiple successful matchers stipulate sorting
2454                                 if ( outermost && !seed && setMatched.length > 0 &&
2455                                         ( matchedCount + setMatchers.length ) > 1 ) {
2457                                         Sizzle.uniqueSort( results );
2458                                 }
2459                         }
2461                         // Override manipulation of globals by nested matchers
2462                         if ( outermost ) {
2463                                 dirruns = dirrunsUnique;
2464                                 outermostContext = contextBackup;
2465                         }
2467                         return unmatched;
2468                 };
2470         return bySet ?
2471                 markFunction( superMatcher ) :
2472                 superMatcher;
2475 compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
2476         var i,
2477                 setMatchers = [],
2478                 elementMatchers = [],
2479                 cached = compilerCache[ selector + " " ];
2481         if ( !cached ) {
2482                 // Generate a function of recursive functions that can be used to check each element
2483                 if ( !match ) {
2484                         match = tokenize( selector );
2485                 }
2486                 i = match.length;
2487                 while ( i-- ) {
2488                         cached = matcherFromTokens( match[i] );
2489                         if ( cached[ expando ] ) {
2490                                 setMatchers.push( cached );
2491                         } else {
2492                                 elementMatchers.push( cached );
2493                         }
2494                 }
2496                 // Cache the compiled function
2497                 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
2499                 // Save selector and tokenization
2500                 cached.selector = selector;
2501         }
2502         return cached;
2503 };
2505 /**
2506  * A low-level selection function that works with Sizzle's compiled
2507  *  selector functions
2508  * @param {String|Function} selector A selector or a pre-compiled
2509  *  selector function built with Sizzle.compile
2510  * @param {Element} context
2511  * @param {Array} [results]
2512  * @param {Array} [seed] A set of elements to match against
2513  */
2514 select = Sizzle.select = function( selector, context, results, seed ) {
2515         var i, tokens, token, type, find,
2516                 compiled = typeof selector === "function" && selector,
2517                 match = !seed && tokenize( (selector = compiled.selector || selector) );
2519         results = results || [];
2521         // Try to minimize operations if there is no seed and only one group
2522         if ( match.length === 1 ) {
2524                 // Take a shortcut and set the context if the root selector is an ID
2525                 tokens = match[0] = match[0].slice( 0 );
2526                 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
2527                                 support.getById && context.nodeType === 9 && documentIsHTML &&
2528                                 Expr.relative[ tokens[1].type ] ) {
2530                         context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
2531                         if ( !context ) {
2532                                 return results;
2534                         // Precompiled matchers will still verify ancestry, so step up a level
2535                         } else if ( compiled ) {
2536                                 context = context.parentNode;
2537                         }
2539                         selector = selector.slice( tokens.shift().value.length );
2540                 }
2542                 // Fetch a seed set for right-to-left matching
2543                 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
2544                 while ( i-- ) {
2545                         token = tokens[i];
2547                         // Abort if we hit a combinator
2548                         if ( Expr.relative[ (type = token.type) ] ) {
2549                                 break;
2550                         }
2551                         if ( (find = Expr.find[ type ]) ) {
2552                                 // Search, expanding context for leading sibling combinators
2553                                 if ( (seed = find(
2554                                         token.matches[0].replace( runescape, funescape ),
2555                                         rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
2556                                 )) ) {
2558                                         // If seed is empty or no tokens remain, we can return early
2559                                         tokens.splice( i, 1 );
2560                                         selector = seed.length && toSelector( tokens );
2561                                         if ( !selector ) {
2562                                                 push.apply( results, seed );
2563                                                 return results;
2564                                         }
2566                                         break;
2567                                 }
2568                         }
2569                 }
2570         }
2572         // Compile and execute a filtering function if one is not provided
2573         // Provide `match` to avoid retokenization if we modified the selector above
2574         ( compiled || compile( selector, match ) )(
2575                 seed,
2576                 context,
2577                 !documentIsHTML,
2578                 results,
2579                 rsibling.test( selector ) && testContext( context.parentNode ) || context
2580         );
2581         return results;
2582 };
2584 // One-time assignments
2586 // Sort stability
2587 support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
2589 // Support: Chrome 14-35+
2590 // Always assume duplicates if they aren't passed to the comparison function
2591 support.detectDuplicates = !!hasDuplicate;
2593 // Initialize against the default document
2594 setDocument();
2596 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
2597 // Detached nodes confoundingly follow *each other*
2598 support.sortDetached = assert(function( div1 ) {
2599         // Should return 1, but returns 4 (following)
2600         return div1.compareDocumentPosition( document.createElement("div") ) & 1;
2601 });
2603 // Support: IE<8
2604 // Prevent attribute/property "interpolation"
2605 // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
2606 if ( !assert(function( div ) {
2607         div.innerHTML = "<a href='#'></a>";
2608         return div.firstChild.getAttribute("href") === "#" ;
2609 }) ) {
2610         addHandle( "type|href|height|width", function( elem, name, isXML ) {
2611                 if ( !isXML ) {
2612                         return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
2613                 }
2614         });
2617 // Support: IE<9
2618 // Use defaultValue in place of getAttribute("value")
2619 if ( !support.attributes || !assert(function( div ) {
2620         div.innerHTML = "<input/>";
2621         div.firstChild.setAttribute( "value", "" );
2622         return div.firstChild.getAttribute( "value" ) === "";
2623 }) ) {
2624         addHandle( "value", function( elem, name, isXML ) {
2625                 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
2626                         return elem.defaultValue;
2627                 }
2628         });
2631 // Support: IE<9
2632 // Use getAttributeNode to fetch booleans when getAttribute lies
2633 if ( !assert(function( div ) {
2634         return div.getAttribute("disabled") == null;
2635 }) ) {
2636         addHandle( booleans, function( elem, name, isXML ) {
2637                 var val;
2638                 if ( !isXML ) {
2639                         return elem[ name ] === true ? name.toLowerCase() :
2640                                         (val = elem.getAttributeNode( name )) && val.specified ?
2641                                         val.value :
2642                                 null;
2643                 }
2644         });
2647 return Sizzle;
2649 })( window );
2653 jQuery.find = Sizzle;
2654 jQuery.expr = Sizzle.selectors;
2655 jQuery.expr[":"] = jQuery.expr.pseudos;
2656 jQuery.unique = Sizzle.uniqueSort;
2657 jQuery.text = Sizzle.getText;
2658 jQuery.isXMLDoc = Sizzle.isXML;
2659 jQuery.contains = Sizzle.contains;
2663 var rneedsContext = jQuery.expr.match.needsContext;
2665 var rsingleTag = (/^<(\w+)\s*\/?>(?:<\/\1>|)$/);
2669 var risSimple = /^.[^:#\[\.,]*$/;
2671 // Implement the identical functionality for filter and not
2672 function winnow( elements, qualifier, not ) {
2673         if ( jQuery.isFunction( qualifier ) ) {
2674                 return jQuery.grep( elements, function( elem, i ) {
2675                         /* jshint -W018 */
2676                         return !!qualifier.call( elem, i, elem ) !== not;
2677                 });
2679         }
2681         if ( qualifier.nodeType ) {
2682                 return jQuery.grep( elements, function( elem ) {
2683                         return ( elem === qualifier ) !== not;
2684                 });
2686         }
2688         if ( typeof qualifier === "string" ) {
2689                 if ( risSimple.test( qualifier ) ) {
2690                         return jQuery.filter( qualifier, elements, not );
2691                 }
2693                 qualifier = jQuery.filter( qualifier, elements );
2694         }
2696         return jQuery.grep( elements, function( elem ) {
2697                 return ( jQuery.inArray( elem, qualifier ) >= 0 ) !== not;
2698         });
2701 jQuery.filter = function( expr, elems, not ) {
2702         var elem = elems[ 0 ];
2704         if ( not ) {
2705                 expr = ":not(" + expr + ")";
2706         }
2708         return elems.length === 1 && elem.nodeType === 1 ?
2709                 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] :
2710                 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
2711                         return elem.nodeType === 1;
2712                 }));
2713 };
2715 jQuery.fn.extend({
2716         find: function( selector ) {
2717                 var i,
2718                         ret = [],
2719                         self = this,
2720                         len = self.length;
2722                 if ( typeof selector !== "string" ) {
2723                         return this.pushStack( jQuery( selector ).filter(function() {
2724                                 for ( i = 0; i < len; i++ ) {
2725                                         if ( jQuery.contains( self[ i ], this ) ) {
2726                                                 return true;
2727                                         }
2728                                 }
2729                         }) );
2730                 }
2732                 for ( i = 0; i < len; i++ ) {
2733                         jQuery.find( selector, self[ i ], ret );
2734                 }
2736                 // Needed because $( selector, context ) becomes $( context ).find( selector )
2737                 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret );
2738                 ret.selector = this.selector ? this.selector + " " + selector : selector;
2739                 return ret;
2740         },
2741         filter: function( selector ) {
2742                 return this.pushStack( winnow(this, selector || [], false) );
2743         },
2744         not: function( selector ) {
2745                 return this.pushStack( winnow(this, selector || [], true) );
2746         },
2747         is: function( selector ) {
2748                 return !!winnow(
2749                         this,
2751                         // If this is a positional/relative selector, check membership in the returned set
2752                         // so $("p:first").is("p:last") won't return true for a doc with two "p".
2753                         typeof selector === "string" && rneedsContext.test( selector ) ?
2754                                 jQuery( selector ) :
2755                                 selector || [],
2756                         false
2757                 ).length;
2758         }
2759 });
2762 // Initialize a jQuery object
2765 // A central reference to the root jQuery(document)
2766 var rootjQuery,
2768         // Use the correct document accordingly with window argument (sandbox)
2769         document = window.document,
2771         // A simple way to check for HTML strings
2772         // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
2773         // Strict HTML recognition (#11290: must start with <)
2774         rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,
2776         init = jQuery.fn.init = function( selector, context ) {
2777                 var match, elem;
2779                 // HANDLE: $(""), $(null), $(undefined), $(false)
2780                 if ( !selector ) {
2781                         return this;
2782                 }
2784                 // Handle HTML strings
2785                 if ( typeof selector === "string" ) {
2786                         if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
2787                                 // Assume that strings that start and end with <> are HTML and skip the regex check
2788                                 match = [ null, selector, null ];
2790                         } else {
2791                                 match = rquickExpr.exec( selector );
2792                         }
2794                         // Match html or make sure no context is specified for #id
2795                         if ( match && (match[1] || !context) ) {
2797                                 // HANDLE: $(html) -> $(array)
2798                                 if ( match[1] ) {
2799                                         context = context instanceof jQuery ? context[0] : context;
2801                                         // scripts is true for back-compat
2802                                         // Intentionally let the error be thrown if parseHTML is not present
2803                                         jQuery.merge( this, jQuery.parseHTML(
2804                                                 match[1],
2805                                                 context && context.nodeType ? context.ownerDocument || context : document,
2806                                                 true
2807                                         ) );
2809                                         // HANDLE: $(html, props)
2810                                         if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
2811                                                 for ( match in context ) {
2812                                                         // Properties of context are called as methods if possible
2813                                                         if ( jQuery.isFunction( this[ match ] ) ) {
2814                                                                 this[ match ]( context[ match ] );
2816                                                         // ...and otherwise set as attributes
2817                                                         } else {
2818                                                                 this.attr( match, context[ match ] );
2819                                                         }
2820                                                 }
2821                                         }
2823                                         return this;
2825                                 // HANDLE: $(#id)
2826                                 } else {
2827                                         elem = document.getElementById( match[2] );
2829                                         // Check parentNode to catch when Blackberry 4.6 returns
2830                                         // nodes that are no longer in the document #6963
2831                                         if ( elem && elem.parentNode ) {
2832                                                 // Handle the case where IE and Opera return items
2833                                                 // by name instead of ID
2834                                                 if ( elem.id !== match[2] ) {
2835                                                         return rootjQuery.find( selector );
2836                                                 }
2838                                                 // Otherwise, we inject the element directly into the jQuery object
2839                                                 this.length = 1;
2840                                                 this[0] = elem;
2841                                         }
2843                                         this.context = document;
2844                                         this.selector = selector;
2845                                         return this;
2846                                 }
2848                         // HANDLE: $(expr, $(...))
2849                         } else if ( !context || context.jquery ) {
2850                                 return ( context || rootjQuery ).find( selector );
2852                         // HANDLE: $(expr, context)
2853                         // (which is just equivalent to: $(context).find(expr)
2854                         } else {
2855                                 return this.constructor( context ).find( selector );
2856                         }
2858                 // HANDLE: $(DOMElement)
2859                 } else if ( selector.nodeType ) {
2860                         this.context = this[0] = selector;
2861                         this.length = 1;
2862                         return this;
2864                 // HANDLE: $(function)
2865                 // Shortcut for document ready
2866                 } else if ( jQuery.isFunction( selector ) ) {
2867                         return typeof rootjQuery.ready !== "undefined" ?
2868                                 rootjQuery.ready( selector ) :
2869                                 // Execute immediately if ready is not present
2870                                 selector( jQuery );
2871                 }
2873                 if ( selector.selector !== undefined ) {
2874                         this.selector = selector.selector;
2875                         this.context = selector.context;
2876                 }
2878                 return jQuery.makeArray( selector, this );
2879         };
2881 // Give the init function the jQuery prototype for later instantiation
2882 init.prototype = jQuery.fn;
2884 // Initialize central reference
2885 rootjQuery = jQuery( document );
2888 var rparentsprev = /^(?:parents|prev(?:Until|All))/,
2889         // methods guaranteed to produce a unique set when starting from a unique set
2890         guaranteedUnique = {