deSVG works by scanning a page's HTML for any SVG image file embedded via a classic <img> tag.
Since few know that you can actually embed SVG graphics via their very own <svg> tag, this library tries to correct this behavior by replacing <img> tags with the "src" pointing at a SVG file with its proper <svg> counterpart.
By using deSVG developers gain access to extra features that aren't normally available to them if embedding SVGs via <img> tag, like styling SVG files via CSS and also accessing their content and manipulating them via JavaScript.
There's a downside to this library as well, deSVG creating duplicate HTTP requests for all the SVG files, so make sure you're using it on pages where there are not that many SVG files that need correcting, or its advantages may be eliminated by a huge page load time.
Requirements:
- JavaScript enabled on client side
Comments not found