(function ($) {
    var slice = Array.prototype.slice;
    $.defer = function (func, delay) {
        var args = slice.call(arguments, 2),
            isCancelled = false,
            cancel = function (reject /* = true */) {
                clearTimeout(timerId);
                isCancelled = true;
                if ((!arguments.length || reject) && deferred.state() === "pending") {
                    deferred.reject(null, promise, args);
                }
            },
            deferred = $.Deferred(),
            timerId = setTimeout(function () {
                deferred.notify(promise, args);
                if (isCancelled) {
                    return;
                }
                try {
                    var result = func.apply(this, args);
                    deferred.resolve(result, promise, args);
                } catch (e) {
                    deferred.reject(e, promise, args);
                }
            }, delay),
            promise = deferred.promise();

        promise.cancel = cancel;
        return promise;
    };
})(jQuery);

(function ($) {
    var slice = Array.prototype.slice;
    $.defer = function (func, delay) {
        var args = slice.call(arguments, 2),
            cancel = function (reject /* = true */) {
                clearTimeout(timerId);
                if ((!arguments.length || reject) && deferred.state() === "pending") {
                    deferred.reject(null, promise, args);
                }
            },
            deferred = $.Deferred(),
            timerId = setTimeout(function () {
                deferred.notify(promise, args);
                // if they cancel inside the progress call-back...
                if (deferred.state() === "rejected") {
                    return;
                }
                try {
                    var result = func.apply(this, args);
                    deferred.resolve(result, promise, args);
                } catch (e) {
                    deferred.reject(e, promise, args);
                }
            }, delay),
            promise = deferred.promise();

        promise.cancel = cancel;
        return promise;
    };
})(jQuery);
--- 
+++ 
@@ -2,10 +2,8 @@
     var slice = Array.prototype.slice;
     $.defer = function (func, delay) {
         var args = slice.call(arguments, 2),
-            isCancelled = false,
             cancel = function (reject /* = true */) {
                 clearTimeout(timerId);
-                isCancelled = true;
                 if ((!arguments.length || reject) && deferred.state() === "pending") {
                     deferred.reject(null, promise, args);
                 }
@@ -13,7 +11,8 @@
             deferred = $.Deferred(),
             timerId = setTimeout(function () {
                 deferred.notify(promise, args);
-                if (isCancelled) {
+                // if they cancel inside the progress call-back...
+                if (deferred.state() === "rejected") {
                     return;
                 }
                 try {
Fix the initial cancel bug
