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

prefixIds fails to prefix when classes and comments are on the same line #1941

Closed
john-neptune opened this issue Jan 22, 2024 · 2 comments
Closed
Labels

Comments

@john-neptune
Copy link
Contributor

john-neptune commented Jan 22, 2024

Describe the bug

This works:

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

This fails:

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

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

To Reproduce

Create SVG with:

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

Run the prefixIds plugin on the SVG.

Expected behavior
All classes should be prefixed.

Desktop (please complete the following information):

  • SVGO Version: 3.2.0
  • NodeJs Version: 20.9.0
  • OS: Sonoma 14.2.1

Additional context
I have a fix and will PR shortly.

@SethFalco
Copy link
Member

Just a heads-up! Markdown usually supports safe HTML, so your issue is a lot easier to read when you put code in code blocks! The comments were actually hidden before.

Thanks for reporting the issue and submitting a patch!

@john-neptune
Copy link
Contributor Author

Yep, for sure. I just missed that. Thanks for the assist!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants