diff options
author | John Resig <jeresig@gmail.com> | 2008-11-17 16:32:05 +0000 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2008-11-17 16:32:05 +0000 |
commit | ab551c2b14ac6b0511cf3da10ca224ce461a0f10 (patch) | |
tree | 7640391551a223f08da43c85ae886225c35724ca /src/ajax.js | |
parent | 0aa8d40cdfb50fd423a3bdcf585ac27f89df5b97 (diff) | |
download | jquery-ab551c2b14ac6b0511cf3da10ca224ce461a0f10.tar.gz jquery-ab551c2b14ac6b0511cf3da10ca224ce461a0f10.zip |
Standardized the type checks across core. isFunction and isArray now use Object.prototype.toString to verify the type, .constructor use was removed in favor of typeof, typeof checks now use ===, undefined checks use === undefined. All of this is outlined in the new style guidelines: http://docs.jquery.com/JQuery_Core_Style_Guidelines#Type_Checks. Fixes bug #3618.
Diffstat (limited to 'src/ajax.js')
-rw-r--r-- | src/ajax.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ajax.js b/src/ajax.js index 4135e34c4..55fc25d14 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -3,7 +3,7 @@ jQuery.fn.extend({ _load: jQuery.fn.load, load: function( url, params, callback ) { - if ( typeof url != 'string' ) + if ( typeof url !== "string" ) return this._load( url ); var off = url.indexOf(" "); @@ -24,7 +24,7 @@ jQuery.fn.extend({ params = null; // Otherwise, build a param string - } else if( typeof params == 'object' ) { + } else if( typeof params === "object" ) { params = jQuery.param( params ); type = "POST"; } @@ -178,7 +178,7 @@ jQuery.extend({ type = s.type.toUpperCase(); // convert data if not already a string - if ( s.data && s.processData && typeof s.data != "string" ) + if ( s.data && s.processData && typeof s.data !== "string" ) s.data = jQuery.param(s.data); // Handle JSONP Parameter Callbacks @@ -459,7 +459,7 @@ jQuery.extend({ // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450 return !xhr.status && location.protocol == "file:" || ( xhr.status >= 200 && xhr.status < 300 ) || xhr.status == 304 || xhr.status == 1223 || - jQuery.browser.safari && xhr.status == undefined; + jQuery.browser.safari && xhr.status === undefined; } catch(e){} return false; }, @@ -471,7 +471,7 @@ jQuery.extend({ // Firefox always returns 200. check Last-Modified date return xhr.status == 304 || xhrRes == jQuery.lastModified[url] || - jQuery.browser.safari && xhr.status == undefined; + jQuery.browser.safari && xhr.status === undefined; } catch(e){} return false; }, @@ -490,7 +490,7 @@ jQuery.extend({ data = s.dataFilter( data, type ); // The filter can actually parse the response - if( typeof data == 'string' ){ + if( typeof data === "string" ){ // If the type is "script", eval it in global context if ( type == "script" ) |