Rework unit tests to check actual result elements.
[jquery.git] / src / xhr.js
index 66be463..4896e6c 100644 (file)
@@ -1,6 +1,6 @@
 (function( jQuery ) {
 
-var rquery = /\?/,
+var rquery_xhr = /\?/,
        rhash = /#.*$/,
        rheaders = /^(.*?):\s*(.*?)\r?$/mg, // IE leaves an \r character at EOL
        rnoContent = /^(?:GET|HEAD)$/,
@@ -87,7 +87,7 @@ jQuery.xhr = function( _native ) {
                }
                
                // Apply option prefilters
-               for (i in prefilters) {
+               for ( i = 0; i < prefilters.length; i++ ) {
                        prefilters[i](s);
                }
                
@@ -109,7 +109,7 @@ jQuery.xhr = function( _native ) {
                                
                                // If data is available, append data to url
                                if ( data ) {
-                                       url += (rquery.test(url) ? "&" : "?") + data;
+                                       url += (rquery_xhr.test(url) ? "&" : "?") + data;
                                }
                                                                
                                // Add anti-cache in url if needed
@@ -120,7 +120,7 @@ jQuery.xhr = function( _native ) {
                                                ret = url.replace(rts, "$1_=" + ts );
                                                
                                        // if nothing was replaced, add timestamp to the end
-                                       url = ret + ((ret == url) ? (rquery.test(url) ? "&" : "?") + "_=" + ts : "");
+                                       url = ret + ((ret == url) ? (rquery_xhr.test(url) ? "&" : "?") + "_=" + ts : "");
                                }
                                
                                s.url = url;
@@ -597,23 +597,6 @@ jQuery.xhr = function( _native ) {
        reset(1);
 
        // Install callbacks related methods
-       jQuery.each(["bind","unbind"], function(_, name) {
-               xhr[name] = function(type) {
-                       
-                       var functors = sliceFunc.call(arguments,1),
-                               list;
-                               
-                       jQuery.each(type.split(/\s+/g), function() {
-                               list = callbacksLists[this];
-                               if ( list ) {
-                                       list[name].apply(list, functors );
-                               }
-                       });
-                       
-                       return this;
-               };
-       });
-
        jQuery.each(callbacksLists, function(name) {
                var list;
                xhr[name] = function() {