Skip to content

Commit

Permalink
Make fullcolor icons work better in safari too
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasloven committed May 17, 2021
1 parent e66ed00 commit 842090a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion custom_components/fontawesome/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion custom_components/fontawesome/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"codeowners": [],
"requirements": [],
"config_flow": true,
"version": "2.1.1",
"version": "2.1.2",
"iot_class": "local_polling"
}
12 changes: 8 additions & 4 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,14 @@ customElements.whenDefined("ha-icon").then(() => {
}
if (icon.fullCode && icon.format === "fullcolor") {
await el.updateComplete;
const root = el.shadowRoot.querySelector("g");
if (root.firstElementChild) {
root.firstElementChild.style.display = "none";
}
const root = el.shadowRoot.querySelector("svg");
const styleEl = document.createElement("style");
styleEl.innerHTML = `
svg:first-child>g:first-of-type>path {
display: none;
}
`;
root.appendChild(styleEl);
root.appendChild(icon.fullCode.cloneNode(true));
} else {
el.setPaths(icon.paths);
Expand Down

0 comments on commit 842090a

Please sign in to comment.