Skip to content

Selector with escaped special characters gives SyntaxError #105

@MatMoore

Description

@MatMoore

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions