nwsapi icon indicating copy to clipboard operation
nwsapi copied to clipboard

Selector with escaped special characters gives SyntaxError

Open MatMoore opened this issue 1 year ago • 0 comments

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.

MatMoore avatar Feb 28 '24 16:02 MatMoore