Source code
Revision control
Copy as Markdown
Other Tools
<!doctype html>
<meta charset=utf-8>
<link rel=match href="content-visibility-auto-svg-image-ref.html">
<body>
<script>
const svg = `
<foreignObject width="100%" height="100%">
<div style="width: 50px; height: 50px; background: cyan;
border: 5px solid blue"></div>
</div>
</foreignObject>
</svg>`;
const data = `data:image/svg+xml,${encodeURIComponent(svg)}`;
const svgImage = new Image();
svgImage.src = data;
document.body.appendChild(svgImage);
</script>
</body>