Skip to content

Instantly share code, notes, and snippets.

@oslego
Last active December 23, 2015 11:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oslego/6628377 to your computer and use it in GitHub Desktop.
Save oslego/6628377 to your computer and use it in GitHub Desktop.
Feather-weight CSS feature detect script that adds class names to the <body> element to signal support.
(function(){
// feather-weight Modernizr-like CSS feature check
['shape-inside','flow-into','shiny-new-feature'].forEach(function(property){
// check if any variant exists, prefixed or not
var isCapable = ['-webkit-','-ms-','-moz-',''].some(function(prefix){
return prefix + property in document.body.style
})
property = isCapable ? property : 'no-' + property;
document.body.classList.add(property)
})
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment