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

Fix/prefix ids sameline comments #1942

Merged
merged 3 commits into from
Jan 23, 2024

Conversation

john-neptune
Copy link
Contributor

@john-neptune john-neptune commented Jan 22, 2024

#1941

Fix prefixing classes on same line as a comment

Before, this worked:

<style>
.cls-1 {}
<!-- foo -->
.cls-2 {}
</style>

but this failed:

<style>
.cls-1 {} <!-- foo -->
.cls-2 {}
</style>

.cls-1 would be prefixed, but .cls-2 and subsquent classes would not.

The root cause is an empty return that was missed during a refactor to
switch from forEach() with a lambda to a for () loop.

Add a new test to cover this case.

Before, this worked:
<style>
.cls-1 {}
<!-- foo -->
.cls-2 {}
</style>

but this failed:
<style>
.cls-1 {} <!-- foo -->
.cls-2 {}
</style>

.cls-1 would be prefixed, but .cls-2 and subsquent classes would not.

The root cause is an empty return that was missed during a refactor to
switch from forEach() with a lambda to a for () loop.

Add a new test to cover this case.
.gitignore Outdated Show resolved Hide resolved
Copy link
Member

@SethFalco SethFalco left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for reporting the issue and submitting a patch. This will be in the next release of SVGO.
Also, sorry for breaking your implementation during the rebase of #1736. ^-^'

Co-authored-by: Seth Falco <seth@falco.fun>
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.

3 participants