]> source.dussan.org Git - jquery-ui.git/commitdiff
Autocompelte: Only run a search if the value has changed; switching from a blacklist...
authorScott González <scott.gonzalez@gmail.com>
Tue, 20 Jul 2010 15:47:34 +0000 (11:47 -0400)
committerScott González <scott.gonzalez@gmail.com>
Tue, 20 Jul 2010 15:48:53 +0000 (11:48 -0400)
ui/jquery.ui.autocomplete.js

index 27bfe941c8e96b88b1ac3ecdd3877e52316e4400..602d5a545d8ee348d04bad7660a181ca281a46db 100644 (file)
@@ -73,24 +73,14 @@ $.widget( "ui.autocomplete", {
                                        self.element.val( self.term );
                                        self.close( event );
                                        break;
-                               case keyCode.LEFT:
-                               case keyCode.RIGHT:
-                               case keyCode.SHIFT:
-                               case keyCode.CONTROL:
-                               case keyCode.ALT:
-                               case keyCode.COMMAND:
-                               case keyCode.COMMAND_RIGHT:
-                               case keyCode.INSERT:
-                               case keyCode.CAPS_LOCK:
-                               case keyCode.END:
-                               case keyCode.HOME:
-                                       // ignore metakeys (shift, ctrl, alt)
-                                       break;
                                default:
                                        // keypress is triggered before the input value is changed
                                        clearTimeout( self.searching );
                                        self.searching = setTimeout(function() {
-                                               self.search( null, event );
+                                               // only search if the value has changed
+                                               if ( self.term != self.element.val() ) {
+                                                       self.search( null, event );
+                                               }
                                        }, self.options.delay );
                                        break;
                                }