PageRenderTime 97ms CodeModel.GetById 34ms RepoModel.GetById 0ms app.codeStats 3ms

/ajax/libs/thorax/2.0.0rc3/thorax.js

https://bitbucket.org/kolbyjAFK/cdnjs
JavaScript | 15921 lines | 12818 code | 1565 blank | 1538 comment | 2156 complexity | 1dc03ae90e8300b2fe4942338fcf9d7c MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception

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

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

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