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.
- package/dist/html2canvas-pro.esm.js +5 -2
- package/dist/html2canvas-pro.esm.js.map +1 -1
- package/dist/html2canvas-pro.js +5 -2
- package/dist/html2canvas-pro.js.map +1 -1
- package/dist/html2canvas-pro.min.js +2 -2
- package/dist/lib/css/index.js +9 -4
- package/dist/lib/css/property-descriptors/background-image.js +1 -0
- package/dist/lib/css/property-descriptors/border-image-source.js +1 -0
- package/dist/lib/css/property-descriptors/list-style-image.js +1 -0
- package/dist/types/css/property-descriptor.d.ts +4 -0
- package/package.json +1 -1
package/dist/lib/css/index.js
CHANGED
|
@@ -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
|
|
314
|
-
//
|
|
315
|
-
//
|
|
316
|
-
|
|
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;
|
|
@@ -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;
|