PageRenderTime 39ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 0ms

/libs/python/doc/html/numpy/_static/jquery-3.1.0.js

https://bitbucket.org/bosp/external-boost
JavaScript | 1834 lines | 1092 code | 333 blank | 409 comment | 304 complexity | e168acfe18bade11fd60942e2ba78d00 MD5 | raw file
Possible License(s): MIT
  1. /*eslint-disable no-unused-vars*/
  2. /*!
  3. * jQuery JavaScript Library v3.1.0
  4. * https://jquery.com/
  5. *
  6. * Includes Sizzle.js
  7. * https://sizzlejs.com/
  8. *
  9. * Copyright jQuery Foundation and other contributors
  10. * Released under the MIT license
  11. * https://jquery.org/license
  12. *
  13. * Date: 2016-07-07T21:44Z
  14. */
  15. ( function( global, factory ) {
  16. "use strict";
  17. if ( typeof module === "object" && typeof module.exports === "object" ) {
  18. // For CommonJS and CommonJS-like environments where a proper `window`
  19. // is present, execute the factory and get jQuery.
  20. // For environments that do not have a `window` with a `document`
  21. // (such as Node.js), expose a factory as module.exports.
  22. // This accentuates the need for the creation of a real `window`.
  23. // e.g. var jQuery = require("jquery")(window);
  24. // See ticket #14549 for more info.
  25. module.exports = global.document ?
  26. factory( global, true ) :
  27. function( w ) {
  28. if ( !w.document ) {
  29. throw new Error( "jQuery requires a window with a document" );
  30. }
  31. return factory( w );
  32. };
  33. } else {
  34. factory( global );
  35. }
  36. // Pass this if window is not defined yet
  37. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  38. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  39. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  40. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  41. // enough that all such attempts are guarded in a try block.
  42. "use strict";
  43. var arr = [];
  44. var document = window.document;
  45. var getProto = Object.getPrototypeOf;
  46. var slice = arr.slice;
  47. var concat = arr.concat;
  48. var push = arr.push;
  49. var indexOf = arr.indexOf;
  50. var class2type = {};
  51. var toString = class2type.toString;
  52. var hasOwn = class2type.hasOwnProperty;
  53. var fnToString = hasOwn.toString;
  54. var ObjectFunctionString = fnToString.call( Object );
  55. var support = {};
  56. function DOMEval( code, doc ) {
  57. doc = doc || document;
  58. var script = doc.createElement( "script" );
  59. script.text = code;
  60. doc.head.appendChild( script ).parentNode.removeChild( script );
  61. }
  62. /* global Symbol */
  63. // Defining this global in .eslintrc would create a danger of using the global
  64. // unguarded in another place, it seems safer to define global only for this module
  65. var
  66. version = "3.1.0",
  67. // Define a local copy of jQuery
  68. jQuery = function( selector, context ) {
  69. // The jQuery object is actually just the init constructor 'enhanced'
  70. // Need init if jQuery is called (just allow error to be thrown if not included)
  71. return new jQuery.fn.init( selector, context );
  72. },
  73. // Support: Android <=4.0 only
  74. // Make sure we trim BOM and NBSP
  75. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
  76. // Matches dashed string for camelizing
  77. rmsPrefix = /^-ms-/,
  78. rdashAlpha = /-([a-z])/g,
  79. // Used by jQuery.camelCase as callback to replace()
  80. fcamelCase = function( all, letter ) {
  81. return letter.toUpperCase();
  82. };
  83. jQuery.fn = jQuery.prototype = {
  84. // The current version of jQuery being used
  85. jquery: version,
  86. constructor: jQuery,
  87. // The default length of a jQuery object is 0
  88. length: 0,
  89. toArray: function() {
  90. return slice.call( this );
  91. },
  92. // Get the Nth element in the matched element set OR
  93. // Get the whole matched element set as a clean array
  94. get: function( num ) {
  95. return num != null ?
  96. // Return just the one element from the set
  97. ( num < 0 ? this[ num + this.length ] : this[ num ] ) :
  98. // Return all the elements in a clean array
  99. slice.call( this );
  100. },
  101. // Take an array of elements and push it onto the stack
  102. // (returning the new matched element set)
  103. pushStack: function( elems ) {
  104. // Build a new jQuery matched element set
  105. var ret = jQuery.merge( this.constructor(), elems );
  106. // Add the old object onto the stack (as a reference)
  107. ret.prevObject = this;
  108. // Return the newly-formed element set
  109. return ret;
  110. },
  111. // Execute a callback for every element in the matched set.
  112. each: function( callback ) {
  113. return jQuery.each( this, callback );
  114. },
  115. map: function( callback ) {
  116. return this.pushStack( jQuery.map( this, function( elem, i ) {
  117. return callback.call( elem, i, elem );
  118. } ) );
  119. },
  120. slice: function() {
  121. return this.pushStack( slice.apply( this, arguments ) );
  122. },
  123. first: function() {
  124. return this.eq( 0 );
  125. },
  126. last: function() {
  127. return this.eq( -1 );
  128. },
  129. eq: function( i ) {
  130. var len = this.length,
  131. j = +i + ( i < 0 ? len : 0 );
  132. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  133. },
  134. end: function() {
  135. return this.prevObject || this.constructor();
  136. },
  137. // For internal use only.
  138. // Behaves like an Array's method, not like a jQuery method.
  139. push: push,
  140. sort: arr.sort,
  141. splice: arr.splice
  142. };
  143. jQuery.extend = jQuery.fn.extend = function() {
  144. var options, name, src, copy, copyIsArray, clone,
  145. target = arguments[ 0 ] || {},
  146. i = 1,
  147. length = arguments.length,
  148. deep = false;
  149. // Handle a deep copy situation
  150. if ( typeof target === "boolean" ) {
  151. deep = target;
  152. // Skip the boolean and the target
  153. target = arguments[ i ] || {};
  154. i++;
  155. }
  156. // Handle case when target is a string or something (possible in deep copy)
  157. if ( typeof target !== "object" && !jQuery.isFunction( target ) ) {
  158. target = {};
  159. }
  160. // Extend jQuery itself if only one argument is passed
  161. if ( i === length ) {
  162. target = this;
  163. i--;
  164. }
  165. for ( ; i < length; i++ ) {
  166. // Only deal with non-null/undefined values
  167. if ( ( options = arguments[ i ] ) != null ) {
  168. // Extend the base object
  169. for ( name in options ) {
  170. src = target[ name ];
  171. copy = options[ name ];
  172. // Prevent never-ending loop
  173. if ( target === copy ) {
  174. continue;
  175. }
  176. // Recurse if we're merging plain objects or arrays
  177. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  178. ( copyIsArray = jQuery.isArray( copy ) ) ) ) {
  179. if ( copyIsArray ) {
  180. copyIsArray = false;
  181. clone = src && jQuery.isArray( src ) ? src : [];
  182. } else {
  183. clone = src && jQuery.isPlainObject( src ) ? src : {};
  184. }
  185. // Never move original objects, clone them
  186. target[ name ] = jQuery.extend( deep, clone, copy );
  187. // Don't bring in undefined values
  188. } else if ( copy !== undefined ) {
  189. target[ name ] = copy;
  190. }
  191. }
  192. }
  193. }
  194. // Return the modified object
  195. return target;
  196. };
  197. jQuery.extend( {
  198. // Unique for each copy of jQuery on the page
  199. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  200. // Assume jQuery is ready without the ready module
  201. isReady: true,
  202. error: function( msg ) {
  203. throw new Error( msg );
  204. },
  205. noop: function() {},
  206. isFunction: function( obj ) {
  207. return jQuery.type( obj ) === "function";
  208. },
  209. isArray: Array.isArray,
  210. isWindow: function( obj ) {
  211. return obj != null && obj === obj.window;
  212. },
  213. isNumeric: function( obj ) {
  214. // As of jQuery 3.0, isNumeric is limited to
  215. // strings and numbers (primitives or objects)
  216. // that can be coerced to finite numbers (gh-2662)
  217. var type = jQuery.type( obj );
  218. return ( type === "number" || type === "string" ) &&
  219. // parseFloat NaNs numeric-cast false positives ("")
  220. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  221. // subtraction forces infinities to NaN
  222. !isNaN( obj - parseFloat( obj ) );
  223. },
  224. isPlainObject: function( obj ) {
  225. var proto, Ctor;
  226. // Detect obvious negatives
  227. // Use toString instead of jQuery.type to catch host objects
  228. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  229. return false;
  230. }
  231. proto = getProto( obj );
  232. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  233. if ( !proto ) {
  234. return true;
  235. }
  236. // Objects with prototype are plain iff they were constructed by a global Object function
  237. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  238. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  239. },
  240. isEmptyObject: function( obj ) {
  241. /* eslint-disable no-unused-vars */
  242. // See https://github.com/eslint/eslint/issues/6125
  243. var name;
  244. for ( name in obj ) {
  245. return false;
  246. }
  247. return true;
  248. },
  249. type: function( obj ) {
  250. if ( obj == null ) {
  251. return obj + "";
  252. }
  253. // Support: Android <=2.3 only (functionish RegExp)
  254. return typeof obj === "object" || typeof obj === "function" ?
  255. class2type[ toString.call( obj ) ] || "object" :
  256. typeof obj;
  257. },
  258. // Evaluates a script in a global context
  259. globalEval: function( code ) {
  260. DOMEval( code );
  261. },
  262. // Convert dashed to camelCase; used by the css and data modules
  263. // Support: IE <=9 - 11, Edge 12 - 13
  264. // Microsoft forgot to hump their vendor prefix (#9572)
  265. camelCase: function( string ) {
  266. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  267. },
  268. nodeName: function( elem, name ) {
  269. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  270. },
  271. each: function( obj, callback ) {
  272. var length, i = 0;
  273. if ( isArrayLike( obj ) ) {
  274. length = obj.length;
  275. for ( ; i < length; i++ ) {
  276. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  277. break;
  278. }
  279. }
  280. } else {
  281. for ( i in obj ) {
  282. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  283. break;
  284. }
  285. }
  286. }
  287. return obj;
  288. },
  289. // Support: Android <=4.0 only
  290. trim: function( text ) {
  291. return text == null ?
  292. "" :
  293. ( text + "" ).replace( rtrim, "" );
  294. },
  295. // results is for internal usage only
  296. makeArray: function( arr, results ) {
  297. var ret = results || [];
  298. if ( arr != null ) {
  299. if ( isArrayLike( Object( arr ) ) ) {
  300. jQuery.merge( ret,
  301. typeof arr === "string" ?
  302. [ arr ] : arr
  303. );
  304. } else {
  305. push.call( ret, arr );
  306. }
  307. }
  308. return ret;
  309. },
  310. inArray: function( elem, arr, i ) {
  311. return arr == null ? -1 : indexOf.call( arr, elem, i );
  312. },
  313. // Support: Android <=4.0 only, PhantomJS 1 only
  314. // push.apply(_, arraylike) throws on ancient WebKit
  315. merge: function( first, second ) {
  316. var len = +second.length,
  317. j = 0,
  318. i = first.length;
  319. for ( ; j < len; j++ ) {
  320. first[ i++ ] = second[ j ];
  321. }
  322. first.length = i;
  323. return first;
  324. },
  325. grep: function( elems, callback, invert ) {
  326. var callbackInverse,
  327. matches = [],
  328. i = 0,
  329. length = elems.length,
  330. callbackExpect = !invert;
  331. // Go through the array, only saving the items
  332. // that pass the validator function
  333. for ( ; i < length; i++ ) {
  334. callbackInverse = !callback( elems[ i ], i );
  335. if ( callbackInverse !== callbackExpect ) {
  336. matches.push( elems[ i ] );
  337. }
  338. }
  339. return matches;
  340. },
  341. // arg is for internal usage only
  342. map: function( elems, callback, arg ) {
  343. var length, value,
  344. i = 0,
  345. ret = [];
  346. // Go through the array, translating each of the items to their new values
  347. if ( isArrayLike( elems ) ) {
  348. length = elems.length;
  349. for ( ; i < length; i++ ) {
  350. value = callback( elems[ i ], i, arg );
  351. if ( value != null ) {
  352. ret.push( value );
  353. }
  354. }
  355. // Go through every key on the object,
  356. } else {
  357. for ( i in elems ) {
  358. value = callback( elems[ i ], i, arg );
  359. if ( value != null ) {
  360. ret.push( value );
  361. }
  362. }
  363. }
  364. // Flatten any nested arrays
  365. return concat.apply( [], ret );
  366. },
  367. // A global GUID counter for objects
  368. guid: 1,
  369. // Bind a function to a context, optionally partially applying any
  370. // arguments.
  371. proxy: function( fn, context ) {
  372. var tmp, args, proxy;
  373. if ( typeof context === "string" ) {
  374. tmp = fn[ context ];
  375. context = fn;
  376. fn = tmp;
  377. }
  378. // Quick check to determine if target is callable, in the spec
  379. // this throws a TypeError, but we will just return undefined.
  380. if ( !jQuery.isFunction( fn ) ) {
  381. return undefined;
  382. }
  383. // Simulated bind
  384. args = slice.call( arguments, 2 );
  385. proxy = function() {
  386. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  387. };
  388. // Set the guid of unique handler to the same of original handler, so it can be removed
  389. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  390. return proxy;
  391. },
  392. now: Date.now,
  393. // jQuery.support is not used in Core but other projects attach their
  394. // properties to it so it needs to exist.
  395. support: support
  396. } );
  397. if ( typeof Symbol === "function" ) {
  398. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  399. }
  400. // Populate the class2type map
  401. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  402. function( i, name ) {
  403. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  404. } );
  405. function isArrayLike( obj ) {
  406. // Support: real iOS 8.2 only (not reproducible in simulator)
  407. // `in` check used to prevent JIT error (gh-2145)
  408. // hasOwn isn't used here due to false negatives
  409. // regarding Nodelist length in IE
  410. var length = !!obj && "length" in obj && obj.length,
  411. type = jQuery.type( obj );
  412. if ( type === "function" || jQuery.isWindow( obj ) ) {
  413. return false;
  414. }
  415. return type === "array" || length === 0 ||
  416. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  417. }
  418. var Sizzle =
  419. /*!
  420. * Sizzle CSS Selector Engine v2.3.0
  421. * https://sizzlejs.com/
  422. *
  423. * Copyright jQuery Foundation and other contributors
  424. * Released under the MIT license
  425. * http://jquery.org/license
  426. *
  427. * Date: 2016-01-04
  428. */
  429. (function( window ) {
  430. var i,
  431. support,
  432. Expr,
  433. getText,
  434. isXML,
  435. tokenize,
  436. compile,
  437. select,
  438. outermostContext,
  439. sortInput,
  440. hasDuplicate,
  441. // Local document vars
  442. setDocument,
  443. document,
  444. docElem,
  445. documentIsHTML,
  446. rbuggyQSA,
  447. rbuggyMatches,
  448. matches,
  449. contains,
  450. // Instance-specific data
  451. expando = "sizzle" + 1 * new Date(),
  452. preferredDoc = window.document,
  453. dirruns = 0,
  454. done = 0,
  455. classCache = createCache(),
  456. tokenCache = createCache(),
  457. compilerCache = createCache(),
  458. sortOrder = function( a, b ) {
  459. if ( a === b ) {
  460. hasDuplicate = true;
  461. }
  462. return 0;
  463. },
  464. // Instance methods
  465. hasOwn = ({}).hasOwnProperty,
  466. arr = [],
  467. pop = arr.pop,
  468. push_native = arr.push,
  469. push = arr.push,
  470. slice = arr.slice,
  471. // Use a stripped-down indexOf as it's faster than native
  472. // https://jsperf.com/thor-indexof-vs-for/5
  473. indexOf = function( list, elem ) {
  474. var i = 0,
  475. len = list.length;
  476. for ( ; i < len; i++ ) {
  477. if ( list[i] === elem ) {
  478. return i;
  479. }
  480. }
  481. return -1;
  482. },
  483. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  484. // Regular expressions
  485. // http://www.w3.org/TR/css3-selectors/#whitespace
  486. whitespace = "[\\x20\\t\\r\\n\\f]",
  487. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  488. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  489. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  490. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  491. // Operator (capture 2)
  492. "*([*^$|!~]?=)" + whitespace +
  493. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  494. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  495. "*\\]",
  496. pseudos = ":(" + identifier + ")(?:\\((" +
  497. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  498. // 1. quoted (capture 3; capture 4 or capture 5)
  499. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  500. // 2. simple (capture 6)
  501. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  502. // 3. anything else (capture 2)
  503. ".*" +
  504. ")\\)|)",
  505. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  506. rwhitespace = new RegExp( whitespace + "+", "g" ),
  507. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  508. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  509. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  510. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  511. rpseudo = new RegExp( pseudos ),
  512. ridentifier = new RegExp( "^" + identifier + "$" ),
  513. matchExpr = {
  514. "ID": new RegExp( "^#(" + identifier + ")" ),
  515. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  516. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  517. "ATTR": new RegExp( "^" + attributes ),
  518. "PSEUDO": new RegExp( "^" + pseudos ),
  519. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  520. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  521. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  522. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  523. // For use in libraries implementing .is()
  524. // We use this for POS matching in `select`
  525. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  526. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  527. },
  528. rinputs = /^(?:input|select|textarea|button)$/i,
  529. rheader = /^h\d$/i,
  530. rnative = /^[^{]+\{\s*\[native \w/,
  531. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  532. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  533. rsibling = /[+~]/,
  534. // CSS escapes
  535. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  536. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  537. funescape = function( _, escaped, escapedWhitespace ) {
  538. var high = "0x" + escaped - 0x10000;
  539. // NaN means non-codepoint
  540. // Support: Firefox<24
  541. // Workaround erroneous numeric interpretation of +"0x"
  542. return high !== high || escapedWhitespace ?
  543. escaped :
  544. high < 0 ?
  545. // BMP codepoint
  546. String.fromCharCode( high + 0x10000 ) :
  547. // Supplemental Plane codepoint (surrogate pair)
  548. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  549. },
  550. // CSS string/identifier serialization
  551. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  552. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,
  553. fcssescape = function( ch, asCodePoint ) {
  554. if ( asCodePoint ) {
  555. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  556. if ( ch === "\0" ) {
  557. return "\uFFFD";
  558. }
  559. // Control characters and (dependent upon position) numbers get escaped as code points
  560. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  561. }
  562. // Other potentially-special ASCII characters get backslash-escaped
  563. return "\\" + ch;
  564. },
  565. // Used for iframes
  566. // See setDocument()
  567. // Removing the function wrapper causes a "Permission Denied"
  568. // error in IE
  569. unloadHandler = function() {
  570. setDocument();
  571. },
  572. disabledAncestor = addCombinator(
  573. function( elem ) {
  574. return elem.disabled === true;
  575. },
  576. { dir: "parentNode", next: "legend" }
  577. );
  578. // Optimize for push.apply( _, NodeList )
  579. try {
  580. push.apply(
  581. (arr = slice.call( preferredDoc.childNodes )),
  582. preferredDoc.childNodes
  583. );
  584. // Support: Android<4.0
  585. // Detect silently failing push.apply
  586. arr[ preferredDoc.childNodes.length ].nodeType;
  587. } catch ( e ) {
  588. push = { apply: arr.length ?
  589. // Leverage slice if possible
  590. function( target, els ) {
  591. push_native.apply( target, slice.call(els) );
  592. } :
  593. // Support: IE<9
  594. // Otherwise append directly
  595. function( target, els ) {
  596. var j = target.length,
  597. i = 0;
  598. // Can't trust NodeList.length
  599. while ( (target[j++] = els[i++]) ) {}
  600. target.length = j - 1;
  601. }
  602. };
  603. }
  604. function Sizzle( selector, context, results, seed ) {
  605. var m, i, elem, nid, match, groups, newSelector,
  606. newContext = context && context.ownerDocument,
  607. // nodeType defaults to 9, since context defaults to document
  608. nodeType = context ? context.nodeType : 9;
  609. results = results || [];
  610. // Return early from calls with invalid selector or context
  611. if ( typeof selector !== "string" || !selector ||
  612. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  613. return results;
  614. }
  615. // Try to shortcut find operations (as opposed to filters) in HTML documents
  616. if ( !seed ) {
  617. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  618. setDocument( context );
  619. }
  620. context = context || document;
  621. if ( documentIsHTML ) {
  622. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  623. // (excepting DocumentFragment context, where the methods don't exist)
  624. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  625. // ID selector
  626. if ( (m = match[1]) ) {
  627. // Document context
  628. if ( nodeType === 9 ) {
  629. if ( (elem = context.getElementById( m )) ) {
  630. // Support: IE, Opera, Webkit
  631. // TODO: identify versions
  632. // getElementById can match elements by name instead of ID
  633. if ( elem.id === m ) {
  634. results.push( elem );
  635. return results;
  636. }
  637. } else {
  638. return results;
  639. }
  640. // Element context
  641. } else {
  642. // Support: IE, Opera, Webkit
  643. // TODO: identify versions
  644. // getElementById can match elements by name instead of ID
  645. if ( newContext && (elem = newContext.getElementById( m )) &&
  646. contains( context, elem ) &&
  647. elem.id === m ) {
  648. results.push( elem );
  649. return results;
  650. }
  651. }
  652. // Type selector
  653. } else if ( match[2] ) {
  654. push.apply( results, context.getElementsByTagName( selector ) );
  655. return results;
  656. // Class selector
  657. } else if ( (m = match[3]) && support.getElementsByClassName &&
  658. context.getElementsByClassName ) {
  659. push.apply( results, context.getElementsByClassName( m ) );
  660. return results;
  661. }
  662. }
  663. // Take advantage of querySelectorAll
  664. if ( support.qsa &&
  665. !compilerCache[ selector + " " ] &&
  666. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  667. if ( nodeType !== 1 ) {
  668. newContext = context;
  669. newSelector = selector;
  670. // qSA looks outside Element context, which is not what we want
  671. // Thanks to Andrew Dupont for this workaround technique
  672. // Support: IE <=8
  673. // Exclude object elements
  674. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  675. // Capture the context ID, setting it first if necessary
  676. if ( (nid = context.getAttribute( "id" )) ) {
  677. nid = nid.replace( rcssescape, fcssescape );
  678. } else {
  679. context.setAttribute( "id", (nid = expando) );
  680. }
  681. // Prefix every selector in the list
  682. groups = tokenize( selector );
  683. i = groups.length;
  684. while ( i-- ) {
  685. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  686. }
  687. newSelector = groups.join( "," );
  688. // Expand context for sibling selectors
  689. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  690. context;
  691. }
  692. if ( newSelector ) {
  693. try {
  694. push.apply( results,
  695. newContext.querySelectorAll( newSelector )
  696. );
  697. return results;
  698. } catch ( qsaError ) {
  699. } finally {
  700. if ( nid === expando ) {
  701. context.removeAttribute( "id" );
  702. }
  703. }
  704. }
  705. }
  706. }
  707. }
  708. // All others
  709. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  710. }
  711. /**
  712. * Create key-value caches of limited size
  713. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  714. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  715. * deleting the oldest entry
  716. */
  717. function createCache() {
  718. var keys = [];
  719. function cache( key, value ) {
  720. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  721. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  722. // Only keep the most recent entries
  723. delete cache[ keys.shift() ];
  724. }
  725. return (cache[ key + " " ] = value);
  726. }
  727. return cache;
  728. }
  729. /**
  730. * Mark a function for special use by Sizzle
  731. * @param {Function} fn The function to mark
  732. */
  733. function markFunction( fn ) {
  734. fn[ expando ] = true;
  735. return fn;
  736. }
  737. /**
  738. * Support testing using an element
  739. * @param {Function} fn Passed the created element and returns a boolean result
  740. */
  741. function assert( fn ) {
  742. var el = document.createElement("fieldset");
  743. try {
  744. return !!fn( el );
  745. } catch (e) {
  746. return false;
  747. } finally {
  748. // Remove from its parent by default
  749. if ( el.parentNode ) {
  750. el.parentNode.removeChild( el );
  751. }
  752. // release memory in IE
  753. el = null;
  754. }
  755. }
  756. /**
  757. * Adds the same handler for all of the specified attrs
  758. * @param {String} attrs Pipe-separated list of attributes
  759. * @param {Function} handler The method that will be applied
  760. */
  761. function addHandle( attrs, handler ) {
  762. var arr = attrs.split("|"),
  763. i = arr.length;
  764. while ( i-- ) {
  765. Expr.attrHandle[ arr[i] ] = handler;
  766. }
  767. }
  768. /**
  769. * Checks document order of two siblings
  770. * @param {Element} a
  771. * @param {Element} b
  772. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  773. */
  774. function siblingCheck( a, b ) {
  775. var cur = b && a,
  776. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  777. a.sourceIndex - b.sourceIndex;
  778. // Use IE sourceIndex if available on both nodes
  779. if ( diff ) {
  780. return diff;
  781. }
  782. // Check if b follows a
  783. if ( cur ) {
  784. while ( (cur = cur.nextSibling) ) {
  785. if ( cur === b ) {
  786. return -1;
  787. }
  788. }
  789. }
  790. return a ? 1 : -1;
  791. }
  792. /**
  793. * Returns a function to use in pseudos for input types
  794. * @param {String} type
  795. */
  796. function createInputPseudo( type ) {
  797. return function( elem ) {
  798. var name = elem.nodeName.toLowerCase();
  799. return name === "input" && elem.type === type;
  800. };
  801. }
  802. /**
  803. * Returns a function to use in pseudos for buttons
  804. * @param {String} type
  805. */
  806. function createButtonPseudo( type ) {
  807. return function( elem ) {
  808. var name = elem.nodeName.toLowerCase();
  809. return (name === "input" || name === "button") && elem.type === type;
  810. };
  811. }
  812. /**
  813. * Returns a function to use in pseudos for :enabled/:disabled
  814. * @param {Boolean} disabled true for :disabled; false for :enabled
  815. */
  816. function createDisabledPseudo( disabled ) {
  817. // Known :disabled false positives:
  818. // IE: *[disabled]:not(button, input, select, textarea, optgroup, option, menuitem, fieldset)
  819. // not IE: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  820. return function( elem ) {
  821. // Check form elements and option elements for explicit disabling
  822. return "label" in elem && elem.disabled === disabled ||
  823. "form" in elem && elem.disabled === disabled ||
  824. // Check non-disabled form elements for fieldset[disabled] ancestors
  825. "form" in elem && elem.disabled === false && (
  826. // Support: IE6-11+
  827. // Ancestry is covered for us
  828. elem.isDisabled === disabled ||
  829. // Otherwise, assume any non-<option> under fieldset[disabled] is disabled
  830. /* jshint -W018 */
  831. elem.isDisabled !== !disabled &&
  832. ("label" in elem || !disabledAncestor( elem )) !== disabled
  833. );
  834. };
  835. }
  836. /**
  837. * Returns a function to use in pseudos for positionals
  838. * @param {Function} fn
  839. */
  840. function createPositionalPseudo( fn ) {
  841. return markFunction(function( argument ) {
  842. argument = +argument;
  843. return markFunction(function( seed, matches ) {
  844. var j,
  845. matchIndexes = fn( [], seed.length, argument ),
  846. i = matchIndexes.length;
  847. // Match elements found at the specified indexes
  848. while ( i-- ) {
  849. if ( seed[ (j = matchIndexes[i]) ] ) {
  850. seed[j] = !(matches[j] = seed[j]);
  851. }
  852. }
  853. });
  854. });
  855. }
  856. /**
  857. * Checks a node for validity as a Sizzle context
  858. * @param {Element|Object=} context
  859. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  860. */
  861. function testContext( context ) {
  862. return context && typeof context.getElementsByTagName !== "undefined" && context;
  863. }
  864. // Expose support vars for convenience
  865. support = Sizzle.support = {};
  866. /**
  867. * Detects XML nodes
  868. * @param {Element|Object} elem An element or a document
  869. * @returns {Boolean} True iff elem is a non-HTML XML node
  870. */
  871. isXML = Sizzle.isXML = function( elem ) {
  872. // documentElement is verified for cases where it doesn't yet exist
  873. // (such as loading iframes in IE - #4833)
  874. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  875. return documentElement ? documentElement.nodeName !== "HTML" : false;
  876. };
  877. /**
  878. * Sets document-related variables once based on the current document
  879. * @param {Element|Object} [doc] An element or document object to use to set the document
  880. * @returns {Object} Returns the current document
  881. */
  882. setDocument = Sizzle.setDocument = function( node ) {
  883. var hasCompare, subWindow,
  884. doc = node ? node.ownerDocument || node : preferredDoc;
  885. // Return early if doc is invalid or already selected
  886. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  887. return document;
  888. }
  889. // Update global variables
  890. document = doc;
  891. docElem = document.documentElement;
  892. documentIsHTML = !isXML( document );
  893. // Support: IE 9-11, Edge
  894. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  895. if ( preferredDoc !== document &&
  896. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  897. // Support: IE 11, Edge
  898. if ( subWindow.addEventListener ) {
  899. subWindow.addEventListener( "unload", unloadHandler, false );
  900. // Support: IE 9 - 10 only
  901. } else if ( subWindow.attachEvent ) {
  902. subWindow.attachEvent( "onunload", unloadHandler );
  903. }
  904. }
  905. /* Attributes
  906. ---------------------------------------------------------------------- */
  907. // Support: IE<8
  908. // Verify that getAttribute really returns attributes and not properties
  909. // (excepting IE8 booleans)
  910. support.attributes = assert(function( el ) {
  911. el.className = "i";
  912. return !el.getAttribute("className");
  913. });
  914. /* getElement(s)By*
  915. ---------------------------------------------------------------------- */
  916. // Check if getElementsByTagName("*") returns only elements
  917. support.getElementsByTagName = assert(function( el ) {
  918. el.appendChild( document.createComment("") );
  919. return !el.getElementsByTagName("*").length;
  920. });
  921. // Support: IE<9
  922. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  923. // Support: IE<10
  924. // Check if getElementById returns elements by name
  925. // The broken getElementById methods don't pick up programmatically-set names,
  926. // so use a roundabout getElementsByName test
  927. support.getById = assert(function( el ) {
  928. docElem.appendChild( el ).id = expando;
  929. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  930. });
  931. // ID find and filter
  932. if ( support.getById ) {
  933. Expr.find["ID"] = function( id, context ) {
  934. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  935. var m = context.getElementById( id );
  936. return m ? [ m ] : [];
  937. }
  938. };
  939. Expr.filter["ID"] = function( id ) {
  940. var attrId = id.replace( runescape, funescape );
  941. return function( elem ) {
  942. return elem.getAttribute("id") === attrId;
  943. };
  944. };
  945. } else {
  946. // Support: IE6/7
  947. // getElementById is not reliable as a find shortcut
  948. delete Expr.find["ID"];
  949. Expr.filter["ID"] = function( id ) {
  950. var attrId = id.replace( runescape, funescape );
  951. return function( elem ) {
  952. var node = typeof elem.getAttributeNode !== "undefined" &&
  953. elem.getAttributeNode("id");
  954. return node && node.value === attrId;
  955. };
  956. };
  957. }
  958. // Tag
  959. Expr.find["TAG"] = support.getElementsByTagName ?
  960. function( tag, context ) {
  961. if ( typeof context.getElementsByTagName !== "undefined" ) {
  962. return context.getElementsByTagName( tag );
  963. // DocumentFragment nodes don't have gEBTN
  964. } else if ( support.qsa ) {
  965. return context.querySelectorAll( tag );
  966. }
  967. } :
  968. function( tag, context ) {
  969. var elem,
  970. tmp = [],
  971. i = 0,
  972. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  973. results = context.getElementsByTagName( tag );
  974. // Filter out possible comments
  975. if ( tag === "*" ) {
  976. while ( (elem = results[i++]) ) {
  977. if ( elem.nodeType === 1 ) {
  978. tmp.push( elem );
  979. }
  980. }
  981. return tmp;
  982. }
  983. return results;
  984. };
  985. // Class
  986. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  987. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  988. return context.getElementsByClassName( className );
  989. }
  990. };
  991. /* QSA/matchesSelector
  992. ---------------------------------------------------------------------- */
  993. // QSA and matchesSelector support
  994. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  995. rbuggyMatches = [];
  996. // qSa(:focus) reports false when true (Chrome 21)
  997. // We allow this because of a bug in IE8/9 that throws an error
  998. // whenever `document.activeElement` is accessed on an iframe
  999. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  1000. // See https://bugs.jquery.com/ticket/13378
  1001. rbuggyQSA = [];
  1002. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  1003. // Build QSA regex
  1004. // Regex strategy adopted from Diego Perini
  1005. assert(function( el ) {
  1006. // Select is set to empty string on purpose
  1007. // This is to test IE's treatment of not explicitly
  1008. // setting a boolean content attribute,
  1009. // since its presence should be enough
  1010. // https://bugs.jquery.com/ticket/12359
  1011. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  1012. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  1013. "<option selected=''></option></select>";
  1014. // Support: IE8, Opera 11-12.16
  1015. // Nothing should be selected when empty strings follow ^= or $= or *=
  1016. // The test attribute must be unknown in Opera but "safe" for WinRT
  1017. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  1018. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  1019. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  1020. }
  1021. // Support: IE8
  1022. // Boolean attributes and "value" are not treated correctly
  1023. if ( !el.querySelectorAll("[selected]").length ) {
  1024. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  1025. }
  1026. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  1027. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  1028. rbuggyQSA.push("~=");
  1029. }
  1030. // Webkit/Opera - :checked should return selected option elements
  1031. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1032. // IE8 throws error here and will not see later tests
  1033. if ( !el.querySelectorAll(":checked").length ) {
  1034. rbuggyQSA.push(":checked");
  1035. }
  1036. // Support: Safari 8+, iOS 8+
  1037. // https://bugs.webkit.org/show_bug.cgi?id=136851
  1038. // In-page `selector#id sibling-combinator selector` fails
  1039. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  1040. rbuggyQSA.push(".#.+[+~]");
  1041. }
  1042. });
  1043. assert(function( el ) {
  1044. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  1045. "<select disabled='disabled'><option/></select>";
  1046. // Support: Windows 8 Native Apps
  1047. // The type and name attributes are restricted during .innerHTML assignment
  1048. var input = document.createElement("input");
  1049. input.setAttribute( "type", "hidden" );
  1050. el.appendChild( input ).setAttribute( "name", "D" );
  1051. // Support: IE8
  1052. // Enforce case-sensitivity of name attribute
  1053. if ( el.querySelectorAll("[name=d]").length ) {
  1054. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  1055. }
  1056. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  1057. // IE8 throws error here and will not see later tests
  1058. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  1059. rbuggyQSA.push( ":enabled", ":disabled" );
  1060. }
  1061. // Support: IE9-11+
  1062. // IE's :disabled selector does not pick up the children of disabled fieldsets
  1063. docElem.appendChild( el ).disabled = true;
  1064. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  1065. rbuggyQSA.push( ":enabled", ":disabled" );
  1066. }
  1067. // Opera 10-11 does not throw on post-comma invalid pseudos
  1068. el.querySelectorAll("*,:x");
  1069. rbuggyQSA.push(",.*:");
  1070. });
  1071. }
  1072. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  1073. docElem.webkitMatchesSelector ||
  1074. docElem.mozMatchesSelector ||
  1075. docElem.oMatchesSelector ||
  1076. docElem.msMatchesSelector) )) ) {
  1077. assert(function( el ) {
  1078. // Check to see if it's possible to do matchesSelector
  1079. // on a disconnected node (IE 9)
  1080. support.disconnectedMatch = matches.call( el, "*" );
  1081. // This should fail with an exception
  1082. // Gecko does not error, returns false instead
  1083. matches.call( el, "[s!='']:x" );
  1084. rbuggyMatches.push( "!=", pseudos );
  1085. });
  1086. }
  1087. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  1088. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  1089. /* Contains
  1090. ---------------------------------------------------------------------- */
  1091. hasCompare = rnative.test( docElem.compareDocumentPosition );
  1092. // Element contains another
  1093. // Purposefully self-exclusive
  1094. // As in, an element does not contain itself
  1095. contains = hasCompare || rnative.test( docElem.contains ) ?
  1096. function( a, b ) {
  1097. var adown = a.nodeType === 9 ? a.documentElement : a,
  1098. bup = b && b.parentNode;
  1099. return a === bup || !!( bup && bup.nodeType === 1 && (
  1100. adown.contains ?
  1101. adown.contains( bup ) :
  1102. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  1103. ));
  1104. } :
  1105. function( a, b ) {
  1106. if ( b ) {
  1107. while ( (b = b.parentNode) ) {
  1108. if ( b === a ) {
  1109. return true;
  1110. }
  1111. }
  1112. }
  1113. return false;
  1114. };
  1115. /* Sorting
  1116. ---------------------------------------------------------------------- */
  1117. // Document order sorting
  1118. sortOrder = hasCompare ?
  1119. function( a, b ) {
  1120. // Flag for duplicate removal
  1121. if ( a === b ) {
  1122. hasDuplicate = true;
  1123. return 0;
  1124. }
  1125. // Sort on method existence if only one input has compareDocumentPosition
  1126. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  1127. if ( compare ) {
  1128. return compare;
  1129. }
  1130. // Calculate position if both inputs belong to the same document
  1131. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  1132. a.compareDocumentPosition( b ) :
  1133. // Otherwise we know they are disconnected
  1134. 1;
  1135. // Disconnected nodes
  1136. if ( compare & 1 ||
  1137. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  1138. // Choose the first element that is related to our preferred document
  1139. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  1140. return -1;
  1141. }
  1142. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  1143. return 1;
  1144. }
  1145. // Maintain original order
  1146. return sortInput ?
  1147. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1148. 0;
  1149. }
  1150. return compare & 4 ? -1 : 1;
  1151. } :
  1152. function( a, b ) {
  1153. // Exit early if the nodes are identical
  1154. if ( a === b ) {
  1155. hasDuplicate = true;
  1156. return 0;
  1157. }
  1158. var cur,
  1159. i = 0,
  1160. aup = a.parentNode,
  1161. bup = b.parentNode,
  1162. ap = [ a ],
  1163. bp = [ b ];
  1164. // Parentless nodes are either documents or disconnected
  1165. if ( !aup || !bup ) {
  1166. return a === document ? -1 :
  1167. b === document ? 1 :
  1168. aup ? -1 :
  1169. bup ? 1 :
  1170. sortInput ?
  1171. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1172. 0;
  1173. // If the nodes are siblings, we can do a quick check
  1174. } else if ( aup === bup ) {
  1175. return siblingCheck( a, b );
  1176. }
  1177. // Otherwise we need full lists of their ancestors for comparison
  1178. cur = a;
  1179. while ( (cur = cur.parentNode) ) {
  1180. ap.unshift( cur );
  1181. }
  1182. cur = b;
  1183. while ( (cur = cur.parentNode) ) {
  1184. bp.unshift( cur );
  1185. }
  1186. // Walk down the tree looking for a discrepancy
  1187. while ( ap[i] === bp[i] ) {
  1188. i++;
  1189. }
  1190. return i ?
  1191. // Do a sibling check if the nodes have a common ancestor
  1192. siblingCheck( ap[i], bp[i] ) :
  1193. // Otherwise nodes in our document sort first
  1194. ap[i] === preferredDoc ? -1 :
  1195. bp[i] === preferredDoc ? 1 :
  1196. 0;
  1197. };
  1198. return document;
  1199. };
  1200. Sizzle.matches = function( expr, elements ) {
  1201. return Sizzle( expr, null, null, elements );
  1202. };
  1203. Sizzle.matchesSelector = function( elem, expr ) {
  1204. // Set document vars if needed
  1205. if ( ( elem.ownerDocument || elem ) !== document ) {
  1206. setDocument( elem );
  1207. }
  1208. // Make sure that attribute selectors are quoted
  1209. expr = expr.replace( rattributeQuotes, "='$1']" );
  1210. if ( support.matchesSelector && documentIsHTML &&
  1211. !compilerCache[ expr + " " ] &&
  1212. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  1213. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  1214. try {
  1215. var ret = matches.call( elem, expr );
  1216. // IE 9's matchesSelector returns false on disconnected nodes
  1217. if ( ret || support.disconnectedMatch ||
  1218. // As well, disconnected nodes are said to be in a document
  1219. // fragment in IE 9
  1220. elem.document && elem.document.nodeType !== 11 ) {
  1221. return ret;
  1222. }
  1223. } catch (e) {}
  1224. }
  1225. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  1226. };
  1227. Sizzle.contains = function( context, elem ) {
  1228. // Set document vars if needed
  1229. if ( ( context.ownerDocument || context ) !== document ) {
  1230. setDocument( context );
  1231. }
  1232. return contains( context, elem );
  1233. };
  1234. Sizzle.attr = function( elem, name ) {
  1235. // Set document vars if needed
  1236. if ( ( elem.ownerDocument || elem ) !== document ) {
  1237. setDocument( elem );
  1238. }
  1239. var fn = Expr.attrHandle[ name.toLowerCase() ],
  1240. // Don't get fooled by Object.prototype properties (jQuery #13807)
  1241. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  1242. fn( elem, name, !documentIsHTML ) :
  1243. undefined;
  1244. return val !== undefined ?
  1245. val :
  1246. support.attributes || !documentIsHTML ?
  1247. elem.getAttribute( name ) :
  1248. (val = elem.getAttributeNode(name)) && val.specified ?
  1249. val.value :
  1250. null;
  1251. };
  1252. Sizzle.escape = function( sel ) {
  1253. return (sel + "").replace( rcssescape, fcssescape );
  1254. };
  1255. Sizzle.error = function( msg ) {
  1256. throw new Error( "Syntax error, unrecognized expression: " + msg );
  1257. };
  1258. /**
  1259. * Document sorting and removing duplicates
  1260. * @param {ArrayLike} results
  1261. */
  1262. Sizzle.uniqueSort = function( results ) {
  1263. var elem,
  1264. duplicates = [],
  1265. j = 0,
  1266. i = 0;
  1267. // Unless we *know* we can detect duplicates, assume their presence
  1268. hasDuplicate = !support.detectDuplicates;
  1269. sortInput = !support.sortStable && results.slice( 0 );
  1270. results.sort( sortOrder );
  1271. if ( hasDuplicate ) {
  1272. while ( (elem = results[i++]) ) {
  1273. if ( elem === results[ i ] ) {
  1274. j = duplicates.push( i );
  1275. }
  1276. }
  1277. while ( j-- ) {
  1278. results.splice( duplicates[ j ], 1 );
  1279. }
  1280. }
  1281. // Clear input after sorting to release objects
  1282. // See https://github.com/jquery/sizzle/pull/225
  1283. sortInput = null;
  1284. return results;
  1285. };
  1286. /**
  1287. * Utility function for retrieving the text value of an array of DOM nodes
  1288. * @param {Array|Element} elem
  1289. */
  1290. getText = Sizzle.getText = function( elem ) {
  1291. var node,
  1292. ret = "",
  1293. i = 0,
  1294. nodeType = elem.nodeType;
  1295. if ( !nodeType ) {
  1296. // If no nodeType, this is expected to be an array
  1297. while ( (node = elem[i++]) ) {
  1298. // Do not traverse comment nodes
  1299. ret += getText( node );
  1300. }
  1301. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  1302. // Use textContent for elements
  1303. // innerText usage removed for consistency of new lines (jQuery #11153)
  1304. if ( typeof elem.textContent === "string" ) {
  1305. return elem.textContent;
  1306. } else {
  1307. // Traverse its children
  1308. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1309. ret += getText( elem );
  1310. }
  1311. }
  1312. } else if ( nodeType === 3 || nodeType === 4 ) {
  1313. return elem.nodeValue;
  1314. }
  1315. // Do not include comment or processing instruction nodes
  1316. return ret;
  1317. };
  1318. Expr = Sizzle.selectors = {
  1319. // Can be adjusted by the user
  1320. cacheLength: 50,
  1321. createPseudo: markFunction,
  1322. match: matchExpr,
  1323. attrHandle: {},
  1324. find: {},
  1325. relative: {
  1326. ">": { dir: "parentNode", first: true },
  1327. " ": { dir: "parentNode" },
  1328. "+": { dir: "previousSibling", first: true },
  1329. "~": { dir: "previousSibling" }
  1330. },
  1331. preFilter: {
  1332. "ATTR": function( match ) {
  1333. match[1] = match[1].replace( runescape, funescape );
  1334. // Move the given value to match[3] whether quoted or unquoted
  1335. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  1336. if ( match[2] === "~=" ) {
  1337. match[3] = " " + match[3] + " ";
  1338. }
  1339. return match.slice( 0, 4 );
  1340. },
  1341. "CHILD": function( match ) {
  1342. /* matches from matchExpr["CHILD"]
  1343. 1 type (only|nth|...)
  1344. 2 what (child|of-type)
  1345. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  1346. 4 xn-component of xn+y argument ([+-]?\d*n|)
  1347. 5 sign of xn-component
  1348. 6 x of xn-component
  1349. 7 sign of y-component
  1350. 8 y of y-component
  1351. */
  1352. match[1] = match[1].toLowerCase();
  1353. if ( match[1].slice( 0, 3 ) === "nth" ) {
  1354. // nth-* requires argument
  1355. if ( !match[3] ) {
  1356. Sizzle.error( match[0] );
  1357. }
  1358. // numeric x and y parameters for Expr.filter.CHILD
  1359. // remember that false/true cast respectively to 0/1
  1360. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  1361. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  1362. // other types prohibit arguments
  1363. } else if ( match[3] ) {
  1364. Sizzle.error( match[0] );
  1365. }
  1366. return match;
  1367. },
  1368. "PSEUDO": function( match ) {
  1369. var excess,
  1370. unquoted = !match[6] && match[2];
  1371. if ( matchExpr["CHILD"].test( match[0] ) ) {
  1372. return null;
  1373. }
  1374. // Accept quoted arguments as-is
  1375. if ( match[3] ) {
  1376. match[2] = match[4] || match[5] || "";
  1377. // Strip excess characters from unquoted arguments
  1378. } else if ( unquoted && rpseudo.test( unquoted ) &&
  1379. // Get excess from tokenize (recursively)
  1380. (excess = tokenize( unquoted, true )) &&
  1381. // advance to the next closing parenthesis
  1382. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  1383. // excess is a negative index
  1384. match[0] = match[0].slice( 0, excess );
  1385. match[2] = unquoted.slice( 0, excess );
  1386. }
  1387. // Return only captures needed by the pseudo filter method (type and argument)
  1388. return match.slice( 0, 3 );
  1389. }
  1390. },
  1391. filter: {
  1392. "TAG": function( nodeNameSelector ) {
  1393. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  1394. return nodeNameSelector === "*" ?
  1395. function() { return true; } :
  1396. function( elem ) {
  1397. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  1398. };
  1399. },
  1400. "CLASS": function( className ) {
  1401. var pattern = classCache[ className + " " ];
  1402. return pattern ||
  1403. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  1404. classCache( className, function( elem ) {
  1405. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  1406. });
  1407. },
  1408. "ATTR": function( name, operator, check ) {
  1409. return function( elem ) {
  1410. var result = Sizzle.attr( elem, name );
  1411. if ( result == null ) {
  1412. return operator === "!=";
  1413. }
  1414. if ( !operator ) {
  1415. return true;
  1416. }
  1417. result += "";
  1418. return operator === "=" ? result === check :
  1419. operator === "!=" ? result !== check :
  1420. operator === "^=" ? check && result.indexOf( check ) === 0 :
  1421. operator === "*=" ? check && result.indexOf( check ) > -1 :
  1422. operator === "$=" ? check && result.slice( -check.length ) === check :
  1423. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  1424. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  1425. false;
  1426. };
  1427. },
  1428. "CHILD": function( type, what, argument, first, last ) {
  1429. var simple = type.slice( 0, 3 ) !== "nth",
  1430. forward = type.slice( -4 ) !== "last",
  1431. ofType = what === "of-type";
  1432. return first === 1 && last === 0 ?
  1433. // Shortcut for :nth-*(n)
  1434. function( elem ) {
  1435. return !!elem.parentNode;
  1436. } :
  1437. function( elem, context, xml ) {
  1438. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  1439. dir = simple !== forward ? "nextSibling" : "previousSibling",
  1440. parent = elem.parentNode,
  1441. name = ofType && elem.nodeName.toLowerCase(),
  1442. useCache = !xml && !ofType,
  1443. diff = false;
  1444. if ( parent ) {
  1445. // :(first|last|only)-(child|of-type)
  1446. if ( simple ) {
  1447. while ( dir ) {
  1448. node = elem;
  1449. while ( (node = node[ dir ]) ) {
  1450. if ( ofType ?
  1451. node.nodeName.toLowerCase() === name :
  1452. node.nodeType === 1 ) {
  1453. return false;
  1454. }
  1455. }
  1456. // Reverse direction for :only-* (if we haven't yet done so)
  1457. start = dir = type === "only" && !start && "nextSibling";
  1458. }
  1459. return true;
  1460. }
  1461. start = [ forward ? parent.firstChild : parent.lastChild ];
  1462. // non-xml :nth-child(...) stores cache data on `parent`
  1463. if ( forward && useCache ) {
  1464. // Seek `elem` from a previously-cached index
  1465. // ...in a gzip-friendly way
  1466. node = parent;
  1467. outerCache = node[ expando ] || (node[ expando ] = {});
  1468. // Support: IE <9 only
  1469. // Defend against cloned attroperties (jQuery gh-1709)
  1470. uniqueCache = outerCache[ node.uniqueID ] ||
  1471. (outerCache[ node.uniqueID ] = {});
  1472. cache = uniqueCache[ type ] || [];
  1473. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1474. diff = nodeIndex && cache[ 2 ];
  1475. node = nodeIndex && parent.childNodes[ nodeIndex ];
  1476. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1477. // Fallback to seeking `elem` from the start
  1478. (diff = nodeIndex = 0) || start.pop()) ) {
  1479. // When found, cache indexes on `parent` and break
  1480. if ( node.nodeType === 1 && ++diff && node === elem ) {
  1481. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  1482. break;
  1483. }
  1484. }
  1485. } else {
  1486. // Use previously-cached element index if available
  1487. if ( useCache ) {
  1488. // ...in a gzip-friendly way
  1489. node = elem;
  1490. outerCache = node[ expando ] || (node[ expando ] = {});
  1491. // Support: IE <9 only
  1492. // Defend against cloned attroperties (jQuery gh-1709)
  1493. uniqueCache = outerCache[ node.uniqueID ] ||
  1494. (outerCache[ node.uniqueID ] = {});
  1495. cache = uniqueCache[ type ] || [];
  1496. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1497. diff = nodeIndex;
  1498. }
  1499. // xml :nth-child(...)
  1500. // or :nth-