@percy/dom 1.26.2 → 1.26.3-beta.1

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 +24 -18
  2. package/package.json +3 -3
package/dist/bundle.js CHANGED
@@ -205,7 +205,8 @@
205
205
  dom,
206
206
  clone,
207
207
  resources,
208
- cache
208
+ cache,
209
+ warnings
209
210
  } = _ref;
210
211
  // in-memory CSSOM into their respective DOM nodes.
211
212
  for (let styleSheet of dom.styleSheets) {
@@ -241,24 +242,29 @@
241
242
 
242
243
  // clone Adopted Stylesheets
243
244
  // Regarding ordering of the adopted stylesheets - https://github.com/WICG/construct-stylesheets/issues/93
244
- for (let sheet of dom.adoptedStyleSheets) {
245
- const styleLink = document.createElement('link');
246
- styleLink.setAttribute('rel', 'stylesheet');
247
- if (!cache.has(sheet)) {
248
- let resource = createStyleResource(sheet);
249
- resources.add(resource);
250
- cache.set(sheet, resource.url);
251
- }
252
- styleLink.setAttribute('data-percy-adopted-stylesheets-serialized', 'true');
253
- styleLink.setAttribute('data-percy-serialized-attribute-href', cache.get(sheet));
254
-
255
- /* istanbul ignore next: tested, but coverage is stripped */
256
- if (clone.constructor.name === 'HTMLDocument' || clone.constructor.name === 'DocumentFragment') {
257
- // handle document and iframe
258
- clone.body.prepend(styleLink);
259
- } else if (clone.constructor.name === 'ShadowRoot') {
260
- clone.prepend(styleLink);
245
+ /* istanbul ignore next: tested, but coverage is stripped */
246
+ if (dom.adoptedStyleSheets) {
247
+ for (let sheet of dom.adoptedStyleSheets) {
248
+ const styleLink = document.createElement('link');
249
+ styleLink.setAttribute('rel', 'stylesheet');
250
+ if (!cache.has(sheet)) {
251
+ let resource = createStyleResource(sheet);
252
+ resources.add(resource);
253
+ cache.set(sheet, resource.url);
254
+ }
255
+ styleLink.setAttribute('data-percy-adopted-stylesheets-serialized', 'true');
256
+ styleLink.setAttribute('data-percy-serialized-attribute-href', cache.get(sheet));
257
+
258
+ /* istanbul ignore next: tested, but coverage is stripped */
259
+ if (clone.constructor.name === 'HTMLDocument' || clone.constructor.name === 'DocumentFragment') {
260
+ // handle document and iframe
261
+ clone.body.prepend(styleLink);
262
+ } else if (clone.constructor.name === 'ShadowRoot') {
263
+ clone.prepend(styleLink);
264
+ }
261
265
  }
266
+ } else {
267
+ warnings.add('Skipping `adoptedStyleSheets` as it is not supported.');
262
268
  }
263
269
  }
264
270
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/dom",
3
- "version": "1.26.2",
3
+ "version": "1.26.3-beta.1",
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": "f97b6c463109420a4045dc0396bf9d429c2dc77d"
38
+ "gitHead": "6571d4ad016bc8b3b32d49bf8a7da1393c1a5eba"
39
39
  }