From 2a0cc7623604089f827e9d7f7b8656cc06aa7e65 Mon Sep 17 00:00:00 2001 From: Jeff Hanke Date: Mon, 1 Jul 2013 13:30:44 -0700 Subject: [PATCH] Remove ajax out-of-order dropping code, handled in updateResults now. --- select2.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/select2.js b/select2.js index 59646e83..7546ae0a 100644 --- a/select2.js +++ b/select2.js @@ -392,7 +392,6 @@ the specific language governing permissions and limitations under the Apache Lic */ function ajax(options) { var timeout, // current scheduled but not yet executed request - requestSequence = 0, // sequence used to drop out-of-order responses handler = null, quietMillis = options.quietMillis || 100, ajaxUrl = options.url, @@ -401,9 +400,7 @@ the specific language governing permissions and limitations under the Apache Lic return function (query) { window.clearTimeout(timeout); timeout = window.setTimeout(function () { - requestSequence += 1; // increment the sequence - var requestNumber = requestSequence, // this request's sequence number - data = options.data, // ajax data function + var data = options.data, // ajax data function url = ajaxUrl, // ajax url string or function transport = options.transport || $.fn.select2.ajaxDefaults.transport, // deprecated - to be removed in 4.0 - use params instead @@ -433,9 +430,6 @@ the specific language governing permissions and limitations under the Apache Lic dataType: options.dataType, data: data, success: function (data) { - if (requestNumber < requestSequence) { - return; - } // TODO - replace query.page with query so users have access to term, page, etc. var results = options.results(data, query.page); query.callback(results); @@ -1511,6 +1505,7 @@ the specific language governing permissions and limitations under the Apache Lic input, term = search.val(), lastTerm = $.data(this.container, "select2-last-term"), + // sequence number used to drop out-of-order responses queryNumber; // prevent duplicate queries against the same term