@percy/dom 1.31.4 → 1.31.5-beta.0

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.
Files changed (2) hide show
  1. package/dist/bundle.js +5 -3
  2. package/package.json +3 -3
package/dist/bundle.js CHANGED
@@ -374,9 +374,11 @@
374
374
  img.setAttribute('data-percy-canvas-serialized', '');
375
375
  img.setAttribute('data-percy-serialized-attribute-src', imageUrl);
376
376
 
377
- // set the maxWidth only if it was set on the canvas
378
- if (canvas.style.maxWidth) {
379
- img.style.maxWidth = canvas.style.maxWidth;
377
+ // set a default max width to account for canvases that might resize with JS
378
+ // Check if width is "static" (fixed pixels) vs "dynamic" (%, vw, etc.)
379
+ const hasStaticWidth = canvas.style.width && canvas.style.width.match(/^\d+px$/);
380
+ if (!hasStaticWidth) {
381
+ img.style.maxWidth = img.style.maxWidth || '100%';
380
382
  }
381
383
 
382
384
  // insert the image into the cloned DOM and remove the cloned canvas element
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/dom",
3
- "version": "1.31.4",
3
+ "version": "1.31.5-beta.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "publishConfig": {
11
11
  "access": "public",
12
- "tag": "latest"
12
+ "tag": "beta"
13
13
  },
14
14
  "main": "dist/bundle.js",
15
15
  "browser": "dist/bundle.js",
@@ -35,5 +35,5 @@
35
35
  "devDependencies": {
36
36
  "interactor.js": "^2.0.0-beta.10"
37
37
  },
38
- "gitHead": "ae9af7043b17186a26e4b8c584faa45559260f9e"
38
+ "gitHead": "06352b66b8e5ebb2281e1111d71b3972a6713ed3"
39
39
  }