]> source.dussan.org Git - jquery.git/commitdiff
Removes now unnecessary regexp and companion function. Fixes some spacing issues...
authorjaubourg <j@ubourg.net>
Fri, 15 Apr 2011 21:16:43 +0000 (14:16 -0700)
committerjaubourg <j@ubourg.net>
Fri, 15 Apr 2011 21:16:43 +0000 (14:16 -0700)
src/ajax.js
src/ajax/xhr.js

index e9f070abdbfadb0e692a313e77d95b28369c9a4e..3048068d04a80f88fb26b02814b139cfcfbfd0a7 100644 (file)
@@ -15,10 +15,6 @@ var r20 = /%20/g,
        rselectTextarea = /^(?:select|textarea)/i,
        rspacesAjax = /\s+/,
        rts = /([?&])_=[^&]*/,
-       rucHeaders = /(^|\-)([a-z])/g,
-       rucHeadersFunc = function( _, $1, $2 ) {
-               return $1 + $2.toUpperCase();
-       },
        rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
 
        // Keep a copy of the old load method
@@ -416,7 +412,7 @@ jQuery.extend({
                                // Caches the header
                                setRequestHeader: function( name, value ) {
                                        if ( !state ) {
-                                               requestHeaders[ name.toUpperCase().replace( rucHeaders, rucHeadersFunc ) ] = { name: name, value: value };
+                                               requestHeaders[ name.toLowerCase() ] = { n: name, v: value };
                                        }
                                        return this;
                                },
@@ -679,12 +675,12 @@ jQuery.extend({
                }
 
                // Set the Accepts header for the server, depending on the dataType
-                jqXHR.setRequestHeader(
-                                       "Accept",
-                                       s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
-                                               s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) :
-                                               s.accepts[ "*" ]
-                                       );
+               jqXHR.setRequestHeader(
+                       "Accept",
+                       s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
+                               s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", */*; q=0.01" : "" ) :
+                               s.accepts[ "*" ]
+               );
 
                // Check for headers option
                for ( i in s.headers ) {
index 0c837c5aa4ea5851aeeb36c05050b9387c460024..ba4c3ec7e4c8f33a5a1e89711237c1b002b7c421 100644 (file)
@@ -104,7 +104,7 @@ if ( jQuery.support.ajax ) {
                                        // Need an extra try/catch for cross domain requests in Firefox 3
                                        try {
                                                for ( i in headers ) {
-                                                       xhr.setRequestHeader( headers[ i ].name, headers[ i ].value );
+                                                       xhr.setRequestHeader( headers[ i ].n, headers[ i ].v );
                                                }
                                        } catch( _ ) {}