Created
February 2, 2011 13:43
-
-
Save petersendidit/807683 to your computer and use it in GitHub Desktop.
Modernizr test for linear-gradient() support
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
/* | |
Modernizr already has a test for cssgradients but it checks the old webkit syntax | |
In order to do px points we need linear-gradient() | |
Webkit did not have suport for linear-gradient() until Jan 2011 | |
http://webkit.org/blog/1424/css3-gradients/ | |
So here is a test to check for it. | |
*/ | |
Modernizr.addTest('lineargradient', function () { | |
var test = document.createElement('div'), | |
prefixes = ' -webkit- -moz- -o- -ms- -khtml- '.split(' '), | |
str1 = 'background-image:', | |
str2 = 'linear-gradient(left top,#9f9, white);'; | |
test.style.cssText = (str1 + prefixes.join(str2 + str1)).slice(0,-str1.length); | |
return ((''+test.style.backgroundImage).indexOf( 'linear-gradient' ) !== -1); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment