Skip to content

Instantly share code, notes, and snippets.

@simplelife7
Created October 26, 2015 17:58
Show Gist options
  • Save simplelife7/3375d596aaf80bb2ab1b to your computer and use it in GitHub Desktop.
Save simplelife7/3375d596aaf80bb2ab1b to your computer and use it in GitHub Desktop.
【JS】检测是否支持CSS3属性
var _isSupport = function(prop){
var div = document.createElement('div'),
vendors = 'Khtml O Moz Webkit'.split(' '),
len = vendors.length;
if ( prop in div.style ) return true;
if ('-ms-' + prop in div.style) return true;
prop = prop.replace(/^[a-z]/, function(val) {
return val.toUpperCase();
});
while(len--) {
if ( vendors[len] + prop in div.style ) {
return true;
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment