diff --git a/src/utils/bx-icon.ts b/src/utils/bx-icon.ts index 3c517be..302f368 100644 --- a/src/utils/bx-icon.ts +++ b/src/utils/bx-icon.ts @@ -1,3 +1,4 @@ +// Credit: https://phosphoricons.com import iconBetterXcloud from "@assets/svg/better-xcloud.svg" with { type: "text" }; import iconTrueAchievements from "@assets/svg/true-achievements.svg" with { type: "text" }; import iconClose from "@assets/svg/close.svg" with { type: "text" }; diff --git a/src/utils/html.ts b/src/utils/html.ts index 7b4ef8f..9840446 100644 --- a/src/utils/html.ts +++ b/src/utils/html.ts @@ -101,16 +101,14 @@ function createElement(elmName: string, props: CreateElementOptio export const CE = createElement; -// Credit: https://phosphoricons.com -const svgParser = (svg: string) => new DOMParser().parseFromString(svg, 'image/svg+xml').documentElement; - -export const createSvgIcon = (icon: typeof BxIcon) => { - return svgParser(icon.toString()); +const domParser = new DOMParser(); +export function createSvgIcon(icon: typeof BxIcon) { + return domParser.parseFromString(icon.toString(), 'image/svg+xml').documentElement; } const ButtonStyleIndices = Object.keys(ButtonStyleClass).map(i => parseInt(i)); -export const createButton = (options: BxButton): T => { +export function createButton(options: BxButton): T { let $btn; if (options.url) { $btn = CE('a', {'class': 'bx-button'}) as HTMLAnchorElement;