diff options
author | jaubourg <j@ubourg.net> | 2011-04-15 14:16:43 -0700 |
---|---|---|
committer | jaubourg <j@ubourg.net> | 2011-04-15 14:16:43 -0700 |
commit | a519129e99ba03770e9290961d43fad9f6873a83 (patch) | |
tree | 999dbc951d3053de451e2f8ba5c9ef1d86426b68 /src | |
parent | 4d3cb7d7ee4cd709f3ed39d81a8ef014b60cd308 (diff) | |
download | jquery-a519129e99ba03770e9290961d43fad9f6873a83.tar.gz jquery-a519129e99ba03770e9290961d43fad9f6873a83.zip |
Removes now unnecessary regexp and companion function. Fixes some spacing issues. Shortens field names.
Diffstat (limited to 'src')
-rw-r--r-- | src/ajax.js | 18 | ||||
-rw-r--r-- | src/ajax/xhr.js | 2 |
2 files changed, 8 insertions, 12 deletions
diff --git a/src/ajax.js b/src/ajax.js index e9f070abd..3048068d0 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -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 ) { diff --git a/src/ajax/xhr.js b/src/ajax/xhr.js index 0c837c5aa..ba4c3ec7e 100644 --- a/src/ajax/xhr.js +++ b/src/ajax/xhr.js @@ -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( _ ) {} |