jquery.suggestions: Do not duplicate keypress logic
authorBartosz Dziewoński <matma.rex@gmail.com>
Sat, 22 Feb 2014 16:06:53 +0000 (17:06 +0100)
committerYuvipanda <yuvipanda@gmail.com>
Mon, 24 Feb 2014 15:22:00 +0000 (15:22 +0000)
This is handled in keyup/keypress handlers, no need to repeat it twice.

Change-Id: I3ddcd21136b44eedcec53b1ecc91bad38f697402

resources/jquery/jquery.suggestions.js

index 3774d0c..c4e95a4 100644 (file)
@@ -591,24 +591,6 @@ $.fn.suggestions = function () {
                                        // Store key pressed to handle later
                                        context.data.keypressed = e.which;
                                        context.data.keypressedCount = 0;
-
-                                       switch ( context.data.keypressed ) {
-                                               // This preventDefault logic is duplicated from
-                                               // $.suggestions.keypress(), which sucks
-                                               // Arrow down
-                                               case 40:
-                                                       e.preventDefault();
-                                                       e.stopImmediatePropagation();
-                                                       break;
-                                               // Arrow up, Escape and Enter
-                                               case 38:
-                                               case 27:
-                                               case 13:
-                                                       if ( context.data.$container.is( ':visible' ) ) {
-                                                               e.preventDefault();
-                                                               e.stopImmediatePropagation();
-                                                       }
-                                       }
                                } )
                                .keypress( function ( e ) {
                                        context.data.keypressedCount++;