-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(icon): IE/Edge ignoring style tags inside inline SVG #11531
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
Conversation
const styleTags = svg.querySelectorAll('style') as NodeListOf<HTMLStyleElement>; | ||
|
||
for (let i = 0; i < styleTags.length; i++) { | ||
styleTags[i].textContent += ' '; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just remove the elements?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn’t override the content, it just adds an empty string to the end so it gets recomputed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I thought it was =
not +=
for (let i = 0; i < styleTags.length; i++) { | ||
styleTags[i].textContent += ' '; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, although it’ll probably look a little weird.
Adds a workaround for an issue in IE11 and Edge where `style` tags inside dynamically-created SVGs will be ignored. Fixes angular#11458.
589d7a5
to
85fa021
Compare
Addressed the feedback @jelbourn. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Adds a workaround for an issue in IE11 and Edge where `style` tags inside dynamically-created SVGs will be ignored. Fixes #11458.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Adds a workaround for an issue in IE11 and Edge where
style
tags inside dynamically-created SVGs will be ignored.Fixes #11458.