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; }