Skip to content

Commit 1b40843

Browse files
committed
Trim item text before comparing
1 parent 4348694 commit 1b40843

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ui/jquery.ui.selectgroup.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@
381381
if (this.search[1].length < 2) {
382382
$.each(this.selectors, function(index) {
383383
if (!found) {
384-
if (that.selectors[index].text.toLowerCase().indexOf(that.search[1][0]) === 0) {
384+
if ($.trim(that.selectors[index].text).toLowerCase().indexOf(that.search[1][0]) === 0) {
385385
if (that.search[0] == that.search[1][0]) {
386386
if (that.search[3] < index) {
387387
focusOption(index);
@@ -396,7 +396,7 @@
396396
else {
397397
$.each(this.selectors, function(index) {
398398
if (!found) {
399-
if (that.selectors[index].text.toLowerCase().indexOf(that.search[1]) === 0) {
399+
if ($.trim(that.selectors[index].text).toLowerCase().indexOf(that.search[1]) === 0) {
400400
if (that.search[0][0] == that.search[1][0]) {
401401
if (that.search[3] < index) {
402402
focusOption(index);
@@ -412,7 +412,7 @@
412412
// Iterate through the selectors with the new unrepeated character.
413413
$.each(this.selectors, function(index) {
414414
if (!found) {
415-
if (that.search[1] === that.selectors[index].text.substring(0, that.search[1].length).toLowerCase()) {
415+
if (that.search[1] === $.trim(that.selectors[index].text).substring(0, that.search[1].length).toLowerCase()) {
416416
that.search[2] = index;
417417
focusOption(index);
418418
}

0 commit comments

Comments
 (0)