From d5958c1b437a3324b5352f8617bfa0735499ba1b Mon Sep 17 00:00:00 2001 From: Felix Nagel Date: Tue, 31 May 2011 21:18:19 +0200 Subject: [PATCH] fixed: disable / enable issue when reinit (refresh) selectmenu fixed: mousedown/mouseup listener was bind multiple times when widget was reinitialized both thx to czindel, see https://github.com/fnagel/jquery-ui/pull/125 --- ui/jquery.ui.selectmenu.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js index 4799bfc91..3447bc08d 100644 --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@ -231,7 +231,10 @@ $.widget("ui.selectmenu", { .bind('keypress.selectmenu', function(event) { self._typeAhead(event.which, 'focus'); return true; - }); + }) + // this allows for using the scrollbar in an overflowed list + .bind( 'mousedown.selectmenu mouseup.selectmenu', function() { return false; }); + // needed when window is resized $(window).bind( "resize.selectmenu", $.proxy( self._refreshPosition, this ) ); @@ -314,9 +317,6 @@ $.widget("ui.selectmenu", { thisLi.appendTo(this.list); } - // this allows for using the scrollbar in an overflowed list - this.list.bind('mousedown.selectmenu mouseup.selectmenu', function() { return false; }); - // append icon if option is specified if (o.icons) { for (var j in o.icons) { @@ -383,10 +383,12 @@ $.widget("ui.selectmenu", { this._optionLis = this.list.find('li:not(.' + self.widgetBaseClass + '-group)'); // transfer disabled state - if (this.element.attr('disabled') === true) { + if ( this.element.attr( 'disabled' ) === true ) { this.disable(); + } else { + this.enable() } - + // update value this.index(this._selectedIndex()); -- 2.39.5