@percy/dom 1.27.4-beta.2 → 1.27.4-beta.3
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/README.md +2 -1
- package/dist/bundle.js +14 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -37,7 +37,8 @@ const domSnapshot = await page.evaluate(() => PercyDOM.serialize(options))
|
|
|
37
37
|
|
|
38
38
|
- `enableJavaScript` — When true, does not serialize some DOM elements
|
|
39
39
|
- `domTransformation` — Function to transform the DOM after serialization
|
|
40
|
-
- `disableShadowDOM` — disable shadow DOM capturing,
|
|
40
|
+
- `disableShadowDOM` — disable shadow DOM capturing, usually to be used when `enableJavascript: true`
|
|
41
|
+
- `reshuffleInvalidTags` — moves DOM tags which are outside `</body>` to its inside to make the DOM compliant.
|
|
41
42
|
|
|
42
43
|
## Serialized Content
|
|
43
44
|
|
package/dist/bundle.js
CHANGED
|
@@ -541,13 +541,15 @@
|
|
|
541
541
|
enableJavaScript = options === null || options === void 0 ? void 0 : options.enable_javascript,
|
|
542
542
|
domTransformation = options === null || options === void 0 ? void 0 : options.dom_transformation,
|
|
543
543
|
stringifyResponse = options === null || options === void 0 ? void 0 : options.stringify_response,
|
|
544
|
-
disableShadowDOM = options === null || options === void 0 ? void 0 : options.disable_shadow_dom
|
|
544
|
+
disableShadowDOM = options === null || options === void 0 ? void 0 : options.disable_shadow_dom,
|
|
545
|
+
reshuffleInvalidTags = options === null || options === void 0 ? void 0 : options.reshuffle_invalid_tags
|
|
545
546
|
} = options || {};
|
|
546
547
|
|
|
547
548
|
// keep certain records throughout serialization
|
|
548
549
|
let ctx = {
|
|
549
550
|
resources: new Set(),
|
|
550
551
|
warnings: new Set(),
|
|
552
|
+
hints: new Set(),
|
|
551
553
|
cache: new Map(),
|
|
552
554
|
enableJavaScript,
|
|
553
555
|
disableShadowDOM
|
|
@@ -569,10 +571,20 @@
|
|
|
569
571
|
if (!disableShadowDOM) {
|
|
570
572
|
injectDeclarativeShadowDOMPolyfill(ctx);
|
|
571
573
|
}
|
|
574
|
+
if (reshuffleInvalidTags) {
|
|
575
|
+
let clonedBody = ctx.clone.body;
|
|
576
|
+
while (clonedBody.nextSibling) {
|
|
577
|
+
let sibling = clonedBody.nextSibling;
|
|
578
|
+
clonedBody.append(sibling);
|
|
579
|
+
}
|
|
580
|
+
} else if (ctx.clone.body.nextSibling) {
|
|
581
|
+
ctx.hints.add('DOM elements found outside </body>');
|
|
582
|
+
}
|
|
572
583
|
let result = {
|
|
573
584
|
html: serializeHTML(ctx),
|
|
574
585
|
warnings: Array.from(ctx.warnings),
|
|
575
|
-
resources: Array.from(ctx.resources)
|
|
586
|
+
resources: Array.from(ctx.resources),
|
|
587
|
+
hints: Array.from(ctx.hints)
|
|
576
588
|
};
|
|
577
589
|
return stringifyResponse ? JSON.stringify(result) : result;
|
|
578
590
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/dom",
|
|
3
|
-
"version": "1.27.4-beta.
|
|
3
|
+
"version": "1.27.4-beta.3",
|
|
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": "e560f5df1637d30722f8d1d7e6eae9cf99ede2dd"
|
|
39
39
|
}
|