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

svg sprite (xlink:href) render problem #716

Open
laphilosophia opened this issue Jul 30, 2017 · 1 comment
Open

svg sprite (xlink:href) render problem #716

laphilosophia opened this issue Jul 30, 2017 · 1 comment

Comments

@laphilosophia
Copy link

laphilosophia commented Jul 30, 2017

Hi all.

I call icons in the project using the svg sprite method. But the icon does not appear when rivets render. I could not find a solution what I did. there is any solution, you know about that?
(sorry about my english)

Here is the sample code: (with pug)
svg(class="icon view-icon") use(rv-xlink:href="item.icon")

and the rendered result:
<svg class="icon view-icon"><use rv-xlink:href="item.icon" xlink:href="#view-icon"></use></svg> #shadow dom (closed) ~ nothing :(

@ultradeq
Copy link

ultradeq commented Oct 2, 2017

Hi,
I had the same problem and solved it with custom binder:

rivets.binders.xlinkhref = function(el, value) {
    el.setAttributeNS('http://www.w3.org/1999/xlink', 'href', '#' + value)
}

HTML:

<svg class="icon view-icon">
    <use rv-xlinkhref="item.icon"></use>
</svg>

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

No branches or pull requests

2 participants