Skip to content

Behaviour of OutputFormatter::removeLastSemicolon() is not quite right #957

Open
@JakeQZ

Description

@JakeQZ

It currently works because Rule::render() renders individual rules with a trailing semicolon, and RuleSet::renderRules() essentially concatenates the results of the former, then appends the spaceAfterRules setting (which could be set to something non-spacy, like a comment).

So it is always passed a string of rules which has a trailing semicolon.

The intention of the method is clearly to remove that trailing semicolon, and not others. But if it is passed a string of rules without one (e.g. color: green; font-size: 20px, or even the result from a previous call), it will remove a semicolon that is required.

It should perhaps be called before spaceAfterRules is appended, and do something like an rtrim().

Note that the comments for each rule are currently inserted before the rule, so the only content after the final rule would be the spaceAfterRules.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions