Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elwinschmitz/584de59b5d0d0963e00b23a76b325d91 to your computer and use it in GitHub Desktop.
Save elwinschmitz/584de59b5d0d0963e00b23a76b325d91 to your computer and use it in GitHub Desktop.
(function(){
var stylesheets = document.querySelectorAll('link[rel=stylesheet][href]');
Array.prototype.forEach.call(stylesheets, function (element) {
if (element.media === 'x') {
element.media = element.getAttribute('data-media');
} else {
element.setAttribute('data-media', element.media);
element.media = 'x';
}
});
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment