Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

10882 řádky
282KB

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