Use .data instead of .attr in typeahead for more flexibility.

Typeahead queries that correspond to arbitrary JavaScript objects cannot be easily attached to the HTML DOM objects using .attr; changing this to .data solves this.