refactor(typeahead): avoid string manipulation for DOM elements