Skip to content

Commit 4104343

Browse files
author
Tomas Kirda
authored
Merge pull request #511 from stonio/patch-5
JS - Replace 'foo.length === 0' by '!foo.length'
2 parents 56c352a + b09eab6 commit 4104343

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/jquery.autocomplete.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158
that.element.setAttribute('autocomplete', 'off');
159159

160160
that.killerFn = function (e) {
161-
if ($(e.target).closest('.' + that.options.containerClass).length === 0) {
161+
if (!$(e.target).closest('.' + that.options.containerClass).length) {
162162
that.killSuggestions();
163163
that.disableKillerFn();
164164
}
@@ -636,7 +636,7 @@
636636
},
637637

638638
suggest: function () {
639-
if (this.suggestions.length === 0) {
639+
if (!this.suggestions.length) {
640640
if (this.options.showNoSuggestionNotice) {
641641
this.noSuggestions();
642642
} else {
@@ -804,7 +804,7 @@
804804
// Cache results if cache is not disabled:
805805
if (!options.noCache) {
806806
that.cachedResponse[cacheKey] = result;
807-
if (options.preventBadQueries && result.suggestions.length === 0) {
807+
if (options.preventBadQueries && !result.suggestions.length) {
808808
that.badQueries.push(originalQuery);
809809
}
810810
}
@@ -962,7 +962,7 @@
962962
var dataKey = 'autocomplete';
963963
// If function invoked without argument return
964964
// instance of the first matched element:
965-
if (arguments.length === 0) {
965+
if (!arguments.length) {
966966
return this.first().data(dataKey);
967967
}
968968

0 commit comments

Comments
 (0)