Skip to content

Commit 2d39cd0

Browse files
committed
fix shadow parsing for IE9
1 parent ebd7828 commit 2d39cd0

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

src/Core.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ _html2canvas.Util.trimText = (function(isNative){
2121
})( String.prototype.trim );
2222

2323
(function() {
24-
2524
// TODO: support all possible length values
2625
var TEXT_SHADOW_PROPERTY = /((rgba|rgb)\([^\)]+\)(\s-?\d+px){0,})/g;
2726
var TEXT_SHADOW_VALUES = /(-?\d+px)|(#.+)|(rgb\(.+\))|(rgba\(.+\))/g;
2827
_html2canvas.Util.parseTextShadows = function (value) {
29-
if (value === 'none') {
28+
if (!value || value === 'none') {
3029
return [];
3130
}
3231

src/Parse.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ _html2canvas.Parse = function (images, options) {
8080
bold = getCSS(el, "fontWeight"),
8181
family = getCSS(el, "fontFamily"),
8282
size = getCSS(el, "fontSize"),
83-
shadow = getCSS(el, "textShadow");
83+
shadows = _html2canvas.Util.parseTextShadows(getCSS(el, "textShadow"));
8484

8585
switch(parseInt(bold, 10)){
8686
case 401:
@@ -95,9 +95,7 @@ _html2canvas.Parse = function (images, options) {
9595
ctx.setVariable("font", [getCSS(el, "fontStyle"), getCSS(el, "fontVariant"), bold, size, family].join(" "));
9696
ctx.setVariable("textAlign", (align) ? "right" : "left");
9797

98-
if (shadow !== "none") {
99-
var shadows = _html2canvas.Util.parseTextShadows(shadow);
100-
98+
if (shadows.length) {
10199
// TODO: support multiple text shadows
102100
// apply the first text shadow
103101
ctx.setVariable("shadowColor", shadows[0].color);

0 commit comments

Comments
 (0)