Skip to content

Commit aa05241

Browse files
committed
Fix gradient tests
1 parent 5b4a6c2 commit aa05241

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

dist/html2canvas.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2412,7 +2412,7 @@ module.exports = ImageLoader;
24122412
var GradientContainer = require('./gradientcontainer');
24132413
var Color = require('./color');
24142414

2415-
var COLOR_STOP_REGEXP = /^(.*)\s*(\d{1,3})?(%|px)?$/;
2415+
var COLOR_STOP_REGEXP = /^\s*(.*)\s*(\d{1,3})?(%|px)?$/;
24162416

24172417
function LinearGradientContainer(imageData) {
24182418
GradientContainer.apply(this, arguments);
@@ -2454,7 +2454,6 @@ function LinearGradientContainer(imageData) {
24542454
this.y1 = 1;
24552455
}
24562456

2457-
24582457
this.colorStops = imageData.args.slice(hasDirection ? 1 : 0)
24592458
.map(function(colorStop) { return colorStop.match(COLOR_STOP_REGEXP);})
24602459
.filter(function(colorStopMatch) { return !!colorStopMatch;})

dist/html2canvas.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lineargradientcontainer.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var GradientContainer = require('./gradientcontainer');
22
var Color = require('./color');
33

4-
var COLOR_STOP_REGEXP = /^(.*)\s*(\d{1,3})?(%|px)?$/;
4+
var COLOR_STOP_REGEXP = /^\s*(.*)\s*(\d{1,3})?(%|px)?$/;
55

66
function LinearGradientContainer(imageData) {
77
GradientContainer.apply(this, arguments);
@@ -43,7 +43,6 @@ function LinearGradientContainer(imageData) {
4343
this.y1 = 1;
4444
}
4545

46-
4746
this.colorStops = imageData.args.slice(hasDirection ? 1 : 0)
4847
.map(function(colorStop) { return colorStop.match(COLOR_STOP_REGEXP);})
4948
.filter(function(colorStopMatch) { return !!colorStopMatch;})

tests/mocha/parsing.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
}
111111

112112
.linearGradient4 {
113+
background: -webkit-linear-gradient(0deg, #ddd, #ddd 50%, transparent 50%);
113114
background: linear-gradient(0deg, #ddd, #ddd 50%, transparent 50%);
114115
}
115116

0 commit comments

Comments
 (0)