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

Selector with escaped special characters gives SyntaxError #105

Open
MatMoore opened this issue Feb 28, 2024 · 0 comments
Open

Selector with escaped special characters gives SyntaxError #105

MatMoore opened this issue Feb 28, 2024 · 0 comments

Comments

@MatMoore
Copy link

I'm trying to use a selector with an escaped special character \\! in it.

Minimal example that breaks in nwsapi 2.2.7:

<div class="abc-!-def"></div>

<script type="text/javascript" src="./node_modules/nwsapi/src/nwsapi.js" onload="NW.Dom.install()"></script>
<script>
        console.log(document.querySelectorAll(":not(.abc-\\!-def)"))
</script>

This throws Uncaught DOMException: '.abc-!-def' is not a valid selector, but it works just fine with the query selector API provided by my browser (Chrome).

If I change the selector to just .abc-\\!-def, then the selector works as expected and I do not get a syntax error.

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

1 participant