Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Checking old webkit syntax
/*
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