fa-icon-element
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "fa-icon-element", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Vanilla custom element that displays FontAwesome icons", | ||
@@ -5,0 +5,0 @@ "main": "src/fa-icon.js", |
# fa-icon Custom Element | ||
[![npm version](https://badge.fury.io/js/fa-icon-element.svg)](https://badge.fury.io/js/fa-icon-element) | ||
**FontAwesome Version:** v4.7.0 | ||
@@ -4,0 +6,0 @@ |
@@ -50,3 +50,3 @@ /** | ||
connectedCallback() { | ||
this.setupFontImport(); | ||
FaIcon.setupFontImport(); | ||
@@ -97,4 +97,4 @@ // setup icon element | ||
*/ | ||
setupFontImport() { | ||
if(this.fontImportComplete) { | ||
static setupFontImport() { | ||
if(FaIcon._fontImportComplete) { | ||
return; | ||
@@ -115,7 +115,7 @@ } | ||
// Important note: we append the style node not to the shadow root but | ||
// to the element itself, so that the created style lives in the global | ||
// CSS scope. This will not work otherwise. | ||
this.appendChild(styleNode); | ||
this.fontImportComplete = true; | ||
// Important note: we append the style node to the body so that it is | ||
// a part of the global CSS scope, therefore circumventing an issue in | ||
// which browsers would not load @font-face's within a shadow root. | ||
document.body.appendChild(styleNode); | ||
FaIcon._fontImportComplete = true; | ||
} | ||
@@ -122,0 +122,0 @@ } |
38943
59