检测浏览器是否支持标签的某个属性

例如 IE lt9 不支持 input标签的 placeholder 属性:

1  function placeholder() {
2         return 'placeholder' in document.createElement('input');
3     }

 

扩展:其他元素是否支持 指定的属性:

 function isPropertySupport(property,tagName) {
        return property in document.createElement(tagName);
    }

 

posted @ 2017-06-18 23:04  流舟  阅读(384)  评论(0编辑  收藏  举报