Skip to content

Conversation

@8ctopus
Copy link
Contributor

@8ctopus 8ctopus commented Dec 26, 2025

This is a PR draft for selector tidying to transform this:

a>p {
    color: red;
}

a>p[title="hello>world"]>small {
    outline: 0;
}

into this:

a > p {
        color: red;
}

a > p[title="hello>world"] > small {
        outline: 0;
}

There are no specific tests yet, and there are improvements that can be made, I just want to get your approval before I polish things up.

@coveralls
Copy link

Coverage Status

coverage: 68.833% (-0.4%) from 69.191%
when pulling 96889c3 on 8ctopus:render-selector
into 0ae1fde on MyIntervals:main.

Copy link
Collaborator

@JakeQZ JakeQZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would definitely be good to be able to render selectors minified.

However, as noted in #1398 (review), it is not straightforward to achieve that from the codebase as it stands.

I don't think the render() method should be responsible for reparsing the selector, which is already parsed by DeclarationBlock::parseSelector():

  • render() should be able to simply output what it has according to the OutputFormat;
  • adding separate parsing functionality here is duplicating functionality.

I think the problem that needs to be solved first is #1325 - i.e. how Selector is represented.

Sorry to be the bearer of bad news, but I think there's quite a bit of initial refactoring needed so that we can have a nice clean solution to this.

If you have any thoughts on solving #1325, they would be very welcome - thanks :) <3

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants