This commit is contained in:
CoolElectronics 2024-02-18 18:43:59 -05:00
parent 2dcae6ad11
commit 696a60ee1e
No known key found for this signature in database
GPG key ID: F63593D168636C50

7
js.js
View file

@ -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) { for (const child of children) {
JSXAddChild(child, elm.appendChild.bind(elm)); 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; return elm;
} }