Skip to content

Commit ba96cb4

Browse files
committed
Autocomplete demo (Combobox): Don't highlight term matches. Fixes #9086 - Autocomplete: Incorrect escaping in combobox demo.
1 parent 2348fb8 commit ba96cb4

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

demos/autocomplete/combobox.html

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,10 @@
4848
.insertAfter( select );
4949

5050
function removeIfInvalid( element ) {
51-
var value = $( element ).val(),
52-
matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( value ) + "$", "i" ),
51+
var value = $( element ).val().toLowerCase(),
5352
valid = false;
5453
select.children( "option" ).each(function() {
55-
if ( $( this ).text().match( matcher ) ) {
54+
if ( $( this ).text().toLowerCase() === value ) {
5655
this.selected = valid = true;
5756
return false;
5857
}
@@ -86,12 +85,7 @@
8685
var text = $( this ).text();
8786
if ( this.value && ( !request.term || matcher.test(text) ) )
8887
return {
89-
label: text.replace(
90-
new RegExp(
91-
"(?![^&;]+;)(?!<[^<>]*)(" +
92-
$.ui.autocomplete.escapeRegex(request.term) +
93-
")(?![^<>]*>)(?![^&;]+;)", "gi"
94-
), "<strong>$1</strong>" ),
88+
label: text,
9589
value: text,
9690
option: this
9791
};
@@ -111,12 +105,6 @@
111105
})
112106
.addClass( "ui-widget ui-widget-content ui-corner-left" );
113107

114-
input.data( "ui-autocomplete" )._renderItem = function( ul, item ) {
115-
return $( "<li>" )
116-
.append( "<a>" + item.label + "</a>" )
117-
.appendTo( ul );
118-
};
119-
120108
$( "<a>" )
121109
.attr( "tabIndex", -1 )
122110
.attr( "title", "Show All Items" )

0 commit comments

Comments
 (0)