loopj/jquery-tokeninput — pull request #392 by dharmamike (2012-08-31 21:20:20+00:00)
Title: deselect first item when freetagging

I was finding that with allowFreeTagging, when I'd get search results while typing, an item was selected. Even after the results were hidden, an item was still selected, so when pressing TAB or COMMA, the call to add_free_tagging_tokens() was never reached.
https://github.com/loopj/jquery-tokeninput/blob/master/src/jquery.tokeninput.js#L328-344

This patch simply deselects any items when no results are found from a search query so that the add_free_tagging_tokens() call can execute.