Operating on classes doesn't work with SVG elements in IE 11
See original GitHub issueThat means NgClass
is broken.
The reason is annoyingly that IE 11 doesn’t support classList
on SVG elements, so add
ing to undefined
in the BrowserDomAdapter throws.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:4
- Comments:19 (8 by maintainers)
Top Results From Across the Web
IE 11 "Crashes" when Using Dynamic SVG Elements
I was running into this with an <svg> that was dynamically added or removed from the DOM with AngularJS and ng-if . The...
Read more >Scalable Vector Graphics (SVG) files are displayed incorrectly ...
Fixes an issue in which Scalable Vector Graphics (SVG) files are displayed incorrectly in Internet Explorer 11. This issue occurs because seam mitigation...
Read more >Simple SVG icon not displaying in IE11
You don't need innerHTML here, you can build up the element with DOM accessors, such as createElement() , setAttribute() , and appendChild() ....
Read more >SVG (basic support) | Can I use... Support tables for ... - CanIUse
... embed or object elements. Refers to the SVG 1.1 spec. ... Known issues (4) Resources (6) Feedback ... 3 IE9-11 & Edge...
Read more >5 Gotchas You're Gonna Face Getting Inline SVG Into ...
It may be obvious, but this is only an issue, here, because we're ... add classes within the source SVG and apply CSS...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.