Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Autocomplete: Render items as text, not HTML. Fixes #5275 - suggestio…
…ns are not html-encoded. As noted in the ticket, it's probably better to default to unstyled items to prevent problems. Users can still implement their own rendering method as shown in the custom data and display demo.
- Loading branch information
1 parent
7deb873
commit 1f2cfb9
Showing
3 changed files
with
9 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,12 @@ | |
minLength: 0 | ||
}) | ||
.addClass("ui-widget ui-widget-content ui-corner-left"); | ||
input.data("autocomplete")._renderItem = function( ul, item) { | ||
return $( "<li></li>" ) | ||
.data( "item.autocomplete", item ) | ||
.append( "<a>" + item.label + "</a>" ) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
scottgonzalez
Author
Member
|
||
.appendTo( ul ); | ||
}; | ||
$("<button> </button>") | ||
.attr("tabIndex", -1) | ||
.attr("title", "Show All Items") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Perhaps we should use text() as below so people don't copy this and end up in trouble when the label is "<script>doMaliciousStuff()</script>"?