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

Merge pull request #511 from stonio/patch-5

JS - Replace 'foo.length === 0' by '!foo.length'
This commit is contained in:
Tomas Kirda 2016-07-06 16:24:44 -05:00 committed by GitHub
commit 41043437c0

View File

@ -158,7 +158,7 @@
that.element.setAttribute('autocomplete', 'off');
that.killerFn = function (e) {
if ($(e.target).closest('.' + that.options.containerClass).length === 0) {
if (!$(e.target).closest('.' + that.options.containerClass).length) {
that.killSuggestions();
that.disableKillerFn();
}
@ -636,7 +636,7 @@
},
suggest: function () {
if (this.suggestions.length === 0) {
if (!this.suggestions.length) {
if (this.options.showNoSuggestionNotice) {
this.noSuggestions();
} else {
@ -804,7 +804,7 @@
// Cache results if cache is not disabled:
if (!options.noCache) {
that.cachedResponse[cacheKey] = result;
if (options.preventBadQueries && result.suggestions.length === 0) {
if (options.preventBadQueries && !result.suggestions.length) {
that.badQueries.push(originalQuery);
}
}
@ -962,7 +962,7 @@
var dataKey = 'autocomplete';
// If function invoked without argument return
// instance of the first matched element:
if (arguments.length === 0) {
if (!arguments.length) {
return this.first().data(dataKey);
}