corejavascript/typeahead.js

autocomplete() should trigger autocomplete event even when text already matches

Open

#132 geöffnet am 15. März 2017

Auf GitHub ansehen
 (3 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)JavaScript (956 Stars) (232 Forks)batch import
enhancementhelp wanted

Beschreibung

Currently, autocomplete() doesn't trigger the autocomplete event if the input text matches the given $selectable. Why should it, if autocompletion won't change the text?

Because there may be other data attached to the typeahead choice which is extracted by downstream logic listening for the event.

Instead of

      isValid = data && query !== data.val;
      if (isValid && !this.eventBus.before('autocomplete', data.obj, data.dataset)) {

it should be just

      if (data && !this.eventBus.before('autocomplete', data.obj, data.dataset)) {

Contributor Guide