Skip to content

Commit 0bc0b63

Browse files
committed
Used method call to isFull to avoid duplicate code
1 parent 30a3c0e commit 0bc0b63

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/selectize.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,7 @@ $.extend(Selectize.prototype, {
12981298
wasFull = self.isFull();
12991299
self.items.splice(self.caretPos, 0, value);
13001300
self.insertAtCaret($item);
1301-
if (!this.isPending || (!wasFull && self.isFull())) {
1301+
if (!self.isPending || (!wasFull && self.isFull())) {
13021302
self.refreshState();
13031303
}
13041304

@@ -1316,7 +1316,7 @@ $.extend(Selectize.prototype, {
13161316
}
13171317

13181318
// hide the menu if the maximum number of items have been selected or no options are left
1319-
if (!$options.length || (self.settings.maxItems !== null && self.items.length >= self.settings.maxItems)) {
1319+
if (!$options.length || self.isFull()) {
13201320
self.close();
13211321
} else {
13221322
self.positionDropdown();

0 commit comments

Comments
 (0)