JSFiddle - React, Tailwind, and code Playground

by prozoroff

JavaScript

// Create a detached SVG element with a text node containing a non-breaking space.
var svgDoc = new DOMParser().parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><text>\u00a0</text></svg>', 'text/xml')
var svgRoot = svgDoc.removeChild(svgDoc.firstChild);
console.log(new XMLSerializer().serializeToString(svgRoot));

// Attach to the main document.
document.body.appendChild(svgRoot);
console.log(new XMLSerializer().serializeToString(svgRoot));