@percy/dom 1.31.11-beta.1 → 1.31.12-beta.0
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 -3
- package/package.json +2 -2
package/dist/bundle.js
CHANGED
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
function markElement(domElement, disableShadowDOM, forceShadowAsLightDOM) {
|
|
229
229
|
var _domElement$tagName;
|
|
230
230
|
// Mark elements that are to be serialized later with a data attribute.
|
|
231
|
-
if (['input', 'textarea', 'select', 'iframe', 'canvas', 'video', 'style'].includes((_domElement$tagName = domElement.tagName) === null || _domElement$tagName === void 0 ? void 0 : _domElement$tagName.toLowerCase())) {
|
|
231
|
+
if (['input', 'textarea', 'select', 'iframe', 'canvas', 'video', 'style', 'dialog'].includes((_domElement$tagName = domElement.tagName) === null || _domElement$tagName === void 0 ? void 0 : _domElement$tagName.toLowerCase())) {
|
|
232
232
|
if (!domElement.getAttribute('data-percy-element-id')) {
|
|
233
233
|
domElement.setAttribute('data-percy-element-id', uid());
|
|
234
234
|
}
|
|
@@ -578,8 +578,8 @@
|
|
|
578
578
|
}
|
|
579
579
|
}
|
|
580
580
|
}
|
|
581
|
-
if (config.
|
|
582
|
-
for (const selector of config.
|
|
581
|
+
if (config.selectors && Array.isArray(config.selectors)) {
|
|
582
|
+
for (const selector of config.selectors) {
|
|
583
583
|
try {
|
|
584
584
|
const matched = Array.from(dom.querySelectorAll(selector));
|
|
585
585
|
if (!matched.length) {
|
|
@@ -670,6 +670,38 @@
|
|
|
670
670
|
}
|
|
671
671
|
}
|
|
672
672
|
|
|
673
|
+
// Serializes open <dialog> elements opened via showModal().
|
|
674
|
+
//
|
|
675
|
+
// The browser's ::backdrop and top-layer positioning are lost during
|
|
676
|
+
// DOM serialization. We stamp data-percy-dialog-modal so the renderer
|
|
677
|
+
// can call removeAttribute('open') then showModal() to restore them.
|
|
678
|
+
//
|
|
679
|
+
// The open attribute is kept so the dialog is visible during Percy's
|
|
680
|
+
// asset discovery and rendering phases.
|
|
681
|
+
function serializeDialogs(ctx) {
|
|
682
|
+
let {
|
|
683
|
+
dom,
|
|
684
|
+
clone
|
|
685
|
+
} = ctx;
|
|
686
|
+
for (let elem of dom.querySelectorAll('dialog[open]')) {
|
|
687
|
+
try {
|
|
688
|
+
let dialogId = elem.getAttribute('data-percy-element-id');
|
|
689
|
+
if (!dialogId) continue;
|
|
690
|
+
let cloneEl = clone.querySelector(`[data-percy-element-id="${dialogId}"]`);
|
|
691
|
+
if (!cloneEl) continue;
|
|
692
|
+
|
|
693
|
+
// Detect showModal() vs show()/setAttribute:
|
|
694
|
+
// :modal pseudo-class matches only dialogs in the top layer (opened via showModal())
|
|
695
|
+
if (!elem.matches(':modal')) continue;
|
|
696
|
+
|
|
697
|
+
// Mark for renderer — it will removeAttribute('open') then showModal()
|
|
698
|
+
cloneEl.setAttribute('data-percy-dialog-modal', 'true');
|
|
699
|
+
} catch (err) {
|
|
700
|
+
handleErrors(err, 'Error serializing dialog element: ', elem);
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
|
|
673
705
|
// Drop loading attribute. We do not scroll page in discovery stage but we want to make sure that
|
|
674
706
|
// all resources are requested, so we drop loading attribute [as it can be set to lazy]
|
|
675
707
|
function dropLoadingAttribute(domElement) {
|
|
@@ -950,6 +982,7 @@
|
|
|
950
982
|
serializeInputElements(ctx);
|
|
951
983
|
serializeFrames(ctx);
|
|
952
984
|
serializeVideos(ctx);
|
|
985
|
+
serializeDialogs(ctx);
|
|
953
986
|
if (!ctx.enableJavaScript) {
|
|
954
987
|
serializeCSSOM(ctx);
|
|
955
988
|
serializeCanvas(ctx);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@percy/dom",
|
|
3
|
-
"version": "1.31.
|
|
3
|
+
"version": "1.31.12-beta.0",
|
|
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": "65b6c76698560f85ef40bcb1687bcb2d4f409c61"
|
|
39
39
|
}
|