treycordova / nativejsx

JSX to native DOM API transpilation. :yellow_heart: <div> ⟹ document.createElement('div')!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SVG support

fregante opened this issue · comments

Input

const check = <svg><iframe></iframe></svg>;

Output

const check = function () {
    var $$a = document.createElement('svg');
    var $$b = document.createElement('iframe');
    $$a.appendChild($$b);
    return $$a;
}.call(this);

Expected

const check = function () {
    var $$a = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
    var $$b = document.createElementNS('http://www.w3.org/2000/svg', 'iframe');
    $$a.appendChild($$b);
    return $$a;
}.call(this);

This is definitely something I want to get to. It's been on my https://github.com/treycordova/nativejsx#wish-list for ages. If someone finds the bandwidth, I'd love a PR.