Skip to content

Fix/prefix ids sameline comments#1942

Merged
SethFalco merged 3 commits into
svg:mainfrom
john-neptune:fix/prefix-ids-sameline-comments
Jan 23, 2024
Merged

Fix/prefix ids sameline comments#1942
SethFalco merged 3 commits into
svg:mainfrom
john-neptune:fix/prefix-ids-sameline-comments

Conversation

@john-neptune

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

Copy link
Copy Markdown
Contributor

#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.
Comment thread .gitignore Outdated

@SethFalco SethFalco left a comment

Copy link
Copy Markdown
Member

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