twitter / typeahead.js

typeahead.js is a fast and fully-featured autocomplete library
http://twitter.github.io/typeahead.js/
MIT License
16.52k stars 3.2k forks source link

Possible docs inaccuracy in Dataset's templates.suggestion description? #1247

Open tomachalek opened 9 years ago

tomachalek commented 9 years ago

Typeahead docs say:

  1. If set (meaning templates.suggestion), this has to be a precompiled template.
  2. Note a precompiled template is a function that takes a JavaScript object as its first argument and returns a HTML string.

But I can implement a function which returns a JQuery or an HTMLElement object and everything seems to work fine. And looking into the code suggests that the returned value can be anything JQuery accepts.

If I am right, would it be possible to update the documentation? Because it probably influences other code (e.g. DefinitelyTyped/typeahead )

razvanphp commented 9 years ago

And also clarify why the returned snippet must be always wrapped in a div? I tried with a p and it does not work.