Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

SVG attribute directive with replace:false does not include template in Internet Explorer #11219

Open
@hansmaad

Description

@hansmaad

I am writing some SVG directives that should insert svg templates. Since replace is marked as deprecated I try to use an attribute directive on a g element like here: http://stackoverflow.com/a/28281587/498298

angular.module('app', []).directive('myRect', function() {
  return {
    restrict: 'A',
    templateNamespace: 'svg',
    template: '<rect x="20" y="20" width="100" height="50" fill="blue" />'
  };
})

It works in Chrome, but in IE11 the <g my-rect></g> is empty.

I'm not sure if I'm right, but I think the problem is in $compileNode.html(directiveValue); which sets innerHTML even for SVG templates. While supported in Chrome, IE seems not to support innerHTML for SVGElements.

I can fix the problem by using the same code as for replace:true case:
hansmaad@2488eed

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions