判断浏览器是否支持指定CSS属性和指定值

/**
 * @param attrName 属性名
 * @param attrVal  属性值
 * @returns {boolean}
 */
function isCssAttrSupported(attrName, attrVal){
        var ele = document.createElement('div');
        if(attrName in ele.style){
            ele.style[attrName] = attrVal;
            return ele.style[attrName] === attrVal;
        }
        else{
            return false;
        }
    }
posted @ 2016-05-25 15:53  HeiYe168  阅读(154)  评论(0编辑  收藏  举报