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.

9934 lines
372 KiB

4 years ago
  1. /*!
  2. * jQuery JavaScript Library v3.3.1
  3. * https://jquery.com/
  4. *
  5. * Includes Sizzle.js
  6. * https://sizzlejs.com/
  7. *
  8. * Copyright JS Foundation and other contributors
  9. * Released under the MIT license
  10. * https://jquery.org/license
  11. *
  12. * Date: 2018-01-20T17:24Z
  13. */
  14. (function (global, factory) {
  15. "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",
  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 = {
  554. apply: arr.length ?
  555. // Leverage slice if possible
  556. function (target, els) {
  557. push_native.apply(target, slice.call(els));
  558. } :
  559. // Support: IE<9
  560. // Otherwise append directly
  561. function (target, els) {
  562. var j = target.length,
  563. i = 0;
  564. // Can't trust NodeList.length
  565. while ((target[j++] = els[i++])) { }
  566. target.length = j - 1;
  567. }
  568. };
  569. }
  570. function Sizzle(selector, context, results, seed) {
  571. var m, i, elem, nid, match, groups, newSelector,
  572. newContext = context && context.ownerDocument,
  573. // nodeType defaults to 9, since context defaults to document
  574. nodeType = context ? context.nodeType : 9;
  575. results = results || [];
  576. // Return early from calls with invalid selector or context
  577. if (typeof selector !== "string" || !selector ||
  578. nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
  579. return results;
  580. }
  581. // Try to shortcut find operations (as opposed to filters) in HTML documents
  582. if (!seed) {
  583. if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
  584. setDocument(context);
  585. }
  586. context = context || document;
  587. if (documentIsHTML) {
  588. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  589. // (excepting DocumentFragment context, where the methods don't exist)
  590. if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
  591. // ID selector
  592. if ((m = match[1])) {
  593. // Document context
  594. if (nodeType === 9) {
  595. if ((elem = context.getElementById(m))) {
  596. // Support: IE, Opera, Webkit
  597. // TODO: identify versions
  598. // getElementById can match elements by name instead of ID
  599. if (elem.id === m) {
  600. results.push(elem);
  601. return results;
  602. }
  603. } else {
  604. return results;
  605. }
  606. // Element context
  607. } else {
  608. // Support: IE, Opera, Webkit
  609. // TODO: identify versions
  610. // getElementById can match elements by name instead of ID
  611. if (newContext && (elem = newContext.getElementById(m)) &&
  612. contains(context, elem) &&
  613. elem.id === m) {
  614. results.push(elem);
  615. return results;
  616. }
  617. }
  618. // Type selector
  619. } else if (match[2]) {
  620. push.apply(results, context.getElementsByTagName(selector));
  621. return results;
  622. // Class selector
  623. } else if ((m = match[3]) && support.getElementsByClassName &&
  624. context.getElementsByClassName) {
  625. push.apply(results, context.getElementsByClassName(m));
  626. return results;
  627. }
  628. }
  629. // Take advantage of querySelectorAll
  630. if (support.qsa &&
  631. !compilerCache[selector + " "] &&
  632. (!rbuggyQSA || !rbuggyQSA.test(selector))) {
  633. if (nodeType !== 1) {
  634. newContext = context;
  635. newSelector = selector;
  636. // qSA looks outside Element context, which is not what we want
  637. // Thanks to Andrew Dupont for this workaround technique
  638. // Support: IE <=8
  639. // Exclude object elements
  640. } else if (context.nodeName.toLowerCase() !== "object") {
  641. // Capture the context ID, setting it first if necessary
  642. if ((nid = context.getAttribute("id"))) {
  643. nid = nid.replace(rcssescape, fcssescape);
  644. } else {
  645. context.setAttribute("id", (nid = expando));
  646. }
  647. // Prefix every selector in the list
  648. groups = tokenize(selector);
  649. i = groups.length;
  650. while (i--) {
  651. groups[i] = "#" + nid + " " + toSelector(groups[i]);
  652. }
  653. newSelector = groups.join(",");
  654. // Expand context for sibling selectors
  655. newContext = rsibling.test(selector) && testContext(context.parentNode) ||
  656. context;
  657. }
  658. if (newSelector) {
  659. try {
  660. push.apply(results,
  661. newContext.querySelectorAll(newSelector)
  662. );
  663. return results;
  664. } catch (qsaError) {
  665. } finally {
  666. if (nid === expando) {
  667. context.removeAttribute("id");
  668. }
  669. }
  670. }
  671. }
  672. }
  673. }
  674. // All others
  675. return select(selector.replace(rtrim, "$1"), context, results, seed);
  676. }
  677. /**
  678. * Create key-value caches of limited size
  679. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  680. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  681. * deleting the oldest entry
  682. */
  683. function createCache() {
  684. var keys = [];
  685. function cache(key, value) {
  686. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  687. if (keys.push(key + " ") > Expr.cacheLength) {
  688. // Only keep the most recent entries
  689. delete cache[keys.shift()];
  690. }
  691. return (cache[key + " "] = value);
  692. }
  693. return cache;
  694. }
  695. /**
  696. * Mark a function for special use by Sizzle
  697. * @param {Function} fn The function to mark
  698. */
  699. function markFunction(fn) {
  700. fn[expando] = true;
  701. return fn;
  702. }
  703. /**
  704. * Support testing using an element
  705. * @param {Function} fn Passed the created element and returns a boolean result
  706. */
  707. function assert(fn) {
  708. var el = document.createElement("fieldset");
  709. try {
  710. return !!fn(el);
  711. } catch (e) {
  712. return false;
  713. } finally {
  714. // Remove from its parent by default
  715. if (el.parentNode) {
  716. el.parentNode.removeChild(el);
  717. }
  718. // release memory in IE
  719. el = null;
  720. }
  721. }
  722. /**
  723. * Adds the same handler for all of the specified attrs
  724. * @param {String} attrs Pipe-separated list of attributes
  725. * @param {Function} handler The method that will be applied
  726. */
  727. function addHandle(attrs, handler) {
  728. var arr = attrs.split("|"),
  729. i = arr.length;
  730. while (i--) {
  731. Expr.attrHandle[arr[i]] = handler;
  732. }
  733. }
  734. /**
  735. * Checks document order of two siblings
  736. * @param {Element} a
  737. * @param {Element} b
  738. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  739. */
  740. function siblingCheck(a, b) {
  741. var cur = b && a,
  742. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  743. a.sourceIndex - b.sourceIndex;
  744. // Use IE sourceIndex if available on both nodes
  745. if (diff) {
  746. return diff;
  747. }
  748. // Check if b follows a
  749. if (cur) {
  750. while ((cur = cur.nextSibling)) {
  751. if (cur === b) {
  752. return -1;
  753. }
  754. }
  755. }
  756. return a ? 1 : -1;
  757. }
  758. /**
  759. * Returns a function to use in pseudos for input types
  760. * @param {String} type
  761. */
  762. function createInputPseudo(type) {
  763. return function (elem) {
  764. var name = elem.nodeName.toLowerCase();
  765. return name === "input" && elem.type === type;
  766. };
  767. }
  768. /**
  769. * Returns a function to use in pseudos for buttons
  770. * @param {String} type
  771. */
  772. function createButtonPseudo(type) {
  773. return function (elem) {
  774. var name = elem.nodeName.toLowerCase();
  775. return (name === "input" || name === "button") && elem.type === type;
  776. };
  777. }
  778. /**
  779. * Returns a function to use in pseudos for :enabled/:disabled
  780. * @param {Boolean} disabled true for :disabled; false for :enabled
  781. */
  782. function createDisabledPseudo(disabled) {
  783. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  784. return function (elem) {
  785. // Only certain elements can match :enabled or :disabled
  786. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  787. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  788. if ("form" in elem) {
  789. // Check for inherited disabledness on relevant non-disabled elements:
  790. // * listed form-associated elements in a disabled fieldset
  791. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  792. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  793. // * option elements in a disabled optgroup
  794. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  795. // All such elements have a "form" property.
  796. if (elem.parentNode && elem.disabled === false) {
  797. // Option elements defer to a parent optgroup if present
  798. if ("label" in elem) {
  799. if ("label" in elem.parentNode) {
  800. return elem.parentNode.disabled === disabled;
  801. } else {
  802. return elem.disabled === disabled;
  803. }
  804. }
  805. // Support: IE 6 - 11
  806. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  807. return elem.isDisabled === disabled ||
  808. // Where there is no isDisabled, check manually
  809. /* jshint -W018 */
  810. elem.isDisabled !== !disabled &&
  811. disabledAncestor(elem) === disabled;
  812. }
  813. return elem.disabled === disabled;
  814. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  815. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  816. // even exist on them, let alone have a boolean value.
  817. } else if ("label" in elem) {
  818. return elem.disabled === disabled;
  819. }
  820. // Remaining elements are neither :enabled nor :disabled
  821. return false;
  822. };
  823. }
  824. /**
  825. * Returns a function to use in pseudos for positionals
  826. * @param {Function} fn
  827. */
  828. function createPositionalPseudo(fn) {
  829. return markFunction(function (argument) {
  830. argument = +argument;
  831. return markFunction(function (seed, matches) {
  832. var j,
  833. matchIndexes = fn([], seed.length, argument),
  834. i = matchIndexes.length;
  835. // Match elements found at the specified indexes
  836. while (i--) {
  837. if (seed[(j = matchIndexes[i])]) {
  838. seed[j] = !(matches[j] = seed[j]);
  839. }
  840. }
  841. });
  842. });
  843. }
  844. /**
  845. * Checks a node for validity as a Sizzle context
  846. * @param {Element|Object=} context
  847. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  848. */
  849. function testContext(context) {
  850. return context && typeof context.getElementsByTagName !== "undefined" && context;
  851. }
  852. // Expose support vars for convenience
  853. support = Sizzle.support = {};
  854. /**
  855. * Detects XML nodes
  856. * @param {Element|Object} elem An element or a document
  857. * @returns {Boolean} True iff elem is a non-HTML XML node
  858. */
  859. isXML = Sizzle.isXML = function (elem) {
  860. // documentElement is verified for cases where it doesn't yet exist
  861. // (such as loading iframes in IE - #4833)
  862. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  863. return documentElement ? documentElement.nodeName !== "HTML" : false;
  864. };
  865. /**
  866. * Sets document-related variables once based on the current document
  867. * @param {Element|Object} [doc] An element or document object to use to set the document
  868. * @returns {Object} Returns the current document
  869. */
  870. setDocument = Sizzle.setDocument = function (node) {
  871. var hasCompare, subWindow,
  872. doc = node ? node.ownerDocument || node : preferredDoc;
  873. // Return early if doc is invalid or already selected
  874. if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
  875. return document;
  876. }
  877. // Update global variables
  878. document = doc;
  879. docElem = document.documentElement;
  880. documentIsHTML = !isXML(document);
  881. // Support: IE 9-11, Edge
  882. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  883. if (preferredDoc !== document &&
  884. (subWindow = document.defaultView) && subWindow.top !== subWindow) {
  885. // Support: IE 11, Edge
  886. if (subWindow.addEventListener) {
  887. subWindow.addEventListener("unload", unloadHandler, false);
  888. // Support: IE 9 - 10 only
  889. } else if (subWindow.attachEvent) {
  890. subWindow.attachEvent("onunload", unloadHandler);
  891. }
  892. }
  893. /* Attributes
  894. ---------------------------------------------------------------------- */
  895. // Support: IE<8
  896. // Verify that getAttribute really returns attributes and not properties
  897. // (excepting IE8 booleans)
  898. support.attributes = assert(function (el) {
  899. el.className = "i";
  900. return !el.getAttribute("className");
  901. });
  902. /* getElement(s)By*
  903. ---------------------------------------------------------------------- */
  904. // Check if getElementsByTagName("*") returns only elements
  905. support.getElementsByTagName = assert(function (el) {
  906. el.appendChild(document.createComment(""));
  907. return !el.getElementsByTagName("*").length;
  908. });
  909. // Support: IE<9
  910. support.getElementsByClassName = rnative.test(document.getElementsByClassName);
  911. // Support: IE<10
  912. // Check if getElementById returns elements by name
  913. // The broken getElementById methods don't pick up programmatically-set names,
  914. // so use a roundabout getElementsByName test
  915. support.getById = assert(function (el) {
  916. docElem.appendChild(el).id = expando;
  917. return !document.getElementsByName || !document.getElementsByName(expando).length;
  918. });
  919. // ID filter and find
  920. if (support.getById) {
  921. Expr.filter["ID"] = function (id) {
  922. var attrId = id.replace(runescape, funescape);
  923. return function (elem) {
  924. return elem.getAttribute("id") === attrId;
  925. };
  926. };
  927. Expr.find["ID"] = function (id, context) {
  928. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  929. var elem = context.getElementById(id);
  930. return elem ? [elem] : [];
  931. }
  932. };
  933. } else {
  934. Expr.filter["ID"] = function (id) {
  935. var attrId = id.replace(runescape, funescape);
  936. return function (elem) {
  937. var node = typeof elem.getAttributeNode !== "undefined" &&
  938. elem.getAttributeNode("id");
  939. return node && node.value === attrId;
  940. };
  941. };
  942. // Support: IE 6 - 7 only
  943. // getElementById is not reliable as a find shortcut
  944. Expr.find["ID"] = function (id, context) {
  945. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  946. var node, i, elems,
  947. elem = context.getElementById(id);
  948. if (elem) {
  949. // Verify the id attribute
  950. node = elem.getAttributeNode("id");
  951. if (node && node.value === id) {
  952. return [elem];
  953. }
  954. // Fall back on getElementsByName
  955. elems = context.getElementsByName(id);
  956. i = 0;
  957. while ((elem = elems[i++])) {
  958. node = elem.getAttributeNode("id");
  959. if (node && node.value === id) {
  960. return [elem];
  961. }
  962. }
  963. }
  964. return [];
  965. }
  966. };
  967. }
  968. // Tag
  969. Expr.find["TAG"] = support.getElementsByTagName ?
  970. function (tag, context) {
  971. if (typeof context.getElementsByTagName !== "undefined") {
  972. return context.getElementsByTagName(tag);
  973. // DocumentFragment nodes don't have gEBTN
  974. } else if (support.qsa) {
  975. return context.querySelectorAll(tag);
  976. }
  977. } :
  978. function (tag, context) {
  979. var elem,
  980. tmp = [],
  981. i = 0,
  982. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  983. results = context.getElementsByTagName(tag);
  984. // Filter out possible comments
  985. if (tag === "*") {
  986. while ((elem = results[i++])) {
  987. if (elem.nodeType === 1) {
  988. tmp.push(elem);
  989. }
  990. }
  991. return tmp;
  992. }
  993. return results;
  994. };
  995. // Class
  996. Expr.find["CLASS"] = support.getElementsByClassName && function (className, context) {
  997. if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
  998. return context.getElementsByClassName(className);
  999. }
  1000. };
  1001. /* QSA/matchesSelector
  1002. ---------------------------------------------------------------------- */
  1003. // QSA and matchesSelector support
  1004. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  1005. rbuggyMatches = [];
  1006. // qSa(:focus) reports false when true (Chrome 21)
  1007. // We allow this because of a bug in IE8/9 that throws an error
  1008. // whenever `document.activeElement` is accessed on an iframe
  1009. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  1010. // See https://bugs.jquery.com/ticket/13378
  1011. rbuggyQSA = [];
  1012. if ((support.qsa = rnative.test(document.querySelectorAll))) {
  1013. // Build QSA regex
  1014. // Regex strategy adopted from Diego Perini
  1015. assert(function (el) {
  1016. // Select is set to empty string on purpose
  1017. // This is to test IE's treatment of not explicitly
  1018. // setting a boolean content attribute,
  1019. // since its presence should be enough
  1020. // https://bugs.jquery.com/ticket/12359
  1021. docElem.appendChild(el).innerHTML = "<a id='" + expando + "'></a>" +
  1022. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  1023. "<option selected=''></option></select>";
  1024. // Support: IE8, Opera 11-12.16
  1025. // Nothing should be selected when empty strings follow ^= or $= or *=
  1026. // The test attribute must be unknown in Opera but "safe" for WinRT
  1027. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  1028. if (el.querySelectorAll("[msallowcapture^='']").length) {
  1029. rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")");
  1030. }
  1031. // Support: IE8
  1032. // Boolean attributes and "value" are not treated correctly
  1033. if (!el.querySelectorAll("[selected]").length) {
  1034. rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
  1035. }
  1036. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  1037. if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
  1038. rbuggyQSA.push("~=");
  1039. }
  1040. // Webkit/Opera - :checked should return selected option elements
  1041. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1042. // IE8 throws error here and will not see later tests
  1043. if (!el.querySelectorAll(":checked").length) {
  1044. rbuggyQSA.push(":checked");
  1045. }
  1046. // Support: Safari 8+, iOS 8+
  1047. // https://bugs.webkit.org/show_bug.cgi?id=136851
  1048. // In-page `selector#id sibling-combinator selector` fails
  1049. if (!el.querySelectorAll("a#" + expando + "+*").length) {
  1050. rbuggyQSA.push(".#.+[+~]");
  1051. }
  1052. });
  1053. assert(function (el) {
  1054. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  1055. "<select disabled='disabled'><option/></select>";
  1056. // Support: Windows 8 Native Apps
  1057. // The type and name attributes are restricted during .innerHTML assignment
  1058. var input = document.createElement("input");
  1059. input.setAttribute("type", "hidden");
  1060. el.appendChild(input).setAttribute("name", "D");
  1061. // Support: IE8
  1062. // Enforce case-sensitivity of name attribute
  1063. if (el.querySelectorAll("[name=d]").length) {
  1064. rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=");
  1065. }
  1066. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  1067. // IE8 throws error here and will not see later tests
  1068. if (el.querySelectorAll(":enabled").length !== 2) {
  1069. rbuggyQSA.push(":enabled", ":disabled");
  1070. }
  1071. // Support: IE9-11+
  1072. // IE's :disabled selector does not pick up the children of disabled fieldsets
  1073. docElem.appendChild(el).disabled = true;
  1074. if (el.querySelectorAll(":disabled").length !== 2) {
  1075. rbuggyQSA.push(":enabled", ":disabled");
  1076. }
  1077. // Opera 10-11 does not throw on post-comma invalid pseudos
  1078. el.querySelectorAll("*,:x");
  1079. rbuggyQSA.push(",.*:");
  1080. });
  1081. }
  1082. if ((support.matchesSelector = rnative.test((matches = docElem.matches ||
  1083. docElem.webkitMatchesSelector ||
  1084. docElem.mozMatchesSelector ||
  1085. docElem.oMatchesSelector ||
  1086. docElem.msMatchesSelector)))) {
  1087. assert(function (el) {
  1088. // Check to see if it's possible to do matchesSelector
  1089. // on a disconnected node (IE 9)
  1090. support.disconnectedMatch = matches.call(el, "*");
  1091. // This should fail with an exception
  1092. // Gecko does not error, returns false instead
  1093. matches.call(el, "[s!='']:x");
  1094. rbuggyMatches.push("!=", pseudos);
  1095. });
  1096. }
  1097. rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
  1098. rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
  1099. /* Contains
  1100. ---------------------------------------------------------------------- */
  1101. hasCompare = rnative.test(docElem.compareDocumentPosition);
  1102. // Element contains another
  1103. // Purposefully self-exclusive
  1104. // As in, an element does not contain itself
  1105. contains = hasCompare || rnative.test(docElem.contains) ?
  1106. function (a, b) {
  1107. var adown = a.nodeType === 9 ? a.documentElement : a,
  1108. bup = b && b.parentNode;
  1109. return a === bup || !!(bup && bup.nodeType === 1 && (
  1110. adown.contains ?
  1111. adown.contains(bup) :
  1112. a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16
  1113. ));
  1114. } :
  1115. function (a, b) {
  1116. if (b) {
  1117. while ((b = b.parentNode)) {
  1118. if (b === a) {
  1119. return true;
  1120. }
  1121. }
  1122. }
  1123. return false;
  1124. };
  1125. /* Sorting
  1126. ---------------------------------------------------------------------- */
  1127. // Document order sorting
  1128. sortOrder = hasCompare ?
  1129. function (a, b) {
  1130. // Flag for duplicate removal
  1131. if (a === b) {
  1132. hasDuplicate = true;
  1133. return 0;
  1134. }
  1135. // Sort on method existence if only one input has compareDocumentPosition
  1136. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  1137. if (compare) {
  1138. return compare;
  1139. }
  1140. // Calculate position if both inputs belong to the same document
  1141. compare = (a.ownerDocument || a) === (b.ownerDocument || b) ?
  1142. a.compareDocumentPosition(b) :
  1143. // Otherwise we know they are disconnected
  1144. 1;
  1145. // Disconnected nodes
  1146. if (compare & 1 ||
  1147. (!support.sortDetached && b.compareDocumentPosition(a) === compare)) {
  1148. // Choose the first element that is related to our preferred document
  1149. if (a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
  1150. return -1;
  1151. }
  1152. if (b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
  1153. return 1;
  1154. }
  1155. // Maintain original order
  1156. return sortInput ?
  1157. (indexOf(sortInput, a) - indexOf(sortInput, b)) :
  1158. 0;
  1159. }
  1160. return compare & 4 ? -1 : 1;
  1161. } :
  1162. function (a, b) {
  1163. // Exit early if the nodes are identical
  1164. if (a === b) {
  1165. hasDuplicate = true;
  1166. return 0;
  1167. }
  1168. var cur,
  1169. i = 0,
  1170. aup = a.parentNode,
  1171. bup = b.parentNode,
  1172. ap = [a],
  1173. bp = [b];
  1174. // Parentless nodes are either documents or disconnected
  1175. if (!aup || !bup) {
  1176. return a === document ? -1 :
  1177. b === document ? 1 :
  1178. aup ? -1 :
  1179. bup ? 1 :
  1180. sortInput ?
  1181. (indexOf(sortInput, a) - indexOf(sortInput, b)) :
  1182. 0;
  1183. // If the nodes are siblings, we can do a quick check
  1184. } else if (aup === bup) {
  1185. return siblingCheck(a, b);
  1186. }
  1187. // Otherwise we need full lists of their ancestors for comparison
  1188. cur = a;
  1189. while ((cur = cur.parentNode)) {
  1190. ap.unshift(cur);
  1191. }
  1192. cur = b;
  1193. while ((cur = cur.parentNode)) {
  1194. bp.unshift(cur);
  1195. }
  1196. // Walk down the tree looking for a discrepancy
  1197. while (ap[i] === bp[i]) {
  1198. i++;
  1199. }
  1200. return i ?
  1201. // Do a sibling check if the nodes have a common ancestor
  1202. siblingCheck(ap[i], bp[i]) :
  1203. // Otherwise nodes in our document sort first
  1204. ap[i] === preferredDoc ? -1 :
  1205. bp[i] === preferredDoc ? 1 :
  1206. 0;
  1207. };
  1208. return document;
  1209. };
  1210. Sizzle.matches = function (expr, elements) {
  1211. return Sizzle(expr, null, null, elements);
  1212. };
  1213. Sizzle.matchesSelector = function (elem, expr) {
  1214. // Set document vars if needed
  1215. if ((elem.ownerDocument || elem) !== document) {
  1216. setDocument(elem);
  1217. }
  1218. // Make sure that attribute selectors are quoted
  1219. expr = expr.replace(rattributeQuotes, "='$1']");
  1220. if (support.matchesSelector && documentIsHTML &&
  1221. !compilerCache[expr + " "] &&
  1222. (!rbuggyMatches || !rbuggyMatches.test(expr)) &&
  1223. (!rbuggyQSA || !rbuggyQSA.test(expr))) {
  1224. try {
  1225. var ret = matches.call(elem, expr);
  1226. // IE 9's matchesSelector returns false on disconnected nodes
  1227. if (ret || support.disconnectedMatch ||
  1228. // As well, disconnected nodes are said to be in a document
  1229. // fragment in IE 9
  1230. elem.document && elem.document.nodeType !== 11) {
  1231. return ret;
  1232. }
  1233. } catch (e) { }
  1234. }
  1235. return Sizzle(expr, document, null, [elem]).length > 0;
  1236. };
  1237. Sizzle.contains = function (context, elem) {
  1238. // Set document vars if needed
  1239. if ((context.ownerDocument || context) !== document) {
  1240. setDocument(context);
  1241. }
  1242. return contains(context, elem);
  1243. };
  1244. Sizzle.attr = function (elem, name) {
  1245. // Set document vars if needed
  1246. if ((elem.ownerDocument || elem) !== document) {
  1247. setDocument(elem);
  1248. }
  1249. var fn = Expr.attrHandle[name.toLowerCase()],
  1250. // Don't get fooled by Object.prototype properties (jQuery #13807)
  1251. val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ?
  1252. fn(elem, name, !documentIsHTML) :
  1253. undefined;
  1254. return val !== undefined ?
  1255. val :
  1256. support.attributes || !documentIsHTML ?
  1257. elem.getAttribute(name) :
  1258. (val = elem.getAttributeNode(name)) && val.specified ?
  1259. val.value :
  1260. null;
  1261. };
  1262. Sizzle.escape = function (sel) {
  1263. return (sel + "").replace(rcssescape, fcssescape);
  1264. };
  1265. Sizzle.error = function (msg) {
  1266. throw new Error("Syntax error, unrecognized expression: " + msg);
  1267. };
  1268. Sizzle.uniqueSort = function (results) {
  1269. var elem,
  1270. duplicates = [],
  1271. j = 0,
  1272. i = 0;
  1273. // Unless we *know* we can detect duplicates, assume their presence
  1274. hasDuplicate = !support.detectDuplicates;
  1275. sortInput = !support.sortStable && results.slice(0);
  1276. results.sort(sortOrder);
  1277. if (hasDuplicate) {
  1278. while ((elem = results[i++])) {
  1279. if (elem === results[i]) {
  1280. j = duplicates.push(i);
  1281. }
  1282. }
  1283. while (j--) {
  1284. results.splice(duplicates[j], 1);
  1285. }
  1286. }
  1287. // Clear input after sorting to release objects
  1288. // See https://github.com/jquery/sizzle/pull/225
  1289. sortInput = null;
  1290. return results;
  1291. };
  1292. /**
  1293. * Utility function for retrieving the text value of an array of DOM nodes
  1294. * @param {Array|Element} elem
  1295. */
  1296. getText = Sizzle.getText = function (elem) {
  1297. var node,
  1298. ret = "",
  1299. i = 0,
  1300. nodeType = elem.nodeType;
  1301. if (!nodeType) {
  1302. // If no nodeType, this is expected to be an array
  1303. while ((node = elem[i++])) {
  1304. // Do not traverse comment nodes
  1305. ret += getText(node);
  1306. }
  1307. } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
  1308. // Use textContent for elements
  1309. // innerText usage removed for consistency of new lines (jQuery #11153)
  1310. if (typeof elem.textContent === "string") {
  1311. return elem.textContent;
  1312. } else {
  1313. // Traverse its children
  1314. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  1315. ret += getText(elem);
  1316. }
  1317. }
  1318. } else if (nodeType === 3 || nodeType === 4) {
  1319. return elem.nodeValue;
  1320. }
  1321. // Do not include comment or processing instruction nodes
  1322. return ret;
  1323. };
  1324. Expr = Sizzle.selectors = {
  1325. // Can be adjusted by the user
  1326. cacheLength: 50,
  1327. createPseudo: markFunction,
  1328. match: matchExpr,
  1329. attrHandle: {},
  1330. find: {},
  1331. relative: {
  1332. ">": { dir: "parentNode", first: true },
  1333. " ": { dir: "parentNode" },
  1334. "+": { dir: "previousSibling", first: true },
  1335. "~": { dir: "previousSibling" }
  1336. },
  1337. preFilter: {
  1338. "ATTR": function (match) {
  1339. match[1] = match[1].replace(runescape, funescape);
  1340. // Move the given value to match[3] whether quoted or unquoted
  1341. match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
  1342. if (match[2] === "~=") {
  1343. match[3] = " " + match[3] + " ";
  1344. }
  1345. return match.slice(0, 4);
  1346. },
  1347. "CHILD": function (match) {
  1348. /* matches from matchExpr["CHILD"]
  1349. 1 type (only|nth|...)
  1350. 2 what (child|of-type)
  1351. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  1352. 4 xn-component of xn+y argument ([+-]?\d*n|)
  1353. 5 sign of xn-component
  1354. 6 x of xn-component
  1355. 7 sign of y-component
  1356. 8 y of y-component
  1357. */
  1358. match[1] = match[1].toLowerCase();
  1359. if (match[1].slice(0, 3) === "nth") {
  1360. // nth-* requires argument
  1361. if (!match[3]) {
  1362. Sizzle.error(match[0]);
  1363. }
  1364. // numeric x and y parameters for Expr.filter.CHILD
  1365. // remember that false/true cast respectively to 0/1
  1366. match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
  1367. match[5] = +((match[7] + match[8]) || match[3] === "odd");
  1368. // other types prohibit arguments
  1369. } else if (match[3]) {
  1370. Sizzle.error(match[0]);
  1371. }
  1372. return match;
  1373. },
  1374. "PSEUDO": function (match) {
  1375. var excess,
  1376. unquoted = !match[6] && match[2];
  1377. if (matchExpr["CHILD"].test(match[0])) {
  1378. return null;
  1379. }
  1380. // Accept quoted arguments as-is
  1381. if (match[3]) {
  1382. match[2] = match[4] || match[5] || "";
  1383. // Strip excess characters from unquoted arguments
  1384. } else if (unquoted && rpseudo.test(unquoted) &&
  1385. // Get excess from tokenize (recursively)
  1386. (excess = tokenize(unquoted, true)) &&
  1387. // advance to the next closing parenthesis
  1388. (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
  1389. // excess is a negative index
  1390. match[0] = match[0].slice(0, excess);
  1391. match[2] = unquoted.slice(0, excess);
  1392. }
  1393. // Return only captures needed by the pseudo filter method (type and argument)
  1394. return match.slice(0, 3);
  1395. }
  1396. },
  1397. filter: {
  1398. "TAG": function (nodeNameSelector) {
  1399. var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
  1400. return nodeNameSelector === "*" ?
  1401. function () { return true; } :
  1402. function (elem) {
  1403. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  1404. };
  1405. },
  1406. "CLASS": function (className) {
  1407. var pattern = classCache[className + " "];
  1408. return pattern ||
  1409. (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) &&
  1410. classCache(className, function (elem) {
  1411. return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "");
  1412. });
  1413. },
  1414. "ATTR": function (name, operator, check) {
  1415. return function (elem) {
  1416. var result = Sizzle.attr(elem, name);
  1417. if (result == null) {
  1418. return operator === "!=";
  1419. }
  1420. if (!operator) {
  1421. return true;
  1422. }
  1423. result += "";
  1424. return operator === "=" ? result === check :
  1425. operator === "!=" ? result !== check :
  1426. operator === "^=" ? check && result.indexOf(check) === 0 :
  1427. operator === "*=" ? check && result.indexOf(check) > -1 :
  1428. operator === "$=" ? check && result.slice(-check.length) === check :
  1429. operator === "~=" ? (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1 :
  1430. operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" :
  1431. false;
  1432. };
  1433. },
  1434. "CHILD": function (type, what, argument, first, last) {
  1435. var simple = type.slice(0, 3) !== "nth",
  1436. forward = type.slice(-4) !== "last",
  1437. ofType = what === "of-type";
  1438. return first === 1 && last === 0 ?
  1439. // Shortcut for :nth-*(n)
  1440. function (elem) {
  1441. return !!elem.parentNode;
  1442. } :
  1443. function (elem, context, xml) {
  1444. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  1445. dir = simple !== forward ? "nextSibling" : "previousSibling",
  1446. parent = elem.parentNode,
  1447. name = ofType && elem.nodeName.toLowerCase(),
  1448. useCache = !xml && !ofType,
  1449. diff = false;
  1450. if (parent) {
  1451. // :(first|last|only)-(child|of-type)
  1452. if (simple) {
  1453. while (dir) {
  1454. node = elem;
  1455. while ((node = node[dir])) {
  1456. if (ofType ?
  1457. node.nodeName.toLowerCase() === name :
  1458. node.nodeType === 1) {
  1459. return false;
  1460. }
  1461. }
  1462. // Reverse direction for :only-* (if we haven't yet done so)
  1463. start = dir = type === "only" && !start && "nextSibling";
  1464. }
  1465. return true;
  1466. }
  1467. start = [forward ? parent.firstChild : parent.lastChild];
  1468. // non-xml :nth-child(...) stores cache data on `parent`
  1469. if (forward && useCache) {
  1470. // Seek `elem` from a previously-cached index
  1471. // ...in a gzip-friendly way
  1472. node = parent;
  1473. outerCache = node[expando] || (node[expando] = {});
  1474. // Support: IE <9 only
  1475. // Defend against cloned attroperties (jQuery gh-1709)
  1476. uniqueCache = outerCache[node.uniqueID] ||
  1477. (outerCache[node.uniqueID] = {});
  1478. cache = uniqueCache[type] || [];
  1479. nodeIndex = cache[0] === dirruns && cache[1];
  1480. diff = nodeIndex && cache[2];
  1481. node = nodeIndex && parent.childNodes[nodeIndex];
  1482. while ((node = ++nodeIndex && node && node[dir] ||
  1483. // Fallback to seeking `elem` from the start
  1484. (diff = nodeIndex = 0) || start.pop())) {
  1485. // When found, cache indexes on `parent` and break
  1486. if (node.nodeType === 1 && ++diff && node === elem) {
  1487. uniqueCache[type] = [dirruns, nodeIndex, diff];
  1488. break;
  1489. }
  1490. }
  1491. } else {
  1492. // Use previously-cached element index if available
  1493. if (useCache) {
  1494. // ...in a gzip-friendly way
  1495. node = elem;
  1496. outerCache = node[expando] || (node[expando] = {});
  1497. // Support: IE <9 only
  1498. // Defend against cloned attroperties (jQuery gh-1709)
  1499. uniqueCache = outerCache[node.uniqueID] ||
  1500. (outerCache[node.uniqueID] = {});
  1501. cache = uniqueCache[type] || [];
  1502. nodeIndex = cache[0] === dirruns && cache[1];
  1503. diff = nodeIndex;
  1504. }
  1505. // xml :nth-child(...)
  1506. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  1507. if (diff === false) {
  1508. // Use the same loop as above to seek `elem` from the start
  1509. while ((node = ++nodeIndex && node && node[dir] ||
  1510. (diff = nodeIndex = 0) || start.pop())) {
  1511. if ((ofType ?
  1512. node.nodeName.toLowerCase() === name :
  1513. node.nodeType === 1) &&
  1514. ++diff) {
  1515. // Cache the index of each encountered element
  1516. if (useCache) {
  1517. outerCache = node[expando] || (node[expando] = {});
  1518. // Support: IE <9 only
  1519. // Defend against cloned attroperties (jQuery gh-1709)
  1520. uniqueCache = outerCache[node.uniqueID] ||
  1521. (outerCache[node.uniqueID] = {});
  1522. uniqueCache[type] = [dirruns, diff];
  1523. }
  1524. if (node === elem) {
  1525. break;
  1526. }
  1527. }
  1528. }
  1529. }
  1530. }
  1531. // Incorporate the offset, then check against cycle size
  1532. diff -= last;
  1533. return diff === first || (diff % first === 0 && diff / first >= 0);
  1534. }
  1535. };
  1536. },
  1537. "PSEUDO": function (pseudo, argument) {
  1538. // pseudo-class names are case-insensitive
  1539. // http://www.w3.org/TR/selectors/#pseudo-classes
  1540. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  1541. // Remember that setFilters inherits from pseudos
  1542. var args,
  1543. fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] ||
  1544. Sizzle.error("unsupported pseudo: " + pseudo);
  1545. // The user may use createPseudo to indicate that
  1546. // arguments are needed to create the filter function
  1547. // just as Sizzle does
  1548. if (fn[expando]) {
  1549. return fn(argument);
  1550. }
  1551. // But maintain support for old signatures
  1552. if (fn.length > 1) {
  1553. args = [pseudo, pseudo, "", argument];
  1554. return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ?
  1555. markFunction(function (seed, matches) {
  1556. var idx,
  1557. matched = fn(seed, argument),
  1558. i = matched.length;
  1559. while (i--) {
  1560. idx = indexOf(seed, matched[i]);
  1561. seed[idx] = !(matches[idx] = matched[i]);
  1562. }
  1563. }) :
  1564. function (elem) {
  1565. return fn(elem, 0, args);
  1566. };
  1567. }
  1568. return fn;
  1569. }
  1570. },
  1571. pseudos: {
  1572. // Potentially complex pseudos
  1573. "not": markFunction(function (selector) {
  1574. // Trim the selector passed to compile
  1575. // to avoid treating leading and trailing
  1576. // spaces as combinators
  1577. var input = [],
  1578. results = [],
  1579. matcher = compile(selector.replace(rtrim, "$1"));
  1580. return matcher[expando] ?
  1581. markFunction(function (seed, matches, context, xml) {
  1582. var elem,
  1583. unmatched = matcher(seed, null, xml, []),
  1584. i = seed.length;
  1585. // Match elements unmatched by `matcher`
  1586. while (i--) {
  1587. if ((elem = unmatched[i])) {
  1588. seed[i] = !(matches[i] = elem);
  1589. }
  1590. }
  1591. }) :
  1592. function (elem, context, xml) {
  1593. input[0] = elem;
  1594. matcher(input, null, xml, results);
  1595. // Don't keep the element (issue #299)
  1596. input[0] = null;
  1597. return !results.pop();
  1598. };
  1599. }),
  1600. "has": markFunction(function (selector) {
  1601. return function (elem) {
  1602. return Sizzle(selector, elem).length > 0;
  1603. };
  1604. }),
  1605. "contains": markFunction(function (text) {
  1606. text = text.replace(runescape, funescape);
  1607. return function (elem) {
  1608. return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;
  1609. };
  1610. }),
  1611. // "Whether an element is represented by a :lang() selector
  1612. // is based solely on the element's language value
  1613. // being equal to the identifier C,
  1614. // or beginning with the identifier C immediately followed by "-".
  1615. // The matching of C against the element's language value is performed case-insensitively.
  1616. // The identifier C does not have to be a valid language name."
  1617. // http://www.w3.org/TR/selectors/#lang-pseudo
  1618. "lang": markFunction(function (lang) {
  1619. // lang value must be a valid identifier
  1620. if (!ridentifier.test(lang || "")) {
  1621. Sizzle.error("unsupported lang: " + lang);
  1622. }
  1623. lang = lang.replace(runescape, funescape).toLowerCase();
  1624. return function (elem) {
  1625. var elemLang;
  1626. do {
  1627. if ((elemLang = documentIsHTML ?
  1628. elem.lang :
  1629. elem.getAttribute("xml:lang") || elem.getAttribute("lang"))) {
  1630. elemLang = elemLang.toLowerCase();
  1631. return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
  1632. }
  1633. } while ((elem = elem.parentNode) && elem.nodeType === 1);
  1634. return false;
  1635. };
  1636. }),
  1637. // Miscellaneous
  1638. "target": function (elem) {
  1639. var hash = window.location && window.location.hash;
  1640. return hash && hash.slice(1) === elem.id;
  1641. },
  1642. "root": function (elem) {
  1643. return elem === docElem;
  1644. },
  1645. "focus": function (elem) {
  1646. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  1647. },
  1648. // Boolean properties
  1649. "enabled": createDisabledPseudo(false),
  1650. "disabled": createDisabledPseudo(true),
  1651. "checked": function (elem) {
  1652. // In CSS3, :checked should return both checked and selected elements
  1653. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  1654. var nodeName = elem.nodeName.toLowerCase();
  1655. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  1656. },
  1657. "selected": function (elem) {
  1658. // Accessing this property makes selected-by-default
  1659. // options in Safari work properly
  1660. if (elem.parentNode) {
  1661. elem.parentNode.selectedIndex;
  1662. }
  1663. return elem.selected === true;
  1664. },
  1665. // Contents
  1666. "empty": function (elem) {
  1667. // http://www.w3.org/TR/selectors/#empty-pseudo
  1668. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  1669. // but not by others (comment: 8; processing instruction: 7; etc.)
  1670. // nodeType < 6 works because attributes (2) do not appear as children
  1671. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  1672. if (elem.nodeType < 6) {
  1673. return false;
  1674. }
  1675. }
  1676. return true;
  1677. },
  1678. "parent": function (elem) {
  1679. return !Expr.pseudos["empty"](elem);
  1680. },
  1681. // Element/input types
  1682. "header": function (elem) {
  1683. return rheader.test(elem.nodeName);
  1684. },
  1685. "input": function (elem) {
  1686. return rinputs.test(elem.nodeName);
  1687. },
  1688. "button": function (elem) {
  1689. var name = elem.nodeName.toLowerCase();
  1690. return name === "input" && elem.type === "button" || name === "button";
  1691. },
  1692. "text": function (elem) {
  1693. var attr;
  1694. return elem.nodeName.toLowerCase() === "input" &&
  1695. elem.type === "text" &&
  1696. // Support: IE<8
  1697. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  1698. ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
  1699. },
  1700. // Position-in-collection
  1701. "first": createPositionalPseudo(function () {
  1702. return [0];
  1703. }),
  1704. "last": createPositionalPseudo(function (matchIndexes, length) {
  1705. return [length - 1];
  1706. }),
  1707. "eq": createPositionalPseudo(function (matchIndexes, length, argument) {
  1708. return [argument < 0 ? argument + length : argument];
  1709. }),
  1710. "even": createPositionalPseudo(function (matchIndexes, length) {
  1711. var i = 0;
  1712. for (; i < length; i += 2) {
  1713. matchIndexes.push(i);
  1714. }
  1715. return matchIndexes;
  1716. }),
  1717. "odd": createPositionalPseudo(function (matchIndexes, length) {
  1718. var i = 1;
  1719. for (; i < length; i += 2) {
  1720. matchIndexes.push(i);
  1721. }
  1722. return matchIndexes;
  1723. }),
  1724. "lt": createPositionalPseudo(function (matchIndexes, length, argument) {
  1725. var i = argument < 0 ? argument + length : argument;
  1726. for (; --i >= 0;) {
  1727. matchIndexes.push(i);
  1728. }
  1729. return matchIndexes;
  1730. }),
  1731. "gt": createPositionalPseudo(function (matchIndexes, length, argument) {
  1732. var i = argument < 0 ? argument + length : argument;
  1733. for (; ++i < length;) {
  1734. matchIndexes.push(i);
  1735. }
  1736. return matchIndexes;
  1737. })
  1738. }
  1739. };
  1740. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  1741. // Add button/input type pseudos
  1742. for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) {
  1743. Expr.pseudos[i] = createInputPseudo(i);
  1744. }
  1745. for (i in { submit: true, reset: true }) {
  1746. Expr.pseudos[i] = createButtonPseudo(i);
  1747. }
  1748. // Easy API for creating new setFilters
  1749. function setFilters() { }
  1750. setFilters.prototype = Expr.filters = Expr.pseudos;
  1751. Expr.setFilters = new setFilters();
  1752. tokenize = Sizzle.tokenize = function (selector, parseOnly) {
  1753. var matched, match, tokens, type,
  1754. soFar, groups, preFilters,
  1755. cached = tokenCache[selector + " "];
  1756. if (cached) {
  1757. return parseOnly ? 0 : cached.slice(0);
  1758. }
  1759. soFar = selector;
  1760. groups = [];
  1761. preFilters = Expr.preFilter;
  1762. while (soFar) {
  1763. // Comma and first run
  1764. if (!matched || (match = rcomma.exec(soFar))) {
  1765. if (match) {
  1766. // Don't consume trailing commas as valid
  1767. soFar = soFar.slice(match[0].length) || soFar;
  1768. }
  1769. groups.push((tokens = []));
  1770. }
  1771. matched = false;
  1772. // Combinators
  1773. if ((match = rcombinators.exec(soFar))) {
  1774. matched = match.shift();
  1775. tokens.push({
  1776. value: matched,
  1777. // Cast descendant combinators to space
  1778. type: match[0].replace(rtrim, " ")
  1779. });
  1780. soFar = soFar.slice(matched.length);
  1781. }
  1782. // Filters
  1783. for (type in Expr.filter) {
  1784. if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] ||
  1785. (match = preFilters[type](match)))) {
  1786. matched = match.shift();
  1787. tokens.push({
  1788. value: matched,
  1789. type: type,
  1790. matches: match
  1791. });
  1792. soFar = soFar.slice(matched.length);
  1793. }
  1794. }
  1795. if (!matched) {
  1796. break;
  1797. }
  1798. }
  1799. // Return the length of the invalid excess
  1800. // if we're just parsing
  1801. // Otherwise, throw an error or return tokens
  1802. return parseOnly ?
  1803. soFar.length :
  1804. soFar ?
  1805. Sizzle.error(selector) :
  1806. // Cache the tokens
  1807. tokenCache(selector, groups).slice(0);
  1808. };
  1809. function toSelector(tokens) {
  1810. var i = 0,
  1811. len = tokens.length,
  1812. selector = "";
  1813. for (; i < len; i++) {
  1814. selector += tokens[i].value;
  1815. }
  1816. return selector;
  1817. }
  1818. function addCombinator(matcher, combinator, base) {
  1819. var dir = combinator.dir,
  1820. skip = combinator.next,
  1821. key = skip || dir,
  1822. checkNonElements = base && key === "parentNode",
  1823. doneName = done++;
  1824. return combinator.first ?
  1825. // Check against closest ancestor/preceding element
  1826. function (elem, context, xml) {
  1827. while ((elem = elem[dir])) {
  1828. if (elem.nodeType === 1 || checkNonElements) {
  1829. return matcher(elem, context, xml);
  1830. }
  1831. }
  1832. return false;
  1833. } :
  1834. // Check against all ancestor/preceding elements
  1835. function (elem, context, xml) {
  1836. var oldCache, uniqueCache, outerCache,
  1837. newCache = [dirruns, doneName];
  1838. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  1839. if (xml) {
  1840. while ((elem = elem[dir])) {
  1841. if (elem.nodeType === 1 || checkNonElements) {
  1842. if (matcher(elem, context, xml)) {
  1843. return true;
  1844. }
  1845. }
  1846. }
  1847. } else {
  1848. while ((elem = elem[dir])) {
  1849. if (elem.nodeType === 1 || checkNonElements) {
  1850. outerCache = elem[expando] || (elem[expando] = {});
  1851. // Support: IE <9 only
  1852. // Defend against cloned attroperties (jQuery gh-1709)
  1853. uniqueCache = outerCache[elem.uniqueID] || (outerCache[elem.uniqueID] = {});
  1854. if (skip && skip === elem.nodeName.toLowerCase()) {
  1855. elem = elem[dir] || elem;
  1856. } else if ((oldCache = uniqueCache[key]) &&
  1857. oldCache[0] === dirruns && oldCache[1] === doneName) {
  1858. // Assign to newCache so results back-propagate to previous elements
  1859. return (newCache[2] = oldCache[2]);
  1860. } else {
  1861. // Reuse newcache so results back-propagate to previous elements
  1862. uniqueCache[key] = newCache;
  1863. // A match means we're done; a fail means we have to keep checking
  1864. if ((newCache[2] = matcher(elem, context, xml))) {
  1865. return true;
  1866. }
  1867. }
  1868. }
  1869. }
  1870. }
  1871. return false;
  1872. };
  1873. }
  1874. function elementMatcher(matchers) {
  1875. return matchers.length > 1 ?
  1876. function (elem, context, xml) {
  1877. var i = matchers.length;
  1878. while (i--) {
  1879. if (!matchers[i](elem, context, xml)) {
  1880. return false;
  1881. }
  1882. }
  1883. return true;
  1884. } :
  1885. matchers[0];
  1886. }
  1887. function multipleContexts(selector, contexts, results) {
  1888. var i = 0,
  1889. len = contexts.length;
  1890. for (; i < len; i++) {
  1891. Sizzle(selector, contexts[i], results);
  1892. }
  1893. return results;
  1894. }
  1895. function condense(unmatched, map, filter, context, xml) {
  1896. var elem,
  1897. newUnmatched = [],
  1898. i = 0,
  1899. len = unmatched.length,
  1900. mapped = map != null;
  1901. for (; i < len; i++) {
  1902. if ((elem = unmatched[i])) {
  1903. if (!filter || filter(elem, context, xml)) {
  1904. newUnmatched.push(elem);
  1905. if (mapped) {
  1906. map.push(i);
  1907. }
  1908. }
  1909. }
  1910. }
  1911. return newUnmatched;
  1912. }
  1913. function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
  1914. if (postFilter && !postFilter[expando]) {
  1915. postFilter = setMatcher(postFilter);
  1916. }
  1917. if (postFinder && !postFinder[expando]) {
  1918. postFinder = setMatcher(postFinder, postSelector);
  1919. }
  1920. return markFunction(function (seed, results, context, xml) {
  1921. var temp, i, elem,
  1922. preMap = [],
  1923. postMap = [],
  1924. preexisting = results.length,
  1925. // Get initial elements from seed or context
  1926. elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
  1927. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  1928. matcherIn = preFilter && (seed || !selector) ?
  1929. condense(elems, preMap, preFilter, context, xml) :
  1930. elems,
  1931. matcherOut = matcher ?
  1932. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  1933. postFinder || (seed ? preFilter : preexisting || postFilter) ?
  1934. // ...intermediate processing is necessary
  1935. [] :
  1936. // ...otherwise use results directly
  1937. results :
  1938. matcherIn;
  1939. // Find primary matches
  1940. if (matcher) {
  1941. matcher(matcherIn, matcherOut, context, xml);
  1942. }
  1943. // Apply postFilter
  1944. if (postFilter) {
  1945. temp = condense(matcherOut, postMap);
  1946. postFilter(temp, [], context, xml);
  1947. // Un-match failing elements by moving them back to matcherIn
  1948. i = temp.length;
  1949. while (i--) {
  1950. if ((elem = temp[i])) {
  1951. matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
  1952. }
  1953. }
  1954. }
  1955. if (seed) {
  1956. if (postFinder || preFilter) {
  1957. if (postFinder) {
  1958. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  1959. temp = [];
  1960. i = matcherOut.length;
  1961. while (i--) {
  1962. if ((elem = matcherOut[i])) {
  1963. // Restore matcherIn since elem is not yet a final match
  1964. temp.push((matcherIn[i] = elem));
  1965. }
  1966. }
  1967. postFinder(null, (matcherOut = []), temp, xml);
  1968. }
  1969. // Move matched elements from seed to results to keep them synchronized
  1970. i = matcherOut.length;
  1971. while (i--) {
  1972. if ((elem = matcherOut[i]) &&
  1973. (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
  1974. seed[temp] = !(results[temp] = elem);
  1975. }
  1976. }
  1977. }
  1978. // Add elements to results, through postFinder if defined
  1979. } else {
  1980. matcherOut = condense(
  1981. matcherOut === results ?
  1982. matcherOut.splice(preexisting, matcherOut.length) :
  1983. matcherOut
  1984. );
  1985. if (postFinder) {
  1986. postFinder(null, results, matcherOut, xml);
  1987. } else {
  1988. push.apply(results, matcherOut);
  1989. }
  1990. }
  1991. });
  1992. }
  1993. function matcherFromTokens(tokens) {
  1994. var checkContext, matcher, j,
  1995. len = tokens.length,
  1996. leadingRelative = Expr.relative[tokens[0].type],
  1997. implicitRelative = leadingRelative || Expr.relative[" "],
  1998. i = leadingRelative ? 1 : 0,
  1999. // The foundational matcher ensures that elements are reachable from top-level context(s)
  2000. matchContext = addCombinator(function (elem) {
  2001. return elem === checkContext;
  2002. }, implicitRelative, true),
  2003. matchAnyContext = addCombinator(function (elem) {
  2004. return indexOf(checkContext, elem) > -1;
  2005. }, implicitRelative, true),
  2006. matchers = [function (elem, context, xml) {
  2007. var ret = (!leadingRelative && (xml || context !== outermostContext)) || (
  2008. (checkContext = context).nodeType ?
  2009. matchContext(elem, context, xml) :
  2010. matchAnyContext(elem, context, xml));
  2011. // Avoid hanging onto element (issue #299)
  2012. checkContext = null;
  2013. return ret;
  2014. }];
  2015. for (; i < len; i++) {
  2016. if ((matcher = Expr.relative[tokens[i].type])) {
  2017. matchers = [addCombinator(elementMatcher(matchers), matcher)];
  2018. } else {
  2019. matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
  2020. // Return special upon seeing a positional matcher
  2021. if (matcher[expando]) {
  2022. // Find the next relative operator (if any) for proper handling
  2023. j = ++i;
  2024. for (; j < len; j++) {
  2025. if (Expr.relative[tokens[j].type]) {
  2026. break;
  2027. }
  2028. }
  2029. return setMatcher(
  2030. i > 1 && elementMatcher(matchers),
  2031. i > 1 && toSelector(
  2032. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  2033. tokens.slice(0, i - 1).concat({ value: tokens[i - 2].type === " " ? "*" : "" })
  2034. ).replace(rtrim, "$1"),
  2035. matcher,
  2036. i < j && matcherFromTokens(tokens.slice(i, j)),
  2037. j < len && matcherFromTokens((tokens = tokens.slice(j))),
  2038. j < len && toSelector(tokens)
  2039. );
  2040. }
  2041. matchers.push(matcher);
  2042. }
  2043. }
  2044. return elementMatcher(matchers);
  2045. }
  2046. function matcherFromGroupMatchers(elementMatchers, setMatchers) {
  2047. var bySet = setMatchers.length > 0,
  2048. byElement = elementMatchers.length > 0,
  2049. superMatcher = function (seed, context, xml, results, outermost) {
  2050. var elem, j, matcher,
  2051. matchedCount = 0,
  2052. i = "0",
  2053. unmatched = seed && [],
  2054. setMatched = [],
  2055. contextBackup = outermostContext,
  2056. // We must always have either seed elements or outermost context
  2057. elems = seed || byElement && Expr.find["TAG"]("*", outermost),
  2058. // Use integer dirruns iff this is the outermost matcher
  2059. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  2060. len = elems.length;
  2061. if (outermost) {
  2062. outermostContext = context === document || context || outermost;
  2063. }
  2064. // Add elements passing elementMatchers directly to results
  2065. // Support: IE<9, Safari
  2066. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  2067. for (; i !== len && (elem = elems[i]) != null; i++) {
  2068. if (byElement && elem) {
  2069. j = 0;
  2070. if (!context && elem.ownerDocument !== document) {
  2071. setDocument(elem);
  2072. xml = !documentIsHTML;
  2073. }
  2074. while ((matcher = elementMatchers[j++])) {
  2075. if (matcher(elem, context || document, xml)) {
  2076. results.push(elem);
  2077. break;
  2078. }
  2079. }
  2080. if (outermost) {
  2081. dirruns = dirrunsUnique;
  2082. }
  2083. }
  2084. // Track unmatched elements for set filters
  2085. if (bySet) {
  2086. // They will have gone through all possible matchers
  2087. if ((elem = !matcher && elem)) {
  2088. matchedCount--;
  2089. }
  2090. // Lengthen the array for every element, matched or not
  2091. if (seed) {
  2092. unmatched.push(elem);
  2093. }
  2094. }
  2095. }
  2096. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  2097. // makes the latter nonnegative.
  2098. matchedCount += i;
  2099. // Apply set filters to unmatched elements
  2100. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  2101. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  2102. // no element matchers and no seed.
  2103. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  2104. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  2105. // numerically zero.
  2106. if (bySet && i !== matchedCount) {
  2107. j = 0;
  2108. while ((matcher = setMatchers[j++])) {
  2109. matcher(unmatched, setMatched, context, xml);
  2110. }
  2111. if (seed) {
  2112. // Reintegrate element matches to eliminate the need for sorting
  2113. if (matchedCount > 0) {
  2114. while (i--) {
  2115. if (!(unmatched[i] || setMatched[i])) {
  2116. setMatched[i] = pop.call(results);
  2117. }
  2118. }
  2119. }
  2120. // Discard index placeholder values to get only actual matches
  2121. setMatched = condense(setMatched);
  2122. }
  2123. // Add matches to results
  2124. push.apply(results, setMatched);
  2125. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  2126. if (outermost && !seed && setMatched.length > 0 &&
  2127. (matchedCount + setMatchers.length) > 1) {
  2128. Sizzle.uniqueSort(results);
  2129. }
  2130. }
  2131. // Override manipulation of globals by nested matchers
  2132. if (outermost) {
  2133. dirruns = dirrunsUnique;
  2134. outermostContext = contextBackup;
  2135. }
  2136. return unmatched;
  2137. };
  2138. return bySet ?
  2139. markFunction(superMatcher) :
  2140. superMatcher;
  2141. }
  2142. compile = Sizzle.compile = function (selector, match /* Internal Use Only */) {
  2143. var i,
  2144. setMatchers = [],
  2145. elementMatchers = [],
  2146. cached = compilerCache[selector + " "];
  2147. if (!cached) {
  2148. // Generate a function of recursive functions that can be used to check each element
  2149. if (!match) {
  2150. match = tokenize(selector);
  2151. }
  2152. i = match.length;
  2153. while (i--) {
  2154. cached = matcherFromTokens(match[i]);
  2155. if (cached[expando]) {
  2156. setMatchers.push(cached);
  2157. } else {
  2158. elementMatchers.push(cached);
  2159. }
  2160. }
  2161. // Cache the compiled function
  2162. cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
  2163. // Save selector and tokenization
  2164. cached.selector = selector;
  2165. }
  2166. return cached;
  2167. };
  2168. /**
  2169. * A low-level selection function that works with Sizzle's compiled
  2170. * selector functions
  2171. * @param {String|Function} selector A selector or a pre-compiled
  2172. * selector function built with Sizzle.compile
  2173. * @param {Element} context
  2174. * @param {Array} [results]
  2175. * @param {Array} [seed] A set of elements to match against
  2176. */
  2177. select = Sizzle.select = function (selector, context, results, seed) {
  2178. var i, tokens, token, type, find,
  2179. compiled = typeof selector === "function" && selector,
  2180. match = !seed && tokenize((selector = compiled.selector || selector));
  2181. results = results || [];
  2182. // Try to minimize operations if there is only one selector in the list and no seed
  2183. // (the latter of which guarantees us context)
  2184. if (match.length === 1) {
  2185. // Reduce context if the leading compound selector is an ID
  2186. tokens = match[0] = match[0].slice(0);
  2187. if (tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  2188. context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
  2189. context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
  2190. if (!context) {
  2191. return results;
  2192. // Precompiled matchers will still verify ancestry, so step up a level
  2193. } else if (compiled) {
  2194. context = context.parentNode;
  2195. }
  2196. selector = selector.slice(tokens.shift().value.length);
  2197. }
  2198. // Fetch a seed set for right-to-left matching
  2199. i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
  2200. while (i--) {
  2201. token = tokens[i];
  2202. // Abort if we hit a combinator
  2203. if (Expr.relative[(type = token.type)]) {
  2204. break;
  2205. }
  2206. if ((find = Expr.find[type])) {
  2207. // Search, expanding context for leading sibling combinators
  2208. if ((seed = find(
  2209. token.matches[0].replace(runescape, funescape),
  2210. rsibling.test(tokens[0].type) && testContext(context.parentNode) || context
  2211. ))) {
  2212. // If seed is empty or no tokens remain, we can return early
  2213. tokens.splice(i, 1);
  2214. selector = seed.length && toSelector(tokens);
  2215. if (!selector) {
  2216. push.apply(results, seed);
  2217. return results;
  2218. }
  2219. break;
  2220. }
  2221. }
  2222. }
  2223. }
  2224. // Compile and execute a filtering function if one is not provided
  2225. // Provide `match` to avoid retokenization if we modified the selector above
  2226. (compiled || compile(selector, match))(
  2227. seed,
  2228. context,
  2229. !documentIsHTML,
  2230. results,
  2231. !context || rsibling.test(selector) && testContext(context.parentNode) || context
  2232. );
  2233. return results;
  2234. };
  2235. // One-time assignments
  2236. // Sort stability
  2237. support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
  2238. // Support: Chrome 14-35+
  2239. // Always assume duplicates if they aren't passed to the comparison function
  2240. support.detectDuplicates = !!hasDuplicate;
  2241. // Initialize against the default document
  2242. setDocument();
  2243. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  2244. // Detached nodes confoundingly follow *each other*
  2245. support.sortDetached = assert(function (el) {
  2246. // Should return 1, but returns 4 (following)
  2247. return el.compareDocumentPosition(document.createElement("fieldset")) & 1;
  2248. });
  2249. // Support: IE<8
  2250. // Prevent attribute/property "interpolation"
  2251. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  2252. if (!assert(function (el) {
  2253. el.innerHTML = "<a href='#'></a>";
  2254. return el.firstChild.getAttribute("href") === "#";
  2255. })) {
  2256. addHandle("type|href|height|width", function (elem, name, isXML) {
  2257. if (!isXML) {
  2258. return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2);
  2259. }
  2260. });
  2261. }
  2262. // Support: IE<9
  2263. // Use defaultValue in place of getAttribute("value")
  2264. if (!support.attributes || !assert(function (el) {
  2265. el.innerHTML = "<input/>";
  2266. el.firstChild.setAttribute("value", "");
  2267. return el.firstChild.getAttribute("value") === "";
  2268. })) {
  2269. addHandle("value", function (elem, name, isXML) {
  2270. if (!isXML && elem.nodeName.toLowerCase() === "input") {
  2271. return elem.defaultValue;
  2272. }
  2273. });
  2274. }
  2275. // Support: IE<9
  2276. // Use getAttributeNode to fetch booleans when getAttribute lies
  2277. if (!assert(function (el) {
  2278. return el.getAttribute("disabled") == null;
  2279. })) {
  2280. addHandle(booleans, function (elem, name, isXML) {
  2281. var val;
  2282. if (!isXML) {
  2283. return elem[name] === true ? name.toLowerCase() :
  2284. (val = elem.getAttributeNode(name)) && val.specified ?
  2285. val.value :
  2286. null;
  2287. }
  2288. });
  2289. }
  2290. return Sizzle;
  2291. })(window);
  2292. jQuery.find = Sizzle;
  2293. jQuery.expr = Sizzle.selectors;
  2294. // Deprecated
  2295. jQuery.expr[":"] = jQuery.expr.pseudos;
  2296. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  2297. jQuery.text = Sizzle.getText;
  2298. jQuery.isXMLDoc = Sizzle.isXML;
  2299. jQuery.contains = Sizzle.contains;
  2300. jQuery.escapeSelector = Sizzle.escape;
  2301. var dir = function (elem, dir, until) {
  2302. var matched = [],
  2303. truncate = until !== undefined;
  2304. while ((elem = elem[dir]) && elem.nodeType !== 9) {
  2305. if (elem.nodeType === 1) {
  2306. if (truncate && jQuery(elem).is(until)) {
  2307. break;
  2308. }
  2309. matched.push(elem);
  2310. }
  2311. }
  2312. return matched;
  2313. };
  2314. var siblings = function (n, elem) {
  2315. var matched = [];
  2316. for (; n; n = n.nextSibling) {
  2317. if (n.nodeType === 1 && n !== elem) {
  2318. matched.push(n);
  2319. }
  2320. }
  2321. return matched;
  2322. };
  2323. var rneedsContext = jQuery.expr.match.needsContext;
  2324. function nodeName(elem, name) {
  2325. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  2326. };
  2327. var rsingleTag = (/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i);
  2328. // Implement the identical functionality for filter and not
  2329. function winnow(elements, qualifier, not) {
  2330. if (isFunction(qualifier)) {
  2331. return jQuery.grep(elements, function (elem, i) {
  2332. return !!qualifier.call(elem, i, elem) !== not;
  2333. });
  2334. }
  2335. // Single element
  2336. if (qualifier.nodeType) {
  2337. return jQuery.grep(elements, function (elem) {
  2338. return (elem === qualifier) !== not;
  2339. });
  2340. }
  2341. // Arraylike of elements (jQuery, arguments, Array)
  2342. if (typeof qualifier !== "string") {
  2343. return jQuery.grep(elements, function (elem) {
  2344. return (indexOf.call(qualifier, elem) > -1) !== not;
  2345. });
  2346. }
  2347. // Filtered directly for both simple and complex selectors
  2348. return jQuery.filter(qualifier, elements, not);
  2349. }
  2350. jQuery.filter = function (expr, elems, not) {
  2351. var elem = elems[0];
  2352. if (not) {
  2353. expr = ":not(" + expr + ")";
  2354. }
  2355. if (elems.length === 1 && elem.nodeType === 1) {
  2356. return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
  2357. }
  2358. return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {
  2359. return elem.nodeType === 1;
  2360. }));
  2361. };
  2362. jQuery.fn.extend({
  2363. find: function (selector) {
  2364. var i, ret,
  2365. len = this.length,
  2366. self = this;
  2367. if (typeof selector !== "string") {
  2368. return this.pushStack(jQuery(selector).filter(function () {
  2369. for (i = 0; i < len; i++) {
  2370. if (jQuery.contains(self[i], this)) {
  2371. return true;
  2372. }
  2373. }
  2374. }));
  2375. }
  2376. ret = this.pushStack([]);
  2377. for (i = 0; i < len; i++) {
  2378. jQuery.find(selector, self[i], ret);
  2379. }
  2380. return len > 1 ? jQuery.uniqueSort(ret) : ret;
  2381. },
  2382. filter: function (selector) {
  2383. return this.pushStack(winnow(this, selector || [], false));
  2384. },
  2385. not: function (selector) {
  2386. return this.pushStack(winnow(this, selector || [], true));
  2387. },
  2388. is: function (selector) {
  2389. return !!winnow(
  2390. this,
  2391. // If this is a positional/relative selector, check membership in the returned set
  2392. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  2393. typeof selector === "string" && rneedsContext.test(selector) ?
  2394. jQuery(selector) :
  2395. selector || [],
  2396. false
  2397. ).length;
  2398. }
  2399. });
  2400. // Initialize a jQuery object
  2401. // A central reference to the root jQuery(document)
  2402. var rootjQuery,
  2403. // A simple way to check for HTML strings
  2404. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  2405. // Strict HTML recognition (#11290: must start with <)
  2406. // Shortcut simple #id case for speed
  2407. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  2408. init = jQuery.fn.init = function (selector, context, root) {
  2409. var match, elem;
  2410. // HANDLE: $(""), $(null), $(undefined), $(false)
  2411. if (!selector) {
  2412. return this;
  2413. }
  2414. // Method init() accepts an alternate rootjQuery
  2415. // so migrate can support jQuery.sub (gh-2101)
  2416. root = root || rootjQuery;
  2417. // Handle HTML strings
  2418. if (typeof selector === "string") {
  2419. if (selector[0] === "<" &&
  2420. selector[selector.length - 1] === ">" &&
  2421. selector.length >= 3) {
  2422. // Assume that strings that start and end with <> are HTML and skip the regex check
  2423. match = [null, selector, null];
  2424. } else {
  2425. match = rquickExpr.exec(selector);
  2426. }
  2427. // Match html or make sure no context is specified for #id
  2428. if (match && (match[1] || !context)) {
  2429. // HANDLE: $(html) -> $(array)
  2430. if (match[1]) {
  2431. context = context instanceof jQuery ? context[0] : context;
  2432. // Option to run scripts is true for back-compat
  2433. // Intentionally let the error be thrown if parseHTML is not present
  2434. jQuery.merge(this, jQuery.parseHTML(
  2435. match[1],
  2436. context && context.nodeType ? context.ownerDocument || context : document,
  2437. true
  2438. ));
  2439. // HANDLE: $(html, props)
  2440. if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
  2441. for (match in context) {
  2442. // Properties of context are called as methods if possible
  2443. if (isFunction(this[match])) {
  2444. this[match](context[match]);
  2445. // ...and otherwise set as attributes
  2446. } else {
  2447. this.attr(match, context[match]);
  2448. }
  2449. }
  2450. }
  2451. return this;
  2452. // HANDLE: $(#id)
  2453. } else {
  2454. elem = document.getElementById(match[2]);
  2455. if (elem) {
  2456. // Inject the element directly into the jQuery object
  2457. this[0] = elem;
  2458. this.length = 1;
  2459. }
  2460. return this;
  2461. }
  2462. // HANDLE: $(expr, $(...))
  2463. } else if (!context || context.jquery) {
  2464. return (context || root).find(selector);
  2465. // HANDLE: $(expr, context)
  2466. // (which is just equivalent to: $(context).find(expr)
  2467. } else {
  2468. return this.constructor(context).find(selector);
  2469. }
  2470. // HANDLE: $(DOMElement)
  2471. } else if (selector.nodeType) {
  2472. this[0] = selector;
  2473. this.length = 1;
  2474. return this;
  2475. // HANDLE: $(function)
  2476. // Shortcut for document ready
  2477. } else if (isFunction(selector)) {
  2478. return root.ready !== undefined ?
  2479. root.ready(selector) :
  2480. // Execute immediately if ready is not present
  2481. selector(jQuery);
  2482. }
  2483. return jQuery.makeArray(selector, this);
  2484. };
  2485. // Give the init function the jQuery prototype for later instantiation
  2486. init.prototype = jQuery.fn;
  2487. // Initialize central reference
  2488. rootjQuery = jQuery(document);
  2489. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  2490. // Methods guaranteed to produce a unique set when starting from a unique set
  2491. guaranteedUnique = {
  2492. children: true,
  2493. contents: true,
  2494. next: true,
  2495. prev: true
  2496. };
  2497. jQuery.fn.extend({
  2498. has: function (target) {
  2499. var targets = jQuery(target, this),
  2500. l = targets.length;
  2501. return this.filter(function () {
  2502. var i = 0;
  2503. for (; i < l; i++) {
  2504. if (jQuery.contains(this, targets[i])) {
  2505. return true;
  2506. }
  2507. }
  2508. });
  2509. },
  2510. closest: function (selectors, context) {
  2511. var cur,
  2512. i = 0,
  2513. l = this.length,
  2514. matched = [],
  2515. targets = typeof selectors !== "string" && jQuery(selectors);
  2516. // Positional selectors never match, since there's no _selection_ context
  2517. if (!rneedsContext.test(selectors)) {
  2518. for (; i < l; i++) {
  2519. for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
  2520. // Always skip document fragments
  2521. if (cur.nodeType < 11 && (targets ?
  2522. targets.index(cur) > -1 :
  2523. // Don't pass non-elements to Sizzle
  2524. cur.nodeType === 1 &&
  2525. jQuery.find.matchesSelector(cur, selectors))) {
  2526. matched.push(cur);
  2527. break;
  2528. }
  2529. }
  2530. }
  2531. }
  2532. return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
  2533. },
  2534. // Determine the position of an element within the set
  2535. index: function (elem) {
  2536. // No argument, return index in parent
  2537. if (!elem) {
  2538. return (this[0] && this[0].parentNode) ? this.first().prevAll().length : -1;
  2539. }
  2540. // Index in selector
  2541. if (typeof elem === "string") {
  2542. return indexOf.call(jQuery(elem), this[0]);
  2543. }
  2544. // Locate the position of the desired element
  2545. return indexOf.call(this,
  2546. // If it receives a jQuery object, the first element is used
  2547. elem.jquery ? elem[0] : elem
  2548. );
  2549. },
  2550. add: function (selector, context) {
  2551. return this.pushStack(
  2552. jQuery.uniqueSort(
  2553. jQuery.merge(this.get(), jQuery(selector, context))
  2554. )
  2555. );
  2556. },
  2557. addBack: function (selector) {
  2558. return this.add(selector == null ?
  2559. this.prevObject : this.prevObject.filter(selector)
  2560. );
  2561. }
  2562. });
  2563. function sibling(cur, dir) {
  2564. while ((cur = cur[dir]) && cur.nodeType !== 1) { }
  2565. return cur;
  2566. }
  2567. jQuery.each({
  2568. parent: function (elem) {
  2569. var parent = elem.parentNode;
  2570. return parent && parent.nodeType !== 11 ? parent : null;
  2571. },
  2572. parents: function (elem) {
  2573. return dir(elem, "parentNode");
  2574. },
  2575. parentsUntil: function (elem, i, until) {
  2576. return dir(elem, "parentNode", until);
  2577. },
  2578. next: function (elem) {
  2579. return sibling(elem, "nextSibling");
  2580. },
  2581. prev: function (elem) {
  2582. return sibling(elem, "previousSibling");
  2583. },
  2584. nextAll: function (elem) {
  2585. return dir(elem, "nextSibling");
  2586. },
  2587. prevAll: function (elem) {
  2588. return dir(elem, "previousSibling");
  2589. },
  2590. nextUntil: function (elem, i, until) {
  2591. return dir(elem, "nextSibling", until);
  2592. },
  2593. prevUntil: function (elem, i, until) {
  2594. return dir(elem, "previousSibling", until);
  2595. },
  2596. siblings: function (elem) {
  2597. return siblings((elem.parentNode || {}).firstChild, elem);
  2598. },
  2599. children: function (elem) {
  2600. return siblings(elem.firstChild);
  2601. },
  2602. contents: function (elem) {
  2603. if (nodeName(elem, "iframe")) {
  2604. return elem.contentDocument;
  2605. }
  2606. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  2607. // Treat the template element as a regular one in browsers that
  2608. // don't support it.
  2609. if (nodeName(elem, "template")) {
  2610. elem = elem.content || elem;
  2611. }
  2612. return jQuery.merge([], elem.childNodes);
  2613. }
  2614. }, function (name, fn) {
  2615. jQuery.fn[name] = function (until, selector) {
  2616. var matched = jQuery.map(this, fn, until);
  2617. if (name.slice(-5) !== "Until") {
  2618. selector = until;
  2619. }
  2620. if (selector && typeof selector === "string") {
  2621. matched = jQuery.filter(selector, matched);
  2622. }
  2623. if (this.length > 1) {
  2624. // Remove duplicates
  2625. if (!guaranteedUnique[name]) {
  2626. jQuery.uniqueSort(matched);
  2627. }
  2628. // Reverse order for parents* and prev-derivatives
  2629. if (rparentsprev.test(name)) {
  2630. matched.reverse();
  2631. }
  2632. }
  2633. return this.pushStack(matched);
  2634. };
  2635. });
  2636. var rnothtmlwhite = (/[^\x20\t\r\n\f]+/g);
  2637. // Convert String-formatted options into Object-formatted ones
  2638. function createOptions(options) {
  2639. var object = {};
  2640. jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) {
  2641. object[flag] = true;
  2642. });
  2643. return object;
  2644. }
  2645. /*
  2646. * Create a callback list using the following parameters:
  2647. *
  2648. * options: an optional list of space-separated options that will change how
  2649. * the callback list behaves or a more traditional option object
  2650. *
  2651. * By default a callback list will act like an event callback list and can be
  2652. * "fired" multiple times.
  2653. *
  2654. * Possible options:
  2655. *
  2656. * once: will ensure the callback list can only be fired once (like a Deferred)
  2657. *
  2658. * memory: will keep track of previous values and will call any callback added
  2659. * after the list has been fired right away with the latest "memorized"
  2660. * values (like a Deferred)
  2661. *
  2662. * unique: will ensure a callback can only be added once (no duplicate in the list)
  2663. *
  2664. * stopOnFalse: interrupt callings when a callback returns false
  2665. *
  2666. */
  2667. jQuery.Callbacks = function (options) {
  2668. // Convert options from String-formatted to Object-formatted if needed
  2669. // (we check in cache first)
  2670. options = typeof options === "string" ?
  2671. createOptions(options) :
  2672. jQuery.extend({}, options);
  2673. var // Flag to know if list is currently firing
  2674. firing,
  2675. // Last fire value for non-forgettable lists
  2676. memory,
  2677. // Flag to know if list was already fired
  2678. fired,
  2679. // Flag to prevent firing
  2680. locked,
  2681. // Actual callback list
  2682. list = [],
  2683. // Queue of execution data for repeatable lists
  2684. queue = [],
  2685. // Index of currently firing callback (modified by add/remove as needed)
  2686. firingIndex = -1,
  2687. // Fire callbacks
  2688. fire = function () {
  2689. // Enforce single-firing
  2690. locked = locked || options.once;
  2691. // Execute callbacks for all pending executions,
  2692. // respecting firingIndex overrides and runtime changes
  2693. fired = firing = true;
  2694. for (; queue.length; firingIndex = -1) {
  2695. memory = queue.shift();
  2696. while (++firingIndex < list.length) {
  2697. // Run callback and check for early termination
  2698. if (list[firingIndex].apply(memory[0], memory[1]) === false &&
  2699. options.stopOnFalse) {
  2700. // Jump to end and forget the data so .add doesn't re-fire
  2701. firingIndex = list.length;
  2702. memory = false;
  2703. }
  2704. }
  2705. }
  2706. // Forget the data if we're done with it
  2707. if (!options.memory) {
  2708. memory = false;
  2709. }
  2710. firing = false;
  2711. // Clean up if we're done firing for good
  2712. if (locked) {
  2713. // Keep an empty list if we have data for future add calls
  2714. if (memory) {
  2715. list = [];
  2716. // Otherwise, this object is spent
  2717. } else {
  2718. list = "";
  2719. }
  2720. }
  2721. },
  2722. // Actual Callbacks object
  2723. self = {
  2724. // Add a callback or a collection of callbacks to the list
  2725. add: function () {
  2726. if (list) {
  2727. // If we have memory from a past run, we should fire after adding
  2728. if (memory && !firing) {
  2729. firingIndex = list.length - 1;
  2730. queue.push(memory);
  2731. }
  2732. (function add(args) {
  2733. jQuery.each(args, function (_, arg) {
  2734. if (isFunction(arg)) {
  2735. if (!options.unique || !self.has(arg)) {
  2736. list.push(arg);
  2737. }
  2738. } else if (arg && arg.length && toType(arg) !== "string") {
  2739. // Inspect recursively
  2740. add(arg);
  2741. }
  2742. });
  2743. })(arguments);
  2744. if (memory && !firing) {
  2745. fire();
  2746. }
  2747. }
  2748. return this;
  2749. },
  2750. // Remove a callback from the list
  2751. remove: function () {
  2752. jQuery.each(arguments, function (_, arg) {
  2753. var index;
  2754. while ((index = jQuery.inArray(arg, list, index)) > -1) {
  2755. list.splice(index, 1);
  2756. // Handle firing indexes
  2757. if (index <= firingIndex) {
  2758. firingIndex--;
  2759. }
  2760. }
  2761. });
  2762. return this;
  2763. },
  2764. // Check if a given callback is in the list.
  2765. // If no argument is given, return whether or not list has callbacks attached.
  2766. has: function (fn) {
  2767. return fn ?
  2768. jQuery.inArray(fn, list) > -1 :
  2769. list.length > 0;
  2770. },
  2771. // Remove all callbacks from the list
  2772. empty: function () {
  2773. if (list) {
  2774. list = [];
  2775. }
  2776. return this;
  2777. },
  2778. // Disable .fire and .add
  2779. // Abort any current/pending executions
  2780. // Clear all callbacks and values
  2781. disable: function () {
  2782. locked = queue = [];
  2783. list = memory = "";
  2784. return this;
  2785. },
  2786. disabled: function () {
  2787. return !list;
  2788. },
  2789. // Disable .fire
  2790. // Also disable .add unless we have memory (since it would have no effect)
  2791. // Abort any pending executions
  2792. lock: function () {
  2793. locked = queue = [];
  2794. if (!memory && !firing) {
  2795. list = memory = "";
  2796. }
  2797. return this;
  2798. },
  2799. locked: function () {
  2800. return !!locked;
  2801. },
  2802. // Call all callbacks with the given context and arguments
  2803. fireWith: function (context, args) {
  2804. if (!locked) {
  2805. args = args || [];
  2806. args = [context, args.slice ? args.slice() : args];
  2807. queue.push(args);
  2808. if (!firing) {
  2809. fire();
  2810. }
  2811. }
  2812. return this;
  2813. },
  2814. // Call all the callbacks with the given arguments
  2815. fire: function () {
  2816. self.fireWith(this, arguments);
  2817. return this;
  2818. },
  2819. // To know if the callbacks have already been called at least once
  2820. fired: function () {
  2821. return !!fired;
  2822. }
  2823. };
  2824. return self;
  2825. };
  2826. function Identity(v) {
  2827. return v;
  2828. }
  2829. function Thrower(ex) {
  2830. throw ex;
  2831. }
  2832. function adoptValue(value, resolve, reject, noValue) {
  2833. var method;
  2834. try {
  2835. // Check for promise aspect first to privilege synchronous behavior
  2836. if (value && isFunction((method = value.promise))) {
  2837. method.call(value).done(resolve).fail(reject);
  2838. // Other thenables
  2839. } else if (value && isFunction((method = value.then))) {
  2840. method.call(value, resolve, reject);
  2841. // Other non-thenables
  2842. } else {
  2843. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  2844. // * false: [ value ].slice( 0 ) => resolve( value )
  2845. // * true: [ value ].slice( 1 ) => resolve()
  2846. resolve.apply(undefined, [value].slice(noValue));
  2847. }
  2848. // For Promises/A+, convert exceptions into rejections
  2849. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  2850. // Deferred#then to conditionally suppress rejection.
  2851. } catch (value) {
  2852. // Support: Android 4.0 only
  2853. // Strict mode functions invoked without .call/.apply get global-object context
  2854. reject.apply(undefined, [value]);
  2855. }
  2856. }
  2857. jQuery.extend({
  2858. Deferred: function (func) {
  2859. var tuples = [
  2860. // action, add listener, callbacks,
  2861. // ... .then handlers, argument index, [final state]
  2862. ["notify", "progress", jQuery.Callbacks("memory"),
  2863. jQuery.Callbacks("memory"), 2],
  2864. ["resolve", "done", jQuery.Callbacks("once memory"),
  2865. jQuery.Callbacks("once memory"), 0, "resolved"],
  2866. ["reject", "fail", jQuery.Callbacks("once memory"),
  2867. jQuery.Callbacks("once memory"), 1, "rejected"]
  2868. ],
  2869. state = "pending",
  2870. promise = {
  2871. state: function () {
  2872. return state;
  2873. },
  2874. always: function () {
  2875. deferred.done(arguments).fail(arguments);
  2876. return this;
  2877. },
  2878. "catch": function (fn) {
  2879. return promise.then(null, fn);
  2880. },
  2881. // Keep pipe for back-compat
  2882. pipe: function ( /* fnDone, fnFail, fnProgress */) {
  2883. var fns = arguments;
  2884. return jQuery.Deferred(function (newDefer) {
  2885. jQuery.each(tuples, function (i, tuple) {
  2886. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  2887. var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]];
  2888. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  2889. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  2890. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  2891. deferred[tuple[1]](function () {
  2892. var returned = fn && fn.apply(this, arguments);
  2893. if (returned && isFunction(returned.promise)) {
  2894. returned.promise()
  2895. .progress(newDefer.notify)
  2896. .done(newDefer.resolve)
  2897. .fail(newDefer.reject);
  2898. } else {
  2899. newDefer[tuple[0] + "With"](
  2900. this,
  2901. fn ? [returned] : arguments
  2902. );
  2903. }
  2904. });
  2905. });
  2906. fns = null;
  2907. }).promise();
  2908. },
  2909. then: function (onFulfilled, onRejected, onProgress) {
  2910. var maxDepth = 0;
  2911. function resolve(depth, deferred, handler, special) {
  2912. return function () {
  2913. var that = this,
  2914. args = arguments,
  2915. mightThrow = function () {
  2916. var returned, then;
  2917. // Support: Promises/A+ section 2.3.3.3.3
  2918. // https://promisesaplus.com/#point-59
  2919. // Ignore double-resolution attempts
  2920. if (depth < maxDepth) {
  2921. return;
  2922. }
  2923. returned = handler.apply(that, args);
  2924. // Support: Promises/A+ section 2.3.1
  2925. // https://promisesaplus.com/#point-48
  2926. if (returned === deferred.promise()) {
  2927. throw new TypeError("Thenable self-resolution");
  2928. }
  2929. // Support: Promises/A+ sections 2.3.3.1, 3.5
  2930. // https://promisesaplus.com/#point-54
  2931. // https://promisesaplus.com/#point-75
  2932. // Retrieve `then` only once
  2933. then = returned &&
  2934. // Support: Promises/A+ section 2.3.4
  2935. // https://promisesaplus.com/#point-64
  2936. // Only check objects and functions for thenability
  2937. (typeof returned === "object" ||
  2938. typeof returned === "function") &&
  2939. returned.then;
  2940. // Handle a returned thenable
  2941. if (isFunction(then)) {
  2942. // Special processors (notify) just wait for resolution
  2943. if (special) {
  2944. then.call(
  2945. returned,
  2946. resolve(maxDepth, deferred, Identity, special),
  2947. resolve(maxDepth, deferred, Thrower, special)
  2948. );
  2949. // Normal processors (resolve) also hook into progress
  2950. } else {
  2951. // ...and disregard older resolution values
  2952. maxDepth++;
  2953. then.call(
  2954. returned,
  2955. resolve(maxDepth, deferred, Identity, special),
  2956. resolve(maxDepth, deferred, Thrower, special),
  2957. resolve(maxDepth, deferred, Identity,
  2958. deferred.notifyWith)
  2959. );
  2960. }
  2961. // Handle all other returned values
  2962. } else {
  2963. // Only substitute handlers pass on context
  2964. // and multiple values (non-spec behavior)
  2965. if (handler !== Identity) {
  2966. that = undefined;
  2967. args = [returned];
  2968. }
  2969. // Process the value(s)
  2970. // Default process is resolve
  2971. (special || deferred.resolveWith)(that, args);
  2972. }
  2973. },
  2974. // Only normal processors (resolve) catch and reject exceptions
  2975. process = special ?
  2976. mightThrow :
  2977. function () {
  2978. try {
  2979. mightThrow();
  2980. } catch (e) {
  2981. if (jQuery.Deferred.exceptionHook) {
  2982. jQuery.Deferred.exceptionHook(e,
  2983. process.stackTrace);
  2984. }
  2985. // Support: Promises/A+ section 2.3.3.3.4.1
  2986. // https://promisesaplus.com/#point-61
  2987. // Ignore post-resolution exceptions
  2988. if (depth + 1 >= maxDepth) {
  2989. // Only substitute handlers pass on context
  2990. // and multiple values (non-spec behavior)
  2991. if (handler !== Thrower) {
  2992. that = undefined;
  2993. args = [e];
  2994. }
  2995. deferred.rejectWith(that, args);
  2996. }
  2997. }
  2998. };
  2999. // Support: Promises/A+ section 2.3.3.3.1
  3000. // https://promisesaplus.com/#point-57
  3001. // Re-resolve promises immediately to dodge false rejection from
  3002. // subsequent errors
  3003. if (depth) {
  3004. process();
  3005. } else {
  3006. // Call an optional hook to record the stack, in case of exception
  3007. // since it's otherwise lost when execution goes async
  3008. if (jQuery.Deferred.getStackHook) {
  3009. process.stackTrace = jQuery.Deferred.getStackHook();
  3010. }
  3011. window.setTimeout(process);
  3012. }
  3013. };
  3014. }
  3015. return jQuery.Deferred(function (newDefer) {
  3016. // progress_handlers.add( ... )
  3017. tuples[0][3].add(
  3018. resolve(
  3019. 0,
  3020. newDefer,
  3021. isFunction(onProgress) ?
  3022. onProgress :
  3023. Identity,
  3024. newDefer.notifyWith
  3025. )
  3026. );
  3027. // fulfilled_handlers.add( ... )
  3028. tuples[1][3].add(
  3029. resolve(
  3030. 0,
  3031. newDefer,
  3032. isFunction(onFulfilled) ?
  3033. onFulfilled :
  3034. Identity
  3035. )
  3036. );
  3037. // rejected_handlers.add( ... )
  3038. tuples[2][3].add(
  3039. resolve(
  3040. 0,
  3041. newDefer,
  3042. isFunction(onRejected) ?
  3043. onRejected :
  3044. Thrower
  3045. )
  3046. );
  3047. }).promise();
  3048. },
  3049. // Get a promise for this deferred
  3050. // If obj is provided, the promise aspect is added to the object
  3051. promise: function (obj) {
  3052. return obj != null ? jQuery.extend(obj, promise) : promise;
  3053. }
  3054. },
  3055. deferred = {};
  3056. // Add list-specific methods
  3057. jQuery.each(tuples, function (i, tuple) {
  3058. var list = tuple[2],
  3059. stateString = tuple[5];
  3060. // promise.progress = list.add
  3061. // promise.done = list.add
  3062. // promise.fail = list.add
  3063. promise[tuple[1]] = list.add;
  3064. // Handle state
  3065. if (stateString) {
  3066. list.add(
  3067. function () {
  3068. // state = "resolved" (i.e., fulfilled)
  3069. // state = "rejected"
  3070. state = stateString;
  3071. },
  3072. // rejected_callbacks.disable
  3073. // fulfilled_callbacks.disable
  3074. tuples[3 - i][2].disable,
  3075. // rejected_handlers.disable
  3076. // fulfilled_handlers.disable
  3077. tuples[3 - i][3].disable,
  3078. // progress_callbacks.lock
  3079. tuples[0][2].lock,
  3080. // progress_handlers.lock
  3081. tuples[0][3].lock
  3082. );
  3083. }
  3084. // progress_handlers.fire
  3085. // fulfilled_handlers.fire
  3086. // rejected_handlers.fire
  3087. list.add(tuple[3].fire);
  3088. // deferred.notify = function() { deferred.notifyWith(...) }
  3089. // deferred.resolve = function() { deferred.resolveWith(...) }
  3090. // deferred.reject = function() { deferred.rejectWith(...) }
  3091. deferred[tuple[0]] = function () {
  3092. deferred[tuple[0] + "With"](this === deferred ? undefined : this, arguments);
  3093. return this;
  3094. };
  3095. // deferred.notifyWith = list.fireWith
  3096. // deferred.resolveWith = list.fireWith
  3097. // deferred.rejectWith = list.fireWith
  3098. deferred[tuple[0] + "With"] = list.fireWith;
  3099. });
  3100. // Make the deferred a promise
  3101. promise.promise(deferred);
  3102. // Call given func if any
  3103. if (func) {
  3104. func.call(deferred, deferred);
  3105. }
  3106. // All done!
  3107. return deferred;
  3108. },
  3109. // Deferred helper
  3110. when: function (singleValue) {
  3111. var
  3112. // count of uncompleted subordinates
  3113. remaining = arguments.length,
  3114. // count of unprocessed arguments
  3115. i = remaining,
  3116. // subordinate fulfillment data
  3117. resolveContexts = Array(i),
  3118. resolveValues = slice.call(arguments),
  3119. // the master Deferred
  3120. master = jQuery.Deferred(),
  3121. // subordinate callback factory
  3122. updateFunc = function (i) {
  3123. return function (value) {
  3124. resolveContexts[i] = this;
  3125. resolveValues[i] = arguments.length > 1 ? slice.call(arguments) : value;
  3126. if (!(--remaining)) {
  3127. master.resolveWith(resolveContexts, resolveValues);
  3128. }
  3129. };
  3130. };
  3131. // Single- and empty arguments are adopted like Promise.resolve
  3132. if (remaining <= 1) {
  3133. adoptValue(singleValue, master.done(updateFunc(i)).resolve, master.reject,
  3134. !remaining);
  3135. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  3136. if (master.state() === "pending" ||
  3137. isFunction(resolveValues[i] && resolveValues[i].then)) {
  3138. return master.then();
  3139. }
  3140. }
  3141. // Multiple arguments are aggregated like Promise.all array elements
  3142. while (i--) {
  3143. adoptValue(resolveValues[i], updateFunc(i), master.reject);
  3144. }
  3145. return master.promise();
  3146. }
  3147. });
  3148. // These usually indicate a programmer mistake during development,
  3149. // warn about them ASAP rather than swallowing them by default.
  3150. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  3151. jQuery.Deferred.exceptionHook = function (error, stack) {
  3152. // Support: IE 8 - 9 only
  3153. // Console exists when dev tools are open, which can happen at any time
  3154. if (window.console && window.console.warn && error && rerrorNames.test(error.name)) {
  3155. window.console.warn("jQuery.Deferred exception: " + error.message, error.stack, stack);
  3156. }
  3157. };
  3158. jQuery.readyException = function (error) {
  3159. window.setTimeout(function () {
  3160. throw error;
  3161. });
  3162. };
  3163. // The deferred used on DOM ready
  3164. var readyList = jQuery.Deferred();
  3165. jQuery.fn.ready = function (fn) {
  3166. readyList
  3167. .then(fn)
  3168. // Wrap jQuery.readyException in a function so that the lookup
  3169. // happens at the time of error handling instead of callback
  3170. // registration.
  3171. .catch(function (error) {
  3172. jQuery.readyException(error);
  3173. });
  3174. return this;
  3175. };
  3176. jQuery.extend({
  3177. // Is the DOM ready to be used? Set to true once it occurs.
  3178. isReady: false,
  3179. // A counter to track how many items to wait for before
  3180. // the ready event fires. See #6781
  3181. readyWait: 1,
  3182. // Handle when the DOM is ready
  3183. ready: function (wait) {
  3184. // Abort if there are pending holds or we're already ready
  3185. if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
  3186. return;
  3187. }
  3188. // Remember that the DOM is ready
  3189. jQuery.isReady = true;
  3190. // If a normal DOM Ready event fired, decrement, and wait if need be
  3191. if (wait !== true && --jQuery.readyWait > 0) {
  3192. return;
  3193. }
  3194. // If there are functions bound, to execute
  3195. readyList.resolveWith(document, [jQuery]);
  3196. }
  3197. });
  3198. jQuery.ready.then = readyList.then;
  3199. // The ready event handler and self cleanup method
  3200. function completed() {
  3201. document.removeEventListener("DOMContentLoaded", completed);
  3202. window.removeEventListener("load", completed);
  3203. jQuery.ready();
  3204. }
  3205. // Catch cases where $(document).ready() is called
  3206. // after the browser event has already occurred.
  3207. // Support: IE <=9 - 10 only
  3208. // Older IE sometimes signals "interactive" too soon
  3209. if (document.readyState === "complete" ||
  3210. (document.readyState !== "loading" && !document.documentElement.doScroll)) {
  3211. // Handle it asynchronously to allow scripts the opportunity to delay ready
  3212. window.setTimeout(jQuery.ready);
  3213. } else {
  3214. // Use the handy event callback
  3215. document.addEventListener("DOMContentLoaded", completed);
  3216. // A fallback to window.onload, that will always work
  3217. window.addEventListener("load", completed);
  3218. }
  3219. // Multifunctional method to get and set values of a collection
  3220. // The value/s can optionally be executed if it's a function
  3221. var access = function (elems, fn, key, value, chainable, emptyGet, raw) {
  3222. var i = 0,
  3223. len = elems.length,
  3224. bulk = key == null;
  3225. // Sets many values
  3226. if (toType(key) === "object") {
  3227. chainable = true;
  3228. for (i in key) {
  3229. access(elems, fn, i, key[i], true, emptyGet, raw);
  3230. }
  3231. // Sets one value
  3232. } else if (value !== undefined) {
  3233. chainable = true;
  3234. if (!isFunction(value)) {
  3235. raw = true;
  3236. }
  3237. if (bulk) {
  3238. // Bulk operations run against the entire set
  3239. if (raw) {
  3240. fn.call(elems, value);
  3241. fn = null;
  3242. // ...except when executing function values
  3243. } else {
  3244. bulk = fn;
  3245. fn = function (elem, key, value) {
  3246. return bulk.call(jQuery(elem), value);
  3247. };
  3248. }
  3249. }
  3250. if (fn) {
  3251. for (; i < len; i++) {
  3252. fn(
  3253. elems[i], key, raw ?
  3254. value :
  3255. value.call(elems[i], i, fn(elems[i], key))
  3256. );
  3257. }
  3258. }
  3259. }
  3260. if (chainable) {
  3261. return elems;
  3262. }
  3263. // Gets
  3264. if (bulk) {
  3265. return fn.call(elems);
  3266. }
  3267. return len ? fn(elems[0], key) : emptyGet;
  3268. };
  3269. // Matches dashed string for camelizing
  3270. var rmsPrefix = /^-ms-/,
  3271. rdashAlpha = /-([a-z])/g;
  3272. // Used by camelCase as callback to replace()
  3273. function fcamelCase(all, letter) {
  3274. return letter.toUpperCase();
  3275. }
  3276. // Convert dashed to camelCase; used by the css and data modules
  3277. // Support: IE <=9 - 11, Edge 12 - 15
  3278. // Microsoft forgot to hump their vendor prefix (#9572)
  3279. function camelCase(string) {
  3280. return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
  3281. }
  3282. var acceptData = function (owner) {
  3283. // Accepts only:
  3284. // - Node
  3285. // - Node.ELEMENT_NODE
  3286. // - Node.DOCUMENT_NODE
  3287. // - Object
  3288. // - Any
  3289. return owner.nodeType === 1 || owner.nodeType === 9 || !(+owner.nodeType);
  3290. };
  3291. function Data() {
  3292. this.expando = jQuery.expando + Data.uid++;
  3293. }
  3294. Data.uid = 1;
  3295. Data.prototype = {
  3296. cache: function (owner) {
  3297. // Check if the owner object already has a cache
  3298. var value = owner[this.expando];
  3299. // If not, create one
  3300. if (!value) {
  3301. value = {};
  3302. // We can accept data for non-element nodes in modern browsers,
  3303. // but we should not, see #8335.
  3304. // Always return an empty object.
  3305. if (acceptData(owner)) {
  3306. // If it is a node unlikely to be stringify-ed or looped over
  3307. // use plain assignment
  3308. if (owner.nodeType) {
  3309. owner[this.expando] = value;
  3310. // Otherwise secure it in a non-enumerable property
  3311. // configurable must be true to allow the property to be
  3312. // deleted when data is removed
  3313. } else {
  3314. Object.defineProperty(owner, this.expando, {
  3315. value: value,
  3316. configurable: true
  3317. });
  3318. }
  3319. }
  3320. }
  3321. return value;
  3322. },
  3323. set: function (owner, data, value) {
  3324. var prop,
  3325. cache = this.cache(owner);
  3326. // Handle: [ owner, key, value ] args
  3327. // Always use camelCase key (gh-2257)
  3328. if (typeof data === "string") {
  3329. cache[camelCase(data)] = value;
  3330. // Handle: [ owner, { properties } ] args
  3331. } else {
  3332. // Copy the properties one-by-one to the cache object
  3333. for (prop in data) {
  3334. cache[camelCase(prop)] = data[prop];
  3335. }
  3336. }
  3337. return cache;
  3338. },
  3339. get: function (owner, key) {
  3340. return key === undefined ?
  3341. this.cache(owner) :
  3342. // Always use camelCase key (gh-2257)
  3343. owner[this.expando] && owner[this.expando][camelCase(key)];
  3344. },
  3345. access: function (owner, key, value) {
  3346. // In cases where either:
  3347. //
  3348. // 1. No key was specified
  3349. // 2. A string key was specified, but no value provided
  3350. //
  3351. // Take the "read" path and allow the get method to determine
  3352. // which value to return, respectively either:
  3353. //
  3354. // 1. The entire cache object
  3355. // 2. The data stored at the key
  3356. //
  3357. if (key === undefined ||
  3358. ((key && typeof key === "string") && value === undefined)) {
  3359. return this.get(owner, key);
  3360. }
  3361. // When the key is not a string, or both a key and value
  3362. // are specified, set or extend (existing objects) with either:
  3363. //
  3364. // 1. An object of properties
  3365. // 2. A key and value
  3366. //
  3367. this.set(owner, key, value);
  3368. // Since the "set" path can have two possible entry points
  3369. // return the expected data based on which path was taken[*]
  3370. return value !== undefined ? value : key;
  3371. },
  3372. remove: function (owner, key) {
  3373. var i,
  3374. cache = owner[this.expando];
  3375. if (cache === undefined) {
  3376. return;
  3377. }
  3378. if (key !== undefined) {
  3379. // Support array or space separated string of keys
  3380. if (Array.isArray(key)) {
  3381. // If key is an array of keys...
  3382. // We always set camelCase keys, so remove that.
  3383. key = key.map(camelCase);
  3384. } else {
  3385. key = camelCase(key);
  3386. // If a key with the spaces exists, use it.
  3387. // Otherwise, create an array by matching non-whitespace
  3388. key = key in cache ?
  3389. [key] :
  3390. (key.match(rnothtmlwhite) || []);
  3391. }
  3392. i = key.length;
  3393. while (i--) {
  3394. delete cache[key[i]];
  3395. }
  3396. }
  3397. // Remove the expando if there's no more data
  3398. if (key === undefined || jQuery.isEmptyObject(cache)) {
  3399. // Support: Chrome <=35 - 45
  3400. // Webkit & Blink performance suffers when deleting properties
  3401. // from DOM nodes, so set to undefined instead
  3402. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  3403. if (owner.nodeType) {
  3404. owner[this.expando] = undefined;
  3405. } else {
  3406. delete owner[this.expando];
  3407. }
  3408. }
  3409. },
  3410. hasData: function (owner) {
  3411. var cache = owner[this.expando];
  3412. return cache !== undefined && !jQuery.isEmptyObject(cache);
  3413. }
  3414. };
  3415. var dataPriv = new Data();
  3416. var dataUser = new Data();
  3417. // Implementation Summary
  3418. //
  3419. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  3420. // 2. Improve the module's maintainability by reducing the storage
  3421. // paths to a single mechanism.
  3422. // 3. Use the same single mechanism to support "private" and "user" data.
  3423. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  3424. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  3425. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  3426. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  3427. rmultiDash = /[A-Z]/g;
  3428. function getData(data) {
  3429. if (data === "true") {
  3430. return true;
  3431. }
  3432. if (data === "false") {
  3433. return false;
  3434. }
  3435. if (data === "null") {
  3436. return null;
  3437. }
  3438. // Only convert to a number if it doesn't change the string
  3439. if (data === +data + "") {
  3440. return +data;
  3441. }
  3442. if (rbrace.test(data)) {
  3443. return JSON.parse(data);
  3444. }
  3445. return data;
  3446. }
  3447. function dataAttr(elem, key, data) {
  3448. var name;
  3449. // If nothing was found internally, try to fetch any
  3450. // data from the HTML5 data-* attribute
  3451. if (data === undefined && elem.nodeType === 1) {
  3452. name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
  3453. data = elem.getAttribute(name);
  3454. if (typeof data === "string") {
  3455. try {
  3456. data = getData(data);
  3457. } catch (e) { }
  3458. // Make sure we set the data so it isn't changed later
  3459. dataUser.set(elem, key, data);
  3460. } else {
  3461. data = undefined;
  3462. }
  3463. }
  3464. return data;
  3465. }
  3466. jQuery.extend({
  3467. hasData: function (elem) {
  3468. return dataUser.hasData(elem) || dataPriv.hasData(elem);
  3469. },
  3470. data: function (elem, name, data) {
  3471. return dataUser.access(elem, name, data);
  3472. },
  3473. removeData: function (elem, name) {
  3474. dataUser.remove(elem, name);
  3475. },
  3476. // TODO: Now that all calls to _data and _removeData have been replaced
  3477. // with direct calls to dataPriv methods, these can be deprecated.
  3478. _data: function (elem, name, data) {
  3479. return dataPriv.access(elem, name, data);
  3480. },
  3481. _removeData: function (elem, name) {
  3482. dataPriv.remove(elem, name);
  3483. }
  3484. });
  3485. jQuery.fn.extend({
  3486. data: function (key, value) {
  3487. var i, name, data,
  3488. elem = this[0],
  3489. attrs = elem && elem.attributes;
  3490. // Gets all values
  3491. if (key === undefined) {
  3492. if (this.length) {
  3493. data = dataUser.get(elem);
  3494. if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
  3495. i = attrs.length;
  3496. while (i--) {
  3497. // Support: IE 11 only
  3498. // The attrs elements can be null (#14894)
  3499. if (attrs[i]) {
  3500. name = attrs[i].name;
  3501. if (name.indexOf("data-") === 0) {
  3502. name = camelCase(name.slice(5));
  3503. dataAttr(elem, name, data[name]);
  3504. }
  3505. }
  3506. }
  3507. dataPriv.set(elem, "hasDataAttrs", true);
  3508. }
  3509. }
  3510. return data;
  3511. }
  3512. // Sets multiple values
  3513. if (typeof key === "object") {
  3514. return this.each(function () {
  3515. dataUser.set(this, key);
  3516. });
  3517. }
  3518. return access(this, function (value) {
  3519. var data;
  3520. // The calling jQuery object (element matches) is not empty
  3521. // (and therefore has an element appears at this[ 0 ]) and the
  3522. // `value` parameter was not undefined. An empty jQuery object
  3523. // will result in `undefined` for elem = this[ 0 ] which will
  3524. // throw an exception if an attempt to read a data cache is made.
  3525. if (elem && value === undefined) {
  3526. // Attempt to get data from the cache
  3527. // The key will always be camelCased in Data
  3528. data = dataUser.get(elem, key);
  3529. if (data !== undefined) {
  3530. return data;
  3531. }
  3532. // Attempt to "discover" the data in
  3533. // HTML5 custom data-* attrs
  3534. data = dataAttr(elem, key);
  3535. if (data !== undefined) {
  3536. return data;
  3537. }
  3538. // We tried really hard, but the data doesn't exist.
  3539. return;
  3540. }
  3541. // Set the data...
  3542. this.each(function () {
  3543. // We always store the camelCased key
  3544. dataUser.set(this, key, value);
  3545. });
  3546. }, null, value, arguments.length > 1, null, true);
  3547. },
  3548. removeData: function (key) {
  3549. return this.each(function () {
  3550. dataUser.remove(this, key);
  3551. });
  3552. }
  3553. });
  3554. jQuery.extend({
  3555. queue: function (elem, type, data) {
  3556. var queue;
  3557. if (elem) {
  3558. type = (type || "fx") + "queue";
  3559. queue = dataPriv.get(elem, type);
  3560. // Speed up dequeue by getting out quickly if this is just a lookup
  3561. if (data) {
  3562. if (!queue || Array.isArray(data)) {
  3563. queue = dataPriv.access(elem, type, jQuery.makeArray(data));
  3564. } else {
  3565. queue.push(data);
  3566. }
  3567. }
  3568. return queue || [];
  3569. }
  3570. },
  3571. dequeue: function (elem, type) {
  3572. type = type || "fx";
  3573. var queue = jQuery.queue(elem, type),
  3574. startLength = queue.length,
  3575. fn = queue.shift(),
  3576. hooks = jQuery._queueHooks(elem, type),
  3577. next = function () {
  3578. jQuery.dequeue(elem, type);
  3579. };
  3580. // If the fx queue is dequeued, always remove the progress sentinel
  3581. if (fn === "inprogress") {
  3582. fn = queue.shift();
  3583. startLength--;
  3584. }
  3585. if (fn) {
  3586. // Add a progress sentinel to prevent the fx queue from being
  3587. // automatically dequeued
  3588. if (type === "fx") {
  3589. queue.unshift("inprogress");
  3590. }
  3591. // Clear up the last queue stop function
  3592. delete hooks.stop;
  3593. fn.call(elem, next, hooks);
  3594. }
  3595. if (!startLength && hooks) {
  3596. hooks.empty.fire();
  3597. }
  3598. },
  3599. // Not public - generate a queueHooks object, or return the current one
  3600. _queueHooks: function (elem, type) {
  3601. var key = type + "queueHooks";
  3602. return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
  3603. empty: jQuery.Callbacks("once memory").add(function () {
  3604. dataPriv.remove(elem, [type + "queue", key]);
  3605. })
  3606. });
  3607. }
  3608. });
  3609. jQuery.fn.extend({
  3610. queue: function (type, data) {
  3611. var setter = 2;
  3612. if (typeof type !== "string") {
  3613. data = type;
  3614. type = "fx";
  3615. setter--;
  3616. }
  3617. if (arguments.length < setter) {
  3618. return jQuery.queue(this[0], type);
  3619. }
  3620. return data === undefined ?
  3621. this :
  3622. this.each(function () {
  3623. var queue = jQuery.queue(this, type, data);
  3624. // Ensure a hooks for this queue
  3625. jQuery._queueHooks(this, type);
  3626. if (type === "fx" && queue[0] !== "inprogress") {
  3627. jQuery.dequeue(this, type);
  3628. }
  3629. });
  3630. },
  3631. dequeue: function (type) {
  3632. return this.each(function () {
  3633. jQuery.dequeue(this, type);
  3634. });
  3635. },
  3636. clearQueue: function (type) {
  3637. return this.queue(type || "fx", []);
  3638. },
  3639. // Get a promise resolved when queues of a certain type
  3640. // are emptied (fx is the type by default)
  3641. promise: function (type, obj) {
  3642. var tmp,
  3643. count = 1,
  3644. defer = jQuery.Deferred(),
  3645. elements = this,
  3646. i = this.length,
  3647. resolve = function () {
  3648. if (!(--count)) {
  3649. defer.resolveWith(elements, [elements]);
  3650. }
  3651. };
  3652. if (typeof type !== "string") {
  3653. obj = type;
  3654. type = undefined;
  3655. }
  3656. type = type || "fx";
  3657. while (i--) {
  3658. tmp = dataPriv.get(elements[i], type + "queueHooks");
  3659. if (tmp && tmp.empty) {
  3660. count++;
  3661. tmp.empty.add(resolve);
  3662. }
  3663. }
  3664. resolve();
  3665. return defer.promise(obj);
  3666. }
  3667. });
  3668. var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;
  3669. var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");
  3670. var cssExpand = ["Top", "Right", "Bottom", "Left"];
  3671. var isHiddenWithinTree = function (elem, el) {
  3672. // isHiddenWithinTree might be called from jQuery#filter function;
  3673. // in that case, element will be second argument
  3674. elem = el || elem;
  3675. // Inline style trumps all
  3676. return elem.style.display === "none" ||
  3677. elem.style.display === "" &&
  3678. // Otherwise, check computed style
  3679. // Support: Firefox <=43 - 45
  3680. // Disconnected elements can have computed display: none, so first confirm that elem is
  3681. // in the document.
  3682. jQuery.contains(elem.ownerDocument, elem) &&
  3683. jQuery.css(elem, "display") === "none";
  3684. };
  3685. var swap = function (elem, options, callback, args) {
  3686. var ret, name,
  3687. old = {};
  3688. // Remember the old values, and insert the new ones
  3689. for (name in options) {
  3690. old[name] = elem.style[name];
  3691. elem.style[name] = options[name];
  3692. }
  3693. ret = callback.apply(elem, args || []);
  3694. // Revert the old values
  3695. for (name in options) {
  3696. elem.style[name] = old[name];
  3697. }
  3698. return ret;
  3699. };
  3700. function adjustCSS(elem, prop, valueParts, tween) {
  3701. var adjusted, scale,
  3702. maxIterations = 20,
  3703. currentValue = tween ?
  3704. function () {
  3705. return tween.cur();
  3706. } :
  3707. function () {
  3708. return jQuery.css(elem, prop, "");
  3709. },
  3710. initial = currentValue(),
  3711. unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
  3712. // Starting value computation is required for potential unit mismatches
  3713. initialInUnit = (jQuery.cssNumber[prop] || unit !== "px" && +initial) &&
  3714. rcssNum.exec(jQuery.css(elem, prop));
  3715. if (initialInUnit && initialInUnit[3] !== unit) {
  3716. // Support: Firefox <=54
  3717. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  3718. initial = initial / 2;
  3719. // Trust units reported by jQuery.css
  3720. unit = unit || initialInUnit[3];
  3721. // Iteratively approximate from a nonzero starting point
  3722. initialInUnit = +initial || 1;
  3723. while (maxIterations--) {
  3724. // Evaluate and update our best guess (doubling guesses that zero out).
  3725. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  3726. jQuery.style(elem, prop, initialInUnit + unit);
  3727. if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {
  3728. maxIterations = 0;
  3729. }
  3730. initialInUnit = initialInUnit / scale;
  3731. }
  3732. initialInUnit = initialInUnit * 2;
  3733. jQuery.style(elem, prop, initialInUnit + unit);
  3734. // Make sure we update the tween properties later on
  3735. valueParts = valueParts || [];
  3736. }
  3737. if (valueParts) {
  3738. initialInUnit = +initialInUnit || +initial || 0;
  3739. // Apply relative offset (+=/-=) if specified
  3740. adjusted = valueParts[1] ?
  3741. initialInUnit + (valueParts[1] + 1) * valueParts[2] :
  3742. +valueParts[2];
  3743. if (tween) {
  3744. tween.unit = unit;
  3745. tween.start = initialInUnit;
  3746. tween.end = adjusted;
  3747. }
  3748. }
  3749. return adjusted;
  3750. }
  3751. var defaultDisplayMap = {};
  3752. function getDefaultDisplay(elem) {
  3753. var temp,
  3754. doc = elem.ownerDocument,
  3755. nodeName = elem.nodeName,
  3756. display = defaultDisplayMap[nodeName];
  3757. if (display) {
  3758. return display;
  3759. }
  3760. temp = doc.body.appendChild(doc.createElement(nodeName));
  3761. display = jQuery.css(temp, "display");
  3762. temp.parentNode.removeChild(temp);
  3763. if (display === "none") {
  3764. display = "block";
  3765. }
  3766. defaultDisplayMap[nodeName] = display;
  3767. return display;
  3768. }
  3769. function showHide(elements, show) {
  3770. var display, elem,
  3771. values = [],
  3772. index = 0,
  3773. length = elements.length;
  3774. // Determine new display value for elements that need to change
  3775. for (; index < length; index++) {
  3776. elem = elements[index];
  3777. if (!elem.style) {
  3778. continue;
  3779. }
  3780. display = elem.style.display;
  3781. if (show) {
  3782. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  3783. // check is required in this first loop unless we have a nonempty display value (either
  3784. // inline or about-to-be-restored)
  3785. if (display === "none") {
  3786. values[index] = dataPriv.get(elem, "display") || null;
  3787. if (!values[index]) {
  3788. elem.style.display = "";
  3789. }
  3790. }
  3791. if (elem.style.display === "" && isHiddenWithinTree(elem)) {
  3792. values[index] = getDefaultDisplay(elem);
  3793. }
  3794. } else {
  3795. if (display !== "none") {
  3796. values[index] = "none";
  3797. // Remember what we're overwriting
  3798. dataPriv.set(elem, "display", display);
  3799. }
  3800. }
  3801. }
  3802. // Set the display of the elements in a second loop to avoid constant reflow
  3803. for (index = 0; index < length; index++) {
  3804. if (values[index] != null) {
  3805. elements[index].style.display = values[index];
  3806. }
  3807. }
  3808. return elements;
  3809. }
  3810. jQuery.fn.extend({
  3811. show: function () {
  3812. return showHide(this, true);
  3813. },
  3814. hide: function () {
  3815. return showHide(this);
  3816. },
  3817. toggle: function (state) {
  3818. if (typeof state === "boolean") {
  3819. return state ? this.show() : this.hide();
  3820. }
  3821. return this.each(function () {
  3822. if (isHiddenWithinTree(this)) {
  3823. jQuery(this).show();
  3824. } else {
  3825. jQuery(this).hide();
  3826. }
  3827. });
  3828. }
  3829. });
  3830. var rcheckableType = (/^(?:checkbox|radio)$/i);
  3831. var rtagName = (/<([a-z][^\/\0>\x20\t\r\n\f]+)/i);
  3832. var rscriptType = (/^$|^module$|\/(?:java|ecma)script/i);
  3833. // We have to close these tags to support XHTML (#13200)
  3834. var wrapMap = {
  3835. // Support: IE <=9 only
  3836. option: [1, "<select multiple='multiple'>", "</select>"],
  3837. // XHTML parsers do not magically insert elements in the
  3838. // same way that tag soup parsers do. So we cannot shorten
  3839. // this by omitting <tbody> or other required elements.
  3840. thead: [1, "<table>", "</table>"],
  3841. col: [2, "<table><colgroup>", "</colgroup></table>"],
  3842. tr: [2, "<table><tbody>", "</tbody></table>"],
  3843. td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
  3844. _default: [0, "", ""]
  3845. };
  3846. // Support: IE <=9 only
  3847. wrapMap.optgroup = wrapMap.option;
  3848. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  3849. wrapMap.th = wrapMap.td;
  3850. function getAll(context, tag) {
  3851. // Support: IE <=9 - 11 only
  3852. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  3853. var ret;
  3854. if (typeof context.getElementsByTagName !== "undefined") {
  3855. ret = context.getElementsByTagName(tag || "*");
  3856. } else if (typeof context.querySelectorAll !== "undefined") {
  3857. ret = context.querySelectorAll(tag || "*");
  3858. } else {
  3859. ret = [];
  3860. }
  3861. if (tag === undefined || tag && nodeName(context, tag)) {
  3862. return jQuery.merge([context], ret);
  3863. }
  3864. return ret;
  3865. }
  3866. // Mark scripts as having already been evaluated
  3867. function setGlobalEval(elems, refElements) {
  3868. var i = 0,
  3869. l = elems.length;
  3870. for (; i < l; i++) {
  3871. dataPriv.set(
  3872. elems[i],
  3873. "globalEval",
  3874. !refElements || dataPriv.get(refElements[i], "globalEval")
  3875. );
  3876. }
  3877. }
  3878. var rhtml = /<|&#?\w+;/;
  3879. function buildFragment(elems, context, scripts, selection, ignored) {
  3880. var elem, tmp, tag, wrap, contains, j,
  3881. fragment = context.createDocumentFragment(),
  3882. nodes = [],
  3883. i = 0,
  3884. l = elems.length;
  3885. for (; i < l; i++) {
  3886. elem = elems[i];
  3887. if (elem || elem === 0) {
  3888. // Add nodes directly
  3889. if (toType(elem) === "object") {
  3890. // Support: Android <=4.0 only, PhantomJS 1 only
  3891. // push.apply(_, arraylike) throws on ancient WebKit
  3892. jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
  3893. // Convert non-html into a text node
  3894. } else if (!rhtml.test(elem)) {
  3895. nodes.push(context.createTextNode(elem));
  3896. // Convert html into DOM nodes
  3897. } else {
  3898. tmp = tmp || fragment.appendChild(context.createElement("div"));
  3899. // Deserialize a standard representation
  3900. tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
  3901. wrap = wrapMap[tag] || wrapMap._default;
  3902. tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];
  3903. // Descend through wrappers to the right content
  3904. j = wrap[0];
  3905. while (j--) {
  3906. tmp = tmp.lastChild;
  3907. }
  3908. // Support: Android <=4.0 only, PhantomJS 1 only
  3909. // push.apply(_, arraylike) throws on ancient WebKit
  3910. jQuery.merge(nodes, tmp.childNodes);
  3911. // Remember the top-level container
  3912. tmp = fragment.firstChild;
  3913. // Ensure the created nodes are orphaned (#12392)
  3914. tmp.textContent = "";
  3915. }
  3916. }
  3917. }
  3918. // Remove wrapper from fragment
  3919. fragment.textContent = "";
  3920. i = 0;
  3921. while ((elem = nodes[i++])) {
  3922. // Skip elements already in the context collection (trac-4087)
  3923. if (selection && jQuery.inArray(elem, selection) > -1) {
  3924. if (ignored) {
  3925. ignored.push(elem);
  3926. }
  3927. continue;
  3928. }
  3929. contains = jQuery.contains(elem.ownerDocument, elem);
  3930. // Append to fragment
  3931. tmp = getAll(fragment.appendChild(elem), "script");
  3932. // Preserve script evaluation history
  3933. if (contains) {
  3934. setGlobalEval(tmp);
  3935. }
  3936. // Capture executables
  3937. if (scripts) {
  3938. j = 0;
  3939. while ((elem = tmp[j++])) {
  3940. if (rscriptType.test(elem.type || "")) {
  3941. scripts.push(elem);
  3942. }
  3943. }
  3944. }
  3945. }
  3946. return fragment;
  3947. }
  3948. (function () {
  3949. var fragment = document.createDocumentFragment(),
  3950. div = fragment.appendChild(document.createElement("div")),
  3951. input = document.createElement("input");
  3952. // Support: Android 4.0 - 4.3 only
  3953. // Check state lost if the name is set (#11217)
  3954. // Support: Windows Web Apps (WWA)
  3955. // `name` and `type` must use .setAttribute for WWA (#14901)
  3956. input.setAttribute("type", "radio");
  3957. input.setAttribute("checked", "checked");
  3958. input.setAttribute("name", "t");
  3959. div.appendChild(input);
  3960. // Support: Android <=4.1 only
  3961. // Older WebKit doesn't clone checked state correctly in fragments
  3962. support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
  3963. // Support: IE <=11 only
  3964. // Make sure textarea (and checkbox) defaultValue is properly cloned
  3965. div.innerHTML = "<textarea>x</textarea>";
  3966. support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
  3967. })();
  3968. var documentElement = document.documentElement;
  3969. var
  3970. rkeyEvent = /^key/,
  3971. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  3972. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  3973. function returnTrue() {
  3974. return true;
  3975. }
  3976. function returnFalse() {
  3977. return false;
  3978. }
  3979. // Support: IE <=9 only
  3980. // See #13393 for more info
  3981. function safeActiveElement() {
  3982. try {
  3983. return document.activeElement;
  3984. } catch (err) { }
  3985. }
  3986. function on(elem, types, selector, data, fn, one) {
  3987. var origFn, type;
  3988. // Types can be a map of types/handlers
  3989. if (typeof types === "object") {
  3990. // ( types-Object, selector, data )
  3991. if (typeof selector !== "string") {
  3992. // ( types-Object, data )
  3993. data = data || selector;
  3994. selector = undefined;
  3995. }
  3996. for (type in types) {
  3997. on(elem, type, selector, data, types[type], one);
  3998. }
  3999. return elem;
  4000. }
  4001. if (data == null && fn == null) {
  4002. // ( types, fn )
  4003. fn = selector;
  4004. data = selector = undefined;
  4005. } else if (fn == null) {
  4006. if (typeof selector === "string") {
  4007. // ( types, selector, fn )
  4008. fn = data;
  4009. data = undefined;
  4010. } else {
  4011. // ( types, data, fn )
  4012. fn = data;
  4013. data = selector;
  4014. selector = undefined;
  4015. }
  4016. }
  4017. if (fn === false) {
  4018. fn = returnFalse;
  4019. } else if (!fn) {
  4020. return elem;
  4021. }
  4022. if (one === 1) {
  4023. origFn = fn;
  4024. fn = function (event) {
  4025. // Can use an empty set, since event contains the info
  4026. jQuery().off(event);
  4027. return origFn.apply(this, arguments);
  4028. };
  4029. // Use same guid so caller can remove using origFn
  4030. fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);
  4031. }
  4032. return elem.each(function () {
  4033. jQuery.event.add(this, types, fn, data, selector);
  4034. });
  4035. }
  4036. /*
  4037. * Helper functions for managing events -- not part of the public interface.
  4038. * Props to Dean Edwards' addEvent library for many of the ideas.
  4039. */
  4040. jQuery.event = {
  4041. global: {},
  4042. add: function (elem, types, handler, data, selector) {
  4043. var handleObjIn, eventHandle, tmp,
  4044. events, t, handleObj,
  4045. special, handlers, type, namespaces, origType,
  4046. elemData = dataPriv.get(elem);
  4047. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  4048. if (!elemData) {
  4049. return;
  4050. }
  4051. // Caller can pass in an object of custom data in lieu of the handler
  4052. if (handler.handler) {
  4053. handleObjIn = handler;
  4054. handler = handleObjIn.handler;
  4055. selector = handleObjIn.selector;
  4056. }
  4057. // Ensure that invalid selectors throw exceptions at attach time
  4058. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  4059. if (selector) {
  4060. jQuery.find.matchesSelector(documentElement, selector);
  4061. }
  4062. // Make sure that the handler has a unique ID, used to find/remove it later
  4063. if (!handler.guid) {
  4064. handler.guid = jQuery.guid++;
  4065. }
  4066. // Init the element's event structure and main handler, if this is the first
  4067. if (!(events = elemData.events)) {
  4068. events = elemData.events = {};
  4069. }
  4070. if (!(eventHandle = elemData.handle)) {
  4071. eventHandle = elemData.handle = function (e) {
  4072. // Discard the second event of a jQuery.event.trigger() and
  4073. // when an event is called after a page has unloaded
  4074. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  4075. jQuery.event.dispatch.apply(elem, arguments) : undefined;
  4076. };
  4077. }
  4078. // Handle multiple events separated by a space
  4079. types = (types || "").match(rnothtmlwhite) || [""];
  4080. t = types.length;
  4081. while (t--) {
  4082. tmp = rtypenamespace.exec(types[t]) || [];
  4083. type = origType = tmp[1];
  4084. namespaces = (tmp[2] || "").split(".").sort();
  4085. // There *must* be a type, no attaching namespace-only handlers
  4086. if (!type) {
  4087. continue;
  4088. }
  4089. // If event changes its type, use the special event handlers for the changed type
  4090. special = jQuery.event.special[type] || {};
  4091. // If selector defined, determine special event api type, otherwise given type
  4092. type = (selector ? special.delegateType : special.bindType) || type;
  4093. // Update special based on newly reset type
  4094. special = jQuery.event.special[type] || {};
  4095. // handleObj is passed to all event handlers
  4096. handleObj = jQuery.extend({
  4097. type: type,
  4098. origType: origType,
  4099. data: data,
  4100. handler: handler,
  4101. guid: handler.guid,
  4102. selector: selector,
  4103. needsContext: selector && jQuery.expr.match.needsContext.test(selector),
  4104. namespace: namespaces.join(".")
  4105. }, handleObjIn);
  4106. // Init the event handler queue if we're the first
  4107. if (!(handlers = events[type])) {
  4108. handlers = events[type] = [];
  4109. handlers.delegateCount = 0;
  4110. // Only use addEventListener if the special events handler returns false
  4111. if (!special.setup ||
  4112. special.setup.call(elem, data, namespaces, eventHandle) === false) {
  4113. if (elem.addEventListener) {
  4114. elem.addEventListener(type, eventHandle);
  4115. }
  4116. }
  4117. }
  4118. if (special.add) {
  4119. special.add.call(elem, handleObj);
  4120. if (!handleObj.handler.guid) {
  4121. handleObj.handler.guid = handler.guid;
  4122. }
  4123. }
  4124. // Add to the element's handler list, delegates in front
  4125. if (selector) {
  4126. handlers.splice(handlers.delegateCount++, 0, handleObj);
  4127. } else {
  4128. handlers.push(handleObj);
  4129. }
  4130. // Keep track of which events have ever been used, for event optimization
  4131. jQuery.event.global[type] = true;
  4132. }
  4133. },
  4134. // Detach an event or set of events from an element
  4135. remove: function (elem, types, handler, selector, mappedTypes) {
  4136. var j, origCount, tmp,
  4137. events, t, handleObj,
  4138. special, handlers, type, namespaces, origType,
  4139. elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
  4140. if (!elemData || !(events = elemData.events)) {
  4141. return;
  4142. }
  4143. // Once for each type.namespace in types; type may be omitted
  4144. types = (types || "").match(rnothtmlwhite) || [""];
  4145. t = types.length;
  4146. while (t--) {
  4147. tmp = rtypenamespace.exec(types[t]) || [];
  4148. type = origType = tmp[1];
  4149. namespaces = (tmp[2] || "").split(".").sort();
  4150. // Unbind all events (on this namespace, if provided) for the element
  4151. if (!type) {
  4152. for (type in events) {
  4153. jQuery.event.remove(elem, type + types[t], handler, selector, true);
  4154. }
  4155. continue;
  4156. }
  4157. special = jQuery.event.special[type] || {};
  4158. type = (selector ? special.delegateType : special.bindType) || type;
  4159. handlers = events[type] || [];
  4160. tmp = tmp[2] &&
  4161. new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
  4162. // Remove matching events
  4163. origCount = j = handlers.length;
  4164. while (j--) {
  4165. handleObj = handlers[j];
  4166. if ((mappedTypes || origType === handleObj.origType) &&
  4167. (!handler || handler.guid === handleObj.guid) &&
  4168. (!tmp || tmp.test(handleObj.namespace)) &&
  4169. (!selector || selector === handleObj.selector ||
  4170. selector === "**" && handleObj.selector)) {
  4171. handlers.splice(j, 1);
  4172. if (handleObj.selector) {
  4173. handlers.delegateCount--;
  4174. }
  4175. if (special.remove) {
  4176. special.remove.call(elem, handleObj);
  4177. }
  4178. }
  4179. }
  4180. // Remove generic event handler if we removed something and no more handlers exist
  4181. // (avoids potential for endless recursion during removal of special event handlers)
  4182. if (origCount && !handlers.length) {
  4183. if (!special.teardown ||
  4184. special.teardown.call(elem, namespaces, elemData.handle) === false) {
  4185. jQuery.removeEvent(elem, type, elemData.handle);
  4186. }
  4187. delete events[type];
  4188. }
  4189. }
  4190. // Remove data and the expando if it's no longer used
  4191. if (jQuery.isEmptyObject(events)) {
  4192. dataPriv.remove(elem, "handle events");
  4193. }
  4194. },
  4195. dispatch: function (nativeEvent) {
  4196. // Make a writable jQuery.Event from the native event object
  4197. var event = jQuery.event.fix(nativeEvent);
  4198. var i, j, ret, matched, handleObj, handlerQueue,
  4199. args = new Array(arguments.length),
  4200. handlers = (dataPriv.get(this, "events") || {})[event.type] || [],
  4201. special = jQuery.event.special[event.type] || {};
  4202. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  4203. args[0] = event;
  4204. for (i = 1; i < arguments.length; i++) {
  4205. args[i] = arguments[i];
  4206. }
  4207. event.delegateTarget = this;
  4208. // Call the preDispatch hook for the mapped type, and let it bail if desired
  4209. if (special.preDispatch && special.preDispatch.call(this, event) === false) {
  4210. return;
  4211. }
  4212. // Determine handlers
  4213. handlerQueue = jQuery.event.handlers.call(this, event, handlers);
  4214. // Run delegates first; they may want to stop propagation beneath us
  4215. i = 0;
  4216. while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
  4217. event.currentTarget = matched.elem;
  4218. j = 0;
  4219. while ((handleObj = matched.handlers[j++]) &&
  4220. !event.isImmediatePropagationStopped()) {
  4221. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  4222. // a subset or equal to those in the bound event (both can have no namespace).
  4223. if (!event.rnamespace || event.rnamespace.test(handleObj.namespace)) {
  4224. event.handleObj = handleObj;
  4225. event.data = handleObj.data;
  4226. ret = ((jQuery.event.special[handleObj.origType] || {}).handle ||
  4227. handleObj.handler).apply(matched.elem, args);
  4228. if (ret !== undefined) {
  4229. if ((event.result = ret) === false) {
  4230. event.preventDefault();
  4231. event.stopPropagation();
  4232. }
  4233. }
  4234. }
  4235. }
  4236. }
  4237. // Call the postDispatch hook for the mapped type
  4238. if (special.postDispatch) {
  4239. special.postDispatch.call(this, event);
  4240. }
  4241. return event.result;
  4242. },
  4243. handlers: function (event, handlers) {
  4244. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  4245. handlerQueue = [],
  4246. delegateCount = handlers.delegateCount,
  4247. cur = event.target;
  4248. // Find delegate handlers
  4249. if (delegateCount &&
  4250. // Support: IE <=9
  4251. // Black-hole SVG <use> instance trees (trac-13180)
  4252. cur.nodeType &&
  4253. // Support: Firefox <=42
  4254. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  4255. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  4256. // Support: IE 11 only
  4257. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  4258. !(event.type === "click" && event.button >= 1)) {
  4259. for (; cur !== this; cur = cur.parentNode || this) {
  4260. // Don't check non-elements (#13208)
  4261. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  4262. if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) {
  4263. matchedHandlers = [];
  4264. matchedSelectors = {};
  4265. for (i = 0; i < delegateCount; i++) {
  4266. handleObj = handlers[i];
  4267. // Don't conflict with Object.prototype properties (#13203)
  4268. sel = handleObj.selector + " ";
  4269. if (matchedSelectors[sel] === undefined) {
  4270. matchedSelectors[sel] = handleObj.needsContext ?
  4271. jQuery(sel, this).index(cur) > -1 :
  4272. jQuery.find(sel, this, null, [cur]).length;
  4273. }
  4274. if (matchedSelectors[sel]) {
  4275. matchedHandlers.push(handleObj);
  4276. }
  4277. }
  4278. if (matchedHandlers.length) {
  4279. handlerQueue.push({ elem: cur, handlers: matchedHandlers });
  4280. }
  4281. }
  4282. }
  4283. }
  4284. // Add the remaining (directly-bound) handlers
  4285. cur = this;
  4286. if (delegateCount < handlers.length) {
  4287. handlerQueue.push({ elem: cur, handlers: handlers.slice(delegateCount) });
  4288. }
  4289. return handlerQueue;
  4290. },
  4291. addProp: function (name, hook) {
  4292. Object.defineProperty(jQuery.Event.prototype, name, {
  4293. enumerable: true,
  4294. configurable: true,
  4295. get: isFunction(hook) ?
  4296. function () {
  4297. if (this.originalEvent) {
  4298. return hook(this.originalEvent);
  4299. }
  4300. } :
  4301. function () {
  4302. if (this.originalEvent) {
  4303. return this.originalEvent[name];
  4304. }
  4305. },
  4306. set: function (value) {
  4307. Object.defineProperty(this, name, {
  4308. enumerable: true,
  4309. configurable: true,
  4310. writable: true,
  4311. value: value
  4312. });
  4313. }
  4314. });
  4315. },
  4316. fix: function (originalEvent) {
  4317. return originalEvent[jQuery.expando] ?
  4318. originalEvent :
  4319. new jQuery.Event(originalEvent);
  4320. },
  4321. special: {
  4322. load: {
  4323. // Prevent triggered image.load events from bubbling to window.load
  4324. noBubble: true
  4325. },
  4326. focus: {
  4327. // Fire native event if possible so blur/focus sequence is correct
  4328. trigger: function () {
  4329. if (this !== safeActiveElement() && this.focus) {
  4330. this.focus();
  4331. return false;
  4332. }
  4333. },
  4334. delegateType: "focusin"
  4335. },
  4336. blur: {
  4337. trigger: function () {
  4338. if (this === safeActiveElement() && this.blur) {
  4339. this.blur();
  4340. return false;
  4341. }
  4342. },
  4343. delegateType: "focusout"
  4344. },
  4345. click: {
  4346. // For checkbox, fire native event so checked state will be right
  4347. trigger: function () {
  4348. if (this.type === "checkbox" && this.click && nodeName(this, "input")) {
  4349. this.click();
  4350. return false;
  4351. }
  4352. },
  4353. // For cross-browser consistency, don't fire native .click() on links
  4354. _default: function (event) {
  4355. return nodeName(event.target, "a");
  4356. }
  4357. },
  4358. beforeunload: {
  4359. postDispatch: function (event) {
  4360. // Support: Firefox 20+
  4361. // Firefox doesn't alert if the returnValue field is not set.
  4362. if (event.result !== undefined && event.originalEvent) {
  4363. event.originalEvent.returnValue = event.result;
  4364. }
  4365. }
  4366. }
  4367. }
  4368. };
  4369. jQuery.removeEvent = function (elem, type, handle) {
  4370. // This "if" is needed for plain objects
  4371. if (elem.removeEventListener) {
  4372. elem.removeEventListener(type, handle);
  4373. }
  4374. };
  4375. jQuery.Event = function (src, props) {
  4376. // Allow instantiation without the 'new' keyword
  4377. if (!(this instanceof jQuery.Event)) {
  4378. return new jQuery.Event(src, props);
  4379. }
  4380. // Event object
  4381. if (src && src.type) {
  4382. this.originalEvent = src;
  4383. this.type = src.type;
  4384. // Events bubbling up the document may have been marked as prevented
  4385. // by a handler lower down the tree; reflect the correct value.
  4386. this.isDefaultPrevented = src.defaultPrevented ||
  4387. src.defaultPrevented === undefined &&
  4388. // Support: Android <=2.3 only
  4389. src.returnValue === false ?
  4390. returnTrue :
  4391. returnFalse;
  4392. // Create target properties
  4393. // Support: Safari <=6 - 7 only
  4394. // Target should not be a text node (#504, #13143)
  4395. this.target = (src.target && src.target.nodeType === 3) ?
  4396. src.target.parentNode :
  4397. src.target;
  4398. this.currentTarget = src.currentTarget;
  4399. this.relatedTarget = src.relatedTarget;
  4400. // Event type
  4401. } else {
  4402. this.type = src;
  4403. }
  4404. // Put explicitly provided properties onto the event object
  4405. if (props) {
  4406. jQuery.extend(this, props);
  4407. }
  4408. // Create a timestamp if incoming event doesn't have one
  4409. this.timeStamp = src && src.timeStamp || Date.now();
  4410. // Mark it as fixed
  4411. this[jQuery.expando] = true;
  4412. };
  4413. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  4414. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  4415. jQuery.Event.prototype = {
  4416. constructor: jQuery.Event,
  4417. isDefaultPrevented: returnFalse,
  4418. isPropagationStopped: returnFalse,
  4419. isImmediatePropagationStopped: returnFalse,
  4420. isSimulated: false,
  4421. preventDefault: function () {
  4422. var e = this.originalEvent;
  4423. this.isDefaultPrevented = returnTrue;
  4424. if (e && !this.isSimulated) {
  4425. e.preventDefault();
  4426. }
  4427. },
  4428. stopPropagation: function () {
  4429. var e = this.originalEvent;
  4430. this.isPropagationStopped = returnTrue;
  4431. if (e && !this.isSimulated) {
  4432. e.stopPropagation();
  4433. }
  4434. },
  4435. stopImmediatePropagation: function () {
  4436. var e = this.originalEvent;
  4437. this.isImmediatePropagationStopped = returnTrue;
  4438. if (e && !this.isSimulated) {
  4439. e.stopImmediatePropagation();
  4440. }
  4441. this.stopPropagation();
  4442. }
  4443. };
  4444. // Includes all common event props including KeyEvent and MouseEvent specific props
  4445. jQuery.each({
  4446. altKey: true,
  4447. bubbles: true,
  4448. cancelable: true,
  4449. changedTouches: true,
  4450. ctrlKey: true,
  4451. detail: true,
  4452. eventPhase: true,
  4453. metaKey: true,
  4454. pageX: true,
  4455. pageY: true,
  4456. shiftKey: true,
  4457. view: true,
  4458. "char": true,
  4459. charCode: true,
  4460. key: true,
  4461. keyCode: true,
  4462. button: true,
  4463. buttons: true,
  4464. clientX: true,
  4465. clientY: true,
  4466. offsetX: true,
  4467. offsetY: true,
  4468. pointerId: true,
  4469. pointerType: true,
  4470. screenX: true,
  4471. screenY: true,
  4472. targetTouches: true,
  4473. toElement: true,
  4474. touches: true,
  4475. which: function (event) {
  4476. var button = event.button;
  4477. // Add which for key events
  4478. if (event.which == null && rkeyEvent.test(event.type)) {
  4479. return event.charCode != null ? event.charCode : event.keyCode;
  4480. }
  4481. // Add which for click: 1 === left; 2 === middle; 3 === right
  4482. if (!event.which && button !== undefined && rmouseEvent.test(event.type)) {
  4483. if (button & 1) {
  4484. return 1;
  4485. }
  4486. if (button & 2) {
  4487. return 3;
  4488. }
  4489. if (button & 4) {
  4490. return 2;
  4491. }
  4492. return 0;
  4493. }
  4494. return event.which;
  4495. }
  4496. }, jQuery.event.addProp);
  4497. // Create mouseenter/leave events using mouseover/out and event-time checks
  4498. // so that event delegation works in jQuery.
  4499. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  4500. //
  4501. // Support: Safari 7 only
  4502. // Safari sends mouseenter too often; see:
  4503. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  4504. // for the description of the bug (it existed in older Chrome versions as well).
  4505. jQuery.each({
  4506. mouseenter: "mouseover",
  4507. mouseleave: "mouseout",
  4508. pointerenter: "pointerover",
  4509. pointerleave: "pointerout"
  4510. }, function (orig, fix) {
  4511. jQuery.event.special[orig] = {
  4512. delegateType: fix,
  4513. bindType: fix,
  4514. handle: function (event) {
  4515. var ret,
  4516. target = this,
  4517. related = event.relatedTarget,
  4518. handleObj = event.handleObj;
  4519. // For mouseenter/leave call the handler if related is outside the target.
  4520. // NB: No relatedTarget if the mouse left/entered the browser window
  4521. if (!related || (related !== target && !jQuery.contains(target, related))) {
  4522. event.type = handleObj.origType;
  4523. ret = handleObj.handler.apply(this, arguments);
  4524. event.type = fix;
  4525. }
  4526. return ret;
  4527. }
  4528. };
  4529. });
  4530. jQuery.fn.extend({
  4531. on: function (types, selector, data, fn) {
  4532. return on(this, types, selector, data, fn);
  4533. },
  4534. one: function (types, selector, data, fn) {
  4535. return on(this, types, selector, data, fn, 1);
  4536. },
  4537. off: function (types, selector, fn) {
  4538. var handleObj, type;
  4539. if (types && types.preventDefault && types.handleObj) {
  4540. // ( event ) dispatched jQuery.Event
  4541. handleObj = types.handleObj;
  4542. jQuery(types.delegateTarget).off(
  4543. handleObj.namespace ?
  4544. handleObj.origType + "." + handleObj.namespace :
  4545. handleObj.origType,
  4546. handleObj.selector,
  4547. handleObj.handler
  4548. );
  4549. return this;
  4550. }
  4551. if (typeof types === "object") {
  4552. // ( types-object [, selector] )
  4553. for (type in types) {
  4554. this.off(type, selector, types[type]);
  4555. }
  4556. return this;
  4557. }
  4558. if (selector === false || typeof selector === "function") {
  4559. // ( types [, fn] )
  4560. fn = selector;
  4561. selector = undefined;
  4562. }
  4563. if (fn === false) {
  4564. fn = returnFalse;
  4565. }
  4566. return this.each(function () {
  4567. jQuery.event.remove(this, types, fn, selector);
  4568. });
  4569. }
  4570. });
  4571. var
  4572. /* eslint-disable max-len */
  4573. // See https://github.com/eslint/eslint/issues/3229
  4574. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  4575. /* eslint-enable */
  4576. // Support: IE <=10 - 11, Edge 12 - 13 only
  4577. // In IE/Edge using regex groups here causes severe slowdowns.
  4578. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  4579. rnoInnerhtml = /<script|<style|<link/i,
  4580. // checked="checked" or checked
  4581. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  4582. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  4583. // Prefer a tbody over its parent table for containing new rows
  4584. function manipulationTarget(elem, content) {
  4585. if (nodeName(elem, "table") &&
  4586. nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) {
  4587. return jQuery(elem).children("tbody")[0] || elem;
  4588. }
  4589. return elem;
  4590. }
  4591. // Replace/restore the type attribute of script elements for safe DOM manipulation
  4592. function disableScript(elem) {
  4593. elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
  4594. return elem;
  4595. }
  4596. function restoreScript(elem) {
  4597. if ((elem.type || "").slice(0, 5) === "true/") {
  4598. elem.type = elem.type.slice(5);
  4599. } else {
  4600. elem.removeAttribute("type");
  4601. }
  4602. return elem;
  4603. }
  4604. function cloneCopyEvent(src, dest) {
  4605. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  4606. if (dest.nodeType !== 1) {
  4607. return;
  4608. }
  4609. // 1. Copy private data: events, handlers, etc.
  4610. if (dataPriv.hasData(src)) {
  4611. pdataOld = dataPriv.access(src);
  4612. pdataCur = dataPriv.set(dest, pdataOld);
  4613. events = pdataOld.events;
  4614. if (events) {
  4615. delete pdataCur.handle;
  4616. pdataCur.events = {};
  4617. for (type in events) {
  4618. for (i = 0, l = events[type].length; i < l; i++) {
  4619. jQuery.event.add(dest, type, events[type][i]);
  4620. }
  4621. }
  4622. }
  4623. }
  4624. // 2. Copy user data
  4625. if (dataUser.hasData(src)) {
  4626. udataOld = dataUser.access(src);
  4627. udataCur = jQuery.extend({}, udataOld);
  4628. dataUser.set(dest, udataCur);
  4629. }
  4630. }
  4631. // Fix IE bugs, see support tests
  4632. function fixInput(src, dest) {
  4633. var nodeName = dest.nodeName.toLowerCase();
  4634. // Fails to persist the checked state of a cloned checkbox or radio button.
  4635. if (nodeName === "input" && rcheckableType.test(src.type)) {
  4636. dest.checked = src.checked;
  4637. // Fails to return the selected option to the default selected state when cloning options
  4638. } else if (nodeName === "input" || nodeName === "textarea") {
  4639. dest.defaultValue = src.defaultValue;
  4640. }
  4641. }
  4642. function domManip(collection, args, callback, ignored) {
  4643. // Flatten any nested arrays
  4644. args = concat.apply([], args);
  4645. var fragment, first, scripts, hasScripts, node, doc,
  4646. i = 0,
  4647. l = collection.length,
  4648. iNoClone = l - 1,
  4649. value = args[0],
  4650. valueIsFunction = isFunction(value);
  4651. // We can't cloneNode fragments that contain checked, in WebKit
  4652. if (valueIsFunction ||
  4653. (l > 1 && typeof value === "string" &&
  4654. !support.checkClone && rchecked.test(value))) {
  4655. return collection.each(function (index) {
  4656. var self = collection.eq(index);
  4657. if (valueIsFunction) {
  4658. args[0] = value.call(this, index, self.html());
  4659. }
  4660. domManip(self, args, callback, ignored);
  4661. });
  4662. }
  4663. if (l) {
  4664. fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);
  4665. first = fragment.firstChild;
  4666. if (fragment.childNodes.length === 1) {
  4667. fragment = first;
  4668. }
  4669. // Require either new content or an interest in ignored elements to invoke the callback
  4670. if (first || ignored) {
  4671. scripts = jQuery.map(getAll(fragment, "script"), disableScript);
  4672. hasScripts = scripts.length;
  4673. // Use the original fragment for the last item
  4674. // instead of the first because it can end up
  4675. // being emptied incorrectly in certain situations (#8070).
  4676. for (; i < l; i++) {
  4677. node = fragment;
  4678. if (i !== iNoClone) {
  4679. node = jQuery.clone(node, true, true);
  4680. // Keep references to cloned scripts for later restoration
  4681. if (hasScripts) {
  4682. // Support: Android <=4.0 only, PhantomJS 1 only
  4683. // push.apply(_, arraylike) throws on ancient WebKit
  4684. jQuery.merge(scripts, getAll(node, "script"));
  4685. }
  4686. }
  4687. callback.call(collection[i], node, i);
  4688. }
  4689. if (hasScripts) {
  4690. doc = scripts[scripts.length - 1].ownerDocument;
  4691. // Reenable scripts
  4692. jQuery.map(scripts, restoreScript);
  4693. // Evaluate executable scripts on first document insertion
  4694. for (i = 0; i < hasScripts; i++) {
  4695. node = scripts[i];
  4696. if (rscriptType.test(node.type || "") &&
  4697. !dataPriv.access(node, "globalEval") &&
  4698. jQuery.contains(doc, node)) {
  4699. if (node.src && (node.type || "").toLowerCase() !== "module") {
  4700. // Optional AJAX dependency, but won't run scripts if not present
  4701. if (jQuery._evalUrl) {
  4702. jQuery._evalUrl(node.src);
  4703. }
  4704. } else {
  4705. DOMEval(node.textContent.replace(rcleanScript, ""), doc, node);
  4706. }
  4707. }
  4708. }
  4709. }
  4710. }
  4711. }
  4712. return collection;
  4713. }
  4714. function remove(elem, selector, keepData) {
  4715. var node,
  4716. nodes = selector ? jQuery.filter(selector, elem) : elem,
  4717. i = 0;
  4718. for (; (node = nodes[i]) != null; i++) {
  4719. if (!keepData && node.nodeType === 1) {
  4720. jQuery.cleanData(getAll(node));
  4721. }
  4722. if (node.parentNode) {
  4723. if (keepData && jQuery.contains(node.ownerDocument, node)) {
  4724. setGlobalEval(getAll(node, "script"));
  4725. }
  4726. node.parentNode.removeChild(node);
  4727. }
  4728. }
  4729. return elem;
  4730. }
  4731. jQuery.extend({
  4732. htmlPrefilter: function (html) {
  4733. return html.replace(rxhtmlTag, "<$1></$2>");
  4734. },
  4735. clone: function (elem, dataAndEvents, deepDataAndEvents) {
  4736. var i, l, srcElements, destElements,
  4737. clone = elem.cloneNode(true),
  4738. inPage = jQuery.contains(elem.ownerDocument, elem);
  4739. // Fix IE cloning issues
  4740. if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) &&
  4741. !jQuery.isXMLDoc(elem)) {
  4742. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  4743. destElements = getAll(clone);
  4744. srcElements = getAll(elem);
  4745. for (i = 0, l = srcElements.length; i < l; i++) {
  4746. fixInput(srcElements[i], destElements[i]);
  4747. }
  4748. }
  4749. // Copy the events from the original to the clone
  4750. if (dataAndEvents) {
  4751. if (deepDataAndEvents) {
  4752. srcElements = srcElements || getAll(elem);
  4753. destElements = destElements || getAll(clone);
  4754. for (i = 0, l = srcElements.length; i < l; i++) {
  4755. cloneCopyEvent(srcElements[i], destElements[i]);
  4756. }
  4757. } else {
  4758. cloneCopyEvent(elem, clone);
  4759. }
  4760. }
  4761. // Preserve script evaluation history
  4762. destElements = getAll(clone, "script");
  4763. if (destElements.length > 0) {
  4764. setGlobalEval(destElements, !inPage && getAll(elem, "script"));
  4765. }
  4766. // Return the cloned set
  4767. return clone;
  4768. },
  4769. cleanData: function (elems) {
  4770. var data, elem, type,
  4771. special = jQuery.event.special,
  4772. i = 0;
  4773. for (; (elem = elems[i]) !== undefined; i++) {
  4774. if (acceptData(elem)) {
  4775. if ((data = elem[dataPriv.expando])) {
  4776. if (data.events) {
  4777. for (type in data.events) {
  4778. if (special[type]) {
  4779. jQuery.event.remove(elem, type);
  4780. // This is a shortcut to avoid jQuery.event.remove's overhead
  4781. } else {
  4782. jQuery.removeEvent(elem, type, data.handle);
  4783. }
  4784. }
  4785. }
  4786. // Support: Chrome <=35 - 45+
  4787. // Assign undefined instead of using delete, see Data#remove
  4788. elem[dataPriv.expando] = undefined;
  4789. }
  4790. if (elem[dataUser.expando]) {
  4791. // Support: Chrome <=35 - 45+
  4792. // Assign undefined instead of using delete, see Data#remove
  4793. elem[dataUser.expando] = undefined;
  4794. }
  4795. }
  4796. }
  4797. }
  4798. });
  4799. jQuery.fn.extend({
  4800. detach: function (selector) {
  4801. return remove(this, selector, true);
  4802. },
  4803. remove: function (selector) {
  4804. return remove(this, selector);
  4805. },
  4806. text: function (value) {
  4807. return access(this, function (value) {
  4808. return value === undefined ?
  4809. jQuery.text(this) :
  4810. this.empty().each(function () {
  4811. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  4812. this.textContent = value;
  4813. }
  4814. });
  4815. }, null, value, arguments.length);
  4816. },
  4817. append: function () {
  4818. return domManip(this, arguments, function (elem) {
  4819. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  4820. var target = manipulationTarget(this, elem);
  4821. target.appendChild(elem);
  4822. }
  4823. });
  4824. },
  4825. prepend: function () {
  4826. return domManip(this, arguments, function (elem) {
  4827. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  4828. var target = manipulationTarget(this, elem);
  4829. target.insertBefore(elem, target.firstChild);
  4830. }
  4831. });
  4832. },
  4833. before: function () {
  4834. return domManip(this, arguments, function (elem) {
  4835. if (this.parentNode) {
  4836. this.parentNode.insertBefore(elem, this);
  4837. }
  4838. });
  4839. },
  4840. after: function () {
  4841. return domManip(this, arguments, function (elem) {
  4842. if (this.parentNode) {
  4843. this.parentNode.insertBefore(elem, this.nextSibling);
  4844. }
  4845. });
  4846. },
  4847. empty: function () {
  4848. var elem,
  4849. i = 0;
  4850. for (; (elem = this[i]) != null; i++) {
  4851. if (elem.nodeType === 1) {
  4852. // Prevent memory leaks
  4853. jQuery.cleanData(getAll(elem, false));
  4854. // Remove any remaining nodes
  4855. elem.textContent = "";
  4856. }
  4857. }
  4858. return this;
  4859. },
  4860. clone: function (dataAndEvents, deepDataAndEvents) {
  4861. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  4862. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  4863. return this.map(function () {
  4864. return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
  4865. });
  4866. },
  4867. html: function (value) {
  4868. return access(this, function (value) {
  4869. var elem = this[0] || {},
  4870. i = 0,
  4871. l = this.length;
  4872. if (value === undefined && elem.nodeType === 1) {
  4873. return elem.innerHTML;
  4874. }
  4875. // See if we can take a shortcut and just use innerHTML
  4876. if (typeof value === "string" && !rnoInnerhtml.test(value) &&
  4877. !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
  4878. value = jQuery.htmlPrefilter(value);
  4879. try {
  4880. for (; i < l; i++) {
  4881. elem = this[i] || {};
  4882. // Remove element nodes and prevent memory leaks
  4883. if (elem.nodeType === 1) {
  4884. jQuery.cleanData(getAll(elem, false));
  4885. elem.innerHTML = value;
  4886. }
  4887. }
  4888. elem = 0;
  4889. // If using innerHTML throws an exception, use the fallback method
  4890. } catch (e) { }
  4891. }
  4892. if (elem) {
  4893. this.empty().append(value);
  4894. }
  4895. }, null, value, arguments.length);
  4896. },
  4897. replaceWith: function () {
  4898. var ignored = [];
  4899. // Make the changes, replacing each non-ignored context element with the new content
  4900. return domManip(this, arguments, function (elem) {
  4901. var parent = this.parentNode;
  4902. if (jQuery.inArray(this, ignored) < 0) {
  4903. jQuery.cleanData(getAll(this));
  4904. if (parent) {
  4905. parent.replaceChild(elem, this);
  4906. }
  4907. }
  4908. // Force callback invocation
  4909. }, ignored);
  4910. }
  4911. });
  4912. jQuery.each({
  4913. appendTo: "append",
  4914. prependTo: "prepend",
  4915. insertBefore: "before",
  4916. insertAfter: "after",
  4917. replaceAll: "replaceWith"
  4918. }, function (name, original) {
  4919. jQuery.fn[name] = function (selector) {
  4920. var elems,
  4921. ret = [],
  4922. insert = jQuery(selector),
  4923. last = insert.length - 1,
  4924. i = 0;
  4925. for (; i <= last; i++) {
  4926. elems = i === last ? this : this.clone(true);
  4927. jQuery(insert[i])[original](elems);
  4928. // Support: Android <=4.0 only, PhantomJS 1 only
  4929. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  4930. push.apply(ret, elems.get());
  4931. }
  4932. return this.pushStack(ret);
  4933. };
  4934. });
  4935. var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
  4936. var getStyles = function (elem) {
  4937. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  4938. // IE throws on elements created in popups
  4939. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  4940. var view = elem.ownerDocument.defaultView;
  4941. if (!view || !view.opener) {
  4942. view = window;
  4943. }
  4944. return view.getComputedStyle(elem);
  4945. };
  4946. var rboxStyle = new RegExp(cssExpand.join("|"), "i");
  4947. (function () {
  4948. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  4949. // so they're executed at the same time to save the second computation.
  4950. function computeStyleTests() {
  4951. // This is a singleton, we need to execute it only once
  4952. if (!div) {
  4953. return;
  4954. }
  4955. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  4956. "margin-top:1px;padding:0;border:0";
  4957. div.style.cssText =
  4958. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  4959. "margin:auto;border:1px;padding:1px;" +
  4960. "width:60%;top:1%";
  4961. documentElement.appendChild(container).appendChild(div);
  4962. var divStyle = window.getComputedStyle(div);
  4963. pixelPositionVal = divStyle.top !== "1%";
  4964. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  4965. reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;
  4966. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  4967. // Some styles come back with percentage values, even though they shouldn't
  4968. div.style.right = "60%";
  4969. pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;
  4970. // Support: IE 9 - 11 only
  4971. // Detect misreporting of content dimensions for box-sizing:border-box elements
  4972. boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;
  4973. // Support: IE 9 only
  4974. // Detect overflow:scroll screwiness (gh-3699)
  4975. div.style.position = "absolute";
  4976. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  4977. documentElement.removeChild(container);
  4978. // Nullify the div so it wouldn't be stored in the memory and
  4979. // it will also be a sign that checks already performed
  4980. div = null;
  4981. }
  4982. function roundPixelMeasures(measure) {
  4983. return Math.round(parseFloat(measure));
  4984. }
  4985. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  4986. reliableMarginLeftVal,
  4987. container = document.createElement("div"),
  4988. div = document.createElement("div");
  4989. // Finish early in limited (non-browser) environments
  4990. if (!div.style) {
  4991. return;
  4992. }
  4993. // Support: IE <=9 - 11 only
  4994. // Style of cloned element affects source element cloned (#8908)
  4995. div.style.backgroundClip = "content-box";
  4996. div.cloneNode(true).style.backgroundClip = "";
  4997. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  4998. jQuery.extend(support, {
  4999. boxSizingReliable: function () {
  5000. computeStyleTests();
  5001. return boxSizingReliableVal;
  5002. },
  5003. pixelBoxStyles: function () {
  5004. computeStyleTests();
  5005. return pixelBoxStylesVal;
  5006. },
  5007. pixelPosition: function () {
  5008. computeStyleTests();
  5009. return pixelPositionVal;
  5010. },
  5011. reliableMarginLeft: function () {
  5012. computeStyleTests();
  5013. return reliableMarginLeftVal;
  5014. },
  5015. scrollboxSize: function () {
  5016. computeStyleTests();
  5017. return scrollboxSizeVal;
  5018. }
  5019. });
  5020. })();
  5021. function curCSS(elem, name, computed) {
  5022. var width, minWidth, maxWidth, ret,
  5023. // Support: Firefox 51+
  5024. // Retrieving style before computed somehow
  5025. // fixes an issue with getting wrong values
  5026. // on detached elements
  5027. style = elem.style;
  5028. computed = computed || getStyles(elem);
  5029. // getPropertyValue is needed for:
  5030. // .css('filter') (IE 9 only, #12537)
  5031. // .css('--customProperty) (#3144)
  5032. if (computed) {
  5033. ret = computed.getPropertyValue(name) || computed[name];
  5034. if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
  5035. ret = jQuery.style(elem, name);
  5036. }
  5037. // A tribute to the "awesome hack by Dean Edwards"
  5038. // Android Browser returns percentage for some values,
  5039. // but width seems to be reliably pixels.
  5040. // This is against the CSSOM draft spec:
  5041. // https://drafts.csswg.org/cssom/#resolved-values
  5042. if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {
  5043. // Remember the original values
  5044. width = style.width;
  5045. minWidth = style.minWidth;
  5046. maxWidth = style.maxWidth;
  5047. // Put in the new values to get a computed value out
  5048. style.minWidth = style.maxWidth = style.width = ret;
  5049. ret = computed.width;
  5050. // Revert the changed values
  5051. style.width = width;
  5052. style.minWidth = minWidth;
  5053. style.maxWidth = maxWidth;
  5054. }
  5055. }
  5056. return ret !== undefined ?
  5057. // Support: IE <=9 - 11 only
  5058. // IE returns zIndex value as an integer.
  5059. ret + "" :
  5060. ret;
  5061. }
  5062. function addGetHookIf(conditionFn, hookFn) {
  5063. // Define the hook, we'll check on the first run if it's really needed.
  5064. return {
  5065. get: function () {
  5066. if (conditionFn()) {
  5067. // Hook not needed (or it's not possible to use it due
  5068. // to missing dependency), remove it.
  5069. delete this.get;
  5070. return;
  5071. }
  5072. // Hook needed; redefine it so that the support test is not executed again.
  5073. return (this.get = hookFn).apply(this, arguments);
  5074. }
  5075. };
  5076. }
  5077. var
  5078. // Swappable if display is none or starts with table
  5079. // except "table", "table-cell", or "table-caption"
  5080. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  5081. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  5082. rcustomProp = /^--/,
  5083. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  5084. cssNormalTransform = {
  5085. letterSpacing: "0",
  5086. fontWeight: "400"
  5087. },
  5088. cssPrefixes = ["Webkit", "Moz", "ms"],
  5089. emptyStyle = document.createElement("div").style;
  5090. // Return a css property mapped to a potentially vendor prefixed property
  5091. function vendorPropName(name) {
  5092. // Shortcut for names that are not vendor prefixed
  5093. if (name in emptyStyle) {
  5094. return name;
  5095. }
  5096. // Check for vendor prefixed names
  5097. var capName = name[0].toUpperCase() + name.slice(1),
  5098. i = cssPrefixes.length;
  5099. while (i--) {
  5100. name = cssPrefixes[i] + capName;
  5101. if (name in emptyStyle) {
  5102. return name;
  5103. }
  5104. }
  5105. }
  5106. // Return a property mapped along what jQuery.cssProps suggests or to
  5107. // a vendor prefixed property.
  5108. function finalPropName(name) {
  5109. var ret = jQuery.cssProps[name];
  5110. if (!ret) {
  5111. ret = jQuery.cssProps[name] = vendorPropName(name) || name;
  5112. }
  5113. return ret;
  5114. }
  5115. function setPositiveNumber(elem, value, subtract) {
  5116. // Any relative (+/-) values have already been
  5117. // normalized at this point
  5118. var matches = rcssNum.exec(value);
  5119. return matches ?
  5120. // Guard against undefined "subtract", e.g., when used as in cssHooks
  5121. Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") :
  5122. value;
  5123. }
  5124. function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {
  5125. var i = dimension === "width" ? 1 : 0,
  5126. extra = 0,
  5127. delta = 0;
  5128. // Adjustment may not be necessary
  5129. if (box === (isBorderBox ? "border" : "content")) {
  5130. return 0;
  5131. }
  5132. for (; i < 4; i += 2) {
  5133. // Both box models exclude margin
  5134. if (box === "margin") {
  5135. delta += jQuery.css(elem, box + cssExpand[i], true, styles);
  5136. }
  5137. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  5138. if (!isBorderBox) {
  5139. // Add padding
  5140. delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  5141. // For "border" or "margin", add border
  5142. if (box !== "padding") {
  5143. delta += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  5144. // But still keep track of it otherwise
  5145. } else {
  5146. extra += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  5147. }
  5148. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  5149. // "padding" or "margin"
  5150. } else {
  5151. // For "content", subtract padding
  5152. if (box === "content") {
  5153. delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  5154. }
  5155. // For "content" or "padding", subtract border
  5156. if (box !== "margin") {
  5157. delta -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  5158. }
  5159. }
  5160. }
  5161. // Account for positive content-box scroll gutter when requested by providing computedVal
  5162. if (!isBorderBox && computedVal >= 0) {
  5163. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  5164. // Assuming integer scroll gutter, subtract the rest and round down
  5165. delta += Math.max(0, Math.ceil(
  5166. elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] -
  5167. computedVal -
  5168. delta -
  5169. extra -
  5170. 0.5
  5171. ));
  5172. }
  5173. return delta;
  5174. }
  5175. function getWidthOrHeight(elem, dimension, extra) {
  5176. // Start with computed style
  5177. var styles = getStyles(elem),
  5178. val = curCSS(elem, dimension, styles),
  5179. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  5180. valueIsBorderBox = isBorderBox;
  5181. // Support: Firefox <=54
  5182. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  5183. if (rnumnonpx.test(val)) {
  5184. if (!extra) {
  5185. return val;
  5186. }
  5187. val = "auto";
  5188. }
  5189. // Check for style in case a browser which returns unreliable values
  5190. // for getComputedStyle silently falls back to the reliable elem.style
  5191. valueIsBorderBox = valueIsBorderBox &&
  5192. (support.boxSizingReliable() || val === elem.style[dimension]);
  5193. // Fall back to offsetWidth/offsetHeight when value is "auto"
  5194. // This happens for inline elements with no explicit setting (gh-3571)
  5195. // Support: Android <=4.1 - 4.3 only
  5196. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  5197. if (val === "auto" ||
  5198. !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") {
  5199. val = elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)];
  5200. // offsetWidth/offsetHeight provide border-box values
  5201. valueIsBorderBox = true;
  5202. }
  5203. // Normalize "" and auto
  5204. val = parseFloat(val) || 0;
  5205. // Adjust for the element's box model
  5206. return (val +
  5207. boxModelAdjustment(
  5208. elem,
  5209. dimension,
  5210. extra || (isBorderBox ? "border" : "content"),
  5211. valueIsBorderBox,
  5212. styles,
  5213. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  5214. val
  5215. )
  5216. ) + "px";
  5217. }
  5218. jQuery.extend({
  5219. // Add in style property hooks for overriding the default
  5220. // behavior of getting and setting a style property
  5221. cssHooks: {
  5222. opacity: {
  5223. get: function (elem, computed) {
  5224. if (computed) {
  5225. // We should always get a number back from opacity
  5226. var ret = curCSS(elem, "opacity");
  5227. return ret === "" ? "1" : ret;
  5228. }
  5229. }
  5230. }
  5231. },
  5232. // Don't automatically add "px" to these possibly-unitless properties
  5233. cssNumber: {
  5234. "animationIterationCount": true,
  5235. "columnCount": true,
  5236. "fillOpacity": true,
  5237. "flexGrow": true,
  5238. "flexShrink": true,
  5239. "fontWeight": true,
  5240. "lineHeight": true,
  5241. "opacity": true,
  5242. "order": true,
  5243. "orphans": true,
  5244. "widows": true,
  5245. "zIndex": true,
  5246. "zoom": true
  5247. },
  5248. // Add in properties whose names you wish to fix before
  5249. // setting or getting the value
  5250. cssProps: {},
  5251. // Get and set the style property on a DOM Node
  5252. style: function (elem, name, value, extra) {
  5253. // Don't set styles on text and comment nodes
  5254. if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
  5255. return;
  5256. }
  5257. // Make sure that we're working with the right name
  5258. var ret, type, hooks,
  5259. origName = camelCase(name),
  5260. isCustomProp = rcustomProp.test(name),
  5261. style = elem.style;
  5262. // Make sure that we're working with the right name. We don't
  5263. // want to query the value if it is a CSS custom property
  5264. // since they are user-defined.
  5265. if (!isCustomProp) {
  5266. name = finalPropName(origName);
  5267. }
  5268. // Gets hook for the prefixed version, then unprefixed version
  5269. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  5270. // Check if we're setting a value
  5271. if (value !== undefined) {
  5272. type = typeof value;
  5273. // Convert "+=" or "-=" to relative numbers (#7345)
  5274. if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) {
  5275. value = adjustCSS(elem, name, ret);
  5276. // Fixes bug #9237
  5277. type = "number";
  5278. }
  5279. // Make sure that null and NaN values aren't set (#7116)
  5280. if (value == null || value !== value) {
  5281. return;
  5282. }
  5283. // If a number was passed in, add the unit (except for certain CSS properties)
  5284. if (type === "number") {
  5285. value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px");
  5286. }
  5287. // background-* props affect original clone's values
  5288. if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
  5289. style[name] = "inherit";
  5290. }
  5291. // If a hook was provided, use that value, otherwise just set the specified value
  5292. if (!hooks || !("set" in hooks) ||
  5293. (value = hooks.set(elem, value, extra)) !== undefined) {
  5294. if (isCustomProp) {
  5295. style.setProperty(name, value);
  5296. } else {
  5297. style[name] = value;
  5298. }
  5299. }
  5300. } else {
  5301. // If a hook was provided get the non-computed value from there
  5302. if (hooks && "get" in hooks &&
  5303. (ret = hooks.get(elem, false, extra)) !== undefined) {
  5304. return ret;
  5305. }
  5306. // Otherwise just get the value from the style object
  5307. return style[name];
  5308. }
  5309. },
  5310. css: function (elem, name, extra, styles) {
  5311. var val, num, hooks,
  5312. origName = camelCase(name),
  5313. isCustomProp = rcustomProp.test(name);
  5314. // Make sure that we're working with the right name. We don't
  5315. // want to modify the value if it is a CSS custom property
  5316. // since they are user-defined.
  5317. if (!isCustomProp) {
  5318. name = finalPropName(origName);
  5319. }
  5320. // Try prefixed name followed by the unprefixed name
  5321. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  5322. // If a hook was provided get the computed value from there
  5323. if (hooks && "get" in hooks) {
  5324. val = hooks.get(elem, true, extra);
  5325. }
  5326. // Otherwise, if a way to get the computed value exists, use that
  5327. if (val === undefined) {
  5328. val = curCSS(elem, name, styles);
  5329. }
  5330. // Convert "normal" to computed value
  5331. if (val === "normal" && name in cssNormalTransform) {
  5332. val = cssNormalTransform[name];
  5333. }
  5334. // Make numeric if forced or a qualifier was provided and val looks numeric
  5335. if (extra === "" || extra) {
  5336. num = parseFloat(val);
  5337. return extra === true || isFinite(num) ? num || 0 : val;
  5338. }
  5339. return val;
  5340. }
  5341. });
  5342. jQuery.each(["height", "width"], function (i, dimension) {
  5343. jQuery.cssHooks[dimension] = {
  5344. get: function (elem, computed, extra) {
  5345. if (computed) {
  5346. // Certain elements can have dimension info if we invisibly show them
  5347. // but it must have a current display style that would benefit
  5348. return rdisplayswap.test(jQuery.css(elem, "display")) &&
  5349. // Support: Safari 8+
  5350. // Table columns in Safari have non-zero offsetWidth & zero
  5351. // getBoundingClientRect().width unless display is changed.
  5352. // Support: IE <=11 only
  5353. // Running getBoundingClientRect on a disconnected node
  5354. // in IE throws an error.
  5355. (!elem.getClientRects().length || !elem.getBoundingClientRect().width) ?
  5356. swap(elem, cssShow, function () {
  5357. return getWidthOrHeight(elem, dimension, extra);
  5358. }) :
  5359. getWidthOrHeight(elem, dimension, extra);
  5360. }
  5361. },
  5362. set: function (elem, value, extra) {
  5363. var matches,
  5364. styles = getStyles(elem),
  5365. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  5366. subtract = extra && boxModelAdjustment(
  5367. elem,
  5368. dimension,
  5369. extra,
  5370. isBorderBox,
  5371. styles
  5372. );
  5373. // Account for unreliable border-box dimensions by comparing offset* to computed and
  5374. // faking a content-box to get border and padding (gh-3699)
  5375. if (isBorderBox && support.scrollboxSize() === styles.position) {
  5376. subtract -= Math.ceil(
  5377. elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] -
  5378. parseFloat(styles[dimension]) -
  5379. boxModelAdjustment(elem, dimension, "border", false, styles) -
  5380. 0.5
  5381. );
  5382. }
  5383. // Convert to pixels if value adjustment is needed
  5384. if (subtract && (matches = rcssNum.exec(value)) &&
  5385. (matches[3] || "px") !== "px") {
  5386. elem.style[dimension] = value;
  5387. value = jQuery.css(elem, dimension);
  5388. }
  5389. return setPositiveNumber(elem, value, subtract);
  5390. }
  5391. };
  5392. });
  5393. jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft,
  5394. function (elem, computed) {
  5395. if (computed) {
  5396. return (parseFloat(curCSS(elem, "marginLeft")) ||
  5397. elem.getBoundingClientRect().left -
  5398. swap(elem, { marginLeft: 0 }, function () {
  5399. return elem.getBoundingClientRect().left;
  5400. })
  5401. ) + "px";
  5402. }
  5403. }
  5404. );
  5405. // These hooks are used by animate to expand properties
  5406. jQuery.each({
  5407. margin: "",
  5408. padding: "",
  5409. border: "Width"
  5410. }, function (prefix, suffix) {
  5411. jQuery.cssHooks[prefix + suffix] = {
  5412. expand: function (value) {
  5413. var i = 0,
  5414. expanded = {},
  5415. // Assumes a single number if not a string
  5416. parts = typeof value === "string" ? value.split(" ") : [value];
  5417. for (; i < 4; i++) {
  5418. expanded[prefix + cssExpand[i] + suffix] =
  5419. parts[i] || parts[i - 2] || parts[0];
  5420. }
  5421. return expanded;
  5422. }
  5423. };
  5424. if (prefix !== "margin") {
  5425. jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
  5426. }
  5427. });
  5428. jQuery.fn.extend({
  5429. css: function (name, value) {
  5430. return access(this, function (elem, name, value) {
  5431. var styles, len,
  5432. map = {},
  5433. i = 0;
  5434. if (Array.isArray(name)) {
  5435. styles = getStyles(elem);
  5436. len = name.length;
  5437. for (; i < len; i++) {
  5438. map[name[i]] = jQuery.css(elem, name[i], false, styles);
  5439. }
  5440. return map;
  5441. }
  5442. return value !== undefined ?
  5443. jQuery.style(elem, name, value) :
  5444. jQuery.css(elem, name);
  5445. }, name, value, arguments.length > 1);
  5446. }
  5447. });
  5448. function Tween(elem, options, prop, end, easing) {
  5449. return new Tween.prototype.init(elem, options, prop, end, easing);
  5450. }
  5451. jQuery.Tween = Tween;
  5452. Tween.prototype = {
  5453. constructor: Tween,
  5454. init: function (elem, options, prop, end, easing, unit) {
  5455. this.elem = elem;
  5456. this.prop = prop;
  5457. this.easing = easing || jQuery.easing._default;
  5458. this.options = options;
  5459. this.start = this.now = this.cur();
  5460. this.end = end;
  5461. this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
  5462. },
  5463. cur: function () {
  5464. var hooks = Tween.propHooks[this.prop];
  5465. return hooks && hooks.get ?
  5466. hooks.get(this) :
  5467. Tween.propHooks._default.get(this);
  5468. },
  5469. run: function (percent) {
  5470. var eased,
  5471. hooks = Tween.propHooks[this.prop];
  5472. if (this.options.duration) {
  5473. this.pos = eased = jQuery.easing[this.easing](
  5474. percent, this.options.duration * percent, 0, 1, this.options.duration
  5475. );
  5476. } else {
  5477. this.pos = eased = percent;
  5478. }
  5479. this.now = (this.end - this.start) * eased + this.start;
  5480. if (this.options.step) {
  5481. this.options.step.call(this.elem, this.now, this);
  5482. }
  5483. if (hooks && hooks.set) {
  5484. hooks.set(this);
  5485. } else {
  5486. Tween.propHooks._default.set(this);
  5487. }
  5488. return this;
  5489. }
  5490. };
  5491. Tween.prototype.init.prototype = Tween.prototype;
  5492. Tween.propHooks = {
  5493. _default: {
  5494. get: function (tween) {
  5495. var result;
  5496. // Use a property on the element directly when it is not a DOM element,
  5497. // or when there is no matching style property that exists.
  5498. if (tween.elem.nodeType !== 1 ||
  5499. tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {
  5500. return tween.elem[tween.prop];
  5501. }
  5502. // Passing an empty string as a 3rd parameter to .css will automatically
  5503. // attempt a parseFloat and fallback to a string if the parse fails.
  5504. // Simple values such as "10px" are parsed to Float;
  5505. // complex values such as "rotate(1rad)" are returned as-is.
  5506. result = jQuery.css(tween.elem, tween.prop, "");
  5507. // Empty strings, null, undefined and "auto" are converted to 0.
  5508. return !result || result === "auto" ? 0 : result;
  5509. },
  5510. set: function (tween) {
  5511. // Use step hook for back compat.
  5512. // Use cssHook if its there.
  5513. // Use .style if available and use plain properties where available.
  5514. if (jQuery.fx.step[tween.prop]) {
  5515. jQuery.fx.step[tween.prop](tween);
  5516. } else if (tween.elem.nodeType === 1 &&
  5517. (tween.elem.style[jQuery.cssProps[tween.prop]] != null ||
  5518. jQuery.cssHooks[tween.prop])) {
  5519. jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
  5520. } else {
  5521. tween.elem[tween.prop] = tween.now;
  5522. }
  5523. }
  5524. }
  5525. };
  5526. // Support: IE <=9 only
  5527. // Panic based approach to setting things on disconnected nodes
  5528. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  5529. set: function (tween) {
  5530. if (tween.elem.nodeType && tween.elem.parentNode) {
  5531. tween.elem[tween.prop] = tween.now;
  5532. }
  5533. }
  5534. };
  5535. jQuery.easing = {
  5536. linear: function (p) {
  5537. return p;
  5538. },
  5539. swing: function (p) {
  5540. return 0.5 - Math.cos(p * Math.PI) / 2;
  5541. },
  5542. _default: "swing"
  5543. };
  5544. jQuery.fx = Tween.prototype.init;
  5545. // Back compat <1.8 extension point
  5546. jQuery.fx.step = {};
  5547. var
  5548. fxNow, inProgress,
  5549. rfxtypes = /^(?:toggle|show|hide)$/,
  5550. rrun = /queueHooks$/;
  5551. function schedule() {
  5552. if (inProgress) {
  5553. if (document.hidden === false && window.requestAnimationFrame) {
  5554. window.requestAnimationFrame(schedule);
  5555. } else {
  5556. window.setTimeout(schedule, jQuery.fx.interval);
  5557. }
  5558. jQuery.fx.tick();
  5559. }
  5560. }
  5561. // Animations created synchronously will run synchronously
  5562. function createFxNow() {
  5563. window.setTimeout(function () {
  5564. fxNow = undefined;
  5565. });
  5566. return (fxNow = Date.now());
  5567. }
  5568. // Generate parameters to create a standard animation
  5569. function genFx(type, includeWidth) {
  5570. var which,
  5571. i = 0,
  5572. attrs = { height: type };
  5573. // If we include width, step value is 1 to do all cssExpand values,
  5574. // otherwise step value is 2 to skip over Left and Right
  5575. includeWidth = includeWidth ? 1 : 0;
  5576. for (; i < 4; i += 2 - includeWidth) {
  5577. which = cssExpand[i];
  5578. attrs["margin" + which] = attrs["padding" + which] = type;
  5579. }
  5580. if (includeWidth) {
  5581. attrs.opacity = attrs.width = type;
  5582. }
  5583. return attrs;
  5584. }
  5585. function createTween(value, prop, animation) {
  5586. var tween,
  5587. collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]),
  5588. index = 0,
  5589. length = collection.length;
  5590. for (; index < length; index++) {
  5591. if ((tween = collection[index].call(animation, prop, value))) {
  5592. // We're done with this property
  5593. return tween;
  5594. }
  5595. }
  5596. }
  5597. function defaultPrefilter(elem, props, opts) {
  5598. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  5599. isBox = "width" in props || "height" in props,
  5600. anim = this,
  5601. orig = {},
  5602. style = elem.style,
  5603. hidden = elem.nodeType && isHiddenWithinTree(elem),
  5604. dataShow = dataPriv.get(elem, "fxshow");
  5605. // Queue-skipping animations hijack the fx hooks
  5606. if (!opts.queue) {
  5607. hooks = jQuery._queueHooks(elem, "fx");
  5608. if (hooks.unqueued == null) {
  5609. hooks.unqueued = 0;
  5610. oldfire = hooks.empty.fire;
  5611. hooks.empty.fire = function () {
  5612. if (!hooks.unqueued) {
  5613. oldfire();
  5614. }
  5615. };
  5616. }
  5617. hooks.unqueued++;
  5618. anim.always(function () {
  5619. // Ensure the complete handler is called before this completes
  5620. anim.always(function () {
  5621. hooks.unqueued--;
  5622. if (!jQuery.queue(elem, "fx").length) {
  5623. hooks.empty.fire();
  5624. }
  5625. });
  5626. });
  5627. }
  5628. // Detect show/hide animations
  5629. for (prop in props) {
  5630. value = props[prop];
  5631. if (rfxtypes.test(value)) {
  5632. delete props[prop];
  5633. toggle = toggle || value === "toggle";
  5634. if (value === (hidden ? "hide" : "show")) {
  5635. // Pretend to be hidden if this is a "show" and
  5636. // there is still data from a stopped show/hide
  5637. if (value === "show" && dataShow && dataShow[prop] !== undefined) {
  5638. hidden = true;
  5639. // Ignore all other no-op show/hide data
  5640. } else {
  5641. continue;
  5642. }
  5643. }
  5644. orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
  5645. }
  5646. }
  5647. // Bail out if this is a no-op like .hide().hide()
  5648. propTween = !jQuery.isEmptyObject(props);
  5649. if (!propTween && jQuery.isEmptyObject(orig)) {
  5650. return;
  5651. }
  5652. // Restrict "overflow" and "display" styles during box animations
  5653. if (isBox && elem.nodeType === 1) {
  5654. // Support: IE <=9 - 11, Edge 12 - 15
  5655. // Record all 3 overflow attributes because IE does not infer the shorthand
  5656. // from identically-valued overflowX and overflowY and Edge just mirrors
  5657. // the overflowX value there.
  5658. opts.overflow = [style.overflow, style.overflowX, style.overflowY];
  5659. // Identify a display type, preferring old show/hide data over the CSS cascade
  5660. restoreDisplay = dataShow && dataShow.display;
  5661. if (restoreDisplay == null) {
  5662. restoreDisplay = dataPriv.get(elem, "display");
  5663. }
  5664. display = jQuery.css(elem, "display");
  5665. if (display === "none") {
  5666. if (restoreDisplay) {
  5667. display = restoreDisplay;
  5668. } else {
  5669. // Get nonempty value(s) by temporarily forcing visibility
  5670. showHide([elem], true);
  5671. restoreDisplay = elem.style.display || restoreDisplay;
  5672. display = jQuery.css(elem, "display");
  5673. showHide([elem]);
  5674. }
  5675. }
  5676. // Animate inline elements as inline-block
  5677. if (display === "inline" || display === "inline-block" && restoreDisplay != null) {
  5678. if (jQuery.css(elem, "float") === "none") {
  5679. // Restore the original display value at the end of pure show/hide animations
  5680. if (!propTween) {
  5681. anim.done(function () {
  5682. style.display = restoreDisplay;
  5683. });
  5684. if (restoreDisplay == null) {
  5685. display = style.display;
  5686. restoreDisplay = display === "none" ? "" : display;
  5687. }
  5688. }
  5689. style.display = "inline-block";
  5690. }
  5691. }
  5692. }
  5693. if (opts.overflow) {
  5694. style.overflow = "hidden";
  5695. anim.always(function () {
  5696. style.overflow = opts.overflow[0];
  5697. style.overflowX = opts.overflow[1];
  5698. style.overflowY = opts.overflow[2];
  5699. });
  5700. }
  5701. // Implement show/hide animations
  5702. propTween = false;
  5703. for (prop in orig) {
  5704. // General show/hide setup for this element animation
  5705. if (!propTween) {
  5706. if (dataShow) {
  5707. if ("hidden" in dataShow) {
  5708. hidden = dataShow.hidden;
  5709. }
  5710. } else {
  5711. dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay });
  5712. }
  5713. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  5714. if (toggle) {
  5715. dataShow.hidden = !hidden;
  5716. }
  5717. // Show elements before animating them
  5718. if (hidden) {
  5719. showHide([elem], true);
  5720. }
  5721. /* eslint-disable no-loop-func */
  5722. anim.done(function () {
  5723. /* eslint-enable no-loop-func */
  5724. // The final step of a "hide" animation is actually hiding the element
  5725. if (!hidden) {
  5726. showHide([elem]);
  5727. }
  5728. dataPriv.remove(elem, "fxshow");
  5729. for (prop in orig) {
  5730. jQuery.style(elem, prop, orig[prop]);
  5731. }
  5732. });
  5733. }
  5734. // Per-property setup
  5735. propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
  5736. if (!(prop in dataShow)) {
  5737. dataShow[prop] = propTween.start;
  5738. if (hidden) {
  5739. propTween.end = propTween.start;
  5740. propTween.start = 0;
  5741. }
  5742. }
  5743. }
  5744. }
  5745. function propFilter(props, specialEasing) {
  5746. var index, name, easing, value, hooks;
  5747. // camelCase, specialEasing and expand cssHook pass
  5748. for (index in props) {
  5749. name = camelCase(index);
  5750. easing = specialEasing[name];
  5751. value = props[index];
  5752. if (Array.isArray(value)) {
  5753. easing = value[1];
  5754. value = props[index] = value[0];
  5755. }
  5756. if (index !== name) {
  5757. props[name] = value;
  5758. delete props[index];
  5759. }
  5760. hooks = jQuery.cssHooks[name];
  5761. if (hooks && "expand" in hooks) {
  5762. value = hooks.expand(value);
  5763. delete props[name];
  5764. // Not quite $.extend, this won't overwrite existing keys.
  5765. // Reusing 'index' because we have the correct "name"
  5766. for (index in value) {
  5767. if (!(index in props)) {
  5768. props[index] = value[index];
  5769. specialEasing[index] = easing;
  5770. }
  5771. }
  5772. } else {
  5773. specialEasing[name] = easing;
  5774. }
  5775. }
  5776. }
  5777. function Animation(elem, properties, options) {
  5778. var result,
  5779. stopped,
  5780. index = 0,
  5781. length = Animation.prefilters.length,
  5782. deferred = jQuery.Deferred().always(function () {
  5783. // Don't match elem in the :animated selector
  5784. delete tick.elem;
  5785. }),
  5786. tick = function () {
  5787. if (stopped) {
  5788. return false;
  5789. }
  5790. var currentTime = fxNow || createFxNow(),
  5791. remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
  5792. // Support: Android 2.3 only
  5793. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  5794. temp = remaining / animation.duration || 0,
  5795. percent = 1 - temp,
  5796. index = 0,
  5797. length = animation.tweens.length;
  5798. for (; index < length; index++) {
  5799. animation.tweens[index].run(percent);
  5800. }
  5801. deferred.notifyWith(elem, [animation, percent, remaining]);
  5802. // If there's more to do, yield
  5803. if (percent < 1 && length) {
  5804. return remaining;
  5805. }
  5806. // If this was an empty animation, synthesize a final progress notification
  5807. if (!length) {
  5808. deferred.notifyWith(elem, [animation, 1, 0]);
  5809. }
  5810. // Resolve the animation and report its conclusion
  5811. deferred.resolveWith(elem, [animation]);
  5812. return false;
  5813. },
  5814. animation = deferred.promise({
  5815. elem: elem,
  5816. props: jQuery.extend({}, properties),
  5817. opts: jQuery.extend(true, {
  5818. specialEasing: {},
  5819. easing: jQuery.easing._default
  5820. }, options),
  5821. originalProperties: properties,
  5822. originalOptions: options,
  5823. startTime: fxNow || createFxNow(),
  5824. duration: options.duration,
  5825. tweens: [],
  5826. createTween: function (prop, end) {
  5827. var tween = jQuery.Tween(elem, animation.opts, prop, end,
  5828. animation.opts.specialEasing[prop] || animation.opts.easing);
  5829. animation.tweens.push(tween);
  5830. return tween;
  5831. },
  5832. stop: function (gotoEnd) {
  5833. var index = 0,
  5834. // If we are going to the end, we want to run all the tweens
  5835. // otherwise we skip this part
  5836. length = gotoEnd ? animation.tweens.length : 0;
  5837. if (stopped) {
  5838. return this;
  5839. }
  5840. stopped = true;
  5841. for (; index < length; index++) {
  5842. animation.tweens[index].run(1);
  5843. }
  5844. // Resolve when we played the last frame; otherwise, reject
  5845. if (gotoEnd) {
  5846. deferred.notifyWith(elem, [animation, 1, 0]);
  5847. deferred.resolveWith(elem, [animation, gotoEnd]);
  5848. } else {
  5849. deferred.rejectWith(elem, [animation, gotoEnd]);
  5850. }
  5851. return this;
  5852. }
  5853. }),
  5854. props = animation.props;
  5855. propFilter(props, animation.opts.specialEasing);
  5856. for (; index < length; index++) {
  5857. result = Animation.prefilters[index].call(animation, elem, props, animation.opts);
  5858. if (result) {
  5859. if (isFunction(result.stop)) {
  5860. jQuery._queueHooks(animation.elem, animation.opts.queue).stop =
  5861. result.stop.bind(result);
  5862. }
  5863. return result;
  5864. }
  5865. }
  5866. jQuery.map(props, createTween, animation);
  5867. if (isFunction(animation.opts.start)) {
  5868. animation.opts.start.call(elem, animation);
  5869. }
  5870. // Attach callbacks from options
  5871. animation
  5872. .progress(animation.opts.progress)
  5873. .done(animation.opts.done, animation.opts.complete)
  5874. .fail(animation.opts.fail)
  5875. .always(animation.opts.always);
  5876. jQuery.fx.timer(
  5877. jQuery.extend(tick, {
  5878. elem: elem,
  5879. anim: animation,
  5880. queue: animation.opts.queue
  5881. })
  5882. );
  5883. return animation;
  5884. }
  5885. jQuery.Animation = jQuery.extend(Animation, {
  5886. tweeners: {
  5887. "*": [function (prop, value) {
  5888. var tween = this.createTween(prop, value);
  5889. adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
  5890. return tween;
  5891. }]
  5892. },
  5893. tweener: function (props, callback) {
  5894. if (isFunction(props)) {
  5895. callback = props;
  5896. props = ["*"];
  5897. } else {
  5898. props = props.match(rnothtmlwhite);
  5899. }
  5900. var prop,
  5901. index = 0,
  5902. length = props.length;
  5903. for (; index < length; index++) {
  5904. prop = props[index];
  5905. Animation.tweeners[prop] = Animation.tweeners[prop] || [];
  5906. Animation.tweeners[prop].unshift(callback);
  5907. }
  5908. },
  5909. prefilters: [defaultPrefilter],
  5910. prefilter: function (callback, prepend) {
  5911. if (prepend) {
  5912. Animation.prefilters.unshift(callback);
  5913. } else {
  5914. Animation.prefilters.push(callback);
  5915. }
  5916. }
  5917. });
  5918. jQuery.speed = function (speed, easing, fn) {
  5919. var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
  5920. complete: fn || !fn && easing ||
  5921. isFunction(speed) && speed,
  5922. duration: speed,
  5923. easing: fn && easing || easing && !isFunction(easing) && easing
  5924. };
  5925. // Go to the end state if fx are off
  5926. if (jQuery.fx.off) {
  5927. opt.duration = 0;
  5928. } else {
  5929. if (typeof opt.duration !== "number") {
  5930. if (opt.duration in jQuery.fx.speeds) {
  5931. opt.duration = jQuery.fx.speeds[opt.duration];
  5932. } else {
  5933. opt.duration = jQuery.fx.speeds._default;
  5934. }
  5935. }
  5936. }
  5937. // Normalize opt.queue - true/undefined/null -> "fx"
  5938. if (opt.queue == null || opt.queue === true) {
  5939. opt.queue = "fx";
  5940. }
  5941. // Queueing
  5942. opt.old = opt.complete;
  5943. opt.complete = function () {
  5944. if (isFunction(opt.old)) {
  5945. opt.old.call(this);
  5946. }
  5947. if (opt.queue) {
  5948. jQuery.dequeue(this, opt.queue);
  5949. }
  5950. };
  5951. return opt;
  5952. };
  5953. jQuery.fn.extend({
  5954. fadeTo: function (speed, to, easing, callback) {
  5955. // Show any hidden elements after setting opacity to 0
  5956. return this.filter(isHiddenWithinTree).css("opacity", 0).show()
  5957. // Animate to the value specified
  5958. .end().animate({ opacity: to }, speed, easing, callback);
  5959. },
  5960. animate: function (prop, speed, easing, callback) {
  5961. var empty = jQuery.isEmptyObject(prop),
  5962. optall = jQuery.speed(speed, easing, callback),
  5963. doAnimation = function () {
  5964. // Operate on a copy of prop so per-property easing won't be lost
  5965. var anim = Animation(this, jQuery.extend({}, prop), optall);
  5966. // Empty animations, or finishing resolves immediately
  5967. if (empty || dataPriv.get(this, "finish")) {
  5968. anim.stop(true);
  5969. }
  5970. };
  5971. doAnimation.finish = doAnimation;
  5972. return empty || optall.queue === false ?
  5973. this.each(doAnimation) :
  5974. this.queue(optall.queue, doAnimation);
  5975. },
  5976. stop: function (type, clearQueue, gotoEnd) {
  5977. var stopQueue = function (hooks) {
  5978. var stop = hooks.stop;
  5979. delete hooks.stop;
  5980. stop(gotoEnd);
  5981. };
  5982. if (typeof type !== "string") {
  5983. gotoEnd = clearQueue;
  5984. clearQueue = type;
  5985. type = undefined;
  5986. }
  5987. if (clearQueue && type !== false) {
  5988. this.queue(type || "fx", []);
  5989. }
  5990. return this.each(function () {
  5991. var dequeue = true,
  5992. index = type != null && type + "queueHooks",
  5993. timers = jQuery.timers,
  5994. data = dataPriv.get(this);
  5995. if (index) {
  5996. if (data[index] && data[index].stop) {
  5997. stopQueue(data[index]);
  5998. }
  5999. } else {
  6000. for (index in data) {
  6001. if (data[index] && data[index].stop && rrun.test(index)) {
  6002. stopQueue(data[index]);
  6003. }
  6004. }
  6005. }
  6006. for (index = timers.length; index--;) {
  6007. if (timers[index].elem === this &&
  6008. (type == null || timers[index].queue === type)) {
  6009. timers[index].anim.stop(gotoEnd);
  6010. dequeue = false;
  6011. timers.splice(index, 1);
  6012. }
  6013. }
  6014. // Start the next in the queue if the last step wasn't forced.
  6015. // Timers currently will call their complete callbacks, which
  6016. // will dequeue but only if they were gotoEnd.
  6017. if (dequeue || !gotoEnd) {
  6018. jQuery.dequeue(this, type);
  6019. }
  6020. });
  6021. },
  6022. finish: function (type) {
  6023. if (type !== false) {
  6024. type = type || "fx";
  6025. }
  6026. return this.each(function () {
  6027. var index,
  6028. data = dataPriv.get(this),
  6029. queue = data[type + "queue"],
  6030. hooks = data[type + "queueHooks"],
  6031. timers = jQuery.timers,
  6032. length = queue ? queue.length : 0;
  6033. // Enable finishing flag on private data
  6034. data.finish = true;
  6035. // Empty the queue first
  6036. jQuery.queue(this, type, []);
  6037. if (hooks && hooks.stop) {
  6038. hooks.stop.call(this, true);
  6039. }
  6040. // Look for any active animations, and finish them
  6041. for (index = timers.length; index--;) {
  6042. if (timers[index].elem === this && timers[index].queue === type) {
  6043. timers[index].anim.stop(true);
  6044. timers.splice(index, 1);
  6045. }
  6046. }
  6047. // Look for any animations in the old queue and finish them
  6048. for (index = 0; index < length; index++) {
  6049. if (queue[index] && queue[index].finish) {
  6050. queue[index].finish.call(this);
  6051. }
  6052. }
  6053. // Turn off finishing flag
  6054. delete data.finish;
  6055. });
  6056. }
  6057. });
  6058. jQuery.each(["toggle", "show", "hide"], function (i, name) {
  6059. var cssFn = jQuery.fn[name];
  6060. jQuery.fn[name] = function (speed, easing, callback) {
  6061. return speed == null || typeof speed === "boolean" ?
  6062. cssFn.apply(this, arguments) :
  6063. this.animate(genFx(name, true), speed, easing, callback);
  6064. };
  6065. });
  6066. // Generate shortcuts for custom animations
  6067. jQuery.each({
  6068. slideDown: genFx("show"),
  6069. slideUp: genFx("hide"),
  6070. slideToggle: genFx("toggle"),
  6071. fadeIn: { opacity: "show" },
  6072. fadeOut: { opacity: "hide" },
  6073. fadeToggle: { opacity: "toggle" }
  6074. }, function (name, props) {
  6075. jQuery.fn[name] = function (speed, easing, callback) {
  6076. return this.animate(props, speed, easing, callback);
  6077. };
  6078. });
  6079. jQuery.timers = [];
  6080. jQuery.fx.tick = function () {
  6081. var timer,
  6082. i = 0,
  6083. timers = jQuery.timers;
  6084. fxNow = Date.now();
  6085. for (; i < timers.length; i++) {
  6086. timer = timers[i];
  6087. // Run the timer and safely remove it when done (allowing for external removal)
  6088. if (!timer() && timers[i] === timer) {
  6089. timers.splice(i--, 1);
  6090. }
  6091. }
  6092. if (!timers.length) {
  6093. jQuery.fx.stop();
  6094. }
  6095. fxNow = undefined;
  6096. };
  6097. jQuery.fx.timer = function (timer) {
  6098. jQuery.timers.push(timer);
  6099. jQuery.fx.start();
  6100. };
  6101. jQuery.fx.interval = 13;
  6102. jQuery.fx.start = function () {
  6103. if (inProgress) {
  6104. return;
  6105. }
  6106. inProgress = true;
  6107. schedule();
  6108. };
  6109. jQuery.fx.stop = function () {
  6110. inProgress = null;
  6111. };
  6112. jQuery.fx.speeds = {
  6113. slow: 600,
  6114. fast: 200,
  6115. // Default speed
  6116. _default: 400
  6117. };
  6118. // Based off of the plugin by Clint Helfers, with permission.
  6119. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  6120. jQuery.fn.delay = function (time, type) {
  6121. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  6122. type = type || "fx";
  6123. return this.queue(type, function (next, hooks) {
  6124. var timeout = window.setTimeout(next, time);
  6125. hooks.stop = function () {
  6126. window.clearTimeout(timeout);
  6127. };
  6128. });
  6129. };
  6130. (function () {
  6131. var input = document.createElement("input"),
  6132. select = document.createElement("select"),
  6133. opt = select.appendChild(document.createElement("option"));
  6134. input.type = "checkbox";
  6135. // Support: Android <=4.3 only
  6136. // Default value for a checkbox should be "on"
  6137. support.checkOn = input.value !== "";
  6138. // Support: IE <=11 only
  6139. // Must access selectedIndex to make default options select
  6140. support.optSelected = opt.selected;
  6141. // Support: IE <=11 only
  6142. // An input loses its value after becoming a radio
  6143. input = document.createElement("input");
  6144. input.value = "t";
  6145. input.type = "radio";
  6146. support.radioValue = input.value === "t";
  6147. })();
  6148. var boolHook,
  6149. attrHandle = jQuery.expr.attrHandle;
  6150. jQuery.fn.extend({
  6151. attr: function (name, value) {
  6152. return access(this, jQuery.attr, name, value, arguments.length > 1);
  6153. },
  6154. removeAttr: function (name) {
  6155. return this.each(function () {
  6156. jQuery.removeAttr(this, name);
  6157. });
  6158. }
  6159. });
  6160. jQuery.extend({
  6161. attr: function (elem, name, value) {
  6162. var ret, hooks,
  6163. nType = elem.nodeType;
  6164. // Don't get/set attributes on text, comment and attribute nodes
  6165. if (nType === 3 || nType === 8 || nType === 2) {
  6166. return;
  6167. }
  6168. // Fallback to prop when attributes are not supported
  6169. if (typeof elem.getAttribute === "undefined") {
  6170. return jQuery.prop(elem, name, value);
  6171. }
  6172. // Attribute hooks are determined by the lowercase version
  6173. // Grab necessary hook if one is defined
  6174. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  6175. hooks = jQuery.attrHooks[name.toLowerCase()] ||
  6176. (jQuery.expr.match.bool.test(name) ? boolHook : undefined);
  6177. }
  6178. if (value !== undefined) {
  6179. if (value === null) {
  6180. jQuery.removeAttr(elem, name);
  6181. return;
  6182. }
  6183. if (hooks && "set" in hooks &&
  6184. (ret = hooks.set(elem, value, name)) !== undefined) {
  6185. return ret;
  6186. }
  6187. elem.setAttribute(name, value + "");
  6188. return value;
  6189. }
  6190. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  6191. return ret;
  6192. }
  6193. ret = jQuery.find.attr(elem, name);
  6194. // Non-existent attributes return null, we normalize to undefined
  6195. return ret == null ? undefined : ret;
  6196. },
  6197. attrHooks: {
  6198. type: {
  6199. set: function (elem, value) {
  6200. if (!support.radioValue && value === "radio" &&
  6201. nodeName(elem, "input")) {
  6202. var val = elem.value;
  6203. elem.setAttribute("type", value);
  6204. if (val) {
  6205. elem.value = val;
  6206. }
  6207. return value;
  6208. }
  6209. }
  6210. }
  6211. },
  6212. removeAttr: function (elem, value) {
  6213. var name,
  6214. i = 0,
  6215. // Attribute names can contain non-HTML whitespace characters
  6216. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  6217. attrNames = value && value.match(rnothtmlwhite);
  6218. if (attrNames && elem.nodeType === 1) {
  6219. while ((name = attrNames[i++])) {
  6220. elem.removeAttribute(name);
  6221. }
  6222. }
  6223. }
  6224. });
  6225. // Hooks for boolean attributes
  6226. boolHook = {
  6227. set: function (elem, value, name) {
  6228. if (value === false) {
  6229. // Remove boolean attributes when set to false
  6230. jQuery.removeAttr(elem, name);
  6231. } else {
  6232. elem.setAttribute(name, name);
  6233. }
  6234. return name;
  6235. }
  6236. };
  6237. jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (i, name) {
  6238. var getter = attrHandle[name] || jQuery.find.attr;
  6239. attrHandle[name] = function (elem, name, isXML) {
  6240. var ret, handle,
  6241. lowercaseName = name.toLowerCase();
  6242. if (!isXML) {
  6243. // Avoid an infinite loop by temporarily removing this function from the getter
  6244. handle = attrHandle[lowercaseName];
  6245. attrHandle[lowercaseName] = ret;
  6246. ret = getter(elem, name, isXML) != null ?
  6247. lowercaseName :
  6248. null;
  6249. attrHandle[lowercaseName] = handle;
  6250. }
  6251. return ret;
  6252. };
  6253. });
  6254. var rfocusable = /^(?:input|select|textarea|button)$/i,
  6255. rclickable = /^(?:a|area)$/i;
  6256. jQuery.fn.extend({
  6257. prop: function (name, value) {
  6258. return access(this, jQuery.prop, name, value, arguments.length > 1);
  6259. },
  6260. removeProp: function (name) {
  6261. return this.each(function () {
  6262. delete this[jQuery.propFix[name] || name];
  6263. });
  6264. }
  6265. });
  6266. jQuery.extend({
  6267. prop: function (elem, name, value) {
  6268. var ret, hooks,
  6269. nType = elem.nodeType;
  6270. // Don't get/set properties on text, comment and attribute nodes
  6271. if (nType === 3 || nType === 8 || nType === 2) {
  6272. return;
  6273. }
  6274. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  6275. // Fix name and attach hooks
  6276. name = jQuery.propFix[name] || name;
  6277. hooks = jQuery.propHooks[name];
  6278. }
  6279. if (value !== undefined) {
  6280. if (hooks && "set" in hooks &&
  6281. (ret = hooks.set(elem, value, name)) !== undefined) {
  6282. return ret;
  6283. }
  6284. return (elem[name] = value);
  6285. }
  6286. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  6287. return ret;
  6288. }
  6289. return elem[name];
  6290. },
  6291. propHooks: {
  6292. tabIndex: {
  6293. get: function (elem) {
  6294. // Support: IE <=9 - 11 only
  6295. // elem.tabIndex doesn't always return the
  6296. // correct value when it hasn't been explicitly set
  6297. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  6298. // Use proper attribute retrieval(#12072)
  6299. var tabindex = jQuery.find.attr(elem, "tabindex");
  6300. if (tabindex) {
  6301. return parseInt(tabindex, 10);
  6302. }
  6303. if (
  6304. rfocusable.test(elem.nodeName) ||
  6305. rclickable.test(elem.nodeName) &&
  6306. elem.href
  6307. ) {
  6308. return 0;
  6309. }
  6310. return -1;
  6311. }
  6312. }
  6313. },
  6314. propFix: {
  6315. "for": "htmlFor",
  6316. "class": "className"
  6317. }
  6318. });
  6319. // Support: IE <=11 only
  6320. // Accessing the selectedIndex property
  6321. // forces the browser to respect setting selected
  6322. // on the option
  6323. // The getter ensures a default option is selected
  6324. // when in an optgroup
  6325. // eslint rule "no-unused-expressions" is disabled for this code
  6326. // since it considers such accessions noop
  6327. if (!support.optSelected) {
  6328. jQuery.propHooks.selected = {
  6329. get: function (elem) {
  6330. /* eslint no-unused-expressions: "off" */
  6331. var parent = elem.parentNode;
  6332. if (parent && parent.parentNode) {
  6333. parent.parentNode.selectedIndex;
  6334. }
  6335. return null;
  6336. },
  6337. set: function (elem) {
  6338. /* eslint no-unused-expressions: "off" */
  6339. var parent = elem.parentNode;
  6340. if (parent) {
  6341. parent.selectedIndex;
  6342. if (parent.parentNode) {
  6343. parent.parentNode.selectedIndex;
  6344. }
  6345. }
  6346. }
  6347. };
  6348. }
  6349. jQuery.each([
  6350. "tabIndex",
  6351. "readOnly",
  6352. "maxLength",
  6353. "cellSpacing",
  6354. "cellPadding",
  6355. "rowSpan",
  6356. "colSpan",
  6357. "useMap",
  6358. "frameBorder",
  6359. "contentEditable"
  6360. ], function () {
  6361. jQuery.propFix[this.toLowerCase()] = this;
  6362. });
  6363. // Strip and collapse whitespace according to HTML spec
  6364. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  6365. function stripAndCollapse(value) {
  6366. var tokens = value.match(rnothtmlwhite) || [];
  6367. return tokens.join(" ");
  6368. }
  6369. function getClass(elem) {
  6370. return elem.getAttribute && elem.getAttribute("class") || "";
  6371. }
  6372. function classesToArray(value) {
  6373. if (Array.isArray(value)) {
  6374. return value;
  6375. }
  6376. if (typeof value === "string") {
  6377. return value.match(rnothtmlwhite) || [];
  6378. }
  6379. return [];
  6380. }
  6381. jQuery.fn.extend({
  6382. addClass: function (value) {
  6383. var classes, elem, cur, curValue, clazz, j, finalValue,
  6384. i = 0;
  6385. if (isFunction(value)) {
  6386. return this.each(function (j) {
  6387. jQuery(this).addClass(value.call(this, j, getClass(this)));
  6388. });
  6389. }
  6390. classes = classesToArray(value);
  6391. if (classes.length) {
  6392. while ((elem = this[i++])) {
  6393. curValue = getClass(elem);
  6394. cur = elem.nodeType === 1 && (" " + stripAndCollapse(curValue) + " ");
  6395. if (cur) {
  6396. j = 0;
  6397. while ((clazz = classes[j++])) {
  6398. if (cur.indexOf(" " + clazz + " ") < 0) {
  6399. cur += clazz + " ";
  6400. }
  6401. }
  6402. // Only assign if different to avoid unneeded rendering.
  6403. finalValue = stripAndCollapse(cur);
  6404. if (curValue !== finalValue) {
  6405. elem.setAttribute("class", finalValue);
  6406. }
  6407. }
  6408. }
  6409. }
  6410. return this;
  6411. },
  6412. removeClass: function (value) {
  6413. var classes, elem, cur, curValue, clazz, j, finalValue,
  6414. i = 0;
  6415. if (isFunction(value)) {
  6416. return this.each(function (j) {
  6417. jQuery(this).removeClass(value.call(this, j, getClass(this)));
  6418. });
  6419. }
  6420. if (!arguments.length) {
  6421. return this.attr("class", "");
  6422. }
  6423. classes = classesToArray(value);
  6424. if (classes.length) {
  6425. while ((elem = this[i++])) {
  6426. curValue = getClass(elem);
  6427. // This expression is here for better compressibility (see addClass)
  6428. cur = elem.nodeType === 1 && (" " + stripAndCollapse(curValue) + " ");
  6429. if (cur) {
  6430. j = 0;
  6431. while ((clazz = classes[j++])) {
  6432. // Remove *all* instances
  6433. while (cur.indexOf(" " + clazz + " ") > -1) {
  6434. cur = cur.replace(" " + clazz + " ", " ");
  6435. }
  6436. }
  6437. // Only assign if different to avoid unneeded rendering.
  6438. finalValue = stripAndCollapse(cur);
  6439. if (curValue !== finalValue) {
  6440. elem.setAttribute("class", finalValue);
  6441. }
  6442. }
  6443. }
  6444. }
  6445. return this;
  6446. },
  6447. toggleClass: function (value, stateVal) {
  6448. var type = typeof value,
  6449. isValidValue = type === "string" || Array.isArray(value);
  6450. if (typeof stateVal === "boolean" && isValidValue) {
  6451. return stateVal ? this.addClass(value) : this.removeClass(value);
  6452. }
  6453. if (isFunction(value)) {
  6454. return this.each(function (i) {
  6455. jQuery(this).toggleClass(
  6456. value.call(this, i, getClass(this), stateVal),
  6457. stateVal
  6458. );
  6459. });
  6460. }
  6461. return this.each(function () {
  6462. var className, i, self, classNames;
  6463. if (isValidValue) {
  6464. // Toggle individual class names
  6465. i = 0;
  6466. self = jQuery(this);
  6467. classNames = classesToArray(value);
  6468. while ((className = classNames[i++])) {
  6469. // Check each className given, space separated list
  6470. if (self.hasClass(className)) {
  6471. self.removeClass(className);
  6472. } else {
  6473. self.addClass(className);
  6474. }
  6475. }
  6476. // Toggle whole class name
  6477. } else if (value === undefined || type === "boolean") {
  6478. className = getClass(this);
  6479. if (className) {
  6480. // Store className if set
  6481. dataPriv.set(this, "__className__", className);
  6482. }
  6483. // If the element has a class name or if we're passed `false`,
  6484. // then remove the whole classname (if there was one, the above saved it).
  6485. // Otherwise bring back whatever was previously saved (if anything),
  6486. // falling back to the empty string if nothing was stored.
  6487. if (this.setAttribute) {
  6488. this.setAttribute("class",
  6489. className || value === false ?
  6490. "" :
  6491. dataPriv.get(this, "__className__") || ""
  6492. );
  6493. }
  6494. }
  6495. });
  6496. },
  6497. hasClass: function (selector) {
  6498. var className, elem,
  6499. i = 0;
  6500. className = " " + selector + " ";
  6501. while ((elem = this[i++])) {
  6502. if (elem.nodeType === 1 &&
  6503. (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) {
  6504. return true;
  6505. }
  6506. }
  6507. return false;
  6508. }
  6509. });
  6510. var rreturn = /\r/g;
  6511. jQuery.fn.extend({
  6512. val: function (value) {
  6513. var hooks, ret, valueIsFunction,
  6514. elem = this[0];
  6515. if (!arguments.length) {
  6516. if (elem) {
  6517. hooks = jQuery.valHooks[elem.type] ||
  6518. jQuery.valHooks[elem.nodeName.toLowerCase()];
  6519. if (hooks &&
  6520. "get" in hooks &&
  6521. (ret = hooks.get(elem, "value")) !== undefined
  6522. ) {
  6523. return ret;
  6524. }
  6525. ret = elem.value;
  6526. // Handle most common string cases
  6527. if (typeof ret === "string") {
  6528. return ret.replace(rreturn, "");
  6529. }
  6530. // Handle cases where value is null/undef or number
  6531. return ret == null ? "" : ret;
  6532. }
  6533. return;
  6534. }
  6535. valueIsFunction = isFunction(value);
  6536. return this.each(function (i) {
  6537. var val;
  6538. if (this.nodeType !== 1) {
  6539. return;
  6540. }
  6541. if (valueIsFunction) {
  6542. val = value.call(this, i, jQuery(this).val());
  6543. } else {
  6544. val = value;
  6545. }
  6546. // Treat null/undefined as ""; convert numbers to string
  6547. if (val == null) {
  6548. val = "";
  6549. } else if (typeof val === "number") {
  6550. val += "";
  6551. } else if (Array.isArray(val)) {
  6552. val = jQuery.map(val, function (value) {
  6553. return value == null ? "" : value + "";
  6554. });
  6555. }
  6556. hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
  6557. // If set returns undefined, fall back to normal setting
  6558. if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
  6559. this.value = val;
  6560. }
  6561. });
  6562. }
  6563. });
  6564. jQuery.extend({
  6565. valHooks: {
  6566. option: {
  6567. get: function (elem) {
  6568. var val = jQuery.find.attr(elem, "value");
  6569. return val != null ?
  6570. val :
  6571. // Support: IE <=10 - 11 only
  6572. // option.text throws exceptions (#14686, #14858)
  6573. // Strip and collapse whitespace
  6574. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  6575. stripAndCollapse(jQuery.text(elem));
  6576. }
  6577. },
  6578. select: {
  6579. get: function (elem) {
  6580. var value, option, i,
  6581. options = elem.options,
  6582. index = elem.selectedIndex,
  6583. one = elem.type === "select-one",
  6584. values = one ? null : [],
  6585. max = one ? index + 1 : options.length;
  6586. if (index < 0) {
  6587. i = max;
  6588. } else {
  6589. i = one ? index : 0;
  6590. }
  6591. // Loop through all the selected options
  6592. for (; i < max; i++) {
  6593. option = options[i];
  6594. // Support: IE <=9 only
  6595. // IE8-9 doesn't update selected after form reset (#2551)
  6596. if ((option.selected || i === index) &&
  6597. // Don't return options that are disabled or in a disabled optgroup
  6598. !option.disabled &&
  6599. (!option.parentNode.disabled ||
  6600. !nodeName(option.parentNode, "optgroup"))) {
  6601. // Get the specific value for the option
  6602. value = jQuery(option).val();
  6603. // We don't need an array for one selects
  6604. if (one) {
  6605. return value;
  6606. }
  6607. // Multi-Selects return an array
  6608. values.push(value);
  6609. }
  6610. }
  6611. return values;
  6612. },
  6613. set: function (elem, value) {
  6614. var optionSet, option,
  6615. options = elem.options,
  6616. values = jQuery.makeArray(value),
  6617. i = options.length;
  6618. while (i--) {
  6619. option = options[i];
  6620. /* eslint-disable no-cond-assign */
  6621. if (option.selected =
  6622. jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1
  6623. ) {
  6624. optionSet = true;
  6625. }
  6626. /* eslint-enable no-cond-assign */
  6627. }
  6628. // Force browsers to behave consistently when non-matching value is set
  6629. if (!optionSet) {
  6630. elem.selectedIndex = -1;
  6631. }
  6632. return values;
  6633. }
  6634. }
  6635. }
  6636. });
  6637. // Radios and checkboxes getter/setter
  6638. jQuery.each(["radio", "checkbox"], function () {
  6639. jQuery.valHooks[this] = {
  6640. set: function (elem, value) {
  6641. if (Array.isArray(value)) {
  6642. return (elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1);
  6643. }
  6644. }
  6645. };
  6646. if (!support.checkOn) {
  6647. jQuery.valHooks[this].get = function (elem) {
  6648. return elem.getAttribute("value") === null ? "on" : elem.value;
  6649. };
  6650. }
  6651. });
  6652. // Return jQuery for attributes-only inclusion
  6653. support.focusin = "onfocusin" in window;
  6654. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  6655. stopPropagationCallback = function (e) {
  6656. e.stopPropagation();
  6657. };
  6658. jQuery.extend(jQuery.event, {
  6659. trigger: function (event, data, elem, onlyHandlers) {
  6660. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  6661. eventPath = [elem || document],
  6662. type = hasOwn.call(event, "type") ? event.type : event,
  6663. namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
  6664. cur = lastElement = tmp = elem = elem || document;
  6665. // Don't do events on text and comment nodes
  6666. if (elem.nodeType === 3 || elem.nodeType === 8) {
  6667. return;
  6668. }
  6669. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  6670. if (rfocusMorph.test(type + jQuery.event.triggered)) {
  6671. return;
  6672. }
  6673. if (type.indexOf(".") > -1) {
  6674. // Namespaced trigger; create a regexp to match event type in handle()
  6675. namespaces = type.split(".");
  6676. type = namespaces.shift();
  6677. namespaces.sort();
  6678. }
  6679. ontype = type.indexOf(":") < 0 && "on" + type;
  6680. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  6681. event = event[jQuery.expando] ?
  6682. event :
  6683. new jQuery.Event(type, typeof event === "object" && event);
  6684. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  6685. event.isTrigger = onlyHandlers ? 2 : 3;
  6686. event.namespace = namespaces.join(".");
  6687. event.rnamespace = event.namespace ?
  6688. new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") :
  6689. null;
  6690. // Clean up the event in case it is being reused
  6691. event.result = undefined;
  6692. if (!event.target) {
  6693. event.target = elem;
  6694. }
  6695. // Clone any incoming data and prepend the event, creating the handler arg list
  6696. data = data == null ?
  6697. [event] :
  6698. jQuery.makeArray(data, [event]);
  6699. // Allow special events to draw outside the lines
  6700. special = jQuery.event.special[type] || {};
  6701. if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
  6702. return;
  6703. }
  6704. // Determine event propagation path in advance, per W3C events spec (#9951)
  6705. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  6706. if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {
  6707. bubbleType = special.delegateType || type;
  6708. if (!rfocusMorph.test(bubbleType + type)) {
  6709. cur = cur.parentNode;
  6710. }
  6711. for (; cur; cur = cur.parentNode) {
  6712. eventPath.push(cur);
  6713. tmp = cur;
  6714. }
  6715. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  6716. if (tmp === (elem.ownerDocument || document)) {
  6717. eventPath.push(tmp.defaultView || tmp.parentWindow || window);
  6718. }
  6719. }
  6720. // Fire handlers on the event path
  6721. i = 0;
  6722. while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
  6723. lastElement = cur;
  6724. event.type = i > 1 ?
  6725. bubbleType :
  6726. special.bindType || type;
  6727. // jQuery handler
  6728. handle = (dataPriv.get(cur, "events") || {})[event.type] &&
  6729. dataPriv.get(cur, "handle");
  6730. if (handle) {
  6731. handle.apply(cur, data);
  6732. }
  6733. // Native handler
  6734. handle = ontype && cur[ontype];
  6735. if (handle && handle.apply && acceptData(cur)) {
  6736. event.result = handle.apply(cur, data);
  6737. if (event.result === false) {
  6738. event.preventDefault();
  6739. }
  6740. }
  6741. }
  6742. event.type = type;
  6743. // If nobody prevented the default action, do it now
  6744. if (!onlyHandlers && !event.isDefaultPrevented()) {
  6745. if ((!special._default ||
  6746. special._default.apply(eventPath.pop(), data) === false) &&
  6747. acceptData(elem)) {
  6748. // Call a native DOM method on the target with the same name as the event.
  6749. // Don't do default actions on window, that's where global variables be (#6170)
  6750. if (ontype && isFunction(elem[type]) && !isWindow(elem)) {
  6751. // Don't re-trigger an onFOO event when we call its FOO() method
  6752. tmp = elem[ontype];
  6753. if (tmp) {
  6754. elem[ontype] = null;
  6755. }
  6756. // Prevent re-triggering of the same event, since we already bubbled it above
  6757. jQuery.event.triggered = type;
  6758. if (event.isPropagationStopped()) {
  6759. lastElement.addEventListener(type, stopPropagationCallback);
  6760. }
  6761. elem[type]();
  6762. if (event.isPropagationStopped()) {
  6763. lastElement.removeEventListener(type, stopPropagationCallback);
  6764. }
  6765. jQuery.event.triggered = undefined;
  6766. if (tmp) {
  6767. elem[ontype] = tmp;
  6768. }
  6769. }
  6770. }
  6771. }
  6772. return event.result;
  6773. },
  6774. // Piggyback on a donor event to simulate a different one
  6775. // Used only for `focus(in | out)` events
  6776. simulate: function (type, elem, event) {
  6777. var e = jQuery.extend(
  6778. new jQuery.Event(),
  6779. event,
  6780. {
  6781. type: type,
  6782. isSimulated: true
  6783. }
  6784. );
  6785. jQuery.event.trigger(e, null, elem);
  6786. }
  6787. });
  6788. jQuery.fn.extend({
  6789. trigger: function (type, data) {
  6790. return this.each(function () {
  6791. jQuery.event.trigger(type, data, this);
  6792. });
  6793. },
  6794. triggerHandler: function (type, data) {
  6795. var elem = this[0];
  6796. if (elem) {
  6797. return jQuery.event.trigger(type, data, elem, true);
  6798. }
  6799. }
  6800. });
  6801. // Support: Firefox <=44
  6802. // Firefox doesn't have focus(in | out) events
  6803. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  6804. //
  6805. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  6806. // focus(in | out) events fire after focus & blur events,
  6807. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  6808. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  6809. if (!support.focusin) {
  6810. jQuery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) {
  6811. // Attach a single capturing handler on the document while someone wants focusin/focusout
  6812. var handler = function (event) {
  6813. jQuery.event.simulate(fix, event.target, jQuery.event.fix(event));
  6814. };
  6815. jQuery.event.special[fix] = {
  6816. setup: function () {
  6817. var doc = this.ownerDocument || this,
  6818. attaches = dataPriv.access(doc, fix);
  6819. if (!attaches) {
  6820. doc.addEventListener(orig, handler, true);
  6821. }
  6822. dataPriv.access(doc, fix, (attaches || 0) + 1);
  6823. },
  6824. teardown: function () {
  6825. var doc = this.ownerDocument || this,
  6826. attaches = dataPriv.access(doc, fix) - 1;
  6827. if (!attaches) {
  6828. doc.removeEventListener(orig, handler, true);
  6829. dataPriv.remove(doc, fix);
  6830. } else {
  6831. dataPriv.access(doc, fix, attaches);
  6832. }
  6833. }
  6834. };
  6835. });
  6836. }
  6837. var location = window.location;
  6838. var nonce = Date.now();
  6839. var rquery = (/\?/);
  6840. // Cross-browser xml parsing
  6841. jQuery.parseXML = function (data) {
  6842. var xml;
  6843. if (!data || typeof data !== "string") {
  6844. return null;
  6845. }
  6846. // Support: IE 9 - 11 only
  6847. // IE throws on parseFromString with invalid input.
  6848. try {
  6849. xml = (new window.DOMParser()).parseFromString(data, "text/xml");
  6850. } catch (e) {
  6851. xml = undefined;
  6852. }
  6853. if (!xml || xml.getElementsByTagName("parsererror").length) {
  6854. jQuery.error("Invalid XML: " + data);
  6855. }
  6856. return xml;
  6857. };
  6858. var
  6859. rbracket = /\[\]$/,
  6860. rCRLF = /\r?\n/g,
  6861. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  6862. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  6863. function buildParams(prefix, obj, traditional, add) {
  6864. var name;
  6865. if (Array.isArray(obj)) {
  6866. // Serialize array item.
  6867. jQuery.each(obj, function (i, v) {
  6868. if (traditional || rbracket.test(prefix)) {
  6869. // Treat each array item as a scalar.
  6870. add(prefix, v);
  6871. } else {
  6872. // Item is non-scalar (array or object), encode its numeric index.
  6873. buildParams(
  6874. prefix + "[" + (typeof v === "object" && v != null ? i : "") + "]",
  6875. v,
  6876. traditional,
  6877. add
  6878. );
  6879. }
  6880. });
  6881. } else if (!traditional && toType(obj) === "object") {
  6882. // Serialize object item.
  6883. for (name in obj) {
  6884. buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
  6885. }
  6886. } else {
  6887. // Serialize scalar item.
  6888. add(prefix, obj);
  6889. }
  6890. }
  6891. // Serialize an array of form elements or a set of
  6892. // key/values into a query string
  6893. jQuery.param = function (a, traditional) {
  6894. var prefix,
  6895. s = [],
  6896. add = function (key, valueOrFunction) {
  6897. // If value is a function, invoke it and use its return value
  6898. var value = isFunction(valueOrFunction) ?
  6899. valueOrFunction() :
  6900. valueOrFunction;
  6901. s[s.length] = encodeURIComponent(key) + "=" +
  6902. encodeURIComponent(value == null ? "" : value);
  6903. };
  6904. // If an array was passed in, assume that it is an array of form elements.
  6905. if (Array.isArray(a) || (a.jquery && !jQuery.isPlainObject(a))) {
  6906. // Serialize the form elements
  6907. jQuery.each(a, function () {
  6908. add(this.name, this.value);
  6909. });
  6910. } else {
  6911. // If traditional, encode the "old" way (the way 1.3.2 or older
  6912. // did it), otherwise encode params recursively.
  6913. for (prefix in a) {
  6914. buildParams(prefix, a[prefix], traditional, add);
  6915. }
  6916. }
  6917. // Return the resulting serialization
  6918. return s.join("&");
  6919. };
  6920. jQuery.fn.extend({
  6921. serialize: function () {
  6922. return jQuery.param(this.serializeArray());
  6923. },
  6924. serializeArray: function () {
  6925. return this.map(function () {
  6926. // Can add propHook for "elements" to filter or add form elements
  6927. var elements = jQuery.prop(this, "elements");
  6928. return elements ? jQuery.makeArray(elements) : this;
  6929. })
  6930. .filter(function () {
  6931. var type = this.type;
  6932. // Use .is( ":disabled" ) so that fieldset[disabled] works
  6933. return this.name && !jQuery(this).is(":disabled") &&
  6934. rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) &&
  6935. (this.checked || !rcheckableType.test(type));
  6936. })
  6937. .map(function (i, elem) {
  6938. var val = jQuery(this).val();
  6939. if (val == null) {
  6940. return null;
  6941. }
  6942. if (Array.isArray(val)) {
  6943. return jQuery.map(val, function (val) {
  6944. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  6945. });
  6946. }
  6947. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  6948. }).get();
  6949. }
  6950. });
  6951. var
  6952. r20 = /%20/g,
  6953. rhash = /#.*$/,
  6954. rantiCache = /([?&])_=[^&]*/,
  6955. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  6956. // #7653, #8125, #8152: local protocol detection
  6957. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  6958. rnoContent = /^(?:GET|HEAD)$/,
  6959. rprotocol = /^\/\//,
  6960. /* Prefilters
  6961. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  6962. * 2) These are called:
  6963. * - BEFORE asking for a transport
  6964. * - AFTER param serialization (s.data is a string if s.processData is true)
  6965. * 3) key is the dataType
  6966. * 4) the catchall symbol "*" can be used
  6967. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  6968. */
  6969. prefilters = {},
  6970. /* Transports bindings
  6971. * 1) key is the dataType
  6972. * 2) the catchall symbol "*" can be used
  6973. * 3) selection will start with transport dataType and THEN go to "*" if needed
  6974. */
  6975. transports = {},
  6976. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  6977. allTypes = "*/".concat("*"),
  6978. // Anchor tag for parsing the document origin
  6979. originAnchor = document.createElement("a");
  6980. originAnchor.href = location.href;
  6981. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  6982. function addToPrefiltersOrTransports(structure) {
  6983. // dataTypeExpression is optional and defaults to "*"
  6984. return function (dataTypeExpression, func) {
  6985. if (typeof dataTypeExpression !== "string") {
  6986. func = dataTypeExpression;
  6987. dataTypeExpression = "*";
  6988. }
  6989. var dataType,
  6990. i = 0,
  6991. dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];
  6992. if (isFunction(func)) {
  6993. // For each dataType in the dataTypeExpression
  6994. while ((dataType = dataTypes[i++])) {
  6995. // Prepend if requested
  6996. if (dataType[0] === "+") {
  6997. dataType = dataType.slice(1) || "*";
  6998. (structure[dataType] = structure[dataType] || []).unshift(func);
  6999. // Otherwise append
  7000. } else {
  7001. (structure[dataType] = structure[dataType] || []).push(func);
  7002. }
  7003. }
  7004. }
  7005. };
  7006. }
  7007. // Base inspection function for prefilters and transports
  7008. function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
  7009. var inspected = {},
  7010. seekingTransport = (structure === transports);
  7011. function inspect(dataType) {
  7012. var selected;
  7013. inspected[dataType] = true;
  7014. jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {
  7015. var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
  7016. if (typeof dataTypeOrTransport === "string" &&
  7017. !seekingTransport && !inspected[dataTypeOrTransport]) {
  7018. options.dataTypes.unshift(dataTypeOrTransport);
  7019. inspect(dataTypeOrTransport);
  7020. return false;
  7021. } else if (seekingTransport) {
  7022. return !(selected = dataTypeOrTransport);
  7023. }
  7024. });
  7025. return selected;
  7026. }
  7027. return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*");
  7028. }
  7029. // A special extend for ajax options
  7030. // that takes "flat" options (not to be deep extended)
  7031. // Fixes #9887
  7032. function ajaxExtend(target, src) {
  7033. var key, deep,
  7034. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  7035. for (key in src) {
  7036. if (src[key] !== undefined) {
  7037. (flatOptions[key] ? target : (deep || (deep = {})))[key] = src[key];
  7038. }
  7039. }
  7040. if (deep) {
  7041. jQuery.extend(true, target, deep);
  7042. }
  7043. return target;
  7044. }
  7045. /* Handles responses to an ajax request:
  7046. * - finds the right dataType (mediates between content-type and expected dataType)
  7047. * - returns the corresponding response
  7048. */
  7049. function ajaxHandleResponses(s, jqXHR, responses) {
  7050. var ct, type, finalDataType, firstDataType,
  7051. contents = s.contents,
  7052. dataTypes = s.dataTypes;
  7053. // Remove auto dataType and get content-type in the process
  7054. while (dataTypes[0] === "*") {
  7055. dataTypes.shift();
  7056. if (ct === undefined) {
  7057. ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
  7058. }
  7059. }
  7060. // Check if we're dealing with a known content-type
  7061. if (ct) {
  7062. for (type in contents) {
  7063. if (contents[type] && contents[type].test(ct)) {
  7064. dataTypes.unshift(type);
  7065. break;
  7066. }
  7067. }
  7068. }
  7069. // Check to see if we have a response for the expected dataType
  7070. if (dataTypes[0] in responses) {
  7071. finalDataType = dataTypes[0];
  7072. } else {
  7073. // Try convertible dataTypes
  7074. for (type in responses) {
  7075. if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
  7076. finalDataType = type;
  7077. break;
  7078. }
  7079. if (!firstDataType) {
  7080. firstDataType = type;
  7081. }
  7082. }
  7083. // Or just use first one
  7084. finalDataType = finalDataType || firstDataType;
  7085. }
  7086. // If we found a dataType
  7087. // We add the dataType to the list if needed
  7088. // and return the corresponding response
  7089. if (finalDataType) {
  7090. if (finalDataType !== dataTypes[0]) {
  7091. dataTypes.unshift(finalDataType);
  7092. }
  7093. return responses[finalDataType];
  7094. }
  7095. }
  7096. /* Chain conversions given the request and the original response
  7097. * Also sets the responseXXX fields on the jqXHR instance
  7098. */
  7099. function ajaxConvert(s, response, jqXHR, isSuccess) {
  7100. var conv2, current, conv, tmp, prev,
  7101. converters = {},
  7102. // Work with a copy of dataTypes in case we need to modify it for conversion
  7103. dataTypes = s.dataTypes.slice();
  7104. // Create converters map with lowercased keys
  7105. if (dataTypes[1]) {
  7106. for (conv in s.converters) {
  7107. converters[conv.toLowerCase()] = s.converters[conv];
  7108. }
  7109. }
  7110. current = dataTypes.shift();
  7111. // Convert to each sequential dataType
  7112. while (current) {
  7113. if (s.responseFields[current]) {
  7114. jqXHR[s.responseFields[current]] = response;
  7115. }
  7116. // Apply the dataFilter if provided
  7117. if (!prev && isSuccess && s.dataFilter) {
  7118. response = s.dataFilter(response, s.dataType);
  7119. }
  7120. prev = current;
  7121. current = dataTypes.shift();
  7122. if (current) {
  7123. // There's only work to do if current dataType is non-auto
  7124. if (current === "*") {
  7125. current = prev;
  7126. // Convert response if prev dataType is non-auto and differs from current
  7127. } else if (prev !== "*" && prev !== current) {
  7128. // Seek a direct converter
  7129. conv = converters[prev + " " + current] || converters["* " + current];
  7130. // If none found, seek a pair
  7131. if (!conv) {
  7132. for (conv2 in converters) {
  7133. // If conv2 outputs current
  7134. tmp = conv2.split(" ");
  7135. if (tmp[1] === current) {
  7136. // If prev can be converted to accepted input
  7137. conv = converters[prev + " " + tmp[0]] ||
  7138. converters["* " + tmp[0]];
  7139. if (conv) {
  7140. // Condense equivalence converters
  7141. if (conv === true) {
  7142. conv = converters[conv2];
  7143. // Otherwise, insert the intermediate dataType
  7144. } else if (converters[conv2] !== true) {
  7145. current = tmp[0];
  7146. dataTypes.unshift(tmp[1]);
  7147. }
  7148. break;
  7149. }
  7150. }
  7151. }
  7152. }
  7153. // Apply converter (if not an equivalence)
  7154. if (conv !== true) {
  7155. // Unless errors are allowed to bubble, catch and return them
  7156. if (conv && s.throws) {
  7157. response = conv(response);
  7158. } else {
  7159. try {
  7160. response = conv(response);
  7161. } catch (e) {
  7162. return {
  7163. state: "parsererror",
  7164. error: conv ? e : "No conversion from " + prev + " to " + current
  7165. };
  7166. }
  7167. }
  7168. }
  7169. }
  7170. }
  7171. }
  7172. return { state: "success", data: response };
  7173. }
  7174. jQuery.extend({
  7175. // Counter for holding the number of active queries
  7176. active: 0,
  7177. // Last-Modified header cache for next request
  7178. lastModified: {},
  7179. etag: {},
  7180. ajaxSettings: {
  7181. url: location.href,
  7182. type: "GET",
  7183. isLocal: rlocalProtocol.test(location.protocol),
  7184. global: true,
  7185. processData: true,
  7186. async: true,
  7187. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  7188. /*
  7189. timeout: 0,
  7190. data: null,
  7191. dataType: null,
  7192. username: null,
  7193. password: null,
  7194. cache: null,
  7195. throws: false,
  7196. traditional: false,
  7197. headers: {},
  7198. */
  7199. accepts: {
  7200. "*": allTypes,
  7201. text: "text/plain",
  7202. html: "text/html",
  7203. xml: "application/xml, text/xml",
  7204. json: "application/json, text/javascript"
  7205. },
  7206. contents: {
  7207. xml: /\bxml\b/,
  7208. html: /\bhtml/,
  7209. json: /\bjson\b/
  7210. },
  7211. responseFields: {
  7212. xml: "responseXML",
  7213. text: "responseText",
  7214. json: "responseJSON"
  7215. },
  7216. // Data converters
  7217. // Keys separate source (or catchall "*") and destination types with a single space
  7218. converters: {
  7219. // Convert anything to text
  7220. "* text": String,
  7221. // Text to html (true = no transformation)
  7222. "text html": true,
  7223. // Evaluate text as a json expression
  7224. "text json": JSON.parse,
  7225. // Parse text as xml
  7226. "text xml": jQuery.parseXML
  7227. },
  7228. // For options that shouldn't be deep extended:
  7229. // you can add your own custom options here if
  7230. // and when you create one that shouldn't be
  7231. // deep extended (see ajaxExtend)
  7232. flatOptions: {
  7233. url: true,
  7234. context: true
  7235. }
  7236. },
  7237. // Creates a full fledged settings object into target
  7238. // with both ajaxSettings and settings fields.
  7239. // If target is omitted, writes into ajaxSettings.
  7240. ajaxSetup: function (target, settings) {
  7241. return settings ?
  7242. // Building a settings object
  7243. ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :
  7244. // Extending ajaxSettings
  7245. ajaxExtend(jQuery.ajaxSettings, target);
  7246. },
  7247. ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
  7248. ajaxTransport: addToPrefiltersOrTransports(transports),
  7249. // Main method
  7250. ajax: function (url, options) {
  7251. // If url is an object, simulate pre-1.5 signature
  7252. if (typeof url === "object") {
  7253. options = url;
  7254. url = undefined;
  7255. }
  7256. // Force options to be an object
  7257. options = options || {};
  7258. var transport,
  7259. // URL without anti-cache param
  7260. cacheURL,
  7261. // Response headers
  7262. responseHeadersString,
  7263. responseHeaders,
  7264. // timeout handle
  7265. timeoutTimer,
  7266. // Url cleanup var
  7267. urlAnchor,
  7268. // Request state (becomes false upon send and true upon completion)
  7269. completed,
  7270. // To know if global events are to be dispatched
  7271. fireGlobals,
  7272. // Loop variable
  7273. i,
  7274. // uncached part of the url
  7275. uncached,
  7276. // Create the final options object
  7277. s = jQuery.ajaxSetup({}, options),
  7278. // Callbacks context
  7279. callbackContext = s.context || s,
  7280. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  7281. globalEventContext = s.context &&
  7282. (callbackContext.nodeType || callbackContext.jquery) ?
  7283. jQuery(callbackContext) :
  7284. jQuery.event,
  7285. // Deferreds
  7286. deferred = jQuery.Deferred(),
  7287. completeDeferred = jQuery.Callbacks("once memory"),
  7288. // Status-dependent callbacks
  7289. statusCode = s.statusCode || {},
  7290. // Headers (they are sent all at once)
  7291. requestHeaders = {},
  7292. requestHeadersNames = {},
  7293. // Default abort message
  7294. strAbort = "canceled",
  7295. // Fake xhr
  7296. jqXHR = {
  7297. readyState: 0,
  7298. // Builds headers hashtable if needed
  7299. getResponseHeader: function (key) {
  7300. var match;
  7301. if (completed) {
  7302. if (!responseHeaders) {
  7303. responseHeaders = {};
  7304. while ((match = rheaders.exec(responseHeadersString))) {
  7305. responseHeaders[match[1].toLowerCase()] = match[2];
  7306. }
  7307. }
  7308. match = responseHeaders[key.toLowerCase()];
  7309. }
  7310. return match == null ? null : match;
  7311. },
  7312. // Raw string
  7313. getAllResponseHeaders: function () {
  7314. return completed ? responseHeadersString : null;
  7315. },
  7316. // Caches the header
  7317. setRequestHeader: function (name, value) {
  7318. if (completed == null) {
  7319. name = requestHeadersNames[name.toLowerCase()] =
  7320. requestHeadersNames[name.toLowerCase()] || name;
  7321. requestHeaders[name] = value;
  7322. }
  7323. return this;
  7324. },
  7325. // Overrides response content-type header
  7326. overrideMimeType: function (type) {
  7327. if (completed == null) {
  7328. s.mimeType = type;
  7329. }
  7330. return this;
  7331. },
  7332. // Status-dependent callbacks
  7333. statusCode: function (map) {
  7334. var code;
  7335. if (map) {
  7336. if (completed) {
  7337. // Execute the appropriate callbacks
  7338. jqXHR.always(map[jqXHR.status]);
  7339. } else {
  7340. // Lazy-add the new callbacks in a way that preserves old ones
  7341. for (code in map) {
  7342. statusCode[code] = [statusCode[code], map[code]];
  7343. }
  7344. }
  7345. }
  7346. return this;
  7347. },
  7348. // Cancel the request
  7349. abort: function (statusText) {
  7350. var finalText = statusText || strAbort;
  7351. if (transport) {
  7352. transport.abort(finalText);
  7353. }
  7354. done(0, finalText);
  7355. return this;
  7356. }
  7357. };
  7358. // Attach deferreds
  7359. deferred.promise(jqXHR);
  7360. // Add protocol if not provided (prefilters might expect it)
  7361. // Handle falsy url in the settings object (#10093: consistency with old signature)
  7362. // We also use the url parameter if available
  7363. s.url = ((url || s.url || location.href) + "")
  7364. .replace(rprotocol, location.protocol + "//");
  7365. // Alias method option to type as per ticket #12004
  7366. s.type = options.method || options.type || s.method || s.type;
  7367. // Extract dataTypes list
  7368. s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""];
  7369. // A cross-domain request is in order when the origin doesn't match the current origin.
  7370. if (s.crossDomain == null) {
  7371. urlAnchor = document.createElement("a");
  7372. // Support: IE <=8 - 11, Edge 12 - 15
  7373. // IE throws exception on accessing the href property if url is malformed,
  7374. // e.g. http://example.com:80x/
  7375. try {
  7376. urlAnchor.href = s.url;
  7377. // Support: IE <=8 - 11 only
  7378. // Anchor's host property isn't correctly set when s.url is relative
  7379. urlAnchor.href = urlAnchor.href;
  7380. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  7381. urlAnchor.protocol + "//" + urlAnchor.host;
  7382. } catch (e) {
  7383. // If there is an error parsing the URL, assume it is crossDomain,
  7384. // it can be rejected by the transport if it is invalid
  7385. s.crossDomain = true;
  7386. }
  7387. }
  7388. // Convert data if not already a string
  7389. if (s.data && s.processData && typeof s.data !== "string") {
  7390. s.data = jQuery.param(s.data, s.traditional);
  7391. }
  7392. // Apply prefilters
  7393. inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
  7394. // If request was aborted inside a prefilter, stop there
  7395. if (completed) {
  7396. return jqXHR;
  7397. }
  7398. // We can fire global events as of now if asked to
  7399. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  7400. fireGlobals = jQuery.event && s.global;
  7401. // Watch for a new set of requests
  7402. if (fireGlobals && jQuery.active++ === 0) {
  7403. jQuery.event.trigger("ajaxStart");
  7404. }
  7405. // Uppercase the type
  7406. s.type = s.type.toUpperCase();
  7407. // Determine if request has content
  7408. s.hasContent = !rnoContent.test(s.type);
  7409. // Save the URL in case we're toying with the If-Modified-Since
  7410. // and/or If-None-Match header later on
  7411. // Remove hash to simplify url manipulation
  7412. cacheURL = s.url.replace(rhash, "");
  7413. // More options handling for requests with no content
  7414. if (!s.hasContent) {
  7415. // Remember the hash so we can put it back
  7416. uncached = s.url.slice(cacheURL.length);
  7417. // If data is available and should be processed, append data to url
  7418. if (s.data && (s.processData || typeof s.data === "string")) {
  7419. cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data;
  7420. // #9682: remove data so that it's not used in an eventual retry
  7421. delete s.data;
  7422. }
  7423. // Add or update anti-cache param if needed
  7424. if (s.cache === false) {
  7425. cacheURL = cacheURL.replace(rantiCache, "$1");
  7426. uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + (nonce++) + uncached;
  7427. }
  7428. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  7429. s.url = cacheURL + uncached;
  7430. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  7431. } else if (s.data && s.processData &&
  7432. (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) {
  7433. s.data = s.data.replace(r20, "+");
  7434. }
  7435. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  7436. if (s.ifModified) {
  7437. if (jQuery.lastModified[cacheURL]) {
  7438. jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
  7439. }
  7440. if (jQuery.etag[cacheURL]) {
  7441. jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
  7442. }
  7443. }
  7444. // Set the correct header, if data is being sent
  7445. if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
  7446. jqXHR.setRequestHeader("Content-Type", s.contentType);
  7447. }
  7448. // Set the Accepts header for the server, depending on the dataType
  7449. jqXHR.setRequestHeader(
  7450. "Accept",
  7451. s.dataTypes[0] && s.accepts[s.dataTypes[0]] ?
  7452. s.accepts[s.dataTypes[0]] +
  7453. (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") :
  7454. s.accepts["*"]
  7455. );
  7456. // Check for headers option
  7457. for (i in s.headers) {
  7458. jqXHR.setRequestHeader(i, s.headers[i]);
  7459. }
  7460. // Allow custom headers/mimetypes and early abort
  7461. if (s.beforeSend &&
  7462. (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) {
  7463. // Abort if not done already and return
  7464. return jqXHR.abort();
  7465. }
  7466. // Aborting is no longer a cancellation
  7467. strAbort = "abort";
  7468. // Install callbacks on deferreds
  7469. completeDeferred.add(s.complete);
  7470. jqXHR.done(s.success);
  7471. jqXHR.fail(s.error);
  7472. // Get transport
  7473. transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
  7474. // If no transport, we auto-abort
  7475. if (!transport) {
  7476. done(-1, "No Transport");
  7477. } else {
  7478. jqXHR.readyState = 1;
  7479. // Send global event
  7480. if (fireGlobals) {
  7481. globalEventContext.trigger("ajaxSend", [jqXHR, s]);
  7482. }
  7483. // If request was aborted inside ajaxSend, stop there
  7484. if (completed) {
  7485. return jqXHR;
  7486. }
  7487. // Timeout
  7488. if (s.async && s.timeout > 0) {
  7489. timeoutTimer = window.setTimeout(function () {
  7490. jqXHR.abort("timeout");
  7491. }, s.timeout);
  7492. }
  7493. try {
  7494. completed = false;
  7495. transport.send(requestHeaders, done);
  7496. } catch (e) {
  7497. // Rethrow post-completion exceptions
  7498. if (completed) {
  7499. throw e;
  7500. }
  7501. // Propagate others as results
  7502. done(-1, e);
  7503. }
  7504. }
  7505. // Callback for when everything is done
  7506. function done(status, nativeStatusText, responses, headers) {
  7507. var isSuccess, success, error, response, modified,
  7508. statusText = nativeStatusText;
  7509. // Ignore repeat invocations
  7510. if (completed) {
  7511. return;
  7512. }
  7513. completed = true;
  7514. // Clear timeout if it exists
  7515. if (timeoutTimer) {
  7516. window.clearTimeout(timeoutTimer);
  7517. }
  7518. // Dereference transport for early garbage collection
  7519. // (no matter how long the jqXHR object will be used)
  7520. transport = undefined;
  7521. // Cache response headers
  7522. responseHeadersString = headers || "";
  7523. // Set readyState
  7524. jqXHR.readyState = status > 0 ? 4 : 0;
  7525. // Determine if successful
  7526. isSuccess = status >= 200 && status < 300 || status === 304;
  7527. // Get response data
  7528. if (responses) {
  7529. response = ajaxHandleResponses(s, jqXHR, responses);
  7530. }
  7531. // Convert no matter what (that way responseXXX fields are always set)
  7532. response = ajaxConvert(s, response, jqXHR, isSuccess);
  7533. // If successful, handle type chaining
  7534. if (isSuccess) {
  7535. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  7536. if (s.ifModified) {
  7537. modified = jqXHR.getResponseHeader("Last-Modified");
  7538. if (modified) {
  7539. jQuery.lastModified[cacheURL] = modified;
  7540. }
  7541. modified = jqXHR.getResponseHeader("etag");
  7542. if (modified) {
  7543. jQuery.etag[cacheURL] = modified;
  7544. }
  7545. }
  7546. // if no content
  7547. if (status === 204 || s.type === "HEAD") {
  7548. statusText = "nocontent";
  7549. // if not modified
  7550. } else if (status === 304) {
  7551. statusText = "notmodified";
  7552. // If we have data, let's convert it
  7553. } else {
  7554. statusText = response.state;
  7555. success = response.data;
  7556. error = response.error;
  7557. isSuccess = !error;
  7558. }
  7559. } else {
  7560. // Extract error from statusText and normalize for non-aborts
  7561. error = statusText;
  7562. if (status || !statusText) {
  7563. statusText = "error";
  7564. if (status < 0) {
  7565. status = 0;
  7566. }
  7567. }
  7568. }
  7569. // Set data for the fake xhr object
  7570. jqXHR.status = status;
  7571. jqXHR.statusText = (nativeStatusText || statusText) + "";
  7572. // Success/Error
  7573. if (isSuccess) {
  7574. deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
  7575. } else {
  7576. deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
  7577. }
  7578. // Status-dependent callbacks
  7579. jqXHR.statusCode(statusCode);
  7580. statusCode = undefined;
  7581. if (fireGlobals) {
  7582. globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError",
  7583. [jqXHR, s, isSuccess ? success : error]);
  7584. }
  7585. // Complete
  7586. completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
  7587. if (fireGlobals) {
  7588. globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
  7589. // Handle the global AJAX counter
  7590. if (!(--jQuery.active)) {
  7591. jQuery.event.trigger("ajaxStop");
  7592. }
  7593. }
  7594. }
  7595. return jqXHR;
  7596. },
  7597. getJSON: function (url, data, callback) {
  7598. return jQuery.get(url, data, callback, "json");
  7599. },
  7600. getScript: function (url, callback) {
  7601. return jQuery.get(url, undefined, callback, "script");
  7602. }
  7603. });
  7604. jQuery.each(["get", "post"], function (i, method) {
  7605. jQuery[method] = function (url, data, callback, type) {
  7606. // Shift arguments if data argument was omitted
  7607. if (isFunction(data)) {
  7608. type = type || callback;
  7609. callback = data;
  7610. data = undefined;
  7611. }
  7612. // The url can be an options object (which then must have .url)
  7613. return jQuery.ajax(jQuery.extend({
  7614. url: url,
  7615. type: method,
  7616. dataType: type,
  7617. data: data,
  7618. success: callback
  7619. }, jQuery.isPlainObject(url) && url));
  7620. };
  7621. });
  7622. jQuery._evalUrl = function (url) {
  7623. return jQuery.ajax({
  7624. url: url,
  7625. // Make this explicit, since user can override this through ajaxSetup (#11264)
  7626. type: "GET",
  7627. dataType: "script",
  7628. cache: true,
  7629. async: false,
  7630. global: false,
  7631. "throws": true
  7632. });
  7633. };
  7634. jQuery.fn.extend({
  7635. wrapAll: function (html) {
  7636. var wrap;
  7637. if (this[0]) {
  7638. if (isFunction(html)) {
  7639. html = html.call(this[0]);
  7640. }
  7641. // The elements to wrap the target around
  7642. wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
  7643. if (this[0].parentNode) {
  7644. wrap.insertBefore(this[0]);
  7645. }
  7646. wrap.map(function () {
  7647. var elem = this;
  7648. while (elem.firstElementChild) {
  7649. elem = elem.firstElementChild;
  7650. }
  7651. return elem;
  7652. }).append(this);
  7653. }
  7654. return this;
  7655. },
  7656. wrapInner: function (html) {
  7657. if (isFunction(html)) {
  7658. return this.each(function (i) {
  7659. jQuery(this).wrapInner(html.call(this, i));
  7660. });
  7661. }
  7662. return this.each(function () {
  7663. var self = jQuery(this),
  7664. contents = self.contents();
  7665. if (contents.length) {
  7666. contents.wrapAll(html);
  7667. } else {
  7668. self.append(html);
  7669. }
  7670. });
  7671. },
  7672. wrap: function (html) {
  7673. var htmlIsFunction = isFunction(html);
  7674. return this.each(function (i) {
  7675. jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);
  7676. });
  7677. },
  7678. unwrap: function (selector) {
  7679. this.parent(selector).not("body").each(function () {
  7680. jQuery(this).replaceWith(this.childNodes);
  7681. });
  7682. return this;
  7683. }
  7684. });
  7685. jQuery.expr.pseudos.hidden = function (elem) {
  7686. return !jQuery.expr.pseudos.visible(elem);
  7687. };
  7688. jQuery.expr.pseudos.visible = function (elem) {
  7689. return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
  7690. };
  7691. jQuery.ajaxSettings.xhr = function () {
  7692. try {
  7693. return new window.XMLHttpRequest();
  7694. } catch (e) { }
  7695. };
  7696. var xhrSuccessStatus = {
  7697. // File protocol always yields status code 0, assume 200
  7698. 0: 200,
  7699. // Support: IE <=9 only
  7700. // #1450: sometimes IE returns 1223 when it should be 204
  7701. 1223: 204
  7702. },
  7703. xhrSupported = jQuery.ajaxSettings.xhr();
  7704. support.cors = !!xhrSupported && ("withCredentials" in xhrSupported);
  7705. support.ajax = xhrSupported = !!xhrSupported;
  7706. jQuery.ajaxTransport(function (options) {
  7707. var callback, errorCallback;
  7708. // Cross domain only allowed if supported through XMLHttpRequest
  7709. if (support.cors || xhrSupported && !options.crossDomain) {
  7710. return {
  7711. send: function (headers, complete) {
  7712. var i,
  7713. xhr = options.xhr();
  7714. xhr.open(
  7715. options.type,
  7716. options.url,
  7717. options.async,
  7718. options.username,
  7719. options.password
  7720. );
  7721. // Apply custom fields if provided
  7722. if (options.xhrFields) {
  7723. for (i in options.xhrFields) {
  7724. xhr[i] = options.xhrFields[i];
  7725. }
  7726. }
  7727. // Override mime type if needed
  7728. if (options.mimeType && xhr.overrideMimeType) {
  7729. xhr.overrideMimeType(options.mimeType);
  7730. }
  7731. // X-Requested-With header
  7732. // For cross-domain requests, seeing as conditions for a preflight are
  7733. // akin to a jigsaw puzzle, we simply never set it to be sure.
  7734. // (it can always be set on a per-request basis or even using ajaxSetup)
  7735. // For same-domain requests, won't change header if already provided.
  7736. if (!options.crossDomain && !headers["X-Requested-With"]) {
  7737. headers["X-Requested-With"] = "XMLHttpRequest";
  7738. }
  7739. // Set headers
  7740. for (i in headers) {
  7741. xhr.setRequestHeader(i, headers[i]);
  7742. }
  7743. // Callback
  7744. callback = function (type) {
  7745. return function () {
  7746. if (callback) {
  7747. callback = errorCallback = xhr.onload =
  7748. xhr.onerror = xhr.onabort = xhr.ontimeout =
  7749. xhr.onreadystatechange = null;
  7750. if (type === "abort") {
  7751. xhr.abort();
  7752. } else if (type === "error") {
  7753. // Support: IE <=9 only
  7754. // On a manual native abort, IE9 throws
  7755. // errors on any property access that is not readyState
  7756. if (typeof xhr.status !== "number") {
  7757. complete(0, "error");
  7758. } else {
  7759. complete(
  7760. // File: protocol always yields status 0; see #8605, #14207
  7761. xhr.status,
  7762. xhr.statusText
  7763. );
  7764. }
  7765. } else {
  7766. complete(
  7767. xhrSuccessStatus[xhr.status] || xhr.status,
  7768. xhr.statusText,
  7769. // Support: IE <=9 only
  7770. // IE9 has no XHR2 but throws on binary (trac-11426)
  7771. // For XHR2 non-text, let the caller handle it (gh-2498)
  7772. (xhr.responseType || "text") !== "text" ||
  7773. typeof xhr.responseText !== "string" ?
  7774. { binary: xhr.response } :
  7775. { text: xhr.responseText },
  7776. xhr.getAllResponseHeaders()
  7777. );
  7778. }
  7779. }
  7780. };
  7781. };
  7782. // Listen to events
  7783. xhr.onload = callback();
  7784. errorCallback = xhr.onerror = xhr.ontimeout = callback("error");
  7785. // Support: IE 9 only
  7786. // Use onreadystatechange to replace onabort
  7787. // to handle uncaught aborts
  7788. if (xhr.onabort !== undefined) {
  7789. xhr.onabort = errorCallback;
  7790. } else {
  7791. xhr.onreadystatechange = function () {
  7792. // Check readyState before timeout as it changes
  7793. if (xhr.readyState === 4) {
  7794. // Allow onerror to be called first,
  7795. // but that will not handle a native abort
  7796. // Also, save errorCallback to a variable
  7797. // as xhr.onerror cannot be accessed
  7798. window.setTimeout(function () {
  7799. if (callback) {
  7800. errorCallback();
  7801. }
  7802. });
  7803. }
  7804. };
  7805. }
  7806. // Create the abort callback
  7807. callback = callback("abort");
  7808. try {
  7809. // Do send the request (this may raise an exception)
  7810. xhr.send(options.hasContent && options.data || null);
  7811. } catch (e) {
  7812. // #14683: Only rethrow if this hasn't been notified as an error yet
  7813. if (callback) {
  7814. throw e;
  7815. }
  7816. }
  7817. },
  7818. abort: function () {
  7819. if (callback) {
  7820. callback();
  7821. }
  7822. }
  7823. };
  7824. }
  7825. });
  7826. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  7827. jQuery.ajaxPrefilter(function (s) {
  7828. if (s.crossDomain) {
  7829. s.contents.script = false;
  7830. }
  7831. });
  7832. // Install script dataType
  7833. jQuery.ajaxSetup({
  7834. accepts: {
  7835. script: "text/javascript, application/javascript, " +
  7836. "application/ecmascript, application/x-ecmascript"
  7837. },
  7838. contents: {
  7839. script: /\b(?:java|ecma)script\b/
  7840. },
  7841. converters: {
  7842. "text script": function (text) {
  7843. jQuery.globalEval(text);
  7844. return text;
  7845. }
  7846. }
  7847. });
  7848. // Handle cache's special case and crossDomain
  7849. jQuery.ajaxPrefilter("script", function (s) {
  7850. if (s.cache === undefined) {
  7851. s.cache = false;
  7852. }
  7853. if (s.crossDomain) {
  7854. s.type = "GET";
  7855. }
  7856. });
  7857. // Bind script tag hack transport
  7858. jQuery.ajaxTransport("script", function (s) {
  7859. // This transport only deals with cross domain requests
  7860. if (s.crossDomain) {
  7861. var script, callback;
  7862. return {
  7863. send: function (_, complete) {
  7864. script = jQuery("<script>").prop({
  7865. charset: s.scriptCharset,
  7866. src: s.url
  7867. }).on(
  7868. "load error",
  7869. callback = function (evt) {
  7870. script.remove();
  7871. callback = null;
  7872. if (evt) {
  7873. complete(evt.type === "error" ? 404 : 200, evt.type);
  7874. }
  7875. }
  7876. );
  7877. // Use native DOM manipulation to avoid our domManip AJAX trickery
  7878. document.head.appendChild(script[0]);
  7879. },
  7880. abort: function () {
  7881. if (callback) {
  7882. callback();
  7883. }
  7884. }
  7885. };
  7886. }
  7887. });
  7888. var oldCallbacks = [],
  7889. rjsonp = /(=)\?(?=&|$)|\?\?/;
  7890. // Default jsonp settings
  7891. jQuery.ajaxSetup({
  7892. jsonp: "callback",
  7893. jsonpCallback: function () {
  7894. var callback = oldCallbacks.pop() || (jQuery.expando + "_" + (nonce++));
  7895. this[callback] = true;
  7896. return callback;
  7897. }
  7898. });
  7899. // Detect, normalize options and install callbacks for jsonp requests
  7900. jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) {
  7901. var callbackName, overwritten, responseContainer,
  7902. jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ?
  7903. "url" :
  7904. typeof s.data === "string" &&
  7905. (s.contentType || "")
  7906. .indexOf("application/x-www-form-urlencoded") === 0 &&
  7907. rjsonp.test(s.data) && "data"
  7908. );
  7909. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  7910. if (jsonProp || s.dataTypes[0] === "jsonp") {
  7911. // Get callback name, remembering preexisting value associated with it
  7912. callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) ?
  7913. s.jsonpCallback() :
  7914. s.jsonpCallback;
  7915. // Insert callback into url or form data
  7916. if (jsonProp) {
  7917. s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
  7918. } else if (s.jsonp !== false) {
  7919. s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
  7920. }
  7921. // Use data converter to retrieve json after script execution
  7922. s.converters["script json"] = function () {
  7923. if (!responseContainer) {
  7924. jQuery.error(callbackName + " was not called");
  7925. }
  7926. return responseContainer[0];
  7927. };
  7928. // Force json dataType
  7929. s.dataTypes[0] = "json";
  7930. // Install callback
  7931. overwritten = window[callbackName];
  7932. window[callbackName] = function () {
  7933. responseContainer = arguments;
  7934. };
  7935. // Clean-up function (fires after converters)
  7936. jqXHR.always(function () {
  7937. // If previous value didn't exist - remove it
  7938. if (overwritten === undefined) {
  7939. jQuery(window).removeProp(callbackName);
  7940. // Otherwise restore preexisting value
  7941. } else {
  7942. window[callbackName] = overwritten;
  7943. }
  7944. // Save back as free
  7945. if (s[callbackName]) {
  7946. // Make sure that re-using the options doesn't screw things around
  7947. s.jsonpCallback = originalSettings.jsonpCallback;
  7948. // Save the callback name for future use
  7949. oldCallbacks.push(callbackName);
  7950. }
  7951. // Call if it was a function and we have a response
  7952. if (responseContainer && isFunction(overwritten)) {
  7953. overwritten(responseContainer[0]);
  7954. }
  7955. responseContainer = overwritten = undefined;
  7956. });
  7957. // Delegate to script
  7958. return "script";
  7959. }
  7960. });
  7961. // Support: Safari 8 only
  7962. // In Safari 8 documents created via document.implementation.createHTMLDocument
  7963. // collapse sibling forms: the second one becomes a child of the first one.
  7964. // Because of that, this security measure has to be disabled in Safari 8.
  7965. // https://bugs.webkit.org/show_bug.cgi?id=137337
  7966. support.createHTMLDocument = (function () {
  7967. var body = document.implementation.createHTMLDocument("").body;
  7968. body.innerHTML = "<form></form><form></form>";
  7969. return body.childNodes.length === 2;
  7970. })();
  7971. // Argument "data" should be string of html
  7972. // context (optional): If specified, the fragment will be created in this context,
  7973. // defaults to document
  7974. // keepScripts (optional): If true, will include scripts passed in the html string
  7975. jQuery.parseHTML = function (data, context, keepScripts) {
  7976. if (typeof data !== "string") {
  7977. return [];
  7978. }
  7979. if (typeof context === "boolean") {
  7980. keepScripts = context;
  7981. context = false;
  7982. }
  7983. var base, parsed, scripts;
  7984. if (!context) {
  7985. // Stop scripts or inline event handlers from being executed immediately
  7986. // by using document.implementation
  7987. if (support.createHTMLDocument) {
  7988. context = document.implementation.createHTMLDocument("");
  7989. // Set the base href for the created document
  7990. // so any parsed elements with URLs
  7991. // are based on the document's URL (gh-2965)
  7992. base = context.createElement("base");
  7993. base.href = document.location.href;
  7994. context.head.appendChild(base);
  7995. } else {
  7996. context = document;
  7997. }
  7998. }
  7999. parsed = rsingleTag.exec(data);
  8000. scripts = !keepScripts && [];
  8001. // Single tag
  8002. if (parsed) {
  8003. return [context.createElement(parsed[1])];
  8004. }
  8005. parsed = buildFragment([data], context, scripts);
  8006. if (scripts && scripts.length) {
  8007. jQuery(scripts).remove();
  8008. }
  8009. return jQuery.merge([], parsed.childNodes);
  8010. };
  8011. /**
  8012. * Load a url into a page
  8013. */
  8014. jQuery.fn.load = function (url, params, callback) {
  8015. var selector, type, response,
  8016. self = this,
  8017. off = url.indexOf(" ");
  8018. if (off > -1) {
  8019. selector = stripAndCollapse(url.slice(off));
  8020. url = url.slice(0, off);
  8021. }
  8022. // If it's a function
  8023. if (isFunction(params)) {
  8024. // We assume that it's the callback
  8025. callback = params;
  8026. params = undefined;
  8027. // Otherwise, build a param string
  8028. } else if (params && typeof params === "object") {
  8029. type = "POST";
  8030. }
  8031. // If we have elements to modify, make the request
  8032. if (self.length > 0) {
  8033. jQuery.ajax({
  8034. url: url,
  8035. // If "type" variable is undefined, then "GET" method will be used.
  8036. // Make value of this field explicit since
  8037. // user can override it through ajaxSetup method
  8038. type: type || "GET",
  8039. dataType: "html",
  8040. data: params
  8041. }).done(function (responseText) {
  8042. // Save response for use in complete callback
  8043. response = arguments;
  8044. self.html(selector ?
  8045. // If a selector was specified, locate the right elements in a dummy div
  8046. // Exclude scripts to avoid IE 'Permission Denied' errors
  8047. jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) :
  8048. // Otherwise use the full result
  8049. responseText);
  8050. // If the request succeeds, this function gets "data", "status", "jqXHR"
  8051. // but they are ignored because response was set above.
  8052. // If it fails, this function gets "jqXHR", "status", "error"
  8053. }).always(callback && function (jqXHR, status) {
  8054. self.each(function () {
  8055. callback.apply(this, response || [jqXHR.responseText, status, jqXHR]);
  8056. });
  8057. });
  8058. }
  8059. return this;
  8060. };
  8061. // Attach a bunch of functions for handling common AJAX events
  8062. jQuery.each([
  8063. "ajaxStart",
  8064. "ajaxStop",
  8065. "ajaxComplete",
  8066. "ajaxError",
  8067. "ajaxSuccess",
  8068. "ajaxSend"
  8069. ], function (i, type) {
  8070. jQuery.fn[type] = function (fn) {
  8071. return this.on(type, fn);
  8072. };
  8073. });
  8074. jQuery.expr.pseudos.animated = function (elem) {
  8075. return jQuery.grep(jQuery.timers, function (fn) {
  8076. return elem === fn.elem;
  8077. }).length;
  8078. };
  8079. jQuery.offset = {
  8080. setOffset: function (elem, options, i) {
  8081. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  8082. position = jQuery.css(elem, "position"),
  8083. curElem = jQuery(elem),
  8084. props = {};
  8085. // Set position first, in-case top/left are set even on static elem
  8086. if (position === "static") {
  8087. elem.style.position = "relative";
  8088. }
  8089. curOffset = curElem.offset();
  8090. curCSSTop = jQuery.css(elem, "top");
  8091. curCSSLeft = jQuery.css(elem, "left");
  8092. calculatePosition = (position === "absolute" || position === "fixed") &&
  8093. (curCSSTop + curCSSLeft).indexOf("auto") > -1;
  8094. // Need to be able to calculate position if either
  8095. // top or left is auto and position is either absolute or fixed
  8096. if (calculatePosition) {
  8097. curPosition = curElem.position();
  8098. curTop = curPosition.top;
  8099. curLeft = curPosition.left;
  8100. } else {
  8101. curTop = parseFloat(curCSSTop) || 0;
  8102. curLeft = parseFloat(curCSSLeft) || 0;
  8103. }
  8104. if (isFunction(options)) {
  8105. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  8106. options = options.call(elem, i, jQuery.extend({}, curOffset));
  8107. }
  8108. if (options.top != null) {
  8109. props.top = (options.top - curOffset.top) + curTop;
  8110. }
  8111. if (options.left != null) {
  8112. props.left = (options.left - curOffset.left) + curLeft;
  8113. }
  8114. if ("using" in options) {
  8115. options.using.call(elem, props);
  8116. } else {
  8117. curElem.css(props);
  8118. }
  8119. }
  8120. };
  8121. jQuery.fn.extend({
  8122. // offset() relates an element's border box to the document origin
  8123. offset: function (options) {
  8124. // Preserve chaining for setter
  8125. if (arguments.length) {
  8126. return options === undefined ?
  8127. this :
  8128. this.each(function (i) {
  8129. jQuery.offset.setOffset(this, options, i);
  8130. });
  8131. }
  8132. var rect, win,
  8133. elem = this[0];
  8134. if (!elem) {
  8135. return;
  8136. }
  8137. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  8138. // Support: IE <=11 only
  8139. // Running getBoundingClientRect on a
  8140. // disconnected node in IE throws an error
  8141. if (!elem.getClientRects().length) {
  8142. return { top: 0, left: 0 };
  8143. }
  8144. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  8145. rect = elem.getBoundingClientRect();
  8146. win = elem.ownerDocument.defaultView;
  8147. return {
  8148. top: rect.top + win.pageYOffset,
  8149. left: rect.left + win.pageXOffset
  8150. };
  8151. },
  8152. // position() relates an element's margin box to its offset parent's padding box
  8153. // This corresponds to the behavior of CSS absolute positioning
  8154. position: function () {
  8155. if (!this[0]) {
  8156. return;
  8157. }
  8158. var offsetParent, offset, doc,
  8159. elem = this[0],
  8160. parentOffset = { top: 0, left: 0 };
  8161. // position:fixed elements are offset from the viewport, which itself always has zero offset
  8162. if (jQuery.css(elem, "position") === "fixed") {
  8163. // Assume position:fixed implies availability of getBoundingClientRect
  8164. offset = elem.getBoundingClientRect();
  8165. } else {
  8166. offset = this.offset();
  8167. // Account for the *real* offset parent, which can be the document or its root element
  8168. // when a statically positioned element is identified
  8169. doc = elem.ownerDocument;
  8170. offsetParent = elem.offsetParent || doc.documentElement;
  8171. while (offsetParent &&
  8172. (offsetParent === doc.body || offsetParent === doc.documentElement) &&
  8173. jQuery.css(offsetParent, "position") === "static") {
  8174. offsetParent = offsetParent.parentNode;
  8175. }
  8176. if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
  8177. // Incorporate borders into its offset, since they are outside its content origin
  8178. parentOffset = jQuery(offsetParent).offset();
  8179. parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true);
  8180. parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true);
  8181. }
  8182. }
  8183. // Subtract parent offsets and element margins
  8184. return {
  8185. top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
  8186. left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
  8187. };
  8188. },
  8189. // This method will return documentElement in the following cases:
  8190. // 1) For the element inside the iframe without offsetParent, this method will return
  8191. // documentElement of the parent window
  8192. // 2) For the hidden or detached element
  8193. // 3) For body or html element, i.e. in case of the html node - it will return itself
  8194. //
  8195. // but those exceptions were never presented as a real life use-cases
  8196. // and might be considered as more preferable results.
  8197. //
  8198. // This logic, however, is not guaranteed and can change at any point in the future
  8199. offsetParent: function () {
  8200. return this.map(function () {
  8201. var offsetParent = this.offsetParent;
  8202. while (offsetParent && jQuery.css(offsetParent, "position") === "static") {
  8203. offsetParent = offsetParent.offsetParent;
  8204. }
  8205. return offsetParent || documentElement;
  8206. });
  8207. }
  8208. });
  8209. // Create scrollLeft and scrollTop methods
  8210. jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function (method, prop) {
  8211. var top = "pageYOffset" === prop;
  8212. jQuery.fn[method] = function (val) {
  8213. return access(this, function (elem, method, val) {
  8214. // Coalesce documents and windows
  8215. var win;
  8216. if (isWindow(elem)) {
  8217. win = elem;
  8218. } else if (elem.nodeType === 9) {
  8219. win = elem.defaultView;
  8220. }
  8221. if (val === undefined) {
  8222. return win ? win[prop] : elem[method];
  8223. }
  8224. if (win) {
  8225. win.scrollTo(
  8226. !top ? val : win.pageXOffset,
  8227. top ? val : win.pageYOffset
  8228. );
  8229. } else {
  8230. elem[method] = val;
  8231. }
  8232. }, method, val, arguments.length);
  8233. };
  8234. });
  8235. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  8236. // Add the top/left cssHooks using jQuery.fn.position
  8237. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  8238. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  8239. // getComputedStyle returns percent when specified for top/left/bottom/right;
  8240. // rather than make the css module depend on the offset module, just check for it here
  8241. jQuery.each(["top", "left"], function (i, prop) {
  8242. jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition,
  8243. function (elem, computed) {
  8244. if (computed) {
  8245. computed = curCSS(elem, prop);
  8246. // If curCSS returns percentage, fallback to offset
  8247. return rnumnonpx.test(computed) ?
  8248. jQuery(elem).position()[prop] + "px" :
  8249. computed;
  8250. }
  8251. }
  8252. );
  8253. });
  8254. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  8255. jQuery.each({ Height: "height", Width: "width" }, function (name, type) {
  8256. jQuery.each({ padding: "inner" + name, content: type, "": "outer" + name },
  8257. function (defaultExtra, funcName) {
  8258. // Margin is only for outerHeight, outerWidth
  8259. jQuery.fn[funcName] = function (margin, value) {
  8260. var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
  8261. extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
  8262. return access(this, function (elem, type, value) {
  8263. var doc;
  8264. if (isWindow(elem)) {
  8265. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  8266. return funcName.indexOf("outer") === 0 ?
  8267. elem["inner" + name] :
  8268. elem.document.documentElement["client" + name];
  8269. }
  8270. // Get document width or height
  8271. if (elem.nodeType === 9) {
  8272. doc = elem.documentElement;
  8273. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  8274. // whichever is greatest
  8275. return Math.max(
  8276. elem.body["scroll" + name], doc["scroll" + name],
  8277. elem.body["offset" + name], doc["offset" + name],
  8278. doc["client" + name]
  8279. );
  8280. }
  8281. return value === undefined ?
  8282. // Get width or height on the element, requesting but not forcing parseFloat
  8283. jQuery.css(elem, type, extra) :
  8284. // Set width or height on the element
  8285. jQuery.style(elem, type, value, extra);
  8286. }, type, chainable ? margin : undefined, chainable);
  8287. };
  8288. });
  8289. });
  8290. jQuery.each(("blur focus focusin focusout resize scroll click dblclick " +
  8291. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  8292. "change select submit keydown keypress keyup contextmenu").split(" "),
  8293. function (i, name) {
  8294. // Handle event binding
  8295. jQuery.fn[name] = function (data, fn) {
  8296. return arguments.length > 0 ?
  8297. this.on(name, null, data, fn) :
  8298. this.trigger(name);
  8299. };
  8300. });
  8301. jQuery.fn.extend({
  8302. hover: function (fnOver, fnOut) {
  8303. return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
  8304. }
  8305. });
  8306. jQuery.fn.extend({
  8307. bind: function (types, data, fn) {
  8308. return this.on(types, null, data, fn);
  8309. },
  8310. unbind: function (types, fn) {
  8311. return this.off(types, null, fn);
  8312. },
  8313. delegate: function (selector, types, data, fn) {
  8314. return this.on(types, selector, data, fn);
  8315. },
  8316. undelegate: function (selector, types, fn) {
  8317. // ( namespace ) or ( selector, types [, fn] )
  8318. return arguments.length === 1 ?
  8319. this.off(selector, "**") :
  8320. this.off(types, selector || "**", fn);
  8321. }
  8322. });
  8323. // Bind a function to a context, optionally partially applying any
  8324. // arguments.
  8325. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  8326. // However, it is not slated for removal any time soon
  8327. jQuery.proxy = function (fn, context) {
  8328. var tmp, args, proxy;
  8329. if (typeof context === "string") {
  8330. tmp = fn[context];
  8331. context = fn;
  8332. fn = tmp;
  8333. }
  8334. // Quick check to determine if target is callable, in the spec
  8335. // this throws a TypeError, but we will just return undefined.
  8336. if (!isFunction(fn)) {
  8337. return undefined;
  8338. }
  8339. // Simulated bind
  8340. args = slice.call(arguments, 2);
  8341. proxy = function () {
  8342. return fn.apply(context || this, args.concat(slice.call(arguments)));
  8343. };
  8344. // Set the guid of unique handler to the same of original handler, so it can be removed
  8345. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  8346. return proxy;
  8347. };
  8348. jQuery.holdReady = function (hold) {
  8349. if (hold) {
  8350. jQuery.readyWait++;
  8351. } else {
  8352. jQuery.ready(true);
  8353. }
  8354. };
  8355. jQuery.isArray = Array.isArray;
  8356. jQuery.parseJSON = JSON.parse;
  8357. jQuery.nodeName = nodeName;
  8358. jQuery.isFunction = isFunction;
  8359. jQuery.isWindow = isWindow;
  8360. jQuery.camelCase = camelCase;
  8361. jQuery.type = toType;
  8362. jQuery.now = Date.now;
  8363. jQuery.isNumeric = function (obj) {
  8364. // As of jQuery 3.0, isNumeric is limited to
  8365. // strings and numbers (primitives or objects)
  8366. // that can be coerced to finite numbers (gh-2662)
  8367. var type = jQuery.type(obj);
  8368. return (type === "number" || type === "string") &&
  8369. // parseFloat NaNs numeric-cast false positives ("")
  8370. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  8371. // subtraction forces infinities to NaN
  8372. !isNaN(obj - parseFloat(obj));
  8373. };
  8374. // Register as a named AMD module, since jQuery can be concatenated with other
  8375. // files that may use define, but not via a proper concatenation script that
  8376. // understands anonymous AMD modules. A named AMD is safest and most robust
  8377. // way to register. Lowercase jquery is used because AMD module names are
  8378. // derived from file names, and jQuery is normally delivered in a lowercase
  8379. // file name. Do this after creating the global so that if an AMD module wants
  8380. // to call noConflict to hide this version of jQuery, it will work.
  8381. // Note that for maximum portability, libraries that are not jQuery should
  8382. // declare themselves as anonymous modules, and avoid setting a global if an
  8383. // AMD loader is present. jQuery is a special case. For more information, see
  8384. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  8385. if (typeof define === "function" && define.amd) {
  8386. define("jquery", [], function () {
  8387. return jQuery;
  8388. });
  8389. }
  8390. var
  8391. // Map over jQuery in case of overwrite
  8392. _jQuery = window.jQuery,
  8393. // Map over the $ in case of overwrite
  8394. _$ = window.$;
  8395. jQuery.noConflict = function (deep) {
  8396. if (window.$ === jQuery) {
  8397. window.$ = _$;
  8398. }
  8399. if (deep && window.jQuery === jQuery) {
  8400. window.jQuery = _jQuery;
  8401. }
  8402. return jQuery;
  8403. };
  8404. // Expose jQuery and $ identifiers, even in AMD
  8405. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  8406. // and CommonJS for browser emulators (#13566)
  8407. if (!noGlobal) {
  8408. window.jQuery = window.$ = jQuery;
  8409. }
  8410. return jQuery;
  8411. });