svgxuse
svgxuse copied to clipboard
Is it possible to configure this to run on the DOMContentLoaded event?
Currently the code runs when the load event is fired (or if it has already fired). This means that you don't get your icons until all images, stylesheets, and annoying adverts have all loaded. My experiments show that my page works when svgxuse runs on DOMContentLoaded event instead. Would it be possible to make this configurable?
Or is there a reason why svgxuse must run on the load event?
The DOMContentLoaded
event doesn't wait for images, CSS, etc. to finish loading. So if you run svgxuse on DOMContentLoaded, it will fetch the referenced SVG files and prepend them to body
even when the browser itself supports referencing external SVGs.
If the sprite is on a different domain, no browser will support this so I want the polyfill to always be active.