Skip to content

Instantly share code, notes, and snippets.

@droidScriptKiddy
Forked from rageandqq/css-property-check.js
Created September 15, 2019 01:54
Show Gist options
  • Save droidScriptKiddy/fae38e9091c4c60f81d96ab68ad0be8d to your computer and use it in GitHub Desktop.
Save droidScriptKiddy/fae38e9091c4c60f81d96ab68ad0be8d 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