From 56092905384e4095ba99838565556f7bbe08b967 Mon Sep 17 00:00:00 2001
From: Vjacheslav Trushkin
Date: Sun, 21 Jan 2024 10:00:10 +0200
Subject: [PATCH] chore: keep innerHTML in web component, export functions for
building icon
---
iconify-icon/icon/README.md | 4 +-
iconify-icon/icon/demo/usage.html | 46 +++++++++++++++
iconify-icon/icon/package.json | 5 +-
iconify-icon/icon/src/component.ts | 89 ++++++++++++++++++++++++------
iconify-icon/icon/src/functions.ts | 11 ++++
5 files changed, 136 insertions(+), 19 deletions(-)
diff --git a/iconify-icon/icon/README.md b/iconify-icon/icon/README.md
index 735f341..7b7d250 100644
--- a/iconify-icon/icon/README.md
+++ b/iconify-icon/icon/README.md
@@ -20,13 +20,13 @@ Iconify Icon web component renders icons.
Add this line to your page to load IconifyIcon (you can add it to `` section of the page or before ``):
```html
-
+
```
or
```html
-
+
```
or, if you are building a project with a bundler, you can include the script by installing `iconify-icon` as a dependency and importing it in your project:
diff --git a/iconify-icon/icon/demo/usage.html b/iconify-icon/icon/demo/usage.html
index 3a37da6..f2f4933 100644
--- a/iconify-icon/icon/demo/usage.html
+++ b/iconify-icon/icon/demo/usage.html
@@ -103,6 +103,16 @@
},
},
});
+
+ setTimeout(() => {
+ const span = document.querySelector('.test-2sec');
+ if (span) {
+ const icon =
+ span.parentElement.querySelector('iconify-icon');
+ span.remove();
+ icon.setAttribute('icon', 'test:icon');
+ }
+ }, 2000);
})();
@@ -322,6 +332,42 @@
mode="style"
>
+
+
Icon with innerHTML
+
+ Keeping innerHTML without icon attribute:
+
+
+
+