From 696a60ee1e572441f071179131593445ddbce60e Mon Sep 17 00:00:00 2001 From: CoolElectronics Date: Sun, 18 Feb 2024 18:43:59 -0500 Subject: [PATCH] svg fix --- js.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js.js b/js.js index d02d31d..1064017 100644 --- a/js.js +++ b/js.js @@ -200,7 +200,8 @@ export function h(type, props, ...children) { } - const elm = document.createElement(type); + let xmlns = props?.xmlns; + const elm = xmlns ? document.createElementNS(xmlns, type) : document.createElement(type); for (const child of children) { JSXAddChild(child, elm.appendChild.bind(elm)); @@ -389,6 +390,10 @@ export function h(type, props, ...children) { } } + // hack to fix svgs + if (xmlns) + elm.innerHTML = elm.innerHTML + return elm; }