JSFiddle - React, Tailwind, and code Playground
JavaScript
// var html = '<svg:svg width="100%" height="400px" id="test" version="1.1" baseProfile="full" />';
// var html = '<object data="rect2.svg" width="100%" height="400px" type="image/svg+xml"></object>';
var canvas = document.createElement("svg:svg");
canvas.setAttribute("id", "svg1");
canvas.setAttribute("width", "100%");
canvas.setAttribute("height", "400px");
canvas.setAttribute("version", "1.1");
canvas.setAttribute("baseProfile", "full");
var group = canvas.getSVGDocument().createElementNS("http://www.w3.org/2000/svg", "svg");