mirror of
https://github.com/devbridge/jQuery-Autocomplete.git
synced 2024-11-26 06:46:32 +00:00
we're caching the lookup fn to avoid multiple wrapping
This commit is contained in:
parent
6ef64da188
commit
e0571afa17
@ -102,6 +102,7 @@
|
|||||||
that.hint = null;
|
that.hint = null;
|
||||||
that.hintValue = '';
|
that.hintValue = '';
|
||||||
that.selection = null;
|
that.selection = null;
|
||||||
|
that.cachedLookupFn = null;
|
||||||
|
|
||||||
// Initialize and set options:
|
// Initialize and set options:
|
||||||
that.initialize();
|
that.initialize();
|
||||||
@ -197,11 +198,12 @@
|
|||||||
that.isLocal = $.isArray(options.lookup) || $.isFunction(options.lookup);
|
that.isLocal = $.isArray(options.lookup) || $.isFunction(options.lookup);
|
||||||
|
|
||||||
if (that.isLocal) {
|
if (that.isLocal) {
|
||||||
if ($.isFunction(options.lookup)) {
|
if ($.isFunction(options.lookup) && options.lookup !== that.cachedLookupFn) {
|
||||||
oldFn = options.lookup;
|
oldFn = options.lookup;
|
||||||
options.lookup = function () {
|
options.lookup = function () {
|
||||||
return that.verifySuggestionsFormat(oldFn.apply(that, arguments));
|
return that.verifySuggestionsFormat(oldFn.apply(that, arguments));
|
||||||
};
|
};
|
||||||
|
that.cachedLookupFn = options.lookup;
|
||||||
} else {
|
} else {
|
||||||
options.lookup = that.verifySuggestionsFormat(options.lookup);
|
options.lookup = that.verifySuggestionsFormat(options.lookup);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user