-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#2826]trim values before search #2844
Conversation
@@ -2951,6 +2951,10 @@ | |||
|
|||
this.$searchbox.on('input propertychange', function () { | |||
var searchValue = that.$searchbox[0].value; | |||
var isWhitespace = /^\s*$/.test(searchValue); | |||
if (!isWhitespace) { | |||
searchValue = searchValue.replace(/^\s+|\s+$/g, ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're probably okay to just use searchValue = searchValue.trim();
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@caseyjhol
thank you very much.
Since some users sometimes enter full-width spaces, so I have added support for trimming all half-width spaces and full-width spaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah gotcha. Maybe just mention this in a brief comment above this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added a comment. thank you.
@@ -2951,6 +2951,10 @@ | |||
|
|||
this.$searchbox.on('input propertychange', function () { | |||
var searchValue = that.$searchbox[0].value; | |||
var isWhitespace = /^\s*$/.test(searchValue); | |||
if (!isWhitespace) { | |||
searchValue = searchValue.replace(/^\s+|\s+$/g, ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah gotcha. Maybe just mention this in a brief comment above this line.
resolved #2826
Make sure to target the
dev
branch!