angular: Operating on classes doesn't work with SVG elements in IE 11

That means NgClass is broken.

The reason is annoyingly that IE 11 doesn’t support classList on SVG elements, so adding to undefined in the BrowserDomAdapter throws.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 4
  • Comments: 19 (8 by maintainers)

Commits related to this issue

Most upvoted comments

A small shim like this gets around the the missing classList on IE11.

if (!(“classList” in document.createElementNS(“http://www.w3.org/2000/svg","g”))) { var descr = Object.getOwnPropertyDescriptor(HTMLElement.prototype, ‘classList’); Object.defineProperty(SVGElement.prototype, ‘classList’, descr); }

I’m not suggestiing it’s a solution. The more interesting thing is that with that shim in place the SVG rendering works but the performance is very slow.