Merge branch 'master' of git://github.com/jquery/jquery into fixedbuild
[jquery.git] / src / ajax.js
index 7ef8dec..add3b37 100644 (file)
@@ -4,10 +4,10 @@ var r20 = /%20/g,
        rbracket = /\[\]$/,
        rCRLF = /\r?\n/g,
        rhash = /#.*$/,
-       rheaders = /^(.*?):\s*(.*?)\r?$/mg, // IE leaves an \r character at EOL
+       rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
        rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
        // #7653, #8125, #8152: local protocol detection
-       rlocalProtocol = /(?:^file|^widget|\-extension):$/,
+       rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|widget):$/,
        rnoContent = /^(?:GET|HEAD)$/,
        rprotocol = /^\/\//,
        rquery = /\?/,
@@ -19,7 +19,7 @@ var r20 = /%20/g,
        rucHeadersFunc = function( _, $1, $2 ) {
                return $1 + $2.toUpperCase();
        },
-       rurl = /^([\w\+\.\-]+:)\/\/([^\/?#:]*)(?::(\d+))?/,
+       rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
 
        // Keep a copy of the old load method
        _load = jQuery.fn.load,
@@ -61,7 +61,7 @@ try {
 }
 
 // Segment location into parts
-ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() );
+ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
 
 // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
 function addToPrefiltersOrTransports( structure ) {
@@ -164,7 +164,7 @@ jQuery.fn.extend({
                        if ( jQuery.isFunction( params ) ) {
                                // We assume that it's the callback
                                callback = params;
-                               params = null;
+                               params = undefined;
 
                        // Otherwise, build a param string
                        } else if ( typeof params === "object" ) {
@@ -256,7 +256,7 @@ jQuery.each( [ "get", "post" ], function( i, method ) {
                if ( jQuery.isFunction( data ) ) {
                        type = type || callback;
                        callback = data;
-                       data = null;
+                       data = undefined;
                }
 
                return jQuery.ajax({
@@ -272,7 +272,7 @@ jQuery.each( [ "get", "post" ], function( i, method ) {
 jQuery.extend({
 
        getScript: function( url, callback ) {
-               return jQuery.get( url, null, callback, "script" );
+               return jQuery.get( url, undefined, callback, "script" );
        },
 
        getJSON: function( url, data, callback ) {
@@ -439,7 +439,7 @@ jQuery.extend({
                                                }
                                                match = responseHeaders[ key.toLowerCase() ];
                                        }
-                                       return match || null;
+                                       return match === undefined ? null : match;
                                },
 
                                // Overrides response content-type header