html2canvas-pro 2.2.2 → 2.2.3

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.
@@ -310,10 +310,15 @@ const parse = (context, descriptor, style) => {
310
310
  valueCache = new Map();
311
311
  parseCache.set(descriptor, valueCache);
312
312
  }
313
- // Skip caching for image descriptors their parse() has the critical
314
- // side effect of calling context.cache.addImage(url) which must run
315
- // on every render pass (different cache instances per html2canvas call).
316
- const skipCache = descriptor.type === 3 /* PropertyDescriptorParsingType.TYPE_VALUE */ && descriptor.format === 'image';
313
+ // Skip caching for descriptors whose parse() has the critical side effect
314
+ // of calling context.cache.addImage() which must run on every render pass
315
+ // (different cache instances per html2canvas call). Two paths:
316
+ // 1. Per-descriptor skipCache flag (backgroundImage, listStyleImage,
317
+ // borderImageSource — all call image.parse() internally).
318
+ // 2. TYPE_VALUE + format 'image' — the image type descriptor itself,
319
+ // which calls addImage() directly.
320
+ const skipCache = descriptor.skipCache ||
321
+ (descriptor.type === 3 /* PropertyDescriptorParsingType.TYPE_VALUE */ && descriptor.format === 'image');
317
322
  if (!skipCache) {
318
323
  if (valueCache.size >= constants_1.PARSE_CACHE_MAX_PER_DESCRIPTOR) {
319
324
  const oldestKey = valueCache.keys().next().value;
@@ -8,6 +8,7 @@ exports.backgroundImage = {
8
8
  initialValue: 'none',
9
9
  type: 1 /* PropertyDescriptorParsingType.LIST */,
10
10
  prefix: false,
11
+ skipCache: true,
11
12
  parse: (context, tokens) => {
12
13
  if (tokens.length === 0) {
13
14
  return [];
@@ -8,6 +8,7 @@ exports.borderImageSource = {
8
8
  initialValue: 'none',
9
9
  prefix: false,
10
10
  type: 1 /* PropertyDescriptorParsingType.LIST */,
11
+ skipCache: true,
11
12
  parse: (context, tokens) => {
12
13
  if (tokens.length === 0) {
13
14
  return null;
@@ -7,6 +7,7 @@ exports.listStyleImage = {
7
7
  initialValue: 'none',
8
8
  type: 0 /* PropertyDescriptorParsingType.VALUE */,
9
9
  prefix: false,
10
+ skipCache: true,
10
11
  parse: (context, token) => {
11
12
  if (token.type === 20 /* TokenType.IDENT_TOKEN */ && token.value === 'none') {
12
13
  return null;
@@ -13,6 +13,10 @@ export interface IPropertyDescriptor {
13
13
  type: PropertyDescriptorParsingType;
14
14
  initialValue: string;
15
15
  prefix: boolean;
16
+ /** When true, the parse result is never stored in parseCache.
17
+ * Set this for descriptors whose parse() has side effects (e.g.,
18
+ * calling context.cache.addImage) that must run on every render pass. */
19
+ skipCache?: boolean;
16
20
  }
17
21
  export interface IPropertyIdentValueDescriptor<T> extends IPropertyDescriptor {
18
22
  type: PropertyDescriptorParsingType.IDENT_VALUE;
package/package.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "default": "./dist/html2canvas-pro.esm.js"
20
20
  }
21
21
  },
22
- "version": "2.2.2",
22
+ "version": "2.2.3",
23
23
  "author": {
24
24
  "name": "yorickshan",
25
25
  "email": "yorickshan@gmail.com",