Skip to content

Commit

Permalink
Improve support for IE11
Browse files Browse the repository at this point in the history
  • Loading branch information
JosefJezek authored Mar 27, 2019
1 parent 0e86ab6 commit b2bd836
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions iron-iconset-svg.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,23 @@
// IE 11 does not provide the outerHTML property.
var outer = content.outerHTML || new XMLSerializer().serializeToString(content);

content = outer.replace(/id="/g, 'id="' + sourceId + '-')
.replace(/fill="url\(#/g, 'fill="url(#' + sourceId + '-');
var contentString = outer.replace(/id="/g, 'id="' + sourceId + '-')
.replace(/fill="url\(#/g, 'fill="url(#' + sourceId + '-');

svg.setAttribute('viewBox', viewBox);
svg.setAttribute('preserveAspectRatio', 'xMidYMid meet');
svg.setAttribute('focusable', 'false');
// TODO(dfreedm): `pointer-events: none` works around https://crbug.com/370136
// TODO(sjmiles): inline style may not be ideal, but avoids requiring a shadow-root
svg.style.cssText = cssText;
svg.innerHTML = content;

var isIEBrowser = /*@cc_on!@*/false || !!document.documentMode;
if (isIEBrowser) {
svg.appendChild(content);
} else {
svg.innerHTML = contentString;
}

return svg;
}
return null;
Expand Down

0 comments on commit b2bd836

Please sign in to comment.