纽威
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

8269 lines
214 KiB

  1. /*!
  2. * jQuery JavaScript Library v3.3.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/parseXML,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-event/ajax,-effects,-effects/Tween,-effects/animatedSelector
  3. * https://jquery.com/
  4. *
  5. * Includes Sizzle.js
  6. * https://sizzlejs.com/
  7. *
  8. * Copyright JS Foundation and other contributors
  9. * Released under the MIT license
  10. * https://jquery.org/license
  11. *
  12. * Date: 2018-01-20T17:24Z
  13. */
  14. ( function( global, factory ) {
  15. "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 document = window.document;
  44. var getProto = Object.getPrototypeOf;
  45. var slice = arr.slice;
  46. var concat = arr.concat;
  47. var push = arr.push;
  48. var indexOf = arr.indexOf;
  49. var class2type = {};
  50. var toString = class2type.toString;
  51. var hasOwn = class2type.hasOwnProperty;
  52. var fnToString = hasOwn.toString;
  53. var ObjectFunctionString = fnToString.call( Object );
  54. var support = {};
  55. var isFunction = function isFunction( obj ) {
  56. // Support: Chrome <=57, Firefox <=52
  57. // In some browsers, typeof returns "function" for HTML <object> elements
  58. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  59. // We don't want to classify *any* DOM node as a function.
  60. return typeof obj === "function" && typeof obj.nodeType !== "number";
  61. };
  62. var isWindow = function isWindow( obj ) {
  63. return obj != null && obj === obj.window;
  64. };
  65. var preservedScriptAttributes = {
  66. type: true,
  67. src: true,
  68. noModule: true
  69. };
  70. function DOMEval( code, doc, node ) {
  71. doc = doc || document;
  72. var i,
  73. script = doc.createElement( "script" );
  74. script.text = code;
  75. if ( node ) {
  76. for ( i in preservedScriptAttributes ) {
  77. if ( node[ i ] ) {
  78. script[ i ] = node[ i ];
  79. }
  80. }
  81. }
  82. doc.head.appendChild( script ).parentNode.removeChild( script );
  83. }
  84. function toType( obj ) {
  85. if ( obj == null ) {
  86. return obj + "";
  87. }
  88. // Support: Android <=2.3 only (functionish RegExp)
  89. return typeof obj === "object" || typeof obj === "function" ?
  90. class2type[ toString.call( obj ) ] || "object" :
  91. typeof obj;
  92. }
  93. /* global Symbol */
  94. // Defining this global in .eslintrc.json would create a danger of using the global
  95. // unguarded in another place, it seems safer to define global only for this module
  96. var
  97. version = "3.3.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/parseXML,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-event/ajax,-effects,-effects/Tween,-effects/animatedSelector",
  98. // Define a local copy of jQuery
  99. jQuery = function( selector, context ) {
  100. // The jQuery object is actually just the init constructor 'enhanced'
  101. // Need init if jQuery is called (just allow error to be thrown if not included)
  102. return new jQuery.fn.init( selector, context );
  103. },
  104. // Support: Android <=4.0 only
  105. // Make sure we trim BOM and NBSP
  106. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  107. jQuery.fn = jQuery.prototype = {
  108. // The current version of jQuery being used
  109. jquery: version,
  110. constructor: jQuery,
  111. // The default length of a jQuery object is 0
  112. length: 0,
  113. toArray: function() {
  114. return slice.call( this );
  115. },
  116. // Get the Nth element in the matched element set OR
  117. // Get the whole matched element set as a clean array
  118. get: function( num ) {
  119. // Return all the elements in a clean array
  120. if ( num == null ) {
  121. return slice.call( this );
  122. }
  123. // Return just the one element from the set
  124. return num < 0 ? this[ num + this.length ] : this[ num ];
  125. },
  126. // Take an array of elements and push it onto the stack
  127. // (returning the new matched element set)
  128. pushStack: function( elems ) {
  129. // Build a new jQuery matched element set
  130. var ret = jQuery.merge( this.constructor(), elems );
  131. // Add the old object onto the stack (as a reference)
  132. ret.prevObject = this;
  133. // Return the newly-formed element set
  134. return ret;
  135. },
  136. // Execute a callback for every element in the matched set.
  137. each: function( callback ) {
  138. return jQuery.each( this, callback );
  139. },
  140. map: function( callback ) {
  141. return this.pushStack( jQuery.map( this, function( elem, i ) {
  142. return callback.call( elem, i, elem );
  143. } ) );
  144. },
  145. slice: function() {
  146. return this.pushStack( slice.apply( this, arguments ) );
  147. },
  148. first: function() {
  149. return this.eq( 0 );
  150. },
  151. last: function() {
  152. return this.eq( -1 );
  153. },
  154. eq: function( i ) {
  155. var len = this.length,
  156. j = +i + ( i < 0 ? len : 0 );
  157. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  158. },
  159. end: function() {
  160. return this.prevObject || this.constructor();
  161. },
  162. // For internal use only.
  163. // Behaves like an Array's method, not like a jQuery method.
  164. push: push,
  165. sort: arr.sort,
  166. splice: arr.splice
  167. };
  168. jQuery.extend = jQuery.fn.extend = function() {
  169. var options, name, src, copy, copyIsArray, clone,
  170. target = arguments[ 0 ] || {},
  171. i = 1,
  172. length = arguments.length,
  173. deep = false;
  174. // Handle a deep copy situation
  175. if ( typeof target === "boolean" ) {
  176. deep = target;
  177. // Skip the boolean and the target
  178. target = arguments[ i ] || {};
  179. i++;
  180. }
  181. // Handle case when target is a string or something (possible in deep copy)
  182. if ( typeof target !== "object" && !isFunction( target ) ) {
  183. target = {};
  184. }
  185. // Extend jQuery itself if only one argument is passed
  186. if ( i === length ) {
  187. target = this;
  188. i--;
  189. }
  190. for ( ; i < length; i++ ) {
  191. // Only deal with non-null/undefined values
  192. if ( ( options = arguments[ i ] ) != null ) {
  193. // Extend the base object
  194. for ( name in options ) {
  195. src = target[ name ];
  196. copy = options[ name ];
  197. // Prevent never-ending loop
  198. if ( target === copy ) {
  199. continue;
  200. }
  201. // Recurse if we're merging plain objects or arrays
  202. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  203. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  204. if ( copyIsArray ) {
  205. copyIsArray = false;
  206. clone = src && Array.isArray( src ) ? src : [];
  207. } else {
  208. clone = src && jQuery.isPlainObject( src ) ? src : {};
  209. }
  210. // Never move original objects, clone them
  211. target[ name ] = jQuery.extend( deep, clone, copy );
  212. // Don't bring in undefined values
  213. } else if ( copy !== undefined ) {
  214. target[ name ] = copy;
  215. }
  216. }
  217. }
  218. }
  219. // Return the modified object
  220. return target;
  221. };
  222. jQuery.extend( {
  223. // Unique for each copy of jQuery on the page
  224. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  225. // Assume jQuery is ready without the ready module
  226. isReady: true,
  227. error: function( msg ) {
  228. throw new Error( msg );
  229. },
  230. noop: function() {},
  231. isPlainObject: function( obj ) {
  232. var proto, Ctor;
  233. // Detect obvious negatives
  234. // Use toString instead of jQuery.type to catch host objects
  235. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  236. return false;
  237. }
  238. proto = getProto( obj );
  239. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  240. if ( !proto ) {
  241. return true;
  242. }
  243. // Objects with prototype are plain iff they were constructed by a global Object function
  244. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  245. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  246. },
  247. isEmptyObject: function( obj ) {
  248. /* eslint-disable no-unused-vars */
  249. // See https://github.com/eslint/eslint/issues/6125
  250. var name;
  251. for ( name in obj ) {
  252. return false;
  253. }
  254. return true;
  255. },
  256. // Evaluates a script in a global context
  257. globalEval: function( code ) {
  258. DOMEval( code );
  259. },
  260. each: function( obj, callback ) {
  261. var length, i = 0;
  262. if ( isArrayLike( obj ) ) {
  263. length = obj.length;
  264. for ( ; i < length; i++ ) {
  265. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  266. break;
  267. }
  268. }
  269. } else {
  270. for ( i in obj ) {
  271. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  272. break;
  273. }
  274. }
  275. }
  276. return obj;
  277. },
  278. // Support: Android <=4.0 only
  279. trim: function( text ) {
  280. return text == null ?
  281. "" :
  282. ( text + "" ).replace( rtrim, "" );
  283. },
  284. // results is for internal usage only
  285. makeArray: function( arr, results ) {
  286. var ret = results || [];
  287. if ( arr != null ) {
  288. if ( isArrayLike( Object( arr ) ) ) {
  289. jQuery.merge( ret,
  290. typeof arr === "string" ?
  291. [ arr ] : arr
  292. );
  293. } else {
  294. push.call( ret, arr );
  295. }
  296. }
  297. return ret;
  298. },
  299. inArray: function( elem, arr, i ) {
  300. return arr == null ? -1 : indexOf.call( arr, elem, i );
  301. },
  302. // Support: Android <=4.0 only, PhantomJS 1 only
  303. // push.apply(_, arraylike) throws on ancient WebKit
  304. merge: function( first, second ) {
  305. var len = +second.length,
  306. j = 0,
  307. i = first.length;
  308. for ( ; j < len; j++ ) {
  309. first[ i++ ] = second[ j ];
  310. }
  311. first.length = i;
  312. return first;
  313. },
  314. grep: function( elems, callback, invert ) {
  315. var callbackInverse,
  316. matches = [],
  317. i = 0,
  318. length = elems.length,
  319. callbackExpect = !invert;
  320. // Go through the array, only saving the items
  321. // that pass the validator function
  322. for ( ; i < length; i++ ) {
  323. callbackInverse = !callback( elems[ i ], i );
  324. if ( callbackInverse !== callbackExpect ) {
  325. matches.push( elems[ i ] );
  326. }
  327. }
  328. return matches;
  329. },
  330. // arg is for internal usage only
  331. map: function( elems, callback, arg ) {
  332. var length, value,
  333. i = 0,
  334. ret = [];
  335. // Go through the array, translating each of the items to their new values
  336. if ( isArrayLike( elems ) ) {
  337. length = elems.length;
  338. for ( ; i < length; i++ ) {
  339. value = callback( elems[ i ], i, arg );
  340. if ( value != null ) {
  341. ret.push( value );
  342. }
  343. }
  344. // Go through every key on the object,
  345. } else {
  346. for ( i in elems ) {
  347. value = callback( elems[ i ], i, arg );
  348. if ( value != null ) {
  349. ret.push( value );
  350. }
  351. }
  352. }
  353. // Flatten any nested arrays
  354. return concat.apply( [], ret );
  355. },
  356. // A global GUID counter for objects
  357. guid: 1,
  358. // jQuery.support is not used in Core but other projects attach their
  359. // properties to it so it needs to exist.
  360. support: support
  361. } );
  362. if ( typeof Symbol === "function" ) {
  363. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  364. }
  365. // Populate the class2type map
  366. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  367. function( i, name ) {
  368. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  369. } );
  370. function isArrayLike( obj ) {
  371. // Support: real iOS 8.2 only (not reproducible in simulator)
  372. // `in` check used to prevent JIT error (gh-2145)
  373. // hasOwn isn't used here due to false negatives
  374. // regarding Nodelist length in IE
  375. var length = !!obj && "length" in obj && obj.length,
  376. type = toType( obj );
  377. if ( isFunction( obj ) || isWindow( obj ) ) {
  378. return false;
  379. }
  380. return type === "array" || length === 0 ||
  381. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  382. }
  383. var Sizzle =
  384. /*!
  385. * Sizzle CSS Selector Engine v2.3.3
  386. * https://sizzlejs.com/
  387. *
  388. * Copyright jQuery Foundation and other contributors
  389. * Released under the MIT license
  390. * http://jquery.org/license
  391. *
  392. * Date: 2016-08-08
  393. */
  394. (function( window ) {
  395. var i,
  396. support,
  397. Expr,
  398. getText,
  399. isXML,
  400. tokenize,
  401. compile,
  402. select,
  403. outermostContext,
  404. sortInput,
  405. hasDuplicate,
  406. // Local document vars
  407. setDocument,
  408. document,
  409. docElem,
  410. documentIsHTML,
  411. rbuggyQSA,
  412. rbuggyMatches,
  413. matches,
  414. contains,
  415. // Instance-specific data
  416. expando = "sizzle" + 1 * new Date(),
  417. preferredDoc = window.document,
  418. dirruns = 0,
  419. done = 0,
  420. classCache = createCache(),
  421. tokenCache = createCache(),
  422. compilerCache = createCache(),
  423. sortOrder = function( a, b ) {
  424. if ( a === b ) {
  425. hasDuplicate = true;
  426. }
  427. return 0;
  428. },
  429. // Instance methods
  430. hasOwn = ({}).hasOwnProperty,
  431. arr = [],
  432. pop = arr.pop,
  433. push_native = arr.push,
  434. push = arr.push,
  435. slice = arr.slice,
  436. // Use a stripped-down indexOf as it's faster than native
  437. // https://jsperf.com/thor-indexof-vs-for/5
  438. indexOf = function( list, elem ) {
  439. var i = 0,
  440. len = list.length;
  441. for ( ; i < len; i++ ) {
  442. if ( list[i] === elem ) {
  443. return i;
  444. }
  445. }
  446. return -1;
  447. },
  448. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  449. // Regular expressions
  450. // http://www.w3.org/TR/css3-selectors/#whitespace
  451. whitespace = "[\\x20\\t\\r\\n\\f]",
  452. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  453. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  454. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  455. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  456. // Operator (capture 2)
  457. "*([*^$|!~]?=)" + whitespace +
  458. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  459. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  460. "*\\]",
  461. pseudos = ":(" + identifier + ")(?:\\((" +
  462. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  463. // 1. quoted (capture 3; capture 4 or capture 5)
  464. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  465. // 2. simple (capture 6)
  466. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  467. // 3. anything else (capture 2)
  468. ".*" +
  469. ")\\)|)",
  470. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  471. rwhitespace = new RegExp( whitespace + "+", "g" ),
  472. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  473. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  474. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  475. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  476. rpseudo = new RegExp( pseudos ),
  477. ridentifier = new RegExp( "^" + identifier + "$" ),
  478. matchExpr = {
  479. "ID": new RegExp( "^#(" + identifier + ")" ),
  480. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  481. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  482. "ATTR": new RegExp( "^" + attributes ),
  483. "PSEUDO": new RegExp( "^" + pseudos ),
  484. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  485. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  486. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  487. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  488. // For use in libraries implementing .is()
  489. // We use this for POS matching in `select`
  490. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  491. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  492. },
  493. rinputs = /^(?:input|select|textarea|button)$/i,
  494. rheader = /^h\d$/i,
  495. rnative = /^[^{]+\{\s*\[native \w/,
  496. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  497. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  498. rsibling = /[+~]/,
  499. // CSS escapes
  500. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  501. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  502. funescape = function( _, escaped, escapedWhitespace ) {
  503. var high = "0x" + escaped - 0x10000;
  504. // NaN means non-codepoint
  505. // Support: Firefox<24
  506. // Workaround erroneous numeric interpretation of +"0x"
  507. return high !== high || escapedWhitespace ?
  508. escaped :
  509. high < 0 ?
  510. // BMP codepoint
  511. String.fromCharCode( high + 0x10000 ) :
  512. // Supplemental Plane codepoint (surrogate pair)
  513. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  514. },
  515. // CSS string/identifier serialization
  516. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  517. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  518. fcssescape = function( ch, asCodePoint ) {
  519. if ( asCodePoint ) {
  520. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  521. if ( ch === "\0" ) {
  522. return "\uFFFD";
  523. }
  524. // Control characters and (dependent upon position) numbers get escaped as code points
  525. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  526. }
  527. // Other potentially-special ASCII characters get backslash-escaped
  528. return "\\" + ch;
  529. },
  530. // Used for iframes
  531. // See setDocument()
  532. // Removing the function wrapper causes a "Permission Denied"
  533. // error in IE
  534. unloadHandler = function() {
  535. setDocument();
  536. },
  537. disabledAncestor = addCombinator(
  538. function( elem ) {
  539. return elem.disabled === true && ("form" in elem || "label" in elem);
  540. },
  541. { dir: "parentNode", next: "legend" }
  542. );
  543. // Optimize for push.apply( _, NodeList )
  544. try {
  545. push.apply(
  546. (arr = slice.call( preferredDoc.childNodes )),
  547. preferredDoc.childNodes
  548. );
  549. // Support: Android<4.0
  550. // Detect silently failing push.apply
  551. arr[ preferredDoc.childNodes.length ].nodeType;
  552. } catch ( e ) {
  553. push = { apply: arr.length ?
  554. // Leverage slice if possible
  555. function( target, els ) {
  556. push_native.apply( target, slice.call(els) );
  557. } :
  558. // Support: IE<9
  559. // Otherwise append directly
  560. function( target, els ) {
  561. var j = target.length,
  562. i = 0;
  563. // Can't trust NodeList.length
  564. while ( (target[j++] = els[i++]) ) {}
  565. target.length = j - 1;
  566. }
  567. };
  568. }
  569. function Sizzle( selector, context, results, seed ) {
  570. var m, i, elem, nid, match, groups, newSelector,
  571. newContext = context && context.ownerDocument,
  572. // nodeType defaults to 9, since context defaults to document
  573. nodeType = context ? context.nodeType : 9;
  574. results = results || [];
  575. // Return early from calls with invalid selector or context
  576. if ( typeof selector !== "string" || !selector ||
  577. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  578. return results;
  579. }
  580. // Try to shortcut find operations (as opposed to filters) in HTML documents
  581. if ( !seed ) {
  582. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  583. setDocument( context );
  584. }
  585. context = context || document;
  586. if ( documentIsHTML ) {
  587. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  588. // (excepting DocumentFragment context, where the methods don't exist)
  589. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  590. // ID selector
  591. if ( (m = match[1]) ) {
  592. // Document context
  593. if ( nodeType === 9 ) {
  594. if ( (elem = context.getElementById( m )) ) {
  595. // Support: IE, Opera, Webkit
  596. // TODO: identify versions
  597. // getElementById can match elements by name instead of ID
  598. if ( elem.id === m ) {
  599. results.push( elem );
  600. return results;
  601. }
  602. } else {
  603. return results;
  604. }
  605. // Element context
  606. } else {
  607. // Support: IE, Opera, Webkit
  608. // TODO: identify versions
  609. // getElementById can match elements by name instead of ID
  610. if ( newContext && (elem = newContext.getElementById( m )) &&
  611. contains( context, elem ) &&
  612. elem.id === m ) {
  613. results.push( elem );
  614. return results;
  615. }
  616. }
  617. // Type selector
  618. } else if ( match[2] ) {
  619. push.apply( results, context.getElementsByTagName( selector ) );
  620. return results;
  621. // Class selector
  622. } else if ( (m = match[3]) && support.getElementsByClassName &&
  623. context.getElementsByClassName ) {
  624. push.apply( results, context.getElementsByClassName( m ) );
  625. return results;
  626. }
  627. }
  628. // Take advantage of querySelectorAll
  629. if ( support.qsa &&
  630. !compilerCache[ selector + " " ] &&
  631. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  632. if ( nodeType !== 1 ) {
  633. newContext = context;
  634. newSelector = selector;
  635. // qSA looks outside Element context, which is not what we want
  636. // Thanks to Andrew Dupont for this workaround technique
  637. // Support: IE <=8
  638. // Exclude object elements
  639. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  640. // Capture the context ID, setting it first if necessary
  641. if ( (nid = context.getAttribute( "id" )) ) {
  642. nid = nid.replace( rcssescape, fcssescape );
  643. } else {
  644. context.setAttribute( "id", (nid = expando) );
  645. }
  646. // Prefix every selector in the list
  647. groups = tokenize( selector );
  648. i = groups.length;
  649. while ( i-- ) {
  650. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  651. }
  652. newSelector = groups.join( "," );
  653. // Expand context for sibling selectors
  654. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  655. context;
  656. }
  657. if ( newSelector ) {
  658. try {
  659. push.apply( results,
  660. newContext.querySelectorAll( newSelector )
  661. );
  662. return results;
  663. } catch ( qsaError ) {
  664. } finally {
  665. if ( nid === expando ) {
  666. context.removeAttribute( "id" );
  667. }
  668. }
  669. }
  670. }
  671. }
  672. }
  673. // All others
  674. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  675. }
  676. /**
  677. * Create key-value caches of limited size
  678. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  679. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  680. * deleting the oldest entry
  681. */
  682. function createCache() {
  683. var keys = [];
  684. function cache( key, value ) {
  685. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  686. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  687. // Only keep the most recent entries
  688. delete cache[ keys.shift() ];
  689. }
  690. return (cache[ key + " " ] = value);
  691. }
  692. return cache;
  693. }
  694. /**
  695. * Mark a function for special use by Sizzle
  696. * @param {Function} fn The function to mark
  697. */
  698. function markFunction( fn ) {
  699. fn[ expando ] = true;
  700. return fn;
  701. }
  702. /**
  703. * Support testing using an element
  704. * @param {Function} fn Passed the created element and returns a boolean result
  705. */
  706. function assert( fn ) {
  707. var el = document.createElement("fieldset");
  708. try {
  709. return !!fn( el );
  710. } catch (e) {
  711. return false;
  712. } finally {
  713. // Remove from its parent by default
  714. if ( el.parentNode ) {
  715. el.parentNode.removeChild( el );
  716. }
  717. // release memory in IE
  718. el = null;
  719. }
  720. }
  721. /**
  722. * Adds the same handler for all of the specified attrs
  723. * @param {String} attrs Pipe-separated list of attributes
  724. * @param {Function} handler The method that will be applied
  725. */
  726. function addHandle( attrs, handler ) {
  727. var arr = attrs.split("|"),
  728. i = arr.length;
  729. while ( i-- ) {
  730. Expr.attrHandle[ arr[i] ] = handler;
  731. }
  732. }
  733. /**
  734. * Checks document order of two siblings
  735. * @param {Element} a
  736. * @param {Element} b
  737. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  738. */
  739. function siblingCheck( a, b ) {
  740. var cur = b && a,
  741. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  742. a.sourceIndex - b.sourceIndex;
  743. // Use IE sourceIndex if available on both nodes
  744. if ( diff ) {
  745. return diff;
  746. }
  747. // Check if b follows a
  748. if ( cur ) {
  749. while ( (cur = cur.nextSibling) ) {
  750. if ( cur === b ) {
  751. return -1;
  752. }
  753. }
  754. }
  755. return a ? 1 : -1;
  756. }
  757. /**
  758. * Returns a function to use in pseudos for input types
  759. * @param {String} type
  760. */
  761. function createInputPseudo( type ) {
  762. return function( elem ) {
  763. var name = elem.nodeName.toLowerCase();
  764. return name === "input" && elem.type === type;
  765. };
  766. }
  767. /**
  768. * Returns a function to use in pseudos for buttons
  769. * @param {String} type
  770. */
  771. function createButtonPseudo( type ) {
  772. return function( elem ) {
  773. var name = elem.nodeName.toLowerCase();
  774. return (name === "input" || name === "button") && elem.type === type;
  775. };
  776. }
  777. /**
  778. * Returns a function to use in pseudos for :enabled/:disabled
  779. * @param {Boolean} disabled true for :disabled; false for :enabled
  780. */
  781. function createDisabledPseudo( disabled ) {
  782. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  783. return function( elem ) {
  784. // Only certain elements can match :enabled or :disabled
  785. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  786. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  787. if ( "form" in elem ) {
  788. // Check for inherited disabledness on relevant non-disabled elements:
  789. // * listed form-associated elements in a disabled fieldset
  790. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  791. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  792. // * option elements in a disabled optgroup
  793. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  794. // All such elements have a "form" property.
  795. if ( elem.parentNode && elem.disabled === false ) {
  796. // Option elements defer to a parent optgroup if present
  797. if ( "label" in elem ) {
  798. if ( "label" in elem.parentNode ) {
  799. return elem.parentNode.disabled === disabled;
  800. } else {
  801. return elem.disabled === disabled;
  802. }
  803. }
  804. // Support: IE 6 - 11
  805. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  806. return elem.isDisabled === disabled ||
  807. // Where there is no isDisabled, check manually
  808. /* jshint -W018 */
  809. elem.isDisabled !== !disabled &&
  810. disabledAncestor( elem ) === disabled;
  811. }
  812. return elem.disabled === disabled;
  813. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  814. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  815. // even exist on them, let alone have a boolean value.
  816. } else if ( "label" in elem ) {
  817. return elem.disabled === disabled;
  818. }
  819. // Remaining elements are neither :enabled nor :disabled
  820. return false;
  821. };
  822. }
  823. /**
  824. * Returns a function to use in pseudos for positionals
  825. * @param {Function} fn
  826. */
  827. function createPositionalPseudo( fn ) {
  828. return markFunction(function( argument ) {
  829. argument = +argument;
  830. return markFunction(function( seed, matches ) {
  831. var j,
  832. matchIndexes = fn( [], seed.length, argument ),
  833. i = matchIndexes.length;
  834. // Match elements found at the specified indexes
  835. while ( i-- ) {
  836. if ( seed[ (j = matchIndexes[i]) ] ) {
  837. seed[j] = !(matches[j] = seed[j]);
  838. }
  839. }
  840. });
  841. });
  842. }
  843. /**
  844. * Checks a node for validity as a Sizzle context
  845. * @param {Element|Object=} context
  846. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  847. */
  848. function testContext( context ) {
  849. return context && typeof context.getElementsByTagName !== "undefined" && context;
  850. }
  851. // Expose support vars for convenience
  852. support = Sizzle.support = {};
  853. /**
  854. * Detects XML nodes
  855. * @param {Element|Object} elem An element or a document
  856. * @returns {Boolean} True iff elem is a non-HTML XML node
  857. */
  858. isXML = Sizzle.isXML = function( elem ) {
  859. // documentElement is verified for cases where it doesn't yet exist
  860. // (such as loading iframes in IE - #4833)
  861. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  862. return documentElement ? documentElement.nodeName !== "HTML" : false;
  863. };
  864. /**
  865. * Sets document-related variables once based on the current document
  866. * @param {Element|Object} [doc] An element or document object to use to set the document
  867. * @returns {Object} Returns the current document
  868. */
  869. setDocument = Sizzle.setDocument = function( node ) {
  870. var hasCompare, subWindow,
  871. doc = node ? node.ownerDocument || node : preferredDoc;
  872. // Return early if doc is invalid or already selected
  873. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  874. return document;
  875. }
  876. // Update global variables
  877. document = doc;
  878. docElem = document.documentElement;
  879. documentIsHTML = !isXML( document );
  880. // Support: IE 9-11, Edge
  881. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  882. if ( preferredDoc !== document &&
  883. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  884. // Support: IE 11, Edge
  885. if ( subWindow.addEventListener ) {
  886. subWindow.addEventListener( "unload", unloadHandler, false );
  887. // Support: IE 9 - 10 only
  888. } else if ( subWindow.attachEvent ) {
  889. subWindow.attachEvent( "onunload", unloadHandler );
  890. }
  891. }
  892. /* Attributes
  893. ---------------------------------------------------------------------- */
  894. // Support: IE<8
  895. // Verify that getAttribute really returns attributes and not properties
  896. // (excepting IE8 booleans)
  897. support.attributes = assert(function( el ) {
  898. el.className = "i";
  899. return !el.getAttribute("className");
  900. });
  901. /* getElement(s)By*
  902. ---------------------------------------------------------------------- */
  903. // Check if getElementsByTagName("*") returns only elements
  904. support.getElementsByTagName = assert(function( el ) {
  905. el.appendChild( document.createComment("") );
  906. return !el.getElementsByTagName("*").length;
  907. });
  908. // Support: IE<9
  909. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  910. // Support: IE<10
  911. // Check if getElementById returns elements by name
  912. // The broken getElementById methods don't pick up programmatically-set names,
  913. // so use a roundabout getElementsByName test
  914. support.getById = assert(function( el ) {
  915. docElem.appendChild( el ).id = expando;
  916. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  917. });
  918. // ID filter and find
  919. if ( support.getById ) {
  920. Expr.filter["ID"] = function( id ) {
  921. var attrId = id.replace( runescape, funescape );
  922. return function( elem ) {
  923. return elem.getAttribute("id") === attrId;
  924. };
  925. };
  926. Expr.find["ID"] = function( id, context ) {
  927. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  928. var elem = context.getElementById( id );
  929. return elem ? [ elem ] : [];
  930. }
  931. };
  932. } else {
  933. Expr.filter["ID"] = function( id ) {
  934. var attrId = id.replace( runescape, funescape );
  935. return function( elem ) {
  936. var node = typeof elem.getAttributeNode !== "undefined" &&
  937. elem.getAttributeNode("id");
  938. return node && node.value === attrId;
  939. };
  940. };
  941. // Support: IE 6 - 7 only
  942. // getElementById is not reliable as a find shortcut
  943. Expr.find["ID"] = function( id, context ) {
  944. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  945. var node, i, elems,
  946. elem = context.getElementById( id );
  947. if ( elem ) {
  948. // Verify the id attribute
  949. node = elem.getAttributeNode("id");
  950. if ( node && node.value === id ) {
  951. return [ elem ];
  952. }
  953. // Fall back on getElementsByName
  954. elems = context.getElementsByName( id );
  955. i = 0;
  956. while ( (elem = elems[i++]) ) {
  957. node = elem.getAttributeNode("id");
  958. if ( node && node.value === id ) {
  959. return [ elem ];
  960. }
  961. }
  962. }
  963. return [];
  964. }
  965. };
  966. }
  967. // Tag
  968. Expr.find["TAG"] = support.getElementsByTagName ?
  969. function( tag, context ) {
  970. if ( typeof context.getElementsByTagName !== "undefined" ) {
  971. return context.getElementsByTagName( tag );
  972. // DocumentFragment nodes don't have gEBTN
  973. } else if ( support.qsa ) {
  974. return context.querySelectorAll( tag );
  975. }
  976. } :
  977. function( tag, context ) {
  978. var elem,
  979. tmp = [],
  980. i = 0,
  981. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  982. results = context.getElementsByTagName( tag );
  983. // Filter out possible comments
  984. if ( tag === "*" ) {
  985. while ( (elem = results[i++]) ) {
  986. if ( elem.nodeType === 1 ) {
  987. tmp.push( elem );
  988. }
  989. }
  990. return tmp;
  991. }
  992. return results;
  993. };
  994. // Class
  995. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  996. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  997. return context.getElementsByClassName( className );
  998. }
  999. };
  1000. /* QSA/matchesSelector
  1001. ---------------------------------------------------------------------- */
  1002. // QSA and matchesSelector support
  1003. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  1004. rbuggyMatches = [];
  1005. // qSa(:focus) reports false when true (Chrome 21)
  1006. // We allow this because of a bug in IE8/9 that throws an error
  1007. // whenever `document.activeElement` is accessed on an iframe
  1008. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  1009. // See https://bugs.jquery.com/ticket/13378
  1010. rbuggyQSA = [];
  1011. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  1012. // Build QSA regex
  1013. // Regex strategy adopted from Diego Perini
  1014. assert(function( el ) {
  1015. // Select is set to empty string on purpose
  1016. // This is to test IE's treatment of not explicitly
  1017. // setting a boolean content attribute,
  1018. // since its presence should be enough
  1019. // https://bugs.jquery.com/ticket/12359
  1020. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  1021. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  1022. "<option selected=''></option></select>";
  1023. // Support: IE8, Opera 11-12.16
  1024. // Nothing should be selected when empty strings follow ^= or $= or *=
  1025. // The test attribute must be unknown in Opera but "safe" for WinRT
  1026. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  1027. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  1028. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  1029. }
  1030. // Support: IE8
  1031. // Boolean attributes and "value" are not treated correctly
  1032. if ( !el.querySelectorAll("[selected]").length ) {
  1033. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  1034. }
  1035. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  1036. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  1037. rbuggyQSA.push("~=");
  1038. }
  1039. // Webkit/Opera - :checked should return selected option elements
  1040. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1041. // IE8 throws error here and will not see later tests
  1042. if ( !el.querySelectorAll(":checked").length ) {
  1043. rbuggyQSA.push(":checked");
  1044. }
  1045. // Support: Safari 8+, iOS 8+
  1046. // https://bugs.webkit.org/show_bug.cgi?id=136851
  1047. // In-page `selector#id sibling-combinator selector` fails
  1048. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  1049. rbuggyQSA.push(".#.+[+~]");
  1050. }
  1051. });
  1052. assert(function( el ) {
  1053. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  1054. "<select disabled='disabled'><option/></select>";
  1055. // Support: Windows 8 Native Apps
  1056. // The type and name attributes are restricted during .innerHTML assignment
  1057. var input = document.createElement("input");
  1058. input.setAttribute( "type", "hidden" );
  1059. el.appendChild( input ).setAttribute( "name", "D" );
  1060. // Support: IE8
  1061. // Enforce case-sensitivity of name attribute
  1062. if ( el.querySelectorAll("[name=d]").length ) {
  1063. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  1064. }
  1065. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  1066. // IE8 throws error here and will not see later tests
  1067. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  1068. rbuggyQSA.push( ":enabled", ":disabled" );
  1069. }
  1070. // Support: IE9-11+
  1071. // IE's :disabled selector does not pick up the children of disabled fieldsets
  1072. docElem.appendChild( el ).disabled = true;
  1073. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  1074. rbuggyQSA.push( ":enabled", ":disabled" );
  1075. }
  1076. // Opera 10-11 does not throw on post-comma invalid pseudos
  1077. el.querySelectorAll("*,:x");
  1078. rbuggyQSA.push(",.*:");
  1079. });
  1080. }
  1081. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  1082. docElem.webkitMatchesSelector ||
  1083. docElem.mozMatchesSelector ||
  1084. docElem.oMatchesSelector ||
  1085. docElem.msMatchesSelector) )) ) {
  1086. assert(function( el ) {
  1087. // Check to see if it's possible to do matchesSelector
  1088. // on a disconnected node (IE 9)
  1089. support.disconnectedMatch = matches.call( el, "*" );
  1090. // This should fail with an exception
  1091. // Gecko does not error, returns false instead
  1092. matches.call( el, "[s!='']:x" );
  1093. rbuggyMatches.push( "!=", pseudos );
  1094. });
  1095. }
  1096. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  1097. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  1098. /* Contains
  1099. ---------------------------------------------------------------------- */
  1100. hasCompare = rnative.test( docElem.compareDocumentPosition );
  1101. // Element contains another
  1102. // Purposefully self-exclusive
  1103. // As in, an element does not contain itself
  1104. contains = hasCompare || rnative.test( docElem.contains ) ?
  1105. function( a, b ) {
  1106. var adown = a.nodeType === 9 ? a.documentElement : a,
  1107. bup = b && b.parentNode;
  1108. return a === bup || !!( bup && bup.nodeType === 1 && (
  1109. adown.contains ?
  1110. adown.contains( bup ) :
  1111. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  1112. ));
  1113. } :
  1114. function( a, b ) {
  1115. if ( b ) {
  1116. while ( (b = b.parentNode) ) {
  1117. if ( b === a ) {
  1118. return true;
  1119. }
  1120. }
  1121. }
  1122. return false;
  1123. };
  1124. /* Sorting
  1125. ---------------------------------------------------------------------- */
  1126. // Document order sorting
  1127. sortOrder = hasCompare ?
  1128. function( a, b ) {
  1129. // Flag for duplicate removal
  1130. if ( a === b ) {
  1131. hasDuplicate = true;
  1132. return 0;
  1133. }
  1134. // Sort on method existence if only one input has compareDocumentPosition
  1135. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  1136. if ( compare ) {
  1137. return compare;
  1138. }
  1139. // Calculate position if both inputs belong to the same document
  1140. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  1141. a.compareDocumentPosition( b ) :
  1142. // Otherwise we know they are disconnected
  1143. 1;
  1144. // Disconnected nodes
  1145. if ( compare & 1 ||
  1146. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  1147. // Choose the first element that is related to our preferred document
  1148. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  1149. return -1;
  1150. }
  1151. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  1152. return 1;
  1153. }
  1154. // Maintain original order
  1155. return sortInput ?
  1156. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1157. 0;
  1158. }
  1159. return compare & 4 ? -1 : 1;
  1160. } :
  1161. function( a, b ) {
  1162. // Exit early if the nodes are identical
  1163. if ( a === b ) {
  1164. hasDuplicate = true;
  1165. return 0;
  1166. }
  1167. var cur,
  1168. i = 0,
  1169. aup = a.parentNode,
  1170. bup = b.parentNode,
  1171. ap = [ a ],
  1172. bp = [ b ];
  1173. // Parentless nodes are either documents or disconnected
  1174. if ( !aup || !bup ) {
  1175. return a === document ? -1 :
  1176. b === document ? 1 :
  1177. aup ? -1 :
  1178. bup ? 1 :
  1179. sortInput ?
  1180. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  1181. 0;
  1182. // If the nodes are siblings, we can do a quick check
  1183. } else if ( aup === bup ) {
  1184. return siblingCheck( a, b );
  1185. }
  1186. // Otherwise we need full lists of their ancestors for comparison
  1187. cur = a;
  1188. while ( (cur = cur.parentNode) ) {
  1189. ap.unshift( cur );
  1190. }
  1191. cur = b;
  1192. while ( (cur = cur.parentNode) ) {
  1193. bp.unshift( cur );
  1194. }
  1195. // Walk down the tree looking for a discrepancy
  1196. while ( ap[i] === bp[i] ) {
  1197. i++;
  1198. }
  1199. return i ?
  1200. // Do a sibling check if the nodes have a common ancestor
  1201. siblingCheck( ap[i], bp[i] ) :
  1202. // Otherwise nodes in our document sort first
  1203. ap[i] === preferredDoc ? -1 :
  1204. bp[i] === preferredDoc ? 1 :
  1205. 0;
  1206. };
  1207. return document;
  1208. };
  1209. Sizzle.matches = function( expr, elements ) {
  1210. return Sizzle( expr, null, null, elements );
  1211. };
  1212. Sizzle.matchesSelector = function( elem, expr ) {
  1213. // Set document vars if needed
  1214. if ( ( elem.ownerDocument || elem ) !== document ) {
  1215. setDocument( elem );
  1216. }
  1217. // Make sure that attribute selectors are quoted
  1218. expr = expr.replace( rattributeQuotes, "='$1']" );
  1219. if ( support.matchesSelector && documentIsHTML &&
  1220. !compilerCache[ expr + " " ] &&
  1221. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  1222. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  1223. try {
  1224. var ret = matches.call( elem, expr );
  1225. // IE 9's matchesSelector returns false on disconnected nodes
  1226. if ( ret || support.disconnectedMatch ||
  1227. // As well, disconnected nodes are said to be in a document
  1228. // fragment in IE 9
  1229. elem.document && elem.document.nodeType !== 11 ) {
  1230. return ret;
  1231. }
  1232. } catch (e) {}
  1233. }
  1234. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  1235. };
  1236. Sizzle.contains = function( context, elem ) {
  1237. // Set document vars if needed
  1238. if ( ( context.ownerDocument || context ) !== document ) {
  1239. setDocument( context );
  1240. }
  1241. return contains( context, elem );
  1242. };
  1243. Sizzle.attr = function( elem, name ) {
  1244. // Set document vars if needed
  1245. if ( ( elem.ownerDocument || elem ) !== document ) {
  1246. setDocument( elem );
  1247. }
  1248. var fn = Expr.attrHandle[ name.toLowerCase() ],
  1249. // Don't get fooled by Object.prototype properties (jQuery #13807)
  1250. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  1251. fn( elem, name, !documentIsHTML ) :
  1252. undefined;
  1253. return val !== undefined ?
  1254. val :
  1255. support.attributes || !documentIsHTML ?
  1256. elem.getAttribute( name ) :
  1257. (val = elem.getAttributeNode(name)) && val.specified ?
  1258. val.value :
  1259. null;
  1260. };
  1261. Sizzle.escape = function( sel ) {
  1262. return (sel + "").replace( rcssescape, fcssescape );
  1263. };
  1264. Sizzle.error = function( msg ) {
  1265. throw new Error( "Syntax error, unrecognized expression: " + msg );
  1266. };
  1267. /**
  1268. * Document sorting and removing duplicates
  1269. * @param {ArrayLike} results
  1270. */
  1271. Sizzle.uniqueSort = function( results ) {
  1272. var elem,
  1273. duplicates = [],
  1274. j = 0,
  1275. i = 0;
  1276. // Unless we *know* we can detect duplicates, assume their presence
  1277. hasDuplicate = !support.detectDuplicates;
  1278. sortInput = !support.sortStable && results.slice( 0 );
  1279. results.sort( sortOrder );
  1280. if ( hasDuplicate ) {
  1281. while ( (elem = results[i++]) ) {
  1282. if ( elem === results[ i ] ) {
  1283. j = duplicates.push( i );
  1284. }
  1285. }
  1286. while ( j-- ) {
  1287. results.splice( duplicates[ j ], 1 );
  1288. }
  1289. }
  1290. // Clear input after sorting to release objects
  1291. // See https://github.com/jquery/sizzle/pull/225
  1292. sortInput = null;
  1293. return results;
  1294. };
  1295. /**
  1296. * Utility function for retrieving the text value of an array of DOM nodes
  1297. * @param {Array|Element} elem
  1298. */
  1299. getText = Sizzle.getText = function( elem ) {
  1300. var node,
  1301. ret = "",
  1302. i = 0,
  1303. nodeType = elem.nodeType;
  1304. if ( !nodeType ) {
  1305. // If no nodeType, this is expected to be an array
  1306. while ( (node = elem[i++]) ) {
  1307. // Do not traverse comment nodes
  1308. ret += getText( node );
  1309. }
  1310. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  1311. // Use textContent for elements
  1312. // innerText usage removed for consistency of new lines (jQuery #11153)
  1313. if ( typeof elem.textContent === "string" ) {
  1314. return elem.textContent;
  1315. } else {
  1316. // Traverse its children
  1317. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1318. ret += getText( elem );
  1319. }
  1320. }
  1321. } else if ( nodeType === 3 || nodeType === 4 ) {
  1322. return elem.nodeValue;
  1323. }
  1324. // Do not include comment or processing instruction nodes
  1325. return ret;
  1326. };
  1327. Expr = Sizzle.selectors = {
  1328. // Can be adjusted by the user
  1329. cacheLength: 50,
  1330. createPseudo: markFunction,
  1331. match: matchExpr,
  1332. attrHandle: {},
  1333. find: {},
  1334. relative: {
  1335. ">": { dir: "parentNode", first: true },
  1336. " ": { dir: "parentNode" },
  1337. "+": { dir: "previousSibling", first: true },
  1338. "~": { dir: "previousSibling" }
  1339. },
  1340. preFilter: {
  1341. "ATTR": function( match ) {
  1342. match[1] = match[1].replace( runescape, funescape );
  1343. // Move the given value to match[3] whether quoted or unquoted
  1344. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  1345. if ( match[2] === "~=" ) {
  1346. match[3] = " " + match[3] + " ";
  1347. }
  1348. return match.slice( 0, 4 );
  1349. },
  1350. "CHILD": function( match ) {
  1351. /* matches from matchExpr["CHILD"]
  1352. 1 type (only|nth|...)
  1353. 2 what (child|of-type)
  1354. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  1355. 4 xn-component of xn+y argument ([+-]?\d*n|)
  1356. 5 sign of xn-component
  1357. 6 x of xn-component
  1358. 7 sign of y-component
  1359. 8 y of y-component
  1360. */
  1361. match[1] = match[1].toLowerCase();
  1362. if ( match[1].slice( 0, 3 ) === "nth" ) {
  1363. // nth-* requires argument
  1364. if ( !match[3] ) {
  1365. Sizzle.error( match[0] );
  1366. }
  1367. // numeric x and y parameters for Expr.filter.CHILD
  1368. // remember that false/true cast respectively to 0/1
  1369. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  1370. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  1371. // other types prohibit arguments
  1372. } else if ( match[3] ) {
  1373. Sizzle.error( match[0] );
  1374. }
  1375. return match;
  1376. },
  1377. "PSEUDO": function( match ) {
  1378. var excess,
  1379. unquoted = !match[6] && match[2];
  1380. if ( matchExpr["CHILD"].test( match[0] ) ) {
  1381. return null;
  1382. }
  1383. // Accept quoted arguments as-is
  1384. if ( match[3] ) {
  1385. match[2] = match[4] || match[5] || "";
  1386. // Strip excess characters from unquoted arguments
  1387. } else if ( unquoted && rpseudo.test( unquoted ) &&
  1388. // Get excess from tokenize (recursively)
  1389. (excess = tokenize( unquoted, true )) &&
  1390. // advance to the next closing parenthesis
  1391. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  1392. // excess is a negative index
  1393. match[0] = match[0].slice( 0, excess );
  1394. match[2] = unquoted.slice( 0, excess );
  1395. }
  1396. // Return only captures needed by the pseudo filter method (type and argument)
  1397. return match.slice( 0, 3 );
  1398. }
  1399. },
  1400. filter: {
  1401. "TAG": function( nodeNameSelector ) {
  1402. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  1403. return nodeNameSelector === "*" ?
  1404. function() { return true; } :
  1405. function( elem ) {
  1406. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  1407. };
  1408. },
  1409. "CLASS": function( className ) {
  1410. var pattern = classCache[ className + " " ];
  1411. return pattern ||
  1412. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  1413. classCache( className, function( elem ) {
  1414. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  1415. });
  1416. },
  1417. "ATTR": function( name, operator, check ) {
  1418. return function( elem ) {
  1419. var result = Sizzle.attr( elem, name );
  1420. if ( result == null ) {
  1421. return operator === "!=";
  1422. }
  1423. if ( !operator ) {
  1424. return true;
  1425. }
  1426. result += "";
  1427. return operator === "=" ? result === check :
  1428. operator === "!=" ? result !== check :
  1429. operator === "^=" ? check && result.indexOf( check ) === 0 :
  1430. operator === "*=" ? check && result.indexOf( check ) > -1 :
  1431. operator === "$=" ? check && result.slice( -check.length ) === check :
  1432. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  1433. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  1434. false;
  1435. };
  1436. },
  1437. "CHILD": function( type, what, argument, first, last ) {
  1438. var simple = type.slice( 0, 3 ) !== "nth",
  1439. forward = type.slice( -4 ) !== "last",
  1440. ofType = what === "of-type";
  1441. return first === 1 && last === 0 ?
  1442. // Shortcut for :nth-*(n)
  1443. function( elem ) {
  1444. return !!elem.parentNode;
  1445. } :
  1446. function( elem, context, xml ) {
  1447. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  1448. dir = simple !== forward ? "nextSibling" : "previousSibling",
  1449. parent = elem.parentNode,
  1450. name = ofType && elem.nodeName.toLowerCase(),
  1451. useCache = !xml && !ofType,
  1452. diff = false;
  1453. if ( parent ) {
  1454. // :(first|last|only)-(child|of-type)
  1455. if ( simple ) {
  1456. while ( dir ) {
  1457. node = elem;
  1458. while ( (node = node[ dir ]) ) {
  1459. if ( ofType ?
  1460. node.nodeName.toLowerCase() === name :
  1461. node.nodeType === 1 ) {
  1462. return false;
  1463. }
  1464. }
  1465. // Reverse direction for :only-* (if we haven't yet done so)
  1466. start = dir = type === "only" && !start && "nextSibling";
  1467. }
  1468. return true;
  1469. }
  1470. start = [ forward ? parent.firstChild : parent.lastChild ];
  1471. // non-xml :nth-child(...) stores cache data on `parent`
  1472. if ( forward && useCache ) {
  1473. // Seek `elem` from a previously-cached index
  1474. // ...in a gzip-friendly way
  1475. node = parent;
  1476. outerCache = node[ expando ] || (node[ expando ] = {});
  1477. // Support: IE <9 only
  1478. // Defend against cloned attroperties (jQuery gh-1709)
  1479. uniqueCache = outerCache[ node.uniqueID ] ||
  1480. (outerCache[ node.uniqueID ] = {});
  1481. cache = uniqueCache[ type ] || [];
  1482. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1483. diff = nodeIndex && cache[ 2 ];
  1484. node = nodeIndex && parent.childNodes[ nodeIndex ];
  1485. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1486. // Fallback to seeking `elem` from the start
  1487. (diff = nodeIndex = 0) || start.pop()) ) {
  1488. // When found, cache indexes on `parent` and break
  1489. if ( node.nodeType === 1 && ++diff && node === elem ) {
  1490. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  1491. break;
  1492. }
  1493. }
  1494. } else {
  1495. // Use previously-cached element index if available
  1496. if ( useCache ) {
  1497. // ...in a gzip-friendly way
  1498. node = elem;
  1499. outerCache = node[ expando ] || (node[ expando ] = {});
  1500. // Support: IE <9 only
  1501. // Defend against cloned attroperties (jQuery gh-1709)
  1502. uniqueCache = outerCache[ node.uniqueID ] ||
  1503. (outerCache[ node.uniqueID ] = {});
  1504. cache = uniqueCache[ type ] || [];
  1505. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  1506. diff = nodeIndex;
  1507. }
  1508. // xml :nth-child(...)
  1509. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  1510. if ( diff === false ) {
  1511. // Use the same loop as above to seek `elem` from the start
  1512. while ( (node = ++nodeIndex && node && node[ dir ] ||
  1513. (diff = nodeIndex = 0) || start.pop()) ) {
  1514. if ( ( ofType ?
  1515. node.nodeName.toLowerCase() === name :
  1516. node.nodeType === 1 ) &&
  1517. ++diff ) {
  1518. // Cache the index of each encountered element
  1519. if ( useCache ) {
  1520. outerCache = node[ expando ] || (node[ expando ] = {});
  1521. // Support: IE <9 only
  1522. // Defend against cloned attroperties (jQuery gh-1709)
  1523. uniqueCache = outerCache[ node.uniqueID ] ||
  1524. (outerCache[ node.uniqueID ] = {});
  1525. uniqueCache[ type ] = [ dirruns, diff ];
  1526. }
  1527. if ( node === elem ) {
  1528. break;
  1529. }
  1530. }
  1531. }
  1532. }
  1533. }
  1534. // Incorporate the offset, then check against cycle size
  1535. diff -= last;
  1536. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  1537. }
  1538. };
  1539. },
  1540. "PSEUDO": function( pseudo, argument ) {
  1541. // pseudo-class names are case-insensitive
  1542. // http://www.w3.org/TR/selectors/#pseudo-classes
  1543. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  1544. // Remember that setFilters inherits from pseudos
  1545. var args,
  1546. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  1547. Sizzle.error( "unsupported pseudo: " + pseudo );
  1548. // The user may use createPseudo to indicate that
  1549. // arguments are needed to create the filter function
  1550. // just as Sizzle does
  1551. if ( fn[ expando ] ) {
  1552. return fn( argument );
  1553. }
  1554. // But maintain support for old signatures
  1555. if ( fn.length > 1 ) {
  1556. args = [ pseudo, pseudo, "", argument ];
  1557. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  1558. markFunction(function( seed, matches ) {
  1559. var idx,
  1560. matched = fn( seed, argument ),
  1561. i = matched.length;
  1562. while ( i-- ) {
  1563. idx = indexOf( seed, matched[i] );
  1564. seed[ idx ] = !( matches[ idx ] = matched[i] );
  1565. }
  1566. }) :
  1567. function( elem ) {
  1568. return fn( elem, 0, args );
  1569. };
  1570. }
  1571. return fn;
  1572. }
  1573. },
  1574. pseudos: {
  1575. // Potentially complex pseudos
  1576. "not": markFunction(function( selector ) {
  1577. // Trim the selector passed to compile
  1578. // to avoid treating leading and trailing
  1579. // spaces as combinators
  1580. var input = [],
  1581. results = [],
  1582. matcher = compile( selector.replace( rtrim, "$1" ) );
  1583. return matcher[ expando ] ?
  1584. markFunction(function( seed, matches, context, xml ) {
  1585. var elem,
  1586. unmatched = matcher( seed, null, xml, [] ),
  1587. i = seed.length;
  1588. // Match elements unmatched by `matcher`
  1589. while ( i-- ) {
  1590. if ( (elem = unmatched[i]) ) {
  1591. seed[i] = !(matches[i] = elem);
  1592. }
  1593. }
  1594. }) :
  1595. function( elem, context, xml ) {
  1596. input[0] = elem;
  1597. matcher( input, null, xml, results );
  1598. // Don't keep the element (issue #299)
  1599. input[0] = null;
  1600. return !results.pop();
  1601. };
  1602. }),
  1603. "has": markFunction(function( selector ) {
  1604. return function( elem ) {
  1605. return Sizzle( selector, elem ).length > 0;
  1606. };
  1607. }),
  1608. "contains": markFunction(function( text ) {
  1609. text = text.replace( runescape, funescape );
  1610. return function( elem ) {
  1611. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  1612. };
  1613. }),
  1614. // "Whether an element is represented by a :lang() selector
  1615. // is based solely on the element's language value
  1616. // being equal to the identifier C,
  1617. // or beginning with the identifier C immediately followed by "-".
  1618. // The matching of C against the element's language value is performed case-insensitively.
  1619. // The identifier C does not have to be a valid language name."
  1620. // http://www.w3.org/TR/selectors/#lang-pseudo
  1621. "lang": markFunction( function( lang ) {
  1622. // lang value must be a valid identifier
  1623. if ( !ridentifier.test(lang || "") ) {
  1624. Sizzle.error( "unsupported lang: " + lang );
  1625. }
  1626. lang = lang.replace( runescape, funescape ).toLowerCase();
  1627. return function( elem ) {
  1628. var elemLang;
  1629. do {
  1630. if ( (elemLang = documentIsHTML ?
  1631. elem.lang :
  1632. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  1633. elemLang = elemLang.toLowerCase();
  1634. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  1635. }
  1636. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  1637. return false;
  1638. };
  1639. }),
  1640. // Miscellaneous
  1641. "target": function( elem ) {
  1642. var hash = window.location && window.location.hash;
  1643. return hash && hash.slice( 1 ) === elem.id;
  1644. },
  1645. "root": function( elem ) {
  1646. return elem === docElem;
  1647. },
  1648. "focus": function( elem ) {
  1649. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  1650. },
  1651. // Boolean properties
  1652. "enabled": createDisabledPseudo( false ),
  1653. "disabled": createDisabledPseudo( true ),
  1654. "checked": function( elem ) {
  1655. // In CSS3, :checked should return both checked and selected elements
  1656. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1657. var nodeName = elem.nodeName.toLowerCase();
  1658. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  1659. },
  1660. "selected": function( elem ) {
  1661. // Accessing this property makes selected-by-default
  1662. // options in Safari work properly
  1663. if ( elem.parentNode ) {
  1664. elem.parentNode.selectedIndex;
  1665. }
  1666. return elem.selected === true;
  1667. },
  1668. // Contents
  1669. "empty": function( elem ) {
  1670. // http://www.w3.org/TR/selectors/#empty-pseudo
  1671. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  1672. // but not by others (comment: 8; processing instruction: 7; etc.)
  1673. // nodeType < 6 works because attributes (2) do not appear as children
  1674. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  1675. if ( elem.nodeType < 6 ) {
  1676. return false;
  1677. }
  1678. }
  1679. return true;
  1680. },
  1681. "parent": function( elem ) {
  1682. return !Expr.pseudos["empty"]( elem );
  1683. },
  1684. // Element/input types
  1685. "header": function( elem ) {
  1686. return rheader.test( elem.nodeName );
  1687. },
  1688. "input": function( elem ) {
  1689. return rinputs.test( elem.nodeName );
  1690. },
  1691. "button": function( elem ) {
  1692. var name = elem.nodeName.toLowerCase();
  1693. return name === "input" && elem.type === "button" || name === "button";
  1694. },
  1695. "text": function( elem ) {
  1696. var attr;
  1697. return elem.nodeName.toLowerCase() === "input" &&
  1698. elem.type === "text" &&
  1699. // Support: IE<8
  1700. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  1701. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  1702. },
  1703. // Position-in-collection
  1704. "first": createPositionalPseudo(function() {
  1705. return [ 0 ];
  1706. }),
  1707. "last": createPositionalPseudo(function( matchIndexes, length ) {
  1708. return [ length - 1 ];
  1709. }),
  1710. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1711. return [ argument < 0 ? argument + length : argument ];
  1712. }),
  1713. "even": createPositionalPseudo(function( matchIndexes, length ) {
  1714. var i = 0;
  1715. for ( ; i < length; i += 2 ) {
  1716. matchIndexes.push( i );
  1717. }
  1718. return matchIndexes;
  1719. }),
  1720. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  1721. var i = 1;
  1722. for ( ; i < length; i += 2 ) {
  1723. matchIndexes.push( i );
  1724. }
  1725. return matchIndexes;
  1726. }),
  1727. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1728. var i = argument < 0 ? argument + length : argument;
  1729. for ( ; --i >= 0; ) {
  1730. matchIndexes.push( i );
  1731. }
  1732. return matchIndexes;
  1733. }),
  1734. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  1735. var i = argument < 0 ? argument + length : argument;
  1736. for ( ; ++i < length; ) {
  1737. matchIndexes.push( i );
  1738. }
  1739. return matchIndexes;
  1740. })
  1741. }
  1742. };
  1743. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  1744. // Add button/input type pseudos
  1745. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  1746. Expr.pseudos[ i ] = createInputPseudo( i );
  1747. }
  1748. for ( i in { submit: true, reset: true } ) {
  1749. Expr.pseudos[ i ] = createButtonPseudo( i );
  1750. }
  1751. // Easy API for creating new setFilters
  1752. function setFilters() {}
  1753. setFilters.prototype = Expr.filters = Expr.pseudos;
  1754. Expr.setFilters = new setFilters();
  1755. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  1756. var matched, match, tokens, type,
  1757. soFar, groups, preFilters,
  1758. cached = tokenCache[ selector + " " ];
  1759. if ( cached ) {
  1760. return parseOnly ? 0 : cached.slice( 0 );
  1761. }
  1762. soFar = selector;
  1763. groups = [];
  1764. preFilters = Expr.preFilter;
  1765. while ( soFar ) {
  1766. // Comma and first run
  1767. if ( !matched || (match = rcomma.exec( soFar )) ) {
  1768. if ( match ) {
  1769. // Don't consume trailing commas as valid
  1770. soFar = soFar.slice( match[0].length ) || soFar;
  1771. }
  1772. groups.push( (tokens = []) );
  1773. }
  1774. matched = false;
  1775. // Combinators
  1776. if ( (match = rcombinators.exec( soFar )) ) {
  1777. matched = match.shift();
  1778. tokens.push({
  1779. value: matched,
  1780. // Cast descendant combinators to space
  1781. type: match[0].replace( rtrim, " " )
  1782. });
  1783. soFar = soFar.slice( matched.length );
  1784. }
  1785. // Filters
  1786. for ( type in Expr.filter ) {
  1787. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  1788. (match = preFilters[ type ]( match ))) ) {
  1789. matched = match.shift();
  1790. tokens.push({
  1791. value: matched,
  1792. type: type,
  1793. matches: match
  1794. });
  1795. soFar = soFar.slice( matched.length );
  1796. }
  1797. }
  1798. if ( !matched ) {
  1799. break;
  1800. }
  1801. }
  1802. // Return the length of the invalid excess
  1803. // if we're just parsing
  1804. // Otherwise, throw an error or return tokens
  1805. return parseOnly ?
  1806. soFar.length :
  1807. soFar ?
  1808. Sizzle.error( selector ) :
  1809. // Cache the tokens
  1810. tokenCache( selector, groups ).slice( 0 );
  1811. };
  1812. function toSelector( tokens ) {
  1813. var i = 0,
  1814. len = tokens.length,
  1815. selector = "";
  1816. for ( ; i < len; i++ ) {
  1817. selector += tokens[i].value;
  1818. }
  1819. return selector;
  1820. }
  1821. function addCombinator( matcher, combinator, base ) {
  1822. var dir = combinator.dir,
  1823. skip = combinator.next,
  1824. key = skip || dir,
  1825. checkNonElements = base && key === "parentNode",
  1826. doneName = done++;
  1827. return combinator.first ?
  1828. // Check against closest ancestor/preceding element
  1829. function( elem, context, xml ) {
  1830. while ( (elem = elem[ dir ]) ) {
  1831. if ( elem.nodeType === 1 || checkNonElements ) {
  1832. return matcher( elem, context, xml );
  1833. }
  1834. }
  1835. return false;
  1836. } :
  1837. // Check against all ancestor/preceding elements
  1838. function( elem, context, xml ) {
  1839. var oldCache, uniqueCache, outerCache,
  1840. newCache = [ dirruns, doneName ];
  1841. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  1842. if ( xml ) {
  1843. while ( (elem = elem[ dir ]) ) {
  1844. if ( elem.nodeType === 1 || checkNonElements ) {
  1845. if ( matcher( elem, context, xml ) ) {
  1846. return true;
  1847. }
  1848. }
  1849. }
  1850. } else {
  1851. while ( (elem = elem[ dir ]) ) {
  1852. if ( elem.nodeType === 1 || checkNonElements ) {
  1853. outerCache = elem[ expando ] || (elem[ expando ] = {});
  1854. // Support: IE <9 only
  1855. // Defend against cloned attroperties (jQuery gh-1709)
  1856. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  1857. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  1858. elem = elem[ dir ] || elem;
  1859. } else if ( (oldCache = uniqueCache[ key ]) &&
  1860. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  1861. // Assign to newCache so results back-propagate to previous elements
  1862. return (newCache[ 2 ] = oldCache[ 2 ]);
  1863. } else {
  1864. // Reuse newcache so results back-propagate to previous elements
  1865. uniqueCache[ key ] = newCache;
  1866. // A match means we're done; a fail means we have to keep checking
  1867. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  1868. return true;
  1869. }
  1870. }
  1871. }
  1872. }
  1873. }
  1874. return false;
  1875. };
  1876. }
  1877. function elementMatcher( matchers ) {
  1878. return matchers.length > 1 ?
  1879. function( elem, context, xml ) {
  1880. var i = matchers.length;
  1881. while ( i-- ) {
  1882. if ( !matchers[i]( elem, context, xml ) ) {
  1883. return false;
  1884. }
  1885. }
  1886. return true;
  1887. } :
  1888. matchers[0];
  1889. }
  1890. function multipleContexts( selector, contexts, results ) {
  1891. var i = 0,
  1892. len = contexts.length;
  1893. for ( ; i < len; i++ ) {
  1894. Sizzle( selector, contexts[i], results );
  1895. }
  1896. return results;
  1897. }
  1898. function condense( unmatched, map, filter, context, xml ) {
  1899. var elem,
  1900. newUnmatched = [],
  1901. i = 0,
  1902. len = unmatched.length,
  1903. mapped = map != null;
  1904. for ( ; i < len; i++ ) {
  1905. if ( (elem = unmatched[i]) ) {
  1906. if ( !filter || filter( elem, context, xml ) ) {
  1907. newUnmatched.push( elem );
  1908. if ( mapped ) {
  1909. map.push( i );
  1910. }
  1911. }
  1912. }
  1913. }
  1914. return newUnmatched;
  1915. }
  1916. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  1917. if ( postFilter && !postFilter[ expando ] ) {
  1918. postFilter = setMatcher( postFilter );
  1919. }
  1920. if ( postFinder && !postFinder[ expando ] ) {
  1921. postFinder = setMatcher( postFinder, postSelector );
  1922. }
  1923. return markFunction(function( seed, results, context, xml ) {
  1924. var temp, i, elem,
  1925. preMap = [],
  1926. postMap = [],
  1927. preexisting = results.length,
  1928. // Get initial elements from seed or context
  1929. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  1930. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  1931. matcherIn = preFilter && ( seed || !selector ) ?
  1932. condense( elems, preMap, preFilter, context, xml ) :
  1933. elems,
  1934. matcherOut = matcher ?
  1935. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  1936. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  1937. // ...intermediate processing is necessary
  1938. [] :
  1939. // ...otherwise use results directly
  1940. results :
  1941. matcherIn;
  1942. // Find primary matches
  1943. if ( matcher ) {
  1944. matcher( matcherIn, matcherOut, context, xml );
  1945. }
  1946. // Apply postFilter
  1947. if ( postFilter ) {
  1948. temp = condense( matcherOut, postMap );
  1949. postFilter( temp, [], context, xml );
  1950. // Un-match failing elements by moving them back to matcherIn
  1951. i = temp.length;
  1952. while ( i-- ) {
  1953. if ( (elem = temp[i]) ) {
  1954. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  1955. }
  1956. }
  1957. }
  1958. if ( seed ) {
  1959. if ( postFinder || preFilter ) {
  1960. if ( postFinder ) {
  1961. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  1962. temp = [];
  1963. i = matcherOut.length;
  1964. while ( i-- ) {
  1965. if ( (elem = matcherOut[i]) ) {
  1966. // Restore matcherIn since elem is not yet a final match
  1967. temp.push( (matcherIn[i] = elem) );
  1968. }
  1969. }
  1970. postFinder( null, (matcherOut = []), temp, xml );
  1971. }
  1972. // Move matched elements from seed to results to keep them synchronized
  1973. i = matcherOut.length;
  1974. while ( i-- ) {
  1975. if ( (elem = matcherOut[i]) &&
  1976. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  1977. seed[temp] = !(results[temp] = elem);
  1978. }
  1979. }
  1980. }
  1981. // Add elements to results, through postFinder if defined
  1982. } else {
  1983. matcherOut = condense(
  1984. matcherOut === results ?
  1985. matcherOut.splice( preexisting, matcherOut.length ) :
  1986. matcherOut
  1987. );
  1988. if ( postFinder ) {
  1989. postFinder( null, results, matcherOut, xml );
  1990. } else {
  1991. push.apply( results, matcherOut );
  1992. }
  1993. }
  1994. });
  1995. }
  1996. function matcherFromTokens( tokens ) {
  1997. var checkContext, matcher, j,
  1998. len = tokens.length,
  1999. leadingRelative = Expr.relative[ tokens[0].type ],
  2000. implicitRelative = leadingRelative || Expr.relative[" "],
  2001. i = leadingRelative ? 1 : 0,
  2002. // The foundational matcher ensures that elements are reachable from top-level context(s)
  2003. matchContext = addCombinator( function( elem ) {
  2004. return elem === checkContext;
  2005. }, implicitRelative, true ),
  2006. matchAnyContext = addCombinator( function( elem ) {
  2007. return indexOf( checkContext, elem ) > -1;
  2008. }, implicitRelative, true ),
  2009. matchers = [ function( elem, context, xml ) {
  2010. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  2011. (checkContext = context).nodeType ?
  2012. matchContext( elem, context, xml ) :
  2013. matchAnyContext( elem, context, xml ) );
  2014. // Avoid hanging onto element (issue #299)
  2015. checkContext = null;
  2016. return ret;
  2017. } ];
  2018. for ( ; i < len; i++ ) {
  2019. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  2020. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  2021. } else {
  2022. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  2023. // Return special upon seeing a positional matcher
  2024. if ( matcher[ expando ] ) {
  2025. // Find the next relative operator (if any) for proper handling
  2026. j = ++i;
  2027. for ( ; j < len; j++ ) {
  2028. if ( Expr.relative[ tokens[j].type ] ) {
  2029. break;
  2030. }
  2031. }
  2032. return setMatcher(
  2033. i > 1 && elementMatcher( matchers ),
  2034. i > 1 && toSelector(
  2035. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  2036. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  2037. ).replace( rtrim, "$1" ),
  2038. matcher,
  2039. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  2040. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  2041. j < len && toSelector( tokens )
  2042. );
  2043. }
  2044. matchers.push( matcher );
  2045. }
  2046. }
  2047. return elementMatcher( matchers );
  2048. }
  2049. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  2050. var bySet = setMatchers.length > 0,
  2051. byElement = elementMatchers.length > 0,
  2052. superMatcher = function( seed, context, xml, results, outermost ) {
  2053. var elem, j, matcher,
  2054. matchedCount = 0,
  2055. i = "0",
  2056. unmatched = seed && [],
  2057. setMatched = [],
  2058. contextBackup = outermostContext,
  2059. // We must always have either seed elements or outermost context
  2060. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  2061. // Use integer dirruns iff this is the outermost matcher
  2062. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  2063. len = elems.length;
  2064. if ( outermost ) {
  2065. outermostContext = context === document || context || outermost;
  2066. }
  2067. // Add elements passing elementMatchers directly to results
  2068. // Support: IE<9, Safari
  2069. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  2070. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  2071. if ( byElement && elem ) {
  2072. j = 0;
  2073. if ( !context && elem.ownerDocument !== document ) {
  2074. setDocument( elem );
  2075. xml = !documentIsHTML;
  2076. }
  2077. while ( (matcher = elementMatchers[j++]) ) {
  2078. if ( matcher( elem, context || document, xml) ) {
  2079. results.push( elem );
  2080. break;
  2081. }
  2082. }
  2083. if ( outermost ) {
  2084. dirruns = dirrunsUnique;
  2085. }
  2086. }
  2087. // Track unmatched elements for set filters
  2088. if ( bySet ) {
  2089. // They will have gone through all possible matchers
  2090. if ( (elem = !matcher && elem) ) {
  2091. matchedCount--;
  2092. }
  2093. // Lengthen the array for every element, matched or not
  2094. if ( seed ) {
  2095. unmatched.push( elem );
  2096. }
  2097. }
  2098. }
  2099. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  2100. // makes the latter nonnegative.
  2101. matchedCount += i;
  2102. // Apply set filters to unmatched elements
  2103. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  2104. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  2105. // no element matchers and no seed.
  2106. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  2107. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  2108. // numerically zero.
  2109. if ( bySet && i !== matchedCount ) {
  2110. j = 0;
  2111. while ( (matcher = setMatchers[j++]) ) {
  2112. matcher( unmatched, setMatched, context, xml );
  2113. }
  2114. if ( seed ) {
  2115. // Reintegrate element matches to eliminate the need for sorting
  2116. if ( matchedCount > 0 ) {
  2117. while ( i-- ) {
  2118. if ( !(unmatched[i] || setMatched[i]) ) {
  2119. setMatched[i] = pop.call( results );
  2120. }
  2121. }
  2122. }
  2123. // Discard index placeholder values to get only actual matches
  2124. setMatched = condense( setMatched );
  2125. }
  2126. // Add matches to results
  2127. push.apply( results, setMatched );
  2128. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  2129. if ( outermost && !seed && setMatched.length > 0 &&
  2130. ( matchedCount + setMatchers.length ) > 1 ) {
  2131. Sizzle.uniqueSort( results );
  2132. }
  2133. }
  2134. // Override manipulation of globals by nested matchers
  2135. if ( outermost ) {
  2136. dirruns = dirrunsUnique;
  2137. outermostContext = contextBackup;
  2138. }
  2139. return unmatched;
  2140. };
  2141. return bySet ?
  2142. markFunction( superMatcher ) :
  2143. superMatcher;
  2144. }
  2145. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  2146. var i,
  2147. setMatchers = [],
  2148. elementMatchers = [],
  2149. cached = compilerCache[ selector + " " ];
  2150. if ( !cached ) {
  2151. // Generate a function of recursive functions that can be used to check each element
  2152. if ( !match ) {
  2153. match = tokenize( selector );
  2154. }
  2155. i = match.length;
  2156. while ( i-- ) {
  2157. cached = matcherFromTokens( match[i] );
  2158. if ( cached[ expando ] ) {
  2159. setMatchers.push( cached );
  2160. } else {
  2161. elementMatchers.push( cached );
  2162. }
  2163. }
  2164. // Cache the compiled function
  2165. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  2166. // Save selector and tokenization
  2167. cached.selector = selector;
  2168. }
  2169. return cached;
  2170. };
  2171. /**
  2172. * A low-level selection function that works with Sizzle's compiled
  2173. * selector functions
  2174. * @param {String|Function} selector A selector or a pre-compiled
  2175. * selector function built with Sizzle.compile
  2176. * @param {Element} context
  2177. * @param {Array} [results]
  2178. * @param {Array} [seed] A set of elements to match against
  2179. */
  2180. select = Sizzle.select = function( selector, context, results, seed ) {
  2181. var i, tokens, token, type, find,
  2182. compiled = typeof selector === "function" && selector,
  2183. match = !seed && tokenize( (selector = compiled.selector || selector) );
  2184. results = results || [];
  2185. // Try to minimize operations if there is only one selector in the list and no seed
  2186. // (the latter of which guarantees us context)
  2187. if ( match.length === 1 ) {
  2188. // Reduce context if the leading compound selector is an ID
  2189. tokens = match[0] = match[0].slice( 0 );
  2190. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  2191. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  2192. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  2193. if ( !context ) {
  2194. return results;
  2195. // Precompiled matchers will still verify ancestry, so step up a level
  2196. } else if ( compiled ) {
  2197. context = context.parentNode;
  2198. }
  2199. selector = selector.slice( tokens.shift().value.length );
  2200. }
  2201. // Fetch a seed set for right-to-left matching
  2202. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  2203. while ( i-- ) {
  2204. token = tokens[i];
  2205. // Abort if we hit a combinator
  2206. if ( Expr.relative[ (type = token.type) ] ) {
  2207. break;
  2208. }
  2209. if ( (find = Expr.find[ type ]) ) {
  2210. // Search, expanding context for leading sibling combinators
  2211. if ( (seed = find(
  2212. token.matches[0].replace( runescape, funescape ),
  2213. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  2214. )) ) {
  2215. // If seed is empty or no tokens remain, we can return early
  2216. tokens.splice( i, 1 );
  2217. selector = seed.length && toSelector( tokens );
  2218. if ( !selector ) {
  2219. push.apply( results, seed );
  2220. return results;
  2221. }
  2222. break;
  2223. }
  2224. }
  2225. }
  2226. }
  2227. // Compile and execute a filtering function if one is not provided
  2228. // Provide `match` to avoid retokenization if we modified the selector above
  2229. ( compiled || compile( selector, match ) )(
  2230. seed,
  2231. context,
  2232. !documentIsHTML,
  2233. results,
  2234. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  2235. );
  2236. return results;
  2237. };
  2238. // One-time assignments
  2239. // Sort stability
  2240. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  2241. // Support: Chrome 14-35+
  2242. // Always assume duplicates if they aren't passed to the comparison function
  2243. support.detectDuplicates = !!hasDuplicate;
  2244. // Initialize against the default document
  2245. setDocument();
  2246. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  2247. // Detached nodes confoundingly follow *each other*
  2248. support.sortDetached = assert(function( el ) {
  2249. // Should return 1, but returns 4 (following)
  2250. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  2251. });
  2252. // Support: IE<8
  2253. // Prevent attribute/property "interpolation"
  2254. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  2255. if ( !assert(function( el ) {
  2256. el.innerHTML = "<a href='#'></a>";
  2257. return el.firstChild.getAttribute("href") === "#" ;
  2258. }) ) {
  2259. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  2260. if ( !isXML ) {
  2261. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  2262. }
  2263. });
  2264. }
  2265. // Support: IE<9
  2266. // Use defaultValue in place of getAttribute("value")
  2267. if ( !support.attributes || !assert(function( el ) {
  2268. el.innerHTML = "<input/>";
  2269. el.firstChild.setAttribute( "value", "" );
  2270. return el.firstChild.getAttribute( "value" ) === "";
  2271. }) ) {
  2272. addHandle( "value", function( elem, name, isXML ) {
  2273. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  2274. return elem.defaultValue;
  2275. }
  2276. });
  2277. }
  2278. // Support: IE<9
  2279. // Use getAttributeNode to fetch booleans when getAttribute lies
  2280. if ( !assert(function( el ) {
  2281. return el.getAttribute("disabled") == null;
  2282. }) ) {
  2283. addHandle( booleans, function( elem, name, isXML ) {
  2284. var val;
  2285. if ( !isXML ) {
  2286. return elem[ name ] === true ? name.toLowerCase() :
  2287. (val = elem.getAttributeNode( name )) && val.specified ?
  2288. val.value :
  2289. null;
  2290. }
  2291. });
  2292. }
  2293. return Sizzle;
  2294. })( window );
  2295. jQuery.find = Sizzle;
  2296. jQuery.expr = Sizzle.selectors;
  2297. // Deprecated
  2298. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  2299. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  2300. jQuery.text = Sizzle.getText;
  2301. jQuery.isXMLDoc = Sizzle.isXML;
  2302. jQuery.contains = Sizzle.contains;
  2303. jQuery.escapeSelector = Sizzle.escape;
  2304. var dir = function( elem, dir, until ) {
  2305. var matched = [],
  2306. truncate = until !== undefined;
  2307. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  2308. if ( elem.nodeType === 1 ) {
  2309. if ( truncate && jQuery( elem ).is( until ) ) {
  2310. break;
  2311. }
  2312. matched.push( elem );
  2313. }
  2314. }
  2315. return matched;
  2316. };
  2317. var siblings = function( n, elem ) {
  2318. var matched = [];
  2319. for ( ; n; n = n.nextSibling ) {
  2320. if ( n.nodeType === 1 && n !== elem ) {
  2321. matched.push( n );
  2322. }
  2323. }
  2324. return matched;
  2325. };
  2326. var rneedsContext = jQuery.expr.match.needsContext;
  2327. function nodeName( elem, name ) {
  2328. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  2329. };
  2330. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  2331. // Implement the identical functionality for filter and not
  2332. function winnow( elements, qualifier, not ) {
  2333. if ( isFunction( qualifier ) ) {
  2334. return jQuery.grep( elements, function( elem, i ) {
  2335. return !!qualifier.call( elem, i, elem ) !== not;
  2336. } );
  2337. }
  2338. // Single element
  2339. if ( qualifier.nodeType ) {
  2340. return jQuery.grep( elements, function( elem ) {
  2341. return ( elem === qualifier ) !== not;
  2342. } );
  2343. }
  2344. // Arraylike of elements (jQuery, arguments, Array)
  2345. if ( typeof qualifier !== "string" ) {
  2346. return jQuery.grep( elements, function( elem ) {
  2347. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  2348. } );
  2349. }
  2350. // Filtered directly for both simple and complex selectors
  2351. return jQuery.filter( qualifier, elements, not );
  2352. }
  2353. jQuery.filter = function( expr, elems, not ) {
  2354. var elem = elems[ 0 ];
  2355. if ( not ) {
  2356. expr = ":not(" + expr + ")";
  2357. }
  2358. if ( elems.length === 1 && elem.nodeType === 1 ) {
  2359. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  2360. }
  2361. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  2362. return elem.nodeType === 1;
  2363. } ) );
  2364. };
  2365. jQuery.fn.extend( {
  2366. find: function( selector ) {
  2367. var i, ret,
  2368. len = this.length,
  2369. self = this;
  2370. if ( typeof selector !== "string" ) {
  2371. return this.pushStack( jQuery( selector ).filter( function() {
  2372. for ( i = 0; i < len; i++ ) {
  2373. if ( jQuery.contains( self[ i ], this ) ) {
  2374. return true;
  2375. }
  2376. }
  2377. } ) );
  2378. }
  2379. ret = this.pushStack( [] );
  2380. for ( i = 0; i < len; i++ ) {
  2381. jQuery.find( selector, self[ i ], ret );
  2382. }
  2383. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  2384. },
  2385. filter: function( selector ) {
  2386. return this.pushStack( winnow( this, selector || [], false ) );
  2387. },
  2388. not: function( selector ) {
  2389. return this.pushStack( winnow( this, selector || [], true ) );
  2390. },
  2391. is: function( selector ) {
  2392. return !!winnow(
  2393. this,
  2394. // If this is a positional/relative selector, check membership in the returned set
  2395. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  2396. typeof selector === "string" && rneedsContext.test( selector ) ?
  2397. jQuery( selector ) :
  2398. selector || [],
  2399. false
  2400. ).length;
  2401. }
  2402. } );
  2403. // Initialize a jQuery object
  2404. // A central reference to the root jQuery(document)
  2405. var rootjQuery,
  2406. // A simple way to check for HTML strings
  2407. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  2408. // Strict HTML recognition (#11290: must start with <)
  2409. // Shortcut simple #id case for speed
  2410. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  2411. init = jQuery.fn.init = function( selector, context, root ) {
  2412. var match, elem;
  2413. // HANDLE: $(""), $(null), $(undefined), $(false)
  2414. if ( !selector ) {
  2415. return this;
  2416. }
  2417. // Method init() accepts an alternate rootjQuery
  2418. // so migrate can support jQuery.sub (gh-2101)
  2419. root = root || rootjQuery;
  2420. // Handle HTML strings
  2421. if ( typeof selector === "string" ) {
  2422. if ( selector[ 0 ] === "<" &&
  2423. selector[ selector.length - 1 ] === ">" &&
  2424. selector.length >= 3 ) {
  2425. // Assume that strings that start and end with <> are HTML and skip the regex check
  2426. match = [ null, selector, null ];
  2427. } else {
  2428. match = rquickExpr.exec( selector );
  2429. }
  2430. // Match html or make sure no context is specified for #id
  2431. if ( match && ( match[ 1 ] || !context ) ) {
  2432. // HANDLE: $(html) -> $(array)
  2433. if ( match[ 1 ] ) {
  2434. context = context instanceof jQuery ? context[ 0 ] : context;
  2435. // Option to run scripts is true for back-compat
  2436. // Intentionally let the error be thrown if parseHTML is not present
  2437. jQuery.merge( this, jQuery.parseHTML(
  2438. match[ 1 ],
  2439. context && context.nodeType ? context.ownerDocument || context : document,
  2440. true
  2441. ) );
  2442. // HANDLE: $(html, props)
  2443. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  2444. for ( match in context ) {
  2445. // Properties of context are called as methods if possible
  2446. if ( isFunction( this[ match ] ) ) {
  2447. this[ match ]( context[ match ] );
  2448. // ...and otherwise set as attributes
  2449. } else {
  2450. this.attr( match, context[ match ] );
  2451. }
  2452. }
  2453. }
  2454. return this;
  2455. // HANDLE: $(#id)
  2456. } else {
  2457. elem = document.getElementById( match[ 2 ] );
  2458. if ( elem ) {
  2459. // Inject the element directly into the jQuery object
  2460. this[ 0 ] = elem;
  2461. this.length = 1;
  2462. }
  2463. return this;
  2464. }
  2465. // HANDLE: $(expr, $(...))
  2466. } else if ( !context || context.jquery ) {
  2467. return ( context || root ).find( selector );
  2468. // HANDLE: $(expr, context)
  2469. // (which is just equivalent to: $(context).find(expr)
  2470. } else {
  2471. return this.constructor( context ).find( selector );
  2472. }
  2473. // HANDLE: $(DOMElement)
  2474. } else if ( selector.nodeType ) {
  2475. this[ 0 ] = selector;
  2476. this.length = 1;
  2477. return this;
  2478. // HANDLE: $(function)
  2479. // Shortcut for document ready
  2480. } else if ( isFunction( selector ) ) {
  2481. return root.ready !== undefined ?
  2482. root.ready( selector ) :
  2483. // Execute immediately if ready is not present
  2484. selector( jQuery );
  2485. }
  2486. return jQuery.makeArray( selector, this );
  2487. };
  2488. // Give the init function the jQuery prototype for later instantiation
  2489. init.prototype = jQuery.fn;
  2490. // Initialize central reference
  2491. rootjQuery = jQuery( document );
  2492. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  2493. // Methods guaranteed to produce a unique set when starting from a unique set
  2494. guaranteedUnique = {
  2495. children: true,
  2496. contents: true,
  2497. next: true,
  2498. prev: true
  2499. };
  2500. jQuery.fn.extend( {
  2501. has: function( target ) {
  2502. var targets = jQuery( target, this ),
  2503. l = targets.length;
  2504. return this.filter( function() {
  2505. var i = 0;
  2506. for ( ; i < l; i++ ) {
  2507. if ( jQuery.contains( this, targets[ i ] ) ) {
  2508. return true;
  2509. }
  2510. }
  2511. } );
  2512. },
  2513. closest: function( selectors, context ) {
  2514. var cur,
  2515. i = 0,
  2516. l = this.length,
  2517. matched = [],
  2518. targets = typeof selectors !== "string" && jQuery( selectors );
  2519. // Positional selectors never match, since there's no _selection_ context
  2520. if ( !rneedsContext.test( selectors ) ) {
  2521. for ( ; i < l; i++ ) {
  2522. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  2523. // Always skip document fragments
  2524. if ( cur.nodeType < 11 && ( targets ?
  2525. targets.index( cur ) > -1 :
  2526. // Don't pass non-elements to Sizzle
  2527. cur.nodeType === 1 &&
  2528. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  2529. matched.push( cur );
  2530. break;
  2531. }
  2532. }
  2533. }
  2534. }
  2535. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  2536. },
  2537. // Determine the position of an element within the set
  2538. index: function( elem ) {
  2539. // No argument, return index in parent
  2540. if ( !elem ) {
  2541. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  2542. }
  2543. // Index in selector
  2544. if ( typeof elem === "string" ) {
  2545. return indexOf.call( jQuery( elem ), this[ 0 ] );
  2546. }
  2547. // Locate the position of the desired element
  2548. return indexOf.call( this,
  2549. // If it receives a jQuery object, the first element is used
  2550. elem.jquery ? elem[ 0 ] : elem
  2551. );
  2552. },
  2553. add: function( selector, context ) {
  2554. return this.pushStack(
  2555. jQuery.uniqueSort(
  2556. jQuery.merge( this.get(), jQuery( selector, context ) )
  2557. )
  2558. );
  2559. },
  2560. addBack: function( selector ) {
  2561. return this.add( selector == null ?
  2562. this.prevObject : this.prevObject.filter( selector )
  2563. );
  2564. }
  2565. } );
  2566. function sibling( cur, dir ) {
  2567. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  2568. return cur;
  2569. }
  2570. jQuery.each( {
  2571. parent: function( elem ) {
  2572. var parent = elem.parentNode;
  2573. return parent && parent.nodeType !== 11 ? parent : null;
  2574. },
  2575. parents: function( elem ) {
  2576. return dir( elem, "parentNode" );
  2577. },
  2578. parentsUntil: function( elem, i, until ) {
  2579. return dir( elem, "parentNode", until );
  2580. },
  2581. next: function( elem ) {
  2582. return sibling( elem, "nextSibling" );
  2583. },
  2584. prev: function( elem ) {
  2585. return sibling( elem, "previousSibling" );
  2586. },
  2587. nextAll: function( elem ) {
  2588. return dir( elem, "nextSibling" );
  2589. },
  2590. prevAll: function( elem ) {
  2591. return dir( elem, "previousSibling" );
  2592. },
  2593. nextUntil: function( elem, i, until ) {
  2594. return dir( elem, "nextSibling", until );
  2595. },
  2596. prevUntil: function( elem, i, until ) {
  2597. return dir( elem, "previousSibling", until );
  2598. },
  2599. siblings: function( elem ) {
  2600. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  2601. },
  2602. children: function( elem ) {
  2603. return siblings( elem.firstChild );
  2604. },
  2605. contents: function( elem ) {
  2606. if ( nodeName( elem, "iframe" ) ) {
  2607. return elem.contentDocument;
  2608. }
  2609. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  2610. // Treat the template element as a regular one in browsers that
  2611. // don't support it.
  2612. if ( nodeName( elem, "template" ) ) {
  2613. elem = elem.content || elem;
  2614. }
  2615. return jQuery.merge( [], elem.childNodes );
  2616. }
  2617. }, function( name, fn ) {
  2618. jQuery.fn[ name ] = function( until, selector ) {
  2619. var matched = jQuery.map( this, fn, until );
  2620. if ( name.slice( -5 ) !== "Until" ) {
  2621. selector = until;
  2622. }
  2623. if ( selector && typeof selector === "string" ) {
  2624. matched = jQuery.filter( selector, matched );
  2625. }
  2626. if ( this.length > 1 ) {
  2627. // Remove duplicates
  2628. if ( !guaranteedUnique[ name ] ) {
  2629. jQuery.uniqueSort( matched );
  2630. }
  2631. // Reverse order for parents* and prev-derivatives
  2632. if ( rparentsprev.test( name ) ) {
  2633. matched.reverse();
  2634. }
  2635. }
  2636. return this.pushStack( matched );
  2637. };
  2638. } );
  2639. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  2640. // Convert String-formatted options into Object-formatted ones
  2641. function createOptions( options ) {
  2642. var object = {};
  2643. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  2644. object[ flag ] = true;
  2645. } );
  2646. return object;
  2647. }
  2648. /*
  2649. * Create a callback list using the following parameters:
  2650. *
  2651. * options: an optional list of space-separated options that will change how
  2652. * the callback list behaves or a more traditional option object
  2653. *
  2654. * By default a callback list will act like an event callback list and can be
  2655. * "fired" multiple times.
  2656. *
  2657. * Possible options:
  2658. *
  2659. * once: will ensure the callback list can only be fired once (like a Deferred)
  2660. *
  2661. * memory: will keep track of previous values and will call any callback added
  2662. * after the list has been fired right away with the latest "memorized"
  2663. * values (like a Deferred)
  2664. *
  2665. * unique: will ensure a callback can only be added once (no duplicate in the list)
  2666. *
  2667. * stopOnFalse: interrupt callings when a callback returns false
  2668. *
  2669. */
  2670. jQuery.Callbacks = function( options ) {
  2671. // Convert options from String-formatted to Object-formatted if needed
  2672. // (we check in cache first)
  2673. options = typeof options === "string" ?
  2674. createOptions( options ) :
  2675. jQuery.extend( {}, options );
  2676. var // Flag to know if list is currently firing
  2677. firing,
  2678. // Last fire value for non-forgettable lists
  2679. memory,
  2680. // Flag to know if list was already fired
  2681. fired,
  2682. // Flag to prevent firing
  2683. locked,
  2684. // Actual callback list
  2685. list = [],
  2686. // Queue of execution data for repeatable lists
  2687. queue = [],
  2688. // Index of currently firing callback (modified by add/remove as needed)
  2689. firingIndex = -1,
  2690. // Fire callbacks
  2691. fire = function() {
  2692. // Enforce single-firing
  2693. locked = locked || options.once;
  2694. // Execute callbacks for all pending executions,
  2695. // respecting firingIndex overrides and runtime changes
  2696. fired = firing = true;
  2697. for ( ; queue.length; firingIndex = -1 ) {
  2698. memory = queue.shift();
  2699. while ( ++firingIndex < list.length ) {
  2700. // Run callback and check for early termination
  2701. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  2702. options.stopOnFalse ) {
  2703. // Jump to end and forget the data so .add doesn't re-fire
  2704. firingIndex = list.length;
  2705. memory = false;
  2706. }
  2707. }
  2708. }
  2709. // Forget the data if we're done with it
  2710. if ( !options.memory ) {
  2711. memory = false;
  2712. }
  2713. firing = false;
  2714. // Clean up if we're done firing for good
  2715. if ( locked ) {
  2716. // Keep an empty list if we have data for future add calls
  2717. if ( memory ) {
  2718. list = [];
  2719. // Otherwise, this object is spent
  2720. } else {
  2721. list = "";
  2722. }
  2723. }
  2724. },
  2725. // Actual Callbacks object
  2726. self = {
  2727. // Add a callback or a collection of callbacks to the list
  2728. add: function() {
  2729. if ( list ) {
  2730. // If we have memory from a past run, we should fire after adding
  2731. if ( memory && !firing ) {
  2732. firingIndex = list.length - 1;
  2733. queue.push( memory );
  2734. }
  2735. ( function add( args ) {
  2736. jQuery.each( args, function( _, arg ) {
  2737. if ( isFunction( arg ) ) {
  2738. if ( !options.unique || !self.has( arg ) ) {
  2739. list.push( arg );
  2740. }
  2741. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  2742. // Inspect recursively
  2743. add( arg );
  2744. }
  2745. } );
  2746. } )( arguments );
  2747. if ( memory && !firing ) {
  2748. fire();
  2749. }
  2750. }
  2751. return this;
  2752. },
  2753. // Remove a callback from the list
  2754. remove: function() {
  2755. jQuery.each( arguments, function( _, arg ) {
  2756. var index;
  2757. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  2758. list.splice( index, 1 );
  2759. // Handle firing indexes
  2760. if ( index <= firingIndex ) {
  2761. firingIndex--;
  2762. }
  2763. }
  2764. } );
  2765. return this;
  2766. },
  2767. // Check if a given callback is in the list.
  2768. // If no argument is given, return whether or not list has callbacks attached.
  2769. has: function( fn ) {
  2770. return fn ?
  2771. jQuery.inArray( fn, list ) > -1 :
  2772. list.length > 0;
  2773. },
  2774. // Remove all callbacks from the list
  2775. empty: function() {
  2776. if ( list ) {
  2777. list = [];
  2778. }
  2779. return this;
  2780. },
  2781. // Disable .fire and .add
  2782. // Abort any current/pending executions
  2783. // Clear all callbacks and values
  2784. disable: function() {
  2785. locked = queue = [];
  2786. list = memory = "";
  2787. return this;
  2788. },
  2789. disabled: function() {
  2790. return !list;
  2791. },
  2792. // Disable .fire
  2793. // Also disable .add unless we have memory (since it would have no effect)
  2794. // Abort any pending executions
  2795. lock: function() {
  2796. locked = queue = [];
  2797. if ( !memory && !firing ) {
  2798. list = memory = "";
  2799. }
  2800. return this;
  2801. },
  2802. locked: function() {
  2803. return !!locked;
  2804. },
  2805. // Call all callbacks with the given context and arguments
  2806. fireWith: function( context, args ) {
  2807. if ( !locked ) {
  2808. args = args || [];
  2809. args = [ context, args.slice ? args.slice() : args ];
  2810. queue.push( args );
  2811. if ( !firing ) {
  2812. fire();
  2813. }
  2814. }
  2815. return this;
  2816. },
  2817. // Call all the callbacks with the given arguments
  2818. fire: function() {
  2819. self.fireWith( this, arguments );
  2820. return this;
  2821. },
  2822. // To know if the callbacks have already been called at least once
  2823. fired: function() {
  2824. return !!fired;
  2825. }
  2826. };
  2827. return self;
  2828. };
  2829. function Identity( v ) {
  2830. return v;
  2831. }
  2832. function Thrower( ex ) {
  2833. throw ex;
  2834. }
  2835. function adoptValue( value, resolve, reject, noValue ) {
  2836. var method;
  2837. try {
  2838. // Check for promise aspect first to privilege synchronous behavior
  2839. if ( value && isFunction( ( method = value.promise ) ) ) {
  2840. method.call( value ).done( resolve ).fail( reject );
  2841. // Other thenables
  2842. } else if ( value && isFunction( ( method = value.then ) ) ) {
  2843. method.call( value, resolve, reject );
  2844. // Other non-thenables
  2845. } else {
  2846. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  2847. // * false: [ value ].slice( 0 ) => resolve( value )
  2848. // * true: [ value ].slice( 1 ) => resolve()
  2849. resolve.apply( undefined, [ value ].slice( noValue ) );
  2850. }
  2851. // For Promises/A+, convert exceptions into rejections
  2852. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  2853. // Deferred#then to conditionally suppress rejection.
  2854. } catch ( value ) {
  2855. // Support: Android 4.0 only
  2856. // Strict mode functions invoked without .call/.apply get global-object context
  2857. reject.apply( undefined, [ value ] );
  2858. }
  2859. }
  2860. jQuery.extend( {
  2861. Deferred: function( func ) {
  2862. var tuples = [
  2863. // action, add listener, callbacks,
  2864. // ... .then handlers, argument index, [final state]
  2865. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  2866. jQuery.Callbacks( "memory" ), 2 ],
  2867. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  2868. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  2869. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  2870. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  2871. ],
  2872. state = "pending",
  2873. promise = {
  2874. state: function() {
  2875. return state;
  2876. },
  2877. always: function() {
  2878. deferred.done( arguments ).fail( arguments );
  2879. return this;
  2880. },
  2881. "catch": function( fn ) {
  2882. return promise.then( null, fn );
  2883. },
  2884. // Keep pipe for back-compat
  2885. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  2886. var fns = arguments;
  2887. return jQuery.Deferred( function( newDefer ) {
  2888. jQuery.each( tuples, function( i, tuple ) {
  2889. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  2890. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  2891. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  2892. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  2893. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  2894. deferred[ tuple[ 1 ] ]( function() {
  2895. var returned = fn && fn.apply( this, arguments );
  2896. if ( returned && isFunction( returned.promise ) ) {
  2897. returned.promise()
  2898. .progress( newDefer.notify )
  2899. .done( newDefer.resolve )
  2900. .fail( newDefer.reject );
  2901. } else {
  2902. newDefer[ tuple[ 0 ] + "With" ](
  2903. this,
  2904. fn ? [ returned ] : arguments
  2905. );
  2906. }
  2907. } );
  2908. } );
  2909. fns = null;
  2910. } ).promise();
  2911. },
  2912. then: function( onFulfilled, onRejected, onProgress ) {
  2913. var maxDepth = 0;
  2914. function resolve( depth, deferred, handler, special ) {
  2915. return function() {
  2916. var that = this,
  2917. args = arguments,
  2918. mightThrow = function() {
  2919. var returned, then;
  2920. // Support: Promises/A+ section 2.3.3.3.3
  2921. // https://promisesaplus.com/#point-59
  2922. // Ignore double-resolution attempts
  2923. if ( depth < maxDepth ) {
  2924. return;
  2925. }
  2926. returned = handler.apply( that, args );
  2927. // Support: Promises/A+ section 2.3.1
  2928. // https://promisesaplus.com/#point-48
  2929. if ( returned === deferred.promise() ) {
  2930. throw new TypeError( "Thenable self-resolution" );
  2931. }
  2932. // Support: Promises/A+ sections 2.3.3.1, 3.5
  2933. // https://promisesaplus.com/#point-54
  2934. // https://promisesaplus.com/#point-75
  2935. // Retrieve `then` only once
  2936. then = returned &&
  2937. // Support: Promises/A+ section 2.3.4
  2938. // https://promisesaplus.com/#point-64
  2939. // Only check objects and functions for thenability
  2940. ( typeof returned === "object" ||
  2941. typeof returned === "function" ) &&
  2942. returned.then;
  2943. // Handle a returned thenable
  2944. if ( isFunction( then ) ) {
  2945. // Special processors (notify) just wait for resolution
  2946. if ( special ) {
  2947. then.call(
  2948. returned,
  2949. resolve( maxDepth, deferred, Identity, special ),
  2950. resolve( maxDepth, deferred, Thrower, special )
  2951. );
  2952. // Normal processors (resolve) also hook into progress
  2953. } else {
  2954. // ...and disregard older resolution values
  2955. maxDepth++;
  2956. then.call(
  2957. returned,
  2958. resolve( maxDepth, deferred, Identity, special ),
  2959. resolve( maxDepth, deferred, Thrower, special ),
  2960. resolve( maxDepth, deferred, Identity,
  2961. deferred.notifyWith )
  2962. );
  2963. }
  2964. // Handle all other returned values
  2965. } else {
  2966. // Only substitute handlers pass on context
  2967. // and multiple values (non-spec behavior)
  2968. if ( handler !== Identity ) {
  2969. that = undefined;
  2970. args = [ returned ];
  2971. }
  2972. // Process the value(s)
  2973. // Default process is resolve
  2974. ( special || deferred.resolveWith )( that, args );
  2975. }
  2976. },
  2977. // Only normal processors (resolve) catch and reject exceptions
  2978. process = special ?
  2979. mightThrow :
  2980. function() {
  2981. try {
  2982. mightThrow();
  2983. } catch ( e ) {
  2984. if ( jQuery.Deferred.exceptionHook ) {
  2985. jQuery.Deferred.exceptionHook( e,
  2986. process.stackTrace );
  2987. }
  2988. // Support: Promises/A+ section 2.3.3.3.4.1
  2989. // https://promisesaplus.com/#point-61
  2990. // Ignore post-resolution exceptions
  2991. if ( depth + 1 >= maxDepth ) {
  2992. // Only substitute handlers pass on context
  2993. // and multiple values (non-spec behavior)
  2994. if ( handler !== Thrower ) {
  2995. that = undefined;
  2996. args = [ e ];
  2997. }
  2998. deferred.rejectWith( that, args );
  2999. }
  3000. }
  3001. };
  3002. // Support: Promises/A+ section 2.3.3.3.1
  3003. // https://promisesaplus.com/#point-57
  3004. // Re-resolve promises immediately to dodge false rejection from
  3005. // subsequent errors
  3006. if ( depth ) {
  3007. process();
  3008. } else {
  3009. // Call an optional hook to record the stack, in case of exception
  3010. // since it's otherwise lost when execution goes async
  3011. if ( jQuery.Deferred.getStackHook ) {
  3012. process.stackTrace = jQuery.Deferred.getStackHook();
  3013. }
  3014. window.setTimeout( process );
  3015. }
  3016. };
  3017. }
  3018. return jQuery.Deferred( function( newDefer ) {
  3019. // progress_handlers.add( ... )
  3020. tuples[ 0 ][ 3 ].add(
  3021. resolve(
  3022. 0,
  3023. newDefer,
  3024. isFunction( onProgress ) ?
  3025. onProgress :
  3026. Identity,
  3027. newDefer.notifyWith
  3028. )
  3029. );
  3030. // fulfilled_handlers.add( ... )
  3031. tuples[ 1 ][ 3 ].add(
  3032. resolve(
  3033. 0,
  3034. newDefer,
  3035. isFunction( onFulfilled ) ?
  3036. onFulfilled :
  3037. Identity
  3038. )
  3039. );
  3040. // rejected_handlers.add( ... )
  3041. tuples[ 2 ][ 3 ].add(
  3042. resolve(
  3043. 0,
  3044. newDefer,
  3045. isFunction( onRejected ) ?
  3046. onRejected :
  3047. Thrower
  3048. )
  3049. );
  3050. } ).promise();
  3051. },
  3052. // Get a promise for this deferred
  3053. // If obj is provided, the promise aspect is added to the object
  3054. promise: function( obj ) {
  3055. return obj != null ? jQuery.extend( obj, promise ) : promise;
  3056. }
  3057. },
  3058. deferred = {};
  3059. // Add list-specific methods
  3060. jQuery.each( tuples, function( i, tuple ) {
  3061. var list = tuple[ 2 ],
  3062. stateString = tuple[ 5 ];
  3063. // promise.progress = list.add
  3064. // promise.done = list.add
  3065. // promise.fail = list.add
  3066. promise[ tuple[ 1 ] ] = list.add;
  3067. // Handle state
  3068. if ( stateString ) {
  3069. list.add(
  3070. function() {
  3071. // state = "resolved" (i.e., fulfilled)
  3072. // state = "rejected"
  3073. state = stateString;
  3074. },
  3075. // rejected_callbacks.disable
  3076. // fulfilled_callbacks.disable
  3077. tuples[ 3 - i ][ 2 ].disable,
  3078. // rejected_handlers.disable
  3079. // fulfilled_handlers.disable
  3080. tuples[ 3 - i ][ 3 ].disable,
  3081. // progress_callbacks.lock
  3082. tuples[ 0 ][ 2 ].lock,
  3083. // progress_handlers.lock
  3084. tuples[ 0 ][ 3 ].lock
  3085. );
  3086. }
  3087. // progress_handlers.fire
  3088. // fulfilled_handlers.fire
  3089. // rejected_handlers.fire
  3090. list.add( tuple[ 3 ].fire );
  3091. // deferred.notify = function() { deferred.notifyWith(...) }
  3092. // deferred.resolve = function() { deferred.resolveWith(...) }
  3093. // deferred.reject = function() { deferred.rejectWith(...) }
  3094. deferred[ tuple[ 0 ] ] = function() {
  3095. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  3096. return this;
  3097. };
  3098. // deferred.notifyWith = list.fireWith
  3099. // deferred.resolveWith = list.fireWith
  3100. // deferred.rejectWith = list.fireWith
  3101. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  3102. } );
  3103. // Make the deferred a promise
  3104. promise.promise( deferred );
  3105. // Call given func if any
  3106. if ( func ) {
  3107. func.call( deferred, deferred );
  3108. }
  3109. // All done!
  3110. return deferred;
  3111. },
  3112. // Deferred helper
  3113. when: function( singleValue ) {
  3114. var
  3115. // count of uncompleted subordinates
  3116. remaining = arguments.length,
  3117. // count of unprocessed arguments
  3118. i = remaining,
  3119. // subordinate fulfillment data
  3120. resolveContexts = Array( i ),
  3121. resolveValues = slice.call( arguments ),
  3122. // the master Deferred
  3123. master = jQuery.Deferred(),
  3124. // subordinate callback factory
  3125. updateFunc = function( i ) {
  3126. return function( value ) {
  3127. resolveContexts[ i ] = this;
  3128. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  3129. if ( !( --remaining ) ) {
  3130. master.resolveWith( resolveContexts, resolveValues );
  3131. }
  3132. };
  3133. };
  3134. // Single- and empty arguments are adopted like Promise.resolve
  3135. if ( remaining <= 1 ) {
  3136. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  3137. !remaining );
  3138. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  3139. if ( master.state() === "pending" ||
  3140. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  3141. return master.then();
  3142. }
  3143. }
  3144. // Multiple arguments are aggregated like Promise.all array elements
  3145. while ( i-- ) {
  3146. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  3147. }
  3148. return master.promise();
  3149. }
  3150. } );
  3151. // These usually indicate a programmer mistake during development,
  3152. // warn about them ASAP rather than swallowing them by default.
  3153. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  3154. jQuery.Deferred.exceptionHook = function( error, stack ) {
  3155. // Support: IE 8 - 9 only
  3156. // Console exists when dev tools are open, which can happen at any time
  3157. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  3158. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  3159. }
  3160. };
  3161. jQuery.readyException = function( error ) {
  3162. window.setTimeout( function() {
  3163. throw error;
  3164. } );
  3165. };
  3166. // The deferred used on DOM ready
  3167. var readyList = jQuery.Deferred();
  3168. jQuery.fn.ready = function( fn ) {
  3169. readyList
  3170. .then( fn )
  3171. // Wrap jQuery.readyException in a function so that the lookup
  3172. // happens at the time of error handling instead of callback
  3173. // registration.
  3174. .catch( function( error ) {
  3175. jQuery.readyException( error );
  3176. } );
  3177. return this;
  3178. };
  3179. jQuery.extend( {
  3180. // Is the DOM ready to be used? Set to true once it occurs.
  3181. isReady: false,
  3182. // A counter to track how many items to wait for before
  3183. // the ready event fires. See #6781
  3184. readyWait: 1,
  3185. // Handle when the DOM is ready
  3186. ready: function( wait ) {
  3187. // Abort if there are pending holds or we're already ready
  3188. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  3189. return;
  3190. }
  3191. // Remember that the DOM is ready
  3192. jQuery.isReady = true;
  3193. // If a normal DOM Ready event fired, decrement, and wait if need be
  3194. if ( wait !== true && --jQuery.readyWait > 0 ) {
  3195. return;
  3196. }
  3197. // If there are functions bound, to execute
  3198. readyList.resolveWith( document, [ jQuery ] );
  3199. }
  3200. } );
  3201. jQuery.ready.then = readyList.then;
  3202. // The ready event handler and self cleanup method
  3203. function completed() {
  3204. document.removeEventListener( "DOMContentLoaded", completed );
  3205. window.removeEventListener( "load", completed );
  3206. jQuery.ready();
  3207. }
  3208. // Catch cases where $(document).ready() is called
  3209. // after the browser event has already occurred.
  3210. // Support: IE <=9 - 10 only
  3211. // Older IE sometimes signals "interactive" too soon
  3212. if ( document.readyState === "complete" ||
  3213. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  3214. // Handle it asynchronously to allow scripts the opportunity to delay ready
  3215. window.setTimeout( jQuery.ready );
  3216. } else {
  3217. // Use the handy event callback
  3218. document.addEventListener( "DOMContentLoaded", completed );
  3219. // A fallback to window.onload, that will always work
  3220. window.addEventListener( "load", completed );
  3221. }
  3222. // Multifunctional method to get and set values of a collection
  3223. // The value/s can optionally be executed if it's a function
  3224. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  3225. var i = 0,
  3226. len = elems.length,
  3227. bulk = key == null;
  3228. // Sets many values
  3229. if ( toType( key ) === "object" ) {
  3230. chainable = true;
  3231. for ( i in key ) {
  3232. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  3233. }
  3234. // Sets one value
  3235. } else if ( value !== undefined ) {
  3236. chainable = true;
  3237. if ( !isFunction( value ) ) {
  3238. raw = true;
  3239. }
  3240. if ( bulk ) {
  3241. // Bulk operations run against the entire set
  3242. if ( raw ) {
  3243. fn.call( elems, value );
  3244. fn = null;
  3245. // ...except when executing function values
  3246. } else {
  3247. bulk = fn;
  3248. fn = function( elem, key, value ) {
  3249. return bulk.call( jQuery( elem ), value );
  3250. };
  3251. }
  3252. }
  3253. if ( fn ) {
  3254. for ( ; i < len; i++ ) {
  3255. fn(
  3256. elems[ i ], key, raw ?
  3257. value :
  3258. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  3259. );
  3260. }
  3261. }
  3262. }
  3263. if ( chainable ) {
  3264. return elems;
  3265. }
  3266. // Gets
  3267. if ( bulk ) {
  3268. return fn.call( elems );
  3269. }
  3270. return len ? fn( elems[ 0 ], key ) : emptyGet;
  3271. };
  3272. // Matches dashed string for camelizing
  3273. var rmsPrefix = /^-ms-/,
  3274. rdashAlpha = /-([a-z])/g;
  3275. // Used by camelCase as callback to replace()
  3276. function fcamelCase( all, letter ) {
  3277. return letter.toUpperCase();
  3278. }
  3279. // Convert dashed to camelCase; used by the css and data modules
  3280. // Support: IE <=9 - 11, Edge 12 - 15
  3281. // Microsoft forgot to hump their vendor prefix (#9572)
  3282. function camelCase( string ) {
  3283. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  3284. }
  3285. var acceptData = function( owner ) {
  3286. // Accepts only:
  3287. // - Node
  3288. // - Node.ELEMENT_NODE
  3289. // - Node.DOCUMENT_NODE
  3290. // - Object
  3291. // - Any
  3292. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  3293. };
  3294. function Data() {
  3295. this.expando = jQuery.expando + Data.uid++;
  3296. }
  3297. Data.uid = 1;
  3298. Data.prototype = {
  3299. cache: function( owner ) {
  3300. // Check if the owner object already has a cache
  3301. var value = owner[ this.expando ];
  3302. // If not, create one
  3303. if ( !value ) {
  3304. value = {};
  3305. // We can accept data for non-element nodes in modern browsers,
  3306. // but we should not, see #8335.
  3307. // Always return an empty object.
  3308. if ( acceptData( owner ) ) {
  3309. // If it is a node unlikely to be stringify-ed or looped over
  3310. // use plain assignment
  3311. if ( owner.nodeType ) {
  3312. owner[ this.expando ] = value;
  3313. // Otherwise secure it in a non-enumerable property
  3314. // configurable must be true to allow the property to be
  3315. // deleted when data is removed
  3316. } else {
  3317. Object.defineProperty( owner, this.expando, {
  3318. value: value,
  3319. configurable: true
  3320. } );
  3321. }
  3322. }
  3323. }
  3324. return value;
  3325. },
  3326. set: function( owner, data, value ) {
  3327. var prop,
  3328. cache = this.cache( owner );
  3329. // Handle: [ owner, key, value ] args
  3330. // Always use camelCase key (gh-2257)
  3331. if ( typeof data === "string" ) {
  3332. cache[ camelCase( data ) ] = value;
  3333. // Handle: [ owner, { properties } ] args
  3334. } else {
  3335. // Copy the properties one-by-one to the cache object
  3336. for ( prop in data ) {
  3337. cache[ camelCase( prop ) ] = data[ prop ];
  3338. }
  3339. }
  3340. return cache;
  3341. },
  3342. get: function( owner, key ) {
  3343. return key === undefined ?
  3344. this.cache( owner ) :
  3345. // Always use camelCase key (gh-2257)
  3346. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  3347. },
  3348. access: function( owner, key, value ) {
  3349. // In cases where either:
  3350. //
  3351. // 1. No key was specified
  3352. // 2. A string key was specified, but no value provided
  3353. //
  3354. // Take the "read" path and allow the get method to determine
  3355. // which value to return, respectively either:
  3356. //
  3357. // 1. The entire cache object
  3358. // 2. The data stored at the key
  3359. //
  3360. if ( key === undefined ||
  3361. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  3362. return this.get( owner, key );
  3363. }
  3364. // When the key is not a string, or both a key and value
  3365. // are specified, set or extend (existing objects) with either:
  3366. //
  3367. // 1. An object of properties
  3368. // 2. A key and value
  3369. //
  3370. this.set( owner, key, value );
  3371. // Since the "set" path can have two possible entry points
  3372. // return the expected data based on which path was taken[*]
  3373. return value !== undefined ? value : key;
  3374. },
  3375. remove: function( owner, key ) {
  3376. var i,
  3377. cache = owner[ this.expando ];
  3378. if ( cache === undefined ) {
  3379. return;
  3380. }
  3381. if ( key !== undefined ) {
  3382. // Support array or space separated string of keys
  3383. if ( Array.isArray( key ) ) {
  3384. // If key is an array of keys...
  3385. // We always set camelCase keys, so remove that.
  3386. key = key.map( camelCase );
  3387. } else {
  3388. key = camelCase( key );
  3389. // If a key with the spaces exists, use it.
  3390. // Otherwise, create an array by matching non-whitespace
  3391. key = key in cache ?
  3392. [ key ] :
  3393. ( key.match( rnothtmlwhite ) || [] );
  3394. }
  3395. i = key.length;
  3396. while ( i-- ) {
  3397. delete cache[ key[ i ] ];
  3398. }
  3399. }
  3400. // Remove the expando if there's no more data
  3401. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  3402. // Support: Chrome <=35 - 45
  3403. // Webkit & Blink performance suffers when deleting properties
  3404. // from DOM nodes, so set to undefined instead
  3405. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  3406. if ( owner.nodeType ) {
  3407. owner[ this.expando ] = undefined;
  3408. } else {
  3409. delete owner[ this.expando ];
  3410. }
  3411. }
  3412. },
  3413. hasData: function( owner ) {
  3414. var cache = owner[ this.expando ];
  3415. return cache !== undefined && !jQuery.isEmptyObject( cache );
  3416. }
  3417. };
  3418. var dataPriv = new Data();
  3419. var dataUser = new Data();
  3420. // Implementation Summary
  3421. //
  3422. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  3423. // 2. Improve the module's maintainability by reducing the storage
  3424. // paths to a single mechanism.
  3425. // 3. Use the same single mechanism to support "private" and "user" data.
  3426. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  3427. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  3428. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  3429. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  3430. rmultiDash = /[A-Z]/g;
  3431. function getData( data ) {
  3432. if ( data === "true" ) {
  3433. return true;
  3434. }
  3435. if ( data === "false" ) {
  3436. return false;
  3437. }
  3438. if ( data === "null" ) {
  3439. return null;
  3440. }
  3441. // Only convert to a number if it doesn't change the string
  3442. if ( data === +data + "" ) {
  3443. return +data;
  3444. }
  3445. if ( rbrace.test( data ) ) {
  3446. return JSON.parse( data );
  3447. }
  3448. return data;
  3449. }
  3450. function dataAttr( elem, key, data ) {
  3451. var name;
  3452. // If nothing was found internally, try to fetch any
  3453. // data from the HTML5 data-* attribute
  3454. if ( data === undefined && elem.nodeType === 1 ) {
  3455. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  3456. data = elem.getAttribute( name );
  3457. if ( typeof data === "string" ) {
  3458. try {
  3459. data = getData( data );
  3460. } catch ( e ) {}
  3461. // Make sure we set the data so it isn't changed later
  3462. dataUser.set( elem, key, data );
  3463. } else {
  3464. data = undefined;
  3465. }
  3466. }
  3467. return data;
  3468. }
  3469. jQuery.extend( {
  3470. hasData: function( elem ) {
  3471. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  3472. },
  3473. data: function( elem, name, data ) {
  3474. return dataUser.access( elem, name, data );
  3475. },
  3476. removeData: function( elem, name ) {
  3477. dataUser.remove( elem, name );
  3478. },
  3479. // TODO: Now that all calls to _data and _removeData have been replaced
  3480. // with direct calls to dataPriv methods, these can be deprecated.
  3481. _data: function( elem, name, data ) {
  3482. return dataPriv.access( elem, name, data );
  3483. },
  3484. _removeData: function( elem, name ) {
  3485. dataPriv.remove( elem, name );
  3486. }
  3487. } );
  3488. jQuery.fn.extend( {
  3489. data: function( key, value ) {
  3490. var i, name, data,
  3491. elem = this[ 0 ],
  3492. attrs = elem && elem.attributes;
  3493. // Gets all values
  3494. if ( key === undefined ) {
  3495. if ( this.length ) {
  3496. data = dataUser.get( elem );
  3497. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  3498. i = attrs.length;
  3499. while ( i-- ) {
  3500. // Support: IE 11 only
  3501. // The attrs elements can be null (#14894)
  3502. if ( attrs[ i ] ) {
  3503. name = attrs[ i ].name;
  3504. if ( name.indexOf( "data-" ) === 0 ) {
  3505. name = camelCase( name.slice( 5 ) );
  3506. dataAttr( elem, name, data[ name ] );
  3507. }
  3508. }
  3509. }
  3510. dataPriv.set( elem, "hasDataAttrs", true );
  3511. }
  3512. }
  3513. return data;
  3514. }
  3515. // Sets multiple values
  3516. if ( typeof key === "object" ) {
  3517. return this.each( function() {
  3518. dataUser.set( this, key );
  3519. } );
  3520. }
  3521. return access( this, function( value ) {
  3522. var data;
  3523. // The calling jQuery object (element matches) is not empty
  3524. // (and therefore has an element appears at this[ 0 ]) and the
  3525. // `value` parameter was not undefined. An empty jQuery object
  3526. // will result in `undefined` for elem = this[ 0 ] which will
  3527. // throw an exception if an attempt to read a data cache is made.
  3528. if ( elem && value === undefined ) {
  3529. // Attempt to get data from the cache
  3530. // The key will always be camelCased in Data
  3531. data = dataUser.get( elem, key );
  3532. if ( data !== undefined ) {
  3533. return data;
  3534. }
  3535. // Attempt to "discover" the data in
  3536. // HTML5 custom data-* attrs
  3537. data = dataAttr( elem, key );
  3538. if ( data !== undefined ) {
  3539. return data;
  3540. }
  3541. // We tried really hard, but the data doesn't exist.
  3542. return;
  3543. }
  3544. // Set the data...
  3545. this.each( function() {
  3546. // We always store the camelCased key
  3547. dataUser.set( this, key, value );
  3548. } );
  3549. }, null, value, arguments.length > 1, null, true );
  3550. },
  3551. removeData: function( key ) {
  3552. return this.each( function() {
  3553. dataUser.remove( this, key );
  3554. } );
  3555. }
  3556. } );
  3557. jQuery.extend( {
  3558. queue: function( elem, type, data ) {
  3559. var queue;
  3560. if ( elem ) {
  3561. type = ( type || "fx" ) + "queue";
  3562. queue = dataPriv.get( elem, type );
  3563. // Speed up dequeue by getting out quickly if this is just a lookup
  3564. if ( data ) {
  3565. if ( !queue || Array.isArray( data ) ) {
  3566. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  3567. } else {
  3568. queue.push( data );
  3569. }
  3570. }
  3571. return queue || [];
  3572. }
  3573. },
  3574. dequeue: function( elem, type ) {
  3575. type = type || "fx";
  3576. var queue = jQuery.queue( elem, type ),
  3577. startLength = queue.length,
  3578. fn = queue.shift(),
  3579. hooks = jQuery._queueHooks( elem, type ),
  3580. next = function() {
  3581. jQuery.dequeue( elem, type );
  3582. };
  3583. // If the fx queue is dequeued, always remove the progress sentinel
  3584. if ( fn === "inprogress" ) {
  3585. fn = queue.shift();
  3586. startLength--;
  3587. }
  3588. if ( fn ) {
  3589. // Add a progress sentinel to prevent the fx queue from being
  3590. // automatically dequeued
  3591. if ( type === "fx" ) {
  3592. queue.unshift( "inprogress" );
  3593. }
  3594. // Clear up the last queue stop function
  3595. delete hooks.stop;
  3596. fn.call( elem, next, hooks );
  3597. }
  3598. if ( !startLength && hooks ) {
  3599. hooks.empty.fire();
  3600. }
  3601. },
  3602. // Not public - generate a queueHooks object, or return the current one
  3603. _queueHooks: function( elem, type ) {
  3604. var key = type + "queueHooks";
  3605. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  3606. empty: jQuery.Callbacks( "once memory" ).add( function() {
  3607. dataPriv.remove( elem, [ type + "queue", key ] );
  3608. } )
  3609. } );
  3610. }
  3611. } );
  3612. jQuery.fn.extend( {
  3613. queue: function( type, data ) {
  3614. var setter = 2;
  3615. if ( typeof type !== "string" ) {
  3616. data = type;
  3617. type = "fx";
  3618. setter--;
  3619. }
  3620. if ( arguments.length < setter ) {
  3621. return jQuery.queue( this[ 0 ], type );
  3622. }
  3623. return data === undefined ?
  3624. this :
  3625. this.each( function() {
  3626. var queue = jQuery.queue( this, type, data );
  3627. // Ensure a hooks for this queue
  3628. jQuery._queueHooks( this, type );
  3629. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  3630. jQuery.dequeue( this, type );
  3631. }
  3632. } );
  3633. },
  3634. dequeue: function( type ) {
  3635. return this.each( function() {
  3636. jQuery.dequeue( this, type );
  3637. } );
  3638. },
  3639. clearQueue: function( type ) {
  3640. return this.queue( type || "fx", [] );
  3641. },
  3642. // Get a promise resolved when queues of a certain type
  3643. // are emptied (fx is the type by default)
  3644. promise: function( type, obj ) {
  3645. var tmp,
  3646. count = 1,
  3647. defer = jQuery.Deferred(),
  3648. elements = this,
  3649. i = this.length,
  3650. resolve = function() {
  3651. if ( !( --count ) ) {
  3652. defer.resolveWith( elements, [ elements ] );
  3653. }
  3654. };
  3655. if ( typeof type !== "string" ) {
  3656. obj = type;
  3657. type = undefined;
  3658. }
  3659. type = type || "fx";
  3660. while ( i-- ) {
  3661. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  3662. if ( tmp && tmp.empty ) {
  3663. count++;
  3664. tmp.empty.add( resolve );
  3665. }
  3666. }
  3667. resolve();
  3668. return defer.promise( obj );
  3669. }
  3670. } );
  3671. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  3672. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  3673. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  3674. var isHiddenWithinTree = function( elem, el ) {
  3675. // isHiddenWithinTree might be called from jQuery#filter function;
  3676. // in that case, element will be second argument
  3677. elem = el || elem;
  3678. // Inline style trumps all
  3679. return elem.style.display === "none" ||
  3680. elem.style.display === "" &&
  3681. // Otherwise, check computed style
  3682. // Support: Firefox <=43 - 45
  3683. // Disconnected elements can have computed display: none, so first confirm that elem is
  3684. // in the document.
  3685. jQuery.contains( elem.ownerDocument, elem ) &&
  3686. jQuery.css( elem, "display" ) === "none";
  3687. };
  3688. var swap = function( elem, options, callback, args ) {
  3689. var ret, name,
  3690. old = {};
  3691. // Remember the old values, and insert the new ones
  3692. for ( name in options ) {
  3693. old[ name ] = elem.style[ name ];
  3694. elem.style[ name ] = options[ name ];
  3695. }
  3696. ret = callback.apply( elem, args || [] );
  3697. // Revert the old values
  3698. for ( name in options ) {
  3699. elem.style[ name ] = old[ name ];
  3700. }
  3701. return ret;
  3702. };
  3703. function adjustCSS( elem, prop, valueParts, tween ) {
  3704. var adjusted, scale,
  3705. maxIterations = 20,
  3706. currentValue = tween ?
  3707. function() {
  3708. return tween.cur();
  3709. } :
  3710. function() {
  3711. return jQuery.css( elem, prop, "" );
  3712. },
  3713. initial = currentValue(),
  3714. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  3715. // Starting value computation is required for potential unit mismatches
  3716. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  3717. rcssNum.exec( jQuery.css( elem, prop ) );
  3718. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  3719. // Support: Firefox <=54
  3720. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  3721. initial = initial / 2;
  3722. // Trust units reported by jQuery.css
  3723. unit = unit || initialInUnit[ 3 ];
  3724. // Iteratively approximate from a nonzero starting point
  3725. initialInUnit = +initial || 1;
  3726. while ( maxIterations-- ) {
  3727. // Evaluate and update our best guess (doubling guesses that zero out).
  3728. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  3729. jQuery.style( elem, prop, initialInUnit + unit );
  3730. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  3731. maxIterations = 0;
  3732. }
  3733. initialInUnit = initialInUnit / scale;
  3734. }
  3735. initialInUnit = initialInUnit * 2;
  3736. jQuery.style( elem, prop, initialInUnit + unit );
  3737. // Make sure we update the tween properties later on
  3738. valueParts = valueParts || [];
  3739. }
  3740. if ( valueParts ) {
  3741. initialInUnit = +initialInUnit || +initial || 0;
  3742. // Apply relative offset (+=/-=) if specified
  3743. adjusted = valueParts[ 1 ] ?
  3744. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  3745. +valueParts[ 2 ];
  3746. if ( tween ) {
  3747. tween.unit = unit;
  3748. tween.start = initialInUnit;
  3749. tween.end = adjusted;
  3750. }
  3751. }
  3752. return adjusted;
  3753. }
  3754. var defaultDisplayMap = {};
  3755. function getDefaultDisplay( elem ) {
  3756. var temp,
  3757. doc = elem.ownerDocument,
  3758. nodeName = elem.nodeName,
  3759. display = defaultDisplayMap[ nodeName ];
  3760. if ( display ) {
  3761. return display;
  3762. }
  3763. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  3764. display = jQuery.css( temp, "display" );
  3765. temp.parentNode.removeChild( temp );
  3766. if ( display === "none" ) {
  3767. display = "block";
  3768. }
  3769. defaultDisplayMap[ nodeName ] = display;
  3770. return display;
  3771. }
  3772. function showHide( elements, show ) {
  3773. var display, elem,
  3774. values = [],
  3775. index = 0,
  3776. length = elements.length;
  3777. // Determine new display value for elements that need to change
  3778. for ( ; index < length; index++ ) {
  3779. elem = elements[ index ];
  3780. if ( !elem.style ) {
  3781. continue;
  3782. }
  3783. display = elem.style.display;
  3784. if ( show ) {
  3785. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  3786. // check is required in this first loop unless we have a nonempty display value (either
  3787. // inline or about-to-be-restored)
  3788. if ( display === "none" ) {
  3789. values[ index ] = dataPriv.get( elem, "display" ) || null;
  3790. if ( !values[ index ] ) {
  3791. elem.style.display = "";
  3792. }
  3793. }
  3794. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  3795. values[ index ] = getDefaultDisplay( elem );
  3796. }
  3797. } else {
  3798. if ( display !== "none" ) {
  3799. values[ index ] = "none";
  3800. // Remember what we're overwriting
  3801. dataPriv.set( elem, "display", display );
  3802. }
  3803. }
  3804. }
  3805. // Set the display of the elements in a second loop to avoid constant reflow
  3806. for ( index = 0; index < length; index++ ) {
  3807. if ( values[ index ] != null ) {
  3808. elements[ index ].style.display = values[ index ];
  3809. }
  3810. }
  3811. return elements;
  3812. }
  3813. jQuery.fn.extend( {
  3814. show: function() {
  3815. return showHide( this, true );
  3816. },
  3817. hide: function() {
  3818. return showHide( this );
  3819. },
  3820. toggle: function( state ) {
  3821. if ( typeof state === "boolean" ) {
  3822. return state ? this.show() : this.hide();
  3823. }
  3824. return this.each( function() {
  3825. if ( isHiddenWithinTree( this ) ) {
  3826. jQuery( this ).show();
  3827. } else {
  3828. jQuery( this ).hide();
  3829. }
  3830. } );
  3831. }
  3832. } );
  3833. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  3834. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
  3835. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  3836. // We have to close these tags to support XHTML (#13200)
  3837. var wrapMap = {
  3838. // Support: IE <=9 only
  3839. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  3840. // XHTML parsers do not magically insert elements in the
  3841. // same way that tag soup parsers do. So we cannot shorten
  3842. // this by omitting <tbody> or other required elements.
  3843. thead: [ 1, "<table>", "</table>" ],
  3844. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  3845. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  3846. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  3847. _default: [ 0, "", "" ]
  3848. };
  3849. // Support: IE <=9 only
  3850. wrapMap.optgroup = wrapMap.option;
  3851. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  3852. wrapMap.th = wrapMap.td;
  3853. function getAll( context, tag ) {
  3854. // Support: IE <=9 - 11 only
  3855. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  3856. var ret;
  3857. if ( typeof context.getElementsByTagName !== "undefined" ) {
  3858. ret = context.getElementsByTagName( tag || "*" );
  3859. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  3860. ret = context.querySelectorAll( tag || "*" );
  3861. } else {
  3862. ret = [];
  3863. }
  3864. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  3865. return jQuery.merge( [ context ], ret );
  3866. }
  3867. return ret;
  3868. }
  3869. // Mark scripts as having already been evaluated
  3870. function setGlobalEval( elems, refElements ) {
  3871. var i = 0,
  3872. l = elems.length;
  3873. for ( ; i < l; i++ ) {
  3874. dataPriv.set(
  3875. elems[ i ],
  3876. "globalEval",
  3877. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  3878. );
  3879. }
  3880. }
  3881. var rhtml = /<|&#?\w+;/;
  3882. function buildFragment( elems, context, scripts, selection, ignored ) {
  3883. var elem, tmp, tag, wrap, contains, j,
  3884. fragment = context.createDocumentFragment(),
  3885. nodes = [],
  3886. i = 0,
  3887. l = elems.length;
  3888. for ( ; i < l; i++ ) {
  3889. elem = elems[ i ];
  3890. if ( elem || elem === 0 ) {
  3891. // Add nodes directly
  3892. if ( toType( elem ) === "object" ) {
  3893. // Support: Android <=4.0 only, PhantomJS 1 only
  3894. // push.apply(_, arraylike) throws on ancient WebKit
  3895. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  3896. // Convert non-html into a text node
  3897. } else if ( !rhtml.test( elem ) ) {
  3898. nodes.push( context.createTextNode( elem ) );
  3899. // Convert html into DOM nodes
  3900. } else {
  3901. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  3902. // Deserialize a standard representation
  3903. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  3904. wrap = wrapMap[ tag ] || wrapMap._default;
  3905. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  3906. // Descend through wrappers to the right content
  3907. j = wrap[ 0 ];
  3908. while ( j-- ) {
  3909. tmp = tmp.lastChild;
  3910. }
  3911. // Support: Android <=4.0 only, PhantomJS 1 only
  3912. // push.apply(_, arraylike) throws on ancient WebKit
  3913. jQuery.merge( nodes, tmp.childNodes );
  3914. // Remember the top-level container
  3915. tmp = fragment.firstChild;
  3916. // Ensure the created nodes are orphaned (#12392)
  3917. tmp.textContent = "";
  3918. }
  3919. }
  3920. }
  3921. // Remove wrapper from fragment
  3922. fragment.textContent = "";
  3923. i = 0;
  3924. while ( ( elem = nodes[ i++ ] ) ) {
  3925. // Skip elements already in the context collection (trac-4087)
  3926. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  3927. if ( ignored ) {
  3928. ignored.push( elem );
  3929. }
  3930. continue;
  3931. }
  3932. contains = jQuery.contains( elem.ownerDocument, elem );
  3933. // Append to fragment
  3934. tmp = getAll( fragment.appendChild( elem ), "script" );
  3935. // Preserve script evaluation history
  3936. if ( contains ) {
  3937. setGlobalEval( tmp );
  3938. }
  3939. // Capture executables
  3940. if ( scripts ) {
  3941. j = 0;
  3942. while ( ( elem = tmp[ j++ ] ) ) {
  3943. if ( rscriptType.test( elem.type || "" ) ) {
  3944. scripts.push( elem );
  3945. }
  3946. }
  3947. }
  3948. }
  3949. return fragment;
  3950. }
  3951. ( function() {
  3952. var fragment = document.createDocumentFragment(),
  3953. div = fragment.appendChild( document.createElement( "div" ) ),
  3954. input = document.createElement( "input" );
  3955. // Support: Android 4.0 - 4.3 only
  3956. // Check state lost if the name is set (#11217)
  3957. // Support: Windows Web Apps (WWA)
  3958. // `name` and `type` must use .setAttribute for WWA (#14901)
  3959. input.setAttribute( "type", "radio" );
  3960. input.setAttribute( "checked", "checked" );
  3961. input.setAttribute( "name", "t" );
  3962. div.appendChild( input );
  3963. // Support: Android <=4.1 only
  3964. // Older WebKit doesn't clone checked state correctly in fragments
  3965. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  3966. // Support: IE <=11 only
  3967. // Make sure textarea (and checkbox) defaultValue is properly cloned
  3968. div.innerHTML = "<textarea>x</textarea>";
  3969. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  3970. } )();
  3971. var documentElement = document.documentElement;
  3972. var
  3973. rkeyEvent = /^key/,
  3974. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  3975. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  3976. function returnTrue() {
  3977. return true;
  3978. }
  3979. function returnFalse() {
  3980. return false;
  3981. }
  3982. // Support: IE <=9 only
  3983. // See #13393 for more info
  3984. function safeActiveElement() {
  3985. try {
  3986. return document.activeElement;
  3987. } catch ( err ) { }
  3988. }
  3989. function on( elem, types, selector, data, fn, one ) {
  3990. var origFn, type;
  3991. // Types can be a map of types/handlers
  3992. if ( typeof types === "object" ) {
  3993. // ( types-Object, selector, data )
  3994. if ( typeof selector !== "string" ) {
  3995. // ( types-Object, data )
  3996. data = data || selector;
  3997. selector = undefined;
  3998. }
  3999. for ( type in types ) {
  4000. on( elem, type, selector, data, types[ type ], one );
  4001. }
  4002. return elem;
  4003. }
  4004. if ( data == null && fn == null ) {
  4005. // ( types, fn )
  4006. fn = selector;
  4007. data = selector = undefined;
  4008. } else if ( fn == null ) {
  4009. if ( typeof selector === "string" ) {
  4010. // ( types, selector, fn )
  4011. fn = data;
  4012. data = undefined;
  4013. } else {
  4014. // ( types, data, fn )
  4015. fn = data;
  4016. data = selector;
  4017. selector = undefined;
  4018. }
  4019. }
  4020. if ( fn === false ) {
  4021. fn = returnFalse;
  4022. } else if ( !fn ) {
  4023. return elem;
  4024. }
  4025. if ( one === 1 ) {
  4026. origFn = fn;
  4027. fn = function( event ) {
  4028. // Can use an empty set, since event contains the info
  4029. jQuery().off( event );
  4030. return origFn.apply( this, arguments );
  4031. };
  4032. // Use same guid so caller can remove using origFn
  4033. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  4034. }
  4035. return elem.each( function() {
  4036. jQuery.event.add( this, types, fn, data, selector );
  4037. } );
  4038. }
  4039. /*
  4040. * Helper functions for managing events -- not part of the public interface.
  4041. * Props to Dean Edwards' addEvent library for many of the ideas.
  4042. */
  4043. jQuery.event = {
  4044. global: {},
  4045. add: function( elem, types, handler, data, selector ) {
  4046. var handleObjIn, eventHandle, tmp,
  4047. events, t, handleObj,
  4048. special, handlers, type, namespaces, origType,
  4049. elemData = dataPriv.get( elem );
  4050. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  4051. if ( !elemData ) {
  4052. return;
  4053. }
  4054. // Caller can pass in an object of custom data in lieu of the handler
  4055. if ( handler.handler ) {
  4056. handleObjIn = handler;
  4057. handler = handleObjIn.handler;
  4058. selector = handleObjIn.selector;
  4059. }
  4060. // Ensure that invalid selectors throw exceptions at attach time
  4061. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  4062. if ( selector ) {
  4063. jQuery.find.matchesSelector( documentElement, selector );
  4064. }
  4065. // Make sure that the handler has a unique ID, used to find/remove it later
  4066. if ( !handler.guid ) {
  4067. handler.guid = jQuery.guid++;
  4068. }
  4069. // Init the element's event structure and main handler, if this is the first
  4070. if ( !( events = elemData.events ) ) {
  4071. events = elemData.events = {};
  4072. }
  4073. if ( !( eventHandle = elemData.handle ) ) {
  4074. eventHandle = elemData.handle = function( e ) {
  4075. // Discard the second event of a jQuery.event.trigger() and
  4076. // when an event is called after a page has unloaded
  4077. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  4078. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  4079. };
  4080. }
  4081. // Handle multiple events separated by a space
  4082. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  4083. t = types.length;
  4084. while ( t-- ) {
  4085. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4086. type = origType = tmp[ 1 ];
  4087. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4088. // There *must* be a type, no attaching namespace-only handlers
  4089. if ( !type ) {
  4090. continue;
  4091. }
  4092. // If event changes its type, use the special event handlers for the changed type
  4093. special = jQuery.event.special[ type ] || {};
  4094. // If selector defined, determine special event api type, otherwise given type
  4095. type = ( selector ? special.delegateType : special.bindType ) || type;
  4096. // Update special based on newly reset type
  4097. special = jQuery.event.special[ type ] || {};
  4098. // handleObj is passed to all event handlers
  4099. handleObj = jQuery.extend( {
  4100. type: type,
  4101. origType: origType,
  4102. data: data,
  4103. handler: handler,
  4104. guid: handler.guid,
  4105. selector: selector,
  4106. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  4107. namespace: namespaces.join( "." )
  4108. }, handleObjIn );
  4109. // Init the event handler queue if we're the first
  4110. if ( !( handlers = events[ type ] ) ) {
  4111. handlers = events[ type ] = [];
  4112. handlers.delegateCount = 0;
  4113. // Only use addEventListener if the special events handler returns false
  4114. if ( !special.setup ||
  4115. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  4116. if ( elem.addEventListener ) {
  4117. elem.addEventListener( type, eventHandle );
  4118. }
  4119. }
  4120. }
  4121. if ( special.add ) {
  4122. special.add.call( elem, handleObj );
  4123. if ( !handleObj.handler.guid ) {
  4124. handleObj.handler.guid = handler.guid;
  4125. }
  4126. }
  4127. // Add to the element's handler list, delegates in front
  4128. if ( selector ) {
  4129. handlers.splice( handlers.delegateCount++, 0, handleObj );
  4130. } else {
  4131. handlers.push( handleObj );
  4132. }
  4133. // Keep track of which events have ever been used, for event optimization
  4134. jQuery.event.global[ type ] = true;
  4135. }
  4136. },
  4137. // Detach an event or set of events from an element
  4138. remove: function( elem, types, handler, selector, mappedTypes ) {
  4139. var j, origCount, tmp,
  4140. events, t, handleObj,
  4141. special, handlers, type, namespaces, origType,
  4142. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  4143. if ( !elemData || !( events = elemData.events ) ) {
  4144. return;
  4145. }
  4146. // Once for each type.namespace in types; type may be omitted
  4147. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  4148. t = types.length;
  4149. while ( t-- ) {
  4150. tmp = rtypenamespace.exec( types[ t ] ) || [];
  4151. type = origType = tmp[ 1 ];
  4152. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  4153. // Unbind all events (on this namespace, if provided) for the element
  4154. if ( !type ) {
  4155. for ( type in events ) {
  4156. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  4157. }
  4158. continue;
  4159. }
  4160. special = jQuery.event.special[ type ] || {};
  4161. type = ( selector ? special.delegateType : special.bindType ) || type;
  4162. handlers = events[ type ] || [];
  4163. tmp = tmp[ 2 ] &&
  4164. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  4165. // Remove matching events
  4166. origCount = j = handlers.length;
  4167. while ( j-- ) {
  4168. handleObj = handlers[ j ];
  4169. if ( ( mappedTypes || origType === handleObj.origType ) &&
  4170. ( !handler || handler.guid === handleObj.guid ) &&
  4171. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  4172. ( !selector || selector === handleObj.selector ||
  4173. selector === "**" && handleObj.selector ) ) {
  4174. handlers.splice( j, 1 );
  4175. if ( handleObj.selector ) {
  4176. handlers.delegateCount--;
  4177. }
  4178. if ( special.remove ) {
  4179. special.remove.call( elem, handleObj );
  4180. }
  4181. }
  4182. }
  4183. // Remove generic event handler if we removed something and no more handlers exist
  4184. // (avoids potential for endless recursion during removal of special event handlers)
  4185. if ( origCount && !handlers.length ) {
  4186. if ( !special.teardown ||
  4187. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  4188. jQuery.removeEvent( elem, type, elemData.handle );
  4189. }
  4190. delete events[ type ];
  4191. }
  4192. }
  4193. // Remove data and the expando if it's no longer used
  4194. if ( jQuery.isEmptyObject( events ) ) {
  4195. dataPriv.remove( elem, "handle events" );
  4196. }
  4197. },
  4198. dispatch: function( nativeEvent ) {
  4199. // Make a writable jQuery.Event from the native event object
  4200. var event = jQuery.event.fix( nativeEvent );
  4201. var i, j, ret, matched, handleObj, handlerQueue,
  4202. args = new Array( arguments.length ),
  4203. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  4204. special = jQuery.event.special[ event.type ] || {};
  4205. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  4206. args[ 0 ] = event;
  4207. for ( i = 1; i < arguments.length; i++ ) {
  4208. args[ i ] = arguments[ i ];
  4209. }
  4210. event.delegateTarget = this;
  4211. // Call the preDispatch hook for the mapped type, and let it bail if desired
  4212. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  4213. return;
  4214. }
  4215. // Determine handlers
  4216. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  4217. // Run delegates first; they may want to stop propagation beneath us
  4218. i = 0;
  4219. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  4220. event.currentTarget = matched.elem;
  4221. j = 0;
  4222. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  4223. !event.isImmediatePropagationStopped() ) {
  4224. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  4225. // a subset or equal to those in the bound event (both can have no namespace).
  4226. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  4227. event.handleObj = handleObj;
  4228. event.data = handleObj.data;
  4229. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  4230. handleObj.handler ).apply( matched.elem, args );
  4231. if ( ret !== undefined ) {
  4232. if ( ( event.result = ret ) === false ) {
  4233. event.preventDefault();
  4234. event.stopPropagation();
  4235. }
  4236. }
  4237. }
  4238. }
  4239. }
  4240. // Call the postDispatch hook for the mapped type
  4241. if ( special.postDispatch ) {
  4242. special.postDispatch.call( this, event );
  4243. }
  4244. return event.result;
  4245. },
  4246. handlers: function( event, handlers ) {
  4247. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  4248. handlerQueue = [],
  4249. delegateCount = handlers.delegateCount,
  4250. cur = event.target;
  4251. // Find delegate handlers
  4252. if ( delegateCount &&
  4253. // Support: IE <=9
  4254. // Black-hole SVG <use> instance trees (trac-13180)
  4255. cur.nodeType &&
  4256. // Support: Firefox <=42
  4257. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  4258. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  4259. // Support: IE 11 only
  4260. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  4261. !( event.type === "click" && event.button >= 1 ) ) {
  4262. for ( ; cur !== this; cur = cur.parentNode || this ) {
  4263. // Don't check non-elements (#13208)
  4264. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  4265. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  4266. matchedHandlers = [];
  4267. matchedSelectors = {};
  4268. for ( i = 0; i < delegateCount; i++ ) {
  4269. handleObj = handlers[ i ];
  4270. // Don't conflict with Object.prototype properties (#13203)
  4271. sel = handleObj.selector + " ";
  4272. if ( matchedSelectors[ sel ] === undefined ) {
  4273. matchedSelectors[ sel ] = handleObj.needsContext ?
  4274. jQuery( sel, this ).index( cur ) > -1 :
  4275. jQuery.find( sel, this, null, [ cur ] ).length;
  4276. }
  4277. if ( matchedSelectors[ sel ] ) {
  4278. matchedHandlers.push( handleObj );
  4279. }
  4280. }
  4281. if ( matchedHandlers.length ) {
  4282. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  4283. }
  4284. }
  4285. }
  4286. }
  4287. // Add the remaining (directly-bound) handlers
  4288. cur = this;
  4289. if ( delegateCount < handlers.length ) {
  4290. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  4291. }
  4292. return handlerQueue;
  4293. },
  4294. addProp: function( name, hook ) {
  4295. Object.defineProperty( jQuery.Event.prototype, name, {
  4296. enumerable: true,
  4297. configurable: true,
  4298. get: isFunction( hook ) ?
  4299. function() {
  4300. if ( this.originalEvent ) {
  4301. return hook( this.originalEvent );
  4302. }
  4303. } :
  4304. function() {
  4305. if ( this.originalEvent ) {
  4306. return this.originalEvent[ name ];
  4307. }
  4308. },
  4309. set: function( value ) {
  4310. Object.defineProperty( this, name, {
  4311. enumerable: true,
  4312. configurable: true,
  4313. writable: true,
  4314. value: value
  4315. } );
  4316. }
  4317. } );
  4318. },
  4319. fix: function( originalEvent ) {
  4320. return originalEvent[ jQuery.expando ] ?
  4321. originalEvent :
  4322. new jQuery.Event( originalEvent );
  4323. },
  4324. special: {
  4325. load: {
  4326. // Prevent triggered image.load events from bubbling to window.load
  4327. noBubble: true
  4328. },
  4329. focus: {
  4330. // Fire native event if possible so blur/focus sequence is correct
  4331. trigger: function() {
  4332. if ( this !== safeActiveElement() && this.focus ) {
  4333. this.focus();
  4334. return false;
  4335. }
  4336. },
  4337. delegateType: "focusin"
  4338. },
  4339. blur: {
  4340. trigger: function() {
  4341. if ( this === safeActiveElement() && this.blur ) {
  4342. this.blur();
  4343. return false;
  4344. }
  4345. },
  4346. delegateType: "focusout"
  4347. },
  4348. click: {
  4349. // For checkbox, fire native event so checked state will be right
  4350. trigger: function() {
  4351. if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
  4352. this.click();
  4353. return false;
  4354. }
  4355. },
  4356. // For cross-browser consistency, don't fire native .click() on links
  4357. _default: function( event ) {
  4358. return nodeName( event.target, "a" );
  4359. }
  4360. },
  4361. beforeunload: {
  4362. postDispatch: function( event ) {
  4363. // Support: Firefox 20+
  4364. // Firefox doesn't alert if the returnValue field is not set.
  4365. if ( event.result !== undefined && event.originalEvent ) {
  4366. event.originalEvent.returnValue = event.result;
  4367. }
  4368. }
  4369. }
  4370. }
  4371. };
  4372. jQuery.removeEvent = function( elem, type, handle ) {
  4373. // This "if" is needed for plain objects
  4374. if ( elem.removeEventListener ) {
  4375. elem.removeEventListener( type, handle );
  4376. }
  4377. };
  4378. jQuery.Event = function( src, props ) {
  4379. // Allow instantiation without the 'new' keyword
  4380. if ( !( this instanceof jQuery.Event ) ) {
  4381. return new jQuery.Event( src, props );
  4382. }
  4383. // Event object
  4384. if ( src && src.type ) {
  4385. this.originalEvent = src;
  4386. this.type = src.type;
  4387. // Events bubbling up the document may have been marked as prevented
  4388. // by a handler lower down the tree; reflect the correct value.
  4389. this.isDefaultPrevented = src.defaultPrevented ||
  4390. src.defaultPrevented === undefined &&
  4391. // Support: Android <=2.3 only
  4392. src.returnValue === false ?
  4393. returnTrue :
  4394. returnFalse;
  4395. // Create target properties
  4396. // Support: Safari <=6 - 7 only
  4397. // Target should not be a text node (#504, #13143)
  4398. this.target = ( src.target && src.target.nodeType === 3 ) ?
  4399. src.target.parentNode :
  4400. src.target;
  4401. this.currentTarget = src.currentTarget;
  4402. this.relatedTarget = src.relatedTarget;
  4403. // Event type
  4404. } else {
  4405. this.type = src;
  4406. }
  4407. // Put explicitly provided properties onto the event object
  4408. if ( props ) {
  4409. jQuery.extend( this, props );
  4410. }
  4411. // Create a timestamp if incoming event doesn't have one
  4412. this.timeStamp = src && src.timeStamp || Date.now();
  4413. // Mark it as fixed
  4414. this[ jQuery.expando ] = true;
  4415. };
  4416. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  4417. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  4418. jQuery.Event.prototype = {
  4419. constructor: jQuery.Event,
  4420. isDefaultPrevented: returnFalse,
  4421. isPropagationStopped: returnFalse,
  4422. isImmediatePropagationStopped: returnFalse,
  4423. isSimulated: false,
  4424. preventDefault: function() {
  4425. var e = this.originalEvent;
  4426. this.isDefaultPrevented = returnTrue;
  4427. if ( e && !this.isSimulated ) {
  4428. e.preventDefault();
  4429. }
  4430. },
  4431. stopPropagation: function() {
  4432. var e = this.originalEvent;
  4433. this.isPropagationStopped = returnTrue;
  4434. if ( e && !this.isSimulated ) {
  4435. e.stopPropagation();
  4436. }
  4437. },
  4438. stopImmediatePropagation: function() {
  4439. var e = this.originalEvent;
  4440. this.isImmediatePropagationStopped = returnTrue;
  4441. if ( e && !this.isSimulated ) {
  4442. e.stopImmediatePropagation();
  4443. }
  4444. this.stopPropagation();
  4445. }
  4446. };
  4447. // Includes all common event props including KeyEvent and MouseEvent specific props
  4448. jQuery.each( {
  4449. altKey: true,
  4450. bubbles: true,
  4451. cancelable: true,
  4452. changedTouches: true,
  4453. ctrlKey: true,
  4454. detail: true,
  4455. eventPhase: true,
  4456. metaKey: true,
  4457. pageX: true,
  4458. pageY: true,
  4459. shiftKey: true,
  4460. view: true,
  4461. "char": true,
  4462. charCode: true,
  4463. key: true,
  4464. keyCode: true,
  4465. button: true,
  4466. buttons: true,
  4467. clientX: true,
  4468. clientY: true,
  4469. offsetX: true,
  4470. offsetY: true,
  4471. pointerId: true,
  4472. pointerType: true,
  4473. screenX: true,
  4474. screenY: true,
  4475. targetTouches: true,
  4476. toElement: true,
  4477. touches: true,
  4478. which: function( event ) {
  4479. var button = event.button;
  4480. // Add which for key events
  4481. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  4482. return event.charCode != null ? event.charCode : event.keyCode;
  4483. }
  4484. // Add which for click: 1 === left; 2 === middle; 3 === right
  4485. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  4486. if ( button & 1 ) {
  4487. return 1;
  4488. }
  4489. if ( button & 2 ) {
  4490. return 3;
  4491. }
  4492. if ( button & 4 ) {
  4493. return 2;
  4494. }
  4495. return 0;
  4496. }
  4497. return event.which;
  4498. }
  4499. }, jQuery.event.addProp );
  4500. // Create mouseenter/leave events using mouseover/out and event-time checks
  4501. // so that event delegation works in jQuery.
  4502. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  4503. //
  4504. // Support: Safari 7 only
  4505. // Safari sends mouseenter too often; see:
  4506. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  4507. // for the description of the bug (it existed in older Chrome versions as well).
  4508. jQuery.each( {
  4509. mouseenter: "mouseover",
  4510. mouseleave: "mouseout",
  4511. pointerenter: "pointerover",
  4512. pointerleave: "pointerout"
  4513. }, function( orig, fix ) {
  4514. jQuery.event.special[ orig ] = {
  4515. delegateType: fix,
  4516. bindType: fix,
  4517. handle: function( event ) {
  4518. var ret,
  4519. target = this,
  4520. related = event.relatedTarget,
  4521. handleObj = event.handleObj;
  4522. // For mouseenter/leave call the handler if related is outside the target.
  4523. // NB: No relatedTarget if the mouse left/entered the browser window
  4524. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  4525. event.type = handleObj.origType;
  4526. ret = handleObj.handler.apply( this, arguments );
  4527. event.type = fix;
  4528. }
  4529. return ret;
  4530. }
  4531. };
  4532. } );
  4533. jQuery.fn.extend( {
  4534. on: function( types, selector, data, fn ) {
  4535. return on( this, types, selector, data, fn );
  4536. },
  4537. one: function( types, selector, data, fn ) {
  4538. return on( this, types, selector, data, fn, 1 );
  4539. },
  4540. off: function( types, selector, fn ) {
  4541. var handleObj, type;
  4542. if ( types && types.preventDefault && types.handleObj ) {
  4543. // ( event ) dispatched jQuery.Event
  4544. handleObj = types.handleObj;
  4545. jQuery( types.delegateTarget ).off(
  4546. handleObj.namespace ?
  4547. handleObj.origType + "." + handleObj.namespace :
  4548. handleObj.origType,
  4549. handleObj.selector,
  4550. handleObj.handler
  4551. );
  4552. return this;
  4553. }
  4554. if ( typeof types === "object" ) {
  4555. // ( types-object [, selector] )
  4556. for ( type in types ) {
  4557. this.off( type, selector, types[ type ] );
  4558. }
  4559. return this;
  4560. }
  4561. if ( selector === false || typeof selector === "function" ) {
  4562. // ( types [, fn] )
  4563. fn = selector;
  4564. selector = undefined;
  4565. }
  4566. if ( fn === false ) {
  4567. fn = returnFalse;
  4568. }
  4569. return this.each( function() {
  4570. jQuery.event.remove( this, types, fn, selector );
  4571. } );
  4572. }
  4573. } );
  4574. var
  4575. /* eslint-disable max-len */
  4576. // See https://github.com/eslint/eslint/issues/3229
  4577. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  4578. /* eslint-enable */
  4579. // Support: IE <=10 - 11, Edge 12 - 13 only
  4580. // In IE/Edge using regex groups here causes severe slowdowns.
  4581. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  4582. rnoInnerhtml = /<script|<style|<link/i,
  4583. // checked="checked" or checked
  4584. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  4585. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  4586. // Prefer a tbody over its parent table for containing new rows
  4587. function manipulationTarget( elem, content ) {
  4588. if ( nodeName( elem, "table" ) &&
  4589. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  4590. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  4591. }
  4592. return elem;
  4593. }
  4594. // Replace/restore the type attribute of script elements for safe DOM manipulation
  4595. function disableScript( elem ) {
  4596. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  4597. return elem;
  4598. }
  4599. function restoreScript( elem ) {
  4600. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  4601. elem.type = elem.type.slice( 5 );
  4602. } else {
  4603. elem.removeAttribute( "type" );
  4604. }
  4605. return elem;
  4606. }
  4607. function cloneCopyEvent( src, dest ) {
  4608. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  4609. if ( dest.nodeType !== 1 ) {
  4610. return;
  4611. }
  4612. // 1. Copy private data: events, handlers, etc.
  4613. if ( dataPriv.hasData( src ) ) {
  4614. pdataOld = dataPriv.access( src );
  4615. pdataCur = dataPriv.set( dest, pdataOld );
  4616. events = pdataOld.events;
  4617. if ( events ) {
  4618. delete pdataCur.handle;
  4619. pdataCur.events = {};
  4620. for ( type in events ) {
  4621. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  4622. jQuery.event.add( dest, type, events[ type ][ i ] );
  4623. }
  4624. }
  4625. }
  4626. }
  4627. // 2. Copy user data
  4628. if ( dataUser.hasData( src ) ) {
  4629. udataOld = dataUser.access( src );
  4630. udataCur = jQuery.extend( {}, udataOld );
  4631. dataUser.set( dest, udataCur );
  4632. }
  4633. }
  4634. // Fix IE bugs, see support tests
  4635. function fixInput( src, dest ) {
  4636. var nodeName = dest.nodeName.toLowerCase();
  4637. // Fails to persist the checked state of a cloned checkbox or radio button.
  4638. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  4639. dest.checked = src.checked;
  4640. // Fails to return the selected option to the default selected state when cloning options
  4641. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  4642. dest.defaultValue = src.defaultValue;
  4643. }
  4644. }
  4645. function domManip( collection, args, callback, ignored ) {
  4646. // Flatten any nested arrays
  4647. args = concat.apply( [], args );
  4648. var fragment, first, scripts, hasScripts, node, doc,
  4649. i = 0,
  4650. l = collection.length,
  4651. iNoClone = l - 1,
  4652. value = args[ 0 ],
  4653. valueIsFunction = isFunction( value );
  4654. // We can't cloneNode fragments that contain checked, in WebKit
  4655. if ( valueIsFunction ||
  4656. ( l > 1 && typeof value === "string" &&
  4657. !support.checkClone && rchecked.test( value ) ) ) {
  4658. return collection.each( function( index ) {
  4659. var self = collection.eq( index );
  4660. if ( valueIsFunction ) {
  4661. args[ 0 ] = value.call( this, index, self.html() );
  4662. }
  4663. domManip( self, args, callback, ignored );
  4664. } );
  4665. }
  4666. if ( l ) {
  4667. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  4668. first = fragment.firstChild;
  4669. if ( fragment.childNodes.length === 1 ) {
  4670. fragment = first;
  4671. }
  4672. // Require either new content or an interest in ignored elements to invoke the callback
  4673. if ( first || ignored ) {
  4674. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  4675. hasScripts = scripts.length;
  4676. // Use the original fragment for the last item
  4677. // instead of the first because it can end up
  4678. // being emptied incorrectly in certain situations (#8070).
  4679. for ( ; i < l; i++ ) {
  4680. node = fragment;
  4681. if ( i !== iNoClone ) {
  4682. node = jQuery.clone( node, true, true );
  4683. // Keep references to cloned scripts for later restoration
  4684. if ( hasScripts ) {
  4685. // Support: Android <=4.0 only, PhantomJS 1 only
  4686. // push.apply(_, arraylike) throws on ancient WebKit
  4687. jQuery.merge( scripts, getAll( node, "script" ) );
  4688. }
  4689. }
  4690. callback.call( collection[ i ], node, i );
  4691. }
  4692. if ( hasScripts ) {
  4693. doc = scripts[ scripts.length - 1 ].ownerDocument;
  4694. // Reenable scripts
  4695. jQuery.map( scripts, restoreScript );
  4696. // Evaluate executable scripts on first document insertion
  4697. for ( i = 0; i < hasScripts; i++ ) {
  4698. node = scripts[ i ];
  4699. if ( rscriptType.test( node.type || "" ) &&
  4700. !dataPriv.access( node, "globalEval" ) &&
  4701. jQuery.contains( doc, node ) ) {
  4702. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  4703. // Optional AJAX dependency, but won't run scripts if not present
  4704. if ( jQuery._evalUrl ) {
  4705. jQuery._evalUrl( node.src );
  4706. }
  4707. } else {
  4708. DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node );
  4709. }
  4710. }
  4711. }
  4712. }
  4713. }
  4714. }
  4715. return collection;
  4716. }
  4717. function remove( elem, selector, keepData ) {
  4718. var node,
  4719. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  4720. i = 0;
  4721. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  4722. if ( !keepData && node.nodeType === 1 ) {
  4723. jQuery.cleanData( getAll( node ) );
  4724. }
  4725. if ( node.parentNode ) {
  4726. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  4727. setGlobalEval( getAll( node, "script" ) );
  4728. }
  4729. node.parentNode.removeChild( node );
  4730. }
  4731. }
  4732. return elem;
  4733. }
  4734. jQuery.extend( {
  4735. htmlPrefilter: function( html ) {
  4736. return html.replace( rxhtmlTag, "<$1></$2>" );
  4737. },
  4738. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  4739. var i, l, srcElements, destElements,
  4740. clone = elem.cloneNode( true ),
  4741. inPage = jQuery.contains( elem.ownerDocument, elem );
  4742. // Fix IE cloning issues
  4743. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  4744. !jQuery.isXMLDoc( elem ) ) {
  4745. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  4746. destElements = getAll( clone );
  4747. srcElements = getAll( elem );
  4748. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  4749. fixInput( srcElements[ i ], destElements[ i ] );
  4750. }
  4751. }
  4752. // Copy the events from the original to the clone
  4753. if ( dataAndEvents ) {
  4754. if ( deepDataAndEvents ) {
  4755. srcElements = srcElements || getAll( elem );
  4756. destElements = destElements || getAll( clone );
  4757. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  4758. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  4759. }
  4760. } else {
  4761. cloneCopyEvent( elem, clone );
  4762. }
  4763. }
  4764. // Preserve script evaluation history
  4765. destElements = getAll( clone, "script" );
  4766. if ( destElements.length > 0 ) {
  4767. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  4768. }
  4769. // Return the cloned set
  4770. return clone;
  4771. },
  4772. cleanData: function( elems ) {
  4773. var data, elem, type,
  4774. special = jQuery.event.special,
  4775. i = 0;
  4776. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  4777. if ( acceptData( elem ) ) {
  4778. if ( ( data = elem[ dataPriv.expando ] ) ) {
  4779. if ( data.events ) {
  4780. for ( type in data.events ) {
  4781. if ( special[ type ] ) {
  4782. jQuery.event.remove( elem, type );
  4783. // This is a shortcut to avoid jQuery.event.remove's overhead
  4784. } else {
  4785. jQuery.removeEvent( elem, type, data.handle );
  4786. }
  4787. }
  4788. }
  4789. // Support: Chrome <=35 - 45+
  4790. // Assign undefined instead of using delete, see Data#remove
  4791. elem[ dataPriv.expando ] = undefined;
  4792. }
  4793. if ( elem[ dataUser.expando ] ) {
  4794. // Support: Chrome <=35 - 45+
  4795. // Assign undefined instead of using delete, see Data#remove
  4796. elem[ dataUser.expando ] = undefined;
  4797. }
  4798. }
  4799. }
  4800. }
  4801. } );
  4802. jQuery.fn.extend( {
  4803. detach: function( selector ) {
  4804. return remove( this, selector, true );
  4805. },
  4806. remove: function( selector ) {
  4807. return remove( this, selector );
  4808. },
  4809. text: function( value ) {
  4810. return access( this, function( value ) {
  4811. return value === undefined ?
  4812. jQuery.text( this ) :
  4813. this.empty().each( function() {
  4814. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  4815. this.textContent = value;
  4816. }
  4817. } );
  4818. }, null, value, arguments.length );
  4819. },
  4820. append: function() {
  4821. return domManip( this, arguments, function( elem ) {
  4822. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  4823. var target = manipulationTarget( this, elem );
  4824. target.appendChild( elem );
  4825. }
  4826. } );
  4827. },
  4828. prepend: function() {
  4829. return domManip( this, arguments, function( elem ) {
  4830. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  4831. var target = manipulationTarget( this, elem );
  4832. target.insertBefore( elem, target.firstChild );
  4833. }
  4834. } );
  4835. },
  4836. before: function() {
  4837. return domManip( this, arguments, function( elem ) {
  4838. if ( this.parentNode ) {
  4839. this.parentNode.insertBefore( elem, this );
  4840. }
  4841. } );
  4842. },
  4843. after: function() {
  4844. return domManip( this, arguments, function( elem ) {
  4845. if ( this.parentNode ) {
  4846. this.parentNode.insertBefore( elem, this.nextSibling );
  4847. }
  4848. } );
  4849. },
  4850. empty: function() {
  4851. var elem,
  4852. i = 0;
  4853. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  4854. if ( elem.nodeType === 1 ) {
  4855. // Prevent memory leaks
  4856. jQuery.cleanData( getAll( elem, false ) );
  4857. // Remove any remaining nodes
  4858. elem.textContent = "";
  4859. }
  4860. }
  4861. return this;
  4862. },
  4863. clone: function( dataAndEvents, deepDataAndEvents ) {
  4864. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  4865. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  4866. return this.map( function() {
  4867. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  4868. } );
  4869. },
  4870. html: function( value ) {
  4871. return access( this, function( value ) {
  4872. var elem = this[ 0 ] || {},
  4873. i = 0,
  4874. l = this.length;
  4875. if ( value === undefined && elem.nodeType === 1 ) {
  4876. return elem.innerHTML;
  4877. }
  4878. // See if we can take a shortcut and just use innerHTML
  4879. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  4880. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  4881. value = jQuery.htmlPrefilter( value );
  4882. try {
  4883. for ( ; i < l; i++ ) {
  4884. elem = this[ i ] || {};
  4885. // Remove element nodes and prevent memory leaks
  4886. if ( elem.nodeType === 1 ) {
  4887. jQuery.cleanData( getAll( elem, false ) );
  4888. elem.innerHTML = value;
  4889. }
  4890. }
  4891. elem = 0;
  4892. // If using innerHTML throws an exception, use the fallback method
  4893. } catch ( e ) {}
  4894. }
  4895. if ( elem ) {
  4896. this.empty().append( value );
  4897. }
  4898. }, null, value, arguments.length );
  4899. },
  4900. replaceWith: function() {
  4901. var ignored = [];
  4902. // Make the changes, replacing each non-ignored context element with the new content
  4903. return domManip( this, arguments, function( elem ) {
  4904. var parent = this.parentNode;
  4905. if ( jQuery.inArray( this, ignored ) < 0 ) {
  4906. jQuery.cleanData( getAll( this ) );
  4907. if ( parent ) {
  4908. parent.replaceChild( elem, this );
  4909. }
  4910. }
  4911. // Force callback invocation
  4912. }, ignored );
  4913. }
  4914. } );
  4915. jQuery.each( {
  4916. appendTo: "append",
  4917. prependTo: "prepend",
  4918. insertBefore: "before",
  4919. insertAfter: "after",
  4920. replaceAll: "replaceWith"
  4921. }, function( name, original ) {
  4922. jQuery.fn[ name ] = function( selector ) {
  4923. var elems,
  4924. ret = [],
  4925. insert = jQuery( selector ),
  4926. last = insert.length - 1,
  4927. i = 0;
  4928. for ( ; i <= last; i++ ) {
  4929. elems = i === last ? this : this.clone( true );
  4930. jQuery( insert[ i ] )[ original ]( elems );
  4931. // Support: Android <=4.0 only, PhantomJS 1 only
  4932. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  4933. push.apply( ret, elems.get() );
  4934. }
  4935. return this.pushStack( ret );
  4936. };
  4937. } );
  4938. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  4939. var getStyles = function( elem ) {
  4940. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  4941. // IE throws on elements created in popups
  4942. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  4943. var view = elem.ownerDocument.defaultView;
  4944. if ( !view || !view.opener ) {
  4945. view = window;
  4946. }
  4947. return view.getComputedStyle( elem );
  4948. };
  4949. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  4950. ( function() {
  4951. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  4952. // so they're executed at the same time to save the second computation.
  4953. function computeStyleTests() {
  4954. // This is a singleton, we need to execute it only once
  4955. if ( !div ) {
  4956. return;
  4957. }
  4958. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  4959. "margin-top:1px;padding:0;border:0";
  4960. div.style.cssText =
  4961. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  4962. "margin:auto;border:1px;padding:1px;" +
  4963. "width:60%;top:1%";
  4964. documentElement.appendChild( container ).appendChild( div );
  4965. var divStyle = window.getComputedStyle( div );
  4966. pixelPositionVal = divStyle.top !== "1%";
  4967. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  4968. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  4969. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  4970. // Some styles come back with percentage values, even though they shouldn't
  4971. div.style.right = "60%";
  4972. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  4973. // Support: IE 9 - 11 only
  4974. // Detect misreporting of content dimensions for box-sizing:border-box elements
  4975. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  4976. // Support: IE 9 only
  4977. // Detect overflow:scroll screwiness (gh-3699)
  4978. div.style.position = "absolute";
  4979. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  4980. documentElement.removeChild( container );
  4981. // Nullify the div so it wouldn't be stored in the memory and
  4982. // it will also be a sign that checks already performed
  4983. div = null;
  4984. }
  4985. function roundPixelMeasures( measure ) {
  4986. return Math.round( parseFloat( measure ) );
  4987. }
  4988. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  4989. reliableMarginLeftVal,
  4990. container = document.createElement( "div" ),
  4991. div = document.createElement( "div" );
  4992. // Finish early in limited (non-browser) environments
  4993. if ( !div.style ) {
  4994. return;
  4995. }
  4996. // Support: IE <=9 - 11 only
  4997. // Style of cloned element affects source element cloned (#8908)
  4998. div.style.backgroundClip = "content-box";
  4999. div.cloneNode( true ).style.backgroundClip = "";
  5000. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  5001. jQuery.extend( support, {
  5002. boxSizingReliable: function() {
  5003. computeStyleTests();
  5004. return boxSizingReliableVal;
  5005. },
  5006. pixelBoxStyles: function() {
  5007. computeStyleTests();
  5008. return pixelBoxStylesVal;
  5009. },
  5010. pixelPosition: function() {
  5011. computeStyleTests();
  5012. return pixelPositionVal;
  5013. },
  5014. reliableMarginLeft: function() {
  5015. computeStyleTests();
  5016. return reliableMarginLeftVal;
  5017. },
  5018. scrollboxSize: function() {
  5019. computeStyleTests();
  5020. return scrollboxSizeVal;
  5021. }
  5022. } );
  5023. } )();
  5024. function curCSS( elem, name, computed ) {
  5025. var width, minWidth, maxWidth, ret,
  5026. // Support: Firefox 51+
  5027. // Retrieving style before computed somehow
  5028. // fixes an issue with getting wrong values
  5029. // on detached elements
  5030. style = elem.style;
  5031. computed = computed || getStyles( elem );
  5032. // getPropertyValue is needed for:
  5033. // .css('filter') (IE 9 only, #12537)
  5034. // .css('--customProperty) (#3144)
  5035. if ( computed ) {
  5036. ret = computed.getPropertyValue( name ) || computed[ name ];
  5037. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  5038. ret = jQuery.style( elem, name );
  5039. }
  5040. // A tribute to the "awesome hack by Dean Edwards"
  5041. // Android Browser returns percentage for some values,
  5042. // but width seems to be reliably pixels.
  5043. // This is against the CSSOM draft spec:
  5044. // https://drafts.csswg.org/cssom/#resolved-values
  5045. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  5046. // Remember the original values
  5047. width = style.width;
  5048. minWidth = style.minWidth;
  5049. maxWidth = style.maxWidth;
  5050. // Put in the new values to get a computed value out
  5051. style.minWidth = style.maxWidth = style.width = ret;
  5052. ret = computed.width;
  5053. // Revert the changed values
  5054. style.width = width;
  5055. style.minWidth = minWidth;
  5056. style.maxWidth = maxWidth;
  5057. }
  5058. }
  5059. return ret !== undefined ?
  5060. // Support: IE <=9 - 11 only
  5061. // IE returns zIndex value as an integer.
  5062. ret + "" :
  5063. ret;
  5064. }
  5065. function addGetHookIf( conditionFn, hookFn ) {
  5066. // Define the hook, we'll check on the first run if it's really needed.
  5067. return {
  5068. get: function() {
  5069. if ( conditionFn() ) {
  5070. // Hook not needed (or it's not possible to use it due
  5071. // to missing dependency), remove it.
  5072. delete this.get;
  5073. return;
  5074. }
  5075. // Hook needed; redefine it so that the support test is not executed again.
  5076. return ( this.get = hookFn ).apply( this, arguments );
  5077. }
  5078. };
  5079. }
  5080. var
  5081. // Swappable if display is none or starts with table
  5082. // except "table", "table-cell", or "table-caption"
  5083. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  5084. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  5085. rcustomProp = /^--/,
  5086. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  5087. cssNormalTransform = {
  5088. letterSpacing: "0",
  5089. fontWeight: "400"
  5090. },
  5091. cssPrefixes = [ "Webkit", "Moz", "ms" ],
  5092. emptyStyle = document.createElement( "div" ).style;
  5093. // Return a css property mapped to a potentially vendor prefixed property
  5094. function vendorPropName( name ) {
  5095. // Shortcut for names that are not vendor prefixed
  5096. if ( name in emptyStyle ) {
  5097. return name;
  5098. }
  5099. // Check for vendor prefixed names
  5100. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  5101. i = cssPrefixes.length;
  5102. while ( i-- ) {
  5103. name = cssPrefixes[ i ] + capName;
  5104. if ( name in emptyStyle ) {
  5105. return name;
  5106. }
  5107. }
  5108. }
  5109. // Return a property mapped along what jQuery.cssProps suggests or to
  5110. // a vendor prefixed property.
  5111. function finalPropName( name ) {
  5112. var ret = jQuery.cssProps[ name ];
  5113. if ( !ret ) {
  5114. ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
  5115. }
  5116. return ret;
  5117. }
  5118. function setPositiveNumber( elem, value, subtract ) {
  5119. // Any relative (+/-) values have already been
  5120. // normalized at this point
  5121. var matches = rcssNum.exec( value );
  5122. return matches ?
  5123. // Guard against undefined "subtract", e.g., when used as in cssHooks
  5124. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  5125. value;
  5126. }
  5127. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  5128. var i = dimension === "width" ? 1 : 0,
  5129. extra = 0,
  5130. delta = 0;
  5131. // Adjustment may not be necessary
  5132. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  5133. return 0;
  5134. }
  5135. for ( ; i < 4; i += 2 ) {
  5136. // Both box models exclude margin
  5137. if ( box === "margin" ) {
  5138. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  5139. }
  5140. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  5141. if ( !isBorderBox ) {
  5142. // Add padding
  5143. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5144. // For "border" or "margin", add border
  5145. if ( box !== "padding" ) {
  5146. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5147. // But still keep track of it otherwise
  5148. } else {
  5149. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5150. }
  5151. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  5152. // "padding" or "margin"
  5153. } else {
  5154. // For "content", subtract padding
  5155. if ( box === "content" ) {
  5156. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  5157. }
  5158. // For "content" or "padding", subtract border
  5159. if ( box !== "margin" ) {
  5160. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  5161. }
  5162. }
  5163. }
  5164. // Account for positive content-box scroll gutter when requested by providing computedVal
  5165. if ( !isBorderBox && computedVal >= 0 ) {
  5166. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  5167. // Assuming integer scroll gutter, subtract the rest and round down
  5168. delta += Math.max( 0, Math.ceil(
  5169. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  5170. computedVal -
  5171. delta -
  5172. extra -
  5173. 0.5
  5174. ) );
  5175. }
  5176. return delta;
  5177. }
  5178. function getWidthOrHeight( elem, dimension, extra ) {
  5179. // Start with computed style
  5180. var styles = getStyles( elem ),
  5181. val = curCSS( elem, dimension, styles ),
  5182. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  5183. valueIsBorderBox = isBorderBox;
  5184. // Support: Firefox <=54
  5185. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  5186. if ( rnumnonpx.test( val ) ) {
  5187. if ( !extra ) {
  5188. return val;
  5189. }
  5190. val = "auto";
  5191. }
  5192. // Check for style in case a browser which returns unreliable values
  5193. // for getComputedStyle silently falls back to the reliable elem.style
  5194. valueIsBorderBox = valueIsBorderBox &&
  5195. ( support.boxSizingReliable() || val === elem.style[ dimension ] );
  5196. // Fall back to offsetWidth/offsetHeight when value is "auto"
  5197. // This happens for inline elements with no explicit setting (gh-3571)
  5198. // Support: Android <=4.1 - 4.3 only
  5199. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  5200. if ( val === "auto" ||
  5201. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) {
  5202. val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ];
  5203. // offsetWidth/offsetHeight provide border-box values
  5204. valueIsBorderBox = true;
  5205. }
  5206. // Normalize "" and auto
  5207. val = parseFloat( val ) || 0;
  5208. // Adjust for the element's box model
  5209. return ( val +
  5210. boxModelAdjustment(
  5211. elem,
  5212. dimension,
  5213. extra || ( isBorderBox ? "border" : "content" ),
  5214. valueIsBorderBox,
  5215. styles,
  5216. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  5217. val
  5218. )
  5219. ) + "px";
  5220. }
  5221. jQuery.extend( {
  5222. // Add in style property hooks for overriding the default
  5223. // behavior of getting and setting a style property
  5224. cssHooks: {
  5225. opacity: {
  5226. get: function( elem, computed ) {
  5227. if ( computed ) {
  5228. // We should always get a number back from opacity
  5229. var ret = curCSS( elem, "opacity" );
  5230. return ret === "" ? "1" : ret;
  5231. }
  5232. }
  5233. }
  5234. },
  5235. // Don't automatically add "px" to these possibly-unitless properties
  5236. cssNumber: {
  5237. "animationIterationCount": true,
  5238. "columnCount": true,
  5239. "fillOpacity": true,
  5240. "flexGrow": true,
  5241. "flexShrink": true,
  5242. "fontWeight": true,
  5243. "lineHeight": true,
  5244. "opacity": true,
  5245. "order": true,
  5246. "orphans": true,
  5247. "widows": true,
  5248. "zIndex": true,
  5249. "zoom": true
  5250. },
  5251. // Add in properties whose names you wish to fix before
  5252. // setting or getting the value
  5253. cssProps: {},
  5254. // Get and set the style property on a DOM Node
  5255. style: function( elem, name, value, extra ) {
  5256. // Don't set styles on text and comment nodes
  5257. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  5258. return;
  5259. }
  5260. // Make sure that we're working with the right name
  5261. var ret, type, hooks,
  5262. origName = camelCase( name ),
  5263. isCustomProp = rcustomProp.test( name ),
  5264. style = elem.style;
  5265. // Make sure that we're working with the right name. We don't
  5266. // want to query the value if it is a CSS custom property
  5267. // since they are user-defined.
  5268. if ( !isCustomProp ) {
  5269. name = finalPropName( origName );
  5270. }
  5271. // Gets hook for the prefixed version, then unprefixed version
  5272. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5273. // Check if we're setting a value
  5274. if ( value !== undefined ) {
  5275. type = typeof value;
  5276. // Convert "+=" or "-=" to relative numbers (#7345)
  5277. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  5278. value = adjustCSS( elem, name, ret );
  5279. // Fixes bug #9237
  5280. type = "number";
  5281. }
  5282. // Make sure that null and NaN values aren't set (#7116)
  5283. if ( value == null || value !== value ) {
  5284. return;
  5285. }
  5286. // If a number was passed in, add the unit (except for certain CSS properties)
  5287. if ( type === "number" ) {
  5288. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  5289. }
  5290. // background-* props affect original clone's values
  5291. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  5292. style[ name ] = "inherit";
  5293. }
  5294. // If a hook was provided, use that value, otherwise just set the specified value
  5295. if ( !hooks || !( "set" in hooks ) ||
  5296. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  5297. if ( isCustomProp ) {
  5298. style.setProperty( name, value );
  5299. } else {
  5300. style[ name ] = value;
  5301. }
  5302. }
  5303. } else {
  5304. // If a hook was provided get the non-computed value from there
  5305. if ( hooks && "get" in hooks &&
  5306. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  5307. return ret;
  5308. }
  5309. // Otherwise just get the value from the style object
  5310. return style[ name ];
  5311. }
  5312. },
  5313. css: function( elem, name, extra, styles ) {
  5314. var val, num, hooks,
  5315. origName = camelCase( name ),
  5316. isCustomProp = rcustomProp.test( name );
  5317. // Make sure that we're working with the right name. We don't
  5318. // want to modify the value if it is a CSS custom property
  5319. // since they are user-defined.
  5320. if ( !isCustomProp ) {
  5321. name = finalPropName( origName );
  5322. }
  5323. // Try prefixed name followed by the unprefixed name
  5324. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  5325. // If a hook was provided get the computed value from there
  5326. if ( hooks && "get" in hooks ) {
  5327. val = hooks.get( elem, true, extra );
  5328. }
  5329. // Otherwise, if a way to get the computed value exists, use that
  5330. if ( val === undefined ) {
  5331. val = curCSS( elem, name, styles );
  5332. }
  5333. // Convert "normal" to computed value
  5334. if ( val === "normal" && name in cssNormalTransform ) {
  5335. val = cssNormalTransform[ name ];
  5336. }
  5337. // Make numeric if forced or a qualifier was provided and val looks numeric
  5338. if ( extra === "" || extra ) {
  5339. num = parseFloat( val );
  5340. return extra === true || isFinite( num ) ? num || 0 : val;
  5341. }
  5342. return val;
  5343. }
  5344. } );
  5345. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  5346. jQuery.cssHooks[ dimension ] = {
  5347. get: function( elem, computed, extra ) {
  5348. if ( computed ) {
  5349. // Certain elements can have dimension info if we invisibly show them
  5350. // but it must have a current display style that would benefit
  5351. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  5352. // Support: Safari 8+
  5353. // Table columns in Safari have non-zero offsetWidth & zero
  5354. // getBoundingClientRect().width unless display is changed.
  5355. // Support: IE <=11 only
  5356. // Running getBoundingClientRect on a disconnected node
  5357. // in IE throws an error.
  5358. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  5359. swap( elem, cssShow, function() {
  5360. return getWidthOrHeight( elem, dimension, extra );
  5361. } ) :
  5362. getWidthOrHeight( elem, dimension, extra );
  5363. }
  5364. },
  5365. set: function( elem, value, extra ) {
  5366. var matches,
  5367. styles = getStyles( elem ),
  5368. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  5369. subtract = extra && boxModelAdjustment(
  5370. elem,
  5371. dimension,
  5372. extra,
  5373. isBorderBox,
  5374. styles
  5375. );
  5376. // Account for unreliable border-box dimensions by comparing offset* to computed and
  5377. // faking a content-box to get border and padding (gh-3699)
  5378. if ( isBorderBox && support.scrollboxSize() === styles.position ) {
  5379. subtract -= Math.ceil(
  5380. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  5381. parseFloat( styles[ dimension ] ) -
  5382. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  5383. 0.5
  5384. );
  5385. }
  5386. // Convert to pixels if value adjustment is needed
  5387. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  5388. ( matches[ 3 ] || "px" ) !== "px" ) {
  5389. elem.style[ dimension ] = value;
  5390. value = jQuery.css( elem, dimension );
  5391. }
  5392. return setPositiveNumber( elem, value, subtract );
  5393. }
  5394. };
  5395. } );
  5396. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  5397. function( elem, computed ) {
  5398. if ( computed ) {
  5399. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  5400. elem.getBoundingClientRect().left -
  5401. swap( elem, { marginLeft: 0 }, function() {
  5402. return elem.getBoundingClientRect().left;
  5403. } )
  5404. ) + "px";
  5405. }
  5406. }
  5407. );
  5408. // These hooks are used by animate to expand properties
  5409. jQuery.each( {
  5410. margin: "",
  5411. padding: "",
  5412. border: "Width"
  5413. }, function( prefix, suffix ) {
  5414. jQuery.cssHooks[ prefix + suffix ] = {
  5415. expand: function( value ) {
  5416. var i = 0,
  5417. expanded = {},
  5418. // Assumes a single number if not a string
  5419. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  5420. for ( ; i < 4; i++ ) {
  5421. expanded[ prefix + cssExpand[ i ] + suffix ] =
  5422. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  5423. }
  5424. return expanded;
  5425. }
  5426. };
  5427. if ( prefix !== "margin" ) {
  5428. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  5429. }
  5430. } );
  5431. jQuery.fn.extend( {
  5432. css: function( name, value ) {
  5433. return access( this, function( elem, name, value ) {
  5434. var styles, len,
  5435. map = {},
  5436. i = 0;
  5437. if ( Array.isArray( name ) ) {
  5438. styles = getStyles( elem );
  5439. len = name.length;
  5440. for ( ; i < len; i++ ) {
  5441. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  5442. }
  5443. return map;
  5444. }
  5445. return value !== undefined ?
  5446. jQuery.style( elem, name, value ) :
  5447. jQuery.css( elem, name );
  5448. }, name, value, arguments.length > 1 );
  5449. }
  5450. } );
  5451. // Based off of the plugin by Clint Helfers, with permission.
  5452. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  5453. jQuery.fn.delay = function( time, type ) {
  5454. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  5455. type = type || "fx";
  5456. return this.queue( type, function( next, hooks ) {
  5457. var timeout = window.setTimeout( next, time );
  5458. hooks.stop = function() {
  5459. window.clearTimeout( timeout );
  5460. };
  5461. } );
  5462. };
  5463. ( function() {
  5464. var input = document.createElement( "input" ),
  5465. select = document.createElement( "select" ),
  5466. opt = select.appendChild( document.createElement( "option" ) );
  5467. input.type = "checkbox";
  5468. // Support: Android <=4.3 only
  5469. // Default value for a checkbox should be "on"
  5470. support.checkOn = input.value !== "";
  5471. // Support: IE <=11 only
  5472. // Must access selectedIndex to make default options select
  5473. support.optSelected = opt.selected;
  5474. // Support: IE <=11 only
  5475. // An input loses its value after becoming a radio
  5476. input = document.createElement( "input" );
  5477. input.value = "t";
  5478. input.type = "radio";
  5479. support.radioValue = input.value === "t";
  5480. } )();
  5481. var boolHook,
  5482. attrHandle = jQuery.expr.attrHandle;
  5483. jQuery.fn.extend( {
  5484. attr: function( name, value ) {
  5485. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  5486. },
  5487. removeAttr: function( name ) {
  5488. return this.each( function() {
  5489. jQuery.removeAttr( this, name );
  5490. } );
  5491. }
  5492. } );
  5493. jQuery.extend( {
  5494. attr: function( elem, name, value ) {
  5495. var ret, hooks,
  5496. nType = elem.nodeType;
  5497. // Don't get/set attributes on text, comment and attribute nodes
  5498. if ( nType === 3 || nType === 8 || nType === 2 ) {
  5499. return;
  5500. }
  5501. // Fallback to prop when attributes are not supported
  5502. if ( typeof elem.getAttribute === "undefined" ) {
  5503. return jQuery.prop( elem, name, value );
  5504. }
  5505. // Attribute hooks are determined by the lowercase version
  5506. // Grab necessary hook if one is defined
  5507. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  5508. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  5509. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  5510. }
  5511. if ( value !== undefined ) {
  5512. if ( value === null ) {
  5513. jQuery.removeAttr( elem, name );
  5514. return;
  5515. }
  5516. if ( hooks && "set" in hooks &&
  5517. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  5518. return ret;
  5519. }
  5520. elem.setAttribute( name, value + "" );
  5521. return value;
  5522. }
  5523. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  5524. return ret;
  5525. }
  5526. ret = jQuery.find.attr( elem, name );
  5527. // Non-existent attributes return null, we normalize to undefined
  5528. return ret == null ? undefined : ret;
  5529. },
  5530. attrHooks: {
  5531. type: {
  5532. set: function( elem, value ) {
  5533. if ( !support.radioValue && value === "radio" &&
  5534. nodeName( elem, "input" ) ) {
  5535. var val = elem.value;
  5536. elem.setAttribute( "type", value );
  5537. if ( val ) {
  5538. elem.value = val;
  5539. }
  5540. return value;
  5541. }
  5542. }
  5543. }
  5544. },
  5545. removeAttr: function( elem, value ) {
  5546. var name,
  5547. i = 0,
  5548. // Attribute names can contain non-HTML whitespace characters
  5549. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  5550. attrNames = value && value.match( rnothtmlwhite );
  5551. if ( attrNames && elem.nodeType === 1 ) {
  5552. while ( ( name = attrNames[ i++ ] ) ) {
  5553. elem.removeAttribute( name );
  5554. }
  5555. }
  5556. }
  5557. } );
  5558. // Hooks for boolean attributes
  5559. boolHook = {
  5560. set: function( elem, value, name ) {
  5561. if ( value === false ) {
  5562. // Remove boolean attributes when set to false
  5563. jQuery.removeAttr( elem, name );
  5564. } else {
  5565. elem.setAttribute( name, name );
  5566. }
  5567. return name;
  5568. }
  5569. };
  5570. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  5571. var getter = attrHandle[ name ] || jQuery.find.attr;
  5572. attrHandle[ name ] = function( elem, name, isXML ) {
  5573. var ret, handle,
  5574. lowercaseName = name.toLowerCase();
  5575. if ( !isXML ) {
  5576. // Avoid an infinite loop by temporarily removing this function from the getter
  5577. handle = attrHandle[ lowercaseName ];
  5578. attrHandle[ lowercaseName ] = ret;
  5579. ret = getter( elem, name, isXML ) != null ?
  5580. lowercaseName :
  5581. null;
  5582. attrHandle[ lowercaseName ] = handle;
  5583. }
  5584. return ret;
  5585. };
  5586. } );
  5587. var rfocusable = /^(?:input|select|textarea|button)$/i,
  5588. rclickable = /^(?:a|area)$/i;
  5589. jQuery.fn.extend( {
  5590. prop: function( name, value ) {
  5591. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  5592. },
  5593. removeProp: function( name ) {
  5594. return this.each( function() {
  5595. delete this[ jQuery.propFix[ name ] || name ];
  5596. } );
  5597. }
  5598. } );
  5599. jQuery.extend( {
  5600. prop: function( elem, name, value ) {
  5601. var ret, hooks,
  5602. nType = elem.nodeType;
  5603. // Don't get/set properties on text, comment and attribute nodes
  5604. if ( nType === 3 || nType === 8 || nType === 2 ) {
  5605. return;
  5606. }
  5607. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  5608. // Fix name and attach hooks
  5609. name = jQuery.propFix[ name ] || name;
  5610. hooks = jQuery.propHooks[ name ];
  5611. }
  5612. if ( value !== undefined ) {
  5613. if ( hooks && "set" in hooks &&
  5614. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  5615. return ret;
  5616. }
  5617. return ( elem[ name ] = value );
  5618. }
  5619. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  5620. return ret;
  5621. }
  5622. return elem[ name ];
  5623. },
  5624. propHooks: {
  5625. tabIndex: {
  5626. get: function( elem ) {
  5627. // Support: IE <=9 - 11 only
  5628. // elem.tabIndex doesn't always return the
  5629. // correct value when it hasn't been explicitly set
  5630. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  5631. // Use proper attribute retrieval(#12072)
  5632. var tabindex = jQuery.find.attr( elem, "tabindex" );
  5633. if ( tabindex ) {
  5634. return parseInt( tabindex, 10 );
  5635. }
  5636. if (
  5637. rfocusable.test( elem.nodeName ) ||
  5638. rclickable.test( elem.nodeName ) &&
  5639. elem.href
  5640. ) {
  5641. return 0;
  5642. }
  5643. return -1;
  5644. }
  5645. }
  5646. },
  5647. propFix: {
  5648. "for": "htmlFor",
  5649. "class": "className"
  5650. }
  5651. } );
  5652. // Support: IE <=11 only
  5653. // Accessing the selectedIndex property
  5654. // forces the browser to respect setting selected
  5655. // on the option
  5656. // The getter ensures a default option is selected
  5657. // when in an optgroup
  5658. // eslint rule "no-unused-expressions" is disabled for this code
  5659. // since it considers such accessions noop
  5660. if ( !support.optSelected ) {
  5661. jQuery.propHooks.selected = {
  5662. get: function( elem ) {
  5663. /* eslint no-unused-expressions: "off" */
  5664. var parent = elem.parentNode;
  5665. if ( parent && parent.parentNode ) {
  5666. parent.parentNode.selectedIndex;
  5667. }
  5668. return null;
  5669. },
  5670. set: function( elem ) {
  5671. /* eslint no-unused-expressions: "off" */
  5672. var parent = elem.parentNode;
  5673. if ( parent ) {
  5674. parent.selectedIndex;
  5675. if ( parent.parentNode ) {
  5676. parent.parentNode.selectedIndex;
  5677. }
  5678. }
  5679. }
  5680. };
  5681. }
  5682. jQuery.each( [
  5683. "tabIndex",
  5684. "readOnly",
  5685. "maxLength",
  5686. "cellSpacing",
  5687. "cellPadding",
  5688. "rowSpan",
  5689. "colSpan",
  5690. "useMap",
  5691. "frameBorder",
  5692. "contentEditable"
  5693. ], function() {
  5694. jQuery.propFix[ this.toLowerCase() ] = this;
  5695. } );
  5696. // Strip and collapse whitespace according to HTML spec
  5697. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  5698. function stripAndCollapse( value ) {
  5699. var tokens = value.match( rnothtmlwhite ) || [];
  5700. return tokens.join( " " );
  5701. }
  5702. function getClass( elem ) {
  5703. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  5704. }
  5705. function classesToArray( value ) {
  5706. if ( Array.isArray( value ) ) {
  5707. return value;
  5708. }
  5709. if ( typeof value === "string" ) {
  5710. return value.match( rnothtmlwhite ) || [];
  5711. }
  5712. return [];
  5713. }
  5714. jQuery.fn.extend( {
  5715. addClass: function( value ) {
  5716. var classes, elem, cur, curValue, clazz, j, finalValue,
  5717. i = 0;
  5718. if ( isFunction( value ) ) {
  5719. return this.each( function( j ) {
  5720. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  5721. } );
  5722. }
  5723. classes = classesToArray( value );
  5724. if ( classes.length ) {
  5725. while ( ( elem = this[ i++ ] ) ) {
  5726. curValue = getClass( elem );
  5727. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  5728. if ( cur ) {
  5729. j = 0;
  5730. while ( ( clazz = classes[ j++ ] ) ) {
  5731. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  5732. cur += clazz + " ";
  5733. }
  5734. }
  5735. // Only assign if different to avoid unneeded rendering.
  5736. finalValue = stripAndCollapse( cur );
  5737. if ( curValue !== finalValue ) {
  5738. elem.setAttribute( "class", finalValue );
  5739. }
  5740. }
  5741. }
  5742. }
  5743. return this;
  5744. },
  5745. removeClass: function( value ) {
  5746. var classes, elem, cur, curValue, clazz, j, finalValue,
  5747. i = 0;
  5748. if ( isFunction( value ) ) {
  5749. return this.each( function( j ) {
  5750. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  5751. } );
  5752. }
  5753. if ( !arguments.length ) {
  5754. return this.attr( "class", "" );
  5755. }
  5756. classes = classesToArray( value );
  5757. if ( classes.length ) {
  5758. while ( ( elem = this[ i++ ] ) ) {
  5759. curValue = getClass( elem );
  5760. // This expression is here for better compressibility (see addClass)
  5761. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  5762. if ( cur ) {
  5763. j = 0;
  5764. while ( ( clazz = classes[ j++ ] ) ) {
  5765. // Remove *all* instances
  5766. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  5767. cur = cur.replace( " " + clazz + " ", " " );
  5768. }
  5769. }
  5770. // Only assign if different to avoid unneeded rendering.
  5771. finalValue = stripAndCollapse( cur );
  5772. if ( curValue !== finalValue ) {
  5773. elem.setAttribute( "class", finalValue );
  5774. }
  5775. }
  5776. }
  5777. }
  5778. return this;
  5779. },
  5780. toggleClass: function( value, stateVal ) {
  5781. var type = typeof value,
  5782. isValidValue = type === "string" || Array.isArray( value );
  5783. if ( typeof stateVal === "boolean" && isValidValue ) {
  5784. return stateVal ? this.addClass( value ) : this.removeClass( value );
  5785. }
  5786. if ( isFunction( value ) ) {
  5787. return this.each( function( i ) {
  5788. jQuery( this ).toggleClass(
  5789. value.call( this, i, getClass( this ), stateVal ),
  5790. stateVal
  5791. );
  5792. } );
  5793. }
  5794. return this.each( function() {
  5795. var className, i, self, classNames;
  5796. if ( isValidValue ) {
  5797. // Toggle individual class names
  5798. i = 0;
  5799. self = jQuery( this );
  5800. classNames = classesToArray( value );
  5801. while ( ( className = classNames[ i++ ] ) ) {
  5802. // Check each className given, space separated list
  5803. if ( self.hasClass( className ) ) {
  5804. self.removeClass( className );
  5805. } else {
  5806. self.addClass( className );
  5807. }
  5808. }
  5809. // Toggle whole class name
  5810. } else if ( value === undefined || type === "boolean" ) {
  5811. className = getClass( this );
  5812. if ( className ) {
  5813. // Store className if set
  5814. dataPriv.set( this, "__className__", className );
  5815. }
  5816. // If the element has a class name or if we're passed `false`,
  5817. // then remove the whole classname (if there was one, the above saved it).
  5818. // Otherwise bring back whatever was previously saved (if anything),
  5819. // falling back to the empty string if nothing was stored.
  5820. if ( this.setAttribute ) {
  5821. this.setAttribute( "class",
  5822. className || value === false ?
  5823. "" :
  5824. dataPriv.get( this, "__className__" ) || ""
  5825. );
  5826. }
  5827. }
  5828. } );
  5829. },
  5830. hasClass: function( selector ) {
  5831. var className, elem,
  5832. i = 0;
  5833. className = " " + selector + " ";
  5834. while ( ( elem = this[ i++ ] ) ) {
  5835. if ( elem.nodeType === 1 &&
  5836. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  5837. return true;
  5838. }
  5839. }
  5840. return false;
  5841. }
  5842. } );
  5843. var rreturn = /\r/g;
  5844. jQuery.fn.extend( {
  5845. val: function( value ) {
  5846. var hooks, ret, valueIsFunction,
  5847. elem = this[ 0 ];
  5848. if ( !arguments.length ) {
  5849. if ( elem ) {
  5850. hooks = jQuery.valHooks[ elem.type ] ||
  5851. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  5852. if ( hooks &&
  5853. "get" in hooks &&
  5854. ( ret = hooks.get( elem, "value" ) ) !== undefined
  5855. ) {
  5856. return ret;
  5857. }
  5858. ret = elem.value;
  5859. // Handle most common string cases
  5860. if ( typeof ret === "string" ) {
  5861. return ret.replace( rreturn, "" );
  5862. }
  5863. // Handle cases where value is null/undef or number
  5864. return ret == null ? "" : ret;
  5865. }
  5866. return;
  5867. }
  5868. valueIsFunction = isFunction( value );
  5869. return this.each( function( i ) {
  5870. var val;
  5871. if ( this.nodeType !== 1 ) {
  5872. return;
  5873. }
  5874. if ( valueIsFunction ) {
  5875. val = value.call( this, i, jQuery( this ).val() );
  5876. } else {
  5877. val = value;
  5878. }
  5879. // Treat null/undefined as ""; convert numbers to string
  5880. if ( val == null ) {
  5881. val = "";
  5882. } else if ( typeof val === "number" ) {
  5883. val += "";
  5884. } else if ( Array.isArray( val ) ) {
  5885. val = jQuery.map( val, function( value ) {
  5886. return value == null ? "" : value + "";
  5887. } );
  5888. }
  5889. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  5890. // If set returns undefined, fall back to normal setting
  5891. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  5892. this.value = val;
  5893. }
  5894. } );
  5895. }
  5896. } );
  5897. jQuery.extend( {
  5898. valHooks: {
  5899. option: {
  5900. get: function( elem ) {
  5901. var val = jQuery.find.attr( elem, "value" );
  5902. return val != null ?
  5903. val :
  5904. // Support: IE <=10 - 11 only
  5905. // option.text throws exceptions (#14686, #14858)
  5906. // Strip and collapse whitespace
  5907. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  5908. stripAndCollapse( jQuery.text( elem ) );
  5909. }
  5910. },
  5911. select: {
  5912. get: function( elem ) {
  5913. var value, option, i,
  5914. options = elem.options,
  5915. index = elem.selectedIndex,
  5916. one = elem.type === "select-one",
  5917. values = one ? null : [],
  5918. max = one ? index + 1 : options.length;
  5919. if ( index < 0 ) {
  5920. i = max;
  5921. } else {
  5922. i = one ? index : 0;
  5923. }
  5924. // Loop through all the selected options
  5925. for ( ; i < max; i++ ) {
  5926. option = options[ i ];
  5927. // Support: IE <=9 only
  5928. // IE8-9 doesn't update selected after form reset (#2551)
  5929. if ( ( option.selected || i === index ) &&
  5930. // Don't return options that are disabled or in a disabled optgroup
  5931. !option.disabled &&
  5932. ( !option.parentNode.disabled ||
  5933. !nodeName( option.parentNode, "optgroup" ) ) ) {
  5934. // Get the specific value for the option
  5935. value = jQuery( option ).val();
  5936. // We don't need an array for one selects
  5937. if ( one ) {
  5938. return value;
  5939. }
  5940. // Multi-Selects return an array
  5941. values.push( value );
  5942. }
  5943. }
  5944. return values;
  5945. },
  5946. set: function( elem, value ) {
  5947. var optionSet, option,
  5948. options = elem.options,
  5949. values = jQuery.makeArray( value ),
  5950. i = options.length;
  5951. while ( i-- ) {
  5952. option = options[ i ];
  5953. /* eslint-disable no-cond-assign */
  5954. if ( option.selected =
  5955. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  5956. ) {
  5957. optionSet = true;
  5958. }
  5959. /* eslint-enable no-cond-assign */
  5960. }
  5961. // Force browsers to behave consistently when non-matching value is set
  5962. if ( !optionSet ) {
  5963. elem.selectedIndex = -1;
  5964. }
  5965. return values;
  5966. }
  5967. }
  5968. }
  5969. } );
  5970. // Radios and checkboxes getter/setter
  5971. jQuery.each( [ "radio", "checkbox" ], function() {
  5972. jQuery.valHooks[ this ] = {
  5973. set: function( elem, value ) {
  5974. if ( Array.isArray( value ) ) {
  5975. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  5976. }
  5977. }
  5978. };
  5979. if ( !support.checkOn ) {
  5980. jQuery.valHooks[ this ].get = function( elem ) {
  5981. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  5982. };
  5983. }
  5984. } );
  5985. // Return jQuery for attributes-only inclusion
  5986. support.focusin = "onfocusin" in window;
  5987. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  5988. stopPropagationCallback = function( e ) {
  5989. e.stopPropagation();
  5990. };
  5991. jQuery.extend( jQuery.event, {
  5992. trigger: function( event, data, elem, onlyHandlers ) {
  5993. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  5994. eventPath = [ elem || document ],
  5995. type = hasOwn.call( event, "type" ) ? event.type : event,
  5996. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  5997. cur = lastElement = tmp = elem = elem || document;
  5998. // Don't do events on text and comment nodes
  5999. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  6000. return;
  6001. }
  6002. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  6003. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  6004. return;
  6005. }
  6006. if ( type.indexOf( "." ) > -1 ) {
  6007. // Namespaced trigger; create a regexp to match event type in handle()
  6008. namespaces = type.split( "." );
  6009. type = namespaces.shift();
  6010. namespaces.sort();
  6011. }
  6012. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  6013. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  6014. event = event[ jQuery.expando ] ?
  6015. event :
  6016. new jQuery.Event( type, typeof event === "object" && event );
  6017. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  6018. event.isTrigger = onlyHandlers ? 2 : 3;
  6019. event.namespace = namespaces.join( "." );
  6020. event.rnamespace = event.namespace ?
  6021. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  6022. null;
  6023. // Clean up the event in case it is being reused
  6024. event.result = undefined;
  6025. if ( !event.target ) {
  6026. event.target = elem;
  6027. }
  6028. // Clone any incoming data and prepend the event, creating the handler arg list
  6029. data = data == null ?
  6030. [ event ] :
  6031. jQuery.makeArray( data, [ event ] );
  6032. // Allow special events to draw outside the lines
  6033. special = jQuery.event.special[ type ] || {};
  6034. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  6035. return;
  6036. }
  6037. // Determine event propagation path in advance, per W3C events spec (#9951)
  6038. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  6039. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  6040. bubbleType = special.delegateType || type;
  6041. if ( !rfocusMorph.test( bubbleType + type ) ) {
  6042. cur = cur.parentNode;
  6043. }
  6044. for ( ; cur; cur = cur.parentNode ) {
  6045. eventPath.push( cur );
  6046. tmp = cur;
  6047. }
  6048. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  6049. if ( tmp === ( elem.ownerDocument || document ) ) {
  6050. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  6051. }
  6052. }
  6053. // Fire handlers on the event path
  6054. i = 0;
  6055. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  6056. lastElement = cur;
  6057. event.type = i > 1 ?
  6058. bubbleType :
  6059. special.bindType || type;
  6060. // jQuery handler
  6061. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  6062. dataPriv.get( cur, "handle" );
  6063. if ( handle ) {
  6064. handle.apply( cur, data );
  6065. }
  6066. // Native handler
  6067. handle = ontype && cur[ ontype ];
  6068. if ( handle && handle.apply && acceptData( cur ) ) {
  6069. event.result = handle.apply( cur, data );
  6070. if ( event.result === false ) {
  6071. event.preventDefault();
  6072. }
  6073. }
  6074. }
  6075. event.type = type;
  6076. // If nobody prevented the default action, do it now
  6077. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  6078. if ( ( !special._default ||
  6079. special._default.apply( eventPath.pop(), data ) === false ) &&
  6080. acceptData( elem ) ) {
  6081. // Call a native DOM method on the target with the same name as the event.
  6082. // Don't do default actions on window, that's where global variables be (#6170)
  6083. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  6084. // Don't re-trigger an onFOO event when we call its FOO() method
  6085. tmp = elem[ ontype ];
  6086. if ( tmp ) {
  6087. elem[ ontype ] = null;
  6088. }
  6089. // Prevent re-triggering of the same event, since we already bubbled it above
  6090. jQuery.event.triggered = type;
  6091. if ( event.isPropagationStopped() ) {
  6092. lastElement.addEventListener( type, stopPropagationCallback );
  6093. }
  6094. elem[ type ]();
  6095. if ( event.isPropagationStopped() ) {
  6096. lastElement.removeEventListener( type, stopPropagationCallback );
  6097. }
  6098. jQuery.event.triggered = undefined;
  6099. if ( tmp ) {
  6100. elem[ ontype ] = tmp;
  6101. }
  6102. }
  6103. }
  6104. }
  6105. return event.result;
  6106. },
  6107. // Piggyback on a donor event to simulate a different one
  6108. // Used only for `focus(in | out)` events
  6109. simulate: function( type, elem, event ) {
  6110. var e = jQuery.extend(
  6111. new jQuery.Event(),
  6112. event,
  6113. {
  6114. type: type,
  6115. isSimulated: true
  6116. }
  6117. );
  6118. jQuery.event.trigger( e, null, elem );
  6119. }
  6120. } );
  6121. jQuery.fn.extend( {
  6122. trigger: function( type, data ) {
  6123. return this.each( function() {
  6124. jQuery.event.trigger( type, data, this );
  6125. } );
  6126. },
  6127. triggerHandler: function( type, data ) {
  6128. var elem = this[ 0 ];
  6129. if ( elem ) {
  6130. return jQuery.event.trigger( type, data, elem, true );
  6131. }
  6132. }
  6133. } );
  6134. // Support: Firefox <=44
  6135. // Firefox doesn't have focus(in | out) events
  6136. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  6137. //
  6138. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  6139. // focus(in | out) events fire after focus & blur events,
  6140. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  6141. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  6142. if ( !support.focusin ) {
  6143. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  6144. // Attach a single capturing handler on the document while someone wants focusin/focusout
  6145. var handler = function( event ) {
  6146. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  6147. };
  6148. jQuery.event.special[ fix ] = {
  6149. setup: function() {
  6150. var doc = this.ownerDocument || this,
  6151. attaches = dataPriv.access( doc, fix );
  6152. if ( !attaches ) {
  6153. doc.addEventListener( orig, handler, true );
  6154. }
  6155. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  6156. },
  6157. teardown: function() {
  6158. var doc = this.ownerDocument || this,
  6159. attaches = dataPriv.access( doc, fix ) - 1;
  6160. if ( !attaches ) {
  6161. doc.removeEventListener( orig, handler, true );
  6162. dataPriv.remove( doc, fix );
  6163. } else {
  6164. dataPriv.access( doc, fix, attaches );
  6165. }
  6166. }
  6167. };
  6168. } );
  6169. }
  6170. var
  6171. rbracket = /\[\]$/,
  6172. rCRLF = /\r?\n/g,
  6173. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  6174. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  6175. function buildParams( prefix, obj, traditional, add ) {
  6176. var name;
  6177. if ( Array.isArray( obj ) ) {
  6178. // Serialize array item.
  6179. jQuery.each( obj, function( i, v ) {
  6180. if ( traditional || rbracket.test( prefix ) ) {
  6181. // Treat each array item as a scalar.
  6182. add( prefix, v );
  6183. } else {
  6184. // Item is non-scalar (array or object), encode its numeric index.
  6185. buildParams(
  6186. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  6187. v,
  6188. traditional,
  6189. add
  6190. );
  6191. }
  6192. } );
  6193. } else if ( !traditional && toType( obj ) === "object" ) {
  6194. // Serialize object item.
  6195. for ( name in obj ) {
  6196. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  6197. }
  6198. } else {
  6199. // Serialize scalar item.
  6200. add( prefix, obj );
  6201. }
  6202. }
  6203. // Serialize an array of form elements or a set of
  6204. // key/values into a query string
  6205. jQuery.param = function( a, traditional ) {
  6206. var prefix,
  6207. s = [],
  6208. add = function( key, valueOrFunction ) {
  6209. // If value is a function, invoke it and use its return value
  6210. var value = isFunction( valueOrFunction ) ?
  6211. valueOrFunction() :
  6212. valueOrFunction;
  6213. s[ s.length ] = encodeURIComponent( key ) + "=" +
  6214. encodeURIComponent( value == null ? "" : value );
  6215. };
  6216. // If an array was passed in, assume that it is an array of form elements.
  6217. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  6218. // Serialize the form elements
  6219. jQuery.each( a, function() {
  6220. add( this.name, this.value );
  6221. } );
  6222. } else {
  6223. // If traditional, encode the "old" way (the way 1.3.2 or older
  6224. // did it), otherwise encode params recursively.
  6225. for ( prefix in a ) {
  6226. buildParams( prefix, a[ prefix ], traditional, add );
  6227. }
  6228. }
  6229. // Return the resulting serialization
  6230. return s.join( "&" );
  6231. };
  6232. jQuery.fn.extend( {
  6233. serialize: function() {
  6234. return jQuery.param( this.serializeArray() );
  6235. },
  6236. serializeArray: function() {
  6237. return this.map( function() {
  6238. // Can add propHook for "elements" to filter or add form elements
  6239. var elements = jQuery.prop( this, "elements" );
  6240. return elements ? jQuery.makeArray( elements ) : this;
  6241. } )
  6242. .filter( function() {
  6243. var type = this.type;
  6244. // Use .is( ":disabled" ) so that fieldset[disabled] works
  6245. return this.name && !jQuery( this ).is( ":disabled" ) &&
  6246. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  6247. ( this.checked || !rcheckableType.test( type ) );
  6248. } )
  6249. .map( function( i, elem ) {
  6250. var val = jQuery( this ).val();
  6251. if ( val == null ) {
  6252. return null;
  6253. }
  6254. if ( Array.isArray( val ) ) {
  6255. return jQuery.map( val, function( val ) {
  6256. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  6257. } );
  6258. }
  6259. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  6260. } ).get();
  6261. }
  6262. } );
  6263. jQuery.fn.extend( {
  6264. wrapAll: function( html ) {
  6265. var wrap;
  6266. if ( this[ 0 ] ) {
  6267. if ( isFunction( html ) ) {
  6268. html = html.call( this[ 0 ] );
  6269. }
  6270. // The elements to wrap the target around
  6271. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  6272. if ( this[ 0 ].parentNode ) {
  6273. wrap.insertBefore( this[ 0 ] );
  6274. }
  6275. wrap.map( function() {
  6276. var elem = this;
  6277. while ( elem.firstElementChild ) {
  6278. elem = elem.firstElementChild;
  6279. }
  6280. return elem;
  6281. } ).append( this );
  6282. }
  6283. return this;
  6284. },
  6285. wrapInner: function( html ) {
  6286. if ( isFunction( html ) ) {
  6287. return this.each( function( i ) {
  6288. jQuery( this ).wrapInner( html.call( this, i ) );
  6289. } );
  6290. }
  6291. return this.each( function() {
  6292. var self = jQuery( this ),
  6293. contents = self.contents();
  6294. if ( contents.length ) {
  6295. contents.wrapAll( html );
  6296. } else {
  6297. self.append( html );
  6298. }
  6299. } );
  6300. },
  6301. wrap: function( html ) {
  6302. var htmlIsFunction = isFunction( html );
  6303. return this.each( function( i ) {
  6304. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  6305. } );
  6306. },
  6307. unwrap: function( selector ) {
  6308. this.parent( selector ).not( "body" ).each( function() {
  6309. jQuery( this ).replaceWith( this.childNodes );
  6310. } );
  6311. return this;
  6312. }
  6313. } );
  6314. jQuery.expr.pseudos.hidden = function( elem ) {
  6315. return !jQuery.expr.pseudos.visible( elem );
  6316. };
  6317. jQuery.expr.pseudos.visible = function( elem ) {
  6318. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  6319. };
  6320. // Support: Safari 8 only
  6321. // In Safari 8 documents created via document.implementation.createHTMLDocument
  6322. // collapse sibling forms: the second one becomes a child of the first one.
  6323. // Because of that, this security measure has to be disabled in Safari 8.
  6324. // https://bugs.webkit.org/show_bug.cgi?id=137337
  6325. support.createHTMLDocument = ( function() {
  6326. var body = document.implementation.createHTMLDocument( "" ).body;
  6327. body.innerHTML = "<form></form><form></form>";
  6328. return body.childNodes.length === 2;
  6329. } )();
  6330. // Argument "data" should be string of html
  6331. // context (optional): If specified, the fragment will be created in this context,
  6332. // defaults to document
  6333. // keepScripts (optional): If true, will include scripts passed in the html string
  6334. jQuery.parseHTML = function( data, context, keepScripts ) {
  6335. if ( typeof data !== "string" ) {
  6336. return [];
  6337. }
  6338. if ( typeof context === "boolean" ) {
  6339. keepScripts = context;
  6340. context = false;
  6341. }
  6342. var base, parsed, scripts;
  6343. if ( !context ) {
  6344. // Stop scripts or inline event handlers from being executed immediately
  6345. // by using document.implementation
  6346. if ( support.createHTMLDocument ) {
  6347. context = document.implementation.createHTMLDocument( "" );
  6348. // Set the base href for the created document
  6349. // so any parsed elements with URLs
  6350. // are based on the document's URL (gh-2965)
  6351. base = context.createElement( "base" );
  6352. base.href = document.location.href;
  6353. context.head.appendChild( base );
  6354. } else {
  6355. context = document;
  6356. }
  6357. }
  6358. parsed = rsingleTag.exec( data );
  6359. scripts = !keepScripts && [];
  6360. // Single tag
  6361. if ( parsed ) {
  6362. return [ context.createElement( parsed[ 1 ] ) ];
  6363. }
  6364. parsed = buildFragment( [ data ], context, scripts );
  6365. if ( scripts && scripts.length ) {
  6366. jQuery( scripts ).remove();
  6367. }
  6368. return jQuery.merge( [], parsed.childNodes );
  6369. };
  6370. jQuery.offset = {
  6371. setOffset: function( elem, options, i ) {
  6372. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  6373. position = jQuery.css( elem, "position" ),
  6374. curElem = jQuery( elem ),
  6375. props = {};
  6376. // Set position first, in-case top/left are set even on static elem
  6377. if ( position === "static" ) {
  6378. elem.style.position = "relative";
  6379. }
  6380. curOffset = curElem.offset();
  6381. curCSSTop = jQuery.css( elem, "top" );
  6382. curCSSLeft = jQuery.css( elem, "left" );
  6383. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  6384. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  6385. // Need to be able to calculate position if either
  6386. // top or left is auto and position is either absolute or fixed
  6387. if ( calculatePosition ) {
  6388. curPosition = curElem.position();
  6389. curTop = curPosition.top;
  6390. curLeft = curPosition.left;
  6391. } else {
  6392. curTop = parseFloat( curCSSTop ) || 0;
  6393. curLeft = parseFloat( curCSSLeft ) || 0;
  6394. }
  6395. if ( isFunction( options ) ) {
  6396. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  6397. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  6398. }
  6399. if ( options.top != null ) {
  6400. props.top = ( options.top - curOffset.top ) + curTop;
  6401. }
  6402. if ( options.left != null ) {
  6403. props.left = ( options.left - curOffset.left ) + curLeft;
  6404. }
  6405. if ( "using" in options ) {
  6406. options.using.call( elem, props );
  6407. } else {
  6408. curElem.css( props );
  6409. }
  6410. }
  6411. };
  6412. jQuery.fn.extend( {
  6413. // offset() relates an element's border box to the document origin
  6414. offset: function( options ) {
  6415. // Preserve chaining for setter
  6416. if ( arguments.length ) {
  6417. return options === undefined ?
  6418. this :
  6419. this.each( function( i ) {
  6420. jQuery.offset.setOffset( this, options, i );
  6421. } );
  6422. }
  6423. var rect, win,
  6424. elem = this[ 0 ];
  6425. if ( !elem ) {
  6426. return;
  6427. }
  6428. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  6429. // Support: IE <=11 only
  6430. // Running getBoundingClientRect on a
  6431. // disconnected node in IE throws an error
  6432. if ( !elem.getClientRects().length ) {
  6433. return { top: 0, left: 0 };
  6434. }
  6435. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  6436. rect = elem.getBoundingClientRect();
  6437. win = elem.ownerDocument.defaultView;
  6438. return {
  6439. top: rect.top + win.pageYOffset,
  6440. left: rect.left + win.pageXOffset
  6441. };
  6442. },
  6443. // position() relates an element's margin box to its offset parent's padding box
  6444. // This corresponds to the behavior of CSS absolute positioning
  6445. position: function() {
  6446. if ( !this[ 0 ] ) {
  6447. return;
  6448. }
  6449. var offsetParent, offset, doc,
  6450. elem = this[ 0 ],
  6451. parentOffset = { top: 0, left: 0 };
  6452. // position:fixed elements are offset from the viewport, which itself always has zero offset
  6453. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  6454. // Assume position:fixed implies availability of getBoundingClientRect
  6455. offset = elem.getBoundingClientRect();
  6456. } else {
  6457. offset = this.offset();
  6458. // Account for the *real* offset parent, which can be the document or its root element
  6459. // when a statically positioned element is identified
  6460. doc = elem.ownerDocument;
  6461. offsetParent = elem.offsetParent || doc.documentElement;
  6462. while ( offsetParent &&
  6463. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  6464. jQuery.css( offsetParent, "position" ) === "static" ) {
  6465. offsetParent = offsetParent.parentNode;
  6466. }
  6467. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  6468. // Incorporate borders into its offset, since they are outside its content origin
  6469. parentOffset = jQuery( offsetParent ).offset();
  6470. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  6471. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  6472. }
  6473. }
  6474. // Subtract parent offsets and element margins
  6475. return {
  6476. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  6477. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  6478. };
  6479. },
  6480. // This method will return documentElement in the following cases:
  6481. // 1) For the element inside the iframe without offsetParent, this method will return
  6482. // documentElement of the parent window
  6483. // 2) For the hidden or detached element
  6484. // 3) For body or html element, i.e. in case of the html node - it will return itself
  6485. //
  6486. // but those exceptions were never presented as a real life use-cases
  6487. // and might be considered as more preferable results.
  6488. //
  6489. // This logic, however, is not guaranteed and can change at any point in the future
  6490. offsetParent: function() {
  6491. return this.map( function() {
  6492. var offsetParent = this.offsetParent;
  6493. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  6494. offsetParent = offsetParent.offsetParent;
  6495. }
  6496. return offsetParent || documentElement;
  6497. } );
  6498. }
  6499. } );
  6500. // Create scrollLeft and scrollTop methods
  6501. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  6502. var top = "pageYOffset" === prop;
  6503. jQuery.fn[ method ] = function( val ) {
  6504. return access( this, function( elem, method, val ) {
  6505. // Coalesce documents and windows
  6506. var win;
  6507. if ( isWindow( elem ) ) {
  6508. win = elem;
  6509. } else if ( elem.nodeType === 9 ) {
  6510. win = elem.defaultView;
  6511. }
  6512. if ( val === undefined ) {
  6513. return win ? win[ prop ] : elem[ method ];
  6514. }
  6515. if ( win ) {
  6516. win.scrollTo(
  6517. !top ? val : win.pageXOffset,
  6518. top ? val : win.pageYOffset
  6519. );
  6520. } else {
  6521. elem[ method ] = val;
  6522. }
  6523. }, method, val, arguments.length );
  6524. };
  6525. } );
  6526. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  6527. // Add the top/left cssHooks using jQuery.fn.position
  6528. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  6529. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  6530. // getComputedStyle returns percent when specified for top/left/bottom/right;
  6531. // rather than make the css module depend on the offset module, just check for it here
  6532. jQuery.each( [ "top", "left" ], function( i, prop ) {
  6533. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  6534. function( elem, computed ) {
  6535. if ( computed ) {
  6536. computed = curCSS( elem, prop );
  6537. // If curCSS returns percentage, fallback to offset
  6538. return rnumnonpx.test( computed ) ?
  6539. jQuery( elem ).position()[ prop ] + "px" :
  6540. computed;
  6541. }
  6542. }
  6543. );
  6544. } );
  6545. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  6546. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  6547. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  6548. function( defaultExtra, funcName ) {
  6549. // Margin is only for outerHeight, outerWidth
  6550. jQuery.fn[ funcName ] = function( margin, value ) {
  6551. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  6552. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  6553. return access( this, function( elem, type, value ) {
  6554. var doc;
  6555. if ( isWindow( elem ) ) {
  6556. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  6557. return funcName.indexOf( "outer" ) === 0 ?
  6558. elem[ "inner" + name ] :
  6559. elem.document.documentElement[ "client" + name ];
  6560. }
  6561. // Get document width or height
  6562. if ( elem.nodeType === 9 ) {
  6563. doc = elem.documentElement;
  6564. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  6565. // whichever is greatest
  6566. return Math.max(
  6567. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  6568. elem.body[ "offset" + name ], doc[ "offset" + name ],
  6569. doc[ "client" + name ]
  6570. );
  6571. }
  6572. return value === undefined ?
  6573. // Get width or height on the element, requesting but not forcing parseFloat
  6574. jQuery.css( elem, type, extra ) :
  6575. // Set width or height on the element
  6576. jQuery.style( elem, type, value, extra );
  6577. }, type, chainable ? margin : undefined, chainable );
  6578. };
  6579. } );
  6580. } );
  6581. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  6582. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  6583. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  6584. function( i, name ) {
  6585. // Handle event binding
  6586. jQuery.fn[ name ] = function( data, fn ) {
  6587. return arguments.length > 0 ?
  6588. this.on( name, null, data, fn ) :
  6589. this.trigger( name );
  6590. };
  6591. } );
  6592. jQuery.fn.extend( {
  6593. hover: function( fnOver, fnOut ) {
  6594. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  6595. }
  6596. } );
  6597. jQuery.fn.extend( {
  6598. bind: function( types, data, fn ) {
  6599. return this.on( types, null, data, fn );
  6600. },
  6601. unbind: function( types, fn ) {
  6602. return this.off( types, null, fn );
  6603. },
  6604. delegate: function( selector, types, data, fn ) {
  6605. return this.on( types, selector, data, fn );
  6606. },
  6607. undelegate: function( selector, types, fn ) {
  6608. // ( namespace ) or ( selector, types [, fn] )
  6609. return arguments.length === 1 ?
  6610. this.off( selector, "**" ) :
  6611. this.off( types, selector || "**", fn );
  6612. }
  6613. } );
  6614. // Bind a function to a context, optionally partially applying any
  6615. // arguments.
  6616. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  6617. // However, it is not slated for removal any time soon
  6618. jQuery.proxy = function( fn, context ) {
  6619. var tmp, args, proxy;
  6620. if ( typeof context === "string" ) {
  6621. tmp = fn[ context ];
  6622. context = fn;
  6623. fn = tmp;
  6624. }
  6625. // Quick check to determine if target is callable, in the spec
  6626. // this throws a TypeError, but we will just return undefined.
  6627. if ( !isFunction( fn ) ) {
  6628. return undefined;
  6629. }
  6630. // Simulated bind
  6631. args = slice.call( arguments, 2 );
  6632. proxy = function() {
  6633. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  6634. };
  6635. // Set the guid of unique handler to the same of original handler, so it can be removed
  6636. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  6637. return proxy;
  6638. };
  6639. jQuery.holdReady = function( hold ) {
  6640. if ( hold ) {
  6641. jQuery.readyWait++;
  6642. } else {
  6643. jQuery.ready( true );
  6644. }
  6645. };
  6646. jQuery.isArray = Array.isArray;
  6647. jQuery.parseJSON = JSON.parse;
  6648. jQuery.nodeName = nodeName;
  6649. jQuery.isFunction = isFunction;
  6650. jQuery.isWindow = isWindow;
  6651. jQuery.camelCase = camelCase;
  6652. jQuery.type = toType;
  6653. jQuery.now = Date.now;
  6654. jQuery.isNumeric = function( obj ) {
  6655. // As of jQuery 3.0, isNumeric is limited to
  6656. // strings and numbers (primitives or objects)
  6657. // that can be coerced to finite numbers (gh-2662)
  6658. var type = jQuery.type( obj );
  6659. return ( type === "number" || type === "string" ) &&
  6660. // parseFloat NaNs numeric-cast false positives ("")
  6661. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  6662. // subtraction forces infinities to NaN
  6663. !isNaN( obj - parseFloat( obj ) );
  6664. };
  6665. // Register as a named AMD module, since jQuery can be concatenated with other
  6666. // files that may use define, but not via a proper concatenation script that
  6667. // understands anonymous AMD modules. A named AMD is safest and most robust
  6668. // way to register. Lowercase jquery is used because AMD module names are
  6669. // derived from file names, and jQuery is normally delivered in a lowercase
  6670. // file name. Do this after creating the global so that if an AMD module wants
  6671. // to call noConflict to hide this version of jQuery, it will work.
  6672. // Note that for maximum portability, libraries that are not jQuery should
  6673. // declare themselves as anonymous modules, and avoid setting a global if an
  6674. // AMD loader is present. jQuery is a special case. For more information, see
  6675. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  6676. if ( typeof define === "function" && define.amd ) {
  6677. define( "jquery", [], function() {
  6678. return jQuery;
  6679. } );
  6680. }
  6681. var
  6682. // Map over jQuery in case of overwrite
  6683. _jQuery = window.jQuery,
  6684. // Map over the $ in case of overwrite
  6685. _$ = window.$;
  6686. jQuery.noConflict = function( deep ) {
  6687. if ( window.$ === jQuery ) {
  6688. window.$ = _$;
  6689. }
  6690. if ( deep && window.jQuery === jQuery ) {
  6691. window.jQuery = _jQuery;
  6692. }
  6693. return jQuery;
  6694. };
  6695. // Expose jQuery and $ identifiers, even in AMD
  6696. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  6697. // and CommonJS for browser emulators (#13566)
  6698. if ( !noGlobal ) {
  6699. window.jQuery = window.$ = jQuery;
  6700. }
  6701. return jQuery;
  6702. } );