jquery

jquery库

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/453166/1105525/jquery.js

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

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址