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

9806 lines
268 KiB

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