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;
}