Search and Top Navigation
#6662 closed bug (notabug)
Opened November 17, 2010 01:22PM UTC
Closed November 17, 2010 02:41PM UTC
Last modified October 11, 2012 09:15PM UTC
Autocomplete: Handling of response changed from 1.8 to 1.8.6 - HTML no longer works
Reported by: | mspaeth | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | ui.autocomplete | Version: | 1.8.6 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I just upgraded from 1.8 to 1.8.6 and all my autocompleters are broken now. I use a callback that returns a JSON array with label and value (the label is HTML here).
In 1.8, everything was displayed fine, in 1.8.6, the HTML code is displayed.
I tracked it down to this change:
Version 1.8
_renderItem: function( ul, item) { return $( "<li></li>" ) .data( "item.autocomplete", item ) .append( "<a>" + item.label + "</a>" ) .appendTo( ul ); },
Version 1.8.6 (not working)
_renderItem: function( ul, item) { return $( "<li></li>" ) .data( "item.autocomplete", item ) .append( $( "<a></a>" ).text( item.label ) ) .appendTo( ul ); },
Since this is unexpected and breaks existing applications, I would suggest to remove the 1.8.6 change OR to include an option whether to quote or not quote the text. In my application, I definitely need the HTML to be displayed (or is there another possibility I forgot to see?)
This was intentional and is listed in both the changelog and upgrade guide, along with a solution for displaying HTML.