twitter/bootstrap — pull request #1551 by tobz (2012-02-01 21:46:25+00:00)
Title: Supporting complex source objects and and adding a handler for on item select

I was implementing typeahead for searching through a set of objects which had an internal name and a display name... it seems to make sense using $.data() for storing the original item returned in the results so complex objects can be used and not just plain jane strings. I also added a way to specify a handler for when an item is selected. In my case, I just wanted to redirect to another page based on the result, and I had no intention of making a user submit the value.

I'm not sure on the performance implication of using $.data(), but the search is still very zippy even when searching through ~800 objects so I can't imagine it's too terrible.