Skip to content

CSS Nesting #92

Closed
Closed

Description

@jonathantneal

I’m thrilled to see a repository with tokenization for HTML, CSS, and JS.

I may have found a couple issues.

Since the 2013 edition of the CSS Syntax specification, the handling for nesting at-rules has been defined, so that at-rules can be successfully consumed, even if their contents are only considered a series of component values.

This does not appear to be supported in this project.

In the 2021 edition of the CSS Syntax specification, this support has been expanded to include the & nesting selector which consumes qualified rules.

This does not appear to be supported in this project.

Activity

  1. tdewolff commented on Dec 7, 2021

    @tdewolff
    Owner

    Hi Jonathan, thanks for reporting the issue! I want to fix both issues but I have to confess that I have limited time to dedicate at the moment.

    I was under the impression that at rules must contain qualified rules (selector + declaration block), but it appears that it may contain instead a declaration as well.

  2. tdewolff commented on Dec 7, 2021

    @tdewolff
    Owner

    I'm not entirely sure what you mean with nesting at-rules. In your example I see that @media{color:blue} is not yet supported and I'm working on that, but what do you mean with nested at-rules? Can you give an example?

  3. tdewolff commented on Dec 11, 2021

    @tdewolff
    Owner

    Relevant documentation is here: https://drafts.csswg.org/css-syntax/#declaration-rule-list
    For each at-rule it is defined where it may contain qualified rules or declarations.

  4. GraphR00t commented on May 3, 2024

    @GraphR00t

    @tdewolff

    CSS nesting is now supported by most major browser vendors: https://caniuse.com/?search=CSS%20nesting
    Even though the specification is not finalized it would be great to have partial support for it.

    Thank you for your work on this Go module !

  5. tdewolff commented on May 12, 2024

    @tdewolff
    Owner

    Great idea, this will definitely be a great way to compress CSS files further and I'll put it on the roadmap when I have time to work on the new CSS parser!

  6. tdewolff commented on Feb 19, 2026

    @tdewolff
    Owner

    There's a hacky fix with 1aea605

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions