Skip to content
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

Address spacing in combinators #42

Merged
merged 1 commit into from
Sep 14, 2021

Conversation

WorldSEnder
Copy link
Collaborator

Closes #41

By inspecting the CSS Selector Spec this identifies tokens that are used at the start or end of <compound-selector>, which signals the intended use of a descendant combinator if no other token is present between them. Expand documentation on this issue and add test cases + ref to upstream tracking of the span API in the rust compiler.

Specifically, * can either start or end a selector, and # can appear at the start. The rest of the tokens like .class or ::before are to be disambiguated by adding a * star selector in front of them to force the spacing.

@futursolo
Copy link
Owner

I think # can actually appear in places other than the start of a selector (.some-class#some-id)?

Despite that, I think this is actually an excellent workaround!

@WorldSEnder
Copy link
Collaborator Author

I think # can actually appear in places other than the start of a selector (.some-class#some-id)?

Despite that, I think this is actually an excellent workaround!

Have you ever seen that used? I think the first instinct is to write the equivalent but more logical #some-id.some-class, but you're of course right that the above can confusingly have an extra space with this PR.

@futursolo
Copy link
Owner

Have you ever seen that used?

I actually prefer .some-class#some-id. But I think it's fine to always insert before # until we can find a better solution as that can be a relatively rare occasion and having # alone is much more common.

@futursolo futursolo merged commit 894cb50 into futursolo:master Sep 14, 2021
@WorldSEnder WorldSEnder deleted the inline-spacing branch September 14, 2021 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(Inline) Descendant combinator is not recognised properly
2 participants