adjustment
This commit is contained in:
@ -9,14 +9,14 @@ function createUse(type, id) {
|
||||
return use;
|
||||
}
|
||||
|
||||
function changeIcon(svg, type, id) {
|
||||
export function changeIcon(svg, type, id) {
|
||||
if (svg instanceof SVGElement) {
|
||||
svg.replaceChildren(createUse(type, id));
|
||||
}
|
||||
return svg;
|
||||
}
|
||||
|
||||
function createIcon(type, id, style) {
|
||||
export function createIcon(type, id, style) {
|
||||
const svg = document.createElementNS(svgns, 'svg');
|
||||
svg.appendChild(createUse(type, id));
|
||||
if (style != null) {
|
||||
@ -27,7 +27,7 @@ function createIcon(type, id, style) {
|
||||
return svg;
|
||||
}
|
||||
|
||||
function resolveIcon(container) {
|
||||
export function resolveIcon(container) {
|
||||
const svgs = container.querySelectorAll('svg[data-id]');
|
||||
for (let icon of svgs) {
|
||||
const type = icon.dataset.type;
|
||||
@ -37,10 +37,4 @@ function resolveIcon(container) {
|
||||
icon.removeAttribute('data-id');
|
||||
}
|
||||
return container;
|
||||
}
|
||||
|
||||
export {
|
||||
createIcon,
|
||||
changeIcon,
|
||||
resolveIcon
|
||||
}
|
Reference in New Issue
Block a user