From 50f813c003f2efbb2a653112a4fd8e4756e0e74c Mon Sep 17 00:00:00 2001 From: riatiger Date: Thu, 21 Nov 2013 19:58:01 +0200 Subject: [PATCH] fix for Uncaught TypeError Prevents "Uncaught TypeError: Object # has no method 'abort'" error for case when non-jQuery promise is used as a handler (AngularJS $promise for example). --- select2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/select2.js b/select2.js index 9cd97cf5..6ee14223 100644 --- a/select2.js +++ b/select2.js @@ -431,7 +431,7 @@ the specific language governing permissions and limitations under the Apache Lic data = data ? data.call(self, query.term, query.page, query.context) : null; url = (typeof url === 'function') ? url.call(self, query.term, query.page, query.context) : url; - if (handler) { handler.abort(); } + if (handler && typeof handler.abort === "function") { handler.abort(); } if (options.params) { if ($.isFunction(options.params)) {