pbauerochse / searchable-option-list

a jquery plugin for a searchable optionlist
MIT License
79 stars 54 forks source link

Issue with search when select option tooltip is undefined #69

Open roying opened 5 years ago

roying commented 5 years ago

Issue: Unexpected results with search Problem: select option item tooltip string is included in the search, but tooltip is undefined.

Line 541 (sol.js v 2.0.2): elementSearchableTerms = (item.label + ' ' + item.tooltip).trim().toLowerCase(); adds "undefined" to the search string.

For example, elementSearchableTerms for option label "Apple" is "apple undefined" so potentially wrong items displayed when searching for any of these characters: "u","n","d","e","f","i","n","e"

My solution: change line to exclude tooltip in search: elementSearchableTerms = (item.label).trim().toLowerCase();