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

Escape React.useId to avoid jsdom SyntaxError #1636

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gaborbernat
Copy link

@gaborbernat gaborbernat commented Feb 4, 2025

Per https://stackoverflow.com/questions/73894096/react-useid-creates-invalid-selector the : can cause SyntaxError due to React returning : charachter. This escape fixes that. Without this I am getting the following crash from nwsapi via jsdom.

SyntaxError: unknown pseudo-class selector ':r0:-menu.Menustyles__MenuPopper-sc-19x7i94-1 *'
    at emit (/frontend/node_modules/jsdom/node_modules/nwsapi/src/nwsapi.js:651:17)
    at compileSelector (/frontend/node_modules/jsdom/node_modules/nwsapi/src/nwsapi.js:1418:17)
    at compile (/frontend/node_modules/jsdom/node_modules/nwsapi/src/nwsapi.js:838:16)
    at collect (/frontend/node_modules/jsdom/node_modules/nwsapi/src/nwsapi.js:1693:22)
    at _querySelectorAll (/frontend/node_modules/jsdom/node_modules/nwsapi/src/nwsapi.js:1651:36)
    at Object._querySelector [as first] (/frontend/node_modules/jsdom/node_modules/nwsapi/src/nwsapi.js:1555:14)
    at HTMLUListElementImpl.querySelector (/frontend/node_modules/jsdom/lib/jsdom/living/nodes/ParentNode-impl.js:69:44)
    at HTMLUListElement.querySelector (/frontend/node_modules/jsdom/lib/jsdom/living/generated/Element.js:1094:58)
    at Array.Resolver (eval at compile (/frontend/node_modules/jsdom/node_modules/nwsapi/src/nwsapi.js:853:17), <anonymous>:3:98)
    at match_assert (/frontend/node_modules/jsdom/node_modules/nwsapi/src/nwsapi.js:1482:13)

Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
@gaborbernat gaborbernat changed the title Escape useID to avoid jsdom SyntaxError Escape React.useId to avoid jsdom SyntaxError Feb 4, 2025
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

Successfully merging this pull request may close these issues.

1 participant