corejavascript/typeahead.js

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

Open

#132 aperta il 15 mar 2017

Vedi su GitHub
 (3 commenti) (0 reazioni) (0 assegnatari)JavaScript (232 fork)batch import
enhancementhelp wanted

Metriche repository

Star
 (956 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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

Guida contributor