Commit Graph

362 Commits

Author SHA1 Message Date
Rick Waldron
327bc07c54 Landing pull request 604. Updates bind to on in src/ajax.js. Fixes #10817.
More Details:
 - https://github.com/jquery/jquery/pull/604
 - http://bugs.jquery.com/ticket/10817
2011-11-17 15:02:38 -05:00
Dave Methvin
c3600e261b Take 2 on "Fix ajax to always expect an Error object, per #10646."
We can't use jQuery.error to rethrow anymore since it constructs a new Error from its supposedly-string arg. Also, older IE stringifies Error objects into "[object Error]" so I've loosened the unit test criteria.

This reverts commit 586fb05919.
2011-11-08 15:52:30 -05:00
Dave Methvin
d8e2b4b6e4 Revert "Catch one more place where a plain-text error was thrown."
This reverts commit cc4a999648.
2011-11-08 15:52:29 -05:00
Dave Methvin
cc4a999648 Catch one more place where a plain-text error was thrown. 2011-11-08 10:09:53 -05:00
Dave Methvin
586fb05919 Fix ajax to always expect an Error object, per #10646. 2011-11-08 09:42:08 -05:00
Rick Waldron
bad83b39ce Cleanup spacing in ajax.js. Fixes #10601 2011-10-27 15:26:37 -04:00
Rick Waldron
a9f1346c16 Core styleguide cleanup. Fixes #10586 2011-10-26 14:58:05 -04:00
jaubourg
4092e3d275 $.Callbacks, $.Topic and notify/progress on $.Deferred. 2011-09-19 15:42:30 -04:00
Dave Methvin
8cabdcd122 Use jdalton's shorter sequence for the chars. 2011-08-23 08:55:41 -04:00
Dave Methvin
9b174520cc Use a semantic name for the variable. 2011-08-23 08:47:34 -04:00
Dave Methvin
771e637a51 Fixes #10098. Avoid a slashy-starry char sequence in literal strings to evade faulty script compressors. 2011-08-22 22:32:06 -04:00
Dave Methvin
2e298d92db Merge pull request #431 from DenisKnauf/master
input type=datetime-local (ajax doesn't support it, yet)
2011-08-04 14:51:43 -07:00
jaubourg
0ed99097bd Fixes #9854: propagates native statusText onto jqXHR.statusText. statusText in callbacks is still normalized. Unit test added. 2011-07-23 02:39:12 +02:00
jaubourg
1d220cdd55 Makes sure that status -1 (used when an internal error occured) will not tag jqXHR.readyState as complete (4). 2011-07-23 02:17:46 +02:00
jaubourg
e6a99fdb0e Fixes #9887: ajax now supports circular references into objects passed as context. Prefilter and transport developpers should add their own custom option into flatOptions when needed. Unit test added. 2011-07-23 02:10:17 +02:00
Denis Knauf
bb7d98f018 input type=datetime-local support for ajax. 2011-07-07 12:13:10 +02:00
jaubourg
e6f8951983 Fixes #9632. Adds res:// protocol to the list of local protocols. 2011-07-01 02:18:05 +02:00
jaubourg
e83fcdcb02 Fixes #9682. Removes data from the options for request with no content so that it is not used again in case of a retry. Unit test added. 2011-07-01 02:11:26 +02:00
jaubourg
5b92a5f5ec Replaces typo (status instead of state) as observed in #9585. 2011-07-01 00:16:34 +02:00
Rick Waldron
bf678fd9d6 Restores var names to satisfy the crock-machine. Supplements #9008 2011-04-28 22:26:34 -04:00
rwldrn
57f56be04f Make cached rspaces regex definitions consistent. Fixes #9008 2011-04-28 16:06:13 -04:00
jaubourg
3a3842c669 (Re) Fixes #8884 in a way that keeps the format of the headers map sent to transports natural. 2011-04-19 00:29:20 -07:00
John Resig
94ee3e9743 Cache references to navigator and location. Fixes #6690. 2011-04-16 14:18:56 -07:00
John Resig
ce7b311b92 Backing out fix for #6481. 2011-04-16 09:12:53 -07:00
jaubourg
a519129e99 Removes now unnecessary regexp and companion function. Fixes some spacing issues. Shortens field names. 2011-04-15 14:16:43 -07:00
Sam Bisbee
4d3cb7d7ee Fixing code styling typo. 2011-04-15 16:45:45 -04:00
Sam Bisbee
a9a79ccc6e Continuing to map request headers using their name in uppercase for the index, but we now map to an object with an unmodified name and value: { name: "", value: "" }. This prevents overwriting of the user's supplied headers, which many applications parse with case sensitivity, because we no longer use the modified, uppercase index when building the request. 2011-04-15 16:36:43 -04:00
jaubourg
2594a935de Applies exception in Style Guidelines regarding objects and functions when they are the last argument of a function call. 2011-04-08 17:41:14 +02:00
Dave Methvin
6c28a394c2 Remove crossDomain:null comment, it's not needed since undefined==null below. 2011-03-30 21:59:38 -04:00
Dave Methvin
adbe5e95f3 Merge branch 'crossDomain' of https://github.com/JessThrysoee/jquery into JessThrysoee-crossDomain 2011-03-30 21:52:04 -04:00
jaubourg
714ae379db Fixes #8509. Makes URL regexp less overzealous and ensures it recognizes URL schemes which do not contain a conformant hierarchical structure ( as per section 2.1.2 of http://www.ietf.org/rfc/rfc2718.txt ). Also adds about: and adobe air's app: and app-storage: to the list of local protocols and provides a failover in case document.location is illformed. Unit test added. 2011-03-15 19:20:03 +01:00
JessThrysoee
11c26b3cc9 no need to specifically initialize crossDomain to null 2011-03-11 17:46:59 +01:00
JessThrysoee
515c56f9c6 Make it possible to force the Ajax crossDomain option to false. 2011-03-11 00:17:38 +01:00
gnarf
14e9da51f9 A quick change to detect AIR urls 2011-02-24 13:10:33 -06:00
jaubourg
5b38439011 Fixes #8297. Makes sure response headers with empty values are handled properly and do not prevent proper parsing of the entire response headers string. Unit test amended. 2011-02-17 17:03:09 +01:00
jaubourg
1ddfdabbb9 Fixes #8277. Sets data to undefined rather than null when it is not provided in ajax helpers so that it won't revent data set in ajaxSettings from being used. Unit test added. 2011-02-15 21:53:38 +01:00
jaubourg
d4790116b8 Enhances ajaxSetup so that it can take an optional target option, in which case target will be updated instead of ajaxSettings. That way, fields that shouldn't be deep extended can be listed and dealt with in one place. jQuery.ajax now makes use of ajaxSetup with target to create its internal settings object. Fixes #7531 in IE9RC. 2011-02-12 03:59:46 +01:00
jaubourg
081562cebc Pulls out the callback function in setRequestHeader. Also renames the regexp so that what it's meant to do is a bit more obvious. 2011-02-12 01:08:24 +01:00
jaubourg
ea3e10a492 Minor changes to enforce JQuery Core Style Guidelines. 2011-02-12 00:14:11 +01:00
jaubourg
f2e0ae1a39 Fixes #8245. Ajax now ensures header names are capitalized so that non-compliant xhr implementations don't override them. 2011-02-11 07:07:06 +01:00
jaubourg
f6e173437e Fixes #8219. Introduces the mimeType option to override content-type header in conversion (and in native xhr when possible). Adds companion overrideMimeType method on jqXHR object (it simply sets the option). Unit test added. 2011-02-09 17:47:33 +01:00
jaubourg
2953d0481a Makes sure statusText always defaults to "error". 2011-02-09 15:26:34 +01:00
jaubourg
5b421fed00 Adds jQuery collection to objects that will be used as global events context if provided in the ajax options. 2011-02-07 17:09:47 +01:00
jaubourg
a2dbdc1f54 Fixes a bug that prevented headers from being set in an ajaxSend callback. Unit test modified. 2011-02-07 16:35:32 +01:00
jaubourg
8f8961de90 Reformats logic for early abort in beforeSend to limit block imbrication. 2011-02-04 22:29:10 +01:00
jaubourg
03bad0a960 Fixes abort in prefilter. No global event will be fired in that case even if the global option is set to true. Unit test added. 2011-02-04 22:19:23 +01:00
jaubourg
d66cc55316 Disables dataType redirection while selecting transport. 2011-02-04 21:50:18 +01:00
jaubourg
7eba4b76df Adds widget as the list of local protocols. 2011-02-03 18:23:02 +01:00
jaubourg
0736db64a2 Adds support for more complex protocol by having the url regexp closer to rfc1738. 2011-02-03 17:17:56 +01:00
jaubourg
ee22a59129 Stores jQuery.ajaxSettings.isLocal locally at load time so that any change to it won't affect the transport. Fixes the url parsing regexp to deal with empty domains. Adds informative text into test/localfile.html and handles Opera's failure. Revises the way xhr are created by doing all tests at load time and normalizes all the xhr creation functions so that none of them may throw an exception. 2011-02-03 06:12:47 +01:00
jaubourg
50e950a96e Fixes #7653. Changes regexp to detect local protocol so that it will accept any protocol finishing by -extension. 2011-02-03 05:19:15 +01:00
jaubourg
d77a2a2274 Fixes #8152 by applying the same special cases for protocol "chrome-extension:" as were for "file:" (needs tests). Re-organizes and fixes the handling of special cases for HTTP status code in the xhr transport. Also re-organizes the handling of document.location in ajax.js. 2011-02-03 02:53:10 +01:00
jaubourg
e3cc440934 Fixes #8138. Access to document.location is made only once at load time and if it fails (throwing an exception in IE when document.domain is already set), we use the href of an A element instead. 2011-02-02 20:52:26 +01:00
Anton Kovalyov
fdd4101fe9 Fixes #7945. Make jQuery.param() serialize plain objects with a property named jquery correctly. 2011-02-02 00:32:29 +01:00
jaubourg
cb49b4a1b6 Fixes #8115. Renames all references to jXHR with jqXHR in the code (like was done in the doc). 2011-02-01 16:00:53 +01:00
Dan Heberden
31949fa528 Bug 8107; Fix argument handling for $.ajax for multiple method signatues and add test case 2011-01-31 19:37:28 -08:00
jaubourg
f43572d3b8 Fixes #8095. Properly handles the case where browser cache needs to be bypassed while server-side logic still delivers proper 304 responses. Unit test added. 2011-01-31 19:59:53 +01:00
jaubourg
7c9a5e6016 Makes sure all converters keys are lowercased before any conversion is taking place: dataTypes' names are now truly case insensitive. Unit test edited. 2011-01-31 17:40:27 +01:00
jaubourg
485fa0c42a Makes sure options.context is used as the context for global ajax events only if it's a DOM node. 2011-01-31 17:40:26 +01:00
Anton M
389c099df6 Fixes #7568. Follow-up fix for #5862. Objects with a length property weren't serialized properly by jQuery.param. 2011-01-31 15:58:27 +01:00
jaubourg
91ca71daaa Ensures dataTypeExpressions are lowercased for prefilters and transports registrations. 2011-01-31 10:13:54 +01:00
jaubourg
bbd3f4f3fe Compatibility fixes in ajax: exceptions are no longer promoted to strings before being given to callbacks. Updated misleading comment in conversion code. 2011-01-28 17:08:46 +01:00
jaubourg
7d75ea950e Actually does what bab8079593 promised: passes the jXHR as the third argument of prefilters and transport factories. Comitted for completness even if if backs this out in the end and only land in 1.5.1. 2011-01-27 00:58:31 +01:00
jaubourg
bab8079593 Passes jXHR object as third argument of prefilters and transport factories. 2011-01-26 17:37:08 +01:00
jaubourg
d7d64713a7 Fixes #5866. Issue number in previous commit was wrong both in comments and commit message. See 0e5b341cc0 for previous commit. 2011-01-26 01:45:00 +01:00
jaubourg
0e5b341cc0 Fixes #5856. Adds document protocol at the beginning of URLs without protocol (thanks go to skrings for the initial pull request). Simplifies cross-domain detection regexp and logic as a consequence. Also took the opportunity to remove an unused variable. Unit test added. 2011-01-26 01:36:05 +01:00
jaubourg
5ca8f0617f Reworks how values of parameters passed to error callbacks are determined. Fixes #8050. 2011-01-25 16:08:19 +01:00
jaubourg
33de9c5597 Makes prefilters and transport inspection more robust and uses better variable names for readability. 2011-01-24 04:22:46 +01:00
jaubourg
02ca45573b Revised internal implementation of ajaxPrefilter() and ajaxTransport(). Everything is shorter and more efficient now. Also fixes a couple spacing issues that remained. 2011-01-23 22:03:24 +01:00
jaubourg
ee22c8b34b More code style fixes. 2011-01-23 20:46:09 +01:00
jaubourg
dd5bf42122 Apply JQuery Core Style Guidelines to ajax.js and ajax/*.js, 2011-01-23 05:51:41 +01:00
jaubourg
bea4815294 Re-organizes ajax.js: prefilters and transports are no longer stored in ajaxSettings (their structure is not handled correctly by extend() and was causing some overhead when constructing the final options map in ajax()); base function for ajaxPrefilter and ajaxTransport has been renamed and split in two (one for inspection, one for addition); response/dataType determination and data conversion logics have been externalized from the ajax() internal callback; data conversion no longer sets responseXXX fields; some minor re-formatting and simplifications. 2011-01-22 04:45:20 +01:00
jaubourg
dc2e7317a9 Replaces "text in-between" technique with a full-fledged one-level transitive search for converters (unit tests added). Also cleans up auto dataType determination and adds converter checks in order to guess the best dataType possible. 2011-01-21 03:58:28 +01:00
jaubourg
3dbd600e19 Moves determineResponse logic into main ajax callback. Puts responseXXX fields definitions into ajaxSettings. 2011-01-20 19:40:51 +01:00
jaubourg
a7cb93bee5 Renames Deferred's fire and fireReject methods as resolveWith and rejectWith respectively. 2011-01-20 17:51:57 +01:00
jaubourg
ef86694ada Renames determineDataType as determineResponse. Makes it more generic as a first step into integrating the logic into the main ajax done callback. Also fixes some comments in ajax/xhr.js. 2011-01-20 17:38:21 +01:00
jaubourg
3e1d3d0f21 Revises the way arguments are handled in ajax. 2011-01-20 16:22:36 +01:00
jaubourg
9ab00a712f Makes sure statusCode callbacks are ordered in the same way success and error callbacks are. Unit tests added. 2011-01-20 15:39:30 +01:00
jaubourg
64e1cdbb95 Cleans up and simplifies code shared by ajaxPrefilter and ajaxTransport. Removes chainability of ajaxSetup, ajaxPrefilter and ajaxTransport. Also makes sure context is handled properly by ajaxSetup (unit test added). 2011-01-20 04:12:15 +01:00
jaubourg
44f3a1b405 Moves things around to make jsLint happier. 2011-01-19 18:36:42 +01:00
jaubourg
7d89d3c072 Fixes crossDomain test so that it assumes port to be 80 for http and 443 for https when it is not provided. 2011-01-19 18:35:40 +01:00
jaubourg
1cecfa1ece Moves determineDataType into ajaxSettings so that it is accessible to transports without the need for a second argument and so that we can now pass the original options to the transport instead. Also ensures the original options are actually propagated to prefilters (they were not). 2011-01-19 18:16:29 +01:00
jaubourg
3ea366401f Re-adds hastily removed variable and simplifies statusCode based callbacks handling. 2011-01-19 17:51:33 +01:00
jaubourg
7947cd77e4 Use undefined instead of 0 to deference transport for clarity. 2011-01-19 17:24:56 +01:00
jaubourg
d343bfe528 Removes unnecessary test and ensures getResponseHeader returns null if the header does not exist. 2011-01-19 17:21:51 +01:00
jaubourg
bd6eb849ee Revised how context is determined and removed unnecessary "parameter as variable" trick. 2011-01-19 17:06:33 +01:00
jaubourg
92c3d87a9c Moved ajaxSettings.xhr definition together with support.ajax and support.cors determination into ajax/xhr.js. 2011-01-19 16:55:26 +01:00
jaubourg
914aa3d66b Makes it so a prefilter can change the type of a request. 2011-01-16 05:24:14 +01:00
jaubourg
21143c3b21 Removed internal dataTypes option and added headers & crossDomain options into commented out options of ajaxSettings. 2011-01-16 03:05:03 +01:00
jaubourg
8ab23aec2c Fixes #2994. Not finding a transport now fires the error callbacks and doesn't make ajax return false. Had to revise how jsonp and script prefilters & transports work (better separation of concerns). Also took the opportunity to revise jXHR getRequestHeader and abort methods and enabled early transport garbage collection when the request completes. 2011-01-16 02:57:39 +01:00
jaubourg
a8fa5f2ec1 Moved jQuery.ajax.prefilter and jQuery.ajax.transport to jQuery.ajaxPrefilter and jQuery.ajaxTransport so that proxying the ajax method doesn't turn into a nightmare. Thanks go to scott_gonzalez and DaveMethvin for pointing out the issue. Also made ajaxSetup return "this" to enable chainable definitions -- jQuery.ajaxSetup(...).ajaxPrefilter(...).ajaxTransport(...). 2011-01-13 18:33:24 +01:00
jaubourg
44fc87f66c Fixes #4964. Adds a statusCode object together with a new statusCode method on the jXHR object (deferred behaviour). They accept a map of statusCode/callback(s). Callbacks are fired when the status code of the response correponds to the key (as a success or an error callback depending on how the request completed). Unit tests added. 2011-01-13 17:01:25 +01:00
jaubourg
b07d43c649 Cleans up statusText handling and simplifies 304 notmodified logic. 2011-01-13 01:43:42 +01:00
jaubourg
97b244312e Removes unnecessary variables and adds much needed comments into the data conversion logic in ajax. 2011-01-13 01:18:46 +01:00
jaubourg
ed1144816b Fixes a regression by calling dataFilter with the second argument set as the dataType. 2011-01-13 00:49:58 +01:00
jaubourg
e9fb7d5be6 Gets rid of a var statement by moving variable declarations up. 2011-01-13 00:41:10 +01:00
jaubourg
14b07ec5de AjaxSetup now uses deep extend internally to accomodate map structured options. 2011-01-12 18:53:00 +01:00
jaubourg
5a721cf31b Fixes 4825. jQuery.fn.load: use the jXHR's Promise interface to get the actual response in case ajaxSettings contains a dataFilter. Unit test added. 2011-01-11 20:02:33 +01:00
Dave Methvin
4e86766d54 Change embedded regexp to a variable (for #6876). 2011-01-09 16:22:11 -06:00
jaubourg
0f28835ee9 Make it so prefilters get access to the original settings. 2011-01-09 20:31:15 +01:00