Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit a62d160

Browse files
Splaktarandrewseguin
authored andcommitted
fix(icon): symbol icons not working on browsers other than IE11 (#11706)
remove extra </path> in symbol-icons.svg add symbol-icons.svg file for use in Svg Icon Set CodePens Fixes #11705
1 parent 5162b74 commit a62d160

File tree

3 files changed

+47
-9
lines changed

3 files changed

+47
-9
lines changed
Lines changed: 21 additions & 4 deletions
Loading
Lines changed: 21 additions & 0 deletions
Loading

src/components/icon/js/iconService.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -676,17 +676,17 @@ function MdIconService(config, $templateRequest, $q, $log, $mdUtil, $sce) {
676676
* @constructor
677677
*/
678678
function Icon(el, config) {
679-
var elementContents;
680679
// If the node is a <symbol>, it won't be rendered so we have to convert it into <svg>.
681680
if (el && el.tagName.toLowerCase() === 'symbol') {
682681
var viewbox = el.getAttribute('viewBox');
683-
// Check if innerHTML is supported as IE11 does not support innerHTML on SVG elements.
682+
// // Check if innerHTML is supported as IE11 does not support innerHTML on SVG elements.
684683
if (el.innerHTML) {
685-
elementContents = el.innerHTML;
684+
el = angular.element('<svg xmlns="http://www.w3.org/2000/svg">')
685+
.html(el.innerHTML)[0];
686686
} else {
687-
elementContents = $mdUtil.getInnerHTML(el);
687+
el = angular.element('<svg xmlns="http://www.w3.org/2000/svg">')
688+
.append($mdUtil.getInnerHTML(el))[0];
688689
}
689-
el = angular.element('<svg xmlns="http://www.w3.org/2000/svg">').append(elementContents)[0];
690690
if (viewbox) el.setAttribute('viewBox', viewbox);
691691
}
692692

0 commit comments

Comments
 (0)