Skip to content

Instantly share code, notes, and snippets.

@Akurganow
Created December 5, 2017 11:52
Show Gist options
  • Save Akurganow/0c93486f8e25ce9b4409e604a64b9984 to your computer and use it in GitHub Desktop.
Save Akurganow/0c93486f8e25ce9b4409e604a64b9984 to your computer and use it in GitHub Desktop.
var sp = [].slice.apply(document.querySelectorAll('link[rel=preload][as=style]'))
sp.forEach(function(item) {
item.onload = function() {
item.rel = 'stylesheet'
item.onload = null
}
})
/**
* For browsers that do not support rel=preload
*/
function rs() {
sp.forEach(function(item) {
item.rel = 'stylesheet'
})
window.removeEventListener('load', rs)
}
window.addEventListener('load', rs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment