Skip to content

Instantly share code, notes, and snippets.

@matijs
Last active December 17, 2015 14:19
Show Gist options
  • Save matijs/5623592 to your computer and use it in GitHub Desktop.
Save matijs/5623592 to your computer and use it in GitHub Desktop.
Generated content feature detection
(function() {
var div = document.createElement("div");
var style = document.createElement("style");
div.id = "d";
style.innerHTML = "#d{position:absolute;left:-999px}#d:before{content:'x';}";
document.documentElement.appendChild(div);
document.documentElement.appendChild(style);
if (div.clientWidth > 0)
document.documentElement.className += " generated-content";
document.documentElement.removeChild(div);
document.documentElement.removeChild(style);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment