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