@percy/dom 1.28.7 → 1.28.8-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.
- package/dist/bundle.js +36 -27
- package/package.json +3 -3
package/dist/bundle.js
CHANGED
|
@@ -220,33 +220,42 @@
|
|
|
220
220
|
warnings
|
|
221
221
|
} = _ref;
|
|
222
222
|
// in-memory CSSOM into their respective DOM nodes.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
223
|
+
let styleSheets = null;
|
|
224
|
+
// catch error in case styleSheets property is not available (overwritten to throw error)
|
|
225
|
+
try {
|
|
226
|
+
styleSheets = dom.styleSheets;
|
|
227
|
+
} catch {
|
|
228
|
+
warnings.add('Skipping `styleSheets` as it is not supported.');
|
|
229
|
+
}
|
|
230
|
+
if (styleSheets) {
|
|
231
|
+
for (let styleSheet of styleSheets) {
|
|
232
|
+
var _styleSheet$href;
|
|
233
|
+
if (isCSSOM(styleSheet)) {
|
|
234
|
+
let styleId = styleSheet.ownerNode.getAttribute('data-percy-element-id');
|
|
235
|
+
let cloneOwnerNode = clone.querySelector(`[data-percy-element-id="${styleId}"]`);
|
|
236
|
+
if (styleSheetsMatch(styleSheet, styleSheetFromNode(cloneOwnerNode))) continue;
|
|
237
|
+
let style = document.createElement('style');
|
|
238
|
+
style.type = 'text/css';
|
|
239
|
+
style.setAttribute('data-percy-element-id', styleId);
|
|
240
|
+
style.setAttribute('data-percy-cssom-serialized', 'true');
|
|
241
|
+
style.innerHTML = Array.from(styleSheet.cssRules).map(cssRule => cssRule.cssText).join('\n');
|
|
242
|
+
cloneOwnerNode.parentNode.insertBefore(style, cloneOwnerNode.nextSibling);
|
|
243
|
+
cloneOwnerNode.remove();
|
|
244
|
+
} else if ((_styleSheet$href = styleSheet.href) !== null && _styleSheet$href !== void 0 && _styleSheet$href.startsWith('blob:')) {
|
|
245
|
+
const styleLink = document.createElement('link');
|
|
246
|
+
styleLink.setAttribute('rel', 'stylesheet');
|
|
247
|
+
let resource = createStyleResource(styleSheet);
|
|
248
|
+
resources.add(resource);
|
|
249
|
+
styleLink.setAttribute('data-percy-blob-stylesheets-serialized', 'true');
|
|
250
|
+
styleLink.setAttribute('data-percy-serialized-attribute-href', resource.url);
|
|
251
|
+
|
|
252
|
+
/* istanbul ignore next: tested, but coverage is stripped */
|
|
253
|
+
if (clone.constructor.name === 'HTMLDocument' || clone.constructor.name === 'DocumentFragment') {
|
|
254
|
+
// handle document and iframe
|
|
255
|
+
clone.body.prepend(styleLink);
|
|
256
|
+
} else if (clone.constructor.name === 'ShadowRoot') {
|
|
257
|
+
clone.prepend(styleLink);
|
|
258
|
+
}
|
|
250
259
|
}
|
|
251
260
|
}
|
|
252
261
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/dom",
|
|
3
|
-
"version": "1.28.
|
|
3
|
+
"version": "1.28.8-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": "
|
|
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": "
|
|
38
|
+
"gitHead": "d31a9746c7be6d74db284b8f30c3248d2bba916e"
|
|
39
39
|
}
|