diff options
author | jaubourg <j@ubourg.net> | 2011-01-19 17:21:51 +0100 |
---|---|---|
committer | jaubourg <j@ubourg.net> | 2011-01-19 17:21:51 +0100 |
commit | d343bfe528cbb8b08c3beb94cb33d1c444932f06 (patch) | |
tree | 7fa703ef52fc266e001ef7a2dd81d05aaec4cee8 /src/ajax.js | |
parent | bd6eb849eeb96298bfbd3de71a27cfcbe32bc772 (diff) | |
download | jquery-d343bfe528cbb8b08c3beb94cb33d1c444932f06.tar.gz jquery-d343bfe528cbb8b08c3beb94cb33d1c444932f06.zip |
Removes unnecessary test and ensures getResponseHeader returns null if the header does not exist.
Diffstat (limited to 'src/ajax.js')
-rw-r--r-- | src/ajax.js | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/ajax.js b/src/ajax.js index b9033587d..3d1f9a377 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -295,30 +295,25 @@ jQuery.extend({ }, // Builds headers hashtable if needed - // (match is used internally) - getResponseHeader: function( key , match ) { + getResponseHeader: function( key ) { + + var match; if ( state === 2 ) { - if ( responseHeaders === undefined ) { + if ( !responseHeaders ) { responseHeaders = {}; - if ( typeof responseHeadersString === "string" ) { - - while( ( match = rheaders.exec( responseHeadersString ) ) ) { - responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; - } + while( ( match = rheaders.exec( responseHeadersString ) ) ) { + responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; } } match = responseHeaders[ key.toLowerCase() ]; - } else { - - match = null; } - return match; + return match || null; }, // Cancel the request |