Skip to content

[css-syntax-3] Clarify the grammar for parsing @media contents #6953

@cdoublev

Description

@cdoublev

I'm aware that parse a stylesheet and parse a list of rules are nearly identical:

  • both consumes rules
  • the former handle HTML comment open/close tokens and returns an object holding rules
  • the latter only returns the rules

But I'm confused by the following:

"Parse a list of rules" is intended for the content of at-rules such as @media.

https://drafts.csswg.org/css-syntax-3/#parser-entry-points

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

https://drafts.csswg.org/css-conditional-3/#at-media

I think that the first quote is incorrect, and that @keyframes could replace @media in this quote.

EDIT 1:

If a given context is only intended to accept at-rules, such as in @font-features-values, it doesn’t actually matter which production is used, but <rule-list> is preferred for its more straightforward name.

I assume the above means it doesn’t actually matter which production is used, <stylesheet> or <rule-list>, but <rule-list> [...].

This helps clarifying the different types used in CSS Syntax and CSS Conditional but the return value of parse a stylesheet and parse a list of rules actually have different shapes. But this may be a minor difference that is not worth clarifying, I do not know.

EDIT 2: I realized that parsing <stylesheet> does not mean parse a stylesheet, I'm sorry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions