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

Invalid selector "[q\\:shadowroot]" #1561

Closed
ianlet opened this issue Oct 7, 2024 · 1 comment
Closed

Invalid selector "[q\\:shadowroot]" #1561

ianlet opened this issue Oct 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@ianlet
Copy link

ianlet commented Oct 7, 2024

I'm one of the maintainers of https://github.com/ianlet/qwik-testing-library and I'm working on adding support for happy-dom for devs who prefer using it.

Unfortunately, we're not yet able to even start a test suite because of an Invalid selector "[q\\:shadowroot]" error is raised when trying to render a Qwik app.

Describe the bug
In Qwik, we use different selectors which contain a : colon to query the DOM, but it seems to be rejected by happy-dom even though they are valid selectors (and accepted by all browsers + jsdom).

Here's are some examples:

document.querySelectorAll("[q\\:shadowroot]");
document.querySelectorAll("[on\\:qvisible]");
document.querySelectorAll("[on\\:qinit]");
// ...

Which will trigger the following error with happy-dom:

DOMException: Invalid selector: "[q\:shadowroot]"
    at Function.getSelectorGroups (file:///home/ian/Projects/noma/node_modules/.pnpm/[email protected]/node_modules/happy-dom/src/query-selector/SelectorParser.ts:214:10)
    at Function.querySelectorAll (file:///home/ian/Projects/noma/node_modules/.pnpm/[email protected]/node_modules/happy-dom/src/query-selector/QuerySelector.ts:116:33)
    at HTMLDocument.querySelectorAll (file:///home/ian/Projects/noma/node_modules/.pnpm/[email protected]/node_modules/happy-dom/src/nodes/document/Document.ts:658:24)

Expected behavior
Valid selectors shouldn't be rejected.

Additional context

    "happy-dom": "^15.7.4",

Seems to be related to those issues: #1559 #1558

@ianlet ianlet added the bug Something isn't working label Oct 7, 2024
@capricorn86
Copy link
Owner

Thank you for reporting @ianlet! 🙂

I believe that is has been fixed now in the latest release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants