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.

Exceptions relating to media queries

See original GitHub issue

Hi 👋🏼 Super stoked to see a polyfill for this! Thanks for your work 😄

I wanted to try this out on a Docusaurus page for a custom component, but when loading the polyfill, I get the following two errors:

Uncaught DOMException: Element.matches: '@media (min-width: 1440px) ' is not a valid selector cqfill.js:130
Uncaught (in promise) DOMException: Document.querySelectorAll: '@media (min-width: 1440px) ' is not a valid selector cqfill.js:204

I’m not entirely sure what’s going on, but it seems to me that @media[...] gets picked up as a rule and that it breaks some queries. That said, I may very well be doing something wrong. This happens both in Firefox 96 and in Chrome 97.

Do you have any ideas about what may be going wrong and/or how I can fix it?

Thanks for any input!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
devknollcommented, Aug 16, 2022

This issue should be fixed by the latest version of the polyfill (currently in alpha). Let me know if you run into any further problems and I’d be happy to reopen the issue.

Thank you!

0reactions
RodrigoTomeEScommented, May 2, 2022

I have the same issue, I am using the last version of the polyfill, v.0.1.2 and I am getting the error -> Document.querySelectorAll: '@media (min-width: 375px) ’ is not a valid selector

imagen

imagen

I am using React v17.0.2 and NextJS 12.1.0.

I add the import in useEffect inside the _app file

Read more comments on GitHub >

github_iconTop Results From Across the Web

Good practice to write CSS Media Queries - Stack Overflow
I never have to use more than four media query rules, and then put all the needed exceptions for classes, id;s etc inside...
Read more >
Using media queries - CSS: Cascading Style Sheets | MDN
Syntax · Media types define the broad category of device for which the media query applies: all , print , screen . ·...
Read more >
Media Queries Level 3 - W3C
A media query consists of a media type and zero or more expressions that check for the conditions of particular media features. Among...
Read more >
CSS media queries - the new code
At-media queries are conditions in your stylesheet. The style rules they contain are applied only if certain criteria are met, ...
Read more >
You Probably Don't Need Media Queries Anymore
If you're still relying primarily on media queries to ensure your site or app is fully responsive, it might be time to take...
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