add ui-icon className.

This commit is contained in:
Chen Lily 2024-06-11 14:52:26 +08:00
parent d296dd01fd
commit 1a7aa1ab66
Signed by: tsanie
GPG Key ID: DA27B68C1D10203C

View File

@ -26,6 +26,7 @@ export function changeIcon(svg, type, id) {
export function createIcon(type, id, style) {
const svg = document.createElementNS(svgns, 'svg');
svg.classList.add('ui-icon');
svg.appendChild(createUse(type, id));
if (style != null) {
for (let css of Object.entries(style)) {
@ -38,6 +39,7 @@ export function createIcon(type, id, style) {
export function resolveIcon(container) {
const svgs = container.querySelectorAll('svg[data-id]');
for (let icon of svgs) {
icon.classList.add('ui-icon');
const type = icon.dataset.type;
const id = icon.dataset.id;
icon.replaceChildren(createUse(type, id));