Skip to content

Commit

Permalink
IE 11 fixes - use textContent instead of innerHTML
Browse files Browse the repository at this point in the history
  • Loading branch information
onlymejosh committed Sep 23, 2014
1 parent 13657f3 commit 330d1a9
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
11 changes: 6 additions & 5 deletions dist/js/pizza.js
Expand Up @@ -402,7 +402,7 @@ $.extend(Pizza, {
'text-anchor': 'end'
});

text.innerHTML = ticks[i];
text.textContent = ticks[i];

if (existing_group.length < 1) {
line_g.appendChild(line);
Expand Down Expand Up @@ -503,7 +503,7 @@ $.extend(Pizza, {
y = (data[i].y / max_y) * height;

points += x + ',' + y + ' ';
this.set_attr(circle, {cx: x, cy: y,r: 0,fill: data[i.color],
this.set_attr(circle, {cx: x, cy: y,r: 0,fill: data[i].color,
'data-value': data[i].x + ', ' + data[i].y,
'data-tooltip': '',
'title': data[i].x + ', ' + data[i].y,
Expand Down Expand Up @@ -658,7 +658,7 @@ $.extend(Pizza, {
if (existing_group.length < 1) {
text_g.appendChild(text);
line_g.appendChild(line);
text.innerHTML = ticks[i];
text.textContent = ticks[i];
}

total_tick_height = line_height;
Expand Down Expand Up @@ -712,6 +712,7 @@ $.extend(Pizza, {
}

});

$.extend(Pizza, {
pie : function (legend) {
// pie chart concept from JavaScript the
Expand Down Expand Up @@ -787,13 +788,13 @@ $.extend(Pizza, {
if (data[i].text) {
var visible_text = this.parse_options(data[i].text, percent, data[i].value);
} else {
var visible_text = Math.ceil(percent) + '%';
var visible_text = Math.round(percent) + '%';
}
var text = this.svg_obj('text');

text.setAttribute('x', cx + (r + settings.percent_offset) * Math.sin(start_angle + (angles[i] / 2)));
text.setAttribute('y', cy - (r + settings.percent_offset) * Math.cos(start_angle + (angles[i] / 2)));
text.innerHTML = visible_text;
text.textContent = visible_text;
}

text.setAttribute('text-anchor', 'middle');
Expand Down
2 changes: 1 addition & 1 deletion dist/js/pizza.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/pizza/bar.js
Expand Up @@ -156,7 +156,7 @@ $.extend(Pizza, {
'text-anchor': 'end'
});

text.innerHTML = ticks[i];
text.textContent = ticks[i];

if (existing_group.length < 1) {
line_g.appendChild(line);
Expand Down
2 changes: 1 addition & 1 deletion js/pizza/line.js
Expand Up @@ -203,7 +203,7 @@ $.extend(Pizza, {
if (existing_group.length < 1) {
text_g.appendChild(text);
line_g.appendChild(line);
text.innerHTML = ticks[i];
text.textContent = ticks[i];
}

total_tick_height = line_height;
Expand Down
2 changes: 1 addition & 1 deletion js/pizza/pie.js
Expand Up @@ -79,7 +79,7 @@ $.extend(Pizza, {

text.setAttribute('x', cx + (r + settings.percent_offset) * Math.sin(start_angle + (angles[i] / 2)));
text.setAttribute('y', cy - (r + settings.percent_offset) * Math.cos(start_angle + (angles[i] / 2)));
text.innerHTML = visible_text;
text.textContent = visible_text;
}

text.setAttribute('text-anchor', 'middle');
Expand Down

0 comments on commit 330d1a9

Please sign in to comment.