Created
July 25, 2016 16:20
-
-
Save benjeffery/a46dde724c280e3e9edfd50b85d954e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function chooseMode(jsProps, cssProps) { | |
if (cssProps.length == 0 && jsProps.length == 0) // IE <10, other early browser, no method works there. In Opera CSS works though | |
return bowser.opera ? 'css' : 'warning'; | |
if (cssProps.length == 0 && jsProps.length > 0) // IE >10 even EDGE... sigh | |
return 'js'; | |
if (cssProps.length == 1 && cssProps[0] == 'optimiseSpeed' && jsProps.length == 0) //A few earlier browsers report this prop, but it only works for images | |
return 'warning'; | |
if (_.includes(cssProps, '-webkit-optimize-contrast') || _.includes(cssProps, '-moz-crisp-edges') || _.includes(cssProps, 'crisp-edges') || _.includes(cssProps, 'pixelated')) { | |
if (!bowser.check({chrome: "41"})) //Earlier chromes only support css on IMG | |
return 'js'; | |
return 'css'; | |
} | |
return 'warning'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment