Skip to content
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

Invalid regular expression error #111

Closed
sigismund opened this issue Jun 14, 2016 · 0 comments
Closed

Invalid regular expression error #111

sigismund opened this issue Jun 14, 2016 · 0 comments

Comments

@sigismund
Copy link

sigismund commented Jun 14, 2016

Few days ago I got error report triggered by user using Chrome (50.0).

Invalid regular expression: /^+/: Nothing to repeat

The culprit code can be found here:

.on('oninput' in $input[0] ? 'input' : 'keyup', function() {
  if ( $input.val().length ) {
    // Search in select options
    $.each(_this.items, function(i, elm) {
      if ( RegExp('^' + $input.val(), 'i').test(elm.slug) && !elm.disabled ) {
        _select(i);
        return false;
      }
    });
  }
});

Probably there should be an additional check if value is empty?

@sigismund sigismund changed the title Selectric - regex error Invalid regular expression error Jun 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants