2
0
mirror of https://github.com/devbridge/jQuery-Autocomplete.git synced 2024-11-09 14:50:57 +00:00

fix(jquery): support for latest 3.3 release

This commit is contained in:
Daniele Scasciafratte 2023-05-17 13:19:47 +02:00
parent 8138252b4c
commit b16a107f46

View File

@ -131,7 +131,7 @@
};
function _transformResult(response) {
return typeof response === 'string' ? $.parseJSON(response) : response;
return typeof response === 'string' ? JSON.parse(response) : response;
};
function _formatResult(suggestion, currentValue) {
@ -514,7 +514,7 @@
return value;
}
parts = value.split(delimiter);
return $.trim(parts[parts.length - 1]);
return String.prototype.trim(parts[parts.length - 1]);
},
getSuggestionsLocal: function (query) {
@ -555,7 +555,7 @@
params = options.ignoreParams ? null : options.params;
if ($.isFunction(options.lookup)){
if (typeof options.lookup === "function"){
options.lookup(q, function (data) {
that.suggestions = data.suggestions;
that.suggest();
@ -567,7 +567,7 @@
if (that.isLocal) {
response = that.getSuggestionsLocal(q);
} else {
if ($.isFunction(serviceUrl)) {
if (typeof serviceUrl === "function") {
serviceUrl = serviceUrl.call(that.element, q);
}
cacheKey = serviceUrl + '?' + $.param(params || {});
@ -625,7 +625,7 @@
var that = this,
container = $(that.suggestionsContainer);
if ($.isFunction(that.options.onHide) && that.visible) {
if (typeof that.options.onHide === "function" && that.visible) {
that.options.onHide.call(that.element, container);
}
@ -689,7 +689,7 @@
noSuggestionsContainer.detach();
container.html(html);
if ($.isFunction(beforeRender)) {
if (typeof beforeRender === "function") {
beforeRender.call(that.element, container, that.suggestions);
}
@ -723,7 +723,7 @@
container.empty();
container.append(noSuggestionsContainer);
if ($.isFunction(beforeRender)) {
if (typeof beforeRender === "function") {
beforeRender.call(that.element, container, that.suggestions);
}
@ -783,7 +783,7 @@
if (that.hintValue !== hintValue) {
that.hintValue = hintValue;
that.hint = suggestion;
if ($.isFunction(onHintCallback)) {
if (typeof onHintCallback === "function") {
onHintCallback.call(that.element, hintValue);
}
}
@ -801,7 +801,7 @@
},
validateOrientation: function(orientation, fallback) {
orientation = $.trim(orientation || '').toLowerCase();
orientation = String.prototype.trim(orientation || '').toLowerCase();
if($.inArray(orientation, ['auto', 'bottom', 'top']) === -1){
orientation = fallback;
@ -945,7 +945,7 @@
that.suggestions = [];
that.selection = suggestion;
if ($.isFunction(onSelectCallback)) {
if (typeof onSelectCallback === "function") {
onSelectCallback.call(that.element, suggestion);
}
},