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

Add note about parens in matchMedia #37504

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

Conversation

chriskirknielsen
Copy link
Contributor

Description

Provides a note about explicit requirements for a matchMedia condition to be wrapped in parentheses.

Motivation

I was bitten by this and didn't find an explicit callout to help developers who might have been in my situation and could not understand why their code wouldn't work.

I was bitten by this and didn't find an explicit callout to help developers who might have been in my situation and could not understand why their code wouldn't work.
@chriskirknielsen chriskirknielsen requested a review from a team as a code owner January 5, 2025 18:18
@chriskirknielsen chriskirknielsen requested review from wbamberg and removed request for a team January 5, 2025 18:18
@github-actions github-actions bot added Content:WebAPI Web API docs size/xs [PR only] 0-5 LoC changed labels Jan 5, 2025
@@ -24,6 +24,9 @@ matchMedia(mediaQueryString)

- `mediaQueryString`
- : A string specifying the media query to parse into a {{domxref("MediaQueryList")}}.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[mdn-linter] reported by reviewdog 🐶

Suggested change

Copy link
Contributor

github-actions bot commented Jan 5, 2025

Preview URLs

@Josh-Cena
Copy link
Member

Josh-Cena commented Jan 5, 2025

This is misleading though. Anything that needs parentheses in <media-query-list> needs parentheses here; anything that doesn't, doesn't. For example print is just print not (print).

@chriskirknielsen
Copy link
Contributor Author

chriskirknielsen commented Jan 5, 2025

@Josh-Cena That's a good point! Do you know what would be a better verbiage to communicate this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:WebAPI Web API docs size/xs [PR only] 0-5 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants