aboutsummaryrefslogtreecommitdiffstats
path: root/src/ajax.js
diff options
context:
space:
mode:
authorjaubourg <j@ubourg.net>2011-01-31 17:39:54 +0100
committerjaubourg <j@ubourg.net>2011-01-31 17:40:27 +0100
commit7c9a5e6016c2fcd38872367a891e5b3887d3df53 (patch)
tree78d630ea848573aa459a5de422813f4ac5fcc6fa /src/ajax.js
parent485fa0c42a71b4decc9cb1ce08bb56efabcc76f3 (diff)
downloadjquery-7c9a5e6016c2fcd38872367a891e5b3887d3df53.tar.gz
jquery-7c9a5e6016c2fcd38872367a891e5b3887d3df53.zip
Makes sure all converters keys are lowercased before any conversion is taking place: dataTypes' names are now truly case insensitive. Unit test edited.
Diffstat (limited to 'src/ajax.js')
-rw-r--r--src/ajax.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/ajax.js b/src/ajax.js
index 11eacee71..39abe9059 100644
--- a/src/ajax.js
+++ b/src/ajax.js
@@ -842,8 +842,9 @@ function ajaxConvert( s, response ) {
}
var dataTypes = s.dataTypes,
- converters = s.converters,
+ converters = {},
i,
+ key,
length = dataTypes.length,
tmp,
// Current and previous dataTypes
@@ -860,6 +861,16 @@ function ajaxConvert( s, response ) {
// For each dataType in the chain
for( i = 1; i < length; i++ ) {
+ // Create converters map
+ // with lowercased keys
+ if ( i === 1 ) {
+ for( key in s.converters ) {
+ if( typeof key === "string" ) {
+ converters[ key.toLowerCase() ] = s.converters[ key ];
+ }
+ }
+ }
+
// Get the dataTypes
prev = current;
current = dataTypes[ i ];