Last active
December 16, 2015 21:50
-
-
Save i-like-robots/5502972 to your computer and use it in GitHub Desktop.
Handy drop-in module for CSS feature detection.
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
define(function() { | |
/** | |
* CSS feature detection | |
* @param {String} property | |
* @returns {String} | |
*/ | |
return function(property) { | |
var i, len, prop; | |
var support = ''; | |
var prefixes = ['ms', 'moz', 'webkit']; | |
var temp = document.createElement('div'); | |
prop = property.toLowerCase(); | |
if (prop in temp.style) { | |
support = prop; | |
} | |
else { | |
for (i = 0, len = prefixes.length; i < len; i++) { | |
prop = prefixes[i] + property; | |
if (prop in temp.style) { | |
support = prop; | |
break; | |
} | |
} | |
} | |
return support; | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment