jquery-autocomplete
jquery-autocomplete copied to clipboard
Empty server response may be interpreted as one "empty" result
When server returns empty (zero-length) response and there is no filter specified (filter: false
), the autocomplete results are not completely empty length. Instead, the result array is of length one, and its sole element is:
{ data: [], value: "" }
that is, a completely 'empty' item.
I've identified the culprit as the usage of standard JavaScript String.split
inside plainTextParser
function. For empty strings, splitting with non-empty delimiter produces [""]
, i.e. an array of one empty string.
I can prepare pull request to fix the issue, but would like to inquire first whether it was an intended behavior or simply a bug.