Skip to content

Instantly share code, notes, and snippets.

@rageandqq
Created March 25, 2015 14:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rageandqq/793c9243e3dbf323090b to your computer and use it in GitHub Desktop.
Save rageandqq/793c9243e3dbf323090b to your computer and use it in GitHub Desktop.
Check if a browser supports a specific CSS property
//Taken from SpinKit (https://github.com/tobiasahlin/SpinKit)
function browserSupportsCSSProperty(propertyName) {
var elm = document.createElement('div');
propertyName = propertyName.toLowerCase();
if (elm.style[propertyName] != undefined)
return true;
var propertyNameCapital = propertyName.charAt(0).toUpperCase() + propertyName.substr(1),
domPrefixes = 'Webkit Moz ms O'.split(' ');
for (var i = 0; i < domPrefixes.length; i++) {
if (elm.style[domPrefixes[i] + propertyNameCapital] != undefined)
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment