From e482efe4c081c2e48a2d8e9feb3896ed1bfaf86c Mon Sep 17 00:00:00 2001 From: MichaelMackus Date: Wed, 11 May 2016 15:58:56 -0700 Subject: [PATCH 1/4] Fix AJAX data source error Fixes #4355 Verified in Firefox & Chromium --- src/js/select2/data/ajax.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/select2/data/ajax.js b/src/js/select2/data/ajax.js index 3309298f6c..03cf28d63f 100644 --- a/src/js/select2/data/ajax.js +++ b/src/js/select2/data/ajax.js @@ -82,7 +82,7 @@ define([ }, function () { // Attempt to detect if a request was aborted // Only works if the transport exposes a status property - if ($request.status && $request.status === '0') { + if ('status' in $request && $request.status === 0) { return; } From 2ee35420f46b8236eea26553a37cce231ca4835a Mon Sep 17 00:00:00 2001 From: Michael Mackus Date: Wed, 11 May 2016 16:03:23 -0700 Subject: [PATCH 2/4] Update dist files with bugfix --- dist/js/select2.full.js | 2 +- dist/js/select2.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/js/select2.full.js b/dist/js/select2.full.js index c1d479d960..b65f5658f6 100644 --- a/dist/js/select2.full.js +++ b/dist/js/select2.full.js @@ -3444,7 +3444,7 @@ S2.define('select2/data/ajax',[ }, function () { // Attempt to detect if a request was aborted // Only works if the transport exposes a status property - if ($request.status && $request.status === '0') { + if ('status' in $request && $request.status === 0) { return; } diff --git a/dist/js/select2.js b/dist/js/select2.js index b240c12816..d735f27b62 100644 --- a/dist/js/select2.js +++ b/dist/js/select2.js @@ -3444,7 +3444,7 @@ S2.define('select2/data/ajax',[ }, function () { // Attempt to detect if a request was aborted // Only works if the transport exposes a status property - if ($request.status && $request.status === '0') { + if ('status' in $request && $request.status === 0) { return; } From 6502b404489c2e28155cb2a2d7b65759af6c4b84 Mon Sep 17 00:00:00 2001 From: Michael Mackus Date: Mon, 20 Feb 2017 09:18:42 -0800 Subject: [PATCH 3/4] Revert changes to dist dir --- dist/js/select2.full.js | 2 +- dist/js/select2.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/js/select2.full.js b/dist/js/select2.full.js index b65f5658f6..c1d479d960 100644 --- a/dist/js/select2.full.js +++ b/dist/js/select2.full.js @@ -3444,7 +3444,7 @@ S2.define('select2/data/ajax',[ }, function () { // Attempt to detect if a request was aborted // Only works if the transport exposes a status property - if ('status' in $request && $request.status === 0) { + if ($request.status && $request.status === '0') { return; } diff --git a/dist/js/select2.js b/dist/js/select2.js index d735f27b62..b240c12816 100644 --- a/dist/js/select2.js +++ b/dist/js/select2.js @@ -3444,7 +3444,7 @@ S2.define('select2/data/ajax',[ }, function () { // Attempt to detect if a request was aborted // Only works if the transport exposes a status property - if ('status' in $request && $request.status === 0) { + if ($request.status && $request.status === '0') { return; } From 180d36672d8c10c4ae6fc283b21e5ff6f3693d8b Mon Sep 17 00:00:00 2001 From: Michael Mackus Date: Mon, 20 Feb 2017 09:21:39 -0800 Subject: [PATCH 4/4] Check for string value --- src/js/select2/data/ajax.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js/select2/data/ajax.js b/src/js/select2/data/ajax.js index 03cf28d63f..c7ba3dde5e 100644 --- a/src/js/select2/data/ajax.js +++ b/src/js/select2/data/ajax.js @@ -82,7 +82,8 @@ define([ }, function () { // Attempt to detect if a request was aborted // Only works if the transport exposes a status property - if ('status' in $request && $request.status === 0) { + if ('status' in $request && + ($request.status === 0 || $request.status === '0')) { return; }