jqXHR.abort breaks ajaxStart and ajaxStop

jqXHR.abort breaks ajaxStart and ajaxStop

I am using jqXHR.abort() to cancel pending Ajax requests.

However, using abort causes ajaxStart and ajaxStop to break, so I tried the following fix:




f_abort = XMLHttpRequest.prototype.abort;
XMLHttpRequest.prototype.abort = function() {
    $.proxy(f_abort, this)();
    if ($.active === 1) {
        $.event.trigger("ajaxStop");
                  $.active = 0;
    } else if ($.active > 1) {
        $.active--;
    }
};

Something that puzzles me is that I can not find where jQuery.active is given an initial value in the jQuery source (Checked in 1.4.2 and 1.5.1)

Why is this patch or something similar not built into jQuery?