mainly made the code shorter:
- removed some needless if's - replace multiple "var x" for one, comma separated declaration. - added a local fn called now() for the (new Date)s - fixed the indentation of a block, and a typo in a comment. - used fn instead of prototype where possible - jquery fx: exposed the speeds hash as jQuery.fx.speeds. Also fixed (again) line endings
This commit is contained in:
parent
ea44348fdb
commit
17b1e407d1
5 changed files with 103 additions and 101 deletions
10
src/ajax.js
10
src/ajax.js
|
@ -91,7 +91,7 @@ jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".sp
|
|||
};
|
||||
});
|
||||
|
||||
var jsc = (new Date).getTime();
|
||||
var jsc = now();
|
||||
|
||||
jQuery.extend({
|
||||
get: function( url, data, callback, type ) {
|
||||
|
@ -211,7 +211,7 @@ jQuery.extend({
|
|||
s.cache = false;
|
||||
|
||||
if ( s.cache === false && s.type.toLowerCase() == "get" ) {
|
||||
var ts = (new Date()).getTime();
|
||||
var ts = now();
|
||||
// try replacing _= if it is there
|
||||
var ret = s.url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2");
|
||||
// if nothing was replaced, add timestamp to the end
|
||||
|
@ -448,9 +448,9 @@ jQuery.extend({
|
|||
},
|
||||
|
||||
httpData: function( r, type ) {
|
||||
var ct = r.getResponseHeader("content-type");
|
||||
var xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0;
|
||||
var data = xml ? r.responseXML : r.responseText;
|
||||
var ct = r.getResponseHeader("content-type"),
|
||||
xml = type == "xml" || !type && ct && ct.indexOf("xml") >= 0,
|
||||
data = xml ? r.responseXML : r.responseText;
|
||||
|
||||
if ( xml && data.documentElement.tagName == "parsererror" )
|
||||
throw "parsererror";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue