Skip to content

Commit

Permalink
delete_removeIfInvalid
Browse files Browse the repository at this point in the history
  • Loading branch information
alyuev committed Apr 11, 2019
1 parent 2075fe4 commit 10386ed
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,6 @@ $.widget('custom.combobox', {
});
},

autocompletechange: '_removeIfInvalid'
});
},

Expand Down Expand Up @@ -604,41 +603,6 @@ $.widget('custom.combobox', {
}) );
},

_removeIfInvalid: function(event, ui) {

// Selected an item, nothing to do
if (ui.item || (ui.item === null)) {
return;
}

// Search for a match (case-insensitive)
var value = this.input.val(),
valueLowerCase = value.toLowerCase(),
valid = false;
this.element.children('option').each(function() {
if ($(this).text().toLowerCase() === valueLowerCase ) {
this.selected = valid = true;
return false;
}
});

// Found a match, nothing to do
if (valid) {
return;
}

// Remove invalid value
this.input
.val('')
.attr('title', value + " didn't match any item")
.tooltip('open');
this.element.val('');
this._delay(function() {
this.input.tooltip('close').attr('title','');
}, 2500 );
this.input.autocomplete('instance').term = '';
},

_destroy: function() {
this.wrapper.remove();
this.element.show();
Expand Down

0 comments on commit 10386ed

Please sign in to comment.