mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Autocomplete demo (Combobox): Don't highlight term matches. Fixes #9086 - Autocomplete: Incorrect escaping in combobox demo.
This commit is contained in:
parent
2348fb8eb9
commit
ba96cb4772
@ -48,11 +48,10 @@
|
|||||||
.insertAfter( select );
|
.insertAfter( select );
|
||||||
|
|
||||||
function removeIfInvalid( element ) {
|
function removeIfInvalid( element ) {
|
||||||
var value = $( element ).val(),
|
var value = $( element ).val().toLowerCase(),
|
||||||
matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( value ) + "$", "i" ),
|
|
||||||
valid = false;
|
valid = false;
|
||||||
select.children( "option" ).each(function() {
|
select.children( "option" ).each(function() {
|
||||||
if ( $( this ).text().match( matcher ) ) {
|
if ( $( this ).text().toLowerCase() === value ) {
|
||||||
this.selected = valid = true;
|
this.selected = valid = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -86,12 +85,7 @@
|
|||||||
var text = $( this ).text();
|
var text = $( this ).text();
|
||||||
if ( this.value && ( !request.term || matcher.test(text) ) )
|
if ( this.value && ( !request.term || matcher.test(text) ) )
|
||||||
return {
|
return {
|
||||||
label: text.replace(
|
label: text,
|
||||||
new RegExp(
|
|
||||||
"(?![^&;]+;)(?!<[^<>]*)(" +
|
|
||||||
$.ui.autocomplete.escapeRegex(request.term) +
|
|
||||||
")(?![^<>]*>)(?![^&;]+;)", "gi"
|
|
||||||
), "<strong>$1</strong>" ),
|
|
||||||
value: text,
|
value: text,
|
||||||
option: this
|
option: this
|
||||||
};
|
};
|
||||||
@ -111,12 +105,6 @@
|
|||||||
})
|
})
|
||||||
.addClass( "ui-widget ui-widget-content ui-corner-left" );
|
.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>" )
|
$( "<a>" )
|
||||||
.attr( "tabIndex", -1 )
|
.attr( "tabIndex", -1 )
|
||||||
.attr( "title", "Show All Items" )
|
.attr( "title", "Show All Items" )
|
||||||
|
Loading…
Reference in New Issue
Block a user