Advertisement
Guest User

jquery.js

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