git.asbjorn.biz
/
jquery.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ea3e10a
)
Pulls out the callback function in setRequestHeader. Also renames the regexp so that...
author
jaubourg
<j@ubourg.net>
Sat, 12 Feb 2011 00:08:24 +0000
(
01:08
+0100)
committer
jaubourg
<j@ubourg.net>
Sat, 12 Feb 2011 00:08:24 +0000
(
01:08
+0100)
src/ajax.js
patch
|
blob
|
history
diff --git
a/src/ajax.js
b/src/ajax.js
index
790585d
..
e6c9ac8
100644
(file)
--- a/
src/ajax.js
+++ b/
src/ajax.js
@@
-15,7
+15,10
@@
var r20 = /%20/g,
rselectTextarea = /^(?:select|textarea)/i,
rspacesAjax = /\s+/,
rts = /([?&])_=[^&]*/,
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
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 ) {
// 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;
},
}
return this;
},