r2759 - changed self._safemouseup toggling from a timeout to a mouseover on any non-selected item...

r2759 - changed self._safemouseup toggling from a timeout to a mouseover on any non-selected item...


Author: scottjehl
Date: Mon Jun 15 08:05:51 2009
New Revision: 2759
Modified:
branches/labs/selectmenu/ui.selectmenu.js
Log:
changed self._safemouseup toggling from a timeout to a mouseover on any
non-selected item. This matches the native implementation and prevents any
unexpected behavior from holding the mousedown too long on a click.
Modified: branches/labs/selectmenu/ui.selectmenu.js
==============================================================================
--- branches/labs/selectmenu/ui.selectmenu.js    (original)
+++ branches/labs/selectmenu/ui.selectmenu.js    Mon Jun 15 08:05:51 2009
@@ -47,7 +47,6 @@
            self.open();
            //make sure a click won't open/close instantly
            self._safemouseup = false;
-            setTimeout(function(){self._safemouseup = true;}, 100);
            return false;
        })
        .bind('click',function(){
@@ -120,6 +119,10 @@
                    
$(this).parent().find('.ui-selectmenu-item-selected').addClass(activeClass);
                    
$(this).parent().find('.ui-selectmenu-item-focus').removeClass('ui-selectmenu-item-focus
ui-state-hover');
                    
$(this).removeClass('ui-state-active').addClass('ui-selectmenu-item-focus
ui-state-hover');
+                    //reset self._safemouseup if this isn't the selected option
+                    if(! $(this).is('.ui-selectmenu-item-selected') ){
+                        self._safemouseup = true;
+                    }
                })
                .bind('mouseout blur', function(){
                    if($(this).is('.ui-selectmenu-item-selected')){
$(this).addClass(activeClass); }