mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
Merge pull request #37 from gatapia/patch-2
Fix for gradient parsing (when step positions are specified)
This commit is contained in:
commit
753ab77ef6
@ -43,12 +43,16 @@ html2canvas.Generate.Gradient = function(src, bounds) {
|
|||||||
steps.push( color );
|
steps.push( color );
|
||||||
color = '';
|
color = '';
|
||||||
j+=2;
|
j+=2;
|
||||||
} else {
|
} else if (color || isValidColorStartChar(chr)) {
|
||||||
color += chr;
|
color += chr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isValidColorStartChar(c) {
|
||||||
|
return c && /[^0-9%,]/.test(c);
|
||||||
|
}
|
||||||
|
|
||||||
if ( tmp = src.match(/-webkit-linear-gradient\((.*)\)/) ) {
|
if ( tmp = src.match(/-webkit-linear-gradient\((.*)\)/) ) {
|
||||||
|
|
||||||
position = tmp[1].split( ",", 1 )[0];
|
position = tmp[1].split( ",", 1 )[0];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user