Skip to content

Instantly share code, notes, and snippets.

@yy-dev7
Created March 20, 2017 11:04
Show Gist options
  • Save yy-dev7/38af3ea8476d0779a0baa7ce8c23d75b to your computer and use it in GitHub Desktop.
Save yy-dev7/38af3ea8476d0779a0baa7ce8c23d75b to your computer and use it in GitHub Desktop.
cssSupported
/**
* 检测浏览器是否支持某个css属性
* @param {[String]} prop [属性名]
* @param {[String]} value [属性值]
* @return {[Boolean]} true:支持 否则不支持
*/
function cssSupported(prop, value) {
const d = document.createElement('div')
d.style[prop] = value
return d.style[prop] === value
}
export default cssSupported
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment