From: gcko Date: Tue, 24 May 2011 16:55:13 +0000 (-0700) Subject: merging X-Git-Tag: selectmenu_v1.1.0~10^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e2c4a3cc654555df75e8241ed40be562b73ab6f1;p=jquery-ui.git merging --- e2c4a3cc654555df75e8241ed40be562b73ab6f1 diff --cc ui/jquery.ui.selectmenu.js index 58ffd76de,deb7b419b..59de135bd --- a/ui/jquery.ui.selectmenu.js +++ b/ui/jquery.ui.selectmenu.js @@@ -448,44 -528,56 +528,57 @@@ $.widget("ui.selectmenu", this._trigger("close", event, this._uiHash()); } }, + change: function(event) { - if (this._disabled(event.currentTarget)) { return false; } - this.element.trigger('change'); + this.element.trigger("change"); this._trigger("change", event, this._uiHash()); }, + select: function(event) { + if (this._disabled(event.currentTarget)) { return false; } this._trigger("select", event, this._uiHash()); }, - _closeOthers: function(event){ - $('.'+ this.widgetBaseClass +'.ui-state-active').not(this.newelement).each(function(){ - $(this).data('selectelement').selectmenu('close',event); + + _closeOthers: function(event) { + $('.' + this.widgetBaseClass + '.ui-state-active').not(this.newelement).each(function() { + $(this).data('selectelement').selectmenu('close', event); }); - $('.'+ this.widgetBaseClass +'.ui-state-hover').trigger('mouseout'); + $('.' + this.widgetBaseClass + '.ui-state-hover').trigger('mouseout'); }, - _toggle: function(event,retainFocus){ - if(this.list.is('.'+ this.widgetBaseClass +'-open')){ this.close(event,retainFocus); } - else { this.open(event); } + + _toggle: function(event, retainFocus) { + if ( this.list.is('.' + this.widgetBaseClass + '-open') ) { + this.close(event, retainFocus); + } else { + this.open(event); + } }, - _formatText: function(text){ - return this.options.format ? this.options.format(text) : text; + + _formatText: function(text) { + return (this.options.format ? this.options.format(text) : text); }, - _selectedIndex: function(){ + + _selectedIndex: function() { return this.element[0].selectedIndex; }, - _selectedOptionLi: function(){ + + _selectedOptionLi: function() { return this._optionLis.eq(this._selectedIndex()); }, - _focusedOptionLi: function(){ - return this.list.find('.'+ this.widgetBaseClass +'-item-focus'); + + _focusedOptionLi: function() { + return this.list.find('.' + this.widgetBaseClass + '-item-focus'); }, - _moveSelection: function(amt){ + + _moveSelection: function(amt) { var currIndex = parseInt(this._selectedOptionLi().data('index'), 10); var newIndex = currIndex + amt; - return this._optionLis.eq(newIndex).trigger('mouseup'); + // do not loop when using up key + if (newIndex >= 0 ) return this._optionLis.eq(newIndex).trigger('mouseup'); }, - _moveFocus: function(amt){ - if(!isNaN(amt)){ + + _moveFocus: function(amt) { + if (!isNaN(amt)) { var currIndex = parseInt(this._focusedOptionLi().data('index') || 0, 10); var newIndex = currIndex + amt; }