github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

jquery / jquery-ui

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 671
    • 124
  • Source
  • Commits
  • Network (124)
  • Graphs
  • Tree: fc093e9

click here to add a description

click here to add a homepage

  • Switch Branches (7)
    • bind
    • devpreview
    • formcontrols
    • master
    • menu
    • panel
    • tooltip
  • Switch Tags (18)
    • 1.9m1
    • 1.8rc3
    • 1.8rc2
    • 1.8rc1
    • 1.8b1
    • 1.8a2
    • 1.8a1
    • 1.8.2
    • 1.8.1
    • 1.8
    • 1.7
    • 1.6rc6
    • 1.6rc5
    • 1.6rc3
    • 1.6rc2
    • 1.6
    • 1.5.2
    • 1.5.1
  • Comments
  • Contributors
Sending Request…

The official jQuery user interface library. — Read more

  Cancel

http://jqueryui.com/

  Cancel
  • HTTP
  • Git Read-Only

This URL has Read+Write access

Prevent autocomplete-menu from closing when clicking 'slowly', eg. a long 
mousedown. Fix for #5405 - Autocomplete: select event not triggered when 
mousedown duration > blur timeout
jzaefferer (author)
Tue May 18 05:57:02 -0700 2010
commit  fc093e9feb4450b1ab93
tree    afb3ccfb589f0f92f095
parent  fcbf4c0872cfc0b0c9fa
M ui/jquery.ui.autocomplete.js 8 ••••
Txt ui/jquery.ui.autocomplete.js
  • View file @ fc093e9
... ...
@@ -96,7 +96,6 @@ $.widget( "ui.autocomplete", {
96 96
       .bind( "blur.autocomplete", function( event ) {
97 97
         clearTimeout( self.searching );
98 98
         // clicks on the menu (or a button to trigger a search) will cause a blur event
99  
-        // TODO try to implement this without a timeout, see clearTimeout in search()
100 99
         self.closing = setTimeout(function() {
101 100
           self.close( event );
102 101
           self._change( event );
... ...
@@ -109,6 +108,13 @@ $.widget( "ui.autocomplete", {
109 108
     this.menu = $( "<ul></ul>" )
110 109
       .addClass( "ui-autocomplete" )
111 110
       .appendTo( "body", doc )
  111
+      // prevent the close-on-blur in case of a "slow" click on the menu (long mousedown)
  112
+      .mousedown(function() {
  113
+        // use another timeout to make sure the blur-event-handler on the input was already triggered
  114
+        setTimeout(function() {
  115
+          clearTimeout( self.closing );
  116
+        }, 13);
  117
+      })
112 118
       .menu({
113 119
         focus: function( event, ui ) {
114 120
           var item = ui.item.data( "item.autocomplete" );

0 notes on commit fc093e9

Please log in to comment.
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server