svgxuse icon indicating copy to clipboard operation
svgxuse copied to clipboard

Is it possible to configure this to run on the DOMContentLoaded event?

Open Richardinho opened this issue 7 years ago • 2 comments

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?

Richardinho avatar Oct 20 '17 15:10 Richardinho

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.

Keyamoon avatar Oct 22 '17 14:10 Keyamoon

If the sprite is on a different domain, no browser will support this so I want the polyfill to always be active.

Richardinho avatar Oct 23 '17 14:10 Richardinho