Skip to content

Commit

Permalink
Support templates that return DOM nodes. Closes #742.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Harding committed Mar 8, 2014
1 parent 17298e9 commit 3e30222
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/typeahead/dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,10 @@ var Dataset = (function() {
return $suggestions;

function getSuggestionNode(suggestion) {
var $el, innerHtml, outerHtml;
var $el;

innerHtml = that.templates.suggestion(suggestion);
outerHtml = html.suggestion.replace('%BODY%', innerHtml);
$el = $(outerHtml)
$el = $(html.suggestion)
.append(that.templates.suggestion(suggestion))
.data(datasetKey, that.name)
.data(valueKey, that.displayFn(suggestion))
.data(datumKey, suggestion);
Expand Down
2 changes: 1 addition & 1 deletion src/typeahead/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ var html = {
dropdown: '<span class="tt-dropdown-menu"></span>',
dataset: '<div class="tt-dataset-%CLASS%"></div>',
suggestions: '<span class="tt-suggestions"></span>',
suggestion: '<div class="tt-suggestion">%BODY%</div>'
suggestion: '<div class="tt-suggestion"></div>'
};

0 comments on commit 3e30222

Please sign in to comment.