-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
removeXMLSpace plugin: remove xml:space attribute for inline svg usage #1660
Conversation
Is this something that will be implemented in a near release? |
@TrySound Any plans to merge this? |
Co-authored-by: Andrey Nelyubin <[email protected]>
I'm currently profiling my build pipeline and noticed that the `strongRound` function showed up a couple of times, followed immediately with a bit of GC cleanup shortly after. We can speed up that function by avoiding the string casting caused by `Number.prototype.toFixed()`. In my project's build pipeline with lots of svg icons this saves about 1.4s in total. <img width="792" alt="js-tools-strongRound" src="https://user-images.githubusercontent.com/1062408/204393563-666be3e0-e0ee-4608-9b7d-9ea8352bd36b.png">
I'm currently profiling my build setup and noticed that `stringifyNumber` pops up here and there. Instead of going with the double regex replace approach, we'll go with the faster approach in `removeLeadingZero`. In total the changes in this PR speed up the build by about `0.9s` in my project. <img width="798" alt="stringifyNumber" src="https://user-images.githubusercontent.com/1062408/204154146-ce67d0c9-faf2-40a1-8186-8d34caea74a5.png">
# Conflicts: # lib/svgo/config.js # plugins/plugins.js
We have a dedicated plugin for removing deprecated attributes in It will be enabled by default, but will only remove safe attributes. Deprecated attributes that may impact rendering will only be removed if the See: It could be worth having a safe plugin that removes |
xml:space
attribute has been deprecated according to MDN.SVG supports the built-in XML xml:space attribute to handle whitespace characters inside elements. Child elements inside an element may also have an xml:space attribute that overrides the parent's one.
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xml:space