-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
additional CSS selector formatting #59
additional CSS selector formatting #59
Conversation
c711ae3
to
5d8fe83
Compare
Implement formatting for IdSelector, HashToken, PseudoClassSelector, and PseudoElementSelector. Also, add formatting test coverage.
5d8fe83
to
c152737
Compare
@@ -125,7 +125,7 @@ def accept(visitor) | |||
end | |||
|
|||
def child_nodes | |||
[type, subclasses, pseudo_elements].flatten | |||
[type, subclasses, pseudo_elements].compact.flatten |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up to you, but you could make this:
[type, subclasses, pseudo_elements].compact.flatten | |
[type, *subclasses, *pseudo_elements] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately that change doesn't account for a) type
being nil and needing to be removed, and b) pseudo_elements
contains nested arrays.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we're here, I don't really like the fact that pseudo_elements contains nested arrays (see the test "parses a compound selector with pseudo-elements and pseudo-classes" to see what it looks like), but regardless I think child_nodes
should flatten it all.
@kddnewton If this is OK with you, would you mind merging? I've got more work that's based on this branch. ❤️ |
Implement CSS selector formatting for IdSelector, HashToken, PseudoClassSelector, and PseudoElementSelector, and add test coverage.
Also backfill coverage of the existing PseudoElementSelector AST.