@percy/dom 1.26.3-beta.0 → 1.26.3-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.
- package/dist/bundle.js +24 -18
- package/package.json +2 -2
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
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
clone.
|
|
259
|
-
|
|
260
|
-
|
|
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.3-beta.
|
|
3
|
+
"version": "1.26.3-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": "
|
|
38
|
+
"gitHead": "5e402f5ff469cc521506fef6a347e04a1a2e1434"
|
|
39
39
|
}
|