Search and Top Navigation
#6147 closed bug (fixed)
Opened October 05, 2010 02:54PM UTC
Closed October 05, 2010 03:10PM UTC
Last modified November 19, 2010 06:26PM UTC
Autocomplete: Errors on empty responses
Reported by: | clewis | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.8.6 |
Component: | ui.autocomplete | Version: | 1.8.5 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
PROBLEM:
When the source is a service and it returns an empty response body, a javascript error occurs. Some service languages, such as .net, will return an empty body when the request is terminated mid stream, such as pressing enter in the text box too fast before the suggestions are displayed.
CAUSE:
The response handler does not check to see if the content parameter is null before attempting to check its length.
WORKAROUND:
override the response handler in the following manner to mitigate the issue:
$.ui.autocomplete.prototype._response = function( content ) { if ( content && content.length ) { content = this._normalize( content ); this._suggest( content ); this._trigger( "open" ); } else { this.close(); } this.element.removeClass( "ui-autocomplete-loading" ); };
Attachments (0)
Change History (3)
Changed October 05, 2010 03:10PM UTC by comment:1
milestone: | TBD → 1.9 |
---|---|
resolution: | → fixed |
status: | new → closed |
summary: | "content is null" javascript error when source service returns empty response body → Autocomplete: Errors on empty responses |
Changed October 25, 2010 06:55PM UTC by comment:2
milestone: | 1.9 → 1.8.6 |
---|
Fixed in a5c1195.