From 3003348b9d638d11994687c2070bf7351848680f Mon Sep 17 00:00:00 2001 From: Adrian Date: Thu, 9 Nov 2017 15:53:30 -0500 Subject: [PATCH] trim before searching --- src/selectr.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/selectr.js b/src/selectr.js index 5fe1ecc..fed7d36 100644 --- a/src/selectr.js +++ b/src/selectr.js @@ -1172,7 +1172,7 @@ return; } - // Open the dropdown on [enter], [↓], and [↑] keys + // Open the dropdown on [enter], [ ], [↓], and [↑] keys if ( e.key === " " || (! that.opened && ["Enter", "ArrowUp", "ArrowDown"].indexOf(e.key) > -1) @@ -1885,7 +1885,7 @@ // Check the options for the matching string util.each(this.options, function(i, option) { var item = this.items[option.idx]; - var matches = compare( option.textContent.toLowerCase(), string ); + var matches = compare( option.textContent.trim().toLowerCase(), string ); if ( matches && !option.disabled ) {