選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

11009 行
287KB

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