Skip to content

Incorrect namespace applied when binding to xlink:href attribute in SVG 'use' elements #5548

@larrifax

Description

@larrifax

I'm attempting to bind values to the xlink:href attribute of a <use> element contained inside a <svg> element like so:

<svg>
   <use [attr.xlink:href]="url"></use>
</svg>

This does not work in either alpha 47 or alpha 46, as no SVG image is displayed. See the following plunk, which illustrates the problem: http://plnkr.co/edit/ELcnoTe2CE5v5r9FUD0c?p=preview

It looks like the xlink:href attribute is missing the correct namespace when binding to it. Executing the following statement in the Chrome developer console when targeting the <use> element fixes the problem:
$0.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", "assets/icons/icons.svg#icons--alert")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions