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

The module version "slimselect.es.js" in dist has a syntax error #584

Open
Jashtoyunda opened this issue Nov 7, 2024 · 3 comments
Open

Comments

@Jashtoyunda
Copy link

Jashtoyunda commented Nov 7, 2024

"slimselect.es.js" has a syntax error.

Firefox says "Uncaught SyntaxError: export declarations may only appear at top level of a module". When the code is reindented, it appears that the class Render is never closed.

But in fact, this is the result of another syntax error, in higlightText() of Render, line 1175 :

const regex = new RegExp('(' + search.trim() + ')(?![^<]*>[^<>]*${originalTextFoundByRegex}`);

An interpolation is opened with "`" but never closed (or closed but never opened, in this case).

The obvious fix is to replace the quote with a backquote :

const regex = new RegExp('(' + search.trim() + `)(?![^<]*>[^<>]*${originalTextFoundByRegex}`);

@brianvoe
Copy link
Owner

brianvoe commented Nov 7, 2024

Cool find. Submit a pr and make sure a test tests this and ill get the pr in asap.

@Jashtoyunda
Copy link
Author

The problem is there is no direct equivalence in the code.
It seems to be a total reinterpretation (by Babel?) of highlightText where the regex declaration and its modification are fused, but with several errors.

As I'm not familiar with TS, I don't know how to fix this, sorry.

@brianvoe
Copy link
Owner

brianvoe commented Nov 7, 2024

ok if i get time in the future ill try to tackle it

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