templates/jquery/jquery.form.js in compass-jquery-plugin-0.3.2.7 vs templates/jquery/jquery.form.js in compass-jquery-plugin-0.3.2.8
- old
+ new
@@ -1,8 +1,8 @@
/*!
* jQuery Form Plugin
- * version: 2.63 (29-JAN-2011)
+ * version: 2.67 (12-MAR-2011)
* @requires jQuery v1.3.2 or later
*
* Examples and documentation at: http://malsup.com/jquery/form/
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
@@ -212,12 +212,18 @@
getResponseHeader: function() {
},
setRequestHeader: function() {
},
abort: function() {
+ log('aborting upload...');
+ var e = 'aborted';
this.aborted = 1;
$io.attr('src', s.iframeSrc); // abort op in progress
+ xhr.error = e;
+ s.error && s.error.call(s.context, xhr, 'error', e);
+ g && $.event.trigger("ajaxError", [xhr, s, e]);
+ s.complete && s.complete.call(s.context, xhr, 'error');
}
};
var g = s.global;
// trigger ajax global events so that activity/block indicators work like normal
@@ -320,11 +326,15 @@
}
var data, doc, domCheckCount = 50;
function cb() {
- doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
+ if (xhr.aborted) {
+ return;
+ }
+
+ var doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
if (!doc || doc.location.href == s.iframeSrc) {
// response not received yet
return;
}
io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
@@ -385,22 +395,22 @@
}
catch(e) {
log('error caught:', e);
ok = false;
xhr.error = e;
- s.error.call(s.context, xhr, 'error', e);
+ s.error && s.error.call(s.context, xhr, 'error', e);
g && $.event.trigger("ajaxError", [xhr, s, e]);
}
if (xhr.aborted) {
log('upload aborted');
ok = false;
}
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
if (ok) {
- s.success.call(s.context, data, 'success', xhr);
+ s.success && s.success.call(s.context, data, 'success', xhr);
g && $.event.trigger("ajaxSuccess", [xhr, s]);
}
g && $.event.trigger("ajaxComplete", [xhr, s]);
@@ -815,6 +825,6 @@
}
}
;
-})(jQuery);
+})(jQuery);
\ No newline at end of file