twitter/typeahead.js — pull request #560 by snjoetw (2013-12-15 16:03:13+00:00)
Title: trigger typeahead:closingwithsuggestion when dropdown is about to close ...

...and there's only 1 suggestion in the dropdown

It’s useful to let the caller know there’s only 1 suggestion in the
dropdown when closing it.

eg. if an user type the whole value instead of autocomplete it, this
event (typeahead:closingwithsuggestion ) will be triggered and the
caller can do something like this:

_onTypeaheadClosing = function(e, datum) {
var $ele = $(e.target);
if ($ele.val().toLowerCase() == datum.value.toLowerCase()) {
$ele
.data('category-id', datum.categoryId)
.typeahead('setQuery', datum.value);
}
};