Skip to main content

Bug Tracker

Side navigation

Ticket #3087: ajax_transport.diff


File ajax_transport.diff, 1.0 KB (added by choan, June 26, 2008 12:15AM UTC)

Makes the Ajax transport replaceable

Index: src/ajax.js
===================================================================
--- src/ajax.js	(revision 5743)
+++ src/ajax.js	(working copy)
@@ -97,6 +97,13 @@
 var jsc = now();
 
 jQuery.extend({
+  
+  // Create the request object; Microsoft failed to properly
+	// implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
+  getAjaxTransport : function() {
+    return window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
+  },
+  
 	get: function( url, data, callback, type ) {
 		// shift arguments if data argument was ommited
 		if ( jQuery.isFunction( data ) ) {
@@ -275,7 +282,7 @@
 
 		// Create the request object; Microsoft failed to properly
 		// implement the XMLHttpRequest in IE7, so we use the ActiveXObject when it is available
-		var xhr = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
+		var xhr = jQuery.getAjaxTransport();
 
 		// Open the socket
 		// Passing null username, generates a login popup on Opera (#2865)

Download in other formats:

Original Format