corejavascript/typeahead.js

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

Open

#132 ouverte le 15 mars 2017

Voir sur GitHub
 (3 commentaires) (0 réactions) (0 assignés)JavaScript (232 forks)batch import
enhancementhelp wanted

Métriques du dépôt

Stars
 (956 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

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)) {

Guide contributeur