Advertisement
ryfan

jquery.js

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