jakiestfu/Mention.js — pull request #16 by spantaleev (2013-08-09 08:16:33+00:00)
Title: Try not to break regular typeahead when monkey-patching it

This monkey-patches `$.fn.typeahead.Constructor.prototype.render`
in a way that makes it proxy:
- to the original typeahead render function, if the items array contains
simple strings (likely typeahead suggestions)
- to the mention.js render function, in all other cases
(more complex non-string item objects, likely for mention.js)

Before this, using typeahead on a page that initialized mention.js was not
possible, due to render() being patched to only support rendering
mention.js items.

This could be improved on more later by adding better/smarter detection.
It probably won't be necessary though, with Bootstrap 3.0 coming soon,
which migrates from its own Typeahead plugin to the completely different
Twitter Typeahead.

Here's a test page that was previously broken:

Typeahead:

Mention: