jquery.suggestions: Only highlight prefix matches
[lhc/web/wiklou.git] / resources / src / jquery / jquery.suggestions.js
index 884ecb6..8c1739c 100644 (file)
                                                        $results.empty();
                                                        expWidth = -1;
                                                        for ( i = 0; i < context.config.suggestions.length; i++ ) {
-                                                               /*jshint loopfunc:true */
                                                                text = context.config.suggestions[ i ];
                                                                $result = $( '<div>' )
                                                                        .addClass( 'suggestions-result' )
                                                                }
 
                                                                if ( context.config.highlightInput ) {
-                                                                       $result.highlightText( context.data.prevText );
+                                                                       $result.highlightText( context.data.prevText, { method: 'prefixHighlight' } );
                                                                }
 
                                                                // Widen results box if needed (new width is only calculated here, applied later).
                                                        46, // delete
                                                        8   // backspace
                                                ];
-                                               if ( context.data.keypressedCount === 0
-                                                       && e.which === context.data.keypressed
-                                                       && $.inArray( e.which, allowed ) !== -1
+                                               if ( context.data.keypressedCount === 0 &&
+                                                       e.which === context.data.keypressed &&
+                                                       $.inArray( e.which, allowed ) !== -1
                                                ) {
                                                        $.suggestions.keypress( e, context, context.data.keypressed );
                                                }