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