Skip to content
Search

SVGInject

lastmod 2021-07-10created 2021-07-104 edits

A tiny, intuitive, and robust caching solution for injecting SVG files inline into the DOM.

In a nutshell

When an SVG file is used in <img>, it lets you control it as an object.

SVG Injection

Element before injection:

<img src="image.svg" onload="SVGInject(this)" />

Element after injection (SVG loaded from image.svg):

<svg version="1.1" ...> ... </svg>

See also

Favorite site

author Zer0 sitemap