Skip to content

Commit

Permalink
Autocomplete demo (Combobox): Don't highlight term matches. Fixes #90…
Browse files Browse the repository at this point in the history
…86 - Autocomplete: Incorrect escaping in combobox demo.
  • Loading branch information
scottgonzalez committed Feb 22, 2013
1 parent 2348fb8 commit ba96cb4
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions demos/autocomplete/combobox.html
Expand Up @@ -48,11 +48,10 @@
.insertAfter( select );

function removeIfInvalid( element ) {
var value = $( element ).val(),
matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( value ) + "$", "i" ),
var value = $( element ).val().toLowerCase(),
valid = false;
select.children( "option" ).each(function() {
if ( $( this ).text().match( matcher ) ) {
if ( $( this ).text().toLowerCase() === value ) {
this.selected = valid = true;
return false;
}
Expand Down Expand Up @@ -86,12 +85,7 @@
var text = $( this ).text();
if ( this.value && ( !request.term || matcher.test(text) ) )
return {
label: text.replace(
new RegExp(
"(?![^&;]+;)(?!<[^<>]*)(" +
$.ui.autocomplete.escapeRegex(request.term) +
")(?![^<>]*>)(?![^&;]+;)", "gi"
), "<strong>$1</strong>" ),
label: text,
value: text,
option: this
};
Expand All @@ -111,12 +105,6 @@
})
.addClass( "ui-widget ui-widget-content ui-corner-left" );

input.data( "ui-autocomplete" )._renderItem = function( ul, item ) {
return $( "<li>" )
.append( "<a>" + item.label + "</a>" )
.appendTo( ul );
};

$( "<a>" )
.attr( "tabIndex", -1 )
.attr( "title", "Show All Items" )
Expand Down

0 comments on commit ba96cb4

Please sign in to comment.