Skip to content

Commit 864541e

Browse files
committed
Update jquery.autocomplete.js
1 parent 2952f32 commit 864541e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

dist/jquery.autocomplete.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,15 @@
127127
$.Autocomplete = Autocomplete;
128128

129129
Autocomplete.formatResult = function (suggestion, currentValue) {
130+
var htmlSafeString = suggestion.value
131+
.replace(/&/g, '&')
132+
.replace(/</g, '&lt;')
133+
.replace(/>/g, '&gt;')
134+
.replace(/"/g, '&quot;');
135+
130136
var pattern = '(' + utils.escapeRegExChars(currentValue) + ')';
131137

132-
return suggestion.value.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
138+
return htmlSafeString.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
133139
};
134140

135141
Autocomplete.prototype = {

0 commit comments

Comments
 (0)