@percy/dom 1.30.9-beta.0 → 1.30.9-beta.2

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 +14 -2
  2. package/package.json +2 -2
package/dist/bundle.js CHANGED
@@ -314,9 +314,21 @@
314
314
  /* istanbul ignore next: tested, but coverage is stripped */
315
315
  if (clone.constructor.name === 'HTMLDocument' || clone.constructor.name === 'DocumentFragment') {
316
316
  // handle document and iframe
317
- clone.body.prepend(styleLink);
317
+ // We are checking if we have multiple stylesheets present for the same clone or clone.body then we add
318
+ // them in the same order in which we receive them.
319
+ const lastLink = clone.body.querySelector('link[data-percy-adopted-stylesheets-serialized]:last-of-type');
320
+ if (lastLink) {
321
+ lastLink.after(styleLink);
322
+ } else {
323
+ clone.body.prepend(styleLink);
324
+ }
318
325
  } else if (clone.constructor.name === 'ShadowRoot') {
319
- clone.prepend(styleLink);
326
+ const lastLink = clone.querySelector('link[data-percy-adopted-stylesheets-serialized]:last-of-type');
327
+ if (lastLink) {
328
+ lastLink.after(styleLink);
329
+ } else {
330
+ clone.prepend(styleLink);
331
+ }
320
332
  }
321
333
  }
322
334
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/dom",
3
- "version": "1.30.9-beta.0",
3
+ "version": "1.30.9-beta.2",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,5 +35,5 @@
35
35
  "devDependencies": {
36
36
  "interactor.js": "^2.0.0-beta.10"
37
37
  },
38
- "gitHead": "5068eefe44f4ea22427d80e538b76603fc2f5f6b"
38
+ "gitHead": "13493f9b47d1c7bc9e6f86a1499970012e4e169a"
39
39
  }