X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fxhr.js;h=4896e6cb6fb00c00c3d5c6f97aadfaa8c400aed7;hb=948c0dfffcf077ed71e4712b38a33d06ea63264c;hp=649a8cd47399b84d75df67474e06b711978d9a63;hpb=3c641bd1345aa25489fc16f09d5f4709bf05b09b;p=jquery.git diff --git a/src/xhr.js b/src/xhr.js index 649a8cd..4896e6c 100644 --- a/src/xhr.js +++ b/src/xhr.js @@ -1,17 +1,15 @@ (function( jQuery ) { -var rquery = /\?/, +var rquery_xhr = /\?/, rhash = /#.*$/, rheaders = /^(.*?):\s*(.*?)\r?$/mg, // IE leaves an \r character at EOL rnoContent = /^(?:GET|HEAD)$/, rts = /([?&])_=[^&]*/, rurl = /^(\w+:)?\/\/([^\/?#]+)/, - slice = Array.prototype.slice, + sliceFunc = Array.prototype.slice, - isFunction = jQuery.isFunction, - - undefined; + isFunction = jQuery.isFunction; // Creates a jQuery xhr object jQuery.xhr = function( _native ) { @@ -82,14 +80,14 @@ jQuery.xhr = function( _native ) { // Other Variables transportDataType, i; - + // Convert data if not already a string if ( data && s.processData && typeof data != "string" ) { data = s.data = jQuery.param( data , s.traditional ); } // Apply option prefilters - for (i in prefilters) { + for ( i = 0; i < prefilters.length; i++ ) { prefilters[i](s); } @@ -111,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 @@ -122,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; @@ -599,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 = slice.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() { @@ -647,7 +628,7 @@ function createCBList() { // Remove autoFire to keep bindings in order autoFire = 0; - var args = slice.call( fireArgs , 2 ); + var args = sliceFunc.call( fireArgs , 2 ); // Execute callbacks while ( flag && functors.length ) {