Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Richardinho opened this issue Oct 20, 2017 · 2 comments

Comments

@Richardinho
Copy link

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?

@Keyamoon
Copy link
Owner

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.

@Richardinho
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants