X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fajax.js;h=e6c9ac8a5aeed664d4fd8223e7e9ce69a3d790b5;hb=081562cebc63617d2c99adbcefa107dbea5c9bee;hp=b35952f0b5fa06d3532d59bfe302b9701af9bbb7;hpb=f2e0ae1a3932d6089853e8c0eed6ecb446610c00;p=jquery.git diff --git a/src/ajax.js b/src/ajax.js index b35952f..e6c9ac8 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -15,7 +15,10 @@ var r20 = /%20/g, rselectTextarea = /^(?:select|textarea)/i, rspacesAjax = /\s+/, rts = /([?&])_=[^&]*/, - rucWord = /(^|\-)([a-z])/g, + rucHeaders = /(^|\-)([a-z])/g, + rucHeadersFunc = function( _, $1, $2 ) { + return $1 + $2.toUpperCase(); + }, rurl = /^([\w\+\.\-]+:)\/\/([^\/?#:]*)(?::(\d+))?/, // Keep a copy of the old load method @@ -402,9 +405,7 @@ jQuery.extend({ // Caches the header setRequestHeader: function( name, value ) { if ( !state ) { - requestHeaders[ name.toLowerCase().replace( rucWord, function( _, $1, $2 ) { - return $1 + $2.toUpperCase(); - } ) ] = value; + requestHeaders[ name.toLowerCase().replace( rucHeaders, rucHeadersFunc ) ] = value; } return this; }, @@ -451,7 +452,7 @@ jQuery.extend({ // Callback for when everything is done // It is defined here because jslint complains if it is declared // at the end of the function (which would be more logical and readable) - function done( status, statusText, responses, headers) { + function done( status, statusText, responses, headers ) { // Called once if ( state === 2 ) {