Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

inlineStyles plugin should not remove id attribute from target element #2065

Open
johnkenny54 opened this issue Aug 22, 2024 · 0 comments · May be fixed by #2066
Open

inlineStyles plugin should not remove id attribute from target element #2065

johnkenny54 opened this issue Aug 22, 2024 · 0 comments · May be fixed by #2066
Labels

Comments

@johnkenny54
Copy link
Contributor

When the inlineStyles plugin inlines a style with an id selector, it is removing the id attribute from the target element. It shouldn't do this, as it has no way of knowing whether the id is used elsewhere.

To Reproduce
Optimize the following with the inlineStyles plugin:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
  <style>
    #a {stroke:red;}
  </style>
  <path id="a" d="M 2 2 h10"/>
  <use href="#a" x="5" y="5"/>
</svg>

Expected behavior
The style should be inlined, but the id attribute should not be deleted.

Version 4.0.0-rc.1

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

Successfully merging a pull request may close this issue.

1 participant