(bug 39833) Make language code search case insensitive

Change-Id: I67b98f058f969cd2fe9fa22085f8f781b29dce3f
This commit is contained in:
Santhosh Thottingal
2012-09-03 18:18:27 +05:30
committed by Gerrit Code Review
parent b7d61c3607
commit 6d9bb6f6a5

View File

@@ -69,17 +69,18 @@
e.stopPropagation(); e.stopPropagation();
} }
break; break;
case 13: case 13: // Enter
if ( !this.options.onSelect ) { if ( !this.options.onSelect ) {
break; break;
} }
var query = $.trim( this.$element.val() ).toLowerCase();
if ( this.selectedLanguage ) { if ( this.selectedLanguage ) {
// this.selectLanguage will be populated from a matching search // this.selectLanguage will be populated from a matching search
this.options.onSelect( this.selectedLanguage ); this.options.onSelect( this.selectedLanguage );
} else if ( this.options.languages[this.$element.val()] ) { } else if ( this.options.languages[query] ) {
// Search is yet to happen (in timeout delay), // Search is yet to happen (in timeout delay),
// but we have a matching language code. // but we have a matching language code.
this.options.onSelect( this.$element.val() ); this.options.onSelect( query );
} }
break; break;
default: default:
@@ -147,7 +148,7 @@
// Autofill the first result. // Autofill the first result.
this.autofill( langCode ); this.autofill( langCode );
} }
if ( query === langCode ) { if ( query.toLowerCase() === langCode ) {
this.selectedLanguage = langCode; this.selectedLanguage = langCode;
} }
this.render( langCode ); this.render( langCode );