question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

querySelectorAll throws a syntax error when using the :scope selector

See original GitHub issue

The following test-case works in browsers which support the :scope selector, but fails in jsdom:

http://jsbin.com/vozebogoja/edit?html,js,output

The error message:

SyntaxError
    at HTMLUListElementImpl.<anonymous> (/test/node_modules/jsdom/lib/jsdom/living/nodes/ParentNode-impl.js:83:11)
    at HTMLUListElementImpl.querySelectorAll (/test/node_modules/jsdom/lib/jsdom/utils.js:133:45)
    at HTMLUListElement.querySelectorAll (/test/node_modules/jsdom/lib/jsdom/living/generated/ParentNode.js:39:62)
    at Object.<anonymous> (/test/t.js:15:4)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.runMain (module.js:590:10)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
dperinicommented, Sep 25, 2016

I am currently working on additional Selector Level 4 compatibility. :scope is one of the targeted features I will add asap.

1reaction
Zirrocommented, Apr 3, 2019

We have support for the :scope selector now. https://github.com/jsdom/jsdom/issues/2359 covers adding more tests for it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught SyntaxError: Failed to execute 'querySelector' on ...
In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646 ...
Read more >
querySelectorAll throws SyntaxError for attribute selector with ...
Summary: querySelectorAll throws SyntaxError for valid attribute selector → querySelectorAll throws SyntaxError for attribute selector with missing ']' ...
Read more >
Avoid Errors With document.querySelector ... - | Ryan Dejaegher
When querySelector doesn't find a matching selector, the value of the variable will be null . For example: var missingElement = document.
Read more >
Element.querySelectorAll() - Web APIs
This string must be a valid CSS selector string; if it's not, a SyntaxError exception is thrown. See Locating DOM elements using selectors...
Read more >
609415 - Error messages from parentNode.querySelector() do ...
https://dom.spec.whatwg.org/#scope-match-a-selectors-string ... It is throwing SyntaxError error only as per below code.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found