Bug in Autocomplete When certain characters are inserted (try ] or [)
See original GitHub issueThis is a (multiple allowed):
-
bug
-
enhancement
-
feature-discussion (RFC)
-
Framework7 Version: v1.5.2.
-
Platform and Target: Android and IOS.
If you try to input only a single character such as ] in the input field of autocomplete, an error will occur (console shows the error below).
Uncaught SyntaxError: Invalid regular expression: /([)/: Unterminated character class at new RegExp (<anonymous>) at framework7.js:8987 at Object.source (autocomplete.html:152) at HTMLInputElement.a (framework7.js:8982)
This issue is probably related to https://github.com/nolimits4web/Framework7/issues/1259 Framework7 attempts to highlight the inputted characters in all the items of the autocomplete dropdown menu items. Certain characters cause an issue with regex expression used for highlighting.
It would be nice to give the users the option of disabling the highlighting altogether as it is really useless in certain languages where characters take different shapes when they are inside words than when they are outside.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5
Top GitHub Comments
That’s great. However, the regex line causing the error reported in this issue is still being executed even when highlightMatches is set to false. It would be nice to have Framework7 escape the string or avoids the declaration of the following line when highlightMatches is set to false.
var regExp = new RegExp('('+query+')', 'i');
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.