PageRenderTime 71ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 3ms

/vendors/jqBootstrapValidation/libs/jquery/jquery-1.9.1.js

https://github.com/aduyng/travel-time-watcher-chrome-extension
JavaScript | 9597 lines | 6921 code | 1361 blank | 1315 comment | 1758 complexity | 04881c667961f2d4735fe1881b94c44b MD5 | raw file
Possible License(s): Apache-2.0, MIT, BSD-3-Clause, GPL-2.0

Large files files are truncated, but you can click here to view the full file

  1. /*!
  2. * jQuery JavaScript Library v1.9.1
  3. * http://jquery.com/
  4. *
  5. * Includes Sizzle.js
  6. * http://sizzlejs.com/
  7. *
  8. * Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors
  9. * Released under the MIT license
  10. * http://jquery.org/license
  11. *
  12. * Date: 2013-2-4
  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<9
  26. // For `typeof node.method` instead of `node.method !== undefined`
  27. core_strundefined = typeof undefined,
  28. // Use the correct document accordingly with window argument (sandbox)
  29. document = window.document,
  30. location = window.location,
  31. // Map over jQuery in case of overwrite
  32. _jQuery = window.jQuery,
  33. // Map over the $ in case of overwrite
  34. _$ = window.$,
  35. // [[Class]] -> type pairs
  36. class2type = {},
  37. // List of deleted data cache ids, so we can reuse them
  38. core_deletedIds = [],
  39. core_version = "1.9.1",
  40. // Save a reference to some core methods
  41. core_concat = core_deletedIds.concat,
  42. core_push = core_deletedIds.push,
  43. core_slice = core_deletedIds.slice,
  44. core_indexOf = core_deletedIds.indexOf,
  45. core_toString = class2type.toString,
  46. core_hasOwn = class2type.hasOwnProperty,
  47. core_trim = core_version.trim,
  48. // Define a local copy of jQuery
  49. jQuery = function( selector, context ) {
  50. // The jQuery object is actually just the init constructor 'enhanced'
  51. return new jQuery.fn.init( selector, context, rootjQuery );
  52. },
  53. // Used for matching numbers
  54. core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,
  55. // Used for splitting on whitespace
  56. core_rnotwhite = /\S+/g,
  57. // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)
  58. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
  59. // A simple way to check for HTML strings
  60. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  61. // Strict HTML recognition (#11290: must start with <)
  62. rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,
  63. // Match a standalone tag
  64. rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/,
  65. // JSON RegExp
  66. rvalidchars = /^[\],:{}\s]*$/,
  67. rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
  68. rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,
  69. rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,
  70. // Matches dashed string for camelizing
  71. rmsPrefix = /^-ms-/,
  72. rdashAlpha = /-([\da-z])/gi,
  73. // Used by jQuery.camelCase as callback to replace()
  74. fcamelCase = function( all, letter ) {
  75. return letter.toUpperCase();
  76. },
  77. // The ready event handler
  78. completed = function( event ) {
  79. // readyState === "complete" is good enough for us to call the dom ready in oldIE
  80. if ( document.addEventListener || event.type === "load" || document.readyState === "complete" ) {
  81. detach();
  82. jQuery.ready();
  83. }
  84. },
  85. // Clean-up method for dom ready events
  86. detach = function() {
  87. if ( document.addEventListener ) {
  88. document.removeEventListener( "DOMContentLoaded", completed, false );
  89. window.removeEventListener( "load", completed, false );
  90. } else {
  91. document.detachEvent( "onreadystatechange", completed );
  92. window.detachEvent( "onload", completed );
  93. }
  94. };
  95. jQuery.fn = jQuery.prototype = {
  96. // The current version of jQuery being used
  97. jquery: core_version,
  98. constructor: jQuery,
  99. init: function( selector, context, rootjQuery ) {
  100. var match, elem;
  101. // HANDLE: $(""), $(null), $(undefined), $(false)
  102. if ( !selector ) {
  103. return this;
  104. }
  105. // Handle HTML strings
  106. if ( typeof selector === "string" ) {
  107. if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
  108. // Assume that strings that start and end with <> are HTML and skip the regex check
  109. match = [ null, selector, null ];
  110. } else {
  111. match = rquickExpr.exec( selector );
  112. }
  113. // Match html or make sure no context is specified for #id
  114. if ( match && (match[1] || !context) ) {
  115. // HANDLE: $(html) -> $(array)
  116. if ( match[1] ) {
  117. context = context instanceof jQuery ? context[0] : context;
  118. // scripts is true for back-compat
  119. jQuery.merge( this, jQuery.parseHTML(
  120. match[1],
  121. context && context.nodeType ? context.ownerDocument || context : document,
  122. true
  123. ) );
  124. // HANDLE: $(html, props)
  125. if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {
  126. for ( match in context ) {
  127. // Properties of context are called as methods if possible
  128. if ( jQuery.isFunction( this[ match ] ) ) {
  129. this[ match ]( context[ match ] );
  130. // ...and otherwise set as attributes
  131. } else {
  132. this.attr( match, context[ match ] );
  133. }
  134. }
  135. }
  136. return this;
  137. // HANDLE: $(#id)
  138. } else {
  139. elem = document.getElementById( match[2] );
  140. // Check parentNode to catch when Blackberry 4.6 returns
  141. // nodes that are no longer in the document #6963
  142. if ( elem && elem.parentNode ) {
  143. // Handle the case where IE and Opera return items
  144. // by name instead of ID
  145. if ( elem.id !== match[2] ) {
  146. return rootjQuery.find( selector );
  147. }
  148. // Otherwise, we inject the element directly into the jQuery object
  149. this.length = 1;
  150. this[0] = elem;
  151. }
  152. this.context = document;
  153. this.selector = selector;
  154. return this;
  155. }
  156. // HANDLE: $(expr, $(...))
  157. } else if ( !context || context.jquery ) {
  158. return ( context || rootjQuery ).find( selector );
  159. // HANDLE: $(expr, context)
  160. // (which is just equivalent to: $(context).find(expr)
  161. } else {
  162. return this.constructor( context ).find( selector );
  163. }
  164. // HANDLE: $(DOMElement)
  165. } else if ( selector.nodeType ) {
  166. this.context = this[0] = selector;
  167. this.length = 1;
  168. return this;
  169. // HANDLE: $(function)
  170. // Shortcut for document ready
  171. } else if ( jQuery.isFunction( selector ) ) {
  172. return rootjQuery.ready( selector );
  173. }
  174. if ( selector.selector !== undefined ) {
  175. this.selector = selector.selector;
  176. this.context = selector.context;
  177. }
  178. return jQuery.makeArray( selector, this );
  179. },
  180. // Start with an empty selector
  181. selector: "",
  182. // The default length of a jQuery object is 0
  183. length: 0,
  184. // The number of elements contained in the matched element set
  185. size: function() {
  186. return this.length;
  187. },
  188. toArray: function() {
  189. return core_slice.call( this );
  190. },
  191. // Get the Nth element in the matched element set OR
  192. // Get the whole matched element set as a clean array
  193. get: function( num ) {
  194. return num == null ?
  195. // Return a 'clean' array
  196. this.toArray() :
  197. // Return just the object
  198. ( num < 0 ? this[ this.length + num ] : this[ num ] );
  199. },
  200. // Take an array of elements and push it onto the stack
  201. // (returning the new matched element set)
  202. pushStack: function( elems ) {
  203. // Build a new jQuery matched element set
  204. var ret = jQuery.merge( this.constructor(), elems );
  205. // Add the old object onto the stack (as a reference)
  206. ret.prevObject = this;
  207. ret.context = this.context;
  208. // Return the newly-formed element set
  209. return ret;
  210. },
  211. // Execute a callback for every element in the matched set.
  212. // (You can seed the arguments with an array of args, but this is
  213. // only used internally.)
  214. each: function( callback, args ) {
  215. return jQuery.each( this, callback, args );
  216. },
  217. ready: function( fn ) {
  218. // Add the callback
  219. jQuery.ready.promise().done( fn );
  220. return this;
  221. },
  222. slice: function() {
  223. return this.pushStack( core_slice.apply( this, arguments ) );
  224. },
  225. first: function() {
  226. return this.eq( 0 );
  227. },
  228. last: function() {
  229. return this.eq( -1 );
  230. },
  231. eq: function( i ) {
  232. var len = this.length,
  233. j = +i + ( i < 0 ? len : 0 );
  234. return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] );
  235. },
  236. map: function( callback ) {
  237. return this.pushStack( jQuery.map(this, function( elem, i ) {
  238. return callback.call( elem, i, elem );
  239. }));
  240. },
  241. end: function() {
  242. return this.prevObject || this.constructor(null);
  243. },
  244. // For internal use only.
  245. // Behaves like an Array's method, not like a jQuery method.
  246. push: core_push,
  247. sort: [].sort,
  248. splice: [].splice
  249. };
  250. // Give the init function the jQuery prototype for later instantiation
  251. jQuery.fn.init.prototype = jQuery.fn;
  252. jQuery.extend = jQuery.fn.extend = function() {
  253. var src, copyIsArray, copy, name, options, clone,
  254. target = arguments[0] || {},
  255. i = 1,
  256. length = arguments.length,
  257. deep = false;
  258. // Handle a deep copy situation
  259. if ( typeof target === "boolean" ) {
  260. deep = target;
  261. target = arguments[1] || {};
  262. // skip the boolean and the target
  263. i = 2;
  264. }
  265. // Handle case when target is a string or something (possible in deep copy)
  266. if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
  267. target = {};
  268. }
  269. // extend jQuery itself if only one argument is passed
  270. if ( length === i ) {
  271. target = this;
  272. --i;
  273. }
  274. for ( ; i < length; i++ ) {
  275. // Only deal with non-null/undefined values
  276. if ( (options = arguments[ i ]) != null ) {
  277. // Extend the base object
  278. for ( name in options ) {
  279. src = target[ name ];
  280. copy = options[ name ];
  281. // Prevent never-ending loop
  282. if ( target === copy ) {
  283. continue;
  284. }
  285. // Recurse if we're merging plain objects or arrays
  286. if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
  287. if ( copyIsArray ) {
  288. copyIsArray = false;
  289. clone = src && jQuery.isArray(src) ? src : [];
  290. } else {
  291. clone = src && jQuery.isPlainObject(src) ? src : {};
  292. }
  293. // Never move original objects, clone them
  294. target[ name ] = jQuery.extend( deep, clone, copy );
  295. // Don't bring in undefined values
  296. } else if ( copy !== undefined ) {
  297. target[ name ] = copy;
  298. }
  299. }
  300. }
  301. }
  302. // Return the modified object
  303. return target;
  304. };
  305. jQuery.extend({
  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. return obj != null && obj == obj.window;
  362. },
  363. isNumeric: function( obj ) {
  364. return !isNaN( parseFloat(obj) ) && isFinite( obj );
  365. },
  366. type: function( obj ) {
  367. if ( obj == null ) {
  368. return String( obj );
  369. }
  370. return typeof obj === "object" || typeof obj === "function" ?
  371. class2type[ core_toString.call(obj) ] || "object" :
  372. typeof obj;
  373. },
  374. isPlainObject: function( obj ) {
  375. // Must be an Object.
  376. // Because of IE, we also have to check the presence of the constructor property.
  377. // Make sure that DOM nodes and window objects don't pass through, as well
  378. if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
  379. return false;
  380. }
  381. try {
  382. // Not own constructor property must be Object
  383. if ( obj.constructor &&
  384. !core_hasOwn.call(obj, "constructor") &&
  385. !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
  386. return false;
  387. }
  388. } catch ( e ) {
  389. // IE8,9 Will throw exceptions on certain host objects #9897
  390. return false;
  391. }
  392. // Own properties are enumerated firstly, so to speed up,
  393. // if last one is own, then all properties are own.
  394. var key;
  395. for ( key in obj ) {}
  396. return key === undefined || core_hasOwn.call( obj, key );
  397. },
  398. isEmptyObject: function( obj ) {
  399. var name;
  400. for ( name in obj ) {
  401. return false;
  402. }
  403. return true;
  404. },
  405. error: function( msg ) {
  406. throw new Error( msg );
  407. },
  408. // data: string of html
  409. // context (optional): If specified, the fragment will be created in this context, defaults to document
  410. // keepScripts (optional): If true, will include scripts passed in the html string
  411. parseHTML: function( data, context, keepScripts ) {
  412. if ( !data || typeof data !== "string" ) {
  413. return null;
  414. }
  415. if ( typeof context === "boolean" ) {
  416. keepScripts = context;
  417. context = false;
  418. }
  419. context = context || document;
  420. var parsed = rsingleTag.exec( data ),
  421. scripts = !keepScripts && [];
  422. // Single tag
  423. if ( parsed ) {
  424. return [ context.createElement( parsed[1] ) ];
  425. }
  426. parsed = jQuery.buildFragment( [ data ], context, scripts );
  427. if ( scripts ) {
  428. jQuery( scripts ).remove();
  429. }
  430. return jQuery.merge( [], parsed.childNodes );
  431. },
  432. parseJSON: function( data ) {
  433. // Attempt to parse using the native JSON parser first
  434. if ( window.JSON && window.JSON.parse ) {
  435. return window.JSON.parse( data );
  436. }
  437. if ( data === null ) {
  438. return data;
  439. }
  440. if ( typeof data === "string" ) {
  441. // Make sure leading/trailing whitespace is removed (IE can't handle it)
  442. data = jQuery.trim( data );
  443. if ( data ) {
  444. // Make sure the incoming data is actual JSON
  445. // Logic borrowed from http://json.org/json2.js
  446. if ( rvalidchars.test( data.replace( rvalidescape, "@" )
  447. .replace( rvalidtokens, "]" )
  448. .replace( rvalidbraces, "")) ) {
  449. return ( new Function( "return " + data ) )();
  450. }
  451. }
  452. }
  453. jQuery.error( "Invalid JSON: " + data );
  454. },
  455. // Cross-browser xml parsing
  456. parseXML: function( data ) {
  457. var xml, tmp;
  458. if ( !data || typeof data !== "string" ) {
  459. return null;
  460. }
  461. try {
  462. if ( window.DOMParser ) { // Standard
  463. tmp = new DOMParser();
  464. xml = tmp.parseFromString( data , "text/xml" );
  465. } else { // IE
  466. xml = new ActiveXObject( "Microsoft.XMLDOM" );
  467. xml.async = "false";
  468. xml.loadXML( data );
  469. }
  470. } catch( e ) {
  471. xml = undefined;
  472. }
  473. if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
  474. jQuery.error( "Invalid XML: " + data );
  475. }
  476. return xml;
  477. },
  478. noop: function() {},
  479. // Evaluates a script in a global context
  480. // Workarounds based on findings by Jim Driscoll
  481. // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
  482. globalEval: function( data ) {
  483. if ( data && jQuery.trim( data ) ) {
  484. // We use execScript on Internet Explorer
  485. // We use an anonymous function so that context is window
  486. // rather than jQuery in Firefox
  487. ( window.execScript || function( data ) {
  488. window[ "eval" ].call( window, data );
  489. } )( data );
  490. }
  491. },
  492. // Convert dashed to camelCase; used by the css and data modules
  493. // Microsoft forgot to hump their vendor prefix (#9572)
  494. camelCase: function( string ) {
  495. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  496. },
  497. nodeName: function( elem, name ) {
  498. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  499. },
  500. // args is for internal usage only
  501. each: function( obj, callback, args ) {
  502. var value,
  503. i = 0,
  504. length = obj.length,
  505. isArray = isArraylike( obj );
  506. if ( args ) {
  507. if ( isArray ) {
  508. for ( ; i < length; i++ ) {
  509. value = callback.apply( obj[ i ], args );
  510. if ( value === false ) {
  511. break;
  512. }
  513. }
  514. } else {
  515. for ( i in obj ) {
  516. value = callback.apply( obj[ i ], args );
  517. if ( value === false ) {
  518. break;
  519. }
  520. }
  521. }
  522. // A special, fast, case for the most common use of each
  523. } else {
  524. if ( isArray ) {
  525. for ( ; i < length; i++ ) {
  526. value = callback.call( obj[ i ], i, obj[ i ] );
  527. if ( value === false ) {
  528. break;
  529. }
  530. }
  531. } else {
  532. for ( i in obj ) {
  533. value = callback.call( obj[ i ], i, obj[ i ] );
  534. if ( value === false ) {
  535. break;
  536. }
  537. }
  538. }
  539. }
  540. return obj;
  541. },
  542. // Use native String.trim function wherever possible
  543. trim: core_trim && !core_trim.call("\uFEFF\xA0") ?
  544. function( text ) {
  545. return text == null ?
  546. "" :
  547. core_trim.call( text );
  548. } :
  549. // Otherwise use our own trimming functionality
  550. function( text ) {
  551. return text == null ?
  552. "" :
  553. ( text + "" ).replace( rtrim, "" );
  554. },
  555. // results is for internal usage only
  556. makeArray: function( arr, results ) {
  557. var ret = results || [];
  558. if ( arr != null ) {
  559. if ( isArraylike( Object(arr) ) ) {
  560. jQuery.merge( ret,
  561. typeof arr === "string" ?
  562. [ arr ] : arr
  563. );
  564. } else {
  565. core_push.call( ret, arr );
  566. }
  567. }
  568. return ret;
  569. },
  570. inArray: function( elem, arr, i ) {
  571. var len;
  572. if ( arr ) {
  573. if ( core_indexOf ) {
  574. return core_indexOf.call( arr, elem, i );
  575. }
  576. len = arr.length;
  577. i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
  578. for ( ; i < len; i++ ) {
  579. // Skip accessing in sparse arrays
  580. if ( i in arr && arr[ i ] === elem ) {
  581. return i;
  582. }
  583. }
  584. }
  585. return -1;
  586. },
  587. merge: function( first, second ) {
  588. var l = second.length,
  589. i = first.length,
  590. j = 0;
  591. if ( typeof l === "number" ) {
  592. for ( ; j < l; j++ ) {
  593. first[ i++ ] = second[ j ];
  594. }
  595. } else {
  596. while ( second[j] !== undefined ) {
  597. first[ i++ ] = second[ j++ ];
  598. }
  599. }
  600. first.length = i;
  601. return first;
  602. },
  603. grep: function( elems, callback, inv ) {
  604. var retVal,
  605. ret = [],
  606. i = 0,
  607. length = elems.length;
  608. inv = !!inv;
  609. // Go through the array, only saving the items
  610. // that pass the validator function
  611. for ( ; i < length; i++ ) {
  612. retVal = !!callback( elems[ i ], i );
  613. if ( inv !== retVal ) {
  614. ret.push( elems[ i ] );
  615. }
  616. }
  617. return ret;
  618. },
  619. // arg is for internal usage only
  620. map: function( elems, callback, arg ) {
  621. var value,
  622. i = 0,
  623. length = elems.length,
  624. isArray = isArraylike( elems ),
  625. ret = [];
  626. // Go through the array, translating each of the items to their
  627. if ( isArray ) {
  628. for ( ; i < length; i++ ) {
  629. value = callback( elems[ i ], i, arg );
  630. if ( value != null ) {
  631. ret[ ret.length ] = value;
  632. }
  633. }
  634. // Go through every key on the object,
  635. } else {
  636. for ( i in elems ) {
  637. value = callback( elems[ i ], i, arg );
  638. if ( value != null ) {
  639. ret[ ret.length ] = value;
  640. }
  641. }
  642. }
  643. // Flatten any nested arrays
  644. return core_concat.apply( [], ret );
  645. },
  646. // A global GUID counter for objects
  647. guid: 1,
  648. // Bind a function to a context, optionally partially applying any
  649. // arguments.
  650. proxy: function( fn, context ) {
  651. var args, proxy, tmp;
  652. if ( typeof context === "string" ) {
  653. tmp = fn[ context ];
  654. context = fn;
  655. fn = tmp;
  656. }
  657. // Quick check to determine if target is callable, in the spec
  658. // this throws a TypeError, but we will just return undefined.
  659. if ( !jQuery.isFunction( fn ) ) {
  660. return undefined;
  661. }
  662. // Simulated bind
  663. args = core_slice.call( arguments, 2 );
  664. proxy = function() {
  665. return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) );
  666. };
  667. // Set the guid of unique handler to the same of original handler, so it can be removed
  668. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  669. return proxy;
  670. },
  671. // Multifunctional method to get and set values of a collection
  672. // The value/s can optionally be executed if it's a function
  673. access: function( elems, fn, key, value, chainable, emptyGet, raw ) {
  674. var i = 0,
  675. length = elems.length,
  676. bulk = key == null;
  677. // Sets many values
  678. if ( jQuery.type( key ) === "object" ) {
  679. chainable = true;
  680. for ( i in key ) {
  681. jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
  682. }
  683. // Sets one value
  684. } else if ( value !== undefined ) {
  685. chainable = true;
  686. if ( !jQuery.isFunction( value ) ) {
  687. raw = true;
  688. }
  689. if ( bulk ) {
  690. // Bulk operations run against the entire set
  691. if ( raw ) {
  692. fn.call( elems, value );
  693. fn = null;
  694. // ...except when executing function values
  695. } else {
  696. bulk = fn;
  697. fn = function( elem, key, value ) {
  698. return bulk.call( jQuery( elem ), value );
  699. };
  700. }
  701. }
  702. if ( fn ) {
  703. for ( ; i < length; i++ ) {
  704. fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) );
  705. }
  706. }
  707. }
  708. return chainable ?
  709. elems :
  710. // Gets
  711. bulk ?
  712. fn.call( elems ) :
  713. length ? fn( elems[0], key ) : emptyGet;
  714. },
  715. now: function() {
  716. return ( new Date() ).getTime();
  717. }
  718. });
  719. jQuery.ready.promise = function( obj ) {
  720. if ( !readyList ) {
  721. readyList = jQuery.Deferred();
  722. // Catch cases where $(document).ready() is called after the browser event has already occurred.
  723. // we once tried to use readyState "interactive" here, but it caused issues like the one
  724. // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15
  725. if ( document.readyState === "complete" ) {
  726. // Handle it asynchronously to allow scripts the opportunity to delay ready
  727. setTimeout( jQuery.ready );
  728. // Standards-based browsers support DOMContentLoaded
  729. } else if ( document.addEventListener ) {
  730. // Use the handy event callback
  731. document.addEventListener( "DOMContentLoaded", completed, false );
  732. // A fallback to window.onload, that will always work
  733. window.addEventListener( "load", completed, false );
  734. // If IE event model is used
  735. } else {
  736. // Ensure firing before onload, maybe late but safe also for iframes
  737. document.attachEvent( "onreadystatechange", completed );
  738. // A fallback to window.onload, that will always work
  739. window.attachEvent( "onload", completed );
  740. // If IE and not a frame
  741. // continually check to see if the document is ready
  742. var top = false;
  743. try {
  744. top = window.frameElement == null && document.documentElement;
  745. } catch(e) {}
  746. if ( top && top.doScroll ) {
  747. (function doScrollCheck() {
  748. if ( !jQuery.isReady ) {
  749. try {
  750. // Use the trick by Diego Perini
  751. // http://javascript.nwbox.com/IEContentLoaded/
  752. top.doScroll("left");
  753. } catch(e) {
  754. return setTimeout( doScrollCheck, 50 );
  755. }
  756. // detach all dom ready events
  757. detach();
  758. // and execute any waiting functions
  759. jQuery.ready();
  760. }
  761. })();
  762. }
  763. }
  764. }
  765. return readyList.promise( obj );
  766. };
  767. // Populate the class2type map
  768. jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) {
  769. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  770. });
  771. function isArraylike( obj ) {
  772. var length = obj.length,
  773. type = jQuery.type( obj );
  774. if ( jQuery.isWindow( obj ) ) {
  775. return false;
  776. }
  777. if ( obj.nodeType === 1 && length ) {
  778. return true;
  779. }
  780. return type === "array" || type !== "function" &&
  781. ( length === 0 ||
  782. typeof length === "number" && length > 0 && ( length - 1 ) in obj );
  783. }
  784. // All jQuery objects should point back to these
  785. rootjQuery = jQuery(document);
  786. // String to Object options format cache
  787. var optionsCache = {};
  788. // Convert String-formatted options into Object-formatted ones and store in cache
  789. function createOptions( options ) {
  790. var object = optionsCache[ options ] = {};
  791. jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) {
  792. object[ flag ] = true;
  793. });
  794. return object;
  795. }
  796. /*
  797. * Create a callback list using the following parameters:
  798. *
  799. * options: an optional list of space-separated options that will change how
  800. * the callback list behaves or a more traditional option object
  801. *
  802. * By default a callback list will act like an event callback list and can be
  803. * "fired" multiple times.
  804. *
  805. * Possible options:
  806. *
  807. * once: will ensure the callback list can only be fired once (like a Deferred)
  808. *
  809. * memory: will keep track of previous values and will call any callback added
  810. * after the list has been fired right away with the latest "memorized"
  811. * values (like a Deferred)
  812. *
  813. * unique: will ensure a callback can only be added once (no duplicate in the list)
  814. *
  815. * stopOnFalse: interrupt callings when a callback returns false
  816. *
  817. */
  818. jQuery.Callbacks = function( options ) {
  819. // Convert options from String-formatted to Object-formatted if needed
  820. // (we check in cache first)
  821. options = typeof options === "string" ?
  822. ( optionsCache[ options ] || createOptions( options ) ) :
  823. jQuery.extend( {}, options );
  824. var // Flag to know if list is currently firing
  825. firing,
  826. // Last fire value (for non-forgettable lists)
  827. memory,
  828. // Flag to know if list was already fired
  829. fired,
  830. // End of the loop when firing
  831. firingLength,
  832. // Index of currently firing callback (modified by remove if needed)
  833. firingIndex,
  834. // First callback to fire (used internally by add and fireWith)
  835. firingStart,
  836. // Actual callback list
  837. list = [],
  838. // Stack of fire calls for repeatable lists
  839. stack = !options.once && [],
  840. // Fire callbacks
  841. fire = function( data ) {
  842. memory = options.memory && data;
  843. fired = true;
  844. firingIndex = firingStart || 0;
  845. firingStart = 0;
  846. firingLength = list.length;
  847. firing = true;
  848. for ( ; list && firingIndex < firingLength; firingIndex++ ) {
  849. if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {
  850. memory = false; // To prevent further calls using add
  851. break;
  852. }
  853. }
  854. firing = false;
  855. if ( list ) {
  856. if ( stack ) {
  857. if ( stack.length ) {
  858. fire( stack.shift() );
  859. }
  860. } else if ( memory ) {
  861. list = [];
  862. } else {
  863. self.disable();
  864. }
  865. }
  866. },
  867. // Actual Callbacks object
  868. self = {
  869. // Add a callback or a collection of callbacks to the list
  870. add: function() {
  871. if ( list ) {
  872. // First, we save the current length
  873. var start = list.length;
  874. (function add( args ) {
  875. jQuery.each( args, function( _, arg ) {
  876. var type = jQuery.type( arg );
  877. if ( type === "function" ) {
  878. if ( !options.unique || !self.has( arg ) ) {
  879. list.push( arg );
  880. }
  881. } else if ( arg && arg.length && type !== "string" ) {
  882. // Inspect recursively
  883. add( arg );
  884. }
  885. });
  886. })( arguments );
  887. // Do we need to add the callbacks to the
  888. // current firing batch?
  889. if ( firing ) {
  890. firingLength = list.length;
  891. // With memory, if we're not firing then
  892. // we should call right away
  893. } else if ( memory ) {
  894. firingStart = start;
  895. fire( memory );
  896. }
  897. }
  898. return this;
  899. },
  900. // Remove a callback from the list
  901. remove: function() {
  902. if ( list ) {
  903. jQuery.each( arguments, function( _, arg ) {
  904. var index;
  905. while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  906. list.splice( index, 1 );
  907. // Handle firing indexes
  908. if ( firing ) {
  909. if ( index <= firingLength ) {
  910. firingLength--;
  911. }
  912. if ( index <= firingIndex ) {
  913. firingIndex--;
  914. }
  915. }
  916. }
  917. });
  918. }
  919. return this;
  920. },
  921. // Check if a given callback is in the list.
  922. // If no argument is given, return whether or not list has callbacks attached.
  923. has: function( fn ) {
  924. return fn ? jQuery.inArray( fn, list ) > -1 : !!( list && list.length );
  925. },
  926. // Remove all callbacks from the list
  927. empty: function() {
  928. list = [];
  929. return this;
  930. },
  931. // Have the list do nothing anymore
  932. disable: function() {
  933. list = stack = memory = undefined;
  934. return this;
  935. },
  936. // Is it disabled?
  937. disabled: function() {
  938. return !list;
  939. },
  940. // Lock the list in its current state
  941. lock: function() {
  942. stack = undefined;
  943. if ( !memory ) {
  944. self.disable();
  945. }
  946. return this;
  947. },
  948. // Is it locked?
  949. locked: function() {
  950. return !stack;
  951. },
  952. // Call all callbacks with the given context and arguments
  953. fireWith: function( context, args ) {
  954. args = args || [];
  955. args = [ context, args.slice ? args.slice() : args ];
  956. if ( list && ( !fired || stack ) ) {
  957. if ( firing ) {
  958. stack.push( args );
  959. } else {
  960. fire( args );
  961. }
  962. }
  963. return this;
  964. },
  965. // Call all the callbacks with the given arguments
  966. fire: function() {
  967. self.fireWith( this, arguments );
  968. return this;
  969. },
  970. // To know if the callbacks have already been called at least once
  971. fired: function() {
  972. return !!fired;
  973. }
  974. };
  975. return self;
  976. };
  977. jQuery.extend({
  978. Deferred: function( func ) {
  979. var tuples = [
  980. // action, add listener, listener list, final state
  981. [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ],
  982. [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ],
  983. [ "notify", "progress", jQuery.Callbacks("memory") ]
  984. ],
  985. state = "pending",
  986. promise = {
  987. state: function() {
  988. return state;
  989. },
  990. always: function() {
  991. deferred.done( arguments ).fail( arguments );
  992. return this;
  993. },
  994. then: function( /* fnDone, fnFail, fnProgress */ ) {
  995. var fns = arguments;
  996. return jQuery.Deferred(function( newDefer ) {
  997. jQuery.each( tuples, function( i, tuple ) {
  998. var action = tuple[ 0 ],
  999. fn = jQuery.isFunction( fns[ i ] ) && fns[ i ];
  1000. // deferred[ done | fail | progress ] for forwarding actions to newDefer
  1001. deferred[ tuple[1] ](function() {
  1002. var returned = fn && fn.apply( this, arguments );
  1003. if ( returned && jQuery.isFunction( returned.promise ) ) {
  1004. returned.promise()
  1005. .done( newDefer.resolve )
  1006. .fail( newDefer.reject )
  1007. .progress( newDefer.notify );
  1008. } else {
  1009. newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, fn ? [ returned ] : arguments );
  1010. }
  1011. });
  1012. });
  1013. fns = null;
  1014. }).promise();
  1015. },
  1016. // Get a promise for this deferred
  1017. // If obj is provided, the promise aspect is added to the object
  1018. promise: function( obj ) {
  1019. return obj != null ? jQuery.extend( obj, promise ) : promise;
  1020. }
  1021. },
  1022. deferred = {};
  1023. // Keep pipe for back-compat
  1024. promise.pipe = promise.then;
  1025. // Add list-specific methods
  1026. jQuery.each( tuples, function( i, tuple ) {
  1027. var list = tuple[ 2 ],
  1028. stateString = tuple[ 3 ];
  1029. // promise[ done | fail | progress ] = list.add
  1030. promise[ tuple[1] ] = list.add;
  1031. // Handle state
  1032. if ( stateString ) {
  1033. list.add(function() {
  1034. // state = [ resolved | rejected ]
  1035. state = stateString;
  1036. // [ reject_list | resolve_list ].disable; progress_list.lock
  1037. }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );
  1038. }
  1039. // deferred[ resolve | reject | notify ]
  1040. deferred[ tuple[0] ] = function() {
  1041. deferred[ tuple[0] + "With" ]( this === deferred ? promise : this, arguments );
  1042. return this;
  1043. };
  1044. deferred[ tuple[0] + "With" ] = list.fireWith;
  1045. });
  1046. // Make the deferred a promise
  1047. promise.promise( deferred );
  1048. // Call given func if any
  1049. if ( func ) {
  1050. func.call( deferred, deferred );
  1051. }
  1052. // All done!
  1053. return deferred;
  1054. },
  1055. // Deferred helper
  1056. when: function( subordinate /* , ..., subordinateN */ ) {
  1057. var i = 0,
  1058. resolveValues = core_slice.call( arguments ),
  1059. length = resolveValues.length,
  1060. // the count of uncompleted subordinates
  1061. remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,
  1062. // the master Deferred. If resolveValues consist of only a single Deferred, just use that.
  1063. deferred = remaining === 1 ? subordinate : jQuery.Deferred(),
  1064. // Update function for both resolve and progress values
  1065. updateFunc = function( i, contexts, values ) {
  1066. return function( value ) {
  1067. contexts[ i ] = this;
  1068. values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;
  1069. if( values === progressValues ) {
  1070. deferred.notifyWith( contexts, values );
  1071. } else if ( !( --remaining ) ) {
  1072. deferred.resolveWith( contexts, values );
  1073. }
  1074. };
  1075. },
  1076. progressValues, progressContexts, resolveContexts;
  1077. // add listeners to Deferred subordinates; treat others as resolved
  1078. if ( length > 1 ) {
  1079. progressValues = new Array( length );
  1080. progressContexts = new Array( length );
  1081. resolveContexts = new Array( length );
  1082. for ( ; i < length; i++ ) {
  1083. if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {
  1084. resolveValues[ i ].promise()
  1085. .done( updateFunc( i, resolveContexts, resolveValues ) )
  1086. .fail( deferred.reject )
  1087. .progress( updateFunc( i, progressContexts, progressValues ) );
  1088. } else {
  1089. --remaining;
  1090. }
  1091. }
  1092. }
  1093. // if we're not waiting on anything, resolve the master
  1094. if ( !remaining ) {
  1095. deferred.resolveWith( resolveContexts, resolveValues );
  1096. }
  1097. return deferred.promise();
  1098. }
  1099. });
  1100. jQuery.support = (function() {
  1101. var support, all, a,
  1102. input, select, fragment,
  1103. opt, eventName, isSupported, i,
  1104. div = document.createElement("div");
  1105. // Setup
  1106. div.setAttribute( "className", "t" );
  1107. div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
  1108. // Support tests won't run in some limited or non-browser environments
  1109. all = div.getElementsByTagName("*");
  1110. a = div.getElementsByTagName("a")[ 0 ];
  1111. if ( !all || !a || !all.length ) {
  1112. return {};
  1113. }
  1114. // First batch of tests
  1115. select = document.createElement("select");
  1116. opt = select.appendChild( document.createElement("option") );
  1117. input = div.getElementsByTagName("input")[ 0 ];
  1118. a.style.cssText = "top:1px;float:left;opacity:.5";
  1119. support = {
  1120. // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
  1121. getSetAttribute: div.className !== "t",
  1122. // IE strips leading whitespace when .innerHTML is used
  1123. leadingWhitespace: div.firstChild.nodeType === 3,
  1124. // Make sure that tbody elements aren't automatically inserted
  1125. // IE will insert them into empty tables
  1126. tbody: !div.getElementsByTagName("tbody").length,
  1127. // Make sure that link elements get serialized correctly by innerHTML
  1128. // This requires a wrapper element in IE
  1129. htmlSerialize: !!div.getElementsByTagName("link").length,
  1130. // Get the style information from getAttribute
  1131. // (IE uses .cssText instead)
  1132. style: /top/.test( a.getAttribute("style") ),
  1133. // Make sure that URLs aren't manipulated
  1134. // (IE normalizes it by default)
  1135. hrefNormalized: a.getAttribute("href") === "/a",
  1136. // Make sure that element opacity exists
  1137. // (IE uses filter instead)
  1138. // Use a regex to work around a WebKit issue. See #5145
  1139. opacity: /^0.5/.test( a.style.opacity ),
  1140. // Verify style float existence
  1141. // (IE uses styleFloat instead of cssFloat)
  1142. cssFloat: !!a.style.cssFloat,
  1143. // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere)
  1144. checkOn: !!input.value,
  1145. // Make sure that a selected-by-default option has a working selected property.
  1146. // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
  1147. optSelected: opt.selected,
  1148. // Tests for enctype support on a form (#6743)
  1149. enctype: !!document.createElement("form").enctype,
  1150. // Makes sure cloning an html5 element does not cause problems
  1151. // Where outerHTML is undefined, this still works
  1152. html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
  1153. // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode
  1154. boxModel: document.compatMode === "CSS1Compat",
  1155. // Will be defined later
  1156. deleteExpando: true,
  1157. noCloneEvent: true,
  1158. inlineBlockNeedsLayout: false,
  1159. shrinkWrapBlocks: false,
  1160. reliableMarginRight: true,
  1161. boxSizingReliable: true,
  1162. pixelPosition: false
  1163. };
  1164. // Make sure checked status is properly cloned
  1165. input.checked = true;
  1166. support.noCloneChecked = input.cloneNode( true ).checked;
  1167. // Make sure that the options inside disabled selects aren't marked as disabled
  1168. // (WebKit marks them as disabled)
  1169. select.disabled = true;
  1170. support.optDisabled = !opt.disabled;
  1171. // Support: IE<9
  1172. try {
  1173. delete div.test;
  1174. } catch( e ) {
  1175. support.deleteExpando = false;
  1176. }
  1177. // Check if we can trust getAttribute("value")
  1178. input = document.createElement("input");
  1179. input.setAttribute( "value", "" );
  1180. support.input = input.getAttribute( "value" ) === "";
  1181. // Check if an input maintains its value after becoming a radio
  1182. input.value = "t";
  1183. input.setAttribute( "type", "radio" );
  1184. support.radioValue = input.value === "t";
  1185. // #11217 - WebKit loses check when the name is after the checked attribute
  1186. input.setAttribute( "checked", "t" );
  1187. input.setAttribute( "name", "t" );
  1188. fragment = document.createDocumentFragment();
  1189. fragment.appendChild( input );
  1190. // Check if a disconnected checkbox will retain its checked
  1191. // value of true after appended to the DOM (IE6/7)
  1192. support.appendChecked = input.checked;
  1193. // WebKit doesn't clone checked state correctly in fragments
  1194. support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
  1195. // Support: IE<9
  1196. // Opera does not clone events (and typeof div.attachEvent === undefined).
  1197. // IE9-10 clones events bound via attachEvent, but they don't trigger with .click()
  1198. if ( div.attachEvent ) {
  1199. div.attachEvent( "onclick", function() {
  1200. support.noCloneEvent = false;
  1201. });
  1202. div.cloneNode( true ).click();
  1203. }
  1204. // Support: IE<9 (lack submit/change bubble), Firefox 17+ (lack focusin event)
  1205. // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP), test/csp.php
  1206. for ( i in { submit: true, change: true, focusin: true }) {
  1207. div.setAttribute( eventName = "on" + i, "t" );
  1208. support[ i + "Bubbles" ] = eventName in window || div.attributes[ eventName ].expando === false;
  1209. }
  1210. div.style.backgroundClip = "content-box";
  1211. div.cloneNode( true ).style.backgroundClip = "";
  1212. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  1213. // Run tests that need a body at doc ready
  1214. jQuery(function() {
  1215. var container, marginDiv, tds,
  1216. divReset = "padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",
  1217. body = document.getElementsByTagName("body")[0];
  1218. if ( !body ) {
  1219. // Return for frameset docs that don't have a body
  1220. return;
  1221. }
  1222. container = document.createElement("div");
  1223. container.style.cssText = "border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px";
  1224. body.appendChild( container ).appendChild( div );
  1225. // Support: IE8
  1226. // Check if table cells still have offsetWidth/Height when they are set
  1227. // to display:none and there are still other visible table cells in a
  1228. // table row; if so, offsetWidth/Height are not reliable for use when
  1229. // determining if an element has been hidden directly using
  1230. // display:none (it is still safe to use offsets if a parent element is
  1231. // hidden; don safety goggles and see bug #4512 for more information).
  1232. div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>";
  1233. tds = div.getElementsByTagName("td");
  1234. tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none";
  1235. isSupported = ( tds[ 0 ].offsetHeight === 0 );
  1236. tds[ 0 ].style.display = "";
  1237. tds[ 1 ].style.display = "none";
  1238. // Support: IE8
  1239. // Check if empty table cells still have offsetWidth/Height
  1240. support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
  1241. // Check box-sizing and margin behavior
  1242. div.innerHTML = "";
  1243. 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%;";
  1244. support.boxSizing = ( div.offsetWidth === 4 );
  1245. support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );
  1246. // Use window.getComputedStyle because jsdom on node.js will break without it.
  1247. if ( window.getComputedStyle ) {
  1248. support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%";
  1249. support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px";
  1250. // Check if div with explicit width and no margin-right incorrectly
  1251. // gets computed margin-right based on width of container. (#3333)
  1252. // Fails in WebKit before Feb 2011 nightlies
  1253. // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
  1254. marginDiv = div.appendChild( document.createElement("div") );
  1255. marginDiv.style.cssText = div.style.cssText = divReset;
  1256. marginDiv.style.marginRight = marginDiv.style.width = "0";
  1257. div.style.width = "1px";
  1258. support.reliableMarginRight =
  1259. !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );
  1260. }
  1261. if ( typeof div.style.zoom !== core_strundefined ) {
  1262. // Support: IE<8
  1263. // Check if natively block-level elements act like inline-block
  1264. // elements when setting their display to 'inline' and giving
  1265. // them layout
  1266. div.innerHTML = "";
  1267. div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1";
  1268. support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );
  1269. // Support: IE6
  1270. // Check if elements with layout shrink-wrap their children
  1271. div.style.display = "block";
  1272. div.innerHTML = "<div></div>";
  1273. div.firstChild.style.width = "5px";
  1274. support.shrinkWrapBlocks = ( div.offsetWidth !== 3 );
  1275. if ( support.inlineBlockNeedsLayout ) {
  1276. // Prevent IE 6 from affecting layout for positioned elements #11048
  1277. // Prevent IE from shrinking the body in IE 7 mode #12869
  1278. // Support: IE<8
  1279. body.style.zoom = 1;
  1280. }
  1281. }
  1282. body.removeChild( container );
  1283. // Null elements to avoid leaks in IE
  1284. container = div = tds = marginDiv = null;
  1285. });
  1286. // Null elements to avoid leaks in IE
  1287. all = select = fragment = opt = a = input = null;
  1288. return support;
  1289. })();
  1290. var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/,
  1291. rmultiDash = /([A-Z])/g;
  1292. function internalData( elem, name, data, pvt /* Internal Use Only */ ){
  1293. if ( !jQuery.acceptData( elem ) ) {
  1294. return;
  1295. }
  1296. var thisCache, ret,
  1297. internalKey = jQuery.expando,
  1298. getByName = typeof name === "string",
  1299. // We have to handle DOM nodes and JS objects differently because IE6-7
  1300. // can't GC object references properly across the DOM-JS boundary
  1301. isNode = elem.nodeType,
  1302. // Only DOM nodes need the global jQuery cache; JS object data is
  1303. // attached directly to the object so GC can occur automatically
  1304. cache = isNode ? jQuery.cache : elem,
  1305. // Only defining an ID for JS objects if its cache already exists allows
  1306. // the code to shortcut on the same path as a DOM node with no cache
  1307. id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;
  1308. // Avoid doing any more work than we need to when trying to get data on an
  1309. // object that has no data at all
  1310. if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {
  1311. return;
  1312. }
  1313. if ( !id ) {
  1314. // Only DOM nodes need a new unique ID for each element since their data
  1315. // ends up in the global cache
  1316. if ( isNode ) {
  1317. elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++;
  1318. } else {
  1319. id = internalKey;
  1320. }
  1321. }
  1322. if ( !cache[ id ] ) {
  1323. cache[ id ] = {};
  1324. // Avoids exposing jQuery metadata on plain JS objects when the object
  1325. // is serialized using JSON.stringify
  1326. if ( !isNode ) {
  1327. cache[ id ].toJSON = jQuery.noop;
  1328. }
  1329. }
  1330. // An object can be passed to jQuery.data instead of a key/value pair; this gets
  1331. // shallow copied over onto the existing cache
  1332. if ( typeof name === "object" || typeof name === "function" ) {
  1333. if ( pvt ) {
  1334. cache[ id ] = jQuery.extend( cache[ id ], name );
  1335. } else {
  1336. cache[ id ].data = jQuery.extend( cache[ id ].data, name );
  1337. }
  1338. }
  1339. thisCache = cache[ id ];
  1340. // jQuery data() is stored in a separate object inside the object's internal data
  1341. // cache in order to avoid key collisions between internal data and user-defined
  1342. // data.
  1343. if ( !pvt ) {
  1344. if ( !thisCache.data ) {
  1345. thisCache.data = {};
  1346. }
  1347. thisCache = thisCache.data;
  1348. }
  1349. if ( data !== undefined ) {
  1350. thisCache[ jQuery.camelCase( name ) ] = data;
  1351. }
  1352. // Check for both converted-to-camel and non-converted data property names
  1353. // If a data property was specified
  1354. if ( getByName ) {
  1355. // First Try to find as-is property data
  1356. ret = thisCache[ name ];
  1357. // Test for null|undefined property data
  1358. if ( ret == null ) {
  1359. // Try to find the camelCased property
  1360. ret = thisCache[ jQuery.camelCase( name ) ];
  1361. }
  1362. } else {
  1363. ret = thisCache;
  1364. }
  1365. return ret;
  1366. }
  1367. function internalRemoveData( elem, name, pvt ) {
  1368. if ( !jQuery.acceptData( elem ) ) {
  1369. return;
  1370. }
  1371. var i, l, thisCache,
  1372. isNode = elem.nodeType,
  1373. // See jQuery.data for more information
  1374. cache = isNode ? jQuery.cache : elem,
  1375. id = isNode ? elem[ jQuery.expando ] : jQuery.expando;
  1376. // If there is already no cache entry for this object, there is no
  1377. // purpose in continuing
  1378. if ( !cache[ id ] ) {
  1379. return;
  1380. }
  1381. if ( name ) {
  1382. thisCache = pvt ? cache[ id ] : cache[ id ].data;
  1383. if ( thisCache ) {
  1384. // Support array or space separated string names for data keys
  1385. if ( !jQuery.isArray( name ) ) {
  1386. // try the string as a key before any manipulation
  1387. if ( name in thisCache ) {
  1388. name = [ name ];
  1389. } else {
  1390. // split the camel cased version by spaces unless a key with the spaces exists
  1391. name = jQuery.camelCase( name );
  1392. if ( name in thisCache ) {
  1393. name = [ name ];
  1394. } else {
  1395. name = name.split(" ");
  1396. }
  1397. }
  1398. } else {
  1399. // If "name" is an array of keys...
  1400. // When data is initially created, via ("key", "val") signature,
  1401. // keys will be converted to camelCase.
  1402. // Since there is no way to tell _how_ a key was added, remove
  1403. // both plain key and camelCase key. #12786
  1404. // This will only penalize the array argument path.
  1405. name = name.concat( jQuery.map( name, jQuery.camelCase ) );
  1406. }
  1407. for ( i = 0, l = name.length; i < l; i++ ) {
  1408. delete thisCache[ name[i] ];
  1409. }
  1410. // If there is no data left in the cache, we want to continue
  1411. // and let the cache object itself get destroyed
  1412. if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
  1413. return;
  1414. }
  1415. }
  1416. }
  1417. // See jQuery.data for more information
  1418. if ( !pvt ) {
  1419. delete cache[ id ].data;
  1420. // Don't destroy the parent cache unless the internal data object
  1421. // had been the only thing left in it
  1422. if ( !isEmptyDataObject( cache[ id ] ) ) {
  1423. return;
  1424. }
  1425. }
  1426. // Destroy the cache
  1427. if ( isNode ) {
  1428. jQuery.cleanData( [ elem ], true );
  1429. // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)
  1430. } else if ( jQuery.support.deleteExpando || cache != cache.window ) {
  1431. delete cache[ id ];
  1432. // When all else fails, null
  1433. } else {
  1434. cache[ id ] = null;
  1435. }
  1436. }
  1437. jQuery.extend({
  1438. cache: {},
  1439. // Unique for each copy of jQuery on the page
  1440. // Non-digits removed to match rinlinejQuery
  1441. expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ),
  1442. // The following elements throw uncatchable exceptions if you
  1443. // attempt to add expando properties to them.
  1444. noData: {
  1445. "embed": true,
  1446. // Ban all objects except for Flash (which handle expandos)
  1447. "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
  1448. "applet": true
  1449. },
  1450. hasData: function( elem ) {
  1451. elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
  1452. return !!elem && !isEmptyDataObject( elem );
  1453. },
  1454. data: function( elem, name, data ) {
  1455. return internalData( elem, name, data );
  1456. },
  1457. removeData: function( elem, name ) {
  1458. return internalRemoveData( elem, name );
  1459. },
  1460. // For internal use only.
  1461. _data: function( elem, name, data ) {
  1462. return internalData( elem, name, data, true );
  1463. },
  1464. _removeData: function( elem, name ) {
  1465. return internalRemoveData( elem, name, true );
  1466. },
  1467. // A method for determining if a DOM node can handle the data expando
  1468. acceptData: function( elem ) {
  1469. // Do not set data on non-element because it will not be cleared (#8335).
  1470. if ( elem.nodeType && elem.nodeType !== 1 && elem.nodeType !== 9 ) {
  1471. return false;
  1472. }
  1473. var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];
  1474. // nodes accept data unless otherwise specified; rejection can be conditional
  1475. return !noData || noData !== true && elem.getAttribute("classid") === noData;
  1476. }
  1477. });
  1478. jQuery.fn.extend({
  1479. data: function( key, value ) {
  1480. var attrs, name,
  1481. elem = this[0],
  1482. i = 0,
  1483. data = null;
  1484. // Gets all values
  1485. if ( key === undefined ) {
  1486. if ( this.length ) {
  1487. data = jQuery.data( elem );
  1488. if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
  1489. attrs = elem.attributes;
  1490. for ( ; i < attrs.length; i++ ) {
  1491. name = attrs[i].name;
  1492. if ( !name.indexOf( "data-" ) ) {
  1493. name = jQuery.camelCase( name.slice(5) );
  1494. dataAttr( elem, name, data[ name ] );
  1495. }
  1496. }
  1497. jQuery._data( elem, "parsedAttrs", true );
  1498. }
  1499. }
  1500. return data;
  1501. }
  1502. // Sets multiple values
  1503. if ( typeof key === "object" ) {
  1504. return this.each(function() {
  1505. jQuery.data( this, key );
  1506. });
  1507. }
  1508. return jQuery.access( this, function( value ) {
  1509. if ( value === undefined ) {
  1510. // Try to fetch any internally stored data first
  1511. return elem ? dataAt

Large files files are truncated, but you can click here to view the full file