-
Notifications
You must be signed in to change notification settings - Fork 90
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
Don't use innerHTML on SVG elements when setting donut title #135
Conversation
Running the ng-docs viewer (grunt ngdocs:view) shows that this does not work when customizing the center label HTML using the config.centerLabelFn attribute. |
@jeff-phillips-18 Thanks, I wasn't sure how to test locally. Any recommendation to fix? Not all browsers let you set HTML on an SVG element, so I'm not sure a custom label function that returns markup will work cross browser. I believe it's a problem on both IE and iOS. |
Created #136 to track the Utilization Bar Chart issue |
centerLabelText.smText + | ||
'</tspan>'; | ||
donutChartTitle.insert('tspan').text(centerLabelText.bigText).classed('donut-title-big-pf', true).attr('dy', 0).attr('x', 0); | ||
donutChartTitle.insert('tspan').text(centerLabelText.smText).classed('donut-title-small-pf', true).attr('dy', 20).attr('x', 0); |
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.
Thoughts on having all of this in the html and then conditionally showing it via an ng-if
or ng-show
? To me, that would be more readable than html in JS.
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.
The donutChartTitle html is in D3/C3
Hi, what we'd like to do is approve this change in order to get the donut chart working in IE and Safari. Next, we'll file another issue about allowing one to specify HTML in the center label. For now, in order to get this fix in, we should update the ngdoc and specify that, at the moment, only text is supported for the centerLabelFn. So, could you please:
|
822c2af
to
38d1691
Compare
@dtaylor113 Thanks, I've made the suggested changes. |
Hi, this needs to be rebased.
|
Fixes an issue on IE where the donut title is not set.
38d1691
to
7d8e367
Compare
@dtaylor113 Rebased. |
Don't use innerHTML on SVG elements when setting donut title
angular-patternfly v2.5.0 should be released tomorrow which will have this fix; will you be able to update to it? |
@dtaylor113 they need a patch release. I have already created a 2.3.x branch for them. |
Fixes an issue on IE where the donut title is not set.
innerHTML
cannot be used reliably on SVG elements./cc @jwforres