Added a fix for the hover mouseover/mouseout problem.
[jquery.git] / ajax / ajax.js
index 5d6126a..f6a1d9e 100644 (file)
@@ -170,15 +170,21 @@ jQuery.ajax.active = 0;
 
 // Determines if an XMLHttpRequest was successful or not
 jQuery.httpSuccess = function(r) {
-       return ( r.status && ( r.status >= 200 && r.status < 300 ) || 
-               r.status == 304 ) || !r.status && location.protocol == "file:";
+  try {
+    return r.status ?
+      ( r.status >= 200 && r.status < 300 ) || r.status == 304 :
+      location.protocol == "file:";
+  } catch(e){}
+  return false;
 };
 
-// Get the data out of an XMLHttpRequest
+// Get the data out of an XMLHttpRequest.
+// Return parsed XML if content-type header is "xml" and type is "xml" or omitted,
+// otherwise return plain text.
 jQuery.httpData = function(r,type) {
-       // Check the headers, or watch for a force override
-       return r.getResponseHeader("content-type").indexOf("xml") > 0 || 
-               type == "xml" ? r.responseXML : r.responseText;
+  var ct = r.getResponseHeader("content-type");
+       var xml = ( !type || type == "xml" ) && ct && ct.indexOf("xml") >= 0;
+       return xml ? r.responseXML : r.responseText;
 };
 
 // Serialize an array of form elements or a set of