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

Feature Request: Better handling of existing class on SVG element #44

Closed
Undistraction opened this issue Jul 21, 2016 · 2 comments
Closed

Comments

@Undistraction
Copy link

It appears that if a class or classes already exist(s) on the svg element and 'inline-svgis called using theclass` parameter, these classes are replaced. It would make more sense to me that any additional classes are added. If classes need to be scrubbed from the SVG then it feels like that should happen in a transform, not as an unexpected bi-product of adding a class.

Additionally I need to add a class to all SVG elements. Obviously I could pass the same class every time I use inline-svg, but this feels like unnecessary repetition. I solved this by writing a transform that pulls a default class from config, but this would be a nice built-in config option.

@jamesmartin
Copy link
Owner

It would make more sense to me that any additional classes are added.

@Undistraction agreed. This feels like the correct behavior.

Obviously I could pass the same class every time I use inline-svg, but this feels like unnecessary repetition.

This would mean exposing the built-in transformations to the configure block, and allowing default values to be added. I'll have to think through the ramifications of this, as there's the potential for confusion here ("Where is this extra class coming from" etc.).

@jamesmartin
Copy link
Owner

jamesmartin commented Sep 1, 2016

Fixed the problem with existing classes being replaced in v0.11.0.

Closing this now in favor of #48.

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

No branches or pull requests

2 participants