您的位置:首页 > Web前端 > CSS

是否支持css3

2016-05-26 14:04 453 查看
/**
* Function to check css3 support
* @param  {String}  declaration name
* @return {Boolean}
*/
function isCssSupported(declaration) {
var supported = false,
prefixes = 'Khtml ms O Moz Webkit'.split(' '),
clone = document.createElement('div'),
declarationCapital = null;

declaration = declaration.toLowerCase();
if (clone.style[declaration] !== undefined) supported = true;
if (supported === false) {
declarationCapital = declaration.charAt(0).toUpperCase() + declaration.substr(1);
for( var i = 0; i < prefixes.length; i++ ) {
if( clone.style[prefixes[i] + declarationCapital ] !== undefined ) {
supported = true;
break;
}
}
}

if (window.opera) {
if (window.opera.version() < 13) supported = false;
}

return supported;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: