eligrey / classList.js

Cross-browser element.classList
The Unlicense
1.11k stars 233 forks source link

classList.js does not work if loaded after DOMContentLoaded #68

Open tmb-github opened 7 years ago

tmb-github commented 7 years ago

I defer all of my JavaScript until after DOMContentLoaded. The classList.js polyfill is not accessible unless it is loaded at or before document.readyState === "loading". How can this be overcome?

englishextra commented 7 years ago

you can do smth like this at the bottom of the body of your page:

loadJS("./polyfills.js",loadJS("./bundle.js"));

see here

DOMContentLoaded is tricky: see here