Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

10352 lines
278KB

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