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

Question: How to programmaticaly add correct href paths? #49

Open
dsine-de opened this issue Feb 16, 2024 · 2 comments
Open

Question: How to programmaticaly add correct href paths? #49

dsine-de opened this issue Feb 16, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@dsine-de
Copy link

dsine-de commented Feb 16, 2024

Hi, how would I add the correct SVG path when using native JavaScript?

This won't replace the correct path:

const svg = document.createElement('svg');
const svgUse = document.createElement('use');
svgUse.setAttribute('href', '/__spritemap#sprite-comment');

svg.appendChild(svgUse);

Thank you!

@dsine-de
Copy link
Author

Seems I need to use createElementNS with the correct SVG namespace if there is no other way provided by the plugin.

@Applelo
Copy link
Contributor

Applelo commented Feb 22, 2024

Hi, the plugin doesn't provide any kind of API to manage SVG with javascript. I didn't test it with this kind of usage in mind. Maybe in a future feature?

@Applelo Applelo added the enhancement New feature or request label Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants