Skip to content

Commit

Permalink
Fix detecting unprefixed gradients
Browse files Browse the repository at this point in the history
  • Loading branch information
TRowbotham committed Jul 28, 2015
1 parent 33a3721 commit 121f977
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions feature-detects/css/gradients.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ define(['Modernizr', 'prefixes', 'createElement'], function(Modernizr, prefixes,

var str1 = 'background-image:';
var str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));';
var str3 = 'linear-gradient(left top,#9f9, white);';
var css = '';
var angle;

for (var i = 0, len = prefixes.length - 1; i < len; i++) {
angle = (i == 0 ? 'to ' : '') + 'left top';
css += str1 + prefixes[i] + 'linear-gradient(' + angle + ', #9f9, white);';
}

// standard syntax // trailing 'background-image:'
var css = str1 + prefixes.join(str3 + str1).slice(0, -str1.length);
if (Modernizr._config.usePrefixes) {
// legacy webkit syntax (FIXME: remove when syntax not in use anymore)
css += str1 + '-webkit-' + str2;
Expand Down

0 comments on commit 121f977

Please sign in to comment.