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

Bind the "role" attribute of svg element is not work #486

Closed
XuJinNet opened this issue Aug 26, 2016 · 5 comments
Closed

Bind the "role" attribute of svg element is not work #486

XuJinNet opened this issue Aug 26, 2016 · 5 comments
Labels

Comments

@XuJinNet
Copy link

I have a custom element responsible for rendering svg icon, i bind the "role" atrribute for the svg element, but it not work, the bind for other bindable attributes is work fine.

View Model

import {containerless, bindable} from 'aurelia-framework';

@containerless()
export class AnImgCustomElement {
    @bindable role;
    @bindable styleClass;
    @bindable style;
    @bindable href;
    @bindable title;
}

View

<template>
    <svg role.bind="role" class.bind="styleClass" style.bind="style">
        <title if.bind="title">${title}</title>
        <use xlink:href.bind="href"></use>
    </svg>
</template>

Use

<an-img role="img" href="images/resources-bundle.svg#${navModel.config.name | dashCase}" title="${navModel.title}"></an-img>

Output

<svg role.bind="role" class.bind="styleClass" style.bind="style" class="au-target" au-target-id="1">
        <title>消息</title><!--anchor-->
        <use xlink:href.bind="href" class="au-target" au-target-id="4" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="images/resources-bundle.svg#message"></use>
</svg>

The role "img" is not set to the svg element.

@jdanyow
Copy link
Contributor

jdanyow commented Sep 6, 2016

@XuJinNet please setup a reproduction using the aurelia gist: https://gist.run/?id=7542e061bc940cde506b

@XuJinNet
Copy link
Author

XuJinNet commented Sep 6, 2016

@jdanyow
Copy link
Contributor

jdanyow commented Sep 16, 2016

@XuJinNet try using xlink:role.bind="role" instead. Take a look at the svg element using the dev tools after making that change- you should see the "role" attribute.

@jdanyow
Copy link
Contributor

jdanyow commented Sep 26, 2016

@XuJinNet in the next release, role.bind="..." will work

@XuJinNet
Copy link
Author

Awesome!
Thank you @jdanyow 👍

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

No branches or pull requests

2 participants