X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fajax.js;h=7760593d384a36176a007442f27dcbb49ab35349;hb=f52c4a3d5fb69f143d90f9a032e2a004c36ccae3;hp=9a843022ce7d0fb1476ec48fa37c54c32d0aa695;hpb=eaca153aea6e7b00fd458cac0c8abadcbab8ad61;p=jquery.git diff --git a/src/ajax.js b/src/ajax.js index 9a84302..7760593 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -296,7 +296,9 @@ jQuery.extend({ // Handle memory leak in IE script.onload = script.onreadystatechange = null; - head.removeChild( script ); + if ( head && script.parentNode ) { + head.removeChild( script ); + } } }; } @@ -368,7 +370,7 @@ jQuery.extend({ // Wait for a response to come back var onreadystatechange = function(isTimeout){ // The request was aborted, clear the interval and decrement jQuery.active - if ( xhr.readyState === 0 ) { + if ( !xhr || xhr.readyState === 0 ) { if ( ival ) { // clear poll interval clearInterval( ival ); @@ -449,7 +451,7 @@ jQuery.extend({ // Send the data try { - xhr.send( type === "POST" ? s.data : null ); + xhr.send( type === "POST" || type === "PUT" ? s.data : null ); } catch(e) { jQuery.handleError(s, xhr, null, e); }