html2canvas-pro 2.3.3 → 2.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -258,7 +258,14 @@ class CSSParsedCounterDeclaration {
258
258
  exports.CSSParsedCounterDeclaration = CSSParsedCounterDeclaration;
259
259
  const parseCache = new Map();
260
260
  const parse = (context, descriptor, style) => {
261
- const rawValue = style !== null && typeof style !== 'undefined' ? style.toString() : descriptor.initialValue;
261
+ let rawValue = style !== null && typeof style !== 'undefined' ? style.toString() : descriptor.initialValue;
262
+ // A whitespace-only (or empty) computed value makes the tokenizer emit only an
263
+ // EOF token, which parseComponentValue() turns into a "unexpected EOF" SyntaxError.
264
+ // Some browsers produce such values for web-component shadow styles (see #225);
265
+ // fall back to the descriptor's initialValue so capture never crashes on them.
266
+ if (rawValue.trim() === '') {
267
+ rawValue = descriptor.initialValue;
268
+ }
262
269
  let valueCache = parseCache.get(descriptor);
263
270
  if (valueCache) {
264
271
  const cached = valueCache.get(rawValue);
@@ -112,11 +112,12 @@ const parseFunctionArgs = (tokens) => {
112
112
  let arg = [];
113
113
  tokens.forEach((token) => {
114
114
  if (token.type === 4 /* TokenType.COMMA_TOKEN */) {
115
- if (arg.length === 0) {
116
- throw new Error(`Error parsing function args, zero tokens for arg`);
115
+ // Skip empty arguments (e.g. "1px,,2px") instead of throwing —
116
+ // real-world computed styles can produce them.
117
+ if (arg.length) {
118
+ args.push(arg);
119
+ arg = [];
117
120
  }
118
- args.push(arg);
119
- arg = [];
120
121
  return;
121
122
  }
122
123
  if (token.type !== 31 /* TokenType.WHITESPACE_TOKEN */) {
package/package.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "default": "./dist/html2canvas-pro.esm.js"
20
20
  }
21
21
  },
22
- "version": "2.3.3",
22
+ "version": "2.3.4",
23
23
  "author": {
24
24
  "name": "yorickshan",
25
25
  "email": "yorickshan@gmail.com",