]> source.dussan.org Git - jquery-ui.git/commitdiff
merging
authorgcko <jscott@coverity.com>
Tue, 24 May 2011 16:55:13 +0000 (09:55 -0700)
committergcko <jscott@coverity.com>
Tue, 24 May 2011 16:55:13 +0000 (09:55 -0700)
1  2 
ui/jquery.ui.selectmenu.js

index 58ffd76de45aae22a0b8e294586a2f891febbe88,deb7b419bfbb85f64c5295858bcedd4679cc0bb8..59de135bda7de942c8ffe424c195f0a82c65a48b
@@@ -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;
                }