You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

9803 lines
268 KiB

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