Last active
December 23, 2015 11:29
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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