Skip to content

Commit 80be9a2

Browse files
committed
changed: code quality, missing semicolon
1 parent ec61214 commit 80be9a2

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

ui/jquery.ui.selectmenu.js

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ $.widget("ui.selectmenu", {
3838
var self = this, o = this.options;
3939

4040
// set a default id value, generate a new random one if not set by developer
41-
var selectmenuId = this.element.attr('id') || 'ui-selectmenu-' + Math.random().toString(16).slice(2, 10);
41+
var selectmenuId = this.element.attr( 'id' ) || 'ui-selectmenu-' + Math.random().toString( 16 ).slice( 2, 10 );
4242

4343
// quick array of button and menu id's
4444
this.ids = [ selectmenuId + '-button', selectmenuId + '-menu' ];
@@ -49,20 +49,20 @@ $.widget("ui.selectmenu", {
4949
// create menu button wrapper
5050
this.newelement = $( '<a />', {
5151
'class': this.widgetBaseClass + ' ui-widget ui-state-default ui-corner-all',
52-
'id' : this.ids[0],
52+
'id' : this.ids[ 0 ],
5353
'role': 'button',
5454
'href': '#',
5555
'tabindex': '0' ,
5656
'aria-haspopup': true,
57-
'aria-owns': this.ids[1]
57+
'aria-owns': this.ids[ 1 ]
5858
});
5959
this.newelementWrap = $( o.wrapperElement )
6060
.append( this.newelement )
6161
.insertAfter( this.element );
6262

6363
// transfer tabindex
6464
var tabindex = this.element.attr( 'tabindex' );
65-
if (tabindex) {
65+
if ( tabindex ) {
6666
this.newelement.attr( 'tabindex', tabindex );
6767
}
6868

@@ -390,7 +390,7 @@ $.widget("ui.selectmenu", {
390390
}
391391

392392
// reset height to auto
393-
this.list.css("height", "auto");
393+
this.list.css( 'height', 'auto' );
394394
var listH = this.listWrap.height();
395395
// calculate default max height
396396
if ( o.maxHeight && o.maxHeight < listH ) {
@@ -443,61 +443,62 @@ $.widget("ui.selectmenu", {
443443
$.Widget.prototype.destroy.apply(this, arguments);
444444
},
445445

446-
_typeAhead: function(code, eventType){
446+
_typeAhead: function( code, eventType ){
447447
var self = this, focusFound = false, C = String.fromCharCode(code).toUpperCase();
448448
c = C.toLowerCase();
449449

450-
if (self.options.typeAhead == 'sequential') {
450+
if ( self.options.typeAhead == 'sequential' ) {
451451
// clear the timeout so we can use _prevChar
452452
window.clearTimeout('ui.selectmenu-' + self.selectmenuId);
453453

454454
// define our find var
455-
var find = typeof(self._prevChar) == 'undefined' ? '' : self._prevChar.join('');
455+
var find = typeof( self._prevChar ) == 'undefined' ? '' : self._prevChar.join( '' );
456456

457-
function focusOptSeq(elem, ind, c){
457+
function focusOptSeq( elem, ind, c ){
458458
focusFound = true;
459-
$(elem).trigger(eventType);
460-
typeof(self._prevChar) == 'undefined' ? self._prevChar = [c] : self._prevChar[self._prevChar.length] = c;
459+
$( elem ).trigger( eventType );
460+
typeof( self._prevChar ) == 'undefined' ? self._prevChar = [ c ] : self._prevChar[ self._prevChar.length ] = c;
461461
}
462-
this.list.find('li a').each(function(i) {
463-
if (!focusFound) {
462+
this.list.find( 'li a' ).each( function( i ) {
463+
if ( !focusFound ) {
464464
// allow the typeahead attribute on the option tag for a more specific lookup
465-
var thisText = $(this).attr('typeahead') || $(this).text();
466-
if (thisText.indexOf(find+C) == 0) {
467-
focusOptSeq(this,i,C)
468-
} else if (thisText.indexOf(find+c) == 0) {
469-
focusOptSeq(this,i,c)
465+
var thisText = $( this ).attr( 'typeahead' ) || $(this).text();
466+
if ( thisText.indexOf( find + C ) === 0 ) {
467+
focusOptSeq( this, i, C );
468+
} else if (thisText.indexOf(find+c) === 0 ) {
469+
focusOptSeq( this, i, c );
470470
}
471471
}
472472
});
473473
// set a 1 second timeout for sequenctial typeahead
474-
// keep this set even if we have no matches so it doesnt typeahead somewhere else
475-
window.setTimeout(function(el) {
474+
// keep this set even if we have no matches so it doesnt typeahead somewhere else
475+
window.setTimeout( function( el ) {
476476
self._prevChar = undefined;
477-
}, 1000, self);
477+
}, 1000, self );
478478

479479
} else {
480-
//define self._prevChar if needed
481-
if (!self._prevChar){ self._prevChar = ['',0]; }
480+
// define self._prevChar if needed
481+
if ( !self._prevChar ) { self._prevChar = [ '' , 0 ]; }
482482

483-
var focusFound = false;
484-
function focusOpt(elem, ind){
483+
focusFound = false;
484+
function focusOpt( elem, ind ){
485485
focusFound = true;
486-
$(elem).trigger(eventType);
487-
self._prevChar[1] = ind;
486+
$( elem ).trigger( eventType );
487+
self._prevChar[ 1 ] = ind;
488488
}
489-
this.list.find('li a').each(function(i){
490-
if(!focusFound){
489+
this.list.find( 'li a' ).each(function( i ){
490+
if (!focusFound){
491491
var thisText = $(this).text();
492-
if( thisText.indexOf(C) == 0 || thisText.indexOf(c) == 0){
493-
if(self._prevChar[0] == C){
494-
if(self._prevChar[1] < i){ focusOpt(this,i); }
495-
}
496-
else{ focusOpt(this,i); }
492+
if ( thisText.indexOf( C ) === 0 || thisText.indexOf( c ) === 0 ) {
493+
if (self._prevChar[0] == C){
494+
if ( self._prevChar[ 1 ] < i ){ focusOpt( this, i ); }
495+
} else{
496+
focusOpt( this, i );
497+
}
497498
}
498499
}
499500
});
500-
this._prevChar[0] = C;
501+
this._prevChar[ 0 ] = C;
501502
}
502503
},
503504

@@ -518,7 +519,7 @@ $.widget("ui.selectmenu", {
518519
self.newelement.addClass('ui-state-active');
519520

520521
self.listWrap.appendTo( o.appendTo );
521-
self.list.attr('aria-hidden', false)
522+
self.list.attr('aria-hidden', false);
522523

523524
if ( o.style == "dropdown" ) {
524525
self.newelement.removeClass('ui-corner-all').addClass('ui-corner-top');
@@ -530,7 +531,7 @@ $.widget("ui.selectmenu", {
530531
if ( $.browser.msie && $.browser.version.substr( 0,1 ) == 7 ) {
531532
self._refreshPosition();
532533
}
533-
selected = self.list.attr('aria-hidden', false).find('li:not(.' + self.widgetBaseClass + '-group):eq(' + self._selectedIndex() + ') a');
534+
var selected = self.list.attr('aria-hidden', false).find('li:not(.' + self.widgetBaseClass + '-group):eq(' + self._selectedIndex() + ') a');
534535
if (selected.length) selected[0].focus();
535536
// positioning needed for FF, Chrome, IE8, IE7, IE6 (tested 01.08.11 on MS VPC Image)
536537
self._refreshPosition();
@@ -626,8 +627,7 @@ $.widget("ui.selectmenu", {
626627
if (!isNaN(amt)) {
627628
var currIndex = parseInt(this._focusedOptionLi().data('index') || 0, 10);
628629
var newIndex = currIndex + amt;
629-
}
630-
else {
630+
} else {
631631
var newIndex = parseInt(this._optionLis.filter(amt).data('index'), 10);
632632
}
633633

@@ -803,13 +803,13 @@ $.widget("ui.selectmenu", {
803803
var o = this.options;
804804

805805
// if its a native pop-up we need to calculate the position of the selected li
806-
if (o.style == "popup" && !o.positionOptions.offset) {
806+
if ( o.style == "popup" && !o.positionOptions.offset ) {
807807
var selected = this._selectedOptionLi();
808-
var _offset = "0 -" + (selected.outerHeight() + selected.offset().top - this.list.offset().top);
808+
var _offset = "0 -" + ( selected.outerHeight() + selected.offset().top - this.list.offset().top );
809809
}
810810
// update zIndex if jQuery UI is able to process
811811
var zIndexElement = this.element.zIndex();
812-
if (zIndexElement) {
812+
if ( zIndexElement ) {
813813
this.list.css({
814814
zIndex: zIndexElement
815815
});

0 commit comments

Comments
 (0)