PageRenderTime 86ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 1ms

/BlogEngine/BlogEngine.NET/Scripts/jQuery/jquery-1.5-vsdoc.js

#
JavaScript | 6574 lines | 3408 code | 897 blank | 2269 comment | 1132 complexity | 5d3a3682e1ba1b76d495104ddf89f0ac MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause
  1. /*
  2. * This file has been generated to support Visual Studio IntelliSense.
  3. * You should not use this file at runtime inside the browser--it is only
  4. * intended to be used only for design-time IntelliSense. Please use the
  5. * standard jQuery library for all production use.
  6. *
  7. * Comment version: 1.5
  8. */
  9. /*!
  10. * jQuery JavaScript Library v1.5
  11. * http://jquery.com/
  12. *
  13. * Distributed in whole under the terms of the MIT
  14. *
  15. * Copyright 2010, John Resig
  16. *
  17. * Permission is hereby granted, free of charge, to any person obtaining
  18. * a copy of this software and associated documentation files (the
  19. * "Software"), to deal in the Software without restriction, including
  20. * without limitation the rights to use, copy, modify, merge, publish,
  21. * distribute, sublicense, and/or sell copies of the Software, and to
  22. * permit persons to whom the Software is furnished to do so, subject to
  23. * the following conditions:
  24. *
  25. * The above copyright notice and this permission notice shall be
  26. * included in all copies or substantial portions of the Software.
  27. *
  28. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  29. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  30. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  31. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  32. * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  33. * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  34. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  35. *
  36. * Includes Sizzle.js
  37. * http://sizzlejs.com/
  38. * Copyright 2010, The Dojo Foundation
  39. * Released under the MIT and BSD Licenses.
  40. */
  41. (function (window, undefined) {
  42. var jQuery = function (selector, context) {
  43. /// <summary>
  44. /// 1: Accepts a string containing a CSS selector which is then used to match a set of elements.
  45. /// 1.1 - $(selector, context)
  46. /// 1.2 - $(element)
  47. /// 1.3 - $(elementArray)
  48. /// 1.4 - $(jQuery object)
  49. /// 1.5 - $()
  50. /// 2: Creates DOM elements on the fly from the provided string of raw HTML.
  51. /// 2.1 - $(html, ownerDocument)
  52. /// 2.2 - $(html, props)
  53. /// 3: Binds a function to be executed when the DOM has finished loading.
  54. /// 3.1 - $(callback)
  55. /// </summary>
  56. /// <param name="selector" type="String">
  57. /// A string containing a selector expression
  58. /// </param>
  59. /// <param name="context" type="jQuery">
  60. /// A DOM Element, Document, or jQuery to use as context
  61. /// </param>
  62. /// <returns type="jQuery" />
  63. // The jQuery object is actually just the init constructor 'enhanced'
  64. return new jQuery.fn.init(selector, context, rootjQuery);
  65. };
  66. jQuery.Deferred = function (func) {
  67. var deferred = jQuery._Deferred(),
  68. failDeferred = jQuery._Deferred(),
  69. promise;
  70. // Add errorDeferred methods, then and promise
  71. jQuery.extend(deferred, {
  72. then: function (doneCallbacks, failCallbacks) {
  73. deferred.done(doneCallbacks).fail(failCallbacks);
  74. return this;
  75. },
  76. fail: failDeferred.done,
  77. rejectWith: failDeferred.resolveWith,
  78. reject: failDeferred.resolve,
  79. isRejected: failDeferred.isResolved,
  80. // Get a promise for this deferred
  81. // If obj is provided, the promise aspect is added to the object
  82. promise: function (obj, i /* internal */) {
  83. if (obj == null) {
  84. if (promise) {
  85. return promise;
  86. }
  87. promise = obj = {};
  88. }
  89. i = promiseMethods.length;
  90. while (i--) {
  91. obj[promiseMethods[i]] = deferred[promiseMethods[i]];
  92. }
  93. return obj;
  94. }
  95. });
  96. // Make sure only one callback list will be used
  97. deferred.then(failDeferred.cancel, deferred.cancel);
  98. // Unexpose cancel
  99. delete deferred.cancel;
  100. // Call given func if any
  101. if (func) {
  102. func.call(deferred, deferred);
  103. }
  104. return deferred;
  105. };
  106. jQuery.Event = function (src) {
  107. // Allow instantiation without the 'new' keyword
  108. if (!this.preventDefault) {
  109. return new jQuery.Event(src);
  110. }
  111. // Event object
  112. if (src && src.type) {
  113. this.originalEvent = src;
  114. this.type = src.type;
  115. // Events bubbling up the document may have been marked as prevented
  116. // by a handler lower down the tree; reflect the correct value.
  117. this.isDefaultPrevented = (src.defaultPrevented || src.returnValue === false ||
  118. src.getPreventDefault && src.getPreventDefault()) ? returnTrue : returnFalse;
  119. // Event type
  120. } else {
  121. this.type = src;
  122. }
  123. // timeStamp is buggy for some events on Firefox(#3843)
  124. // So we won't rely on the native value
  125. this.timeStamp = jQuery.now();
  126. // Mark it as fixed
  127. this[jQuery.expando] = true;
  128. };
  129. jQuery._Deferred = function () {
  130. var // callbacks list
  131. callbacks = [],
  132. // stored [ context , args ]
  133. fired,
  134. // to avoid firing when already doing so
  135. firing,
  136. // flag to know if the deferred has been cancelled
  137. cancelled,
  138. // the deferred itself
  139. deferred = {
  140. // done( f1, f2, ...)
  141. done: function () {
  142. if (!cancelled) {
  143. var args = arguments,
  144. i,
  145. length,
  146. elem,
  147. type,
  148. _fired;
  149. if (fired) {
  150. _fired = fired;
  151. fired = 0;
  152. }
  153. for (i = 0, length = args.length; i < length; i++) {
  154. elem = args[i];
  155. type = jQuery.type(elem);
  156. if (type === "array") {
  157. deferred.done.apply(deferred, elem);
  158. } else if (type === "function") {
  159. callbacks.push(elem);
  160. }
  161. }
  162. if (_fired) {
  163. deferred.resolveWith(_fired[0], _fired[1]);
  164. }
  165. }
  166. return this;
  167. },
  168. // resolve with given context and args
  169. resolveWith: function (context, args) {
  170. if (!cancelled && !fired && !firing) {
  171. firing = 1;
  172. try {
  173. while (callbacks[0]) {
  174. callbacks.shift().apply(context, args);
  175. }
  176. }
  177. finally {
  178. fired = [context, args];
  179. firing = 0;
  180. }
  181. }
  182. return this;
  183. },
  184. // resolve with this as context and given arguments
  185. resolve: function () {
  186. deferred.resolveWith(jQuery.isFunction(this.promise) ? this.promise() : this, arguments);
  187. return this;
  188. },
  189. // Has this deferred been resolved?
  190. isResolved: function () {
  191. return !!(firing || fired);
  192. },
  193. // Cancel
  194. cancel: function () {
  195. cancelled = 1;
  196. callbacks = [];
  197. return this;
  198. }
  199. };
  200. return deferred;
  201. };
  202. jQuery._data = function (elem, name, data) {
  203. return jQuery.data(elem, name, data, true);
  204. };
  205. jQuery.acceptData = function (elem) {
  206. if (elem.nodeName) {
  207. var match = jQuery.noData[elem.nodeName.toLowerCase()];
  208. if (match) {
  209. return !(match === true || elem.getAttribute("classid") !== match);
  210. }
  211. }
  212. return true;
  213. };
  214. jQuery.access = function (elems, key, value, exec, fn, pass) {
  215. var length = elems.length;
  216. // Setting many attributes
  217. if (typeof key === "object") {
  218. for (var k in key) {
  219. jQuery.access(elems, k, key[k], exec, fn, value);
  220. }
  221. return elems;
  222. }
  223. // Setting one attribute
  224. if (value !== undefined) {
  225. // Optionally, function values get executed if exec is true
  226. exec = !pass && exec && jQuery.isFunction(value);
  227. for (var i = 0; i < length; i++) {
  228. fn(elems[i], key, exec ? value.call(elems[i], i, fn(elems[i], key)) : value, pass);
  229. }
  230. return elems;
  231. }
  232. // Getting an attribute
  233. return length ? fn(elems[0], key) : undefined;
  234. };
  235. jQuery.active = 0;
  236. jQuery.ajax = function (url, options) {
  237. /// <summary>
  238. /// Perform an asynchronous HTTP (Ajax) request.
  239. /// 1 - jQuery.ajax(url, settings)
  240. /// 2 - jQuery.ajax(settings)
  241. /// </summary>
  242. /// <param name="url" type="String">
  243. /// A string containing the URL to which the request is sent.
  244. /// </param>
  245. /// <param name="options" type="Object">
  246. /// A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup(). See jQuery.ajax( settings ) below for a complete list of all settings.
  247. /// </param>
  248. // If options is not an object,
  249. // we simulate pre-1.5 signature
  250. if (typeof options !== "object") {
  251. options = url;
  252. url = undefined;
  253. }
  254. // Force options to be an object
  255. options = options || {};
  256. var // Create the final options object
  257. s = jQuery.extend(true, {}, jQuery.ajaxSettings, options),
  258. // Callbacks contexts
  259. // We force the original context if it exists
  260. // or take it from jQuery.ajaxSettings otherwise
  261. // (plain objects used as context get extended)
  262. callbackContext =
  263. (s.context = ("context" in options ? options : jQuery.ajaxSettings).context) || s,
  264. globalEventContext = callbackContext === s ? jQuery.event : jQuery(callbackContext),
  265. // Deferreds
  266. deferred = jQuery.Deferred(),
  267. completeDeferred = jQuery._Deferred(),
  268. // Status-dependent callbacks
  269. statusCode = s.statusCode || {},
  270. // Headers (they are sent all at once)
  271. requestHeaders = {},
  272. // Response headers
  273. responseHeadersString,
  274. responseHeaders,
  275. // transport
  276. transport,
  277. // timeout handle
  278. timeoutTimer,
  279. // Cross-domain detection vars
  280. loc = document.location,
  281. protocol = loc.protocol || "http:",
  282. parts,
  283. // The jXHR state
  284. state = 0,
  285. // Loop variable
  286. i,
  287. // Fake xhr
  288. jXHR = {
  289. readyState: 0,
  290. // Caches the header
  291. setRequestHeader: function (name, value) {
  292. if (state === 0) {
  293. requestHeaders[name.toLowerCase()] = value;
  294. }
  295. return this;
  296. },
  297. // Raw string
  298. getAllResponseHeaders: function () {
  299. return state === 2 ? responseHeadersString : null;
  300. },
  301. // Builds headers hashtable if needed
  302. getResponseHeader: function (key) {
  303. var match;
  304. if (state === 2) {
  305. if (!responseHeaders) {
  306. responseHeaders = {};
  307. while ((match = rheaders.exec(responseHeadersString))) {
  308. responseHeaders[match[1].toLowerCase()] = match[2];
  309. }
  310. }
  311. match = responseHeaders[key.toLowerCase()];
  312. }
  313. return match || null;
  314. },
  315. // Cancel the request
  316. abort: function (statusText) {
  317. statusText = statusText || "abort";
  318. if (transport) {
  319. transport.abort(statusText);
  320. }
  321. done(0, statusText);
  322. return this;
  323. }
  324. };
  325. // Callback for when everything is done
  326. // It is defined here because jslint complains if it is declared
  327. // at the end of the function (which would be more logical and readable)
  328. function done(status, statusText, responses, headers) {
  329. // Called once
  330. if (state === 2) {
  331. return;
  332. }
  333. // State is "done" now
  334. state = 2;
  335. // Clear timeout if it exists
  336. if (timeoutTimer) {
  337. clearTimeout(timeoutTimer);
  338. }
  339. // Dereference transport for early garbage collection
  340. // (no matter how long the jXHR object will be used)
  341. transport = undefined;
  342. // Cache response headers
  343. responseHeadersString = headers || "";
  344. // Set readyState
  345. jXHR.readyState = status ? 4 : 0;
  346. var isSuccess,
  347. success,
  348. error,
  349. response = responses ? ajaxHandleResponses(s, jXHR, responses) : undefined,
  350. lastModified,
  351. etag;
  352. // If successful, handle type chaining
  353. if (status >= 200 && status < 300 || status === 304) {
  354. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  355. if (s.ifModified) {
  356. if ((lastModified = jXHR.getResponseHeader("Last-Modified"))) {
  357. jQuery.lastModified[s.url] = lastModified;
  358. }
  359. if ((etag = jXHR.getResponseHeader("Etag"))) {
  360. jQuery.etag[s.url] = etag;
  361. }
  362. }
  363. // If not modified
  364. if (status === 304) {
  365. statusText = "notmodified";
  366. isSuccess = true;
  367. // If we have data
  368. } else {
  369. try {
  370. success = ajaxConvert(s, response);
  371. statusText = "success";
  372. isSuccess = true;
  373. } catch (e) {
  374. // We have a parsererror
  375. statusText = "parsererror";
  376. error = e;
  377. }
  378. }
  379. } else {
  380. // We extract error from statusText
  381. // then normalize statusText and status for non-aborts
  382. error = statusText;
  383. if (status) {
  384. statusText = "error";
  385. if (status < 0) {
  386. status = 0;
  387. }
  388. }
  389. }
  390. // Set data for the fake xhr object
  391. jXHR.status = status;
  392. jXHR.statusText = statusText;
  393. // Success/Error
  394. if (isSuccess) {
  395. deferred.resolveWith(callbackContext, [success, statusText, jXHR]);
  396. } else {
  397. deferred.rejectWith(callbackContext, [jXHR, statusText, error]);
  398. }
  399. // Status-dependent callbacks
  400. jXHR.statusCode(statusCode);
  401. statusCode = undefined;
  402. if (s.global) {
  403. globalEventContext.trigger("ajax" + (isSuccess ? "Success" : "Error"),
  404. [jXHR, s, isSuccess ? success : error]);
  405. }
  406. // Complete
  407. completeDeferred.resolveWith(callbackContext, [jXHR, statusText]);
  408. if (s.global) {
  409. globalEventContext.trigger("ajaxComplete", [jXHR, s]);
  410. // Handle the global AJAX counter
  411. if (!(--jQuery.active)) {
  412. jQuery.event.trigger("ajaxStop");
  413. }
  414. }
  415. }
  416. // Attach deferreds
  417. deferred.promise(jXHR);
  418. jXHR.success = jXHR.done;
  419. jXHR.error = jXHR.fail;
  420. jXHR.complete = completeDeferred.done;
  421. // Status-dependent callbacks
  422. jXHR.statusCode = function (map) {
  423. if (map) {
  424. var tmp;
  425. if (state < 2) {
  426. for (tmp in map) {
  427. statusCode[tmp] = [statusCode[tmp], map[tmp]];
  428. }
  429. } else {
  430. tmp = map[jXHR.status];
  431. jXHR.then(tmp, tmp);
  432. }
  433. }
  434. return this;
  435. };
  436. // Remove hash character (#7531: and string promotion)
  437. // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
  438. // We also use the url parameter if available
  439. s.url = ("" + (url || s.url)).replace(rhash, "").replace(rprotocol, protocol + "//");
  440. // Extract dataTypes list
  441. s.dataTypes = jQuery.trim(s.dataType || "*").toLowerCase().split(rspacesAjax);
  442. // Determine if a cross-domain request is in order
  443. if (!s.crossDomain) {
  444. parts = rurl.exec(s.url.toLowerCase());
  445. s.crossDomain = !!(parts &&
  446. (parts[1] != protocol || parts[2] != loc.hostname ||
  447. (parts[3] || (parts[1] === "http:" ? 80 : 443)) !=
  448. (loc.port || (protocol === "http:" ? 80 : 443)))
  449. );
  450. }
  451. // Convert data if not already a string
  452. if (s.data && s.processData && typeof s.data !== "string") {
  453. s.data = jQuery.param(s.data, s.traditional);
  454. }
  455. // Apply prefilters
  456. inspectPrefiltersOrTransports(prefilters, s, options, jXHR);
  457. // Uppercase the type
  458. s.type = s.type.toUpperCase();
  459. // Determine if request has content
  460. s.hasContent = !rnoContent.test(s.type);
  461. // Watch for a new set of requests
  462. if (s.global && jQuery.active++ === 0) {
  463. jQuery.event.trigger("ajaxStart");
  464. }
  465. // More options handling for requests with no content
  466. if (!s.hasContent) {
  467. // If data is available, append data to url
  468. if (s.data) {
  469. s.url += (rquery.test(s.url) ? "&" : "?") + s.data;
  470. }
  471. // Add anti-cache in url if needed
  472. if (s.cache === false) {
  473. var ts = jQuery.now(),
  474. // try replacing _= if it is there
  475. ret = s.url.replace(rts, "$1_=" + ts);
  476. // if nothing was replaced, add timestamp to the end
  477. s.url = ret + ((ret === s.url) ? (rquery.test(s.url) ? "&" : "?") + "_=" + ts : "");
  478. }
  479. }
  480. // Set the correct header, if data is being sent
  481. if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
  482. requestHeaders["content-type"] = s.contentType;
  483. }
  484. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  485. if (s.ifModified) {
  486. if (jQuery.lastModified[s.url]) {
  487. requestHeaders["if-modified-since"] = jQuery.lastModified[s.url];
  488. }
  489. if (jQuery.etag[s.url]) {
  490. requestHeaders["if-none-match"] = jQuery.etag[s.url];
  491. }
  492. }
  493. // Set the Accepts header for the server, depending on the dataType
  494. requestHeaders.accept = s.dataTypes[0] && s.accepts[s.dataTypes[0]] ?
  495. s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", */*; q=0.01" : "") :
  496. s.accepts["*"];
  497. // Check for headers option
  498. for (i in s.headers) {
  499. requestHeaders[i.toLowerCase()] = s.headers[i];
  500. }
  501. // Allow custom headers/mimetypes and early abort
  502. if (s.beforeSend && (s.beforeSend.call(callbackContext, jXHR, s) === false || state === 2)) {
  503. // Abort if not done already
  504. done(0, "abort");
  505. // Return false
  506. jXHR = false;
  507. } else {
  508. // Install callbacks on deferreds
  509. for (i in { success: 1, error: 1, complete: 1 }) {
  510. jXHR[i](s[i]);
  511. }
  512. // Get transport
  513. transport = inspectPrefiltersOrTransports(transports, s, options, jXHR);
  514. // If no transport, we auto-abort
  515. if (!transport) {
  516. done(-1, "No Transport");
  517. } else {
  518. // Set state as sending
  519. state = jXHR.readyState = 1;
  520. // Send global event
  521. if (s.global) {
  522. globalEventContext.trigger("ajaxSend", [jXHR, s]);
  523. }
  524. // Timeout
  525. if (s.async && s.timeout > 0) {
  526. timeoutTimer = setTimeout(function () {
  527. jXHR.abort("timeout");
  528. }, s.timeout);
  529. }
  530. try {
  531. transport.send(requestHeaders, done);
  532. } catch (e) {
  533. // Propagate exception as error if not done
  534. if (status < 2) {
  535. done(-1, e);
  536. // Simply rethrow otherwise
  537. } else {
  538. jQuery.error(e);
  539. }
  540. }
  541. }
  542. }
  543. return jXHR;
  544. };
  545. jQuery.ajaxPrefilter = function (dataTypeExpression, func) {
  546. if (typeof dataTypeExpression !== "string") {
  547. func = dataTypeExpression;
  548. dataTypeExpression = "*";
  549. }
  550. if (jQuery.isFunction(func)) {
  551. var dataTypes = dataTypeExpression.toLowerCase().split(rspacesAjax),
  552. i = 0,
  553. length = dataTypes.length,
  554. dataType,
  555. list,
  556. placeBefore;
  557. // For each dataType in the dataTypeExpression
  558. for (; i < length; i++) {
  559. dataType = dataTypes[i];
  560. // We control if we're asked to add before
  561. // any existing element
  562. placeBefore = /^\+/.test(dataType);
  563. if (placeBefore) {
  564. dataType = dataType.substr(1) || "*";
  565. }
  566. list = structure[dataType] = structure[dataType] || [];
  567. // then we add to the structure accordingly
  568. list[placeBefore ? "unshift" : "push"](func);
  569. }
  570. }
  571. };
  572. jQuery.ajaxSettings = { "url": 'http://localhost:25812/',
  573. "global": true,
  574. "type": 'GET',
  575. "contentType": 'application/x-www-form-urlencoded',
  576. "processData": true,
  577. "async": true,
  578. "accepts": {},
  579. "contents": {},
  580. "responseFields": {},
  581. "converters": {},
  582. "jsonp": 'callback'
  583. };
  584. jQuery.ajaxSetup = function (settings) {
  585. /// <summary>
  586. /// Set default values for future Ajax requests.
  587. /// </summary>
  588. /// <param name="settings" type="Object">
  589. /// A set of key/value pairs that configure the default Ajax request. All options are optional.
  590. /// </param>
  591. jQuery.extend(true, jQuery.ajaxSettings, settings);
  592. if (settings.context) {
  593. jQuery.ajaxSettings.context = settings.context;
  594. }
  595. };
  596. jQuery.ajaxTransport = function (dataTypeExpression, func) {
  597. if (typeof dataTypeExpression !== "string") {
  598. func = dataTypeExpression;
  599. dataTypeExpression = "*";
  600. }
  601. if (jQuery.isFunction(func)) {
  602. var dataTypes = dataTypeExpression.toLowerCase().split(rspacesAjax),
  603. i = 0,
  604. length = dataTypes.length,
  605. dataType,
  606. list,
  607. placeBefore;
  608. // For each dataType in the dataTypeExpression
  609. for (; i < length; i++) {
  610. dataType = dataTypes[i];
  611. // We control if we're asked to add before
  612. // any existing element
  613. placeBefore = /^\+/.test(dataType);
  614. if (placeBefore) {
  615. dataType = dataType.substr(1) || "*";
  616. }
  617. list = structure[dataType] = structure[dataType] || [];
  618. // then we add to the structure accordingly
  619. list[placeBefore ? "unshift" : "push"](func);
  620. }
  621. }
  622. };
  623. jQuery.attr = function (elem, name, value, pass) {
  624. // don't get/set attributes on text, comment and attribute nodes
  625. if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || elem.nodeType === 2) {
  626. return undefined;
  627. }
  628. if (pass && name in jQuery.attrFn) {
  629. return jQuery(elem)[name](value);
  630. }
  631. var notxml = elem.nodeType !== 1 || !jQuery.isXMLDoc(elem),
  632. // Whether we are setting (or getting)
  633. set = value !== undefined;
  634. // Try to normalize/fix the name
  635. name = notxml && jQuery.props[name] || name;
  636. // Only do all the following if this is a node (faster for style)
  637. if (elem.nodeType === 1) {
  638. // These attributes require special treatment
  639. var special = rspecialurl.test(name);
  640. // Safari mis-reports the default selected property of an option
  641. // Accessing the parent's selectedIndex property fixes it
  642. if (name === "selected" && !jQuery.support.optSelected) {
  643. var parent = elem.parentNode;
  644. if (parent) {
  645. parent.selectedIndex;
  646. // Make sure that it also works with optgroups, see #5701
  647. if (parent.parentNode) {
  648. parent.parentNode.selectedIndex;
  649. }
  650. }
  651. }
  652. // If applicable, access the attribute via the DOM 0 way
  653. // 'in' checks fail in Blackberry 4.7 #6931
  654. if ((name in elem || elem[name] !== undefined) && notxml && !special) {
  655. if (set) {
  656. // We can't allow the type property to be changed (since it causes problems in IE)
  657. if (name === "type" && rtype.test(elem.nodeName) && elem.parentNode) {
  658. jQuery.error("type property can't be changed");
  659. }
  660. if (value === null) {
  661. if (elem.nodeType === 1) {
  662. elem.removeAttribute(name);
  663. }
  664. } else {
  665. elem[name] = value;
  666. }
  667. }
  668. // browsers index elements by id/name on forms, give priority to attributes.
  669. if (jQuery.nodeName(elem, "form") && elem.getAttributeNode(name)) {
  670. return elem.getAttributeNode(name).nodeValue;
  671. }
  672. // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
  673. // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  674. if (name === "tabIndex") {
  675. var attributeNode = elem.getAttributeNode("tabIndex");
  676. return attributeNode && attributeNode.specified ?
  677. attributeNode.value :
  678. rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href ?
  679. 0 :
  680. undefined;
  681. }
  682. return elem[name];
  683. }
  684. if (!jQuery.support.style && notxml && name === "style") {
  685. if (set) {
  686. elem.style.cssText = "" + value;
  687. }
  688. return elem.style.cssText;
  689. }
  690. if (set) {
  691. // convert the value to a string (all browsers do this but IE) see #1070
  692. elem.setAttribute(name, "" + value);
  693. }
  694. // Ensure that missing attributes return undefined
  695. // Blackberry 4.7 returns "" from getAttribute #6938
  696. if (!elem.attributes[name] && (elem.hasAttribute && !elem.hasAttribute(name))) {
  697. return undefined;
  698. }
  699. var attr = !jQuery.support.hrefNormalized && notxml && special ?
  700. // Some attributes require a special call on IE
  701. elem.getAttribute(name, 2) :
  702. elem.getAttribute(name);
  703. // Non-existent attributes return null, we normalize to undefined
  704. return attr === null ? undefined : attr;
  705. }
  706. // Handle everything which isn't a DOM element node
  707. if (set) {
  708. elem[name] = value;
  709. }
  710. return elem[name];
  711. };
  712. jQuery.attrFn = { "val": true,
  713. "css": true,
  714. "html": true,
  715. "text": true,
  716. "data": true,
  717. "width": true,
  718. "height": true,
  719. "offset": true,
  720. "blur": true,
  721. "focus": true,
  722. "focusin": true,
  723. "focusout": true,
  724. "load": true,
  725. "resize": true,
  726. "scroll": true,
  727. "unload": true,
  728. "click": true,
  729. "dblclick": true,
  730. "mousedown": true,
  731. "mouseup": true,
  732. "mousemove": true,
  733. "mouseover": true,
  734. "mouseout": true,
  735. "mouseenter": true,
  736. "mouseleave": true,
  737. "change": true,
  738. "select": true,
  739. "submit": true,
  740. "keydown": true,
  741. "keypress": true,
  742. "keyup": true,
  743. "error": true
  744. };
  745. jQuery.bindReady = function () {
  746. if (readyBound) {
  747. return;
  748. }
  749. readyBound = true;
  750. // Catch cases where $(document).ready() is called after the
  751. // browser event has already occurred.
  752. if (document.readyState === "complete") {
  753. // Handle it asynchronously to allow scripts the opportunity to delay ready
  754. return setTimeout(jQuery.ready, 1);
  755. }
  756. // Mozilla, Opera and webkit nightlies currently support this event
  757. if (document.addEventListener) {
  758. // Use the handy event callback
  759. document.addEventListener("DOMContentLoaded", DOMContentLoaded, false);
  760. // A fallback to window.onload, that will always work
  761. window.addEventListener("load", jQuery.ready, false);
  762. // If IE event model is used
  763. } else if (document.attachEvent) {
  764. // ensure firing before onload,
  765. // maybe late but safe also for iframes
  766. document.attachEvent("onreadystatechange", DOMContentLoaded);
  767. // A fallback to window.onload, that will always work
  768. window.attachEvent("onload", jQuery.ready);
  769. // If IE and not a frame
  770. // continually check to see if the document is ready
  771. var toplevel = false;
  772. try {
  773. toplevel = window.frameElement == null;
  774. } catch (e) { }
  775. if (document.documentElement.doScroll && toplevel) {
  776. doScrollCheck();
  777. }
  778. }
  779. };
  780. jQuery.boxModel = true;
  781. jQuery.browser = { "webkit": true,
  782. "version": '534.13',
  783. "safari": true
  784. };
  785. jQuery.buildFragment = function (args, nodes, scripts) {
  786. var fragment, cacheable, cacheresults,
  787. doc = (nodes && nodes[0] ? nodes[0].ownerDocument || nodes[0] : document);
  788. // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
  789. // Cloning options loses the selected state, so don't cache them
  790. // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
  791. // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
  792. if (args.length === 1 && typeof args[0] === "string" && args[0].length < 512 && doc === document &&
  793. args[0].charAt(0) === "<" && !rnocache.test(args[0]) && (jQuery.support.checkClone || !rchecked.test(args[0]))) {
  794. cacheable = true;
  795. cacheresults = jQuery.fragments[args[0]];
  796. if (cacheresults) {
  797. if (cacheresults !== 1) {
  798. fragment = cacheresults;
  799. }
  800. }
  801. }
  802. if (!fragment) {
  803. fragment = doc.createDocumentFragment();
  804. jQuery.clean(args, doc, fragment, scripts);
  805. }
  806. if (cacheable) {
  807. jQuery.fragments[args[0]] = cacheresults ? fragment : 1;
  808. }
  809. return { fragment: fragment, cacheable: cacheable };
  810. };
  811. jQuery.cache = {};
  812. jQuery.camelCase = function (string) {
  813. return string.replace(rdashAlpha, fcamelCase);
  814. };
  815. jQuery.clean = function (elems, context, fragment, scripts) {
  816. context = context || document;
  817. // !context.createElement fails in IE with an error but returns typeof 'object'
  818. if (typeof context.createElement === "undefined") {
  819. context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
  820. }
  821. var ret = [];
  822. for (var i = 0, elem; (elem = elems[i]) != null; i++) {
  823. if (typeof elem === "number") {
  824. elem += "";
  825. }
  826. if (!elem) {
  827. continue;
  828. }
  829. // Convert html string into DOM nodes
  830. if (typeof elem === "string" && !rhtml.test(elem)) {
  831. elem = context.createTextNode(elem);
  832. } else if (typeof elem === "string") {
  833. // Fix "XHTML"-style tags in all browsers
  834. elem = elem.replace(rxhtmlTag, "<$1></$2>");
  835. // Trim whitespace, otherwise indexOf won't work as expected
  836. var tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase(),
  837. wrap = wrapMap[tag] || wrapMap._default,
  838. depth = wrap[0],
  839. div = context.createElement("div");
  840. // Go to html and back, then peel off extra wrappers
  841. div.innerHTML = wrap[1] + elem + wrap[2];
  842. // Move to the right depth
  843. while (depth--) {
  844. div = div.lastChild;
  845. }
  846. // Remove IE's autoinserted <tbody> from table fragments
  847. if (!jQuery.support.tbody) {
  848. // String was a <table>, *may* have spurious <tbody>
  849. var hasBody = rtbody.test(elem),
  850. tbody = tag === "table" && !hasBody ?
  851. div.firstChild && div.firstChild.childNodes :
  852. // String was a bare <thead> or <tfoot>
  853. wrap[1] === "<table>" && !hasBody ?
  854. div.childNodes :
  855. [];
  856. for (var j = tbody.length - 1; j >= 0; --j) {
  857. if (jQuery.nodeName(tbody[j], "tbody") && !tbody[j].childNodes.length) {
  858. tbody[j].parentNode.removeChild(tbody[j]);
  859. }
  860. }
  861. }
  862. // IE completely kills leading whitespace when innerHTML is used
  863. if (!jQuery.support.leadingWhitespace && rleadingWhitespace.test(elem)) {
  864. div.insertBefore(context.createTextNode(rleadingWhitespace.exec(elem)[0]), div.firstChild);
  865. }
  866. elem = div.childNodes;
  867. }
  868. if (elem.nodeType) {
  869. ret.push(elem);
  870. } else {
  871. ret = jQuery.merge(ret, elem);
  872. }
  873. }
  874. if (fragment) {
  875. for (i = 0; ret[i]; i++) {
  876. if (scripts && jQuery.nodeName(ret[i], "script") && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript")) {
  877. scripts.push(ret[i].parentNode ? ret[i].parentNode.removeChild(ret[i]) : ret[i]);
  878. } else {
  879. if (ret[i].nodeType === 1) {
  880. ret.splice.apply(ret, [i + 1, 0].concat(jQuery.makeArray(ret[i].getElementsByTagName("script"))));
  881. }
  882. fragment.appendChild(ret[i]);
  883. }
  884. }
  885. }
  886. return ret;
  887. };
  888. jQuery.cleanData = function (elems) {
  889. var data, id, cache = jQuery.cache, internalKey = jQuery.expando, special = jQuery.event.special,
  890. deleteExpando = jQuery.support.deleteExpando;
  891. for (var i = 0, elem; (elem = elems[i]) != null; i++) {
  892. if (elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()]) {
  893. continue;
  894. }
  895. id = elem[jQuery.expando];
  896. if (id) {
  897. data = cache[id] && cache[id][internalKey];
  898. if (data && data.events) {
  899. for (var type in data.events) {
  900. if (special[type]) {
  901. jQuery.event.remove(elem, type);
  902. // This is a shortcut to avoid jQuery.event.remove's overhead
  903. } else {
  904. jQuery.removeEvent(elem, type, data.handle);
  905. }
  906. }
  907. // Null the DOM reference to avoid IE6/7/8 leak (#7054)
  908. if (data.handle) {
  909. data.handle.elem = null;
  910. }
  911. }
  912. if (deleteExpando) {
  913. delete elem[jQuery.expando];
  914. } else if (elem.removeAttribute) {
  915. elem.removeAttribute(jQuery.expando);
  916. }
  917. delete cache[id];
  918. }
  919. }
  920. };
  921. jQuery.clone = function (elem, dataAndEvents, deepDataAndEvents) {
  922. var clone = elem.cloneNode(true),
  923. srcElements,
  924. destElements,
  925. i;
  926. if (!jQuery.support.noCloneEvent && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
  927. // IE copies events bound via attachEvent when using cloneNode.
  928. // Calling detachEvent on the clone will also remove the events
  929. // from the original. In order to get around this, we use some
  930. // proprietary methods to clear the events. Thanks to MooTools
  931. // guys for this hotness.
  932. // Using Sizzle here is crazy slow, so we use getElementsByTagName
  933. // instead
  934. srcElements = elem.getElementsByTagName("*");
  935. destElements = clone.getElementsByTagName("*");
  936. // Weird iteration because IE will replace the length property
  937. // with an element if you are cloning the body and one of the
  938. // elements on the page has a name or id of "length"
  939. for (i = 0; srcElements[i]; ++i) {
  940. cloneFixAttributes(srcElements[i], destElements[i]);
  941. }
  942. cloneFixAttributes(elem, clone);
  943. }
  944. // Copy the events from the original to the clone
  945. if (dataAndEvents) {
  946. cloneCopyEvent(elem, clone);
  947. if (deepDataAndEvents && "getElementsByTagName" in elem) {
  948. srcElements = elem.getElementsByTagName("*");
  949. destElements = clone.getElementsByTagName("*");
  950. if (srcElements.length) {
  951. for (i = 0; srcElements[i]; ++i) {
  952. cloneCopyEvent(srcElements[i], destElements[i]);
  953. }
  954. }
  955. }
  956. }
  957. // Return the cloned set
  958. return clone;
  959. };
  960. jQuery.contains = function (a, b) {
  961. /// <summary>
  962. /// Check to see if a DOM node is within another DOM node.
  963. /// </summary>
  964. /// <param name="a" domElement="true">
  965. /// The DOM element that may contain the other element.
  966. /// </param>
  967. /// <param name="b" domElement="true">
  968. /// The DOM node that may be contained by the other element.
  969. /// </param>
  970. /// <returns type="Boolean" />
  971. return a !== b && (a.contains ? a.contains(b) : true);
  972. };
  973. jQuery.css = function (elem, name, extra) {
  974. // Make sure that we're working with the right name
  975. var ret, origName = jQuery.camelCase(name),
  976. hooks = jQuery.cssHooks[origName];
  977. name = jQuery.cssProps[origName] || origName;
  978. // If a hook was provided get the computed value from there
  979. if (hooks && "get" in hooks && (ret = hooks.get(elem, true, extra)) !== undefined) {
  980. return ret;
  981. // Otherwise, if a way to get the computed value exists, use that
  982. } else if (curCSS) {
  983. return curCSS(elem, name, origName);
  984. }
  985. };
  986. jQuery.cssHooks = { "opacity": {},
  987. "height": {},
  988. "width": {}
  989. };
  990. jQuery.cssNumber = { "zIndex": true,
  991. "fontWeight": true,
  992. "opacity": true,
  993. "zoom": true,
  994. "lineHeight": true
  995. };
  996. jQuery.cssProps = { "float": 'cssFloat' };
  997. jQuery.curCSS = function (elem, name, extra) {
  998. // Make sure that we're working with the right name
  999. var ret, origName = jQuery.camelCase(name),
  1000. hooks = jQuery.cssHooks[origName];
  1001. name = jQuery.cssProps[origName] || origName;
  1002. // If a hook was provided get the computed value from there
  1003. if (hooks && "get" in hooks && (ret = hooks.get(elem, true, extra)) !== undefined) {
  1004. return ret;
  1005. // Otherwise, if a way to get the computed value exists, use that
  1006. } else if (curCSS) {
  1007. return curCSS(elem, name, origName);
  1008. }
  1009. };
  1010. jQuery.data = function (elem, name, data, pvt /* Internal Use Only */) {
  1011. /// <summary>
  1012. /// 1: Store arbitrary data associated with the specified element.
  1013. /// 1.1 - jQuery.data(element, key, value)
  1014. /// 2: Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element.
  1015. /// 2.1 - jQuery.data(element, key)
  1016. /// 2.2 - jQuery.data(element)
  1017. /// </summary>
  1018. /// <param name="elem" domElement="true">
  1019. /// The DOM element to associate with the data.
  1020. /// </param>
  1021. /// <param name="name" type="String">
  1022. /// A string naming the piece of data to set.
  1023. /// </param>
  1024. /// <param name="data" type="Object">
  1025. /// The new data value.
  1026. /// </param>
  1027. /// <returns type="jQuery" />
  1028. if (!jQuery.acceptData(elem)) {
  1029. return;
  1030. }
  1031. var internalKey = jQuery.expando, getByName = typeof name === "string", thisCache,
  1032. // We have to handle DOM nodes and JS objects differently because IE6-7
  1033. // can't GC object references properly across the DOM-JS boundary
  1034. isNode = elem.nodeType,
  1035. // Only DOM nodes need the global jQuery cache; JS object data is
  1036. // attached directly to the object so GC can occur automatically
  1037. cache = isNode ? jQuery.cache : elem,
  1038. // Only defining an ID for JS objects if its cache already exists allows
  1039. // the code to shortcut on the same path as a DOM node with no cache
  1040. id = isNode ? elem[jQuery.expando] : elem[jQuery.expando] && jQuery.expando;
  1041. // Avoid doing any more work than we need to when trying to get data on an
  1042. // object that has no data at all
  1043. if ((!id || (pvt && id && !cache[id][internalKey])) && getByName && data === undefined) {
  1044. return;
  1045. }
  1046. if (!id) {
  1047. // Only DOM nodes need a new unique ID for each element since their data
  1048. // ends up in the global cache
  1049. if (isNode) {
  1050. elem[jQuery.expando] = id = ++jQuery.uuid;
  1051. } else {
  1052. id = jQuery.expando;
  1053. }
  1054. }
  1055. if (!cache[id]) {
  1056. cache[id] = {};
  1057. }
  1058. // An object can be passed to jQuery.data instead of a key/value pair; this gets
  1059. // shallow copied over onto the existing cache
  1060. if (typeof name === "object") {
  1061. if (pvt) {
  1062. cache[id][internalKey] = jQuery.extend(cache[id][internalKey], name);
  1063. } else {
  1064. cache[id] = jQuery.extend(cache[id], name);
  1065. }
  1066. }
  1067. thisCache = cache[id];
  1068. // Internal jQuery data is stored in a separate object inside the object's data
  1069. // cache in order to avoid key collisions between internal data and user-defined
  1070. // data
  1071. if (pvt) {
  1072. if (!thisCache[internalKey]) {
  1073. thisCache[internalKey] = {};
  1074. }
  1075. thisCache = thisCache[internalKey];
  1076. }
  1077. if (data !== undefined) {
  1078. thisCache[name] = data;
  1079. }
  1080. // TODO: This is a hack for 1.5 ONLY. It will be removed in 1.6. Users should
  1081. // not attempt to inspect the internal events object using jQuery.data, as this
  1082. // internal data object is undocumented and subject to change.
  1083. if (name === "events" && !thisCache[name]) {
  1084. return thisCache[internalKey] && thisCache[internalKey].events;
  1085. }
  1086. return getByName ? thisCache[name] : thisCache;
  1087. };
  1088. jQuery.dequeue = function (elem, type) {
  1089. /// <summary>
  1090. /// Execute the next function on the queue for the matched element.
  1091. /// </summary>
  1092. /// <param name="elem" domElement="true">
  1093. /// A DOM element from which to remove and execute a queued function.
  1094. /// </param>
  1095. /// <param name="type" type="String">
  1096. /// A string containing the name of the queue. Defaults to fx, the standard effects queue.
  1097. /// </param>
  1098. /// <returns type="jQuery" />
  1099. type = type || "fx";
  1100. var queue = jQuery.queue(elem, type),
  1101. fn = queue.shift();
  1102. // If the fx queue is dequeued, always remove the progress sentinel
  1103. if (fn === "inprogress") {
  1104. fn = queue.shift();
  1105. }
  1106. if (fn) {
  1107. // Add a progress sentinel to prevent the fx queue from being
  1108. // automatically dequeued
  1109. if (type === "fx") {
  1110. queue.unshift("inprogress");
  1111. }
  1112. fn.call(elem, function () {
  1113. jQuery.dequeue(elem, type);
  1114. });
  1115. }
  1116. if (!queue.length) {
  1117. jQuery.removeData(elem, type + "queue", true);
  1118. }
  1119. };
  1120. jQuery.dir = function (elem, dir, until) {
  1121. var matched = [],
  1122. cur = elem[dir];
  1123. while (cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery(cur).is(until))) {
  1124. if (cur.nodeType === 1) {
  1125. matched.push(cur);
  1126. }
  1127. cur = cur[dir];
  1128. }
  1129. return matched;
  1130. };
  1131. jQuery.each = function (object, callback, args) {
  1132. /// <summary>
  1133. /// A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.
  1134. /// </summary>
  1135. /// <param name="object" type="Object">
  1136. /// The object or array to iterate over.
  1137. /// </param>
  1138. /// <param name="callback" type="Function">
  1139. /// The function that will be executed on every object.
  1140. /// </param>
  1141. /// <returns type="Object" />
  1142. var name, i = 0,
  1143. length = object.length,
  1144. isObj = length === undefined || jQuery.isFunction(object);
  1145. if (args) {
  1146. if (isObj) {
  1147. for (name in object) {
  1148. if (callback.apply(object[name], args) === false) {
  1149. break;
  1150. }
  1151. }
  1152. } else {
  1153. for (; i < length; ) {
  1154. if (callback.apply(object[i++], args) === false) {
  1155. break;
  1156. }
  1157. }
  1158. }
  1159. // A special, fast, case for the most common use of each
  1160. } else {
  1161. if (isObj) {
  1162. for (name in object) {
  1163. if (callback.call(object[name], name, object[name]) === false) {
  1164. break;
  1165. }
  1166. }
  1167. } else {
  1168. for (var value = object[0];
  1169. i < length && callback.call(value, i, value) !== false; value = object[++i]) { }
  1170. }
  1171. }
  1172. return object;
  1173. };
  1174. jQuery.easing = {};
  1175. jQuery.error = function (msg) {
  1176. /// <summary>
  1177. /// Takes a string and throws an exception containing it.
  1178. /// </summary>
  1179. /// <param name="msg" type="String">
  1180. /// The message to send out.
  1181. /// </param>
  1182. throw msg;
  1183. };
  1184. jQuery.etag = {};
  1185. jQuery.event = { "global": {},
  1186. "props": ['altKey', 'attrChange', 'attrName', 'bubbles', 'button', 'cancelable', 'charCode', 'clientX', 'clientY', 'ctrlKey', 'currentTarget', 'data', 'detail', 'eventPhase', 'fromElement', 'handler', 'keyCode', 'layerX', 'layerY', 'metaKey', 'newValue', 'offsetX', 'offsetY', 'pageX', 'pageY', 'prevValue', 'relatedNode', 'relatedTarget', 'screenX', 'screenY', 'shiftKey', 'srcElement', 'target', 'toElement', 'view', 'wheelDelta', 'which'],
  1187. "guid": 100000000,
  1188. "special": {},
  1189. "triggered": false
  1190. };
  1191. jQuery.expr = { "order": ['ID', 'CLASS', 'NAME', 'TAG'],
  1192. "match": {},
  1193. "leftMatch": {},
  1194. "attrMap": {},
  1195. "attrHandle": {},
  1196. "relative": {},
  1197. "find": {},
  1198. "preFilter": {},
  1199. "filters": {},
  1200. "setFilters": {},
  1201. "filter": {},
  1202. ":": {}
  1203. };
  1204. jQuery.extend = function () {
  1205. /// <summary>
  1206. /// Merge the contents of two or more objects together into the first object.
  1207. /// 1 - jQuery.extend(target, object1, objectN)
  1208. /// 2 - jQuery.extend(deep, target, object1, objectN)
  1209. /// </summary>
  1210. /// <param name="" type="Boolean">
  1211. /// If true, the merge becomes recursive (aka. deep copy).
  1212. /// </param>
  1213. /// <param name="" type="Object">
  1214. /// The object to extend. It will receive the new properties.
  1215. /// </param>
  1216. /// <param name="" type="Object">
  1217. /// An object containing additional properties to merge in.
  1218. /// </param>
  1219. /// <param name="" type="Object">
  1220. /// Additional objects containing properties to merge in.
  1221. /// </param>
  1222. /// <returns type="Object" />
  1223. var options, name, src, copy, copyIsArray, clone,
  1224. target = arguments[0] || {},
  1225. i = 1,
  1226. length = arguments.length,
  1227. deep = false;
  1228. // Handle a deep copy situation
  1229. if (typeof target === "boolean") {
  1230. deep = target;
  1231. target = arguments[1] || {};
  1232. // skip the boolean and the target
  1233. i = 2;
  1234. }
  1235. // Handle case when target is a string or something (possible in deep copy)
  1236. if (typeof target !== "object" && !jQuery.isFunction(target)) {
  1237. target = {};
  1238. }
  1239. // extend jQuery itself if only one argument is passed
  1240. if (length === i) {
  1241. target = this;
  1242. --i;
  1243. }
  1244. for (; i < length; i++) {
  1245. // Only deal with non-null/undefined values
  1246. if ((options = arguments[i]) != null) {
  1247. // Extend the base object
  1248. for (name in options) {
  1249. src = target[name];
  1250. copy = options[name];
  1251. // Prevent never-ending loop
  1252. if (target === copy) {
  1253. continue;
  1254. }
  1255. // Recurse if we're merging plain objects or arrays
  1256. if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)))) {
  1257. if (copyIsArray) {
  1258. copyIsArray = false;
  1259. clone = src && jQuery.isArray(src) ? src : [];
  1260. } else {
  1261. clone = src && jQuery.isPlainObject(src) ? src : {};
  1262. }
  1263. // Never move original objects, clone them
  1264. target[name] = jQuery.extend(deep, clone, copy);
  1265. // Don't bring in undefined values
  1266. } else if (copy !== undefined) {
  1267. target[name] = copy;
  1268. }
  1269. }
  1270. }
  1271. }
  1272. // Return the modified object
  1273. return target;
  1274. };
  1275. jQuery.filter = function (expr, elems, not) {
  1276. if (not) {
  1277. expr = ":not(" + expr + ")";
  1278. }
  1279. return elems.length === 1 ?
  1280. jQuery.find.matchesSelector(elems[0], expr) ? [elems[0]] : [] :
  1281. jQuery.find.matches(expr, elems);
  1282. };
  1283. jQuery.find = function (query, context, extra, seed) {
  1284. context = context || document;
  1285. // Only use querySelectorAll on non-XML documents
  1286. // (ID selectors don't work in non-HTML documents)
  1287. if (!seed && !Sizzle.isXML(context)) {
  1288. // See if we find a selector to speed up
  1289. var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(query);
  1290. if (match && (context.nodeType === 1 || context.nodeType === 9)) {
  1291. // Speed-up: Sizzle("TAG")
  1292. if (match[1]) {
  1293. return makeArray(context.getElementsByTagName(query), extra);
  1294. // Speed-up: Sizzle(".CLASS")
  1295. } else if (match[2] && Expr.find.CLASS && context.getElementsByClassName) {
  1296. return makeArray(context.getElementsByClassName(match[2]), extra);
  1297. }
  1298. }
  1299. if (context.nodeType === 9) {
  1300. // Speed-up: Sizzle("body")
  1301. // The body element only exists once, optimize finding it
  1302. if (query === "body" && context.body) {
  1303. return makeArray([context.body], extra);
  1304. // Speed-up: Sizzle("#ID")
  1305. } else if (match && match[3]) {
  1306. var elem = context.getElementById(match[3]);
  1307. // Check parentNode to catch when Blackberry 4.6 returns
  1308. // nodes that are no longer in the document #6963
  1309. if (elem && elem.parentNode) {
  1310. // Handle the case where IE and Opera return items
  1311. // by name instead of ID
  1312. if (elem.id === match[3]) {
  1313. return makeArray([elem], extra);
  1314. }
  1315. } else {
  1316. return makeArray([], extra);
  1317. }
  1318. }
  1319. try {
  1320. return makeArray(context.querySelectorAll(query), extra);
  1321. } catch (qsaError) { }
  1322. // qSA works strangely on Element-rooted queries
  1323. // We can work around this by specifying an extra ID on the root
  1324. // and working up from there (Thanks to Andrew Dupont for the technique)
  1325. // IE 8 doesn't work on object elements
  1326. } else if (context.nodeType === 1 && context.nodeName.toLowerCase() !== "object") {
  1327. var old = context.getAttribute("id"),
  1328. nid = old || id,
  1329. hasParent = context.parentNode,
  1330. relativeHierarchySelector = /^\s*[+~]/.test(query);
  1331. if (!old) {
  1332. context.setAttribute("id", nid);
  1333. } else {
  1334. nid = nid.replace(/'/g, "\\$&");
  1335. }
  1336. if (relativeHierarchySelector && hasParent) {
  1337. context = context.parentNode;
  1338. }
  1339. try {
  1340. if (!relativeHierarchySelector || hasParent) {
  1341. return makeArray(context.querySelectorAll("[id='" + nid + "'] " + query), extra);
  1342. }
  1343. } catch (pseudoError) {
  1344. } finally {
  1345. if (!old) {
  1346. context.removeAttribute("id");
  1347. }
  1348. }
  1349. }
  1350. }
  1351. return oldSizzle(query, context, extra, seed);
  1352. };
  1353. jQuery.fn = { "selector": '',
  1354. "jquery": '1.5',
  1355. "length": 0
  1356. };
  1357. jQuery.fragments = {};
  1358. jQuery.fx = function (elem, options, prop) {
  1359. this.options = options;
  1360. this.elem = elem;
  1361. this.prop = prop;
  1362. if (!options.orig) {
  1363. options.orig = {};
  1364. }
  1365. };
  1366. jQuery.get = function (url, data, callback, type) {
  1367. /// <summary>
  1368. /// Load data from the server using a HTTP GET request.
  1369. /// </summary>
  1370. /// <param name="url" type="String">
  1371. /// A string containing the URL to which the request is sent.
  1372. /// </param>
  1373. /// <param name="data" type="String">
  1374. /// A map or string that is sent to the server with the request.
  1375. /// </param>
  1376. /// <param name="callback" type="Function">
  1377. /// A callback function that is executed if the request succeeds.
  1378. /// </param>
  1379. /// <param name="type" type="String">
  1380. /// The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html).
  1381. /// </param>
  1382. // shift arguments if data argument was omitted
  1383. if (jQuery.isFunction(data)) {
  1384. type = type || callback;
  1385. callback = data;
  1386. data = null;
  1387. }
  1388. return jQuery.ajax({
  1389. type: method,
  1390. url: url,
  1391. data: data,
  1392. success: callback,
  1393. dataType: type
  1394. });
  1395. };
  1396. jQuery.getJSON = function (url, data, callback) {
  1397. /// <summary>
  1398. /// Load JSON-encoded data from the server using a GET HTTP request.
  1399. /// </summary>
  1400. /// <param name="url" type="String">
  1401. /// A string containing the URL to which the request is sent.
  1402. /// </param>
  1403. /// <param name="data" type="Object">
  1404. /// A map or string that is sent to the server with the request.
  1405. /// </param>
  1406. /// <param name="callback" type="Function">
  1407. /// A callback function that is executed if the request succeeds.
  1408. /// </param>
  1409. /// <returns type="XMLHttpRequest" />
  1410. return jQuery.get(url, data, callback, "json");
  1411. };
  1412. jQuery.getScript = function (url, callback) {
  1413. /// <summary>
  1414. /// Load a JavaScript file from the server using a GET HTTP request, then execute it.
  1415. /// </summary>
  1416. /// <param name="url" type="String">
  1417. /// A string containing the URL to which the request is sent.
  1418. /// </param>
  1419. /// <param name="callback" type="Function">
  1420. /// A callback function that is executed if the request succeeds.
  1421. /// </param>
  1422. /// <returns type="XMLHttpRequest" />
  1423. return jQuery.get(url, null, callback, "script");
  1424. };
  1425. jQuery.globalEval = function (data) {
  1426. /// <summary>
  1427. /// Execute some JavaScript code globally.
  1428. /// </summary>
  1429. /// <param name="data" type="String">
  1430. /// The JavaScript code to execute.
  1431. /// </param>
  1432. if (data && rnotwhite.test(data)) {
  1433. // Inspired by code by Andrea Giammarchi
  1434. // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
  1435. var head = document.getElementsByTagName("head")[0] || document.documentElement,
  1436. script = document.createElement("script");
  1437. script.type = "text/javascript";
  1438. if (jQuery.support.scriptEval()) {
  1439. script.appendChild(document.createTextNode(data));
  1440. } else {
  1441. script.text = data;
  1442. }
  1443. // Use insertBefore instead of appendChild to circumvent an IE6 bug.
  1444. // This arises when a base node is used (#2709).
  1445. head.insertBefore(script, head.firstChild);
  1446. head.removeChild(script);
  1447. }
  1448. };
  1449. jQuery.grep = function (elems, callback, inv) {
  1450. /// <summary>
  1451. /// Finds the elements of an array which satisfy a filter function. The original array is not affected.
  1452. /// </summary>
  1453. /// <param name="elems" type="Array">
  1454. /// The array to search through.
  1455. /// </param>
  1456. /// <param name="callback" type="Function">
  1457. /// The function to process each item against. The first argument to the function is the item, and the second argument is the index. The function should return a Boolean value. this will be the global window object.
  1458. /// </param>
  1459. /// <param name="inv" type="Boolean">
  1460. /// If "invert" is false, or not provided, then the function returns an array consisting of all elements for which "callback" returns true. If "invert" is true, then the function returns an array consisting of all elements for which "callback" returns false.
  1461. /// </param>
  1462. /// <returns type="Array" />
  1463. var ret = [], retVal;
  1464. inv = !!inv;
  1465. // Go through the array, only saving the items
  1466. // that pass the validator function
  1467. for (var i = 0, length = elems.length; i < length; i++) {
  1468. retVal = !!callback(elems[i], i);
  1469. if (inv !== retVal) {
  1470. ret.push(elems[i]);
  1471. }
  1472. }
  1473. return ret;
  1474. };
  1475. jQuery.guid = 1;
  1476. jQuery.hasData = function (elem) {
  1477. elem = elem.nodeType ? jQuery.cache[elem[jQuery.expando]] : elem[jQuery.expando];
  1478. return !!elem && !jQuery.isEmptyObject(elem);
  1479. };
  1480. jQuery.inArray = function (elem, array) {
  1481. /// <summary>
  1482. /// Search for a specified value within an array and return its index (or -1 if not found).
  1483. /// </summary>
  1484. /// <param name="elem" type="Object">
  1485. /// The value to search for.
  1486. /// </param>
  1487. /// <param name="array" type="Array">
  1488. /// An array through which to search.
  1489. /// </param>
  1490. /// <returns type="Number" />
  1491. return indexOf.call(array, elem);
  1492. };
  1493. jQuery.isEmptyObject = function (obj) {
  1494. /// <summary>
  1495. /// Check to see if an object is empty (contains no properties).
  1496. /// </summary>
  1497. /// <param name="obj" type="Object">
  1498. /// The object that will be checked to see if it's empty.
  1499. /// </param>
  1500. /// <returns type="Boolean" />
  1501. for (var name in obj) {
  1502. return false;
  1503. }
  1504. return true;
  1505. };
  1506. jQuery.isFunction = function (obj) {
  1507. /// <summary>
  1508. /// Determine if the argument passed is a Javascript function object.
  1509. /// </summary>
  1510. /// <param name="obj" type="Object">
  1511. /// Object to test whether or not it is a function.
  1512. /// </param>
  1513. /// <returns type="boolean" />
  1514. return jQuery.type(obj) === "function";
  1515. };
  1516. jQuery.isNaN = function (obj) {
  1517. return obj == null || !rdigit.test(obj) || isNaN(obj);
  1518. };
  1519. jQuery.isPlainObject = function (obj) {
  1520. /// <summary>
  1521. /// Check to see if an object is a plain object (created using "{}" or "new Object").
  1522. /// </summary>
  1523. /// <param name="obj" type="Object">
  1524. /// The object that will be checked to see if it's a plain object.
  1525. /// </param>
  1526. /// <returns type="Boolean" />
  1527. // Must be an Object.
  1528. // Because of IE, we also have to check the presence of the constructor property.
  1529. // Make sure that DOM nodes and window objects don't pass through, as well
  1530. if (!obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow(obj)) {
  1531. return false;
  1532. }
  1533. // Not own constructor property must be Object
  1534. if (obj.constructor &&
  1535. !hasOwn.call(obj, "constructor") &&
  1536. !hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) {
  1537. return false;
  1538. }
  1539. // Own properties are enumerated firstly, so to speed up,
  1540. // if last one is own, then all properties are own.
  1541. var key;
  1542. for (key in obj) { }
  1543. return key === undefined || hasOwn.call(obj, key);
  1544. };
  1545. jQuery.isReady = true;
  1546. jQuery.isWindow = function (obj) {
  1547. /// <summary>
  1548. /// Determine whether the argument is a window.
  1549. /// </summary>
  1550. /// <param name="obj" type="Object">
  1551. /// Object to test whether or not it is a window.
  1552. /// </param>
  1553. /// <returns type="boolean" />
  1554. return obj && typeof obj === "object" && "setInterval" in obj;
  1555. };
  1556. jQuery.isXMLDoc = function (elem) {
  1557. /// <summary>
  1558. /// Check to see if a DOM node is within an XML document (or is an XML document).
  1559. /// </summary>
  1560. /// <param name="elem" domElement="true">
  1561. /// The DOM node that will be checked to see if it's in an XML document.
  1562. /// </param>
  1563. /// <returns type="Boolean" />
  1564. // documentElement is verified for cases where it doesn't yet exist
  1565. // (such as loading iframes in IE - #4833)
  1566. var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
  1567. return documentElement ? documentElement.nodeName !== "HTML" : false;
  1568. };
  1569. jQuery.lastModified = {};
  1570. jQuery.makeArray = function (array, results) {
  1571. /// <summary>
  1572. /// Convert an array-like object into a true JavaScript array.
  1573. /// </summary>
  1574. /// <param name="array" type="Object">
  1575. /// Any object to turn into a native Array.
  1576. /// </param>
  1577. /// <returns type="Array" />
  1578. var ret = results || [];
  1579. if (array != null) {
  1580. // The window, strings (and functions) also have 'length'
  1581. // The extra typeof function check is to prevent crashes
  1582. // in Safari 2 (See: #3039)
  1583. // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
  1584. var type = jQuery.type(array);
  1585. if (array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow(array)) {
  1586. push.call(ret, array);
  1587. } else {
  1588. jQuery.merge(ret, array);
  1589. }
  1590. }
  1591. return ret;
  1592. };
  1593. jQuery.map = function (elems, callback, arg) {
  1594. /// <summary>
  1595. /// Translate all items in an array or array-like object to another array of items.
  1596. /// </summary>
  1597. /// <param name="elems" type="Array">
  1598. /// The Array to translate.
  1599. /// </param>
  1600. /// <param name="callback" type="Function">
  1601. /// The function to process each item against. The first argument to the function is the list item, the second argument is the index in array The function can return any value. this will be the global window object.
  1602. /// </param>
  1603. /// <returns type="Array" />
  1604. var ret = [], value;
  1605. // Go through the array, translating each of the items to their
  1606. // new value (or values).
  1607. for (var i = 0, length = elems.length; i < length; i++) {
  1608. value = callback(elems[i], i, arg);
  1609. if (value != null) {
  1610. ret[ret.length] = value;
  1611. }
  1612. }
  1613. // Flatten any nested arrays
  1614. return ret.concat.apply([], ret);
  1615. };
  1616. jQuery.merge = function (first, second) {
  1617. /// <summary>
  1618. /// Merge the contents of two arrays together into the first array.
  1619. /// </summary>
  1620. /// <param name="first" type="Array">
  1621. /// The first array to merge, the elements of second added.
  1622. /// </param>
  1623. /// <param name="second" type="Array">
  1624. /// The second array to merge into the first, unaltered.
  1625. /// </param>
  1626. /// <returns type="Array" />
  1627. var i = first.length,
  1628. j = 0;
  1629. if (typeof second.length === "number") {
  1630. for (var l = second.length; j < l; j++) {
  1631. first[i++] = second[j];
  1632. }
  1633. } else {
  1634. while (second[j] !== undefined) {
  1635. first[i++] = second[j++];
  1636. }
  1637. }
  1638. first.length = i;
  1639. return first;
  1640. };
  1641. jQuery.noConflict = function (deep) {
  1642. /// <summary>
  1643. /// Relinquish jQuery's control of the $ variable.
  1644. /// </summary>
  1645. /// <param name="deep" type="Boolean">
  1646. /// A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself).
  1647. /// </param>
  1648. /// <returns type="Object" />
  1649. window.$ = _$;
  1650. if (deep) {
  1651. window.jQuery = _jQuery;
  1652. }
  1653. return jQuery;
  1654. };
  1655. jQuery.noData = { "embed": true,
  1656. "object": 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000',
  1657. "applet": true
  1658. };
  1659. jQuery.nodeName = function (elem, name) {
  1660. return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
  1661. };
  1662. jQuery.noop = function () {
  1663. /// <summary>
  1664. /// An empty function.
  1665. /// </summary>
  1666. /// <returns type="Function" />
  1667. };
  1668. jQuery.now = function () {
  1669. return (new Date()).getTime();
  1670. };
  1671. jQuery.nth = function (cur, result, dir, elem) {
  1672. result = result || 1;
  1673. var num = 0;
  1674. for (; cur; cur = cur[dir]) {
  1675. if (cur.nodeType === 1 && ++num === result) {
  1676. break;
  1677. }
  1678. }
  1679. return cur;
  1680. };
  1681. jQuery.offset = {};
  1682. jQuery.param = function (a, traditional) {
  1683. /// <summary>
  1684. /// Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request.
  1685. /// 1 - jQuery.param(obj)
  1686. /// 2 - jQuery.param(obj, traditional)
  1687. /// </summary>
  1688. /// <param name="a" type="Object">
  1689. /// An array or object to serialize.
  1690. /// </param>
  1691. /// <param name="traditional" type="Boolean">
  1692. /// A Boolean indicating whether to perform a traditional "shallow" serialization.
  1693. /// </param>
  1694. /// <returns type="String" />
  1695. var s = [],
  1696. add = function (key, value) {
  1697. // If value is a function, invoke it and return its value
  1698. value = jQuery.isFunction(value) ? value() : value;
  1699. s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value);
  1700. };
  1701. // Set traditional to true for jQuery <= 1.3.2 behavior.
  1702. if (traditional === undefined) {
  1703. traditional = jQuery.ajaxSettings.traditional;
  1704. }
  1705. // If an array was passed in, assume that it is an array of form elements.
  1706. if (jQuery.isArray(a) || a.jquery) {
  1707. // Serialize the form elements
  1708. jQuery.each(a, function () {
  1709. add(this.name, this.value);
  1710. });
  1711. } else {
  1712. // If traditional, encode the "old" way (the way 1.3.2 or older
  1713. // did it), otherwise encode params recursively.
  1714. for (var prefix in a) {
  1715. buildParams(prefix, a[prefix], traditional, add);
  1716. }
  1717. }
  1718. // Return the resulting serialization
  1719. return s.join("&").replace(r20, "+");
  1720. };
  1721. jQuery.parseJSON = function (data) {
  1722. /// <summary>
  1723. /// Takes a well-formed JSON string and returns the resulting JavaScript object.
  1724. /// </summary>
  1725. /// <param name="data" type="String">
  1726. /// The JSON string to parse.
  1727. /// </param>
  1728. /// <returns type="Object" />
  1729. if (typeof data !== "string" || !data) {
  1730. return null;
  1731. }
  1732. // Make sure leading/trailing whitespace is removed (IE can't handle it)
  1733. data = jQuery.trim(data);
  1734. // Make sure the incoming data is actual JSON
  1735. // Logic borrowed from http://json.org/json2.js
  1736. if (rvalidchars.test(data.replace(rvalidescape, "@")
  1737. .replace(rvalidtokens, "]")
  1738. .replace(rvalidbraces, ""))) {
  1739. // Try to use the native JSON parser first
  1740. return window.JSON && window.JSON.parse ?
  1741. window.JSON.parse(data) :
  1742. (new Function("return " + data))();
  1743. } else {
  1744. jQuery.error("Invalid JSON: " + data);
  1745. }
  1746. };
  1747. jQuery.parseXML = function (data, xml, tmp) {
  1748. /// <summary>
  1749. /// Parses a string into an XML document.
  1750. /// </summary>
  1751. /// <param name="data" type="String">
  1752. /// a well-formed XML string to be parsed
  1753. /// </param>
  1754. /// <returns type="XMLDocument" />
  1755. if (window.DOMParser) { // Standard
  1756. tmp = new DOMParser();
  1757. xml = tmp.parseFromString(data, "text/xml");
  1758. } else { // IE
  1759. xml = new ActiveXObject("Microsoft.XMLDOM");
  1760. xml.async = "false";
  1761. xml.loadXML(data);
  1762. }
  1763. tmp = xml.documentElement;
  1764. if (!tmp || !tmp.nodeName || tmp.nodeName === "parsererror") {
  1765. jQuery.error("Invalid XML: " + data);
  1766. }
  1767. return xml;
  1768. };
  1769. jQuery.post = function (url, data, callback, type) {
  1770. /// <summary>
  1771. /// Load data from the server using a HTTP POST request.
  1772. /// </summary>
  1773. /// <param name="url" type="String">
  1774. /// A string containing the URL to which the request is sent.
  1775. /// </param>
  1776. /// <param name="data" type="String">
  1777. /// A map or string that is sent to the server with the request.
  1778. /// </param>
  1779. /// <param name="callback" type="Function">
  1780. /// A callback function that is executed if the request succeeds.
  1781. /// </param>
  1782. /// <param name="type" type="String">
  1783. /// The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html).
  1784. /// </param>
  1785. /// <returns type="XMLHttpRequest" />
  1786. // shift arguments if data argument was omitted
  1787. if (jQuery.isFunction(data)) {
  1788. type = type || callback;
  1789. callback = data;
  1790. data = null;
  1791. }
  1792. return jQuery.ajax({
  1793. type: method,
  1794. url: url,
  1795. data: data,
  1796. success: callback,
  1797. dataType: type
  1798. });
  1799. };
  1800. jQuery.props = { "for": 'htmlFor',
  1801. "class": 'className',
  1802. "readonly": 'readOnly',
  1803. "maxlength": 'maxLength',
  1804. "cellspacing": 'cellSpacing',
  1805. "rowspan": 'rowSpan',
  1806. "colspan": 'colSpan',
  1807. "tabindex": 'tabIndex',
  1808. "usemap": 'useMap',
  1809. "frameborder": 'frameBorder'
  1810. };
  1811. jQuery.proxy = function (fn, proxy, thisObject) {
  1812. /// <summary>
  1813. /// Takes a function and returns a new one that will always have a particular context.
  1814. /// 1 - jQuery.proxy(function, context)
  1815. /// 2 - jQuery.proxy(context, name)
  1816. /// </summary>
  1817. /// <param name="fn" type="Function">
  1818. /// The function whose context will be changed.
  1819. /// </param>
  1820. /// <param name="proxy" type="Object">
  1821. /// The object to which the context (`this`) of the function should be set.
  1822. /// </param>
  1823. /// <returns type="Function" />
  1824. if (arguments.length === 2) {
  1825. if (typeof proxy === "string") {
  1826. thisObject = fn;
  1827. fn = thisObject[proxy];
  1828. proxy = undefined;
  1829. } else if (proxy && !jQuery.isFunction(proxy)) {
  1830. thisObject = proxy;
  1831. proxy = undefined;
  1832. }
  1833. }
  1834. if (!proxy && fn) {
  1835. proxy = function () {
  1836. return fn.apply(thisObject || this, arguments);
  1837. };
  1838. }
  1839. // Set the guid of unique handler to the same of original handler, so it can be removed
  1840. if (fn) {
  1841. proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
  1842. }
  1843. // So proxy can be declared as an argument
  1844. return proxy;
  1845. };
  1846. jQuery.queue = function (elem, type, data) {
  1847. /// <summary>
  1848. /// 1: Show the queue of functions to be executed on the matched element.
  1849. /// 1.1 - jQuery.queue(element, queueName)
  1850. /// 2: Manipulate the queue of functions to be executed on the matched element.
  1851. /// 2.1 - jQuery.queue(element, queueName, newQueue)
  1852. /// 2.2 - jQuery.queue(element, queueName, callback())
  1853. /// </summary>
  1854. /// <param name="elem" domElement="true">
  1855. /// A DOM element where the array of queued functions is attached.
  1856. /// </param>
  1857. /// <param name="type" type="String">
  1858. /// A string containing the name of the queue. Defaults to fx, the standard effects queue.
  1859. /// </param>
  1860. /// <param name="data" type="Array">
  1861. /// An array of functions to replace the current queue contents.
  1862. /// </param>
  1863. /// <returns type="jQuery" />
  1864. if (!elem) {
  1865. return;
  1866. }
  1867. type = (type || "fx") + "queue";
  1868. var q = jQuery._data(elem, type);
  1869. // Speed up dequeue by getting out quickly if this is just a lookup
  1870. if (!data) {
  1871. return q || [];
  1872. }
  1873. if (!q || jQuery.isArray(data)) {
  1874. q = jQuery._data(elem, type, jQuery.makeArray(data));
  1875. } else {
  1876. q.push(data);
  1877. }
  1878. return q;
  1879. };
  1880. jQuery.ready = function (wait) {
  1881. // A third-party is pushing the ready event forwards
  1882. if (wait === true) {
  1883. jQuery.readyWait--;
  1884. }
  1885. // Make sure that the DOM is not already loaded
  1886. if (!jQuery.readyWait || (wait !== true && !jQuery.isReady)) {
  1887. // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
  1888. if (!document.body) {
  1889. return setTimeout(jQuery.ready, 1);
  1890. }
  1891. // Remember that the DOM is ready
  1892. jQuery.isReady = true;
  1893. // If a normal DOM Ready event fired, decrement, and wait if need be
  1894. if (wait !== true && --jQuery.readyWait > 0) {
  1895. return;
  1896. }
  1897. // If there are functions bound, to execute
  1898. readyList.resolveWith(document, [jQuery]);
  1899. // Trigger any bound ready events
  1900. if (jQuery.fn.trigger) {
  1901. jQuery(document).trigger("ready").unbind("ready");
  1902. }
  1903. }
  1904. };
  1905. jQuery.readyWait = 0;
  1906. jQuery.removeData = function (elem, name, pvt /* Internal Use Only */) {
  1907. /// <summary>
  1908. /// Remove a previously-stored piece of data.
  1909. /// </summary>
  1910. /// <param name="elem" domElement="true">
  1911. /// A DOM element from which to remove data.
  1912. /// </param>
  1913. /// <param name="name" type="String">
  1914. /// A string naming the piece of data to remove.
  1915. /// </param>
  1916. /// <returns type="jQuery" />
  1917. if (!jQuery.acceptData(elem)) {
  1918. return;
  1919. }
  1920. var internalKey = jQuery.expando, isNode = elem.nodeType,
  1921. // See jQuery.data for more information
  1922. cache = isNode ? jQuery.cache : elem,
  1923. // See jQuery.data for more information
  1924. id = isNode ? elem[jQuery.expando] : jQuery.expando;
  1925. // If there is already no cache entry for this object, there is no
  1926. // purpose in continuing
  1927. if (!cache[id]) {
  1928. return;
  1929. }
  1930. if (name) {
  1931. var thisCache = pvt ? cache[id][internalKey] : cache[id];
  1932. if (thisCache) {
  1933. delete thisCache[name];
  1934. // If there is no data left in the cache, we want to continue
  1935. // and let the cache object itself get destroyed
  1936. if (!jQuery.isEmptyObject(thisCache)) {
  1937. return;
  1938. }
  1939. }
  1940. }
  1941. // See jQuery.data for more information
  1942. if (pvt) {
  1943. delete cache[id][internalKey];
  1944. // Don't destroy the parent cache unless the internal data object
  1945. // had been the only thing left in it
  1946. if (!jQuery.isEmptyObject(cache[id])) {
  1947. return;
  1948. }
  1949. }
  1950. var internalCache = cache[id][internalKey];
  1951. // Browsers that fail expando deletion also refuse to delete expandos on
  1952. // the window, but it will allow it on all other JS objects; other browsers
  1953. // don't care
  1954. if (jQuery.support.deleteExpando || cache != window) {
  1955. delete cache[id];
  1956. } else {
  1957. cache[id] = null;
  1958. }
  1959. // We destroyed the entire user cache at once because it's faster than
  1960. // iterating through each key, but we need to continue to persist internal
  1961. // data if it existed
  1962. if (internalCache) {
  1963. cache[id] = {};
  1964. cache[id][internalKey] = internalCache;
  1965. // Otherwise, we need to eliminate the expando on the node to avoid
  1966. // false lookups in the cache for entries that no longer exist
  1967. } else if (isNode) {
  1968. // IE does not allow us to delete expando properties from nodes,
  1969. // nor does it have a removeAttribute function on Document nodes;
  1970. // we must handle all of these cases
  1971. if (jQuery.support.deleteExpando) {
  1972. delete elem[jQuery.expando];
  1973. } else if (elem.removeAttribute) {
  1974. elem.removeAttribute(jQuery.expando);
  1975. } else {
  1976. elem[jQuery.expando] = null;
  1977. }
  1978. }
  1979. };
  1980. jQuery.removeEvent = function (elem, type, handle) {
  1981. if (elem.removeEventListener) {
  1982. elem.removeEventListener(type, handle, false);
  1983. }
  1984. };
  1985. jQuery.sibling = function (n, elem) {
  1986. var r = [];
  1987. for (; n; n = n.nextSibling) {
  1988. if (n.nodeType === 1 && n !== elem) {
  1989. r.push(n);
  1990. }
  1991. }
  1992. return r;
  1993. };
  1994. jQuery.speed = function (speed, easing, fn) {
  1995. var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
  1996. complete: fn || !fn && easing ||
  1997. jQuery.isFunction(speed) && speed,
  1998. duration: speed,
  1999. easing: fn && easing || easing && !jQuery.isFunction(easing) && easing
  2000. };
  2001. opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
  2002. opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[opt.duration] : jQuery.fx.speeds._default;
  2003. // Queueing
  2004. opt.old = opt.complete;
  2005. opt.complete = function () {
  2006. if (opt.queue !== false) {
  2007. jQuery(this).dequeue();
  2008. }
  2009. if (jQuery.isFunction(opt.old)) {
  2010. opt.old.call(this);
  2011. }
  2012. };
  2013. return opt;
  2014. };
  2015. jQuery.style = function (elem, name, value, extra) {
  2016. // Don't set styles on text and comment nodes
  2017. if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
  2018. return;
  2019. }
  2020. // Make sure that we're working with the right name
  2021. var ret, origName = jQuery.camelCase(name),
  2022. style = elem.style, hooks = jQuery.cssHooks[origName];
  2023. name = jQuery.cssProps[origName] || origName;
  2024. // Check if we're setting a value
  2025. if (value !== undefined) {
  2026. // Make sure that NaN and null values aren't set. See: #7116
  2027. if (typeof value === "number" && isNaN(value) || value == null) {
  2028. return;
  2029. }
  2030. // If a number was passed in, add 'px' to the (except for certain CSS properties)
  2031. if (typeof value === "number" && !jQuery.cssNumber[origName]) {
  2032. value += "px";
  2033. }
  2034. // If a hook was provided, use that value, otherwise just set the specified value
  2035. if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value)) !== undefined) {
  2036. // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
  2037. // Fixes bug #5509
  2038. try {
  2039. style[name] = value;
  2040. } catch (e) { }
  2041. }
  2042. } else {
  2043. // If a hook was provided get the non-computed value from there
  2044. if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
  2045. return ret;
  2046. }
  2047. // Otherwise just get the value from the style object
  2048. return style[name];
  2049. }
  2050. };
  2051. jQuery.sub = function () {
  2052. /// <summary>
  2053. /// Creates a new copy of jQuery whose properties and methods can be modified without affecting the original jQuery object.
  2054. /// </summary>
  2055. /// <returns type="jQuery" />
  2056. function jQuerySubclass(selector, context) {
  2057. return new jQuerySubclass.fn.init(selector, context);
  2058. }
  2059. jQuery.extend(true, jQuerySubclass, this);
  2060. jQuerySubclass.superclass = this;
  2061. jQuerySubclass.fn = jQuerySubclass.prototype = this();
  2062. jQuerySubclass.fn.constructor = jQuerySubclass;
  2063. jQuerySubclass.subclass = this.subclass;
  2064. jQuerySubclass.fn.init = function init(selector, context) {
  2065. if (context && context instanceof jQuery && !(context instanceof jQuerySubclass)) {
  2066. context = jQuerySubclass(context);
  2067. }
  2068. return jQuery.fn.init.call(this, selector, context, rootjQuerySubclass);
  2069. };
  2070. jQuerySubclass.fn.init.prototype = jQuerySubclass.fn;
  2071. var rootjQuerySubclass = jQuerySubclass(document);
  2072. return jQuerySubclass;
  2073. };
  2074. jQuery.support = { "leadingWhitespace": true,
  2075. "tbody": true,
  2076. "htmlSerialize": true,
  2077. "style": true,
  2078. "hrefNormalized": true,
  2079. "opacity": true,
  2080. "cssFloat": true,
  2081. "checkOn": false,
  2082. "optSelected": true,
  2083. "deleteExpando": true,
  2084. "optDisabled": true,
  2085. "checkClone": true,
  2086. "_scriptEval": {},
  2087. "noCloneEvent": true,
  2088. "boxModel": true,
  2089. "inlineBlockNeedsLayout": false,
  2090. "shrinkWrapBlocks": false,
  2091. "reliableHiddenOffsets": true,
  2092. "submitBubbles": true,
  2093. "changeBubbles": true,
  2094. "ajax": true,
  2095. "cors": true
  2096. };
  2097. jQuery.swap = function (elem, options, callback) {
  2098. var old = {};
  2099. // Remember the old values, and insert the new ones
  2100. for (var name in options) {
  2101. old[name] = elem.style[name];
  2102. elem.style[name] = options[name];
  2103. }
  2104. callback.call(elem);
  2105. // Revert the old values
  2106. for (name in options) {
  2107. elem.style[name] = old[name];
  2108. }
  2109. };
  2110. jQuery.text = function (elems) {
  2111. var ret = "", elem;
  2112. for (var i = 0; elems[i]; i++) {
  2113. elem = elems[i];
  2114. // Get the text from text nodes and CDATA nodes
  2115. if (elem.nodeType === 3 || elem.nodeType === 4) {
  2116. ret += elem.nodeValue;
  2117. // Traverse everything else, except comment nodes
  2118. } else if (elem.nodeType !== 8) {
  2119. ret += Sizzle.getText(elem.childNodes);
  2120. }
  2121. }
  2122. return ret;
  2123. };
  2124. jQuery.trim = function (text) {
  2125. /// <summary>
  2126. /// Remove the whitespace from the beginning and end of a string.
  2127. /// </summary>
  2128. /// <param name="text" type="String">
  2129. /// The string to trim.
  2130. /// </param>
  2131. /// <returns type="String" />
  2132. return text == null ?
  2133. "" :
  2134. trim.call(text);
  2135. };
  2136. jQuery.type = function (obj) {
  2137. /// <summary>
  2138. /// Determine the internal JavaScript [[Class]] of an object.
  2139. /// </summary>
  2140. /// <param name="obj" type="Object">
  2141. /// Object to get the internal JavaScript [[Class]] of.
  2142. /// </param>
  2143. /// <returns type="String" />
  2144. return obj == null ?
  2145. String(obj) :
  2146. class2type[toString.call(obj)] || "object";
  2147. };
  2148. jQuery.uaMatch = function (ua) {
  2149. ua = ua.toLowerCase();
  2150. var match = rwebkit.exec(ua) ||
  2151. ropera.exec(ua) ||
  2152. rmsie.exec(ua) ||
  2153. ua.indexOf("compatible") < 0 && rmozilla.exec(ua) ||
  2154. [];
  2155. return { browser: match[1] || "", version: match[2] || "0" };
  2156. };
  2157. jQuery.unique = function (results) {
  2158. /// <summary>
  2159. /// Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.
  2160. /// </summary>
  2161. /// <param name="results" type="Array">
  2162. /// The Array of DOM elements.
  2163. /// </param>
  2164. /// <returns type="Array" />
  2165. if (sortOrder) {
  2166. hasDuplicate = baseHasDuplicate;
  2167. results.sort(sortOrder);
  2168. if (hasDuplicate) {
  2169. for (var i = 1; i < results.length; i++) {
  2170. if (results[i] === results[i - 1]) {
  2171. results.splice(i--, 1);
  2172. }
  2173. }
  2174. }
  2175. }
  2176. return results;
  2177. };
  2178. jQuery.uuid = 0;
  2179. jQuery.when = function (object) {
  2180. /// <summary>
  2181. /// Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.
  2182. /// </summary>
  2183. /// <param name="object" type="Deferred">
  2184. /// One or more Deferred objects, or plain JavaScript objects.
  2185. /// </param>
  2186. /// <returns type="Deferred" />
  2187. var args = arguments,
  2188. length = args.length,
  2189. deferred = length <= 1 && object && jQuery.isFunction(object.promise) ?
  2190. object :
  2191. jQuery.Deferred(),
  2192. promise = deferred.promise(),
  2193. resolveArray;
  2194. if (length > 1) {
  2195. resolveArray = new Array(length);
  2196. jQuery.each(args, function (index, element) {
  2197. jQuery.when(element).then(function (value) {
  2198. resolveArray[index] = arguments.length > 1 ? slice.call(arguments, 0) : value;
  2199. if (! --length) {
  2200. deferred.resolveWith(promise, resolveArray);
  2201. }
  2202. }, deferred.reject);
  2203. });
  2204. } else if (deferred !== object) {
  2205. deferred.resolve(object);
  2206. }
  2207. return promise;
  2208. };
  2209. jQuery.Event.prototype.isDefaultPrevented = function returnFalse() {
  2210. /// <summary>
  2211. /// Returns whether event.preventDefault() was ever called on this event object.
  2212. /// </summary>
  2213. /// <returns type="Boolean" />
  2214. return false;
  2215. };
  2216. jQuery.Event.prototype.isImmediatePropagationStopped = function returnFalse() {
  2217. /// <summary>
  2218. /// Returns whether event.stopImmediatePropagation() was ever called on this event object.
  2219. /// </summary>
  2220. /// <returns type="Boolean" />
  2221. return false;
  2222. };
  2223. jQuery.Event.prototype.isPropagationStopped = function returnFalse() {
  2224. /// <summary>
  2225. /// Returns whether event.stopPropagation() was ever called on this event object.
  2226. /// </summary>
  2227. /// <returns type="Boolean" />
  2228. return false;
  2229. };
  2230. jQuery.Event.prototype.preventDefault = function () {
  2231. /// <summary>
  2232. /// If this method is called, the default action of the event will not be triggered.
  2233. /// </summary>
  2234. /// <returns type="undefined" />
  2235. this.isDefaultPrevented = returnTrue;
  2236. var e = this.originalEvent;
  2237. if (!e) {
  2238. return;
  2239. }
  2240. // if preventDefault exists run it on the original event
  2241. if (e.preventDefault) {
  2242. e.preventDefault();
  2243. // otherwise set the returnValue property of the original event to false (IE)
  2244. } else {
  2245. e.returnValue = false;
  2246. }
  2247. };
  2248. jQuery.Event.prototype.stopImmediatePropagation = function () {
  2249. /// <summary>
  2250. /// Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree.
  2251. /// </summary>
  2252. this.isImmediatePropagationStopped = returnTrue;
  2253. this.stopPropagation();
  2254. };
  2255. jQuery.Event.prototype.stopPropagation = function () {
  2256. /// <summary>
  2257. /// Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.
  2258. /// </summary>
  2259. this.isPropagationStopped = returnTrue;
  2260. var e = this.originalEvent;
  2261. if (!e) {
  2262. return;
  2263. }
  2264. // if stopPropagation exists run it on the original event
  2265. if (e.stopPropagation) {
  2266. e.stopPropagation();
  2267. }
  2268. // otherwise set the cancelBubble property of the original event to true (IE)
  2269. e.cancelBubble = true;
  2270. };
  2271. jQuery.prototype._toggle = function (fn) {
  2272. // Save reference to arguments for access in closure
  2273. var args = arguments,
  2274. i = 1;
  2275. // link all the functions, so any of them can unbind this click handler
  2276. while (i < args.length) {
  2277. jQuery.proxy(fn, args[i++]);
  2278. }
  2279. return this.click(jQuery.proxy(fn, function (event) {
  2280. // Figure out which function to execute
  2281. var lastToggle = (jQuery._data(this, "lastToggle" + fn.guid) || 0) % i;
  2282. jQuery._data(this, "lastToggle" + fn.guid, lastToggle + 1);
  2283. // Make sure that clicks stop
  2284. event.preventDefault();
  2285. // and execute the function
  2286. return args[lastToggle].apply(this, arguments) || false;
  2287. }));
  2288. };
  2289. jQuery.prototype.add = function (selector, context) {
  2290. /// <summary>
  2291. /// Add elements to the set of matched elements.
  2292. /// 1 - add(selector)
  2293. /// 2 - add(elements)
  2294. /// 3 - add(html)
  2295. /// 4 - add(selector, context)
  2296. /// </summary>
  2297. /// <param name="selector" type="String">
  2298. /// A string containing a selector expression to match additional elements against.
  2299. /// </param>
  2300. /// <param name="context" domElement="true">
  2301. /// The point in the document at which the selector should begin matching; similar to the context argument of the $() method.
  2302. /// </param>
  2303. /// <returns type="jQuery" />
  2304. var set = typeof selector === "string" ?
  2305. jQuery(selector, context) :
  2306. jQuery.makeArray(selector),
  2307. all = jQuery.merge(this.get(), set);
  2308. return this.pushStack(isDisconnected(set[0]) || isDisconnected(all[0]) ?
  2309. all :
  2310. jQuery.unique(all));
  2311. };
  2312. jQuery.prototype.addClass = function (value) {
  2313. /// <summary>
  2314. /// Adds the specified class(es) to each of the set of matched elements.
  2315. /// 1 - addClass(className)
  2316. /// 2 - addClass(function(index, class))
  2317. /// </summary>
  2318. /// <param name="value" type="String">
  2319. /// One or more class names to be added to the class attribute of each matched element.
  2320. /// </param>
  2321. /// <returns type="jQuery" />
  2322. if (jQuery.isFunction(value)) {
  2323. return this.each(function (i) {
  2324. var self = jQuery(this);
  2325. self.addClass(value.call(this, i, self.attr("class")));
  2326. });
  2327. }
  2328. if (value && typeof value === "string") {
  2329. var classNames = (value || "").split(rspaces);
  2330. for (var i = 0, l = this.length; i < l; i++) {
  2331. var elem = this[i];
  2332. if (elem.nodeType === 1) {
  2333. if (!elem.className) {
  2334. elem.className = value;
  2335. } else {
  2336. var className = " " + elem.className + " ",
  2337. setClass = elem.className;
  2338. for (var c = 0, cl = classNames.length; c < cl; c++) {
  2339. if (className.indexOf(" " + classNames[c] + " ") < 0) {
  2340. setClass += " " + classNames[c];
  2341. }
  2342. }
  2343. elem.className = jQuery.trim(setClass);
  2344. }
  2345. }
  2346. }
  2347. }
  2348. return this;
  2349. };
  2350. jQuery.prototype.after = function () {
  2351. /// <summary>
  2352. /// Insert content, specified by the parameter, after each element in the set of matched elements.
  2353. /// 1 - after(content)
  2354. /// 2 - after(function(index))
  2355. /// </summary>
  2356. /// <param name="" type="jQuery">
  2357. /// An element, HTML string, or jQuery object to insert after each element in the set of matched elements.
  2358. /// </param>
  2359. /// <returns type="jQuery" />
  2360. if (this[0] && this[0].parentNode) {
  2361. return this.domManip(arguments, false, function (elem) {
  2362. this.parentNode.insertBefore(elem, this.nextSibling);
  2363. });
  2364. } else if (arguments.length) {
  2365. var set = this.pushStack(this, "after", arguments);
  2366. set.push.apply(set, jQuery(arguments[0]).toArray());
  2367. return set;
  2368. }
  2369. };
  2370. jQuery.prototype.ajaxComplete = function (f) {
  2371. /// <summary>
  2372. /// Register a handler to be called when Ajax requests complete. This is an Ajax Event.
  2373. /// </summary>
  2374. /// <param name="f" type="Function">
  2375. /// The function to be invoked.
  2376. /// </param>
  2377. /// <returns type="jQuery" />
  2378. return this.bind(o, f);
  2379. };
  2380. jQuery.prototype.ajaxError = function (f) {
  2381. /// <summary>
  2382. /// Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event.
  2383. /// </summary>
  2384. /// <param name="f" type="Function">
  2385. /// The function to be invoked.
  2386. /// </param>
  2387. /// <returns type="jQuery" />
  2388. return this.bind(o, f);
  2389. };
  2390. jQuery.prototype.ajaxSend = function (f) {
  2391. /// <summary>
  2392. /// Attach a function to be executed before an Ajax request is sent. This is an Ajax Event.
  2393. /// </summary>
  2394. /// <param name="f" type="Function">
  2395. /// The function to be invoked.
  2396. /// </param>
  2397. /// <returns type="jQuery" />
  2398. return this.bind(o, f);
  2399. };
  2400. jQuery.prototype.ajaxStart = function (f) {
  2401. /// <summary>
  2402. /// Register a handler to be called when the first Ajax request begins. This is an Ajax Event.
  2403. /// </summary>
  2404. /// <param name="f" type="Function">
  2405. /// The function to be invoked.
  2406. /// </param>
  2407. /// <returns type="jQuery" />
  2408. return this.bind(o, f);
  2409. };
  2410. jQuery.prototype.ajaxStop = function (f) {
  2411. /// <summary>
  2412. /// Register a handler to be called when all Ajax requests have completed. This is an Ajax Event.
  2413. /// </summary>
  2414. /// <param name="f" type="Function">
  2415. /// The function to be invoked.
  2416. /// </param>
  2417. /// <returns type="jQuery" />
  2418. return this.bind(o, f);
  2419. };
  2420. jQuery.prototype.ajaxSuccess = function (f) {
  2421. /// <summary>
  2422. /// Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event.
  2423. /// </summary>
  2424. /// <param name="f" type="Function">
  2425. /// The function to be invoked.
  2426. /// </param>
  2427. /// <returns type="jQuery" />
  2428. return this.bind(o, f);
  2429. };
  2430. jQuery.prototype.andSelf = function () {
  2431. /// <summary>
  2432. /// Add the previous set of elements on the stack to the current set.
  2433. /// </summary>
  2434. /// <returns type="jQuery" />
  2435. return this.add(this.prevObject);
  2436. };
  2437. jQuery.prototype.animate = function (prop, speed, easing, callback) {
  2438. /// <summary>
  2439. /// Perform a custom animation of a set of CSS properties.
  2440. /// 1 - animate(properties, duration, easing, complete)
  2441. /// 2 - animate(properties, options)
  2442. /// </summary>
  2443. /// <param name="prop" type="Object">
  2444. /// A map of CSS properties that the animation will move toward.
  2445. /// </param>
  2446. /// <param name="speed" type="Number">
  2447. /// A string or number determining how long the animation will run.
  2448. /// </param>
  2449. /// <param name="easing" type="String">
  2450. /// A string indicating which easing function to use for the transition.
  2451. /// </param>
  2452. /// <param name="callback" type="Function">
  2453. /// A function to call once the animation is complete.
  2454. /// </param>
  2455. /// <returns type="jQuery" />
  2456. var optall = jQuery.speed(speed, easing, callback);
  2457. if (jQuery.isEmptyObject(prop)) {
  2458. return this.each(optall.complete);
  2459. }
  2460. return this[optall.queue === false ? "each" : "queue"](function () {
  2461. // XXX 'this' does not always have a nodeName when running the
  2462. // test suite
  2463. var opt = jQuery.extend({}, optall), p,
  2464. isElement = this.nodeType === 1,
  2465. hidden = isElement && jQuery(this).is(":hidden"),
  2466. self = this;
  2467. for (p in prop) {
  2468. var name = jQuery.camelCase(p);
  2469. if (p !== name) {
  2470. prop[name] = prop[p];
  2471. delete prop[p];
  2472. p = name;
  2473. }
  2474. if (prop[p] === "hide" && hidden || prop[p] === "show" && !hidden) {
  2475. return opt.complete.call(this);
  2476. }
  2477. if (isElement && (p === "height" || p === "width")) {
  2478. // Make sure that nothing sneaks out
  2479. // Record all 3 overflow attributes because IE does not
  2480. // change the overflow attribute when overflowX and
  2481. // overflowY are set to the same value
  2482. opt.overflow = [this.style.overflow, this.style.overflowX, this.style.overflowY];
  2483. // Set display property to inline-block for height/width
  2484. // animations on inline elements that are having width/height
  2485. // animated
  2486. if (jQuery.css(this, "display") === "inline" &&
  2487. jQuery.css(this, "float") === "none") {
  2488. if (!jQuery.support.inlineBlockNeedsLayout) {
  2489. this.style.display = "inline-block";
  2490. } else {
  2491. var display = defaultDisplay(this.nodeName);
  2492. // inline-level elements accept inline-block;
  2493. // block-level elements need to be inline with layout
  2494. if (display === "inline") {
  2495. this.style.display = "inline-block";
  2496. } else {
  2497. this.style.display = "inline";
  2498. this.style.zoom = 1;
  2499. }
  2500. }
  2501. }
  2502. }
  2503. if (jQuery.isArray(prop[p])) {
  2504. // Create (if needed) and add to specialEasing
  2505. (opt.specialEasing = opt.specialEasing || {})[p] = prop[p][1];
  2506. prop[p] = prop[p][0];
  2507. }
  2508. }
  2509. if (opt.overflow != null) {
  2510. this.style.overflow = "hidden";
  2511. }
  2512. opt.curAnim = jQuery.extend({}, prop);
  2513. jQuery.each(prop, function (name, val) {
  2514. var e = new jQuery.fx(self, opt, name);
  2515. if (rfxtypes.test(val)) {
  2516. e[val === "toggle" ? hidden ? "show" : "hide" : val](prop);
  2517. } else {
  2518. var parts = rfxnum.exec(val),
  2519. start = e.cur() || 0;
  2520. if (parts) {
  2521. var end = parseFloat(parts[2]),
  2522. unit = parts[3] || "px";
  2523. // We need to compute starting value
  2524. if (unit !== "px") {
  2525. jQuery.style(self, name, (end || 1) + unit);
  2526. start = ((end || 1) / e.cur()) * start;
  2527. jQuery.style(self, name, start + unit);
  2528. }
  2529. // If a +=/-= token was provided, we're doing a relative animation
  2530. if (parts[1]) {
  2531. end = ((parts[1] === "-=" ? -1 : 1) * end) + start;
  2532. }
  2533. e.custom(start, end, unit);
  2534. } else {
  2535. e.custom(start, val, "");
  2536. }
  2537. }
  2538. });
  2539. // For JS strict compliance
  2540. return true;
  2541. });
  2542. };
  2543. jQuery.prototype.append = function () {
  2544. /// <summary>
  2545. /// Insert content, specified by the parameter, to the end of each element in the set of matched elements.
  2546. /// 1 - append(content)
  2547. /// 2 - append(function(index, html))
  2548. /// </summary>
  2549. /// <param name="" type="jQuery">
  2550. /// An element, HTML string, or jQuery object to insert at the end of each element in the set of matched elements.
  2551. /// </param>
  2552. /// <returns type="jQuery" />
  2553. return this.domManip(arguments, true, function (elem) {
  2554. if (this.nodeType === 1) {
  2555. this.appendChild(elem);
  2556. }
  2557. });
  2558. };
  2559. jQuery.prototype.appendTo = function (selector) {
  2560. /// <summary>
  2561. /// Insert every element in the set of matched elements to the end of the target.
  2562. /// </summary>
  2563. /// <param name="selector" type="jQuery">
  2564. /// A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted at the end of the element(s) specified by this parameter.
  2565. /// </param>
  2566. /// <returns type="jQuery" />
  2567. var ret = [],
  2568. insert = jQuery(selector),
  2569. parent = this.length === 1 && this[0].parentNode;
  2570. if (parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1) {
  2571. insert[original](this[0]);
  2572. return this;
  2573. } else {
  2574. for (var i = 0, l = insert.length; i < l; i++) {
  2575. var elems = (i > 0 ? this.clone(true) : this).get();
  2576. jQuery(insert[i])[original](elems);
  2577. ret = ret.concat(elems);
  2578. }
  2579. return this.pushStack(ret, name, insert.selector);
  2580. }
  2581. };
  2582. jQuery.prototype.attr = function (name, value) {
  2583. /// <summary>
  2584. /// 1: Get the value of an attribute for the first element in the set of matched elements.
  2585. /// 1.1 - attr(attributeName)
  2586. /// 2: Set one or more attributes for the set of matched elements.
  2587. /// 2.1 - attr(attributeName, value)
  2588. /// 2.2 - attr(map)
  2589. /// 2.3 - attr(attributeName, function(index, attr))
  2590. /// </summary>
  2591. /// <param name="name" type="String">
  2592. /// The name of the attribute to set.
  2593. /// </param>
  2594. /// <param name="value" type="Number">
  2595. /// A value to set for the attribute.
  2596. /// </param>
  2597. /// <returns type="jQuery" />
  2598. return jQuery.access(this, name, value, true, jQuery.attr);
  2599. };
  2600. jQuery.prototype.before = function () {
  2601. /// <summary>
  2602. /// Insert content, specified by the parameter, before each element in the set of matched elements.
  2603. /// 1 - before(content)
  2604. /// 2 - before(function)
  2605. /// </summary>
  2606. /// <param name="" type="jQuery">
  2607. /// An element, HTML string, or jQuery object to insert before each element in the set of matched elements.
  2608. /// </param>
  2609. /// <returns type="jQuery" />
  2610. if (this[0] && this[0].parentNode) {
  2611. return this.domManip(arguments, false, function (elem) {
  2612. this.parentNode.insertBefore(elem, this);
  2613. });
  2614. } else if (arguments.length) {
  2615. var set = jQuery(arguments[0]);
  2616. set.push.apply(set, this.toArray());
  2617. return this.pushStack(set, "before", arguments);
  2618. }
  2619. };
  2620. jQuery.prototype.bind = function (type, data, fn) {
  2621. /// <summary>
  2622. /// Attach a handler to an event for the elements.
  2623. /// 1 - bind(eventType, eventData, handler(eventObject))
  2624. /// 2 - bind(eventType, eventData, false)
  2625. /// 3 - bind(events)
  2626. /// </summary>
  2627. /// <param name="type" type="String">
  2628. /// A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names.
  2629. /// </param>
  2630. /// <param name="data" type="Object">
  2631. /// A map of data that will be passed to the event handler.
  2632. /// </param>
  2633. /// <param name="fn" type="Function">
  2634. /// A function to execute each time the event is triggered.
  2635. /// </param>
  2636. /// <returns type="jQuery" />
  2637. // Handle object literals
  2638. if (typeof type === "object") {
  2639. for (var key in type) {
  2640. this[name](key, data, type[key], fn);
  2641. }
  2642. return this;
  2643. }
  2644. if (jQuery.isFunction(data) || data === false) {
  2645. fn = data;
  2646. data = undefined;
  2647. }
  2648. var handler = name === "one" ? jQuery.proxy(fn, function (event) {
  2649. jQuery(this).unbind(event, handler);
  2650. return fn.apply(this, arguments);
  2651. }) : fn;
  2652. if (type === "unload" && name !== "one") {
  2653. this.one(type, data, fn);
  2654. } else {
  2655. for (var i = 0, l = this.length; i < l; i++) {
  2656. jQuery.event.add(this[i], type, handler, data);
  2657. }
  2658. }
  2659. return this;
  2660. };
  2661. jQuery.prototype.blur = function (data, fn) {
  2662. /// <summary>
  2663. /// Bind an event handler to the "blur" JavaScript event, or trigger that event on an element.
  2664. /// 1 - blur(handler(eventObject))
  2665. /// 2 - blur(eventData, handler(eventObject))
  2666. /// 3 - blur()
  2667. /// </summary>
  2668. /// <param name="data" type="Object">
  2669. /// A map of data that will be passed to the event handler.
  2670. /// </param>
  2671. /// <param name="fn" type="Function">
  2672. /// A function to execute each time the event is triggered.
  2673. /// </param>
  2674. /// <returns type="jQuery" />
  2675. if (fn == null) {
  2676. fn = data;
  2677. data = null;
  2678. }
  2679. return arguments.length > 0 ?
  2680. this.bind(name, data, fn) :
  2681. this.trigger(name);
  2682. };
  2683. jQuery.prototype.change = function (data, fn) {
  2684. /// <summary>
  2685. /// Bind an event handler to the "change" JavaScript event, or trigger that event on an element.
  2686. /// 1 - change(handler(eventObject))
  2687. /// 2 - change(eventData, handler(eventObject))
  2688. /// 3 - change()
  2689. /// </summary>
  2690. /// <param name="data" type="Object">
  2691. /// A map of data that will be passed to the event handler.
  2692. /// </param>
  2693. /// <param name="fn" type="Function">
  2694. /// A function to execute each time the event is triggered.
  2695. /// </param>
  2696. /// <returns type="jQuery" />
  2697. if (fn == null) {
  2698. fn = data;
  2699. data = null;
  2700. }
  2701. return arguments.length > 0 ?
  2702. this.bind(name, data, fn) :
  2703. this.trigger(name);
  2704. };
  2705. jQuery.prototype.children = function (until, selector) {
  2706. /// <summary>
  2707. /// Get the children of each element in the set of matched elements, optionally filtered by a selector.
  2708. /// </summary>
  2709. /// <param name="until" type="String">
  2710. /// A string containing a selector expression to match elements against.
  2711. /// </param>
  2712. /// <returns type="jQuery" />
  2713. var ret = jQuery.map(this, fn, until),
  2714. // The variable 'args' was introduced in
  2715. // https://github.com/jquery/jquery/commit/52a0238
  2716. // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
  2717. // http://code.google.com/p/v8/issues/detail?id=1050
  2718. args = slice.call(arguments);
  2719. if (!runtil.test(name)) {
  2720. selector = until;
  2721. }
  2722. if (selector && typeof selector === "string") {
  2723. ret = jQuery.filter(selector, ret);
  2724. }
  2725. ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
  2726. if ((this.length > 1 || rmultiselector.test(selector)) && rparentsprev.test(name)) {
  2727. ret = ret.reverse();
  2728. }
  2729. return this.pushStack(ret, name, args.join(","));
  2730. };
  2731. jQuery.prototype.clearQueue = function (type) {
  2732. /// <summary>
  2733. /// Remove from the queue all items that have not yet been run.
  2734. /// </summary>
  2735. /// <param name="type" type="String">
  2736. /// A string containing the name of the queue. Defaults to fx, the standard effects queue.
  2737. /// </param>
  2738. /// <returns type="jQuery" />
  2739. return this.queue(type || "fx", []);
  2740. };
  2741. jQuery.prototype.click = function (data, fn) {
  2742. /// <summary>
  2743. /// Bind an event handler to the "click" JavaScript event, or trigger that event on an element.
  2744. /// 1 - click(handler(eventObject))
  2745. /// 2 - click(eventData, handler(eventObject))
  2746. /// 3 - click()
  2747. /// </summary>
  2748. /// <param name="data" type="Object">
  2749. /// A map of data that will be passed to the event handler.
  2750. /// </param>
  2751. /// <param name="fn" type="Function">
  2752. /// A function to execute each time the event is triggered.
  2753. /// </param>
  2754. /// <returns type="jQuery" />
  2755. if (fn == null) {
  2756. fn = data;
  2757. data = null;
  2758. }
  2759. return arguments.length > 0 ?
  2760. this.bind(name, data, fn) :
  2761. this.trigger(name);
  2762. };
  2763. jQuery.prototype.clone = function (dataAndEvents, deepDataAndEvents) {
  2764. /// <summary>
  2765. /// Create a deep copy of the set of matched elements.
  2766. /// 1 - clone(withDataAndEvents)
  2767. /// 2 - clone(withDataAndEvents, deepWithDataAndEvents)
  2768. /// </summary>
  2769. /// <param name="dataAndEvents" type="Boolean">
  2770. /// A Boolean indicating whether event handlers should be copied along with the elements. As of jQuery 1.4, element data will be copied as well. The default value is false
  2771. /// </param>
  2772. /// <param name="deepDataAndEvents" type="Boolean">
  2773. /// A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. The default value is false
  2774. /// </param>
  2775. /// <returns type="jQuery" />
  2776. dataAndEvents = dataAndEvents == null ? true : dataAndEvents;
  2777. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  2778. return this.map(function () {
  2779. return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
  2780. });
  2781. };
  2782. jQuery.prototype.closest = function (selectors, context) {
  2783. /// <summary>
  2784. /// 1: Get the first ancestor element that matches the selector, beginning at the current element and progressing up through the DOM tree.
  2785. /// 1.1 - closest(selector)
  2786. /// 1.2 - closest(selector, context)
  2787. /// 2: Gets an array of all the elements and selectors matched against the current element up through the DOM tree.
  2788. /// 2.1 - closest(selectors, context)
  2789. /// </summary>
  2790. /// <param name="selectors" type="String">
  2791. /// A string containing a selector expression to match elements against.
  2792. /// </param>
  2793. /// <param name="context" domElement="true">
  2794. /// A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead.
  2795. /// </param>
  2796. /// <returns type="jQuery" />
  2797. var ret = [], i, l, cur = this[0];
  2798. if (jQuery.isArray(selectors)) {
  2799. var match, selector,
  2800. matches = {},
  2801. level = 1;
  2802. if (cur && selectors.length) {
  2803. for (i = 0, l = selectors.length; i < l; i++) {
  2804. selector = selectors[i];
  2805. if (!matches[selector]) {
  2806. matches[selector] = jQuery.expr.match.POS.test(selector) ?
  2807. jQuery(selector, context || this.context) :
  2808. selector;
  2809. }
  2810. }
  2811. while (cur && cur.ownerDocument && cur !== context) {
  2812. for (selector in matches) {
  2813. match = matches[selector];
  2814. if (match.jquery ? match.index(cur) > -1 : jQuery(cur).is(match)) {
  2815. ret.push({ selector: selector, elem: cur, level: level });
  2816. }
  2817. }
  2818. cur = cur.parentNode;
  2819. level++;
  2820. }
  2821. }
  2822. return ret;
  2823. }
  2824. var pos = POS.test(selectors) ?
  2825. jQuery(selectors, context || this.context) : null;
  2826. for (i = 0, l = this.length; i < l; i++) {
  2827. cur = this[i];
  2828. while (cur) {
  2829. if (pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors)) {
  2830. ret.push(cur);
  2831. break;
  2832. } else {
  2833. cur = cur.parentNode;
  2834. if (!cur || !cur.ownerDocument || cur === context) {
  2835. break;
  2836. }
  2837. }
  2838. }
  2839. }
  2840. ret = ret.length > 1 ? jQuery.unique(ret) : ret;
  2841. return this.pushStack(ret, "closest", selectors);
  2842. };
  2843. jQuery.prototype.constructor = function (selector, context) {
  2844. // The jQuery object is actually just the init constructor 'enhanced'
  2845. return new jQuery.fn.init(selector, context, rootjQuery);
  2846. };
  2847. jQuery.prototype.contents = function (until, selector) {
  2848. /// <summary>
  2849. /// Get the children of each element in the set of matched elements, including text and comment nodes.
  2850. /// </summary>
  2851. /// <returns type="jQuery" />
  2852. var ret = jQuery.map(this, fn, until),
  2853. // The variable 'args' was introduced in
  2854. // https://github.com/jquery/jquery/commit/52a0238
  2855. // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
  2856. // http://code.google.com/p/v8/issues/detail?id=1050
  2857. args = slice.call(arguments);
  2858. if (!runtil.test(name)) {
  2859. selector = until;
  2860. }
  2861. if (selector && typeof selector === "string") {
  2862. ret = jQuery.filter(selector, ret);
  2863. }
  2864. ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
  2865. if ((this.length > 1 || rmultiselector.test(selector)) && rparentsprev.test(name)) {
  2866. ret = ret.reverse();
  2867. }
  2868. return this.pushStack(ret, name, args.join(","));
  2869. };
  2870. jQuery.prototype.css = function (name, value) {
  2871. /// <summary>
  2872. /// 1: Get the value of a style property for the first element in the set of matched elements.
  2873. /// 1.1 - css(propertyName)
  2874. /// 2: Set one or more CSS properties for the set of matched elements.
  2875. /// 2.1 - css(propertyName, value)
  2876. /// 2.2 - css(propertyName, function(index, value))
  2877. /// 2.3 - css(map)
  2878. /// </summary>
  2879. /// <param name="name" type="String">
  2880. /// A CSS property name.
  2881. /// </param>
  2882. /// <param name="value" type="Number">
  2883. /// A value to set for the property.
  2884. /// </param>
  2885. /// <returns type="jQuery" />
  2886. // Setting 'undefined' is a no-op
  2887. if (arguments.length === 2 && value === undefined) {
  2888. return this;
  2889. }
  2890. return jQuery.access(this, name, value, true, function (elem, name, value) {
  2891. return value !== undefined ?
  2892. jQuery.style(elem, name, value) :
  2893. jQuery.css(elem, name);
  2894. });
  2895. };
  2896. jQuery.prototype.data = function (key, value) {
  2897. /// <summary>
  2898. /// 1: Store arbitrary data associated with the matched elements.
  2899. /// 1.1 - data(key, value)
  2900. /// 1.2 - data(obj)
  2901. /// 2: Returns value at named data store for the first element in the jQuery collection, as set by data(name, value).
  2902. /// 2.1 - data(key)
  2903. /// 2.2 - data()
  2904. /// </summary>
  2905. /// <param name="key" type="String">
  2906. /// A string naming the piece of data to set.
  2907. /// </param>
  2908. /// <param name="value" type="Object">
  2909. /// The new data value; it can be any Javascript type including Array or Object.
  2910. /// </param>
  2911. /// <returns type="jQuery" />
  2912. var data = null;
  2913. if (typeof key === "undefined") {
  2914. if (this.length) {
  2915. data = jQuery.data(this[0]);
  2916. if (this[0].nodeType === 1) {
  2917. var attr = this[0].attributes, name;
  2918. for (var i = 0, l = attr.length; i < l; i++) {
  2919. name = attr[i].name;
  2920. if (name.indexOf("data-") === 0) {
  2921. name = name.substr(5);
  2922. dataAttr(this[0], name, data[name]);
  2923. }
  2924. }
  2925. }
  2926. }
  2927. return data;
  2928. } else if (typeof key === "object") {
  2929. return this.each(function () {
  2930. jQuery.data(this, key);
  2931. });
  2932. }
  2933. var parts = key.split(".");
  2934. parts[1] = parts[1] ? "." + parts[1] : "";
  2935. if (value === undefined) {
  2936. data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
  2937. // Try to fetch any internally stored data first
  2938. if (data === undefined && this.length) {
  2939. data = jQuery.data(this[0], key);
  2940. data = dataAttr(this[0], key, data);
  2941. }
  2942. return data === undefined && parts[1] ?
  2943. this.data(parts[0]) :
  2944. data;
  2945. } else {
  2946. return this.each(function () {
  2947. var $this = jQuery(this),
  2948. args = [parts[0], value];
  2949. $this.triggerHandler("setData" + parts[1] + "!", args);
  2950. jQuery.data(this, key, value);
  2951. $this.triggerHandler("changeData" + parts[1] + "!", args);
  2952. });
  2953. }
  2954. };
  2955. jQuery.prototype.dblclick = function (data, fn) {
  2956. /// <summary>
  2957. /// Bind an event handler to the "dblclick" JavaScript event, or trigger that event on an element.
  2958. /// 1 - dblclick(handler(eventObject))
  2959. /// 2 - dblclick(eventData, handler(eventObject))
  2960. /// 3 - dblclick()
  2961. /// </summary>
  2962. /// <param name="data" type="Object">
  2963. /// A map of data that will be passed to the event handler.
  2964. /// </param>
  2965. /// <param name="fn" type="Function">
  2966. /// A function to execute each time the event is triggered.
  2967. /// </param>
  2968. /// <returns type="jQuery" />
  2969. if (fn == null) {
  2970. fn = data;
  2971. data = null;
  2972. }
  2973. return arguments.length > 0 ?
  2974. this.bind(name, data, fn) :
  2975. this.trigger(name);
  2976. };
  2977. jQuery.prototype.delay = function (time, type) {
  2978. /// <summary>
  2979. /// Set a timer to delay execution of subsequent items in the queue.
  2980. /// </summary>
  2981. /// <param name="time" type="Number">
  2982. /// An integer indicating the number of milliseconds to delay execution of the next item in the queue.
  2983. /// </param>
  2984. /// <param name="type" type="String">
  2985. /// A string containing the name of the queue. Defaults to fx, the standard effects queue.
  2986. /// </param>
  2987. /// <returns type="jQuery" />
  2988. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  2989. type = type || "fx";
  2990. return this.queue(type, function () {
  2991. var elem = this;
  2992. setTimeout(function () {
  2993. jQuery.dequeue(elem, type);
  2994. }, time);
  2995. });
  2996. };
  2997. jQuery.prototype.delegate = function (selector, types, data, fn) {
  2998. /// <summary>
  2999. /// Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements.
  3000. /// 1 - delegate(selector, eventType, handler)
  3001. /// 2 - delegate(selector, eventType, eventData, handler)
  3002. /// </summary>
  3003. /// <param name="selector" type="String">
  3004. /// A selector to filter the elements that trigger the event.
  3005. /// </param>
  3006. /// <param name="types" type="String">
  3007. /// A string containing one or more space-separated JavaScript event types, such as "click" or "keydown," or custom event names.
  3008. /// </param>
  3009. /// <param name="data" type="Object">
  3010. /// A map of data that will be passed to the event handler.
  3011. /// </param>
  3012. /// <param name="fn" type="Function">
  3013. /// A function to execute at the time the event is triggered.
  3014. /// </param>
  3015. /// <returns type="jQuery" />
  3016. return this.live(types, data, fn, selector);
  3017. };
  3018. jQuery.prototype.dequeue = function (type) {
  3019. /// <summary>
  3020. /// Execute the next function on the queue for the matched elements.
  3021. /// </summary>
  3022. /// <param name="type" type="String">
  3023. /// A string containing the name of the queue. Defaults to fx, the standard effects queue.
  3024. /// </param>
  3025. /// <returns type="jQuery" />
  3026. return this.each(function () {
  3027. jQuery.dequeue(this, type);
  3028. });
  3029. };
  3030. jQuery.prototype.detach = function (selector) {
  3031. /// <summary>
  3032. /// Remove the set of matched elements from the DOM.
  3033. /// </summary>
  3034. /// <param name="selector" type="String">
  3035. /// A selector expression that filters the set of matched elements to be removed.
  3036. /// </param>
  3037. /// <returns type="jQuery" />
  3038. return this.remove(selector, true);
  3039. };
  3040. jQuery.prototype.die = function (types, data, fn, origSelector /* Internal Use Only */) {
  3041. /// <summary>
  3042. /// 1: Remove all event handlers previously attached using .live() from the elements.
  3043. /// 1.1 - die()
  3044. /// 2: Remove an event handler previously attached using .live() from the elements.
  3045. /// 2.1 - die(eventType, handler)
  3046. /// </summary>
  3047. /// <param name="types" type="String">
  3048. /// A string containing a JavaScript event type, such as click or keydown.
  3049. /// </param>
  3050. /// <param name="data" type="String">
  3051. /// The function that is to be no longer executed.
  3052. /// </param>
  3053. /// <returns type="jQuery" />
  3054. var type, i = 0, match, namespaces, preType,
  3055. selector = origSelector || this.selector,
  3056. context = origSelector ? this : jQuery(this.context);
  3057. if (typeof types === "object" && !types.preventDefault) {
  3058. for (var key in types) {
  3059. context[name](key, data, types[key], selector);
  3060. }
  3061. return this;
  3062. }
  3063. if (jQuery.isFunction(data)) {
  3064. fn = data;
  3065. data = undefined;
  3066. }
  3067. types = (types || "").split(" ");
  3068. while ((type = types[i++]) != null) {
  3069. match = rnamespaces.exec(type);
  3070. namespaces = "";
  3071. if (match) {
  3072. namespaces = match[0];
  3073. type = type.replace(rnamespaces, "");
  3074. }
  3075. if (type === "hover") {
  3076. types.push("mouseenter" + namespaces, "mouseleave" + namespaces);
  3077. continue;
  3078. }
  3079. preType = type;
  3080. if (type === "focus" || type === "blur") {
  3081. types.push(liveMap[type] + namespaces);
  3082. type = type + namespaces;
  3083. } else {
  3084. type = (liveMap[type] || type) + namespaces;
  3085. }
  3086. if (name === "live") {
  3087. // bind live handler
  3088. for (var j = 0, l = context.length; j < l; j++) {
  3089. jQuery.event.add(context[j], "live." + liveConvert(type, selector),
  3090. { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType });
  3091. }
  3092. } else {
  3093. // unbind live handler
  3094. context.unbind("live." + liveConvert(type, selector), fn);
  3095. }
  3096. }
  3097. return this;
  3098. };
  3099. jQuery.prototype.domManip = function (args, table, callback) {
  3100. var results, first, fragment, parent,
  3101. value = args[0],
  3102. scripts = [];
  3103. // We can't cloneNode fragments that contain checked, in WebKit
  3104. if (!jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test(value)) {
  3105. return this.each(function () {
  3106. jQuery(this).domManip(args, table, callback, true);
  3107. });
  3108. }
  3109. if (jQuery.isFunction(value)) {
  3110. return this.each(function (i) {
  3111. var self = jQuery(this);
  3112. args[0] = value.call(this, i, table ? self.html() : undefined);
  3113. self.domManip(args, table, callback);
  3114. });
  3115. }
  3116. if (this[0]) {
  3117. parent = value && value.parentNode;
  3118. // If we're in a fragment, just use that instead of building a new one
  3119. if (jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length) {
  3120. results = { fragment: parent };
  3121. } else {
  3122. results = jQuery.buildFragment(args, this, scripts);
  3123. }
  3124. fragment = results.fragment;
  3125. if (fragment.childNodes.length === 1) {
  3126. first = fragment = fragment.firstChild;
  3127. } else {
  3128. first = fragment.firstChild;
  3129. }
  3130. if (first) {
  3131. table = table && jQuery.nodeName(first, "tr");
  3132. for (var i = 0, l = this.length, lastIndex = l - 1; i < l; i++) {
  3133. callback.call(
  3134. table ?
  3135. root(this[i], first) :
  3136. this[i],
  3137. // Make sure that we do not leak memory by inadvertently discarding
  3138. // the original fragment (which might have attached data) instead of
  3139. // using it; in addition, use the original fragment object for the last
  3140. // item instead of first because it can end up being emptied incorrectly
  3141. // in certain situations (Bug #8070).
  3142. // Fragments from the fragment cache must always be cloned and never used
  3143. // in place.
  3144. results.cacheable || (l > 1 && i < lastIndex) ?
  3145. jQuery.clone(fragment, true, true) :
  3146. fragment
  3147. );
  3148. }
  3149. }
  3150. if (scripts.length) {
  3151. jQuery.each(scripts, evalScript);
  3152. }
  3153. }
  3154. return this;
  3155. };
  3156. jQuery.prototype.each = function (callback, args) {
  3157. /// <summary>
  3158. /// Iterate over a jQuery object, executing a function for each matched element.
  3159. /// </summary>
  3160. /// <param name="callback" type="Function">
  3161. /// A function to execute for each matched element.
  3162. /// </param>
  3163. /// <returns type="jQuery" />
  3164. return jQuery.each(this, callback, args);
  3165. };
  3166. jQuery.prototype.empty = function () {
  3167. /// <summary>
  3168. /// Remove all child nodes of the set of matched elements from the DOM.
  3169. /// </summary>
  3170. /// <returns type="jQuery" />
  3171. for (var i = 0, elem; (elem = this[i]) != null; i++) {
  3172. // Remove element nodes and prevent memory leaks
  3173. if (elem.nodeType === 1) {
  3174. jQuery.cleanData(elem.getElementsByTagName("*"));
  3175. }
  3176. // Remove any remaining nodes
  3177. while (elem.firstChild) {
  3178. elem.removeChild(elem.firstChild);
  3179. }
  3180. }
  3181. return this;
  3182. };
  3183. jQuery.prototype.end = function () {
  3184. /// <summary>
  3185. /// End the most recent filtering operation in the current chain and return the set of matched elements to its previous state.
  3186. /// </summary>
  3187. /// <returns type="jQuery" />
  3188. return this.prevObject || this.constructor(null);
  3189. };
  3190. jQuery.prototype.eq = function (i) {
  3191. /// <summary>
  3192. /// Reduce the set of matched elements to the one at the specified index.
  3193. /// 1 - eq(index)
  3194. /// 2 - eq(-index)
  3195. /// </summary>
  3196. /// <param name="i" type="Number">
  3197. /// An integer indicating the 0-based position of the element.
  3198. /// </param>
  3199. /// <returns type="jQuery" />
  3200. return i === -1 ?
  3201. this.slice(i) :
  3202. this.slice(i, +i + 1);
  3203. };
  3204. jQuery.prototype.error = function (data, fn) {
  3205. /// <summary>
  3206. /// Bind an event handler to the "error" JavaScript event.
  3207. /// 1 - error(handler(eventObject))
  3208. /// 2 - error(eventData, handler(eventObject))
  3209. /// </summary>
  3210. /// <param name="data" type="Object">
  3211. /// A map of data that will be passed to the event handler.
  3212. /// </param>
  3213. /// <param name="fn" type="Function">
  3214. /// A function to execute each time the event is triggered.
  3215. /// </param>
  3216. /// <returns type="jQuery" />
  3217. if (fn == null) {
  3218. fn = data;
  3219. data = null;
  3220. }
  3221. return arguments.length > 0 ?
  3222. this.bind(name, data, fn) :
  3223. this.trigger(name);
  3224. };
  3225. jQuery.prototype.extend = function () {
  3226. var options, name, src, copy, copyIsArray, clone,
  3227. target = arguments[0] || {},
  3228. i = 1,
  3229. length = arguments.length,
  3230. deep = false;
  3231. // Handle a deep copy situation
  3232. if (typeof target === "boolean") {
  3233. deep = target;
  3234. target = arguments[1] || {};
  3235. // skip the boolean and the target
  3236. i = 2;
  3237. }
  3238. // Handle case when target is a string or something (possible in deep copy)
  3239. if (typeof target !== "object" && !jQuery.isFunction(target)) {
  3240. target = {};
  3241. }
  3242. // extend jQuery itself if only one argument is passed
  3243. if (length === i) {
  3244. target = this;
  3245. --i;
  3246. }
  3247. for (; i < length; i++) {
  3248. // Only deal with non-null/undefined values
  3249. if ((options = arguments[i]) != null) {
  3250. // Extend the base object
  3251. for (name in options) {
  3252. src = target[name];
  3253. copy = options[name];
  3254. // Prevent never-ending loop
  3255. if (target === copy) {
  3256. continue;
  3257. }
  3258. // Recurse if we're merging plain objects or arrays
  3259. if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)))) {
  3260. if (copyIsArray) {
  3261. copyIsArray = false;
  3262. clone = src && jQuery.isArray(src) ? src : [];
  3263. } else {
  3264. clone = src && jQuery.isPlainObject(src) ? src : {};
  3265. }
  3266. // Never move original objects, clone them
  3267. target[name] = jQuery.extend(deep, clone, copy);
  3268. // Don't bring in undefined values
  3269. } else if (copy !== undefined) {
  3270. target[name] = copy;
  3271. }
  3272. }
  3273. }
  3274. }
  3275. // Return the modified object
  3276. return target;
  3277. };
  3278. jQuery.prototype.fadeIn = function (speed, easing, callback) {
  3279. /// <summary>
  3280. /// Display the matched elements by fading them to opaque.
  3281. /// 1 - fadeIn(duration, callback)
  3282. /// 2 - fadeIn(duration, easing, callback)
  3283. /// </summary>
  3284. /// <param name="speed" type="Number">
  3285. /// A string or number determining how long the animation will run.
  3286. /// </param>
  3287. /// <param name="easing" type="String">
  3288. /// A string indicating which easing function to use for the transition.
  3289. /// </param>
  3290. /// <param name="callback" type="Function">
  3291. /// A function to call once the animation is complete.
  3292. /// </param>
  3293. /// <returns type="jQuery" />
  3294. return this.animate(props, speed, easing, callback);
  3295. };
  3296. jQuery.prototype.fadeOut = function (speed, easing, callback) {
  3297. /// <summary>
  3298. /// Hide the matched elements by fading them to transparent.
  3299. /// 1 - fadeOut(duration, callback)
  3300. /// 2 - fadeOut(duration, easing, callback)
  3301. /// </summary>
  3302. /// <param name="speed" type="Number">
  3303. /// A string or number determining how long the animation will run.
  3304. /// </param>
  3305. /// <param name="easing" type="String">
  3306. /// A string indicating which easing function to use for the transition.
  3307. /// </param>
  3308. /// <param name="callback" type="Function">
  3309. /// A function to call once the animation is complete.
  3310. /// </param>
  3311. /// <returns type="jQuery" />
  3312. return this.animate(props, speed, easing, callback);
  3313. };
  3314. jQuery.prototype.fadeTo = function (speed, to, easing, callback) {
  3315. /// <summary>
  3316. /// Adjust the opacity of the matched elements.
  3317. /// 1 - fadeTo(duration, opacity, callback)
  3318. /// 2 - fadeTo(duration, opacity, easing, callback)
  3319. /// </summary>
  3320. /// <param name="speed" type="Number">
  3321. /// A string or number determining how long the animation will run.
  3322. /// </param>
  3323. /// <param name="to" type="Number">
  3324. /// A number between 0 and 1 denoting the target opacity.
  3325. /// </param>
  3326. /// <param name="easing" type="String">
  3327. /// A string indicating which easing function to use for the transition.
  3328. /// </param>
  3329. /// <param name="callback" type="Function">
  3330. /// A function to call once the animation is complete.
  3331. /// </param>
  3332. /// <returns type="jQuery" />
  3333. return this.filter(":hidden").css("opacity", 0).show().end()
  3334. .animate({ opacity: to }, speed, easing, callback);
  3335. };
  3336. jQuery.prototype.fadeToggle = function (speed, easing, callback) {
  3337. /// <summary>
  3338. /// Display or hide the matched elements by animating their opacity.
  3339. /// </summary>
  3340. /// <param name="speed" type="Number">
  3341. /// A string or number determining how long the animation will run.
  3342. /// </param>
  3343. /// <param name="easing" type="String">
  3344. /// A string indicating which easing function to use for the transition.
  3345. /// </param>
  3346. /// <param name="callback" type="Function">
  3347. /// A function to call once the animation is complete.
  3348. /// </param>
  3349. /// <returns type="jQuery" />
  3350. return this.animate(props, speed, easing, callback);
  3351. };
  3352. jQuery.prototype.filter = function (selector) {
  3353. /// <summary>
  3354. /// Reduce the set of matched elements to those that match the selector or pass the function's test.
  3355. /// 1 - filter(selector)
  3356. /// 2 - filter(function(index))
  3357. /// 3 - filter(element)
  3358. /// 4 - filter(jQuery object)
  3359. /// </summary>
  3360. /// <param name="selector" type="String">
  3361. /// A string containing a selector expression to match the current set of elements against.
  3362. /// </param>
  3363. /// <returns type="jQuery" />
  3364. return this.pushStack(winnow(this, selector, true), "filter", selector);
  3365. };
  3366. jQuery.prototype.find = function (selector) {
  3367. /// <summary>
  3368. /// Get the descendants of each element in the current set of matched elements, filtered by a selector.
  3369. /// </summary>
  3370. /// <param name="selector" type="String">
  3371. /// A string containing a selector expression to match elements against.
  3372. /// </param>
  3373. /// <returns type="jQuery" />
  3374. var ret = this.pushStack("", "find", selector),
  3375. length = 0;
  3376. for (var i = 0, l = this.length; i < l; i++) {
  3377. length = ret.length;
  3378. jQuery.find(selector, this[i], ret);
  3379. if (i > 0) {
  3380. // Make sure that the results are unique
  3381. for (var n = length; n < ret.length; n++) {
  3382. for (var r = 0; r < length; r++) {
  3383. if (ret[r] === ret[n]) {
  3384. ret.splice(n--, 1);
  3385. break;
  3386. }
  3387. }
  3388. }
  3389. }
  3390. }
  3391. return ret;
  3392. };
  3393. jQuery.prototype.first = function () {
  3394. /// <summary>
  3395. /// Reduce the set of matched elements to the first in the set.
  3396. /// </summary>
  3397. /// <returns type="jQuery" />
  3398. return this.eq(0);
  3399. };
  3400. jQuery.prototype.focus = function (data, fn) {
  3401. /// <summary>
  3402. /// Bind an event handler to the "focus" JavaScript event, or trigger that event on an element.
  3403. /// 1 - focus(handler(eventObject))
  3404. /// 2 - focus(eventData, handler(eventObject))
  3405. /// 3 - focus()
  3406. /// </summary>
  3407. /// <param name="data" type="Object">
  3408. /// A map of data that will be passed to the event handler.
  3409. /// </param>
  3410. /// <param name="fn" type="Function">
  3411. /// A function to execute each time the event is triggered.
  3412. /// </param>
  3413. /// <returns type="jQuery" />
  3414. if (fn == null) {
  3415. fn = data;
  3416. data = null;
  3417. }
  3418. return arguments.length > 0 ?
  3419. this.bind(name, data, fn) :
  3420. this.trigger(name);
  3421. };
  3422. jQuery.prototype.focusin = function (data, fn) {
  3423. /// <summary>
  3424. /// Bind an event handler to the "focusin" JavaScript event.
  3425. /// 1 - focusin(handler(eventObject))
  3426. /// 2 - focusin(eventData, handler(eventObject))
  3427. /// </summary>
  3428. /// <param name="data" type="Object">
  3429. /// A map of data that will be passed to the event handler.
  3430. /// </param>
  3431. /// <param name="fn" type="Function">
  3432. /// A function to execute each time the event is triggered.
  3433. /// </param>
  3434. /// <returns type="jQuery" />
  3435. if (fn == null) {
  3436. fn = data;
  3437. data = null;
  3438. }
  3439. return arguments.length > 0 ?
  3440. this.bind(name, data, fn) :
  3441. this.trigger(name);
  3442. };
  3443. jQuery.prototype.focusout = function (data, fn) {
  3444. /// <summary>
  3445. /// Bind an event handler to the "focusout" JavaScript event.
  3446. /// 1 - focusout(handler(eventObject))
  3447. /// 2 - focusout(eventData, handler(eventObject))
  3448. /// </summary>
  3449. /// <param name="data" type="Object">
  3450. /// A map of data that will be passed to the event handler.
  3451. /// </param>
  3452. /// <param name="fn" type="Function">
  3453. /// A function to execute each time the event is triggered.
  3454. /// </param>
  3455. /// <returns type="jQuery" />
  3456. if (fn == null) {
  3457. fn = data;
  3458. data = null;
  3459. }
  3460. return arguments.length > 0 ?
  3461. this.bind(name, data, fn) :
  3462. this.trigger(name);
  3463. };
  3464. jQuery.prototype.get = function (num) {
  3465. /// <summary>
  3466. /// Retrieve the DOM elements matched by the jQuery object.
  3467. /// </summary>
  3468. /// <param name="num" type="Number">
  3469. /// A zero-based integer indicating which element to retrieve.
  3470. /// </param>
  3471. /// <returns type="Array" />
  3472. return num == null ?
  3473. // Return a 'clean' array
  3474. this.toArray() :
  3475. // Return just the object
  3476. (num < 0 ? this[this.length + num] : this[num]);
  3477. };
  3478. jQuery.prototype.has = function (target) {
  3479. /// <summary>
  3480. /// Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.
  3481. /// 1 - has(selector)
  3482. /// 2 - has(contained)
  3483. /// </summary>
  3484. /// <param name="target" type="String">
  3485. /// A string containing a selector expression to match elements against.
  3486. /// </param>
  3487. /// <returns type="jQuery" />
  3488. var targets = jQuery(target);
  3489. return this.filter(function () {
  3490. for (var i = 0, l = targets.length; i < l; i++) {
  3491. if (jQuery.contains(this, targets[i])) {
  3492. return true;
  3493. }
  3494. }
  3495. });
  3496. };
  3497. jQuery.prototype.hasClass = function (selector) {
  3498. /// <summary>
  3499. /// Determine whether any of the matched elements are assigned the given class.
  3500. /// </summary>
  3501. /// <param name="selector" type="String">
  3502. /// The class name to search for.
  3503. /// </param>
  3504. /// <returns type="Boolean" />
  3505. var className = " " + selector + " ";
  3506. for (var i = 0, l = this.length; i < l; i++) {
  3507. if ((" " + this[i].className + " ").replace(rclass, " ").indexOf(className) > -1) {
  3508. return true;
  3509. }
  3510. }
  3511. return false;
  3512. };
  3513. jQuery.prototype.height = function (size) {
  3514. /// <summary>
  3515. /// 1: Get the current computed height for the first element in the set of matched elements.
  3516. /// 1.1 - height()
  3517. /// 2: Set the CSS height of every matched element.
  3518. /// 2.1 - height(value)
  3519. /// 2.2 - height(function(index, height))
  3520. /// </summary>
  3521. /// <param name="size" type="Number">
  3522. /// An integer representing the number of pixels, or an integer with an optional unit of measure appended (as a string).
  3523. /// </param>
  3524. /// <returns type="jQuery" />
  3525. // Get window width or height
  3526. var elem = this[0];
  3527. if (!elem) {
  3528. return size == null ? null : this;
  3529. }
  3530. if (jQuery.isFunction(size)) {
  3531. return this.each(function (i) {
  3532. var self = jQuery(this);
  3533. self[type](size.call(this, i, self[type]()));
  3534. });
  3535. }
  3536. if (jQuery.isWindow(elem)) {
  3537. // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
  3538. // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
  3539. var docElemProp = elem.document.documentElement["client" + name];
  3540. return elem.document.compatMode === "CSS1Compat" && docElemProp ||
  3541. elem.document.body["client" + name] || docElemProp;
  3542. // Get document width or height
  3543. } else if (elem.nodeType === 9) {
  3544. // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
  3545. return Math.max(
  3546. elem.documentElement["client" + name],
  3547. elem.body["scroll" + name], elem.documentElement["scroll" + name],
  3548. elem.body["offset" + name], elem.documentElement["offset" + name]
  3549. );
  3550. // Get or set width or height on the element
  3551. } else if (size === undefined) {
  3552. var orig = jQuery.css(elem, type),
  3553. ret = parseFloat(orig);
  3554. return jQuery.isNaN(ret) ? orig : ret;
  3555. // Set the width or height on the element (default to pixels if value is unitless)
  3556. } else {
  3557. return this.css(type, typeof size === "string" ? size : size + "px");
  3558. }
  3559. };
  3560. jQuery.prototype.hide = function (speed, easing, callback) {
  3561. /// <summary>
  3562. /// Hide the matched elements.
  3563. /// 1 - hide()
  3564. /// 2 - hide(duration, callback)
  3565. /// 3 - hide(duration, easing, callback)
  3566. /// </summary>
  3567. /// <param name="speed" type="Number">
  3568. /// A string or number determining how long the animation will run.
  3569. /// </param>
  3570. /// <param name="easing" type="String">
  3571. /// A string indicating which easing function to use for the transition.
  3572. /// </param>
  3573. /// <param name="callback" type="Function">
  3574. /// A function to call once the animation is complete.
  3575. /// </param>
  3576. /// <returns type="jQuery" />
  3577. if (speed || speed === 0) {
  3578. return this.animate(genFx("hide", 3), speed, easing, callback);
  3579. } else {
  3580. for (var i = 0, j = this.length; i < j; i++) {
  3581. var display = jQuery.css(this[i], "display");
  3582. if (display !== "none" && !jQuery._data(this[i], "olddisplay")) {
  3583. jQuery._data(this[i], "olddisplay", display);
  3584. }
  3585. }
  3586. // Set the display of the elements in a second loop
  3587. // to avoid the constant reflow
  3588. for (i = 0; i < j; i++) {
  3589. this[i].style.display = "none";
  3590. }
  3591. return this;
  3592. }
  3593. };
  3594. jQuery.prototype.hover = function (fnOver, fnOut) {
  3595. /// <summary>
  3596. /// 1: Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.
  3597. /// 1.1 - hover(handlerIn(eventObject), handlerOut(eventObject))
  3598. /// 2: Bind a single handler to the matched elements, to be executed when the mouse pointer enters or leaves the elements.
  3599. /// 2.1 - hover(handlerInOut(eventObject))
  3600. /// </summary>
  3601. /// <param name="fnOver" type="Function">
  3602. /// A function to execute when the mouse pointer enters the element.
  3603. /// </param>
  3604. /// <param name="fnOut" type="Function">
  3605. /// A function to execute when the mouse pointer leaves the element.
  3606. /// </param>
  3607. /// <returns type="jQuery" />
  3608. return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
  3609. };
  3610. jQuery.prototype.html = function (value) {
  3611. /// <summary>
  3612. /// 1: Get the HTML contents of the first element in the set of matched elements.
  3613. /// 1.1 - html()
  3614. /// 2: Set the HTML contents of each element in the set of matched elements.
  3615. /// 2.1 - html(htmlString)
  3616. /// 2.2 - html(function(index, oldhtml))
  3617. /// </summary>
  3618. /// <param name="value" type="String">
  3619. /// A string of HTML to set as the content of each matched element.
  3620. /// </param>
  3621. /// <returns type="jQuery" />
  3622. if (value === undefined) {
  3623. return this[0] && this[0].nodeType === 1 ?
  3624. this[0].innerHTML.replace(rinlinejQuery, "") :
  3625. null;
  3626. // See if we can take a shortcut and just use innerHTML
  3627. } else if (typeof value === "string" && !rnocache.test(value) &&
  3628. (jQuery.support.leadingWhitespace || !rleadingWhitespace.test(value)) &&
  3629. !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
  3630. value = value.replace(rxhtmlTag, "<$1></$2>");
  3631. try {
  3632. for (var i = 0, l = this.length; i < l; i++) {
  3633. // Remove element nodes and prevent memory leaks
  3634. if (this[i].nodeType === 1) {
  3635. jQuery.cleanData(this[i].getElementsByTagName("*"));
  3636. this[i].innerHTML = value;
  3637. }
  3638. }
  3639. // If using innerHTML throws an exception, use the fallback method
  3640. } catch (e) {
  3641. this.empty().append(value);
  3642. }
  3643. } else if (jQuery.isFunction(value)) {
  3644. this.each(function (i) {
  3645. var self = jQuery(this);
  3646. self.html(value.call(this, i, self.html()));
  3647. });
  3648. } else {
  3649. this.empty().append(value);
  3650. }
  3651. return this;
  3652. };
  3653. jQuery.prototype.index = function (elem) {
  3654. /// <summary>
  3655. /// Search for a given element from among the matched elements.
  3656. /// 1 - index()
  3657. /// 2 - index(selector)
  3658. /// 3 - index(element)
  3659. /// </summary>
  3660. /// <param name="elem" type="String">
  3661. /// A selector representing a jQuery collection in which to look for an element.
  3662. /// </param>
  3663. /// <returns type="Number" />
  3664. if (!elem || typeof elem === "string") {
  3665. return jQuery.inArray(this[0],
  3666. // If it receives a string, the selector is used
  3667. // If it receives nothing, the siblings are used
  3668. elem ? jQuery(elem) : this.parent().children());
  3669. }
  3670. // Locate the position of the desired element
  3671. return jQuery.inArray(
  3672. // If it receives a jQuery object, the first element is used
  3673. elem.jquery ? elem[0] : elem, this);
  3674. };
  3675. jQuery.prototype.init = function (selector, context, rootjQuery) {
  3676. var match, elem, ret, doc;
  3677. // Handle $(""), $(null), or $(undefined)
  3678. if (!selector) {
  3679. return this;
  3680. }
  3681. // Handle $(DOMElement)
  3682. if (selector.nodeType) {
  3683. this.context = this[0] = selector;
  3684. this.length = 1;
  3685. return this;
  3686. }
  3687. // The body element only exists once, optimize finding it
  3688. if (selector === "body" && !context && document.body) {
  3689. this.context = document;
  3690. this[0] = document.body;
  3691. this.selector = "body";
  3692. this.length = 1;
  3693. return this;
  3694. }
  3695. // Handle HTML strings
  3696. if (typeof selector === "string") {
  3697. // Are we dealing with HTML string or an ID?
  3698. match = quickExpr.exec(selector);
  3699. // Verify a match, and that no context was specified for #id
  3700. if (match && (match[1] || !context)) {
  3701. // HANDLE: $(html) -> $(array)
  3702. if (match[1]) {
  3703. context = context instanceof jQuery ? context[0] : context;
  3704. doc = (context ? context.ownerDocument || context : document);
  3705. // If a single string is passed in and it's a single tag
  3706. // just do a createElement and skip the rest
  3707. ret = rsingleTag.exec(selector);
  3708. if (ret) {
  3709. if (jQuery.isPlainObject(context)) {
  3710. selector = [document.createElement(ret[1])];
  3711. jQuery.fn.attr.call(selector, context, true);
  3712. } else {
  3713. selector = [doc.createElement(ret[1])];
  3714. }
  3715. } else {
  3716. ret = jQuery.buildFragment([match[1]], [doc]);
  3717. selector = (ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment).childNodes;
  3718. }
  3719. return jQuery.merge(this, selector);
  3720. // HANDLE: $("#id")
  3721. } else {
  3722. elem = document.getElementById(match[2]);
  3723. // Check parentNode to catch when Blackberry 4.6 returns
  3724. // nodes that are no longer in the document #6963
  3725. if (elem && elem.parentNode) {
  3726. // Handle the case where IE and Opera return items
  3727. // by name instead of ID
  3728. if (elem.id !== match[2]) {
  3729. return rootjQuery.find(selector);
  3730. }
  3731. // Otherwise, we inject the element directly into the jQuery object
  3732. this.length = 1;
  3733. this[0] = elem;
  3734. }
  3735. this.context = document;
  3736. this.selector = selector;
  3737. return this;
  3738. }
  3739. // HANDLE: $(expr, $(...))
  3740. } else if (!context || context.jquery) {
  3741. return (context || rootjQuery).find(selector);
  3742. // HANDLE: $(expr, context)
  3743. // (which is just equivalent to: $(context).find(expr)
  3744. } else {
  3745. return this.constructor(context).find(selector);
  3746. }
  3747. // HANDLE: $(function)
  3748. // Shortcut for document ready
  3749. } else if (jQuery.isFunction(selector)) {
  3750. return rootjQuery.ready(selector);
  3751. }
  3752. if (selector.selector !== undefined) {
  3753. this.selector = selector.selector;
  3754. this.context = selector.context;
  3755. }
  3756. return jQuery.makeArray(selector, this);
  3757. };
  3758. jQuery.prototype.innerHeight = function () {
  3759. /// <summary>
  3760. /// Get the current computed height for the first element in the set of matched elements, including padding but not border.
  3761. /// </summary>
  3762. /// <returns type="Number" />
  3763. return this[0] ?
  3764. parseFloat(jQuery.css(this[0], type, "padding")) :
  3765. null;
  3766. };
  3767. jQuery.prototype.innerWidth = function () {
  3768. /// <summary>
  3769. /// Get the current computed width for the first element in the set of matched elements, including padding but not border.
  3770. /// </summary>
  3771. /// <returns type="Number" />
  3772. return this[0] ?
  3773. parseFloat(jQuery.css(this[0], type, "padding")) :
  3774. null;
  3775. };
  3776. jQuery.prototype.insertAfter = function (selector) {
  3777. /// <summary>
  3778. /// Insert every element in the set of matched elements after the target.
  3779. /// </summary>
  3780. /// <param name="selector" type="jQuery">
  3781. /// A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted after the element(s) specified by this parameter.
  3782. /// </param>
  3783. /// <returns type="jQuery" />
  3784. var ret = [],
  3785. insert = jQuery(selector),
  3786. parent = this.length === 1 && this[0].parentNode;
  3787. if (parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1) {
  3788. insert[original](this[0]);
  3789. return this;
  3790. } else {
  3791. for (var i = 0, l = insert.length; i < l; i++) {
  3792. var elems = (i > 0 ? this.clone(true) : this).get();
  3793. jQuery(insert[i])[original](elems);
  3794. ret = ret.concat(elems);
  3795. }
  3796. return this.pushStack(ret, name, insert.selector);
  3797. }
  3798. };
  3799. jQuery.prototype.insertBefore = function (selector) {
  3800. /// <summary>
  3801. /// Insert every element in the set of matched elements before the target.
  3802. /// </summary>
  3803. /// <param name="selector" type="jQuery">
  3804. /// A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted before the element(s) specified by this parameter.
  3805. /// </param>
  3806. /// <returns type="jQuery" />
  3807. var ret = [],
  3808. insert = jQuery(selector),
  3809. parent = this.length === 1 && this[0].parentNode;
  3810. if (parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1) {
  3811. insert[original](this[0]);
  3812. return this;
  3813. } else {
  3814. for (var i = 0, l = insert.length; i < l; i++) {
  3815. var elems = (i > 0 ? this.clone(true) : this).get();
  3816. jQuery(insert[i])[original](elems);
  3817. ret = ret.concat(elems);
  3818. }
  3819. return this.pushStack(ret, name, insert.selector);
  3820. }
  3821. };
  3822. jQuery.prototype.is = function (selector) {
  3823. /// <summary>
  3824. /// Check the current matched set of elements against a selector and return true if at least one of these elements matches the selector.
  3825. /// </summary>
  3826. /// <param name="selector" type="String">
  3827. /// A string containing a selector expression to match elements against.
  3828. /// </param>
  3829. /// <returns type="Boolean" />
  3830. return !!selector && jQuery.filter(selector, this).length > 0;
  3831. };
  3832. jQuery.prototype.keydown = function (data, fn) {
  3833. /// <summary>
  3834. /// Bind an event handler to the "keydown" JavaScript event, or trigger that event on an element.
  3835. /// 1 - keydown(handler(eventObject))
  3836. /// 2 - keydown(eventData, handler(eventObject))
  3837. /// 3 - keydown()
  3838. /// </summary>
  3839. /// <param name="data" type="Object">
  3840. /// A map of data that will be passed to the event handler.
  3841. /// </param>
  3842. /// <param name="fn" type="Function">
  3843. /// A function to execute each time the event is triggered.
  3844. /// </param>
  3845. /// <returns type="jQuery" />
  3846. if (fn == null) {
  3847. fn = data;
  3848. data = null;
  3849. }
  3850. return arguments.length > 0 ?
  3851. this.bind(name, data, fn) :
  3852. this.trigger(name);
  3853. };
  3854. jQuery.prototype.keypress = function (data, fn) {
  3855. /// <summary>
  3856. /// Bind an event handler to the "keypress" JavaScript event, or trigger that event on an element.
  3857. /// 1 - keypress(handler(eventObject))
  3858. /// 2 - keypress(eventData, handler(eventObject))
  3859. /// 3 - keypress()
  3860. /// </summary>
  3861. /// <param name="data" type="Object">
  3862. /// A map of data that will be passed to the event handler.
  3863. /// </param>
  3864. /// <param name="fn" type="Function">
  3865. /// A function to execute each time the event is triggered.
  3866. /// </param>
  3867. /// <returns type="jQuery" />
  3868. if (fn == null) {
  3869. fn = data;
  3870. data = null;
  3871. }
  3872. return arguments.length > 0 ?
  3873. this.bind(name, data, fn) :
  3874. this.trigger(name);
  3875. };
  3876. jQuery.prototype.keyup = function (data, fn) {
  3877. /// <summary>
  3878. /// Bind an event handler to the "keyup" JavaScript event, or trigger that event on an element.
  3879. /// 1 - keyup(handler(eventObject))
  3880. /// 2 - keyup(eventData, handler(eventObject))
  3881. /// 3 - keyup()
  3882. /// </summary>
  3883. /// <param name="data" type="Object">
  3884. /// A map of data that will be passed to the event handler.
  3885. /// </param>
  3886. /// <param name="fn" type="Function">
  3887. /// A function to execute each time the event is triggered.
  3888. /// </param>
  3889. /// <returns type="jQuery" />
  3890. if (fn == null) {
  3891. fn = data;
  3892. data = null;
  3893. }
  3894. return arguments.length > 0 ?
  3895. this.bind(name, data, fn) :
  3896. this.trigger(name);
  3897. };
  3898. jQuery.prototype.last = function () {
  3899. /// <summary>
  3900. /// Reduce the set of matched elements to the final one in the set.
  3901. /// </summary>
  3902. /// <returns type="jQuery" />
  3903. return this.eq(-1);
  3904. };
  3905. jQuery.prototype.length = 0;
  3906. jQuery.prototype.live = function (types, data, fn, origSelector /* Internal Use Only */) {
  3907. /// <summary>
  3908. /// Attach a handler to the event for all elements which match the current selector, now and in the future.
  3909. /// 1 - live(eventType, handler)
  3910. /// 2 - live(eventType, eventData, handler)
  3911. /// </summary>
  3912. /// <param name="types" type="String">
  3913. /// A string containing a JavaScript event type, such as "click" or "keydown." As of jQuery 1.4 the string can contain multiple, space-separated event types or custom event names, as well.
  3914. /// </param>
  3915. /// <param name="data" type="Object">
  3916. /// A map of data that will be passed to the event handler.
  3917. /// </param>
  3918. /// <param name="fn" type="Function">
  3919. /// A function to execute at the time the event is triggered.
  3920. /// </param>
  3921. /// <returns type="jQuery" />
  3922. var type, i = 0, match, namespaces, preType,
  3923. selector = origSelector || this.selector,
  3924. context = origSelector ? this : jQuery(this.context);
  3925. if (typeof types === "object" && !types.preventDefault) {
  3926. for (var key in types) {
  3927. context[name](key, data, types[key], selector);
  3928. }
  3929. return this;
  3930. }
  3931. if (jQuery.isFunction(data)) {
  3932. fn = data;
  3933. data = undefined;
  3934. }
  3935. types = (types || "").split(" ");
  3936. while ((type = types[i++]) != null) {
  3937. match = rnamespaces.exec(type);
  3938. namespaces = "";
  3939. if (match) {
  3940. namespaces = match[0];
  3941. type = type.replace(rnamespaces, "");
  3942. }
  3943. if (type === "hover") {
  3944. types.push("mouseenter" + namespaces, "mouseleave" + namespaces);
  3945. continue;
  3946. }
  3947. preType = type;
  3948. if (type === "focus" || type === "blur") {
  3949. types.push(liveMap[type] + namespaces);
  3950. type = type + namespaces;
  3951. } else {
  3952. type = (liveMap[type] || type) + namespaces;
  3953. }
  3954. if (name === "live") {
  3955. // bind live handler
  3956. for (var j = 0, l = context.length; j < l; j++) {
  3957. jQuery.event.add(context[j], "live." + liveConvert(type, selector),
  3958. { data: data, selector: selector, handler: fn, origType: type, origHandler: fn, preType: preType });
  3959. }
  3960. } else {
  3961. // unbind live handler
  3962. context.unbind("live." + liveConvert(type, selector), fn);
  3963. }
  3964. }
  3965. return this;
  3966. };
  3967. jQuery.prototype.load = function (url, params, callback) {
  3968. /// <summary>
  3969. /// 1: Bind an event handler to the "load" JavaScript event.
  3970. /// 1.1 - load(handler(eventObject))
  3971. /// 1.2 - load(eventData, handler(eventObject))
  3972. /// 2: Load data from the server and place the returned HTML into the matched element.
  3973. /// 2.1 - load(url, data, complete(responseText, textStatus, XMLHttpRequest))
  3974. /// </summary>
  3975. /// <param name="url" type="String">
  3976. /// A string containing the URL to which the request is sent.
  3977. /// </param>
  3978. /// <param name="params" type="String">
  3979. /// A map or string that is sent to the server with the request.
  3980. /// </param>
  3981. /// <param name="callback" type="Function">
  3982. /// A callback function that is executed when the request completes.
  3983. /// </param>
  3984. /// <returns type="jQuery" />
  3985. if (typeof url !== "string" && _load) {
  3986. return _load.apply(this, arguments);
  3987. // Don't do a request if no elements are being requested
  3988. } else if (!this.length) {
  3989. return this;
  3990. }
  3991. var off = url.indexOf(" ");
  3992. if (off >= 0) {
  3993. var selector = url.slice(off, url.length);
  3994. url = url.slice(0, off);
  3995. }
  3996. // Default to a GET request
  3997. var type = "GET";
  3998. // If the second parameter was provided
  3999. if (params) {
  4000. // If it's a function
  4001. if (jQuery.isFunction(params)) {
  4002. // We assume that it's the callback
  4003. callback = params;
  4004. params = null;
  4005. // Otherwise, build a param string
  4006. } else if (typeof params === "object") {
  4007. params = jQuery.param(params, jQuery.ajaxSettings.traditional);
  4008. type = "POST";
  4009. }
  4010. }
  4011. var self = this;
  4012. // Request the remote document
  4013. jQuery.ajax({
  4014. url: url,
  4015. type: type,
  4016. dataType: "html",
  4017. data: params,
  4018. // Complete callback (responseText is used internally)
  4019. complete: function (jXHR, status, responseText) {
  4020. // Store the response as specified by the jXHR object
  4021. responseText = jXHR.responseText;
  4022. // If successful, inject the HTML into all the matched elements
  4023. if (jXHR.isResolved()) {
  4024. // #4825: Get the actual response in case
  4025. // a dataFilter is present in ajaxSettings
  4026. jXHR.done(function (r) {
  4027. responseText = r;
  4028. });
  4029. // See if a selector was specified
  4030. self.html(selector ?
  4031. // Create a dummy div to hold the results
  4032. jQuery("<div>")
  4033. // inject the contents of the document in, removing the scripts
  4034. // to avoid any 'Permission Denied' errors in IE
  4035. .append(responseText.replace(rscript, ""))
  4036. // Locate the specified elements
  4037. .find(selector) :
  4038. // If not, just inject the full result
  4039. responseText);
  4040. }
  4041. if (callback) {
  4042. self.each(callback, [responseText, status, jXHR]);
  4043. }
  4044. }
  4045. });
  4046. return this;
  4047. };
  4048. jQuery.prototype.map = function (callback) {
  4049. /// <summary>
  4050. /// Pass each element in the current matched set through a function, producing a new jQuery object containing the return values.
  4051. /// </summary>
  4052. /// <param name="callback" type="Function">
  4053. /// A function object that will be invoked for each element in the current set.
  4054. /// </param>
  4055. /// <returns type="jQuery" />
  4056. return this.pushStack(jQuery.map(this, function (elem, i) {
  4057. return callback.call(elem, i, elem);
  4058. }));
  4059. };
  4060. jQuery.prototype.mousedown = function (data, fn) {
  4061. /// <summary>
  4062. /// Bind an event handler to the "mousedown" JavaScript event, or trigger that event on an element.
  4063. /// 1 - mousedown(handler(eventObject))
  4064. /// 2 - mousedown(eventData, handler(eventObject))
  4065. /// 3 - mousedown()
  4066. /// </summary>
  4067. /// <param name="data" type="Object">
  4068. /// A map of data that will be passed to the event handler.
  4069. /// </param>
  4070. /// <param name="fn" type="Function">
  4071. /// A function to execute each time the event is triggered.
  4072. /// </param>
  4073. /// <returns type="jQuery" />
  4074. if (fn == null) {
  4075. fn = data;
  4076. data = null;
  4077. }
  4078. return arguments.length > 0 ?
  4079. this.bind(name, data, fn) :
  4080. this.trigger(name);
  4081. };
  4082. jQuery.prototype.mouseenter = function (data, fn) {
  4083. /// <summary>
  4084. /// Bind an event handler to be fired when the mouse enters an element, or trigger that handler on an element.
  4085. /// 1 - mouseenter(handler(eventObject))
  4086. /// 2 - mouseenter(eventData, handler(eventObject))
  4087. /// 3 - mouseenter()
  4088. /// </summary>
  4089. /// <param name="data" type="Object">
  4090. /// A map of data that will be passed to the event handler.
  4091. /// </param>
  4092. /// <param name="fn" type="Function">
  4093. /// A function to execute each time the event is triggered.
  4094. /// </param>
  4095. /// <returns type="jQuery" />
  4096. if (fn == null) {
  4097. fn = data;
  4098. data = null;
  4099. }
  4100. return arguments.length > 0 ?
  4101. this.bind(name, data, fn) :
  4102. this.trigger(name);
  4103. };
  4104. jQuery.prototype.mouseleave = function (data, fn) {
  4105. /// <summary>
  4106. /// Bind an event handler to be fired when the mouse leaves an element, or trigger that handler on an element.
  4107. /// 1 - mouseleave(handler(eventObject))
  4108. /// 2 - mouseleave(eventData, handler(eventObject))
  4109. /// 3 - mouseleave()
  4110. /// </summary>
  4111. /// <param name="data" type="Object">
  4112. /// A map of data that will be passed to the event handler.
  4113. /// </param>
  4114. /// <param name="fn" type="Function">
  4115. /// A function to execute each time the event is triggered.
  4116. /// </param>
  4117. /// <returns type="jQuery" />
  4118. if (fn == null) {
  4119. fn = data;
  4120. data = null;
  4121. }
  4122. return arguments.length > 0 ?
  4123. this.bind(name, data, fn) :
  4124. this.trigger(name);
  4125. };
  4126. jQuery.prototype.mousemove = function (data, fn) {
  4127. /// <summary>
  4128. /// Bind an event handler to the "mousemove" JavaScript event, or trigger that event on an element.
  4129. /// 1 - mousemove(handler(eventObject))
  4130. /// 2 - mousemove(eventData, handler(eventObject))
  4131. /// 3 - mousemove()
  4132. /// </summary>
  4133. /// <param name="data" type="Object">
  4134. /// A map of data that will be passed to the event handler.
  4135. /// </param>
  4136. /// <param name="fn" type="Function">
  4137. /// A function to execute each time the event is triggered.
  4138. /// </param>
  4139. /// <returns type="jQuery" />
  4140. if (fn == null) {
  4141. fn = data;
  4142. data = null;
  4143. }
  4144. return arguments.length > 0 ?
  4145. this.bind(name, data, fn) :
  4146. this.trigger(name);
  4147. };
  4148. jQuery.prototype.mouseout = function (data, fn) {
  4149. /// <summary>
  4150. /// Bind an event handler to the "mouseout" JavaScript event, or trigger that event on an element.
  4151. /// 1 - mouseout(handler(eventObject))
  4152. /// 2 - mouseout(eventData, handler(eventObject))
  4153. /// 3 - mouseout()
  4154. /// </summary>
  4155. /// <param name="data" type="Object">
  4156. /// A map of data that will be passed to the event handler.
  4157. /// </param>
  4158. /// <param name="fn" type="Function">
  4159. /// A function to execute each time the event is triggered.
  4160. /// </param>
  4161. /// <returns type="jQuery" />
  4162. if (fn == null) {
  4163. fn = data;
  4164. data = null;
  4165. }
  4166. return arguments.length > 0 ?
  4167. this.bind(name, data, fn) :
  4168. this.trigger(name);
  4169. };
  4170. jQuery.prototype.mouseover = function (data, fn) {
  4171. /// <summary>
  4172. /// Bind an event handler to the "mouseover" JavaScript event, or trigger that event on an element.
  4173. /// 1 - mouseover(handler(eventObject))
  4174. /// 2 - mouseover(eventData, handler(eventObject))
  4175. /// 3 - mouseover()
  4176. /// </summary>
  4177. /// <param name="data" type="Object">
  4178. /// A map of data that will be passed to the event handler.
  4179. /// </param>
  4180. /// <param name="fn" type="Function">
  4181. /// A function to execute each time the event is triggered.
  4182. /// </param>
  4183. /// <returns type="jQuery" />
  4184. if (fn == null) {
  4185. fn = data;
  4186. data = null;
  4187. }
  4188. return arguments.length > 0 ?
  4189. this.bind(name, data, fn) :
  4190. this.trigger(name);
  4191. };
  4192. jQuery.prototype.mouseup = function (data, fn) {
  4193. /// <summary>
  4194. /// Bind an event handler to the "mouseup" JavaScript event, or trigger that event on an element.
  4195. /// 1 - mouseup(handler(eventObject))
  4196. /// 2 - mouseup(eventData, handler(eventObject))
  4197. /// 3 - mouseup()
  4198. /// </summary>
  4199. /// <param name="data" type="Object">
  4200. /// A map of data that will be passed to the event handler.
  4201. /// </param>
  4202. /// <param name="fn" type="Function">
  4203. /// A function to execute each time the event is triggered.
  4204. /// </param>
  4205. /// <returns type="jQuery" />
  4206. if (fn == null) {
  4207. fn = data;
  4208. data = null;
  4209. }
  4210. return arguments.length > 0 ?
  4211. this.bind(name, data, fn) :
  4212. this.trigger(name);
  4213. };
  4214. jQuery.prototype.next = function (until, selector) {
  4215. /// <summary>
  4216. /// Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.
  4217. /// </summary>
  4218. /// <param name="until" type="String">
  4219. /// A string containing a selector expression to match elements against.
  4220. /// </param>
  4221. /// <returns type="jQuery" />
  4222. var ret = jQuery.map(this, fn, until),
  4223. // The variable 'args' was introduced in
  4224. // https://github.com/jquery/jquery/commit/52a0238
  4225. // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
  4226. // http://code.google.com/p/v8/issues/detail?id=1050
  4227. args = slice.call(arguments);
  4228. if (!runtil.test(name)) {
  4229. selector = until;
  4230. }
  4231. if (selector && typeof selector === "string") {
  4232. ret = jQuery.filter(selector, ret);
  4233. }
  4234. ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
  4235. if ((this.length > 1 || rmultiselector.test(selector)) && rparentsprev.test(name)) {
  4236. ret = ret.reverse();
  4237. }
  4238. return this.pushStack(ret, name, args.join(","));
  4239. };
  4240. jQuery.prototype.nextAll = function (until, selector) {
  4241. /// <summary>
  4242. /// Get all following siblings of each element in the set of matched elements, optionally filtered by a selector.
  4243. /// </summary>
  4244. /// <param name="until" type="String">
  4245. /// A string containing a selector expression to match elements against.
  4246. /// </param>
  4247. /// <returns type="jQuery" />
  4248. var ret = jQuery.map(this, fn, until),
  4249. // The variable 'args' was introduced in
  4250. // https://github.com/jquery/jquery/commit/52a0238
  4251. // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
  4252. // http://code.google.com/p/v8/issues/detail?id=1050
  4253. args = slice.call(arguments);
  4254. if (!runtil.test(name)) {
  4255. selector = until;
  4256. }
  4257. if (selector && typeof selector === "string") {
  4258. ret = jQuery.filter(selector, ret);
  4259. }
  4260. ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
  4261. if ((this.length > 1 || rmultiselector.test(selector)) && rparentsprev.test(name)) {
  4262. ret = ret.reverse();
  4263. }
  4264. return this.pushStack(ret, name, args.join(","));
  4265. };
  4266. jQuery.prototype.nextUntil = function (until, selector) {
  4267. /// <summary>
  4268. /// Get all following siblings of each element up to but not including the element matched by the selector.
  4269. /// </summary>
  4270. /// <param name="until" type="String">
  4271. /// A string containing a selector expression to indicate where to stop matching following sibling elements.
  4272. /// </param>
  4273. /// <returns type="jQuery" />
  4274. var ret = jQuery.map(this, fn, until),
  4275. // The variable 'args' was introduced in
  4276. // https://github.com/jquery/jquery/commit/52a0238
  4277. // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
  4278. // http://code.google.com/p/v8/issues/detail?id=1050
  4279. args = slice.call(arguments);
  4280. if (!runtil.test(name)) {
  4281. selector = until;
  4282. }
  4283. if (selector && typeof selector === "string") {
  4284. ret = jQuery.filter(selector, ret);
  4285. }
  4286. ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
  4287. if ((this.length > 1 || rmultiselector.test(selector)) && rparentsprev.test(name)) {
  4288. ret = ret.reverse();
  4289. }
  4290. return this.pushStack(ret, name, args.join(","));
  4291. };
  4292. jQuery.prototype.not = function (selector) {
  4293. /// <summary>
  4294. /// Remove elements from the set of matched elements.
  4295. /// 1 - not(selector)
  4296. /// 2 - not(elements)
  4297. /// 3 - not(function(index))
  4298. /// </summary>
  4299. /// <param name="selector" type="String">
  4300. /// A string containing a selector expression to match elements against.
  4301. /// </param>
  4302. /// <returns type="jQuery" />
  4303. return this.pushStack(winnow(this, selector, false), "not", selector);
  4304. };
  4305. jQuery.prototype.offset = function (options) {
  4306. /// <summary>
  4307. /// 1: Get the current coordinates of the first element in the set of matched elements, relative to the document.
  4308. /// 1.1 - offset()
  4309. /// 2: Set the current coordinates of every element in the set of matched elements, relative to the document.
  4310. /// 2.1 - offset(coordinates)
  4311. /// 2.2 - offset(function(index, coords))
  4312. /// </summary>
  4313. /// <param name="options" type="Object">
  4314. /// An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements.
  4315. /// </param>
  4316. /// <returns type="jQuery" />
  4317. var elem = this[0], box;
  4318. if (options) {
  4319. return this.each(function (i) {
  4320. jQuery.offset.setOffset(this, options, i);
  4321. });
  4322. }
  4323. if (!elem || !elem.ownerDocument) {
  4324. return null;
  4325. }
  4326. if (elem === elem.ownerDocument.body) {
  4327. return jQuery.offset.bodyOffset(elem);
  4328. }
  4329. try {
  4330. box = elem.getBoundingClientRect();
  4331. } catch (e) { }
  4332. var doc = elem.ownerDocument,
  4333. docElem = doc.documentElement;
  4334. // Make sure we're not dealing with a disconnected DOM node
  4335. if (!box || !jQuery.contains(docElem, elem)) {
  4336. return box ? { top: box.top, left: box.left} : { top: 0, left: 0 };
  4337. }
  4338. var body = doc.body,
  4339. win = getWindow(doc),
  4340. clientTop = docElem.clientTop || body.clientTop || 0,
  4341. clientLeft = docElem.clientLeft || body.clientLeft || 0,
  4342. scrollTop = (win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop),
  4343. scrollLeft = (win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft),
  4344. top = box.top + scrollTop - clientTop,
  4345. left = box.left + scrollLeft - clientLeft;
  4346. return { top: top, left: left };
  4347. };
  4348. jQuery.prototype.offsetParent = function () {
  4349. /// <summary>
  4350. /// Get the closest ancestor element that is positioned.
  4351. /// </summary>
  4352. /// <returns type="jQuery" />
  4353. return this.map(function () {
  4354. var offsetParent = this.offsetParent || document.body;
  4355. while (offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static")) {
  4356. offsetParent = offsetParent.offsetParent;
  4357. }
  4358. return offsetParent;
  4359. });
  4360. };
  4361. jQuery.prototype.one = function (type, data, fn) {
  4362. /// <summary>
  4363. /// Attach a handler to an event for the elements. The handler is executed at most once per element.
  4364. /// </summary>
  4365. /// <param name="type" type="String">
  4366. /// A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names.
  4367. /// </param>
  4368. /// <param name="data" type="Object">
  4369. /// A map of data that will be passed to the event handler.
  4370. /// </param>
  4371. /// <param name="fn" type="Function">
  4372. /// A function to execute at the time the event is triggered.
  4373. /// </param>
  4374. /// <returns type="jQuery" />
  4375. // Handle object literals
  4376. if (typeof type === "object") {
  4377. for (var key in type) {
  4378. this[name](key, data, type[key], fn);
  4379. }
  4380. return this;
  4381. }
  4382. if (jQuery.isFunction(data) || data === false) {
  4383. fn = data;
  4384. data = undefined;
  4385. }
  4386. var handler = name === "one" ? jQuery.proxy(fn, function (event) {
  4387. jQuery(this).unbind(event, handler);
  4388. return fn.apply(this, arguments);
  4389. }) : fn;
  4390. if (type === "unload" && name !== "one") {
  4391. this.one(type, data, fn);
  4392. } else {
  4393. for (var i = 0, l = this.length; i < l; i++) {
  4394. jQuery.event.add(this[i], type, handler, data);
  4395. }
  4396. }
  4397. return this;
  4398. };
  4399. jQuery.prototype.outerHeight = function (margin) {
  4400. /// <summary>
  4401. /// Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin.
  4402. /// </summary>
  4403. /// <param name="margin" type="Boolean">
  4404. /// A Boolean indicating whether to include the element's margin in the calculation.
  4405. /// </param>
  4406. /// <returns type="Number" />
  4407. return this[0] ?
  4408. parseFloat(jQuery.css(this[0], type, margin ? "margin" : "border")) :
  4409. null;
  4410. };
  4411. jQuery.prototype.outerWidth = function (margin) {
  4412. /// <summary>
  4413. /// Get the current computed width for the first element in the set of matched elements, including padding and border.
  4414. /// </summary>
  4415. /// <param name="margin" type="Boolean">
  4416. /// A Boolean indicating whether to include the element's margin in the calculation.
  4417. /// </param>
  4418. /// <returns type="Number" />
  4419. return this[0] ?
  4420. parseFloat(jQuery.css(this[0], type, margin ? "margin" : "border")) :
  4421. null;
  4422. };
  4423. jQuery.prototype.parent = function (until, selector) {
  4424. /// <summary>
  4425. /// Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
  4426. /// </summary>
  4427. /// <param name="until" type="String">
  4428. /// A string containing a selector expression to match elements against.
  4429. /// </param>
  4430. /// <returns type="jQuery" />
  4431. var ret = jQuery.map(this, fn, until),
  4432. // The variable 'args' was introduced in
  4433. // https://github.com/jquery/jquery/commit/52a0238
  4434. // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
  4435. // http://code.google.com/p/v8/issues/detail?id=1050
  4436. args = slice.call(arguments);
  4437. if (!runtil.test(name)) {
  4438. selector = until;
  4439. }
  4440. if (selector && typeof selector === "string") {
  4441. ret = jQuery.filter(selector, ret);
  4442. }
  4443. ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
  4444. if ((this.length > 1 || rmultiselector.test(selector)) && rparentsprev.test(name)) {
  4445. ret = ret.reverse();
  4446. }
  4447. return this.pushStack(ret, name, args.join(","));
  4448. };
  4449. jQuery.prototype.parents = function (until, selector) {
  4450. /// <summary>
  4451. /// Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector.
  4452. /// </summary>
  4453. /// <param name="until" type="String">
  4454. /// A string containing a selector expression to match elements against.
  4455. /// </param>
  4456. /// <returns type="jQuery" />
  4457. var ret = jQuery.map(this, fn, until),
  4458. // The variable 'args' was introduced in
  4459. // https://github.com/jquery/jquery/commit/52a0238
  4460. // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
  4461. // http://code.google.com/p/v8/issues/detail?id=1050
  4462. args = slice.call(arguments);
  4463. if (!runtil.test(name)) {
  4464. selector = until;
  4465. }
  4466. if (selector && typeof selector === "string") {
  4467. ret = jQuery.filter(selector, ret);
  4468. }
  4469. ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
  4470. if ((this.length > 1 || rmultiselector.test(selector)) && rparentsprev.test(name)) {
  4471. ret = ret.reverse();
  4472. }
  4473. return this.pushStack(ret, name, args.join(","));
  4474. };
  4475. jQuery.prototype.parentsUntil = function (until, selector) {
  4476. /// <summary>
  4477. /// Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector.
  4478. /// </summary>
  4479. /// <param name="until" type="String">
  4480. /// A string containing a selector expression to indicate where to stop matching ancestor elements.
  4481. /// </param>
  4482. /// <returns type="jQuery" />
  4483. var ret = jQuery.map(this, fn, until),
  4484. // The variable 'args' was introduced in
  4485. // https://github.com/jquery/jquery/commit/52a0238
  4486. // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
  4487. // http://code.google.com/p/v8/issues/detail?id=1050
  4488. args = slice.call(arguments);
  4489. if (!runtil.test(name)) {
  4490. selector = until;
  4491. }
  4492. if (selector && typeof selector === "string") {
  4493. ret = jQuery.filter(selector, ret);
  4494. }
  4495. ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
  4496. if ((this.length > 1 || rmultiselector.test(selector)) && rparentsprev.test(name)) {
  4497. ret = ret.reverse();
  4498. }
  4499. return this.pushStack(ret, name, args.join(","));
  4500. };
  4501. jQuery.prototype.position = function () {
  4502. /// <summary>
  4503. /// Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.
  4504. /// </summary>
  4505. /// <returns type="Object" />
  4506. if (!this[0]) {
  4507. return null;
  4508. }
  4509. var elem = this[0],
  4510. // Get *real* offsetParent
  4511. offsetParent = this.offsetParent(),
  4512. // Get correct offsets
  4513. offset = this.offset(),
  4514. parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0} : offsetParent.offset();
  4515. // Subtract element margins
  4516. // note: when an element has margin: auto the offsetLeft and marginLeft
  4517. // are the same in Safari causing offset.left to incorrectly be 0
  4518. offset.top -= parseFloat(jQuery.css(elem, "marginTop")) || 0;
  4519. offset.left -= parseFloat(jQuery.css(elem, "marginLeft")) || 0;
  4520. // Add offsetParent borders
  4521. parentOffset.top += parseFloat(jQuery.css(offsetParent[0], "borderTopWidth")) || 0;
  4522. parentOffset.left += parseFloat(jQuery.css(offsetParent[0], "borderLeftWidth")) || 0;
  4523. // Subtract the two offsets
  4524. return {
  4525. top: offset.top - parentOffset.top,
  4526. left: offset.left - parentOffset.left
  4527. };
  4528. };
  4529. jQuery.prototype.prepend = function () {
  4530. /// <summary>
  4531. /// Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
  4532. /// 1 - prepend(content, content)
  4533. /// 2 - prepend(function(index, html))
  4534. /// </summary>
  4535. /// <param name="" type="jQuery">
  4536. /// DOM element, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements.
  4537. /// </param>
  4538. /// <param name="" type="jQuery">
  4539. /// One or more additional DOM elements, array of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements.
  4540. /// </param>
  4541. /// <returns type="jQuery" />
  4542. return this.domManip(arguments, true, function (elem) {
  4543. if (this.nodeType === 1) {
  4544. this.insertBefore(elem, this.firstChild);
  4545. }
  4546. });
  4547. };
  4548. jQuery.prototype.prependTo = function (selector) {
  4549. /// <summary>
  4550. /// Insert every element in the set of matched elements to the beginning of the target.
  4551. /// </summary>
  4552. /// <param name="selector" type="jQuery">
  4553. /// A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted at the beginning of the element(s) specified by this parameter.
  4554. /// </param>
  4555. /// <returns type="jQuery" />
  4556. var ret = [],
  4557. insert = jQuery(selector),
  4558. parent = this.length === 1 && this[0].parentNode;
  4559. if (parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1) {
  4560. insert[original](this[0]);
  4561. return this;
  4562. } else {
  4563. for (var i = 0, l = insert.length; i < l; i++) {
  4564. var elems = (i > 0 ? this.clone(true) : this).get();
  4565. jQuery(insert[i])[original](elems);
  4566. ret = ret.concat(elems);
  4567. }
  4568. return this.pushStack(ret, name, insert.selector);
  4569. }
  4570. };
  4571. jQuery.prototype.prev = function (until, selector) {
  4572. /// <summary>
  4573. /// Get the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector.
  4574. /// </summary>
  4575. /// <param name="until" type="String">
  4576. /// A string containing a selector expression to match elements against.
  4577. /// </param>
  4578. /// <returns type="jQuery" />
  4579. var ret = jQuery.map(this, fn, until),
  4580. // The variable 'args' was introduced in
  4581. // https://github.com/jquery/jquery/commit/52a0238
  4582. // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
  4583. // http://code.google.com/p/v8/issues/detail?id=1050
  4584. args = slice.call(arguments);
  4585. if (!runtil.test(name)) {
  4586. selector = until;
  4587. }
  4588. if (selector && typeof selector === "string") {
  4589. ret = jQuery.filter(selector, ret);
  4590. }
  4591. ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
  4592. if ((this.length > 1 || rmultiselector.test(selector)) && rparentsprev.test(name)) {
  4593. ret = ret.reverse();
  4594. }
  4595. return this.pushStack(ret, name, args.join(","));
  4596. };
  4597. jQuery.prototype.prevAll = function (until, selector) {
  4598. /// <summary>
  4599. /// Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector.
  4600. /// </summary>
  4601. /// <param name="until" type="String">
  4602. /// A string containing a selector expression to match elements against.
  4603. /// </param>
  4604. /// <returns type="jQuery" />
  4605. var ret = jQuery.map(this, fn, until),
  4606. // The variable 'args' was introduced in
  4607. // https://github.com/jquery/jquery/commit/52a0238
  4608. // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
  4609. // http://code.google.com/p/v8/issues/detail?id=1050
  4610. args = slice.call(arguments);
  4611. if (!runtil.test(name)) {
  4612. selector = until;
  4613. }
  4614. if (selector && typeof selector === "string") {
  4615. ret = jQuery.filter(selector, ret);
  4616. }
  4617. ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
  4618. if ((this.length > 1 || rmultiselector.test(selector)) && rparentsprev.test(name)) {
  4619. ret = ret.reverse();
  4620. }
  4621. return this.pushStack(ret, name, args.join(","));
  4622. };
  4623. jQuery.prototype.prevUntil = function (until, selector) {
  4624. /// <summary>
  4625. /// Get all preceding siblings of each element up to but not including the element matched by the selector.
  4626. /// </summary>
  4627. /// <param name="until" type="String">
  4628. /// A string containing a selector expression to indicate where to stop matching preceding sibling elements.
  4629. /// </param>
  4630. /// <returns type="jQuery" />
  4631. var ret = jQuery.map(this, fn, until),
  4632. // The variable 'args' was introduced in
  4633. // https://github.com/jquery/jquery/commit/52a0238
  4634. // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
  4635. // http://code.google.com/p/v8/issues/detail?id=1050
  4636. args = slice.call(arguments);
  4637. if (!runtil.test(name)) {
  4638. selector = until;
  4639. }
  4640. if (selector && typeof selector === "string") {
  4641. ret = jQuery.filter(selector, ret);
  4642. }
  4643. ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
  4644. if ((this.length > 1 || rmultiselector.test(selector)) && rparentsprev.test(name)) {
  4645. ret = ret.reverse();
  4646. }
  4647. return this.pushStack(ret, name, args.join(","));
  4648. };
  4649. jQuery.prototype.pushStack = function (elems, name, selector) {
  4650. /// <summary>
  4651. /// Add a collection of DOM elements onto the jQuery stack.
  4652. /// 1 - pushStack(elements)
  4653. /// 2 - pushStack(elements, name, arguments)
  4654. /// </summary>
  4655. /// <param name="elems" type="Array">
  4656. /// An array of elements to push onto the stack and make into a new jQuery object.
  4657. /// </param>
  4658. /// <param name="name" type="String">
  4659. /// The name of a jQuery method that generated the array of elements.
  4660. /// </param>
  4661. /// <param name="selector" type="Array">
  4662. /// The arguments that were passed in to the jQuery method (for serialization).
  4663. /// </param>
  4664. /// <returns type="jQuery" />
  4665. // Build a new jQuery matched element set
  4666. var ret = this.constructor();
  4667. if (jQuery.isArray(elems)) {
  4668. push.apply(ret, elems);
  4669. } else {
  4670. jQuery.merge(ret, elems);
  4671. }
  4672. // Add the old object onto the stack (as a reference)
  4673. ret.prevObject = this;
  4674. ret.context = this.context;
  4675. if (name === "find") {
  4676. ret.selector = this.selector + (this.selector ? " " : "") + selector;
  4677. } else if (name) {
  4678. ret.selector = this.selector + "." + name + "(" + selector + ")";
  4679. }
  4680. // Return the newly-formed element set
  4681. return ret;
  4682. };
  4683. jQuery.prototype.queue = function (type, data) {
  4684. /// <summary>
  4685. /// 1: Show the queue of functions to be executed on the matched elements.
  4686. /// 1.1 - queue(queueName)
  4687. /// 2: Manipulate the queue of functions to be executed on the matched elements.
  4688. /// 2.1 - queue(queueName, newQueue)
  4689. /// 2.2 - queue(queueName, callback( next ))
  4690. /// </summary>
  4691. /// <param name="type" type="String">
  4692. /// A string containing the name of the queue. Defaults to fx, the standard effects queue.
  4693. /// </param>
  4694. /// <param name="data" type="Array">
  4695. /// An array of functions to replace the current queue contents.
  4696. /// </param>
  4697. /// <returns type="jQuery" />
  4698. if (typeof type !== "string") {
  4699. data = type;
  4700. type = "fx";
  4701. }
  4702. if (data === undefined) {
  4703. return jQuery.queue(this[0], type);
  4704. }
  4705. return this.each(function (i) {
  4706. var queue = jQuery.queue(this, type, data);
  4707. if (type === "fx" && queue[0] !== "inprogress") {
  4708. jQuery.dequeue(this, type);
  4709. }
  4710. });
  4711. };
  4712. jQuery.prototype.ready = function (fn) {
  4713. /// <summary>
  4714. /// Specify a function to execute when the DOM is fully loaded.
  4715. /// </summary>
  4716. /// <param name="fn" type="Function">
  4717. /// A function to execute after the DOM is ready.
  4718. /// </param>
  4719. /// <returns type="jQuery" />
  4720. // Attach the listeners
  4721. jQuery.bindReady();
  4722. // Add the callback
  4723. readyList.done(fn);
  4724. return this;
  4725. };
  4726. jQuery.prototype.remove = function (selector, keepData) {
  4727. /// <summary>
  4728. /// Remove the set of matched elements from the DOM.
  4729. /// </summary>
  4730. /// <param name="selector" type="String">
  4731. /// A selector expression that filters the set of matched elements to be removed.
  4732. /// </param>
  4733. /// <returns type="jQuery" />
  4734. for (var i = 0, elem; (elem = this[i]) != null; i++) {
  4735. if (!selector || jQuery.filter(selector, [elem]).length) {
  4736. if (!keepData && elem.nodeType === 1) {
  4737. jQuery.cleanData(elem.getElementsByTagName("*"));
  4738. jQuery.cleanData([elem]);
  4739. }
  4740. if (elem.parentNode) {
  4741. elem.parentNode.removeChild(elem);
  4742. }
  4743. }
  4744. }
  4745. return this;
  4746. };
  4747. jQuery.prototype.removeAttr = function (name, fn) {
  4748. /// <summary>
  4749. /// Remove an attribute from each element in the set of matched elements.
  4750. /// </summary>
  4751. /// <param name="name" type="String">
  4752. /// An attribute to remove.
  4753. /// </param>
  4754. /// <returns type="jQuery" />
  4755. return this.each(function () {
  4756. jQuery.attr(this, name, "");
  4757. if (this.nodeType === 1) {
  4758. this.removeAttribute(name);
  4759. }
  4760. });
  4761. };
  4762. jQuery.prototype.removeClass = function (value) {
  4763. /// <summary>
  4764. /// Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
  4765. /// 1 - removeClass(className)
  4766. /// 2 - removeClass(function(index, class))
  4767. /// </summary>
  4768. /// <param name="value" type="String">
  4769. /// A class name to be removed from the class attribute of each matched element.
  4770. /// </param>
  4771. /// <returns type="jQuery" />
  4772. if (jQuery.isFunction(value)) {
  4773. return this.each(function (i) {
  4774. var self = jQuery(this);
  4775. self.removeClass(value.call(this, i, self.attr("class")));
  4776. });
  4777. }
  4778. if ((value && typeof value === "string") || value === undefined) {
  4779. var classNames = (value || "").split(rspaces);
  4780. for (var i = 0, l = this.length; i < l; i++) {
  4781. var elem = this[i];
  4782. if (elem.nodeType === 1 && elem.className) {
  4783. if (value) {
  4784. var className = (" " + elem.className + " ").replace(rclass, " ");
  4785. for (var c = 0, cl = classNames.length; c < cl; c++) {
  4786. className = className.replace(" " + classNames[c] + " ", " ");
  4787. }
  4788. elem.className = jQuery.trim(className);
  4789. } else {
  4790. elem.className = "";
  4791. }
  4792. }
  4793. }
  4794. }
  4795. return this;
  4796. };
  4797. jQuery.prototype.removeData = function (key) {
  4798. /// <summary>
  4799. /// Remove a previously-stored piece of data.
  4800. /// </summary>
  4801. /// <param name="key" type="String">
  4802. /// A string naming the piece of data to delete.
  4803. /// </param>
  4804. /// <returns type="jQuery" />
  4805. return this.each(function () {
  4806. jQuery.removeData(this, key);
  4807. });
  4808. };
  4809. jQuery.prototype.replaceAll = function (selector) {
  4810. /// <summary>
  4811. /// Replace each target element with the set of matched elements.
  4812. /// </summary>
  4813. /// <param name="selector" type="String">
  4814. /// A selector expression indicating which element(s) to replace.
  4815. /// </param>
  4816. /// <returns type="jQuery" />
  4817. var ret = [],
  4818. insert = jQuery(selector),
  4819. parent = this.length === 1 && this[0].parentNode;
  4820. if (parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1) {
  4821. insert[original](this[0]);
  4822. return this;
  4823. } else {
  4824. for (var i = 0, l = insert.length; i < l; i++) {
  4825. var elems = (i > 0 ? this.clone(true) : this).get();
  4826. jQuery(insert[i])[original](elems);
  4827. ret = ret.concat(elems);
  4828. }
  4829. return this.pushStack(ret, name, insert.selector);
  4830. }
  4831. };
  4832. jQuery.prototype.replaceWith = function (value) {
  4833. /// <summary>
  4834. /// Replace each element in the set of matched elements with the provided new content.
  4835. /// 1 - replaceWith(newContent)
  4836. /// 2 - replaceWith(function)
  4837. /// </summary>
  4838. /// <param name="value" type="jQuery">
  4839. /// The content to insert. May be an HTML string, DOM element, or jQuery object.
  4840. /// </param>
  4841. /// <returns type="jQuery" />
  4842. if (this[0] && this[0].parentNode) {
  4843. // Make sure that the elements are removed from the DOM before they are inserted
  4844. // this can help fix replacing a parent with child elements
  4845. if (jQuery.isFunction(value)) {
  4846. return this.each(function (i) {
  4847. var self = jQuery(this), old = self.html();
  4848. self.replaceWith(value.call(this, i, old));
  4849. });
  4850. }
  4851. if (typeof value !== "string") {
  4852. value = jQuery(value).detach();
  4853. }
  4854. return this.each(function () {
  4855. var next = this.nextSibling,
  4856. parent = this.parentNode;
  4857. jQuery(this).remove();
  4858. if (next) {
  4859. jQuery(next).before(value);
  4860. } else {
  4861. jQuery(parent).append(value);
  4862. }
  4863. });
  4864. } else {
  4865. return this.pushStack(jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value);
  4866. }
  4867. };
  4868. jQuery.prototype.resize = function (data, fn) {
  4869. /// <summary>
  4870. /// Bind an event handler to the "resize" JavaScript event, or trigger that event on an element.
  4871. /// 1 - resize(handler(eventObject))
  4872. /// 2 - resize(eventData, handler(eventObject))
  4873. /// 3 - resize()
  4874. /// </summary>
  4875. /// <param name="data" type="Object">
  4876. /// A map of data that will be passed to the event handler.
  4877. /// </param>
  4878. /// <param name="fn" type="Function">
  4879. /// A function to execute each time the event is triggered.
  4880. /// </param>
  4881. /// <returns type="jQuery" />
  4882. if (fn == null) {
  4883. fn = data;
  4884. data = null;
  4885. }
  4886. return arguments.length > 0 ?
  4887. this.bind(name, data, fn) :
  4888. this.trigger(name);
  4889. };
  4890. jQuery.prototype.scroll = function (data, fn) {
  4891. /// <summary>
  4892. /// Bind an event handler to the "scroll" JavaScript event, or trigger that event on an element.
  4893. /// 1 - scroll(handler(eventObject))
  4894. /// 2 - scroll(eventData, handler(eventObject))
  4895. /// 3 - scroll()
  4896. /// </summary>
  4897. /// <param name="data" type="Object">
  4898. /// A map of data that will be passed to the event handler.
  4899. /// </param>
  4900. /// <param name="fn" type="Function">
  4901. /// A function to execute each time the event is triggered.
  4902. /// </param>
  4903. /// <returns type="jQuery" />
  4904. if (fn == null) {
  4905. fn = data;
  4906. data = null;
  4907. }
  4908. return arguments.length > 0 ?
  4909. this.bind(name, data, fn) :
  4910. this.trigger(name);
  4911. };
  4912. jQuery.prototype.scrollLeft = function (val) {
  4913. /// <summary>
  4914. /// 1: Get the current horizontal position of the scroll bar for the first element in the set of matched elements.
  4915. /// 1.1 - scrollLeft()
  4916. /// 2: Set the current horizontal position of the scroll bar for each of the set of matched elements.
  4917. /// 2.1 - scrollLeft(value)
  4918. /// </summary>
  4919. /// <param name="val" type="Number">
  4920. /// An integer indicating the new position to set the scroll bar to.
  4921. /// </param>
  4922. /// <returns type="jQuery" />
  4923. var elem = this[0], win;
  4924. if (!elem) {
  4925. return null;
  4926. }
  4927. if (val !== undefined) {
  4928. // Set the scroll offset
  4929. return this.each(function () {
  4930. win = getWindow(this);
  4931. if (win) {
  4932. win.scrollTo(
  4933. !i ? val : jQuery(win).scrollLeft(),
  4934. i ? val : jQuery(win).scrollTop()
  4935. );
  4936. } else {
  4937. this[method] = val;
  4938. }
  4939. });
  4940. } else {
  4941. win = getWindow(elem);
  4942. // Return the scroll offset
  4943. return win ? ("pageXOffset" in win) ? win[i ? "pageYOffset" : "pageXOffset"] :
  4944. jQuery.support.boxModel && win.document.documentElement[method] ||
  4945. win.document.body[method] :
  4946. elem[method];
  4947. }
  4948. };
  4949. jQuery.prototype.scrollTop = function (val) {
  4950. /// <summary>
  4951. /// 1: Get the current vertical position of the scroll bar for the first element in the set of matched elements.
  4952. /// 1.1 - scrollTop()
  4953. /// 2: Set the current vertical position of the scroll bar for each of the set of matched elements.
  4954. /// 2.1 - scrollTop(value)
  4955. /// </summary>
  4956. /// <param name="val" type="Number">
  4957. /// An integer indicating the new position to set the scroll bar to.
  4958. /// </param>
  4959. /// <returns type="jQuery" />
  4960. var elem = this[0], win;
  4961. if (!elem) {
  4962. return null;
  4963. }
  4964. if (val !== undefined) {
  4965. // Set the scroll offset
  4966. return this.each(function () {
  4967. win = getWindow(this);
  4968. if (win) {
  4969. win.scrollTo(
  4970. !i ? val : jQuery(win).scrollLeft(),
  4971. i ? val : jQuery(win).scrollTop()
  4972. );
  4973. } else {
  4974. this[method] = val;
  4975. }
  4976. });
  4977. } else {
  4978. win = getWindow(elem);
  4979. // Return the scroll offset
  4980. return win ? ("pageXOffset" in win) ? win[i ? "pageYOffset" : "pageXOffset"] :
  4981. jQuery.support.boxModel && win.document.documentElement[method] ||
  4982. win.document.body[method] :
  4983. elem[method];
  4984. }
  4985. };
  4986. jQuery.prototype.select = function (data, fn) {
  4987. /// <summary>
  4988. /// Bind an event handler to the "select" JavaScript event, or trigger that event on an element.
  4989. /// 1 - select(handler(eventObject))
  4990. /// 2 - select(eventData, handler(eventObject))
  4991. /// 3 - select()
  4992. /// </summary>
  4993. /// <param name="data" type="Object">
  4994. /// A map of data that will be passed to the event handler.
  4995. /// </param>
  4996. /// <param name="fn" type="Function">
  4997. /// A function to execute each time the event is triggered.
  4998. /// </param>
  4999. /// <returns type="jQuery" />
  5000. if (fn == null) {
  5001. fn = data;
  5002. data = null;
  5003. }
  5004. return arguments.length > 0 ?
  5005. this.bind(name, data, fn) :
  5006. this.trigger(name);
  5007. };
  5008. jQuery.prototype.serialize = function () {
  5009. /// <summary>
  5010. /// Encode a set of form elements as a string for submission.
  5011. /// </summary>
  5012. /// <returns type="String" />
  5013. return jQuery.param(this.serializeArray());
  5014. };
  5015. jQuery.prototype.serializeArray = function () {
  5016. /// <summary>
  5017. /// Encode a set of form elements as an array of names and values.
  5018. /// </summary>
  5019. /// <returns type="Array" />
  5020. return this.map(function () {
  5021. return this.elements ? jQuery.makeArray(this.elements) : this;
  5022. })
  5023. .filter(function () {
  5024. return this.name && !this.disabled &&
  5025. (this.checked || rselectTextarea.test(this.nodeName) ||
  5026. rinput.test(this.type));
  5027. })
  5028. .map(function (i, elem) {
  5029. var val = jQuery(this).val();
  5030. return val == null ?
  5031. null :
  5032. jQuery.isArray(val) ?
  5033. jQuery.map(val, function (val, i) {
  5034. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  5035. }) :
  5036. { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  5037. }).get();
  5038. };
  5039. jQuery.prototype.show = function (speed, easing, callback) {
  5040. /// <summary>
  5041. /// Display the matched elements.
  5042. /// 1 - show()
  5043. /// 2 - show(duration, callback)
  5044. /// 3 - show(duration, easing, callback)
  5045. /// </summary>
  5046. /// <param name="speed" type="Number">
  5047. /// A string or number determining how long the animation will run.
  5048. /// </param>
  5049. /// <param name="easing" type="String">
  5050. /// A string indicating which easing function to use for the transition.
  5051. /// </param>
  5052. /// <param name="callback" type="Function">
  5053. /// A function to call once the animation is complete.
  5054. /// </param>
  5055. /// <returns type="jQuery" />
  5056. var elem, display;
  5057. if (speed || speed === 0) {
  5058. return this.animate(genFx("show", 3), speed, easing, callback);
  5059. } else {
  5060. for (var i = 0, j = this.length; i < j; i++) {
  5061. elem = this[i];
  5062. display = elem.style.display;
  5063. // Reset the inline display of this element to learn if it is
  5064. // being hidden by cascaded rules or not
  5065. if (!jQuery._data(elem, "olddisplay") && display === "none") {
  5066. display = elem.style.display = "";
  5067. }
  5068. // Set elements which have been overridden with display: none
  5069. // in a stylesheet to whatever the default browser style is
  5070. // for such an element
  5071. if (display === "" && jQuery.css(elem, "display") === "none") {
  5072. jQuery._data(elem, "olddisplay", defaultDisplay(elem.nodeName));
  5073. }
  5074. }
  5075. // Set the display of most of the elements in a second loop
  5076. // to avoid the constant reflow
  5077. for (i = 0; i < j; i++) {
  5078. elem = this[i];
  5079. display = elem.style.display;
  5080. if (display === "" || display === "none") {
  5081. elem.style.display = jQuery._data(elem, "olddisplay") || "";
  5082. }
  5083. }
  5084. return this;
  5085. }
  5086. };
  5087. jQuery.prototype.siblings = function (until, selector) {
  5088. /// <summary>
  5089. /// Get the siblings of each element in the set of matched elements, optionally filtered by a selector.
  5090. /// </summary>
  5091. /// <param name="until" type="String">
  5092. /// A string containing a selector expression to match elements against.
  5093. /// </param>
  5094. /// <returns type="jQuery" />
  5095. var ret = jQuery.map(this, fn, until),
  5096. // The variable 'args' was introduced in
  5097. // https://github.com/jquery/jquery/commit/52a0238
  5098. // to work around a bug in Chrome 10 (Dev) and should be removed when the bug is fixed.
  5099. // http://code.google.com/p/v8/issues/detail?id=1050
  5100. args = slice.call(arguments);
  5101. if (!runtil.test(name)) {
  5102. selector = until;
  5103. }
  5104. if (selector && typeof selector === "string") {
  5105. ret = jQuery.filter(selector, ret);
  5106. }
  5107. ret = this.length > 1 && !guaranteedUnique[name] ? jQuery.unique(ret) : ret;
  5108. if ((this.length > 1 || rmultiselector.test(selector)) && rparentsprev.test(name)) {
  5109. ret = ret.reverse();
  5110. }
  5111. return this.pushStack(ret, name, args.join(","));
  5112. };
  5113. jQuery.prototype.size = function () {
  5114. /// <summary>
  5115. /// Return the number of DOM elements matched by the jQuery object.
  5116. /// </summary>
  5117. /// <returns type="Number" />
  5118. return this.length;
  5119. };
  5120. jQuery.prototype.slice = function () {
  5121. /// <summary>
  5122. /// Reduce the set of matched elements to a subset specified by a range of indices.
  5123. /// </summary>
  5124. /// <param name="" type="Number">
  5125. /// An integer indicating the 0-based position at which the elements begin to be selected. If negative, it indicates an offset from the end of the set.
  5126. /// </param>
  5127. /// <param name="" type="Number">
  5128. /// An integer indicating the 0-based position at which the elements stop being selected. If negative, it indicates an offset from the end of the set. If omitted, the range continues until the end of the set.
  5129. /// </param>
  5130. /// <returns type="jQuery" />
  5131. return this.pushStack(slice.apply(this, arguments),
  5132. "slice", slice.call(arguments).join(","));
  5133. };
  5134. jQuery.prototype.slideDown = function (speed, easing, callback) {
  5135. /// <summary>
  5136. /// Display the matched elements with a sliding motion.
  5137. /// 1 - slideDown(duration, callback)
  5138. /// 2 - slideDown(duration, easing, callback)
  5139. /// </summary>
  5140. /// <param name="speed" type="Number">
  5141. /// A string or number determining how long the animation will run.
  5142. /// </param>
  5143. /// <param name="easing" type="String">
  5144. /// A string indicating which easing function to use for the transition.
  5145. /// </param>
  5146. /// <param name="callback" type="Function">
  5147. /// A function to call once the animation is complete.
  5148. /// </param>
  5149. /// <returns type="jQuery" />
  5150. return this.animate(props, speed, easing, callback);
  5151. };
  5152. jQuery.prototype.slideToggle = function (speed, easing, callback) {
  5153. /// <summary>
  5154. /// Display or hide the matched elements with a sliding motion.
  5155. /// 1 - slideToggle(duration, callback)
  5156. /// 2 - slideToggle(duration, easing, callback)
  5157. /// </summary>
  5158. /// <param name="speed" type="Number">
  5159. /// A string or number determining how long the animation will run.
  5160. /// </param>
  5161. /// <param name="easing" type="String">
  5162. /// A string indicating which easing function to use for the transition.
  5163. /// </param>
  5164. /// <param name="callback" type="Function">
  5165. /// A function to call once the animation is complete.
  5166. /// </param>
  5167. /// <returns type="jQuery" />
  5168. return this.animate(props, speed, easing, callback);
  5169. };
  5170. jQuery.prototype.slideUp = function (speed, easing, callback) {
  5171. /// <summary>
  5172. /// Hide the matched elements with a sliding motion.
  5173. /// 1 - slideUp(duration, callback)
  5174. /// 2 - slideUp(duration, easing, callback)
  5175. /// </summary>
  5176. /// <param name="speed" type="Number">
  5177. /// A string or number determining how long the animation will run.
  5178. /// </param>
  5179. /// <param name="easing" type="String">
  5180. /// A string indicating which easing function to use for the transition.
  5181. /// </param>
  5182. /// <param name="callback" type="Function">
  5183. /// A function to call once the animation is complete.
  5184. /// </param>
  5185. /// <returns type="jQuery" />
  5186. return this.animate(props, speed, easing, callback);
  5187. };
  5188. jQuery.prototype.stop = function (clearQueue, gotoEnd) {
  5189. /// <summary>
  5190. /// Stop the currently-running animation on the matched elements.
  5191. /// </summary>
  5192. /// <param name="clearQueue" type="Boolean">
  5193. /// A Boolean indicating whether to remove queued animation as well. Defaults to false.
  5194. /// </param>
  5195. /// <param name="gotoEnd" type="Boolean">
  5196. /// A Boolean indicating whether to complete the current animation immediately. Defaults to false.
  5197. /// </param>
  5198. /// <returns type="jQuery" />
  5199. var timers = jQuery.timers;
  5200. if (clearQueue) {
  5201. this.queue([]);
  5202. }
  5203. this.each(function () {
  5204. // go in reverse order so anything added to the queue during the loop is ignored
  5205. for (var i = timers.length - 1; i >= 0; i--) {
  5206. if (timers[i].elem === this) {
  5207. if (gotoEnd) {
  5208. // force the next step to be the last
  5209. timers[i](true);
  5210. }
  5211. timers.splice(i, 1);
  5212. }
  5213. }
  5214. });
  5215. // start the next in the queue if the last step wasn't forced
  5216. if (!gotoEnd) {
  5217. this.dequeue();
  5218. }
  5219. return this;
  5220. };
  5221. jQuery.prototype.submit = function (data, fn) {
  5222. /// <summary>
  5223. /// Bind an event handler to the "submit" JavaScript event, or trigger that event on an element.
  5224. /// 1 - submit(handler(eventObject))
  5225. /// 2 - submit(eventData, handler(eventObject))
  5226. /// 3 - submit()
  5227. /// </summary>
  5228. /// <param name="data" type="Object">
  5229. /// A map of data that will be passed to the event handler.
  5230. /// </param>
  5231. /// <param name="fn" type="Function">
  5232. /// A function to execute each time the event is triggered.
  5233. /// </param>
  5234. /// <returns type="jQuery" />
  5235. if (fn == null) {
  5236. fn = data;
  5237. data = null;
  5238. }
  5239. return arguments.length > 0 ?
  5240. this.bind(name, data, fn) :
  5241. this.trigger(name);
  5242. };
  5243. jQuery.prototype.text = function (text) {
  5244. /// <summary>
  5245. /// 1: Get the combined text contents of each element in the set of matched elements, including their descendants.
  5246. /// 1.1 - text()
  5247. /// 2: Set the content of each element in the set of matched elements to the specified text.
  5248. /// 2.1 - text(textString)
  5249. /// 2.2 - text(function(index, text))
  5250. /// </summary>
  5251. /// <param name="text" type="String">
  5252. /// A string of text to set as the content of each matched element.
  5253. /// </param>
  5254. /// <returns type="jQuery" />
  5255. if (jQuery.isFunction(text)) {
  5256. return this.each(function (i) {
  5257. var self = jQuery(this);
  5258. self.text(text.call(this, i, self.text()));
  5259. });
  5260. }
  5261. if (typeof text !== "object" && text !== undefined) {
  5262. return this.empty().append((this[0] && this[0].ownerDocument || document).createTextNode(text));
  5263. }
  5264. return jQuery.text(this);
  5265. };
  5266. jQuery.prototype.toArray = function () {
  5267. /// <summary>
  5268. /// Retrieve all the DOM elements contained in the jQuery set, as an array.
  5269. /// </summary>
  5270. /// <returns type="Array" />
  5271. return slice.call(this, 0);
  5272. };
  5273. jQuery.prototype.toggle = function (fn, fn2, callback) {
  5274. /// <summary>
  5275. /// 1: Bind two or more handlers to the matched elements, to be executed on alternate clicks.
  5276. /// 1.1 - toggle(handler(eventObject), handler(eventObject), handler(eventObject))
  5277. /// 2: Display or hide the matched elements.
  5278. /// 2.1 - toggle(duration, callback)
  5279. /// 2.2 - toggle(duration, easing, callback)
  5280. /// 2.3 - toggle(showOrHide)
  5281. /// </summary>
  5282. /// <param name="fn" type="Function">
  5283. /// A function to execute every even time the element is clicked.
  5284. /// </param>
  5285. /// <param name="fn2" type="Function">
  5286. /// A function to execute every odd time the element is clicked.
  5287. /// </param>
  5288. /// <param name="callback" type="Function">
  5289. /// Additional handlers to cycle through after clicks.
  5290. /// </param>
  5291. /// <returns type="jQuery" />
  5292. var bool = typeof fn === "boolean";
  5293. if (jQuery.isFunction(fn) && jQuery.isFunction(fn2)) {
  5294. this._toggle.apply(this, arguments);
  5295. } else if (fn == null || bool) {
  5296. this.each(function () {
  5297. var state = bool ? fn : jQuery(this).is(":hidden");
  5298. jQuery(this)[state ? "show" : "hide"]();
  5299. });
  5300. } else {
  5301. this.animate(genFx("toggle", 3), fn, fn2, callback);
  5302. }
  5303. return this;
  5304. };
  5305. jQuery.prototype.toggleClass = function (value, stateVal) {
  5306. /// <summary>
  5307. /// Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
  5308. /// 1 - toggleClass(className)
  5309. /// 2 - toggleClass(className, switch)
  5310. /// 3 - toggleClass(function(index, class), switch)
  5311. /// </summary>
  5312. /// <param name="value" type="String">
  5313. /// One or more class names (separated by spaces) to be toggled for each element in the matched set.
  5314. /// </param>
  5315. /// <param name="stateVal" type="Boolean">
  5316. /// A boolean value to determine whether the class should be added or removed.
  5317. /// </param>
  5318. /// <returns type="jQuery" />
  5319. var type = typeof value,
  5320. isBool = typeof stateVal === "boolean";
  5321. if (jQuery.isFunction(value)) {
  5322. return this.each(function (i) {
  5323. var self = jQuery(this);
  5324. self.toggleClass(value.call(this, i, self.attr("class"), stateVal), stateVal);
  5325. });
  5326. }
  5327. return this.each(function () {
  5328. if (type === "string") {
  5329. // toggle individual class names
  5330. var className,
  5331. i = 0,
  5332. self = jQuery(this),
  5333. state = stateVal,
  5334. classNames = value.split(rspaces);
  5335. while ((className = classNames[i++])) {
  5336. // check each className given, space seperated list
  5337. state = isBool ? state : !self.hasClass(className);
  5338. self[state ? "addClass" : "removeClass"](className);
  5339. }
  5340. } else if (type === "undefined" || type === "boolean") {
  5341. if (this.className) {
  5342. // store className if set
  5343. jQuery._data(this, "__className__", this.className);
  5344. }
  5345. // toggle whole className
  5346. this.className = this.className || value === false ? "" : jQuery._data(this, "__className__") || "";
  5347. }
  5348. });
  5349. };
  5350. jQuery.prototype.trigger = function (type, data) {
  5351. /// <summary>
  5352. /// Execute all handlers and behaviors attached to the matched elements for the given event type.
  5353. /// 1 - trigger(eventType, extraParameters)
  5354. /// 2 - trigger(event)
  5355. /// </summary>
  5356. /// <param name="type" type="String">
  5357. /// A string containing a JavaScript event type, such as click or submit.
  5358. /// </param>
  5359. /// <param name="data" type="Array">
  5360. /// An array of additional parameters to pass along to the event handler.
  5361. /// </param>
  5362. /// <returns type="jQuery" />
  5363. return this.each(function () {
  5364. jQuery.event.trigger(type, data, this);
  5365. });
  5366. };
  5367. jQuery.prototype.triggerHandler = function (type, data) {
  5368. /// <summary>
  5369. /// Execute all handlers attached to an element for an event.
  5370. /// </summary>
  5371. /// <param name="type" type="String">
  5372. /// A string containing a JavaScript event type, such as click or submit.
  5373. /// </param>
  5374. /// <param name="data" type="Array">
  5375. /// An array of additional parameters to pass along to the event handler.
  5376. /// </param>
  5377. /// <returns type="Object" />
  5378. if (this[0]) {
  5379. var event = jQuery.Event(type);
  5380. event.preventDefault();
  5381. event.stopPropagation();
  5382. jQuery.event.trigger(event, data, this[0]);
  5383. return event.result;
  5384. }
  5385. };
  5386. jQuery.prototype.unbind = function (type, fn) {
  5387. /// <summary>
  5388. /// Remove a previously-attached event handler from the elements.
  5389. /// 1 - unbind(eventType, handler(eventObject))
  5390. /// 2 - unbind(eventType, false)
  5391. /// 3 - unbind(event)
  5392. /// </summary>
  5393. /// <param name="type" type="String">
  5394. /// A string containing a JavaScript event type, such as click or submit.
  5395. /// </param>
  5396. /// <param name="fn" type="Function">
  5397. /// The function that is to be no longer executed.
  5398. /// </param>
  5399. /// <returns type="jQuery" />
  5400. // Handle object literals
  5401. if (typeof type === "object" && !type.preventDefault) {
  5402. for (var key in type) {
  5403. this.unbind(key, type[key]);
  5404. }
  5405. } else {
  5406. for (var i = 0, l = this.length; i < l; i++) {
  5407. jQuery.event.remove(this[i], type, fn);
  5408. }
  5409. }
  5410. return this;
  5411. };
  5412. jQuery.prototype.undelegate = function (selector, types, fn) {
  5413. /// <summary>
  5414. /// Remove a handler from the event for all elements which match the current selector, now or in the future, based upon a specific set of root elements.
  5415. /// 1 - undelegate()
  5416. /// 2 - undelegate(selector, eventType)
  5417. /// 3 - undelegate(selector, eventType, handler)
  5418. /// </summary>
  5419. /// <param name="selector" type="String">
  5420. /// A selector which will be used to filter the event results.
  5421. /// </param>
  5422. /// <param name="types" type="String">
  5423. /// A string containing a JavaScript event type, such as "click" or "keydown"
  5424. /// </param>
  5425. /// <param name="fn" type="Function">
  5426. /// A function to execute at the time the event is triggered.
  5427. /// </param>
  5428. /// <returns type="jQuery" />
  5429. if (arguments.length === 0) {
  5430. return this.unbind("live");
  5431. } else {
  5432. return this.die(types, null, fn, selector);
  5433. }
  5434. };
  5435. jQuery.prototype.unload = function (data, fn) {
  5436. /// <summary>
  5437. /// Bind an event handler to the "unload" JavaScript event.
  5438. /// 1 - unload(handler(eventObject))
  5439. /// 2 - unload(eventData, handler(eventObject))
  5440. /// </summary>
  5441. /// <param name="data" type="Object">
  5442. /// A map of data that will be passed to the event handler.
  5443. /// </param>
  5444. /// <param name="fn" type="Function">
  5445. /// A function to execute each time the event is triggered.
  5446. /// </param>
  5447. /// <returns type="jQuery" />
  5448. if (fn == null) {
  5449. fn = data;
  5450. data = null;
  5451. }
  5452. return arguments.length > 0 ?
  5453. this.bind(name, data, fn) :
  5454. this.trigger(name);
  5455. };
  5456. jQuery.prototype.unwrap = function () {
  5457. /// <summary>
  5458. /// Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.
  5459. /// </summary>
  5460. /// <returns type="jQuery" />
  5461. return this.parent().each(function () {
  5462. if (!jQuery.nodeName(this, "body")) {
  5463. jQuery(this).replaceWith(this.childNodes);
  5464. }
  5465. }).end();
  5466. };
  5467. jQuery.prototype.val = function (value) {
  5468. /// <summary>
  5469. /// 1: Get the current value of the first element in the set of matched elements.
  5470. /// 1.1 - val()
  5471. /// 2: Set the value of each element in the set of matched elements.
  5472. /// 2.1 - val(value)
  5473. /// 2.2 - val(function(index, value))
  5474. /// </summary>
  5475. /// <param name="value" type="String">
  5476. /// A string of text or an array of strings corresponding to the value of each matched element to set as selected/checked.
  5477. /// </param>
  5478. /// <returns type="jQuery" />
  5479. if (!arguments.length) {
  5480. var elem = this[0];
  5481. if (elem) {
  5482. if (jQuery.nodeName(elem, "option")) {
  5483. // attributes.value is undefined in Blackberry 4.7 but
  5484. // uses .value. See #6932
  5485. var val = elem.attributes.value;
  5486. return !val || val.specified ? elem.value : elem.text;
  5487. }
  5488. // We need to handle select boxes special
  5489. if (jQuery.nodeName(elem, "select")) {
  5490. var index = elem.selectedIndex,
  5491. values = [],
  5492. options = elem.options,
  5493. one = elem.type === "select-one";
  5494. // Nothing was selected
  5495. if (index < 0) {
  5496. return null;
  5497. }
  5498. // Loop through all the selected options
  5499. for (var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++) {
  5500. var option = options[i];
  5501. // Don't return options that are disabled or in a disabled optgroup
  5502. if (option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
  5503. (!option.parentNode.disabled || !jQuery.nodeName(option.parentNode, "optgroup"))) {
  5504. // Get the specific value for the option
  5505. value = jQuery(option).val();
  5506. // We don't need an array for one selects
  5507. if (one) {
  5508. return value;
  5509. }
  5510. // Multi-Selects return an array
  5511. values.push(value);
  5512. }
  5513. }
  5514. return values;
  5515. }
  5516. // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
  5517. if (rradiocheck.test(elem.type) && !jQuery.support.checkOn) {
  5518. return elem.getAttribute("value") === null ? "on" : elem.value;
  5519. }
  5520. // Everything else, we just grab the value
  5521. return (elem.value || "").replace(rreturn, "");
  5522. }
  5523. return undefined;
  5524. }
  5525. var isFunction = jQuery.isFunction(value);
  5526. return this.each(function (i) {
  5527. var self = jQuery(this), val = value;
  5528. if (this.nodeType !== 1) {
  5529. return;
  5530. }
  5531. if (isFunction) {
  5532. val = value.call(this, i, self.val());
  5533. }
  5534. // Treat null/undefined as ""; convert numbers to string
  5535. if (val == null) {
  5536. val = "";
  5537. } else if (typeof val === "number") {
  5538. val += "";
  5539. } else if (jQuery.isArray(val)) {
  5540. val = jQuery.map(val, function (value) {
  5541. return value == null ? "" : value + "";
  5542. });
  5543. }
  5544. if (jQuery.isArray(val) && rradiocheck.test(this.type)) {
  5545. this.checked = jQuery.inArray(self.val(), val) >= 0;
  5546. } else if (jQuery.nodeName(this, "select")) {
  5547. var values = jQuery.makeArray(val);
  5548. jQuery("option", this).each(function () {
  5549. this.selected = jQuery.inArray(jQuery(this).val(), values) >= 0;
  5550. });
  5551. if (!values.length) {
  5552. this.selectedIndex = -1;
  5553. }
  5554. } else {
  5555. this.value = val;
  5556. }
  5557. });
  5558. };
  5559. jQuery.prototype.width = function (size) {
  5560. /// <summary>
  5561. /// 1: Get the current computed width for the first element in the set of matched elements.
  5562. /// 1.1 - width()
  5563. /// 2: Set the CSS width of each element in the set of matched elements.
  5564. /// 2.1 - width(value)
  5565. /// 2.2 - width(function(index, width))
  5566. /// </summary>
  5567. /// <param name="size" type="Number">
  5568. /// An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).
  5569. /// </param>
  5570. /// <returns type="jQuery" />
  5571. // Get window width or height
  5572. var elem = this[0];
  5573. if (!elem) {
  5574. return size == null ? null : this;
  5575. }
  5576. if (jQuery.isFunction(size)) {
  5577. return this.each(function (i) {
  5578. var self = jQuery(this);
  5579. self[type](size.call(this, i, self[type]()));
  5580. });
  5581. }
  5582. if (jQuery.isWindow(elem)) {
  5583. // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
  5584. // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
  5585. var docElemProp = elem.document.documentElement["client" + name];
  5586. return elem.document.compatMode === "CSS1Compat" && docElemProp ||
  5587. elem.document.body["client" + name] || docElemProp;
  5588. // Get document width or height
  5589. } else if (elem.nodeType === 9) {
  5590. // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
  5591. return Math.max(
  5592. elem.documentElement["client" + name],
  5593. elem.body["scroll" + name], elem.documentElement["scroll" + name],
  5594. elem.body["offset" + name], elem.documentElement["offset" + name]
  5595. );
  5596. // Get or set width or height on the element
  5597. } else if (size === undefined) {
  5598. var orig = jQuery.css(elem, type),
  5599. ret = parseFloat(orig);
  5600. return jQuery.isNaN(ret) ? orig : ret;
  5601. // Set the width or height on the element (default to pixels if value is unitless)
  5602. } else {
  5603. return this.css(type, typeof size === "string" ? size : size + "px");
  5604. }
  5605. };
  5606. jQuery.prototype.wrap = function (html) {
  5607. /// <summary>
  5608. /// Wrap an HTML structure around each element in the set of matched elements.
  5609. /// 1 - wrap(wrappingElement)
  5610. /// 2 - wrap(wrappingFunction)
  5611. /// </summary>
  5612. /// <param name="html" type="jQuery">
  5613. /// An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the matched elements.
  5614. /// </param>
  5615. /// <returns type="jQuery" />
  5616. return this.each(function () {
  5617. jQuery(this).wrapAll(html);
  5618. });
  5619. };
  5620. jQuery.prototype.wrapAll = function (html) {
  5621. /// <summary>
  5622. /// Wrap an HTML structure around all elements in the set of matched elements.
  5623. /// </summary>
  5624. /// <param name="html" type="jQuery">
  5625. /// An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the matched elements.
  5626. /// </param>
  5627. /// <returns type="jQuery" />
  5628. if (jQuery.isFunction(html)) {
  5629. return this.each(function (i) {
  5630. jQuery(this).wrapAll(html.call(this, i));
  5631. });
  5632. }
  5633. if (this[0]) {
  5634. // The elements to wrap the target around
  5635. var wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
  5636. if (this[0].parentNode) {
  5637. wrap.insertBefore(this[0]);
  5638. }
  5639. wrap.map(function () {
  5640. var elem = this;
  5641. while (elem.firstChild && elem.firstChild.nodeType === 1) {
  5642. elem = elem.firstChild;
  5643. }
  5644. return elem;
  5645. }).append(this);
  5646. }
  5647. return this;
  5648. };
  5649. jQuery.prototype.wrapInner = function (html) {
  5650. /// <summary>
  5651. /// Wrap an HTML structure around the content of each element in the set of matched elements.
  5652. /// 1 - wrapInner(wrappingElement)
  5653. /// 2 - wrapInner(wrappingFunction)
  5654. /// </summary>
  5655. /// <param name="html" type="String">
  5656. /// An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the content of the matched elements.
  5657. /// </param>
  5658. /// <returns type="jQuery" />
  5659. if (jQuery.isFunction(html)) {
  5660. return this.each(function (i) {
  5661. jQuery(this).wrapInner(html.call(this, i));
  5662. });
  5663. }
  5664. return this.each(function () {
  5665. var self = jQuery(this),
  5666. contents = self.contents();
  5667. if (contents.length) {
  5668. contents.wrapAll(html);
  5669. } else {
  5670. self.append(html);
  5671. }
  5672. });
  5673. };
  5674. jQuery.fn = jQuery.prototype;
  5675. jQuery.fn.init.prototype = jQuery.fn;
  5676. window.jQuery = window.$ = jQuery;
  5677. })(window);