Skip to content

Commit 66a9a17

Browse files
committed
Bugfix: Fix IE11 issue
1 parent ba4fb59 commit 66a9a17

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

svg-piechart.html

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,7 @@
3535
</style>
3636

3737
<template>
38-
<svg id="svg" width$="[[size]]" height$="[[size]]" viewBox="0 0 360 360">
39-
<!-- <template is="dom-repeat" items={{_arcs}}>
40-
<path class="slice" d="M180,180 L{{item.x1}},{{item.y1}} A180,180 0 {{item.largeArcFlag}},1 {{item.x2}},{{item.y2}} z"style="fill: {{item.color}}" />
41-
</template> -->
42-
</svg>
38+
<svg id="svg" width$="[[size]]" height$="[[size]]" viewBox="0 0 360 360"></svg>
4339
</template>
4440

4541
</dom-module>
@@ -194,7 +190,14 @@
194190

195191
for (var i = 0; i < arcs.length; i++) {
196192
var path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
197-
path.classList.add('slice');
193+
// IE11 does not support classList on SVG elements
194+
if (path.classList) {
195+
path.classList.add('slice');
196+
}
197+
else {
198+
var c = path.getAttribute('class');
199+
path.setAttribute('class','slice');
200+
}
198201
path.style.fill = arcs[i].color;
199202
path.setAttribute('d', this._computePath(arcs[i]));
200203
svg.appendChild(path);

0 commit comments

Comments
 (0)