是否支持css3

/**
* 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;
}
上一篇:爬虫系列二(数据清洗--->正则表达式)


下一篇:C和指针 第五章 警告总结