Skip to content

[css-syntax-3] Fix outdated example featuring nested media queries #6958

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

Closed
cdoublev opened this issue Jan 17, 2022 · 3 comments
Closed

[css-syntax-3] Fix outdated example featuring nested media queries #6958

cdoublev opened this issue Jan 17, 2022 · 3 comments

Comments

@cdoublev
Copy link
Collaborator

cdoublev commented Jan 17, 2022

At the very bottom of section 8.1. Defining Block Contents: the <declaration-list>, <rule-list>, and <stylesheet> productions, I understand from Example 15 that nested media queries are invalid:

For example, the @media rule accepts anything that can be placed in a stylesheet, except more @media rules. As such, its grammar is:

@media <media-query-list> { <stylesheet> }

It additionally defines a restriction that the <stylesheet> can not contain @media rules, which causes them to be dropped from the outer rule’s value if they appear.

I may be confused because both sentences mean the same thing to me.

@tabatkins
Copy link
Member

Correct, the last paragraph is saying that the @media spec places that restriction on the <stylesheet> production, which matches the intended behavior listed in the first paragraph.

@cdoublev
Copy link
Collaborator Author

But Conditional defines that nested @media are allowed, isn't it?

Example 2

For example, with this set of nested rules:

@media print { /* rule (1) */
  /* hide navigation controls when printing */
  #navigation { display: none }
  @media (max-width: 12cm) { /* rule (2) */
  /* keep notes in flow when printing to narrow pages */
    .note { float: none }
  }
}

[...]

3. Contents of conditional group rules

All conditional group rules are defined to take a in their block, which means they can accept any rule that is normally allowed at the top-level of a stylesheet, and not otherwise restricted.

@cdoublev
Copy link
Collaborator Author

cdoublev commented Feb 5, 2024

Removed in c7ce041.

@cdoublev cdoublev closed this as completed Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants