Advertisement
Guest User

Untitled

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