Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 127
127
$ . Autocomplete = Autocomplete ;
128
128
129
129
Autocomplete . formatResult = function ( suggestion , currentValue ) {
130
+ var htmlSafeString = suggestion . value
131
+ . replace ( / & / g, '&' )
132
+ . replace ( / < / g, '<' )
133
+ . replace ( / > / g, '>' )
134
+ . replace ( / " / g, '"' ) ;
135
+
130
136
var pattern = '(' + utils . escapeRegExChars ( currentValue ) + ')' ;
131
137
132
- return suggestion . value . replace ( new RegExp ( pattern , 'gi' ) , '<strong>$1<\/strong>' ) ;
138
+ return htmlSafeString . replace ( new RegExp ( pattern , 'gi' ) , '<strong>$1<\/strong>' ) ;
133
139
} ;
134
140
135
141
Autocomplete . prototype = {
Original file line number Diff line number Diff line change 127
127
$ . Autocomplete = Autocomplete ;
128
128
129
129
Autocomplete . formatResult = function ( suggestion , currentValue ) {
130
+ var htmlSafeString = suggestion . value
131
+ . replace ( / & / g, '&' )
132
+ . replace ( / < / g, '<' )
133
+ . replace ( / > / g, '>' )
134
+ . replace ( / " / g, '"' ) ;
135
+
130
136
var pattern = '(' + utils . escapeRegExChars ( currentValue ) + ')' ;
131
137
132
- return suggestion . value . replace ( new RegExp ( pattern , 'gi' ) , '<strong>$1<\/strong>' ) ;
138
+ return htmlSafeString . replace ( new RegExp ( pattern , 'gi' ) , '<strong>$1<\/strong>' ) ;
133
139
} ;
134
140
135
141
Autocomplete . prototype = {
0 commit comments