X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fajax.js;h=bffbeb607e66ddaba235968d7442314c2cb9f88f;hb=b97b886fcd212b7a4c8c883b1afb04b6bd071545;hp=8262bc7ad886f62cd3d21accada5e6fdd57fb479;hpb=00b70c75278896495365e25f0327af4a1b61acce;p=jquery.git diff --git a/src/ajax.js b/src/ajax.js index 8262bc7..bffbeb6 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -71,7 +71,7 @@ jQuery.fn.extend({ .filter(function(){ return this.name && !this.disabled && (this.checked || /select|textarea/i.test(this.nodeName) || - /text|hidden|password/i.test(this.type)); + /text|hidden|password|search/i.test(this.type)); }) .map(function(i, elem){ var val = jQuery(this).val(); @@ -95,7 +95,7 @@ jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".sp var jsc = now(); jQuery.extend({ - + get: function( url, data, callback, type ) { // shift arguments if data argument was ommited if ( jQuery.isFunction( data ) ) { @@ -233,9 +233,6 @@ jQuery.extend({ // If data is available, append data to url for get requests if ( s.data && type == "GET" ) { s.url += (s.url.match(/\?/) ? "&" : "?") + s.data; - - // IE likes to send both get and post data, prevent this - s.data = null; } // Watch for a new set of requests @@ -267,12 +264,17 @@ jQuery.extend({ done = true; success(); complete(); + + // Handle memory leak in IE + script.onload = script.onreadystatechange = null; head.removeChild( script ); } }; } - head.appendChild(script); + // Use insertBefore instead of appendChild to circumvent an IE6 bug. + // This arises when a base node is used (#2709 and #4378). + head.insertBefore( script, head.firstChild ); // We handle everything using the script element injection return undefined; @@ -404,7 +406,7 @@ jQuery.extend({ // Send the data try { - xhr.send(s.data); + xhr.send( type === "POST" ? s.data : null ); } catch(e) { jQuery.handleError(s, xhr, null, e); } @@ -481,7 +483,7 @@ jQuery.extend({ if ( xml && data.documentElement.tagName == "parsererror" ) throw "parsererror"; - + // Allow a pre-filtering function to sanitize the response // s != null is checked to keep backwards compatibility if( s && s.dataFilter ) @@ -498,7 +500,7 @@ jQuery.extend({ if ( type == "json" ) data = window["eval"]("(" + data + ")"); } - + return data; },