Skip to content

[css-nesting-1] Indenting of deeply nested rules is still only one level #7862

Closed
@sesse

Description

@sesse

There's an example from the nesting-parsing.html test:

main { & > section, & > article { & > header { color: green; } } }

As far as I understand the algorithm (which is defined in https://drafts.csswg.org/cssom-1/#serialize-a-css-rule, I believe—it seems to have been updated for nesting, and then a near-identical copy was pasted into the css-nesting-1 draft for CSSNestingRule), this should be serialized as:

main {
  & > section, & > article {
  & > header { color: green; }
}
}

This isn't optimal, by any stretch; not only is it hard to understand the nesting level of the innermost rule, but the second-to-last } also comes at an unexpected place. Could we perhaps have some sort of explicit string replacement? Or idea of nesting level? I don't know how these algorithms are usually defined to be as implementable as possible.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions