]> source.dussan.org Git - jquery-ui.git/commitdiff
Autocomplete demo (Combobox): Don't highlight term matches. Fixes #9086 - Autocomplet...
authorScott González <scott.gonzalez@gmail.com>
Tue, 19 Feb 2013 19:46:30 +0000 (14:46 -0500)
committerScott González <scott.gonzalez@gmail.com>
Fri, 22 Feb 2013 22:13:16 +0000 (17:13 -0500)
demos/autocomplete/combobox.html

index 0d59db67070e3988ba382f4aaa0393b14832964d..c5ef93576d3a738f0746d75d55d0588b97978522 100644 (file)
                                                .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;
                                                }
                                                                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
                                                                        };
                                        })
                                        .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" )