twitter/bootstrap — pull request #7298 by pickypg (2013-03-16 07:07:39+00:00)
Title: 3.0.0 wip

http://jsfiddle.net/Mtxkn/11/

This adds the ability to conveniently override a lot more methods (ones that I arbitrarily identified as reasonable through my own usage), as well as providing an updated `sorter` method to interaction with objects. Further, by exposing each internal sorting step as a method, as well as the query values, each piece can be overridden to enable Typeahead to work with arbitrary data.

The extra sorting option, `sortAny`, is added to support the case where the source gives results that may not match the actual query at all, such as through Ajax results that may have typo correction. Such cases would want to at least override `matcher`:

```javascript
matcher: function() {
return true
}
```

That can be done without changes, but the sorting would have to be completely overridden in its current form even for simple, arbitrary object sorting. Allowing each step to be overridden enables arbitrary object support for both the `item` and the query due to the one-time expense of looking up the query in both normal and lowercase form; those methods could return anything relevant to the actual task at hand rather than a single string as well.

Overriding `highlighter` will always be necessary to support JSON objects, but that is already exposed.

Also attached is a few unit tests to test the minor added functions.

Finally, this is my first attempt at a pull request, and it's bringing across a CSS change that I referenced in a different pull request. I don't know how to remove that as part of the current request (dropdowns.less), so I apologize for the clutter.